}
}
\f
-static void do_add_if(int argc, char *argv[]);
+static void dpctl_add_if(int argc, char *argv[]);
static int if_up(const char *netdev_name)
{
}
static void
-do_add_dp(int argc OVS_UNUSED, char *argv[])
+dpctl_add_dp(int argc OVS_UNUSED, char *argv[])
{
struct dpif *dpif;
run(parsed_dpif_open(argv[1], true, &dpif), "add_dp");
dpif_close(dpif);
if (argc > 2) {
- do_add_if(argc, argv);
+ dpctl_add_if(argc, argv);
}
}
static void
-do_del_dp(int argc OVS_UNUSED, char *argv[])
+dpctl_del_dp(int argc OVS_UNUSED, char *argv[])
{
struct dpif *dpif;
run(parsed_dpif_open(argv[1], false, &dpif), "opening datapath");
}
static void
-do_add_if(int argc OVS_UNUSED, char *argv[])
+dpctl_add_if(int argc OVS_UNUSED, char *argv[])
{
bool failure = false;
struct dpif *dpif;
}
static void
-do_set_if(int argc, char *argv[])
+dpctl_set_if(int argc, char *argv[])
{
bool failure = false;
struct dpif *dpif;
}
static void
-do_del_if(int argc OVS_UNUSED, char *argv[])
+dpctl_del_if(int argc OVS_UNUSED, char *argv[])
{
bool failure = false;
struct dpif *dpif;
}
static void
-do_show(int argc, char *argv[])
+dpctl_show(int argc, char *argv[])
{
bool failure = false;
if (argc > 1) {
}
static void
-do_dump_dps(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+dpctl_dump_dps(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
struct sset dpif_names, dpif_types;
const char *type;
}
static void
-do_dump_flows(int argc OVS_UNUSED, char *argv[])
+dpctl_dump_flows(int argc OVS_UNUSED, char *argv[])
{
const struct dpif_flow_stats *stats;
const struct nlattr *actions;
}
static void
-do_del_flows(int argc OVS_UNUSED, char *argv[])
+dpctl_del_flows(int argc OVS_UNUSED, char *argv[])
{
struct dpif *dpif;
}
static void
-do_help(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+dpctl_help(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
usage();
}
/* Undocumented commands for unit testing. */
static void
-do_parse_actions(int argc, char *argv[])
+dpctl_parse_actions(int argc, char *argv[])
{
int i;
* The idea here generalizes beyond VLANs (e.g. to setting other fields) but
* so far the implementation only covers VLANs. */
static void
-do_normalize_actions(int argc, char *argv[])
+dpctl_normalize_actions(int argc, char *argv[])
{
struct simap port_names;
struct ofpbuf keybuf;
}
static const struct command all_commands[] = {
- { "add-dp", 1, INT_MAX, do_add_dp },
- { "del-dp", 1, 1, do_del_dp },
- { "add-if", 2, INT_MAX, do_add_if },
- { "del-if", 2, INT_MAX, do_del_if },
- { "set-if", 2, INT_MAX, do_set_if },
- { "dump-dps", 0, 0, do_dump_dps },
- { "show", 0, INT_MAX, do_show },
- { "dump-flows", 1, 1, do_dump_flows },
- { "del-flows", 1, 1, do_del_flows },
- { "help", 0, INT_MAX, do_help },
+ { "add-dp", 1, INT_MAX, dpctl_add_dp },
+ { "del-dp", 1, 1, dpctl_del_dp },
+ { "add-if", 2, INT_MAX, dpctl_add_if },
+ { "del-if", 2, INT_MAX, dpctl_del_if },
+ { "set-if", 2, INT_MAX, dpctl_set_if },
+ { "dump-dps", 0, 0, dpctl_dump_dps },
+ { "show", 0, INT_MAX, dpctl_show },
+ { "dump-flows", 1, 1, dpctl_dump_flows },
+ { "del-flows", 1, 1, dpctl_del_flows },
+ { "help", 0, INT_MAX, dpctl_help },
/* Undocumented commands for testing. */
- { "parse-actions", 1, INT_MAX, do_parse_actions },
- { "normalize-actions", 2, INT_MAX, do_normalize_actions },
+ { "parse-actions", 1, INT_MAX, dpctl_parse_actions },
+ { "normalize-actions", 2, INT_MAX, dpctl_normalize_actions },
{ NULL, 0, 0, NULL },
};
}
static void
-do_show(int argc OVS_UNUSED, char *argv[])
+ofctl_show(int argc OVS_UNUSED, char *argv[])
{
const char *vconn_name = argv[1];
struct vconn *vconn;
}
static void
-do_dump_desc(int argc OVS_UNUSED, char *argv[])
+ofctl_dump_desc(int argc OVS_UNUSED, char *argv[])
{
dump_trivial_stats_transaction(argv[1], OFPST_DESC);
}
static void
-do_dump_tables(int argc OVS_UNUSED, char *argv[])
+ofctl_dump_tables(int argc OVS_UNUSED, char *argv[])
{
dump_trivial_stats_transaction(argv[1], OFPST_TABLE);
}
}
static void
-do_dump_flows__(int argc, char *argv[], bool aggregate)
+ofctl_dump_flows__(int argc, char *argv[], bool aggregate)
{
enum ofputil_protocol usable_protocols, protocol;
struct ofputil_flow_stats_request fsr;
}
static void
-do_dump_flows(int argc, char *argv[])
+ofctl_dump_flows(int argc, char *argv[])
{
- return do_dump_flows__(argc, argv, false);
+ return ofctl_dump_flows__(argc, argv, false);
}
static void
-do_dump_aggregate(int argc, char *argv[])
+ofctl_dump_aggregate(int argc, char *argv[])
{
- return do_dump_flows__(argc, argv, true);
+ return ofctl_dump_flows__(argc, argv, true);
}
static void
-do_queue_stats(int argc, char *argv[])
+ofctl_queue_stats(int argc, char *argv[])
{
struct ofp_queue_stats_request *req;
struct ofpbuf *request;
}
static void
-do_flow_mod__(const char *remote, struct ofputil_flow_mod *fms, size_t n_fms)
+ofctl_flow_mod__(const char *remote, struct ofputil_flow_mod *fms,
+ size_t n_fms)
{
enum ofputil_protocol protocol;
struct vconn *vconn;
}
static void
-do_flow_mod_file(int argc OVS_UNUSED, char *argv[], uint16_t command)
+ofctl_flow_mod_file(int argc OVS_UNUSED, char *argv[], uint16_t command)
{
struct ofputil_flow_mod *fms = NULL;
size_t n_fms = 0;
parse_ofp_flow_mod_file(argv[2], command, &fms, &n_fms);
- do_flow_mod__(argv[1], fms, n_fms);
+ ofctl_flow_mod__(argv[1], fms, n_fms);
free(fms);
}
static void
-do_flow_mod(int argc, char *argv[], uint16_t command)
+ofctl_flow_mod(int argc, char *argv[], uint16_t command)
{
if (argc > 2 && !strcmp(argv[2], "-")) {
- do_flow_mod_file(argc, argv, command);
+ ofctl_flow_mod_file(argc, argv, command);
} else {
struct ofputil_flow_mod fm;
parse_ofp_flow_mod_str(&fm, argc > 2 ? argv[2] : "", command, false);
- do_flow_mod__(argv[1], &fm, 1);
+ ofctl_flow_mod__(argv[1], &fm, 1);
}
}
static void
-do_add_flow(int argc, char *argv[])
+ofctl_add_flow(int argc, char *argv[])
{
- do_flow_mod(argc, argv, OFPFC_ADD);
+ ofctl_flow_mod(argc, argv, OFPFC_ADD);
}
static void
-do_add_flows(int argc, char *argv[])
+ofctl_add_flows(int argc, char *argv[])
{
- do_flow_mod_file(argc, argv, OFPFC_ADD);
+ ofctl_flow_mod_file(argc, argv, OFPFC_ADD);
}
static void
-do_mod_flows(int argc, char *argv[])
+ofctl_mod_flows(int argc, char *argv[])
{
- do_flow_mod(argc, argv, strict ? OFPFC_MODIFY_STRICT : OFPFC_MODIFY);
+ ofctl_flow_mod(argc, argv, strict ? OFPFC_MODIFY_STRICT : OFPFC_MODIFY);
}
static void
-do_del_flows(int argc, char *argv[])
+ofctl_del_flows(int argc, char *argv[])
{
- do_flow_mod(argc, argv, strict ? OFPFC_DELETE_STRICT : OFPFC_DELETE);
+ ofctl_flow_mod(argc, argv, strict ? OFPFC_DELETE_STRICT : OFPFC_DELETE);
}
static void
}
static void
-do_monitor(int argc, char *argv[])
+ofctl_monitor(int argc, char *argv[])
{
struct vconn *vconn;
}
static void
-do_snoop(int argc OVS_UNUSED, char *argv[])
+ofctl_snoop(int argc OVS_UNUSED, char *argv[])
{
struct vconn *vconn;
}
static void
-do_dump_ports(int argc, char *argv[])
+ofctl_dump_ports(int argc, char *argv[])
{
struct ofp_port_stats_request *req;
struct ofpbuf *request;
}
static void
-do_dump_ports_desc(int argc OVS_UNUSED, char *argv[])
+ofctl_dump_ports_desc(int argc OVS_UNUSED, char *argv[])
{
dump_trivial_stats_transaction(argv[1], OFPST_PORT_DESC);
}
static void
-do_probe(int argc OVS_UNUSED, char *argv[])
+ofctl_probe(int argc OVS_UNUSED, char *argv[])
{
struct ofpbuf *request;
struct vconn *vconn;
}
static void
-do_packet_out(int argc, char *argv[])
+ofctl_packet_out(int argc, char *argv[])
{
struct ofputil_packet_out po;
struct ofpbuf ofpacts;
}
static void
-do_mod_port(int argc OVS_UNUSED, char *argv[])
+ofctl_mod_port(int argc OVS_UNUSED, char *argv[])
{
struct ofp_config_flag {
const char *name; /* The flag's name. */
}
static void
-do_get_frags(int argc OVS_UNUSED, char *argv[])
+ofctl_get_frags(int argc OVS_UNUSED, char *argv[])
{
struct ofp_switch_config config;
struct vconn *vconn;
}
static void
-do_set_frags(int argc OVS_UNUSED, char *argv[])
+ofctl_set_frags(int argc OVS_UNUSED, char *argv[])
{
struct ofp_switch_config config;
enum ofp_config_flags mode;
}
static void
-do_ping(int argc, char *argv[])
+ofctl_ping(int argc, char *argv[])
{
size_t max_payload = 65535 - sizeof(struct ofp_header);
unsigned int payload;
}
static void
-do_benchmark(int argc OVS_UNUSED, char *argv[])
+ofctl_benchmark(int argc OVS_UNUSED, char *argv[])
{
size_t max_payload = 65535 - sizeof(struct ofp_header);
struct timeval start, end;
}
static void
-do_help(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+ofctl_help(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
usage();
}
}
static void
-do_replace_flows(int argc OVS_UNUSED, char *argv[])
+ofctl_replace_flows(int argc OVS_UNUSED, char *argv[])
{
enum { FILE_IDX = 0, SWITCH_IDX = 1 };
enum ofputil_protocol usable_protocols, protocol;
}
static void
-do_diff_flows(int argc OVS_UNUSED, char *argv[])
+ofctl_diff_flows(int argc OVS_UNUSED, char *argv[])
{
bool differences = false;
struct cls_cursor cursor;
/* Undocumented commands for unit testing. */
static void
-do_parse_flows__(struct ofputil_flow_mod *fms, size_t n_fms)
+ofctl_parse_flows__(struct ofputil_flow_mod *fms, size_t n_fms)
{
enum ofputil_protocol usable_protocols;
enum ofputil_protocol protocol = 0;
/* "parse-flow FLOW": parses the argument as a flow (like add-flow) and prints
* it back to stdout. */
static void
-do_parse_flow(int argc OVS_UNUSED, char *argv[])
+ofctl_parse_flow(int argc OVS_UNUSED, char *argv[])
{
struct ofputil_flow_mod fm;
parse_ofp_flow_mod_str(&fm, argv[1], OFPFC_ADD, false);
- do_parse_flows__(&fm, 1);
+ ofctl_parse_flows__(&fm, 1);
}
/* "parse-flows FILENAME": reads the named file as a sequence of flows (like
* add-flows) and prints each of the flows back to stdout. */
static void
-do_parse_flows(int argc OVS_UNUSED, char *argv[])
+ofctl_parse_flows(int argc OVS_UNUSED, char *argv[])
{
struct ofputil_flow_mod *fms = NULL;
size_t n_fms = 0;
parse_ofp_flow_mod_file(argv[1], OFPFC_ADD, &fms, &n_fms);
- do_parse_flows__(fms, n_fms);
+ ofctl_parse_flows__(fms, n_fms);
free(fms);
}
static void
-do_parse_nxm__(bool oxm)
+ofctl_parse_nxm__(bool oxm)
{
struct ds in;
* stdin, does some internal fussing with them, and then prints them back as
* strings on stdout. */
static void
-do_parse_nxm(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+ofctl_parse_nxm(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
- return do_parse_nxm__(false);
+ return ofctl_parse_nxm__(false);
}
/* "parse-oxm": reads a series of OXM nx_match specifications as strings from
* stdin, does some internal fussing with them, and then prints them back as
* strings on stdout. */
static void
-do_parse_oxm(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+ofctl_parse_oxm(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
- return do_parse_nxm__(true);
+ return ofctl_parse_nxm__(true);
}
static void
* on stdout, and then converts them back to hex bytes and prints any
* differences from the input. */
static void
-do_parse_ofp10_actions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+ofctl_parse_ofp10_actions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
struct ds in;
* stdout, and then converts them back to hex bytes and prints any differences
* from the input. */
static void
-do_parse_ofp11_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+ofctl_parse_ofp11_match(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
struct ds in;
* on stdout, and then converts them back to hex bytes and prints any
* differences from the input. */
static void
-do_parse_ofp11_actions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+ofctl_parse_ofp11_actions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
struct ds in;
* them as strings on stdout, and then converts them back to hex bytes and
* prints any differences from the input. */
static void
-do_parse_ofp11_instructions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+ofctl_parse_ofp11_instructions(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
struct ds in;
/* "print-error ENUM": Prints the type and code of ENUM for every OpenFlow
* version. */
static void
-do_print_error(int argc OVS_UNUSED, char *argv[])
+ofctl_print_error(int argc OVS_UNUSED, char *argv[])
{
enum ofperr error;
int version;
* binary data, interpreting them as an OpenFlow message, and prints the
* OpenFlow message on stdout, at VERBOSITY (level 2 by default). */
static void
-do_ofp_print(int argc, char *argv[])
+ofctl_ofp_print(int argc, char *argv[])
{
struct ofpbuf packet;
}
static const struct command all_commands[] = {
- { "show", 1, 1, do_show },
- { "monitor", 1, 3, do_monitor },
- { "snoop", 1, 1, do_snoop },
- { "dump-desc", 1, 1, do_dump_desc },
- { "dump-tables", 1, 1, do_dump_tables },
- { "dump-flows", 1, 2, do_dump_flows },
- { "dump-aggregate", 1, 2, do_dump_aggregate },
- { "queue-stats", 1, 3, do_queue_stats },
- { "add-flow", 2, 2, do_add_flow },
- { "add-flows", 2, 2, do_add_flows },
- { "mod-flows", 2, 2, do_mod_flows },
- { "del-flows", 1, 2, do_del_flows },
- { "replace-flows", 2, 2, do_replace_flows },
- { "diff-flows", 2, 2, do_diff_flows },
- { "packet-out", 4, INT_MAX, do_packet_out },
- { "dump-ports", 1, 2, do_dump_ports },
- { "dump-ports-desc", 1, 1, do_dump_ports_desc },
- { "mod-port", 3, 3, do_mod_port },
- { "get-frags", 1, 1, do_get_frags },
- { "set-frags", 2, 2, do_set_frags },
- { "probe", 1, 1, do_probe },
- { "ping", 1, 2, do_ping },
- { "benchmark", 3, 3, do_benchmark },
- { "help", 0, INT_MAX, do_help },
+ { "show", 1, 1, ofctl_show },
+ { "monitor", 1, 3, ofctl_monitor },
+ { "snoop", 1, 1, ofctl_snoop },
+ { "dump-desc", 1, 1, ofctl_dump_desc },
+ { "dump-tables", 1, 1, ofctl_dump_tables },
+ { "dump-flows", 1, 2, ofctl_dump_flows },
+ { "dump-aggregate", 1, 2, ofctl_dump_aggregate },
+ { "queue-stats", 1, 3, ofctl_queue_stats },
+ { "add-flow", 2, 2, ofctl_add_flow },
+ { "add-flows", 2, 2, ofctl_add_flows },
+ { "mod-flows", 2, 2, ofctl_mod_flows },
+ { "del-flows", 1, 2, ofctl_del_flows },
+ { "replace-flows", 2, 2, ofctl_replace_flows },
+ { "diff-flows", 2, 2, ofctl_diff_flows },
+ { "packet-out", 4, INT_MAX, ofctl_packet_out },
+ { "dump-ports", 1, 2, ofctl_dump_ports },
+ { "dump-ports-desc", 1, 1, ofctl_dump_ports_desc },
+ { "mod-port", 3, 3, ofctl_mod_port },
+ { "get-frags", 1, 1, ofctl_get_frags },
+ { "set-frags", 2, 2, ofctl_set_frags },
+ { "probe", 1, 1, ofctl_probe },
+ { "ping", 1, 2, ofctl_ping },
+ { "benchmark", 3, 3, ofctl_benchmark },
+ { "help", 0, INT_MAX, ofctl_help },
/* Undocumented commands for testing. */
- { "parse-flow", 1, 1, do_parse_flow },
- { "parse-flows", 1, 1, do_parse_flows },
- { "parse-nx-match", 0, 0, do_parse_nxm },
- { "parse-nxm", 0, 0, do_parse_nxm },
- { "parse-oxm", 0, 0, do_parse_oxm },
- { "parse-ofp10-actions", 0, 0, do_parse_ofp10_actions },
- { "parse-ofp11-match", 0, 0, do_parse_ofp11_match },
- { "parse-ofp11-actions", 0, 0, do_parse_ofp11_actions },
- { "parse-ofp11-instructions", 0, 0, do_parse_ofp11_instructions },
- { "print-error", 1, 1, do_print_error },
- { "ofp-print", 1, 2, do_ofp_print },
+ { "parse-flow", 1, 1, ofctl_parse_flow },
+ { "parse-flows", 1, 1, ofctl_parse_flows },
+ { "parse-nx-match", 0, 0, ofctl_parse_nxm },
+ { "parse-nxm", 0, 0, ofctl_parse_nxm },
+ { "parse-oxm", 0, 0, ofctl_parse_oxm },
+ { "parse-ofp10-actions", 0, 0, ofctl_parse_ofp10_actions },
+ { "parse-ofp11-match", 0, 0, ofctl_parse_ofp11_match },
+ { "parse-ofp11-actions", 0, 0, ofctl_parse_ofp11_actions },
+ { "parse-ofp11-instructions", 0, 0, ofctl_parse_ofp11_instructions },
+ { "print-error", 1, 1, ofctl_print_error },
+ { "ofp-print", 1, 2, ofctl_ofp_print },
{ NULL, 0, 0, NULL },
};