]> git.proxmox.com Git - mirror_ovs.git/blame - ovsdb/monitor.h
ovsdb-client: Fix memory leaks
[mirror_ovs.git] / ovsdb / monitor.h
CommitLineData
2fa1df7b
AZ
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
20struct ovsdb_monitor;
85226894 21struct ovsdb_jsonrpc_monitor;
71cdf7cd
LS
22struct ovsdb_monitor_session_condition;
23struct ovsdb_condition;
2fa1df7b
AZ
24
25enum ovsdb_monitor_selection {
71cdf7cd 26 OJMS_NONE = 0, /* None for this iteration */
2fa1df7b
AZ
27 OJMS_INITIAL = 1 << 0, /* All rows when monitor is created. */
28 OJMS_INSERT = 1 << 1, /* New rows. */
29 OJMS_DELETE = 1 << 2, /* Deleted rows. */
30 OJMS_MODIFY = 1 << 3 /* Modified rows. */
31};
32
33
52553aea
AZ
34enum ovsdb_monitor_version {
35 OVSDB_MONITOR_V1, /* RFC 7047 "monitor" method. */
36 OVSDB_MONITOR_V2, /* Extension to RFC 7047, see ovsdb-server
37 man page for details. */
38
39 /* Last entry. */
40 OVSDB_MONITOR_VERSION_MAX
41};
42
2fa1df7b 43struct ovsdb_monitor *ovsdb_monitor_create(struct ovsdb *db,
6e5a9216
AZ
44 struct ovsdb_jsonrpc_monitor *jsonrpc_monitor);
45
46struct ovsdb_monitor *ovsdb_monitor_add(struct ovsdb_monitor *dbmon);
47
48void ovsdb_monitor_add_jsonrpc_monitor(struct ovsdb_monitor *dbmon,
49 struct ovsdb_jsonrpc_monitor *jsonrpc_monitor);
50
51void ovsdb_monitor_remove_jsonrpc_monitor(struct ovsdb_monitor *dbmon,
f76def25
AZ
52 struct ovsdb_jsonrpc_monitor *jsonrpc_monitor,
53 uint64_t unflushed);
d9412837 54
2fa1df7b
AZ
55void ovsdb_monitor_add_table(struct ovsdb_monitor *m,
56 const struct ovsdb_table *table);
57
ec1eadce 58const char * ovsdb_monitor_add_column(struct ovsdb_monitor *dbmon,
845a1187
LS
59 const struct ovsdb_table *table,
60 const struct ovsdb_column *column,
61 enum ovsdb_monitor_selection select,
62 bool monitored);
63bool
64ovsdb_monitor_table_exists(struct ovsdb_monitor *m,
65 const struct ovsdb_table *table);
66
67struct json *ovsdb_monitor_get_update(struct ovsdb_monitor *dbmon,
68 bool initial,
69 bool cond_updated,
70 uint64_t *unflushed_transaction,
71 struct ovsdb_monitor_session_condition *condition,
72 enum ovsdb_monitor_version version);
2fa1df7b
AZ
73
74void ovsdb_monitor_table_add_select(struct ovsdb_monitor *dbmon,
75 const struct ovsdb_table *table,
76 enum ovsdb_monitor_selection select);
77
59c35e11
AZ
78bool ovsdb_monitor_needs_flush(struct ovsdb_monitor *dbmon,
79 uint64_t next_transaction);
2fa1df7b 80
61b63013 81void ovsdb_monitor_get_initial(const struct ovsdb_monitor *dbmon);
e0c73ed1
AZ
82
83void ovsdb_monitor_get_memory_usage(struct simap *usage);
71cdf7cd
LS
84
85struct ovsdb_monitor_session_condition *
86ovsdb_monitor_session_condition_create(void);
87
88void
89ovsdb_monitor_session_condition_destroy(
90 struct ovsdb_monitor_session_condition *condition);
91struct ovsdb_error *
92ovsdb_monitor_table_condition_create(
93 struct ovsdb_monitor_session_condition *condition,
94 const struct ovsdb_table *table,
95 const struct json *json_cnd);
96
97void
98ovsdb_monitor_condition_bind(struct ovsdb_monitor *dbmon,
99 struct ovsdb_monitor_session_condition *cond);
100
845a1187
LS
101struct ovsdb_error *
102ovsdb_monitor_table_condition_update(
103 struct ovsdb_monitor *dbmon,
104 struct ovsdb_monitor_session_condition *condition,
105 const struct ovsdb_table *table,
106 const struct json *cond_json);
107
2fa1df7b 108#endif