2 * Copyright (c) 2015, 2017 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
23 struct ovsdb_jsonrpc_monitor
;
24 struct ovsdb_monitor_session_condition
;
25 struct ovsdb_condition
;
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. */
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
46 OVSDB_MONITOR_VERSION_MAX
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
*);
54 void ovsdb_monitor_prereplace_db(struct ovsdb
*);
56 struct ovsdb_monitor
*ovsdb_monitor_add(struct ovsdb_monitor
*);
58 void ovsdb_monitor_add_jsonrpc_monitor(struct ovsdb_monitor
*,
59 struct ovsdb_jsonrpc_monitor
*);
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
*);
66 void ovsdb_monitor_add_table(struct ovsdb_monitor
*,
67 const struct ovsdb_table
*);
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
,
75 ovsdb_monitor_table_exists(struct ovsdb_monitor
*,
76 const struct ovsdb_table
*);
78 struct json
*ovsdb_monitor_get_update(struct ovsdb_monitor
*,
81 struct ovsdb_monitor_session_condition
*,
82 enum ovsdb_monitor_version
,
83 struct ovsdb_monitor_change_set
**p_mcs
);
85 const struct uuid
*ovsdb_monitor_get_last_txnid(struct ovsdb_monitor
*);
87 void ovsdb_monitor_table_add_select(struct ovsdb_monitor
*,
88 const struct ovsdb_table
*,
89 enum ovsdb_monitor_selection
);
91 bool ovsdb_monitor_needs_flush(struct ovsdb_monitor
*,
92 struct ovsdb_monitor_change_set
*);
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
**);
99 void ovsdb_monitor_get_memory_usage(struct simap
*);
101 struct ovsdb_monitor_session_condition
*
102 ovsdb_monitor_session_condition_create(void);
105 ovsdb_monitor_session_condition_destroy(
106 struct ovsdb_monitor_session_condition
*);
108 ovsdb_monitor_table_condition_create(
109 struct ovsdb_monitor_session_condition
*,
110 const struct ovsdb_table
*,
111 const struct json
*json_cnd
);
114 ovsdb_monitor_condition_bind(struct ovsdb_monitor
*,
115 struct ovsdb_monitor_session_condition
*);
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
);