]> git.proxmox.com Git - mirror_ovs.git/blob - ovsdb/monitor.h
dist-docs: Include manpages generated from rST.
[mirror_ovs.git] / ovsdb / monitor.h
1 /*
2 * Copyright (c) 2015, 2017 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;
21 struct ovsdb_column;
22 struct ovsdb_monitor;
23 struct ovsdb_jsonrpc_monitor;
24 struct ovsdb_monitor_session_condition;
25 struct ovsdb_condition;
26 struct ovsdb_txn;
27 struct simap;
28
29 enum ovsdb_monitor_selection {
30 OJMS_NONE = 0, /* None for this iteration */
31 OJMS_INITIAL = 1 << 0, /* All rows when monitor is created. */
32 OJMS_INSERT = 1 << 1, /* New rows. */
33 OJMS_DELETE = 1 << 2, /* Deleted rows. */
34 OJMS_MODIFY = 1 << 3 /* Modified rows. */
35 };
36
37
38 enum ovsdb_monitor_version {
39 OVSDB_MONITOR_V1, /* RFC 7047 "monitor" method. */
40 OVSDB_MONITOR_V2, /* Extension to RFC 7047, see ovsdb-server
41 man page for details. */
42 OVSDB_MONITOR_V3, /* Extension to V2, see ovsdb-server man
43 page for details. */
44
45 /* Last entry. */
46 OVSDB_MONITOR_VERSION_MAX
47 };
48
49 struct ovsdb_monitor *ovsdb_monitor_create(struct ovsdb *,
50 struct ovsdb_jsonrpc_monitor *);
51 void ovsdb_monitors_remove(struct ovsdb *);
52 void ovsdb_monitors_commit(struct ovsdb *, const struct ovsdb_txn *);
53
54 void ovsdb_monitor_prereplace_db(struct ovsdb *);
55
56 struct ovsdb_monitor *ovsdb_monitor_add(struct ovsdb_monitor *);
57
58 void ovsdb_monitor_add_jsonrpc_monitor(struct ovsdb_monitor *,
59 struct ovsdb_jsonrpc_monitor *);
60
61 struct ovsdb_monitor_change_set;
62 void ovsdb_monitor_remove_jsonrpc_monitor(struct ovsdb_monitor *,
63 struct ovsdb_jsonrpc_monitor *,
64 struct ovsdb_monitor_change_set *);
65
66 void ovsdb_monitor_add_table(struct ovsdb_monitor *,
67 const struct ovsdb_table *);
68
69 const char * ovsdb_monitor_add_column(struct ovsdb_monitor *,
70 const struct ovsdb_table *,
71 const struct ovsdb_column *,
72 enum ovsdb_monitor_selection,
73 bool monitored);
74 bool
75 ovsdb_monitor_table_exists(struct ovsdb_monitor *,
76 const struct ovsdb_table *);
77
78 struct json *ovsdb_monitor_get_update(struct ovsdb_monitor *,
79 bool initial,
80 bool cond_updated,
81 struct ovsdb_monitor_session_condition *,
82 enum ovsdb_monitor_version,
83 struct ovsdb_monitor_change_set **p_mcs);
84
85 const struct uuid *ovsdb_monitor_get_last_txnid(struct ovsdb_monitor *);
86
87 void ovsdb_monitor_table_add_select(struct ovsdb_monitor *,
88 const struct ovsdb_table *,
89 enum ovsdb_monitor_selection);
90
91 bool ovsdb_monitor_needs_flush(struct ovsdb_monitor *,
92 struct ovsdb_monitor_change_set *);
93
94 void ovsdb_monitor_get_initial(struct ovsdb_monitor *,
95 struct ovsdb_monitor_change_set **);
96 void ovsdb_monitor_get_changes_after(const struct uuid *txn_uuid,
97 struct ovsdb_monitor *, struct ovsdb_monitor_change_set **);
98
99 void ovsdb_monitor_get_memory_usage(struct simap *);
100
101 struct ovsdb_monitor_session_condition *
102 ovsdb_monitor_session_condition_create(void);
103
104 void
105 ovsdb_monitor_session_condition_destroy(
106 struct ovsdb_monitor_session_condition *);
107 struct ovsdb_error *
108 ovsdb_monitor_table_condition_create(
109 struct ovsdb_monitor_session_condition *,
110 const struct ovsdb_table *,
111 const struct json *json_cnd);
112
113 void
114 ovsdb_monitor_condition_bind(struct ovsdb_monitor *,
115 struct ovsdb_monitor_session_condition *);
116
117 struct ovsdb_error *
118 ovsdb_monitor_table_condition_update(
119 struct ovsdb_monitor *,
120 struct ovsdb_monitor_session_condition *,
121 const struct ovsdb_table *,
122 const struct json *cond_json);
123
124 #endif