- monitor_request = json_object_create();
- json_object_put(monitor_request,
- "columns", ovsdb_column_set_to_json(&columns));
- if (select) {
- json_object_put(monitor_request, "select", select);
+ return mr;
+}
+
+static void
+do_monitor(int argc, char *argv[])
+{
+ const char *server = argv[1];
+ const char *database = argv[2];
+ const char *table_name = argv[3];
+ struct ovsdb_column_set columns = OVSDB_COLUMN_SET_INITIALIZER;
+ struct ovsdb_table_schema *table;
+ struct ovsdb_schema *schema;
+ struct jsonrpc_msg *request;
+ struct jsonrpc *rpc;
+ struct json *monitor, *monitor_request_array,
+ *monitor_requests, *request_id;
+
+ rpc = open_jsonrpc(server);
+
+ schema = fetch_schema_from_rpc(rpc, database);
+ table = shash_find_data(&schema->tables, table_name);
+ if (!table) {
+ ovs_fatal(0, "%s: %s does not have a table named \"%s\"",
+ server, database, table_name);
+ }
+
+ monitor_request_array = json_array_create_empty();
+ if (argc > 4) {
+ int i;
+
+ for (i = 4; i < argc; i++) {
+ json_array_add(
+ monitor_request_array,
+ parse_monitor_columns(argv[i], server, database, table,
+ &columns));
+ }
+ } else {
+ /* Allocate a writable empty string since parse_monitor_columns() is
+ * going to strtok() it and that's risky with literal "". */
+ char empty[] = "";
+ json_array_add(
+ monitor_request_array,
+ parse_monitor_columns(empty, server, database, table, &columns));