]> git.proxmox.com Git - ovs.git/blob - ovsdb/monitor.h
ovsdb-server: Fix a reference count leak bug
[ovs.git] / ovsdb / monitor.h
1 /*
2 * Copyright (c) 2015 Nicira, Inc.
3 *
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:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 #ifndef OVSDB_MONITOR_H
18 #define OVSDB_MONITOR_H
19
20 struct ovsdb_monitor;
21 struct ovsdb_jsonrpc_monitor;
22
23 enum ovsdb_monitor_selection {
24 OJMS_INITIAL = 1 << 0, /* All rows when monitor is created. */
25 OJMS_INSERT = 1 << 1, /* New rows. */
26 OJMS_DELETE = 1 << 2, /* Deleted rows. */
27 OJMS_MODIFY = 1 << 3 /* Modified rows. */
28 };
29
30
31 enum ovsdb_monitor_version {
32 OVSDB_MONITOR_V1, /* RFC 7047 "monitor" method. */
33 OVSDB_MONITOR_V2, /* Extension to RFC 7047, see ovsdb-server
34 man page for details. */
35
36 /* Last entry. */
37 OVSDB_MONITOR_VERSION_MAX
38 };
39
40 struct ovsdb_monitor *ovsdb_monitor_create(struct ovsdb *db,
41 struct ovsdb_jsonrpc_monitor *jsonrpc_monitor);
42
43 struct ovsdb_monitor *ovsdb_monitor_add(struct ovsdb_monitor *dbmon);
44
45 void ovsdb_monitor_add_jsonrpc_monitor(struct ovsdb_monitor *dbmon,
46 struct ovsdb_jsonrpc_monitor *jsonrpc_monitor);
47
48 void ovsdb_monitor_remove_jsonrpc_monitor(struct ovsdb_monitor *dbmon,
49 struct ovsdb_jsonrpc_monitor *jsonrpc_monitor,
50 uint64_t unflushed);
51
52 void ovsdb_monitor_add_table(struct ovsdb_monitor *m,
53 const struct ovsdb_table *table);
54
55 void ovsdb_monitor_add_column(struct ovsdb_monitor *dbmon,
56 const struct ovsdb_table *table,
57 const struct ovsdb_column *column,
58 enum ovsdb_monitor_selection select,
59 size_t *allocated_columns);
60
61 const char * OVS_WARN_UNUSED_RESULT
62 ovsdb_monitor_table_check_duplicates(struct ovsdb_monitor *,
63 const struct ovsdb_table *);
64
65 struct json *ovsdb_monitor_get_update(struct ovsdb_monitor *dbmon,
66 bool initial,
67 uint64_t *unflushed_transaction,
68 enum ovsdb_monitor_version version);
69
70 void ovsdb_monitor_table_add_select(struct ovsdb_monitor *dbmon,
71 const struct ovsdb_table *table,
72 enum ovsdb_monitor_selection select);
73
74 bool ovsdb_monitor_needs_flush(struct ovsdb_monitor *dbmon,
75 uint64_t next_transaction);
76
77 void ovsdb_monitor_get_initial(const struct ovsdb_monitor *dbmon);
78
79 void ovsdb_monitor_get_memory_usage(struct simap *usage);
80 #endif