+ ovsdb_symbol_table_destroy(symtab);
+ for (c = commands; c < &commands[n_commands]; c++) {
+ ds_destroy(&c->output);
+ table_destroy(c->table);
+ free(c->table);
+ }
+ free(error);
+}
+
+/* Frees the current transaction and the underlying IDL and then calls
+ * exit(status).
+ *
+ * Freeing the transaction and the IDL is not strictly necessary, but it makes
+ * for a clean memory leak report from valgrind in the normal case. That makes
+ * it easier to notice real memory leaks. */
+static void
+nbctl_exit(int status)
+{
+ if (the_idl_txn) {
+ ovsdb_idl_txn_abort(the_idl_txn);
+ ovsdb_idl_txn_destroy(the_idl_txn);
+ }
+ ovsdb_idl_destroy(the_idl);
+ exit(status);
+}
+
+static const struct ctl_command_syntax nbctl_commands[] = {
+ { "show", 0, 1, "[LSWITCH]", NULL, nbctl_show, NULL, "", RO },
+
+ /* lswitch commands. */
+ { "lswitch-add", 0, 1, "[LSWITCH]", NULL, nbctl_lswitch_add,
+ NULL, "", RW },
+ { "lswitch-del", 1, 1, "LSWITCH", NULL, nbctl_lswitch_del,
+ NULL, "", RW },
+ { "lswitch-list", 0, 0, "", NULL, nbctl_lswitch_list, NULL, "", RO },
+ { "lswitch-set-external-id", 2, 3, "LSWITCH KEY [VALUE]", NULL,
+ nbctl_lswitch_set_external_id, NULL, "", RW },
+ { "lswitch-get-external-id", 1, 2, "LSWITCH [KEY]", NULL,
+ nbctl_lswitch_get_external_id, NULL, "", RO },
+
+ /* acl commands. */
+ { "acl-add", 5, 5, "LSWITCH DIRECTION PRIORITY MATCH ACTION", NULL,
+ nbctl_acl_add, NULL, "--log", RW },
+ { "acl-del", 1, 4, "LSWITCH [DIRECTION [PRIORITY MATCH]]", NULL,
+ nbctl_acl_del, NULL, "", RW },
+ { "acl-list", 1, 1, "LSWITCH", NULL, nbctl_acl_list, NULL, "", RO },
+
+ /* lport commands. */
+ { "lport-add", 2, 4, "LSWITCH LPORT [PARENT] [TAG]", NULL, nbctl_lport_add,
+ NULL, "", RW },
+ { "lport-del", 1, 1, "LPORT", NULL, nbctl_lport_del, NULL, "", RO },
+ { "lport-list", 1, 1, "LSWITCH", NULL, nbctl_lport_list, NULL, "", RO },
+ { "lport-get-parent", 1, 1, "LPORT", NULL, nbctl_lport_get_parent, NULL,
+ "", RO },
+ { "lport-get-tag", 1, 1, "LPORT", NULL, nbctl_lport_get_tag, NULL, "",
+ RO },
+ { "lport-set-external-id", 2, 3, "LPORT KEY [VALUE]", NULL,
+ nbctl_lport_set_external_id, NULL, "", RW },
+ { "lport-get-external-id", 1, 2, "LPORT [KEY]", NULL,
+ nbctl_lport_get_external_id, NULL, "", RO },
+ { "lport-set-macs", 1, INT_MAX, "LPORT [MAC]...", NULL,
+ nbctl_lport_set_macs, NULL, "", RW },
+ { "lport-get-macs", 1, 1, "LPORT", NULL, nbctl_lport_get_macs, NULL,
+ "", RO },
+ { "lport-set-port-security", 0, INT_MAX, "LPORT [ADDRS]...", NULL,
+ nbctl_lport_set_port_security, NULL, "", RW },
+ { "lport-get-port-security", 1, 1, "LPORT", NULL,
+ nbctl_lport_get_port_security, NULL, "", RO },
+ { "lport-get-up", 1, 1, "LPORT", NULL, nbctl_lport_get_up, NULL, "", RO },
+ { "lport-set-enabled", 2, 2, "LPORT STATE", NULL, nbctl_lport_set_enabled,
+ NULL, "", RW },
+ { "lport-get-enabled", 1, 1, "LPORT", NULL, nbctl_lport_get_enabled, NULL,
+ "", RO },
+ { "lport-set-type", 2, 2, "LPORT TYPE", NULL, nbctl_lport_set_type, NULL,
+ "", RW },
+ { "lport-get-type", 1, 1, "LPORT", NULL, nbctl_lport_get_type, NULL, "",
+ RO },
+ { "lport-set-options", 1, INT_MAX, "LPORT KEY=VALUE [KEY=VALUE]...", NULL,
+ nbctl_lport_set_options, NULL, "", RW },
+ { "lport-get-options", 1, 1, "LPORT", NULL, nbctl_lport_get_options, NULL,
+ "", RO },
+
+ {NULL, 0, 0, NULL, NULL, NULL, NULL, "", RO},
+};