2 * Copyright (c) 2015 Nicira, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef OVSDB_MONITOR_H
18 #define OVSDB_MONITOR_H
22 enum ovsdb_monitor_selection {
23 OJMS_INITIAL = 1 << 0, /* All rows when monitor is created. */
24 OJMS_INSERT = 1 << 1, /* New rows. */
25 OJMS_DELETE = 1 << 2, /* Deleted rows. */
26 OJMS_MODIFY = 1 << 3 /* Modified rows. */
30 struct ovsdb_monitor *ovsdb_monitor_create(struct ovsdb *db,
31 struct ovsdb_jsonrpc_monitor *jsonrpc_monitor);
33 void ovsdb_monitor_remove_jsonrpc_monitor(struct ovsdb_monitor *dbmon,
34 struct ovsdb_jsonrpc_monitor *jsonrpc_monitor);
36 void ovsdb_monitor_add_table(struct ovsdb_monitor *m,
37 const struct ovsdb_table *table);
39 void ovsdb_monitor_add_column(struct ovsdb_monitor *dbmon,
40 const struct ovsdb_table *table,
41 const struct ovsdb_column *column,
42 enum ovsdb_monitor_selection select,
43 size_t *allocated_columns);
45 const char * OVS_WARN_UNUSED_RESULT
46 ovsdb_monitor_table_check_duplicates(struct ovsdb_monitor *,
47 const struct ovsdb_table *);
49 struct json *ovsdb_monitor_compose_table_update(
50 const struct ovsdb_monitor *dbmon, bool initial);
52 void ovsdb_monitor_table_add_select(struct ovsdb_monitor *dbmon,
53 const struct ovsdb_table *table,
54 enum ovsdb_monitor_selection select);
56 bool ovsdb_monitor_needs_flush(struct ovsdb_monitor *dbmon);
58 void ovsdb_monitor_get_initial(const struct ovsdb_monitor *dbmon);