Branch data Line data Source code
1 : : /* Generated automatically -- do not modify! -*- buffer-read-only: t -*- */
2 : :
3 : : #include <config.h>
4 : : #include "ovn/lib/ovn-sb-idl.h"
5 : : #include <limits.h>
6 : : #include "ovs-thread.h"
7 : : #include "ovsdb-data.h"
8 : : #include "ovsdb-error.h"
9 : : #include "util.h"
10 : :
11 : : #ifdef __CHECKER__
12 : : /* Sparse dislikes sizeof(bool) ("warning: expression using sizeof bool"). */
13 : : enum { sizeof_bool = 1 };
14 : : #else
15 : : enum { sizeof_bool = sizeof(bool) };
16 : : #endif
17 : :
18 : : static bool inited;
19 : :
20 : :
21 : : static struct sbrec_address_set *
22 : 5592 : sbrec_address_set_cast(const struct ovsdb_idl_row *row)
23 : : {
24 : 5592 : return row ? CONTAINER_OF(row, struct sbrec_address_set, header_) : NULL;
25 : : }
26 : :
27 : : static struct sbrec_chassis *
28 : 38572 : sbrec_chassis_cast(const struct ovsdb_idl_row *row)
29 : : {
30 : 38572 : return row ? CONTAINER_OF(row, struct sbrec_chassis, header_) : NULL;
31 : : }
32 : :
33 : : static struct sbrec_dhcp_options *
34 : 149503 : sbrec_dhcp_options_cast(const struct ovsdb_idl_row *row)
35 : : {
36 : 149503 : return row ? CONTAINER_OF(row, struct sbrec_dhcp_options, header_) : NULL;
37 : : }
38 : :
39 : : static struct sbrec_dhcpv6_options *
40 : 29622 : sbrec_dhcpv6_options_cast(const struct ovsdb_idl_row *row)
41 : : {
42 : 29622 : return row ? CONTAINER_OF(row, struct sbrec_dhcpv6_options, header_) : NULL;
43 : : }
44 : :
45 : : static struct sbrec_datapath_binding *
46 : 38195 : sbrec_datapath_binding_cast(const struct ovsdb_idl_row *row)
47 : : {
48 : 38195 : return row ? CONTAINER_OF(row, struct sbrec_datapath_binding, header_) : NULL;
49 : : }
50 : :
51 : : static struct sbrec_encap *
52 : 3260 : sbrec_encap_cast(const struct ovsdb_idl_row *row)
53 : : {
54 : 3260 : return row ? CONTAINER_OF(row, struct sbrec_encap, header_) : NULL;
55 : : }
56 : :
57 : : static struct sbrec_logical_flow *
58 : 1180890 : sbrec_logical_flow_cast(const struct ovsdb_idl_row *row)
59 : : {
60 : 1180890 : return row ? CONTAINER_OF(row, struct sbrec_logical_flow, header_) : NULL;
61 : : }
62 : :
63 : : static struct sbrec_mac_binding *
64 : 94166 : sbrec_mac_binding_cast(const struct ovsdb_idl_row *row)
65 : : {
66 : 94166 : return row ? CONTAINER_OF(row, struct sbrec_mac_binding, header_) : NULL;
67 : : }
68 : :
69 : : static struct sbrec_multicast_group *
70 : 43911 : sbrec_multicast_group_cast(const struct ovsdb_idl_row *row)
71 : : {
72 : 43911 : return row ? CONTAINER_OF(row, struct sbrec_multicast_group, header_) : NULL;
73 : : }
74 : :
75 : : static struct sbrec_port_binding *
76 : 378497 : sbrec_port_binding_cast(const struct ovsdb_idl_row *row)
77 : : {
78 : 378497 : return row ? CONTAINER_OF(row, struct sbrec_port_binding, header_) : NULL;
79 : : }
80 : :
81 : : static struct sbrec_sb_global *
82 : 6864 : sbrec_sb_global_cast(const struct ovsdb_idl_row *row)
83 : : {
84 : 6864 : return row ? CONTAINER_OF(row, struct sbrec_sb_global, header_) : NULL;
85 : : }
86 : :
87 : : /* Address_Set table. */
88 : :
89 : : static void
90 : 12 : sbrec_address_set_parse_addresses(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
91 : : {
92 : 12 : struct sbrec_address_set *row = sbrec_address_set_cast(row_);
93 : : size_t i;
94 : :
95 [ - + ]: 12 : ovs_assert(inited);
96 : 12 : row->addresses = NULL;
97 : 12 : row->n_addresses = 0;
98 [ + + ]: 34 : for (i = 0; i < datum->n; i++) {
99 [ + + ]: 22 : if (!row->n_addresses) {
100 : 12 : row->addresses = xmalloc(datum->n * sizeof *row->addresses);
101 : : }
102 : 22 : row->addresses[row->n_addresses] = datum->keys[i].string;
103 : 22 : row->n_addresses++;
104 : : }
105 : 12 : }
106 : :
107 : : static void
108 : 11 : sbrec_address_set_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
109 : : {
110 : 11 : struct sbrec_address_set *row = sbrec_address_set_cast(row_);
111 : :
112 [ - + ]: 11 : ovs_assert(inited);
113 [ + - ]: 11 : if (datum->n >= 1) {
114 : 11 : row->name = datum->keys[0].string;
115 : : } else {
116 : 0 : row->name = "";
117 : : }
118 : 11 : }
119 : :
120 : : static void
121 : 14 : sbrec_address_set_unparse_addresses(struct ovsdb_idl_row *row_)
122 : : {
123 : 14 : struct sbrec_address_set *row = sbrec_address_set_cast(row_);
124 : :
125 [ - + ]: 14 : ovs_assert(inited);
126 : 14 : free(row->addresses);
127 : 14 : }
128 : :
129 : : static void
130 : 13 : sbrec_address_set_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
131 : : {
132 : : /* Nothing to do. */
133 : 13 : }
134 : :
135 : : static void
136 : 8 : sbrec_address_set_init__(struct ovsdb_idl_row *row)
137 : : {
138 : 8 : sbrec_address_set_init(sbrec_address_set_cast(row));
139 : 8 : }
140 : :
141 : : /* Clears the contents of 'row' in table "Address_Set". */
142 : : void
143 : 8 : sbrec_address_set_init(struct sbrec_address_set *row)
144 : : {
145 : 8 : memset(row, 0, sizeof *row);
146 : 8 : }
147 : :
148 : : /* Searches table "Address_Set" in 'idl' for a row with UUID 'uuid'. Returns
149 : : * a pointer to the row if there is one, otherwise a null pointer. */
150 : : const struct sbrec_address_set *
151 : 0 : sbrec_address_set_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
152 : : {
153 : 0 : return sbrec_address_set_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET], uuid));
154 : : }
155 : :
156 : : /* Returns a row in table "Address_Set" in 'idl', or a null pointer if that
157 : : * table is empty.
158 : : *
159 : : * Database tables are internally maintained as hash tables, so adding or
160 : : * removing rows while traversing the same table can cause some rows to be
161 : : * visited twice or not at apply. */
162 : : const struct sbrec_address_set *
163 : 5411 : sbrec_address_set_first(const struct ovsdb_idl *idl)
164 : : {
165 : 5411 : return sbrec_address_set_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET]));
166 : : }
167 : :
168 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
169 : : * is the last row in its table. */
170 : : const struct sbrec_address_set *
171 : 134 : sbrec_address_set_next(const struct sbrec_address_set *row)
172 : : {
173 : 134 : return sbrec_address_set_cast(ovsdb_idl_next_row(&row->header_));
174 : : }
175 : :
176 : 0 : unsigned int sbrec_address_set_get_seqno(const struct ovsdb_idl *idl)
177 : : {
178 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET]);
179 : : }
180 : :
181 : 0 : unsigned int sbrec_address_set_row_get_seqno(const struct sbrec_address_set *row, enum ovsdb_idl_change change)
182 : : {
183 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
184 : : }
185 : :
186 : : const struct sbrec_address_set *
187 : 0 : sbrec_address_set_track_get_first(const struct ovsdb_idl *idl)
188 : : {
189 : 0 : return sbrec_address_set_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET]));
190 : : }
191 : :
192 : : const struct sbrec_address_set
193 : 0 : *sbrec_address_set_track_get_next(const struct sbrec_address_set *row)
194 : : {
195 : 0 : return sbrec_address_set_cast(ovsdb_idl_track_get_next(&row->header_));
196 : : }
197 : :
198 : :
199 : : /* Deletes 'row' from table "Address_Set". 'row' may be freed, so it must not be
200 : : * accessed afterward.
201 : : *
202 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
203 : : void
204 : 1 : sbrec_address_set_delete(const struct sbrec_address_set *row)
205 : : {
206 : 1 : ovsdb_idl_txn_delete(&row->header_);
207 : 1 : }
208 : :
209 : : /* Inserts and returns a new row in the table "Address_Set" in the database
210 : : * with open transaction 'txn'.
211 : : *
212 : : * The new row is assigned a randomly generated provisional UUID.
213 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
214 : : * but the IDL will replace any uses of the provisional UUID in the
215 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
216 : : struct sbrec_address_set *
217 : 2 : sbrec_address_set_insert(struct ovsdb_idl_txn *txn)
218 : : {
219 : 2 : return sbrec_address_set_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET], NULL));
220 : : }
221 : :
222 : : bool
223 : 0 : sbrec_address_set_is_updated(const struct sbrec_address_set *row, enum sbrec_address_set_column_id column)
224 : : {
225 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_address_set_columns[column]);
226 : : }
227 : :
228 : : /* Causes the original contents of column "addresses" in 'row' to be
229 : : * verified as a prerequisite to completing the transaction. That is, if
230 : : * "addresses" in 'row' changed (or if 'row' was deleted) between the
231 : : * time that the IDL originally read its contents and the time that the
232 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
233 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
234 : : * change has already been received).
235 : : *
236 : : * The intention is that, to ensure that no transaction commits based on dirty
237 : : * reads, an application should call this function any time "addresses" is
238 : : * read as part of a read-modify-write operation.
239 : : *
240 : : * In some cases this function reduces to a no-op, because the current value
241 : : * of "addresses" is already known:
242 : : *
243 : : * - If 'row' is a row created by the current transaction (returned by
244 : : * sbrec_address_set_insert()).
245 : : *
246 : : * - If "addresses" has already been modified (with
247 : : * sbrec_address_set_set_addresses()) within the current transaction.
248 : : *
249 : : * Because of the latter property, always call this function *before*
250 : : * sbrec_address_set_set_addresses() for a given read-modify-write.
251 : : *
252 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
253 : : void
254 : 0 : sbrec_address_set_verify_addresses(const struct sbrec_address_set *row)
255 : : {
256 [ # # ]: 0 : ovs_assert(inited);
257 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_address_set_columns[SBREC_ADDRESS_SET_COL_ADDRESSES]);
258 : 0 : }
259 : :
260 : : /* Causes the original contents of column "name" in 'row' to be
261 : : * verified as a prerequisite to completing the transaction. That is, if
262 : : * "name" in 'row' changed (or if 'row' was deleted) between the
263 : : * time that the IDL originally read its contents and the time that the
264 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
265 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
266 : : * change has already been received).
267 : : *
268 : : * The intention is that, to ensure that no transaction commits based on dirty
269 : : * reads, an application should call this function any time "name" is
270 : : * read as part of a read-modify-write operation.
271 : : *
272 : : * In some cases this function reduces to a no-op, because the current value
273 : : * of "name" is already known:
274 : : *
275 : : * - If 'row' is a row created by the current transaction (returned by
276 : : * sbrec_address_set_insert()).
277 : : *
278 : : * - If "name" has already been modified (with
279 : : * sbrec_address_set_set_name()) within the current transaction.
280 : : *
281 : : * Because of the latter property, always call this function *before*
282 : : * sbrec_address_set_set_name() for a given read-modify-write.
283 : : *
284 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
285 : : void
286 : 0 : sbrec_address_set_verify_name(const struct sbrec_address_set *row)
287 : : {
288 [ # # ]: 0 : ovs_assert(inited);
289 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_address_set_columns[SBREC_ADDRESS_SET_COL_NAME]);
290 : 0 : }
291 : :
292 : : /* Returns the "addresses" column's value from the "Address_Set" table in 'row'
293 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
294 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
295 : : * for a given key than implementing the same operation on the "cooked"
296 : : * form in 'row'.
297 : : *
298 : : * 'key_type' must be OVSDB_TYPE_STRING.
299 : : * (This helps to avoid silent bugs if someone changes addresses's
300 : : * type without updating the caller.)
301 : : *
302 : : * The caller must not modify or free the returned value.
303 : : *
304 : : * Various kinds of changes can invalidate the returned value: modifying
305 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
306 : : * If the returned value is needed for a long time, it is best to make a copy
307 : : * of it with ovsdb_datum_clone().
308 : : *
309 : : * This function is rarely useful, since it is easier to access the value
310 : : * directly through the "addresses" member in sbrec_address_set. */
311 : : const struct ovsdb_datum *
312 : 0 : sbrec_address_set_get_addresses(const struct sbrec_address_set *row,
313 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
314 : : {
315 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
316 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_address_set_col_addresses);
317 : : }
318 : :
319 : : /* Returns the "name" column's value from the "Address_Set" table in 'row'
320 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
321 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
322 : : * for a given key than implementing the same operation on the "cooked"
323 : : * form in 'row'.
324 : : *
325 : : * 'key_type' must be OVSDB_TYPE_STRING.
326 : : * (This helps to avoid silent bugs if someone changes name's
327 : : * type without updating the caller.)
328 : : *
329 : : * The caller must not modify or free the returned value.
330 : : *
331 : : * Various kinds of changes can invalidate the returned value: modifying
332 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
333 : : * If the returned value is needed for a long time, it is best to make a copy
334 : : * of it with ovsdb_datum_clone().
335 : : *
336 : : * This function is rarely useful, since it is easier to access the value
337 : : * directly through the "name" member in sbrec_address_set. */
338 : : const struct ovsdb_datum *
339 : 0 : sbrec_address_set_get_name(const struct sbrec_address_set *row,
340 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
341 : : {
342 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
343 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_address_set_col_name);
344 : : }
345 : :
346 : : /* Sets the "addresses" column from the "Address_Set" table in 'row' to
347 : : * the 'addresses' set with 'n_addresses' entries.
348 : : *
349 : : * The caller retains ownership of the arguments. */
350 : : void
351 : 24 : sbrec_address_set_set_addresses(const struct sbrec_address_set *row, const char **addresses, size_t n_addresses)
352 : : {
353 : : struct ovsdb_datum datum;
354 : : size_t i;
355 : :
356 [ - + ]: 24 : ovs_assert(inited);
357 : 24 : datum.n = n_addresses;
358 [ + - ]: 24 : datum.keys = n_addresses ? xmalloc(n_addresses * sizeof *datum.keys) : NULL;
359 : 24 : datum.values = NULL;
360 [ + + ]: 88 : for (i = 0; i < n_addresses; i++) {
361 : 64 : datum.keys[i].string = xstrdup(addresses[i]);
362 : : }
363 : 24 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
364 : 24 : ovsdb_idl_txn_write(&row->header_, &sbrec_address_set_columns[SBREC_ADDRESS_SET_COL_ADDRESSES], &datum);
365 : 24 : }
366 : :
367 : : /* Sets the "name" column from the "Address_Set" table in 'row' to
368 : : * 'name'.
369 : : *
370 : : * The caller retains ownership of the arguments. */
371 : : void
372 : 2 : sbrec_address_set_set_name(const struct sbrec_address_set *row, const char *name)
373 : : {
374 : : struct ovsdb_datum datum;
375 : : union ovsdb_atom key;
376 : :
377 [ - + ]: 2 : ovs_assert(inited);
378 : 2 : datum.n = 1;
379 : 2 : datum.keys = &key;
380 : 2 : key.string = CONST_CAST(char *, name);
381 : 2 : datum.values = NULL;
382 : 2 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_address_set_columns[SBREC_ADDRESS_SET_COL_NAME], &datum);
383 : 2 : }
384 : :
385 : : /* Adds the value 'new_value' to the "addresses" set column from the "Address_Set" table
386 : : * in 'row'.
387 : : *
388 : : */
389 : : void
390 : 0 : sbrec_address_set_update_addresses_addvalue(const struct sbrec_address_set *row, const char *new_value)
391 : : {
392 : : struct ovsdb_datum *datum;
393 : :
394 [ # # ]: 0 : ovs_assert(inited);
395 : :
396 : 0 : datum = xmalloc(sizeof *datum);
397 : 0 : datum->n = 1;
398 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
399 : 0 : datum->values = NULL;
400 : :
401 : 0 : datum->keys[0].string = xstrdup(new_value);
402 : :
403 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
404 : : &sbrec_address_set_columns[SBREC_ADDRESS_SET_COL_ADDRESSES],
405 : : datum);
406 : 0 : }
407 : :
408 : : /* Deletes the value 'delete_value' from the "addresses" set column from the
409 : : * "Address_Set" table in 'row'.
410 : : *
411 : : */
412 : : void
413 : 0 : sbrec_address_set_update_addresses_delvalue(const struct sbrec_address_set *row, const char *delete_value)
414 : : {
415 : : struct ovsdb_datum *datum;
416 : :
417 [ # # ]: 0 : ovs_assert(inited);
418 : :
419 : 0 : datum = xmalloc(sizeof *datum);
420 : 0 : datum->n = 1;
421 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
422 : 0 : datum->values = NULL;
423 : :
424 : 0 : datum->keys[0].string = xstrdup(delete_value);
425 : :
426 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
427 : : &sbrec_address_set_columns[SBREC_ADDRESS_SET_COL_ADDRESSES],
428 : : datum);
429 : 0 : }
430 : :
431 : : /* Sets the "addresses" column from the "Address_Set" table in 'row' to
432 : : * the 'addresses' set with 'n_addresses' entries.
433 : : *
434 : : * The caller retains ownership of the arguments. */
435 : : void
436 : 0 : sbrec_address_set_add_clause_addresses(struct ovsdb_idl *idl, enum ovsdb_function function, const char **addresses, size_t n_addresses)
437 : : {
438 : : struct ovsdb_datum datum;
439 : : size_t i;
440 : :
441 [ # # ]: 0 : ovs_assert(inited);
442 : 0 : datum.n = n_addresses;
443 [ # # ]: 0 : datum.keys = n_addresses ? xmalloc(n_addresses * sizeof *datum.keys) : NULL;
444 : 0 : datum.values = NULL;
445 [ # # ]: 0 : for (i = 0; i < n_addresses; i++) {
446 : 0 : datum.keys[i].string = CONST_CAST(char *, addresses[i]);
447 : : }
448 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
449 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET],
450 : : function,
451 : : &sbrec_address_set_columns[SBREC_ADDRESS_SET_COL_ADDRESSES],
452 : : &datum);
453 : 0 : free(datum.keys);
454 : 0 : }
455 : :
456 : : /* Sets the "name" column from the "Address_Set" table in 'row' to
457 : : * 'name'.
458 : : *
459 : : * The caller retains ownership of the arguments. */
460 : : void
461 : 0 : sbrec_address_set_add_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
462 : : {
463 : : struct ovsdb_datum datum;
464 : : union ovsdb_atom key;
465 : :
466 [ # # ]: 0 : ovs_assert(inited);
467 : 0 : datum.n = 1;
468 : 0 : datum.keys = &key;
469 : 0 : key.string = CONST_CAST(char *, name);
470 : 0 : datum.values = NULL;
471 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET],
472 : : function,
473 : : &sbrec_address_set_columns[SBREC_ADDRESS_SET_COL_NAME],
474 : : &datum);
475 : 0 : }
476 : : void
477 : 0 : sbrec_address_set_add_clause_false(struct ovsdb_idl *idl)
478 : : {
479 : : struct ovsdb_datum datum;
480 : :
481 : 0 : ovsdb_datum_init_empty(&datum);
482 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET], OVSDB_F_FALSE, NULL, &datum);
483 : 0 : }
484 : : void
485 : 0 : sbrec_address_set_add_clause_true(struct ovsdb_idl *idl)
486 : : {
487 : : struct ovsdb_datum datum;
488 : :
489 : 0 : ovsdb_datum_init_empty(&datum);
490 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET], OVSDB_F_TRUE, NULL, &datum);
491 : 0 : }
492 : :
493 : : /* Sets the "addresses" column from the "Address_Set" table in 'row' to
494 : : * the 'addresses' set with 'n_addresses' entries.
495 : : *
496 : : * The caller retains ownership of the arguments. */
497 : : void
498 : 0 : sbrec_address_set_remove_clause_addresses(struct ovsdb_idl *idl, enum ovsdb_function function, const char **addresses, size_t n_addresses)
499 : : {
500 : : struct ovsdb_datum datum;
501 : : size_t i;
502 : :
503 [ # # ]: 0 : ovs_assert(inited);
504 : 0 : datum.n = n_addresses;
505 [ # # ]: 0 : datum.keys = n_addresses ? xmalloc(n_addresses * sizeof *datum.keys) : NULL;
506 : 0 : datum.values = NULL;
507 [ # # ]: 0 : for (i = 0; i < n_addresses; i++) {
508 : 0 : datum.keys[i].string = CONST_CAST(char *, addresses[i]);
509 : : }
510 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
511 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET],
512 : : function,
513 : : &sbrec_address_set_columns[SBREC_ADDRESS_SET_COL_ADDRESSES],
514 : : &datum);
515 : 0 : free(datum.keys);
516 : 0 : }
517 : :
518 : : /* Sets the "name" column from the "Address_Set" table in 'row' to
519 : : * 'name'.
520 : : *
521 : : * The caller retains ownership of the arguments. */
522 : : void
523 : 0 : sbrec_address_set_remove_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
524 : : {
525 : : struct ovsdb_datum datum;
526 : : union ovsdb_atom key;
527 : :
528 [ # # ]: 0 : ovs_assert(inited);
529 : 0 : datum.n = 1;
530 : 0 : datum.keys = &key;
531 : 0 : key.string = CONST_CAST(char *, name);
532 : 0 : datum.values = NULL;
533 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET],
534 : : function,
535 : : &sbrec_address_set_columns[SBREC_ADDRESS_SET_COL_NAME],
536 : : &datum);
537 : 0 : }
538 : : void
539 : 0 : sbrec_address_set_remove_clause_false(struct ovsdb_idl *idl)
540 : : {
541 : : struct ovsdb_datum datum;
542 : :
543 : 0 : ovsdb_datum_init_empty(&datum);
544 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET], OVSDB_F_FALSE, NULL, &datum);
545 : 0 : }
546 : : void
547 : 0 : sbrec_address_set_remove_clause_true(struct ovsdb_idl *idl)
548 : : {
549 : : struct ovsdb_datum datum;
550 : :
551 : 0 : ovsdb_datum_init_empty(&datum);
552 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_ADDRESS_SET], OVSDB_F_TRUE, NULL, &datum);
553 : 0 : }
554 : :
555 : : struct ovsdb_idl_column sbrec_address_set_columns[SBREC_ADDRESS_SET_N_COLUMNS];
556 : :
557 : : static void
558 : 272 : sbrec_address_set_columns_init(void)
559 : : {
560 : : struct ovsdb_idl_column *c;
561 : :
562 : : /* Initialize sbrec_address_set_col_addresses. */
563 : 272 : c = &sbrec_address_set_col_addresses;
564 : 272 : c->name = "addresses";
565 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
566 : 272 : c->type.key.u.string.minLen = 0;
567 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
568 : 272 : c->type.n_min = 0;
569 : 272 : c->type.n_max = UINT_MAX;
570 : 272 : c->mutable = true;
571 : 272 : c->parse = sbrec_address_set_parse_addresses;
572 : 272 : c->unparse = sbrec_address_set_unparse_addresses;
573 : :
574 : : /* Initialize sbrec_address_set_col_name. */
575 : 272 : c = &sbrec_address_set_col_name;
576 : 272 : c->name = "name";
577 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
578 : 272 : c->type.key.u.string.minLen = 0;
579 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
580 : 272 : c->type.n_min = 1;
581 : 272 : c->type.n_max = 1;
582 : 272 : c->mutable = true;
583 : 272 : c->parse = sbrec_address_set_parse_name;
584 : 272 : c->unparse = sbrec_address_set_unparse_name;
585 : 272 : }
586 : :
587 : : /* Chassis table. */
588 : :
589 : : static void
590 : 691 : sbrec_chassis_parse_encaps(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
591 : : {
592 : 691 : struct sbrec_chassis *row = sbrec_chassis_cast(row_);
593 : : size_t i;
594 : :
595 [ - + ]: 691 : ovs_assert(inited);
596 : 691 : row->encaps = NULL;
597 : 691 : row->n_encaps = 0;
598 [ + + ]: 1593 : for (i = 0; i < datum->n; i++) {
599 : 902 : struct sbrec_encap *keyRow = sbrec_encap_cast(ovsdb_idl_get_row_arc(row_, &sbrec_table_classes[SBREC_TABLE_ENCAP], &datum->keys[i].uuid));
600 [ + + ]: 902 : if (keyRow) {
601 [ + + ]: 695 : if (!row->n_encaps) {
602 : 526 : row->encaps = xmalloc(datum->n * sizeof *row->encaps);
603 : : }
604 : 695 : row->encaps[row->n_encaps] = keyRow;
605 : 695 : row->n_encaps++;
606 : : }
607 : : }
608 : 691 : }
609 : :
610 : : static void
611 : 681 : sbrec_chassis_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
612 : : {
613 : 681 : struct sbrec_chassis *row = sbrec_chassis_cast(row_);
614 : : size_t i;
615 : :
616 [ - + ]: 681 : ovs_assert(inited);
617 : 681 : smap_init(&row->external_ids);
618 [ + + ]: 1257 : for (i = 0; i < datum->n; i++) {
619 : 576 : smap_add(&row->external_ids,
620 : 576 : datum->keys[i].string,
621 : 576 : datum->values[i].string);
622 : : }
623 : 681 : }
624 : :
625 : : static void
626 : 671 : sbrec_chassis_parse_hostname(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
627 : : {
628 : 671 : struct sbrec_chassis *row = sbrec_chassis_cast(row_);
629 : :
630 [ - + ]: 671 : ovs_assert(inited);
631 [ + - ]: 671 : if (datum->n >= 1) {
632 : 671 : row->hostname = datum->keys[0].string;
633 : : } else {
634 : 0 : row->hostname = "";
635 : : }
636 : 671 : }
637 : :
638 : : static void
639 : 690 : sbrec_chassis_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
640 : : {
641 : 690 : struct sbrec_chassis *row = sbrec_chassis_cast(row_);
642 : :
643 [ - + ]: 690 : ovs_assert(inited);
644 [ + - ]: 690 : if (datum->n >= 1) {
645 : 690 : row->name = datum->keys[0].string;
646 : : } else {
647 : 0 : row->name = "";
648 : : }
649 : 690 : }
650 : :
651 : : static void
652 : 626 : sbrec_chassis_parse_nb_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
653 : : {
654 : 626 : struct sbrec_chassis *row = sbrec_chassis_cast(row_);
655 : :
656 [ - + ]: 626 : ovs_assert(inited);
657 [ + - ]: 626 : if (datum->n >= 1) {
658 : 626 : row->nb_cfg = datum->keys[0].integer;
659 : : } else {
660 : 0 : row->nb_cfg = 0;
661 : : }
662 : 626 : }
663 : :
664 : : static void
665 : 864 : sbrec_chassis_parse_vtep_logical_switches(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
666 : : {
667 : 864 : struct sbrec_chassis *row = sbrec_chassis_cast(row_);
668 : : size_t i;
669 : :
670 [ - + ]: 864 : ovs_assert(inited);
671 : 864 : row->vtep_logical_switches = NULL;
672 : 864 : row->n_vtep_logical_switches = 0;
673 [ + + ]: 1355 : for (i = 0; i < datum->n; i++) {
674 [ + + ]: 491 : if (!row->n_vtep_logical_switches) {
675 : 407 : row->vtep_logical_switches = xmalloc(datum->n * sizeof *row->vtep_logical_switches);
676 : : }
677 : 491 : row->vtep_logical_switches[row->n_vtep_logical_switches] = datum->keys[i].string;
678 : 491 : row->n_vtep_logical_switches++;
679 : : }
680 : 864 : }
681 : :
682 : : static void
683 : 755 : sbrec_chassis_unparse_encaps(struct ovsdb_idl_row *row_)
684 : : {
685 : 755 : struct sbrec_chassis *row = sbrec_chassis_cast(row_);
686 : :
687 [ - + ]: 755 : ovs_assert(inited);
688 : 755 : free(row->encaps);
689 : 755 : }
690 : :
691 : : static void
692 : 745 : sbrec_chassis_unparse_external_ids(struct ovsdb_idl_row *row_)
693 : : {
694 : 745 : struct sbrec_chassis *row = sbrec_chassis_cast(row_);
695 : :
696 [ - + ]: 745 : ovs_assert(inited);
697 : 745 : smap_destroy(&row->external_ids);
698 : 745 : }
699 : :
700 : : static void
701 : 735 : sbrec_chassis_unparse_hostname(struct ovsdb_idl_row *row OVS_UNUSED)
702 : : {
703 : : /* Nothing to do. */
704 : 735 : }
705 : :
706 : : static void
707 : 754 : sbrec_chassis_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
708 : : {
709 : : /* Nothing to do. */
710 : 754 : }
711 : :
712 : : static void
713 : 690 : sbrec_chassis_unparse_nb_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
714 : : {
715 : : /* Nothing to do. */
716 : 690 : }
717 : :
718 : : static void
719 : 928 : sbrec_chassis_unparse_vtep_logical_switches(struct ovsdb_idl_row *row_)
720 : : {
721 : 928 : struct sbrec_chassis *row = sbrec_chassis_cast(row_);
722 : :
723 [ - + ]: 928 : ovs_assert(inited);
724 : 928 : free(row->vtep_logical_switches);
725 : 928 : }
726 : :
727 : : static void
728 : 357 : sbrec_chassis_init__(struct ovsdb_idl_row *row)
729 : : {
730 : 357 : sbrec_chassis_init(sbrec_chassis_cast(row));
731 : 357 : }
732 : :
733 : : /* Clears the contents of 'row' in table "Chassis". */
734 : : void
735 : 357 : sbrec_chassis_init(struct sbrec_chassis *row)
736 : : {
737 : 357 : memset(row, 0, sizeof *row);
738 : 357 : smap_init(&row->external_ids);
739 : 357 : }
740 : :
741 : : /* Searches table "Chassis" in 'idl' for a row with UUID 'uuid'. Returns
742 : : * a pointer to the row if there is one, otherwise a null pointer. */
743 : : const struct sbrec_chassis *
744 : 0 : sbrec_chassis_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
745 : : {
746 : 0 : return sbrec_chassis_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS], uuid));
747 : : }
748 : :
749 : : /* Returns a row in table "Chassis" in 'idl', or a null pointer if that
750 : : * table is empty.
751 : : *
752 : : * Database tables are internally maintained as hash tables, so adding or
753 : : * removing rows while traversing the same table can cause some rows to be
754 : : * visited twice or not at apply. */
755 : : const struct sbrec_chassis *
756 : 15798 : sbrec_chassis_first(const struct ovsdb_idl *idl)
757 : : {
758 : 15798 : return sbrec_chassis_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS]));
759 : : }
760 : :
761 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
762 : : * is the last row in its table. */
763 : : const struct sbrec_chassis *
764 : 14192 : sbrec_chassis_next(const struct sbrec_chassis *row)
765 : : {
766 : 14192 : return sbrec_chassis_cast(ovsdb_idl_next_row(&row->header_));
767 : : }
768 : :
769 : 0 : unsigned int sbrec_chassis_get_seqno(const struct ovsdb_idl *idl)
770 : : {
771 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS]);
772 : : }
773 : :
774 : 0 : unsigned int sbrec_chassis_row_get_seqno(const struct sbrec_chassis *row, enum ovsdb_idl_change change)
775 : : {
776 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
777 : : }
778 : :
779 : : const struct sbrec_chassis *
780 : 0 : sbrec_chassis_track_get_first(const struct ovsdb_idl *idl)
781 : : {
782 : 0 : return sbrec_chassis_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS]));
783 : : }
784 : :
785 : : const struct sbrec_chassis
786 : 0 : *sbrec_chassis_track_get_next(const struct sbrec_chassis *row)
787 : : {
788 : 0 : return sbrec_chassis_cast(ovsdb_idl_track_get_next(&row->header_));
789 : : }
790 : :
791 : :
792 : : /* Deletes 'row' from table "Chassis". 'row' may be freed, so it must not be
793 : : * accessed afterward.
794 : : *
795 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
796 : : void
797 : 55 : sbrec_chassis_delete(const struct sbrec_chassis *row)
798 : : {
799 : 55 : ovsdb_idl_txn_delete(&row->header_);
800 : 55 : }
801 : :
802 : : /* Inserts and returns a new row in the table "Chassis" in the database
803 : : * with open transaction 'txn'.
804 : : *
805 : : * The new row is assigned a randomly generated provisional UUID.
806 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
807 : : * but the IDL will replace any uses of the provisional UUID in the
808 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
809 : : struct sbrec_chassis *
810 : 64 : sbrec_chassis_insert(struct ovsdb_idl_txn *txn)
811 : : {
812 : 64 : return sbrec_chassis_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_CHASSIS], NULL));
813 : : }
814 : :
815 : : bool
816 : 0 : sbrec_chassis_is_updated(const struct sbrec_chassis *row, enum sbrec_chassis_column_id column)
817 : : {
818 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_chassis_columns[column]);
819 : : }
820 : :
821 : : /* Causes the original contents of column "encaps" in 'row' to be
822 : : * verified as a prerequisite to completing the transaction. That is, if
823 : : * "encaps" in 'row' changed (or if 'row' was deleted) between the
824 : : * time that the IDL originally read its contents and the time that the
825 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
826 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
827 : : * change has already been received).
828 : : *
829 : : * The intention is that, to ensure that no transaction commits based on dirty
830 : : * reads, an application should call this function any time "encaps" is
831 : : * read as part of a read-modify-write operation.
832 : : *
833 : : * In some cases this function reduces to a no-op, because the current value
834 : : * of "encaps" is already known:
835 : : *
836 : : * - If 'row' is a row created by the current transaction (returned by
837 : : * sbrec_chassis_insert()).
838 : : *
839 : : * - If "encaps" has already been modified (with
840 : : * sbrec_chassis_set_encaps()) within the current transaction.
841 : : *
842 : : * Because of the latter property, always call this function *before*
843 : : * sbrec_chassis_set_encaps() for a given read-modify-write.
844 : : *
845 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
846 : : void
847 : 0 : sbrec_chassis_verify_encaps(const struct sbrec_chassis *row)
848 : : {
849 [ # # ]: 0 : ovs_assert(inited);
850 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_ENCAPS]);
851 : 0 : }
852 : :
853 : : /* Causes the original contents of column "external_ids" in 'row' to be
854 : : * verified as a prerequisite to completing the transaction. That is, if
855 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
856 : : * time that the IDL originally read its contents and the time that the
857 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
858 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
859 : : * change has already been received).
860 : : *
861 : : * The intention is that, to ensure that no transaction commits based on dirty
862 : : * reads, an application should call this function any time "external_ids" is
863 : : * read as part of a read-modify-write operation.
864 : : *
865 : : * In some cases this function reduces to a no-op, because the current value
866 : : * of "external_ids" is already known:
867 : : *
868 : : * - If 'row' is a row created by the current transaction (returned by
869 : : * sbrec_chassis_insert()).
870 : : *
871 : : * - If "external_ids" has already been modified (with
872 : : * sbrec_chassis_set_external_ids()) within the current transaction.
873 : : *
874 : : * Because of the latter property, always call this function *before*
875 : : * sbrec_chassis_set_external_ids() for a given read-modify-write.
876 : : *
877 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
878 : : void
879 : 9 : sbrec_chassis_verify_external_ids(const struct sbrec_chassis *row)
880 : : {
881 [ - + ]: 9 : ovs_assert(inited);
882 : 9 : ovsdb_idl_txn_verify(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_EXTERNAL_IDS]);
883 : 9 : }
884 : :
885 : : /* Causes the original contents of column "hostname" in 'row' to be
886 : : * verified as a prerequisite to completing the transaction. That is, if
887 : : * "hostname" in 'row' changed (or if 'row' was deleted) between the
888 : : * time that the IDL originally read its contents and the time that the
889 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
890 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
891 : : * change has already been received).
892 : : *
893 : : * The intention is that, to ensure that no transaction commits based on dirty
894 : : * reads, an application should call this function any time "hostname" is
895 : : * read as part of a read-modify-write operation.
896 : : *
897 : : * In some cases this function reduces to a no-op, because the current value
898 : : * of "hostname" is already known:
899 : : *
900 : : * - If 'row' is a row created by the current transaction (returned by
901 : : * sbrec_chassis_insert()).
902 : : *
903 : : * - If "hostname" has already been modified (with
904 : : * sbrec_chassis_set_hostname()) within the current transaction.
905 : : *
906 : : * Because of the latter property, always call this function *before*
907 : : * sbrec_chassis_set_hostname() for a given read-modify-write.
908 : : *
909 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
910 : : void
911 : 0 : sbrec_chassis_verify_hostname(const struct sbrec_chassis *row)
912 : : {
913 [ # # ]: 0 : ovs_assert(inited);
914 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_HOSTNAME]);
915 : 0 : }
916 : :
917 : : /* Causes the original contents of column "name" in 'row' to be
918 : : * verified as a prerequisite to completing the transaction. That is, if
919 : : * "name" in 'row' changed (or if 'row' was deleted) between the
920 : : * time that the IDL originally read its contents and the time that the
921 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
922 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
923 : : * change has already been received).
924 : : *
925 : : * The intention is that, to ensure that no transaction commits based on dirty
926 : : * reads, an application should call this function any time "name" is
927 : : * read as part of a read-modify-write operation.
928 : : *
929 : : * In some cases this function reduces to a no-op, because the current value
930 : : * of "name" is already known:
931 : : *
932 : : * - If 'row' is a row created by the current transaction (returned by
933 : : * sbrec_chassis_insert()).
934 : : *
935 : : * - If "name" has already been modified (with
936 : : * sbrec_chassis_set_name()) within the current transaction.
937 : : *
938 : : * Because of the latter property, always call this function *before*
939 : : * sbrec_chassis_set_name() for a given read-modify-write.
940 : : *
941 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
942 : : void
943 : 0 : sbrec_chassis_verify_name(const struct sbrec_chassis *row)
944 : : {
945 [ # # ]: 0 : ovs_assert(inited);
946 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_NAME]);
947 : 0 : }
948 : :
949 : : /* Causes the original contents of column "nb_cfg" in 'row' to be
950 : : * verified as a prerequisite to completing the transaction. That is, if
951 : : * "nb_cfg" in 'row' changed (or if 'row' was deleted) between the
952 : : * time that the IDL originally read its contents and the time that the
953 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
954 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
955 : : * change has already been received).
956 : : *
957 : : * The intention is that, to ensure that no transaction commits based on dirty
958 : : * reads, an application should call this function any time "nb_cfg" is
959 : : * read as part of a read-modify-write operation.
960 : : *
961 : : * In some cases this function reduces to a no-op, because the current value
962 : : * of "nb_cfg" is already known:
963 : : *
964 : : * - If 'row' is a row created by the current transaction (returned by
965 : : * sbrec_chassis_insert()).
966 : : *
967 : : * - If "nb_cfg" has already been modified (with
968 : : * sbrec_chassis_set_nb_cfg()) within the current transaction.
969 : : *
970 : : * Because of the latter property, always call this function *before*
971 : : * sbrec_chassis_set_nb_cfg() for a given read-modify-write.
972 : : *
973 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
974 : : void
975 : 0 : sbrec_chassis_verify_nb_cfg(const struct sbrec_chassis *row)
976 : : {
977 [ # # ]: 0 : ovs_assert(inited);
978 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_NB_CFG]);
979 : 0 : }
980 : :
981 : : /* Causes the original contents of column "vtep_logical_switches" in 'row' to be
982 : : * verified as a prerequisite to completing the transaction. That is, if
983 : : * "vtep_logical_switches" in 'row' changed (or if 'row' was deleted) between the
984 : : * time that the IDL originally read its contents and the time that the
985 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
986 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
987 : : * change has already been received).
988 : : *
989 : : * The intention is that, to ensure that no transaction commits based on dirty
990 : : * reads, an application should call this function any time "vtep_logical_switches" is
991 : : * read as part of a read-modify-write operation.
992 : : *
993 : : * In some cases this function reduces to a no-op, because the current value
994 : : * of "vtep_logical_switches" is already known:
995 : : *
996 : : * - If 'row' is a row created by the current transaction (returned by
997 : : * sbrec_chassis_insert()).
998 : : *
999 : : * - If "vtep_logical_switches" has already been modified (with
1000 : : * sbrec_chassis_set_vtep_logical_switches()) within the current transaction.
1001 : : *
1002 : : * Because of the latter property, always call this function *before*
1003 : : * sbrec_chassis_set_vtep_logical_switches() for a given read-modify-write.
1004 : : *
1005 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1006 : : void
1007 : 0 : sbrec_chassis_verify_vtep_logical_switches(const struct sbrec_chassis *row)
1008 : : {
1009 [ # # ]: 0 : ovs_assert(inited);
1010 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_VTEP_LOGICAL_SWITCHES]);
1011 : 0 : }
1012 : :
1013 : : /* Returns the "encaps" column's value from the "Chassis" table in 'row'
1014 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
1015 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
1016 : : * for a given key than implementing the same operation on the "cooked"
1017 : : * form in 'row'.
1018 : : *
1019 : : * 'key_type' must be OVSDB_TYPE_UUID.
1020 : : * (This helps to avoid silent bugs if someone changes encaps's
1021 : : * type without updating the caller.)
1022 : : *
1023 : : * The caller must not modify or free the returned value.
1024 : : *
1025 : : * Various kinds of changes can invalidate the returned value: modifying
1026 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1027 : : * If the returned value is needed for a long time, it is best to make a copy
1028 : : * of it with ovsdb_datum_clone().
1029 : : *
1030 : : * This function is rarely useful, since it is easier to access the value
1031 : : * directly through the "encaps" member in sbrec_chassis. */
1032 : : const struct ovsdb_datum *
1033 : 0 : sbrec_chassis_get_encaps(const struct sbrec_chassis *row,
1034 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
1035 : : {
1036 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
1037 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_chassis_col_encaps);
1038 : : }
1039 : :
1040 : : /* Returns the "external_ids" column's value from the "Chassis" table in 'row'
1041 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
1042 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
1043 : : * for a given key than implementing the same operation on the "cooked"
1044 : : * form in 'row'.
1045 : : *
1046 : : * 'key_type' must be OVSDB_TYPE_STRING.
1047 : : * 'value_type' must be OVSDB_TYPE_STRING.
1048 : : * (This helps to avoid silent bugs if someone changes external_ids's
1049 : : * type without updating the caller.)
1050 : : *
1051 : : * The caller must not modify or free the returned value.
1052 : : *
1053 : : * Various kinds of changes can invalidate the returned value: modifying
1054 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1055 : : * If the returned value is needed for a long time, it is best to make a copy
1056 : : * of it with ovsdb_datum_clone().
1057 : : *
1058 : : * This function is rarely useful, since it is easier to access the value
1059 : : * directly through the "external_ids" member in sbrec_chassis. */
1060 : : const struct ovsdb_datum *
1061 : 0 : sbrec_chassis_get_external_ids(const struct sbrec_chassis *row,
1062 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
1063 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
1064 : : {
1065 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
1066 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
1067 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_chassis_col_external_ids);
1068 : : }
1069 : :
1070 : : /* Returns the "hostname" column's value from the "Chassis" table in 'row'
1071 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
1072 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
1073 : : * for a given key than implementing the same operation on the "cooked"
1074 : : * form in 'row'.
1075 : : *
1076 : : * 'key_type' must be OVSDB_TYPE_STRING.
1077 : : * (This helps to avoid silent bugs if someone changes hostname's
1078 : : * type without updating the caller.)
1079 : : *
1080 : : * The caller must not modify or free the returned value.
1081 : : *
1082 : : * Various kinds of changes can invalidate the returned value: modifying
1083 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1084 : : * If the returned value is needed for a long time, it is best to make a copy
1085 : : * of it with ovsdb_datum_clone().
1086 : : *
1087 : : * This function is rarely useful, since it is easier to access the value
1088 : : * directly through the "hostname" member in sbrec_chassis. */
1089 : : const struct ovsdb_datum *
1090 : 0 : sbrec_chassis_get_hostname(const struct sbrec_chassis *row,
1091 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
1092 : : {
1093 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
1094 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_chassis_col_hostname);
1095 : : }
1096 : :
1097 : : /* Returns the "name" column's value from the "Chassis" table in 'row'
1098 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
1099 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
1100 : : * for a given key than implementing the same operation on the "cooked"
1101 : : * form in 'row'.
1102 : : *
1103 : : * 'key_type' must be OVSDB_TYPE_STRING.
1104 : : * (This helps to avoid silent bugs if someone changes name's
1105 : : * type without updating the caller.)
1106 : : *
1107 : : * The caller must not modify or free the returned value.
1108 : : *
1109 : : * Various kinds of changes can invalidate the returned value: modifying
1110 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1111 : : * If the returned value is needed for a long time, it is best to make a copy
1112 : : * of it with ovsdb_datum_clone().
1113 : : *
1114 : : * This function is rarely useful, since it is easier to access the value
1115 : : * directly through the "name" member in sbrec_chassis. */
1116 : : const struct ovsdb_datum *
1117 : 0 : sbrec_chassis_get_name(const struct sbrec_chassis *row,
1118 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
1119 : : {
1120 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
1121 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_chassis_col_name);
1122 : : }
1123 : :
1124 : : /* Returns the "nb_cfg" column's value from the "Chassis" table in 'row'
1125 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
1126 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
1127 : : * for a given key than implementing the same operation on the "cooked"
1128 : : * form in 'row'.
1129 : : *
1130 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
1131 : : * (This helps to avoid silent bugs if someone changes nb_cfg's
1132 : : * type without updating the caller.)
1133 : : *
1134 : : * The caller must not modify or free the returned value.
1135 : : *
1136 : : * Various kinds of changes can invalidate the returned value: modifying
1137 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1138 : : * If the returned value is needed for a long time, it is best to make a copy
1139 : : * of it with ovsdb_datum_clone().
1140 : : *
1141 : : * This function is rarely useful, since it is easier to access the value
1142 : : * directly through the "nb_cfg" member in sbrec_chassis. */
1143 : : const struct ovsdb_datum *
1144 : 0 : sbrec_chassis_get_nb_cfg(const struct sbrec_chassis *row,
1145 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
1146 : : {
1147 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
1148 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_chassis_col_nb_cfg);
1149 : : }
1150 : :
1151 : : /* Returns the "vtep_logical_switches" column's value from the "Chassis" table in 'row'
1152 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
1153 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
1154 : : * for a given key than implementing the same operation on the "cooked"
1155 : : * form in 'row'.
1156 : : *
1157 : : * 'key_type' must be OVSDB_TYPE_STRING.
1158 : : * (This helps to avoid silent bugs if someone changes vtep_logical_switches's
1159 : : * type without updating the caller.)
1160 : : *
1161 : : * The caller must not modify or free the returned value.
1162 : : *
1163 : : * Various kinds of changes can invalidate the returned value: modifying
1164 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1165 : : * If the returned value is needed for a long time, it is best to make a copy
1166 : : * of it with ovsdb_datum_clone().
1167 : : *
1168 : : * This function is rarely useful, since it is easier to access the value
1169 : : * directly through the "vtep_logical_switches" member in sbrec_chassis. */
1170 : : const struct ovsdb_datum *
1171 : 0 : sbrec_chassis_get_vtep_logical_switches(const struct sbrec_chassis *row,
1172 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
1173 : : {
1174 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
1175 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_chassis_col_vtep_logical_switches);
1176 : : }
1177 : :
1178 : : /* Sets the "encaps" column from the "Chassis" table in 'row' to
1179 : : * the 'encaps' set with 'n_encaps' entries.
1180 : : *
1181 : : * The caller retains ownership of the arguments. */
1182 : : void
1183 : 64 : sbrec_chassis_set_encaps(const struct sbrec_chassis *row, struct sbrec_encap **encaps, size_t n_encaps)
1184 : : {
1185 : : struct ovsdb_datum datum;
1186 : : size_t i;
1187 : :
1188 [ - + ]: 64 : ovs_assert(inited);
1189 : 64 : datum.n = n_encaps;
1190 [ + - ]: 64 : datum.keys = n_encaps ? xmalloc(n_encaps * sizeof *datum.keys) : NULL;
1191 : 64 : datum.values = NULL;
1192 [ + + ]: 170 : for (i = 0; i < n_encaps; i++) {
1193 : 106 : datum.keys[i].uuid = encaps[i]->header_.uuid;
1194 : : }
1195 : 64 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
1196 : 64 : ovsdb_idl_txn_write(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_ENCAPS], &datum);
1197 : 64 : }
1198 : :
1199 : : /* Sets the "external_ids" column's value from the "Chassis" table in 'row'
1200 : : * to 'external_ids'.
1201 : : *
1202 : : * The caller retains ownership of 'external_ids' and everything in it. */
1203 : : void
1204 : 54 : sbrec_chassis_set_external_ids(const struct sbrec_chassis *row, const struct smap *external_ids)
1205 : : {
1206 : : struct ovsdb_datum datum;
1207 : :
1208 [ - + ]: 54 : ovs_assert(inited);
1209 [ + - ]: 54 : if (external_ids) {
1210 : : struct smap_node *node;
1211 : : size_t i;
1212 : :
1213 : 54 : datum.n = smap_count(external_ids);
1214 : 54 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1215 : 54 : datum.values = xmalloc(datum.n * sizeof *datum.values);
1216 : :
1217 : 54 : i = 0;
1218 [ + + ][ - + ]: 216 : SMAP_FOR_EACH (node, external_ids) {
1219 : 162 : datum.keys[i].string = xstrdup(node->key);
1220 : 162 : datum.values[i].string = xstrdup(node->value);
1221 : 162 : i++;
1222 : : }
1223 : 54 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1224 : : } else {
1225 : 0 : ovsdb_datum_init_empty(&datum);
1226 : : }
1227 : 54 : ovsdb_idl_txn_write(&row->header_,
1228 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_EXTERNAL_IDS],
1229 : : &datum);
1230 : 54 : }
1231 : :
1232 : :
1233 : : /* Sets the "hostname" column from the "Chassis" table in 'row' to
1234 : : * 'hostname'.
1235 : : *
1236 : : * The caller retains ownership of the arguments. */
1237 : : void
1238 : 45 : sbrec_chassis_set_hostname(const struct sbrec_chassis *row, const char *hostname)
1239 : : {
1240 : : struct ovsdb_datum datum;
1241 : : union ovsdb_atom key;
1242 : :
1243 [ - + ]: 45 : ovs_assert(inited);
1244 : 45 : datum.n = 1;
1245 : 45 : datum.keys = &key;
1246 : 45 : key.string = CONST_CAST(char *, hostname);
1247 : 45 : datum.values = NULL;
1248 : 45 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_HOSTNAME], &datum);
1249 : 45 : }
1250 : :
1251 : : /* Sets the "name" column from the "Chassis" table in 'row' to
1252 : : * 'name'.
1253 : : *
1254 : : * The caller retains ownership of the arguments. */
1255 : : void
1256 : 64 : sbrec_chassis_set_name(const struct sbrec_chassis *row, const char *name)
1257 : : {
1258 : : struct ovsdb_datum datum;
1259 : : union ovsdb_atom key;
1260 : :
1261 [ - + ]: 64 : ovs_assert(inited);
1262 : 64 : datum.n = 1;
1263 : 64 : datum.keys = &key;
1264 : 64 : key.string = CONST_CAST(char *, name);
1265 : 64 : datum.values = NULL;
1266 : 64 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_NAME], &datum);
1267 : 64 : }
1268 : :
1269 : : /* Sets the "nb_cfg" column from the "Chassis" table in 'row' to
1270 : : * 'nb_cfg'.
1271 : : *
1272 : : * The caller retains ownership of the arguments. */
1273 : : void
1274 : 0 : sbrec_chassis_set_nb_cfg(const struct sbrec_chassis *row, int64_t nb_cfg)
1275 : : {
1276 : : struct ovsdb_datum datum;
1277 : : union ovsdb_atom key;
1278 : :
1279 [ # # ]: 0 : ovs_assert(inited);
1280 : 0 : datum.n = 1;
1281 : 0 : datum.keys = &key;
1282 : 0 : key.integer = nb_cfg;
1283 : 0 : datum.values = NULL;
1284 : 0 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_NB_CFG], &datum);
1285 : 0 : }
1286 : :
1287 : : /* Sets the "vtep_logical_switches" column from the "Chassis" table in 'row' to
1288 : : * the 'vtep_logical_switches' set with 'n_vtep_logical_switches' entries.
1289 : : *
1290 : : * The caller retains ownership of the arguments. */
1291 : : void
1292 : 238 : sbrec_chassis_set_vtep_logical_switches(const struct sbrec_chassis *row, const char **vtep_logical_switches, size_t n_vtep_logical_switches)
1293 : : {
1294 : : struct ovsdb_datum datum;
1295 : : size_t i;
1296 : :
1297 [ - + ]: 238 : ovs_assert(inited);
1298 : 238 : datum.n = n_vtep_logical_switches;
1299 [ + + ]: 238 : datum.keys = n_vtep_logical_switches ? xmalloc(n_vtep_logical_switches * sizeof *datum.keys) : NULL;
1300 : 238 : datum.values = NULL;
1301 [ + + ]: 468 : for (i = 0; i < n_vtep_logical_switches; i++) {
1302 : 230 : datum.keys[i].string = xstrdup(vtep_logical_switches[i]);
1303 : : }
1304 : 238 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
1305 : 238 : ovsdb_idl_txn_write(&row->header_, &sbrec_chassis_columns[SBREC_CHASSIS_COL_VTEP_LOGICAL_SWITCHES], &datum);
1306 : 238 : }
1307 : :
1308 : : /* Adds the value 'new_value' to the "encaps" set column from the "Chassis" table
1309 : : * in 'row'.
1310 : : *
1311 : : */
1312 : : void
1313 : 0 : sbrec_chassis_update_encaps_addvalue(const struct sbrec_chassis *row, const struct sbrec_encap *new_value)
1314 : : {
1315 : : struct ovsdb_datum *datum;
1316 : :
1317 [ # # ]: 0 : ovs_assert(inited);
1318 : :
1319 : 0 : datum = xmalloc(sizeof *datum);
1320 : 0 : datum->n = 1;
1321 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
1322 : 0 : datum->values = NULL;
1323 : :
1324 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
1325 : :
1326 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
1327 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_ENCAPS],
1328 : : datum);
1329 : 0 : }
1330 : :
1331 : : /* Deletes the value 'delete_value' from the "encaps" set column from the
1332 : : * "Chassis" table in 'row'.
1333 : : *
1334 : : */
1335 : : void
1336 : 0 : sbrec_chassis_update_encaps_delvalue(const struct sbrec_chassis *row, const struct sbrec_encap *delete_value)
1337 : : {
1338 : : struct ovsdb_datum *datum;
1339 : :
1340 [ # # ]: 0 : ovs_assert(inited);
1341 : :
1342 : 0 : datum = xmalloc(sizeof *datum);
1343 : 0 : datum->n = 1;
1344 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
1345 : 0 : datum->values = NULL;
1346 : :
1347 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
1348 : :
1349 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
1350 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_ENCAPS],
1351 : : datum);
1352 : 0 : }
1353 : :
1354 : : /* Sets an element of the "external_ids" map column from the "Chassis" table in 'row'
1355 : : * to 'new_value' given the key value 'new_key'.
1356 : : *
1357 : : */
1358 : : void
1359 : 0 : sbrec_chassis_update_external_ids_setkey(const struct sbrec_chassis *row, const char *new_key, const char *new_value)
1360 : : {
1361 : : struct ovsdb_datum *datum;
1362 : :
1363 [ # # ]: 0 : ovs_assert(inited);
1364 : :
1365 : 0 : datum = xmalloc(sizeof *datum);
1366 : 0 : datum->n = 1;
1367 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
1368 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
1369 : :
1370 : 0 : datum->keys[0].string = xstrdup(new_key);
1371 : 0 : datum->values[0].string = xstrdup(new_value);
1372 : :
1373 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
1374 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_EXTERNAL_IDS],
1375 : : datum);
1376 : 0 : }
1377 : :
1378 : : /* Deletes an element of the "external_ids" map column from the "Chassis" table in 'row'
1379 : : * given the key value 'delete_key'.
1380 : : *
1381 : : */
1382 : : void
1383 : 0 : sbrec_chassis_update_external_ids_delkey(const struct sbrec_chassis *row, const char *delete_key)
1384 : : {
1385 : : struct ovsdb_datum *datum;
1386 : :
1387 [ # # ]: 0 : ovs_assert(inited);
1388 : :
1389 : 0 : datum = xmalloc(sizeof *datum);
1390 : 0 : datum->n = 1;
1391 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
1392 : 0 : datum->values = NULL;
1393 : :
1394 : 0 : datum->keys[0].string = xstrdup(delete_key);
1395 : :
1396 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
1397 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_EXTERNAL_IDS],
1398 : : datum);
1399 : 0 : }
1400 : :
1401 : : /* Adds the value 'new_value' to the "vtep_logical_switches" set column from the "Chassis" table
1402 : : * in 'row'.
1403 : : *
1404 : : */
1405 : : void
1406 : 0 : sbrec_chassis_update_vtep_logical_switches_addvalue(const struct sbrec_chassis *row, const char *new_value)
1407 : : {
1408 : : struct ovsdb_datum *datum;
1409 : :
1410 [ # # ]: 0 : ovs_assert(inited);
1411 : :
1412 : 0 : datum = xmalloc(sizeof *datum);
1413 : 0 : datum->n = 1;
1414 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
1415 : 0 : datum->values = NULL;
1416 : :
1417 : 0 : datum->keys[0].string = xstrdup(new_value);
1418 : :
1419 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
1420 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_VTEP_LOGICAL_SWITCHES],
1421 : : datum);
1422 : 0 : }
1423 : :
1424 : : /* Deletes the value 'delete_value' from the "vtep_logical_switches" set column from the
1425 : : * "Chassis" table in 'row'.
1426 : : *
1427 : : */
1428 : : void
1429 : 0 : sbrec_chassis_update_vtep_logical_switches_delvalue(const struct sbrec_chassis *row, const char *delete_value)
1430 : : {
1431 : : struct ovsdb_datum *datum;
1432 : :
1433 [ # # ]: 0 : ovs_assert(inited);
1434 : :
1435 : 0 : datum = xmalloc(sizeof *datum);
1436 : 0 : datum->n = 1;
1437 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
1438 : 0 : datum->values = NULL;
1439 : :
1440 : 0 : datum->keys[0].string = xstrdup(delete_value);
1441 : :
1442 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
1443 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_VTEP_LOGICAL_SWITCHES],
1444 : : datum);
1445 : 0 : }
1446 : :
1447 : : /* Sets the "encaps" column from the "Chassis" table in 'row' to
1448 : : * the 'encaps' set with 'n_encaps' entries.
1449 : : *
1450 : : * The caller retains ownership of the arguments. */
1451 : : void
1452 : 0 : sbrec_chassis_add_clause_encaps(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **encaps, size_t n_encaps)
1453 : : {
1454 : : struct ovsdb_datum datum;
1455 : : size_t i;
1456 : :
1457 [ # # ]: 0 : ovs_assert(inited);
1458 : 0 : datum.n = n_encaps;
1459 [ # # ]: 0 : datum.keys = n_encaps ? xmalloc(n_encaps * sizeof *datum.keys) : NULL;
1460 : 0 : datum.values = NULL;
1461 [ # # ]: 0 : for (i = 0; i < n_encaps; i++) {
1462 : 0 : datum.keys[i].uuid = *encaps[i];
1463 : : }
1464 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
1465 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1466 : : function,
1467 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_ENCAPS],
1468 : : &datum);
1469 : 0 : free(datum.keys);
1470 : 0 : }
1471 : :
1472 : : /* Sets the "external_ids" column's value from the "Chassis" table in 'row'
1473 : : * to 'external_ids'.
1474 : : *
1475 : : * The caller retains ownership of 'external_ids' and everything in it. */
1476 : : void
1477 : 0 : sbrec_chassis_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
1478 : : {
1479 : : struct ovsdb_datum datum;
1480 : :
1481 [ # # ]: 0 : ovs_assert(inited);
1482 [ # # ]: 0 : if (external_ids) {
1483 : : struct smap_node *node;
1484 : : size_t i;
1485 : :
1486 : 0 : datum.n = smap_count(external_ids);
1487 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1488 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
1489 : :
1490 : 0 : i = 0;
1491 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
1492 : 0 : datum.keys[i].string = xstrdup(node->key);
1493 : 0 : datum.values[i].string = xstrdup(node->value);
1494 : 0 : i++;
1495 : : }
1496 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1497 : : } else {
1498 : 0 : ovsdb_datum_init_empty(&datum);
1499 : : }
1500 : :
1501 : 0 : ovsdb_idl_condition_add_clause(idl,
1502 : : &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1503 : : function,
1504 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_EXTERNAL_IDS],
1505 : : &datum);
1506 : :
1507 : 0 : ovsdb_datum_destroy(&datum, &sbrec_chassis_col_external_ids.type);
1508 : 0 : }
1509 : :
1510 : :
1511 : : /* Sets the "hostname" column from the "Chassis" table in 'row' to
1512 : : * 'hostname'.
1513 : : *
1514 : : * The caller retains ownership of the arguments. */
1515 : : void
1516 : 0 : sbrec_chassis_add_clause_hostname(struct ovsdb_idl *idl, enum ovsdb_function function, const char *hostname)
1517 : : {
1518 : : struct ovsdb_datum datum;
1519 : : union ovsdb_atom key;
1520 : :
1521 [ # # ]: 0 : ovs_assert(inited);
1522 : 0 : datum.n = 1;
1523 : 0 : datum.keys = &key;
1524 : 0 : key.string = CONST_CAST(char *, hostname);
1525 : 0 : datum.values = NULL;
1526 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1527 : : function,
1528 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_HOSTNAME],
1529 : : &datum);
1530 : 0 : }
1531 : :
1532 : : /* Sets the "name" column from the "Chassis" table in 'row' to
1533 : : * 'name'.
1534 : : *
1535 : : * The caller retains ownership of the arguments. */
1536 : : void
1537 : 0 : sbrec_chassis_add_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
1538 : : {
1539 : : struct ovsdb_datum datum;
1540 : : union ovsdb_atom key;
1541 : :
1542 [ # # ]: 0 : ovs_assert(inited);
1543 : 0 : datum.n = 1;
1544 : 0 : datum.keys = &key;
1545 : 0 : key.string = CONST_CAST(char *, name);
1546 : 0 : datum.values = NULL;
1547 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1548 : : function,
1549 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_NAME],
1550 : : &datum);
1551 : 0 : }
1552 : :
1553 : : /* Sets the "nb_cfg" column from the "Chassis" table in 'row' to
1554 : : * 'nb_cfg'.
1555 : : *
1556 : : * The caller retains ownership of the arguments. */
1557 : : void
1558 : 0 : sbrec_chassis_add_clause_nb_cfg(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t nb_cfg)
1559 : : {
1560 : : struct ovsdb_datum datum;
1561 : : union ovsdb_atom key;
1562 : :
1563 [ # # ]: 0 : ovs_assert(inited);
1564 : 0 : datum.n = 1;
1565 : 0 : datum.keys = &key;
1566 : 0 : key.integer = nb_cfg;
1567 : 0 : datum.values = NULL;
1568 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1569 : : function,
1570 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_NB_CFG],
1571 : : &datum);
1572 : 0 : }
1573 : :
1574 : : /* Sets the "vtep_logical_switches" column from the "Chassis" table in 'row' to
1575 : : * the 'vtep_logical_switches' set with 'n_vtep_logical_switches' entries.
1576 : : *
1577 : : * The caller retains ownership of the arguments. */
1578 : : void
1579 : 0 : sbrec_chassis_add_clause_vtep_logical_switches(struct ovsdb_idl *idl, enum ovsdb_function function, const char **vtep_logical_switches, size_t n_vtep_logical_switches)
1580 : : {
1581 : : struct ovsdb_datum datum;
1582 : : size_t i;
1583 : :
1584 [ # # ]: 0 : ovs_assert(inited);
1585 : 0 : datum.n = n_vtep_logical_switches;
1586 [ # # ]: 0 : datum.keys = n_vtep_logical_switches ? xmalloc(n_vtep_logical_switches * sizeof *datum.keys) : NULL;
1587 : 0 : datum.values = NULL;
1588 [ # # ]: 0 : for (i = 0; i < n_vtep_logical_switches; i++) {
1589 : 0 : datum.keys[i].string = CONST_CAST(char *, vtep_logical_switches[i]);
1590 : : }
1591 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
1592 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1593 : : function,
1594 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_VTEP_LOGICAL_SWITCHES],
1595 : : &datum);
1596 : 0 : free(datum.keys);
1597 : 0 : }
1598 : : void
1599 : 0 : sbrec_chassis_add_clause_false(struct ovsdb_idl *idl)
1600 : : {
1601 : : struct ovsdb_datum datum;
1602 : :
1603 : 0 : ovsdb_datum_init_empty(&datum);
1604 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS], OVSDB_F_FALSE, NULL, &datum);
1605 : 0 : }
1606 : : void
1607 : 0 : sbrec_chassis_add_clause_true(struct ovsdb_idl *idl)
1608 : : {
1609 : : struct ovsdb_datum datum;
1610 : :
1611 : 0 : ovsdb_datum_init_empty(&datum);
1612 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS], OVSDB_F_TRUE, NULL, &datum);
1613 : 0 : }
1614 : :
1615 : : /* Sets the "encaps" column from the "Chassis" table in 'row' to
1616 : : * the 'encaps' set with 'n_encaps' entries.
1617 : : *
1618 : : * The caller retains ownership of the arguments. */
1619 : : void
1620 : 0 : sbrec_chassis_remove_clause_encaps(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **encaps, size_t n_encaps)
1621 : : {
1622 : : struct ovsdb_datum datum;
1623 : : size_t i;
1624 : :
1625 [ # # ]: 0 : ovs_assert(inited);
1626 : 0 : datum.n = n_encaps;
1627 [ # # ]: 0 : datum.keys = n_encaps ? xmalloc(n_encaps * sizeof *datum.keys) : NULL;
1628 : 0 : datum.values = NULL;
1629 [ # # ]: 0 : for (i = 0; i < n_encaps; i++) {
1630 : 0 : datum.keys[i].uuid = *encaps[i];
1631 : : }
1632 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
1633 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1634 : : function,
1635 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_ENCAPS],
1636 : : &datum);
1637 : 0 : free(datum.keys);
1638 : 0 : }
1639 : :
1640 : : /* Sets the "external_ids" column's value from the "Chassis" table in 'row'
1641 : : * to 'external_ids'.
1642 : : *
1643 : : * The caller retains ownership of 'external_ids' and everything in it. */
1644 : : void
1645 : 0 : sbrec_chassis_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
1646 : : {
1647 : : struct ovsdb_datum datum;
1648 : :
1649 [ # # ]: 0 : ovs_assert(inited);
1650 [ # # ]: 0 : if (external_ids) {
1651 : : struct smap_node *node;
1652 : : size_t i;
1653 : :
1654 : 0 : datum.n = smap_count(external_ids);
1655 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1656 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
1657 : :
1658 : 0 : i = 0;
1659 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
1660 : 0 : datum.keys[i].string = xstrdup(node->key);
1661 : 0 : datum.values[i].string = xstrdup(node->value);
1662 : 0 : i++;
1663 : : }
1664 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1665 : : } else {
1666 : 0 : ovsdb_datum_init_empty(&datum);
1667 : : }
1668 : :
1669 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1670 : : function,
1671 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_EXTERNAL_IDS],
1672 : : &datum);
1673 : :
1674 : 0 : ovsdb_datum_destroy(&datum, &sbrec_chassis_col_external_ids.type);
1675 : 0 : }
1676 : :
1677 : :
1678 : : /* Sets the "hostname" column from the "Chassis" table in 'row' to
1679 : : * 'hostname'.
1680 : : *
1681 : : * The caller retains ownership of the arguments. */
1682 : : void
1683 : 0 : sbrec_chassis_remove_clause_hostname(struct ovsdb_idl *idl, enum ovsdb_function function, const char *hostname)
1684 : : {
1685 : : struct ovsdb_datum datum;
1686 : : union ovsdb_atom key;
1687 : :
1688 [ # # ]: 0 : ovs_assert(inited);
1689 : 0 : datum.n = 1;
1690 : 0 : datum.keys = &key;
1691 : 0 : key.string = CONST_CAST(char *, hostname);
1692 : 0 : datum.values = NULL;
1693 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1694 : : function,
1695 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_HOSTNAME],
1696 : : &datum);
1697 : 0 : }
1698 : :
1699 : : /* Sets the "name" column from the "Chassis" table in 'row' to
1700 : : * 'name'.
1701 : : *
1702 : : * The caller retains ownership of the arguments. */
1703 : : void
1704 : 0 : sbrec_chassis_remove_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
1705 : : {
1706 : : struct ovsdb_datum datum;
1707 : : union ovsdb_atom key;
1708 : :
1709 [ # # ]: 0 : ovs_assert(inited);
1710 : 0 : datum.n = 1;
1711 : 0 : datum.keys = &key;
1712 : 0 : key.string = CONST_CAST(char *, name);
1713 : 0 : datum.values = NULL;
1714 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1715 : : function,
1716 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_NAME],
1717 : : &datum);
1718 : 0 : }
1719 : :
1720 : : /* Sets the "nb_cfg" column from the "Chassis" table in 'row' to
1721 : : * 'nb_cfg'.
1722 : : *
1723 : : * The caller retains ownership of the arguments. */
1724 : : void
1725 : 0 : sbrec_chassis_remove_clause_nb_cfg(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t nb_cfg)
1726 : : {
1727 : : struct ovsdb_datum datum;
1728 : : union ovsdb_atom key;
1729 : :
1730 [ # # ]: 0 : ovs_assert(inited);
1731 : 0 : datum.n = 1;
1732 : 0 : datum.keys = &key;
1733 : 0 : key.integer = nb_cfg;
1734 : 0 : datum.values = NULL;
1735 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1736 : : function,
1737 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_NB_CFG],
1738 : : &datum);
1739 : 0 : }
1740 : :
1741 : : /* Sets the "vtep_logical_switches" column from the "Chassis" table in 'row' to
1742 : : * the 'vtep_logical_switches' set with 'n_vtep_logical_switches' entries.
1743 : : *
1744 : : * The caller retains ownership of the arguments. */
1745 : : void
1746 : 0 : sbrec_chassis_remove_clause_vtep_logical_switches(struct ovsdb_idl *idl, enum ovsdb_function function, const char **vtep_logical_switches, size_t n_vtep_logical_switches)
1747 : : {
1748 : : struct ovsdb_datum datum;
1749 : : size_t i;
1750 : :
1751 [ # # ]: 0 : ovs_assert(inited);
1752 : 0 : datum.n = n_vtep_logical_switches;
1753 [ # # ]: 0 : datum.keys = n_vtep_logical_switches ? xmalloc(n_vtep_logical_switches * sizeof *datum.keys) : NULL;
1754 : 0 : datum.values = NULL;
1755 [ # # ]: 0 : for (i = 0; i < n_vtep_logical_switches; i++) {
1756 : 0 : datum.keys[i].string = CONST_CAST(char *, vtep_logical_switches[i]);
1757 : : }
1758 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
1759 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS],
1760 : : function,
1761 : : &sbrec_chassis_columns[SBREC_CHASSIS_COL_VTEP_LOGICAL_SWITCHES],
1762 : : &datum);
1763 : 0 : free(datum.keys);
1764 : 0 : }
1765 : : void
1766 : 0 : sbrec_chassis_remove_clause_false(struct ovsdb_idl *idl)
1767 : : {
1768 : : struct ovsdb_datum datum;
1769 : :
1770 : 0 : ovsdb_datum_init_empty(&datum);
1771 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS], OVSDB_F_FALSE, NULL, &datum);
1772 : 0 : }
1773 : : void
1774 : 0 : sbrec_chassis_remove_clause_true(struct ovsdb_idl *idl)
1775 : : {
1776 : : struct ovsdb_datum datum;
1777 : :
1778 : 0 : ovsdb_datum_init_empty(&datum);
1779 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_CHASSIS], OVSDB_F_TRUE, NULL, &datum);
1780 : 0 : }
1781 : :
1782 : : struct ovsdb_idl_column sbrec_chassis_columns[SBREC_CHASSIS_N_COLUMNS];
1783 : :
1784 : : static void
1785 : 272 : sbrec_chassis_columns_init(void)
1786 : : {
1787 : : struct ovsdb_idl_column *c;
1788 : :
1789 : : /* Initialize sbrec_chassis_col_encaps. */
1790 : 272 : c = &sbrec_chassis_col_encaps;
1791 : 272 : c->name = "encaps";
1792 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1793 : 272 : c->type.key.u.uuid.refTableName = "Encap";
1794 : 272 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1795 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1796 : 272 : c->type.n_min = 1;
1797 : 272 : c->type.n_max = UINT_MAX;
1798 : 272 : c->mutable = true;
1799 : 272 : c->parse = sbrec_chassis_parse_encaps;
1800 : 272 : c->unparse = sbrec_chassis_unparse_encaps;
1801 : :
1802 : : /* Initialize sbrec_chassis_col_external_ids. */
1803 : 272 : c = &sbrec_chassis_col_external_ids;
1804 : 272 : c->name = "external_ids";
1805 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1806 : 272 : c->type.key.u.string.minLen = 0;
1807 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
1808 : 272 : c->type.value.u.string.minLen = 0;
1809 : 272 : c->type.n_min = 0;
1810 : 272 : c->type.n_max = UINT_MAX;
1811 : 272 : c->mutable = true;
1812 : 272 : c->parse = sbrec_chassis_parse_external_ids;
1813 : 272 : c->unparse = sbrec_chassis_unparse_external_ids;
1814 : :
1815 : : /* Initialize sbrec_chassis_col_hostname. */
1816 : 272 : c = &sbrec_chassis_col_hostname;
1817 : 272 : c->name = "hostname";
1818 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1819 : 272 : c->type.key.u.string.minLen = 0;
1820 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1821 : 272 : c->type.n_min = 1;
1822 : 272 : c->type.n_max = 1;
1823 : 272 : c->mutable = true;
1824 : 272 : c->parse = sbrec_chassis_parse_hostname;
1825 : 272 : c->unparse = sbrec_chassis_unparse_hostname;
1826 : :
1827 : : /* Initialize sbrec_chassis_col_name. */
1828 : 272 : c = &sbrec_chassis_col_name;
1829 : 272 : c->name = "name";
1830 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1831 : 272 : c->type.key.u.string.minLen = 0;
1832 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1833 : 272 : c->type.n_min = 1;
1834 : 272 : c->type.n_max = 1;
1835 : 272 : c->mutable = true;
1836 : 272 : c->parse = sbrec_chassis_parse_name;
1837 : 272 : c->unparse = sbrec_chassis_unparse_name;
1838 : :
1839 : : /* Initialize sbrec_chassis_col_nb_cfg. */
1840 : 272 : c = &sbrec_chassis_col_nb_cfg;
1841 : 272 : c->name = "nb_cfg";
1842 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
1843 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1844 : 272 : c->type.n_min = 1;
1845 : 272 : c->type.n_max = 1;
1846 : 272 : c->mutable = true;
1847 : 272 : c->parse = sbrec_chassis_parse_nb_cfg;
1848 : 272 : c->unparse = sbrec_chassis_unparse_nb_cfg;
1849 : :
1850 : : /* Initialize sbrec_chassis_col_vtep_logical_switches. */
1851 : 272 : c = &sbrec_chassis_col_vtep_logical_switches;
1852 : 272 : c->name = "vtep_logical_switches";
1853 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1854 : 272 : c->type.key.u.string.minLen = 0;
1855 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1856 : 272 : c->type.n_min = 0;
1857 : 272 : c->type.n_max = UINT_MAX;
1858 : 272 : c->mutable = true;
1859 : 272 : c->parse = sbrec_chassis_parse_vtep_logical_switches;
1860 : 272 : c->unparse = sbrec_chassis_unparse_vtep_logical_switches;
1861 : 272 : }
1862 : :
1863 : : /* DHCP_Options table. */
1864 : :
1865 : : static void
1866 : 2985 : sbrec_dhcp_options_parse_code(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1867 : : {
1868 : 2985 : struct sbrec_dhcp_options *row = sbrec_dhcp_options_cast(row_);
1869 : :
1870 [ - + ]: 2985 : ovs_assert(inited);
1871 [ + - ]: 2985 : if (datum->n >= 1) {
1872 : 2985 : row->code = datum->keys[0].integer;
1873 : : } else {
1874 : 0 : row->code = 0;
1875 : : }
1876 : 2985 : }
1877 : :
1878 : : static void
1879 : 3024 : sbrec_dhcp_options_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1880 : : {
1881 : 3024 : struct sbrec_dhcp_options *row = sbrec_dhcp_options_cast(row_);
1882 : :
1883 [ - + ]: 3024 : ovs_assert(inited);
1884 [ + - ]: 3024 : if (datum->n >= 1) {
1885 : 3024 : row->name = datum->keys[0].string;
1886 : : } else {
1887 : 0 : row->name = "";
1888 : : }
1889 : 3024 : }
1890 : :
1891 : : static void
1892 : 3024 : sbrec_dhcp_options_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1893 : : {
1894 : 3024 : struct sbrec_dhcp_options *row = sbrec_dhcp_options_cast(row_);
1895 : :
1896 [ - + ]: 3024 : ovs_assert(inited);
1897 [ + - ]: 3024 : if (datum->n >= 1) {
1898 : 3024 : row->type = datum->keys[0].string;
1899 : : } else {
1900 : 0 : row->type = "";
1901 : : }
1902 : 3024 : }
1903 : :
1904 : : static void
1905 : 3921 : sbrec_dhcp_options_unparse_code(struct ovsdb_idl_row *row OVS_UNUSED)
1906 : : {
1907 : : /* Nothing to do. */
1908 : 3921 : }
1909 : :
1910 : : static void
1911 : 3960 : sbrec_dhcp_options_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
1912 : : {
1913 : : /* Nothing to do. */
1914 : 3960 : }
1915 : :
1916 : : static void
1917 : 3960 : sbrec_dhcp_options_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
1918 : : {
1919 : : /* Nothing to do. */
1920 : 3960 : }
1921 : :
1922 : : static void
1923 : 3024 : sbrec_dhcp_options_init__(struct ovsdb_idl_row *row)
1924 : : {
1925 : 3024 : sbrec_dhcp_options_init(sbrec_dhcp_options_cast(row));
1926 : 3024 : }
1927 : :
1928 : : /* Clears the contents of 'row' in table "DHCP_Options". */
1929 : : void
1930 : 3024 : sbrec_dhcp_options_init(struct sbrec_dhcp_options *row)
1931 : : {
1932 : 3024 : memset(row, 0, sizeof *row);
1933 : 3024 : }
1934 : :
1935 : : /* Searches table "DHCP_Options" in 'idl' for a row with UUID 'uuid'. Returns
1936 : : * a pointer to the row if there is one, otherwise a null pointer. */
1937 : : const struct sbrec_dhcp_options *
1938 : 0 : sbrec_dhcp_options_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
1939 : : {
1940 : 0 : return sbrec_dhcp_options_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS], uuid));
1941 : : }
1942 : :
1943 : : /* Returns a row in table "DHCP_Options" in 'idl', or a null pointer if that
1944 : : * table is empty.
1945 : : *
1946 : : * Database tables are internally maintained as hash tables, so adding or
1947 : : * removing rows while traversing the same table can cause some rows to be
1948 : : * visited twice or not at apply. */
1949 : : const struct sbrec_dhcp_options *
1950 : 5638 : sbrec_dhcp_options_first(const struct ovsdb_idl *idl)
1951 : : {
1952 : 5638 : return sbrec_dhcp_options_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS]));
1953 : : }
1954 : :
1955 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
1956 : : * is the last row in its table. */
1957 : : const struct sbrec_dhcp_options *
1958 : 130872 : sbrec_dhcp_options_next(const struct sbrec_dhcp_options *row)
1959 : : {
1960 : 130872 : return sbrec_dhcp_options_cast(ovsdb_idl_next_row(&row->header_));
1961 : : }
1962 : :
1963 : 0 : unsigned int sbrec_dhcp_options_get_seqno(const struct ovsdb_idl *idl)
1964 : : {
1965 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS]);
1966 : : }
1967 : :
1968 : 0 : unsigned int sbrec_dhcp_options_row_get_seqno(const struct sbrec_dhcp_options *row, enum ovsdb_idl_change change)
1969 : : {
1970 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
1971 : : }
1972 : :
1973 : : const struct sbrec_dhcp_options *
1974 : 0 : sbrec_dhcp_options_track_get_first(const struct ovsdb_idl *idl)
1975 : : {
1976 : 0 : return sbrec_dhcp_options_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS]));
1977 : : }
1978 : :
1979 : : const struct sbrec_dhcp_options
1980 : 0 : *sbrec_dhcp_options_track_get_next(const struct sbrec_dhcp_options *row)
1981 : : {
1982 : 0 : return sbrec_dhcp_options_cast(ovsdb_idl_track_get_next(&row->header_));
1983 : : }
1984 : :
1985 : :
1986 : : /* Deletes 'row' from table "DHCP_Options". 'row' may be freed, so it must not be
1987 : : * accessed afterward.
1988 : : *
1989 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1990 : : void
1991 : 0 : sbrec_dhcp_options_delete(const struct sbrec_dhcp_options *row)
1992 : : {
1993 : 0 : ovsdb_idl_txn_delete(&row->header_);
1994 : 0 : }
1995 : :
1996 : : /* Inserts and returns a new row in the table "DHCP_Options" in the database
1997 : : * with open transaction 'txn'.
1998 : : *
1999 : : * The new row is assigned a randomly generated provisional UUID.
2000 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
2001 : : * but the IDL will replace any uses of the provisional UUID in the
2002 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
2003 : : struct sbrec_dhcp_options *
2004 : 936 : sbrec_dhcp_options_insert(struct ovsdb_idl_txn *txn)
2005 : : {
2006 : 936 : return sbrec_dhcp_options_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS], NULL));
2007 : : }
2008 : :
2009 : : bool
2010 : 0 : sbrec_dhcp_options_is_updated(const struct sbrec_dhcp_options *row, enum sbrec_dhcp_options_column_id column)
2011 : : {
2012 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_dhcp_options_columns[column]);
2013 : : }
2014 : :
2015 : : /* Causes the original contents of column "code" in 'row' to be
2016 : : * verified as a prerequisite to completing the transaction. That is, if
2017 : : * "code" in 'row' changed (or if 'row' was deleted) between the
2018 : : * time that the IDL originally read its contents and the time that the
2019 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
2020 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
2021 : : * change has already been received).
2022 : : *
2023 : : * The intention is that, to ensure that no transaction commits based on dirty
2024 : : * reads, an application should call this function any time "code" is
2025 : : * read as part of a read-modify-write operation.
2026 : : *
2027 : : * In some cases this function reduces to a no-op, because the current value
2028 : : * of "code" is already known:
2029 : : *
2030 : : * - If 'row' is a row created by the current transaction (returned by
2031 : : * sbrec_dhcp_options_insert()).
2032 : : *
2033 : : * - If "code" has already been modified (with
2034 : : * sbrec_dhcp_options_set_code()) within the current transaction.
2035 : : *
2036 : : * Because of the latter property, always call this function *before*
2037 : : * sbrec_dhcp_options_set_code() for a given read-modify-write.
2038 : : *
2039 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2040 : : void
2041 : 0 : sbrec_dhcp_options_verify_code(const struct sbrec_dhcp_options *row)
2042 : : {
2043 [ # # ]: 0 : ovs_assert(inited);
2044 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_CODE]);
2045 : 0 : }
2046 : :
2047 : : /* Causes the original contents of column "name" in 'row' to be
2048 : : * verified as a prerequisite to completing the transaction. That is, if
2049 : : * "name" in 'row' changed (or if 'row' was deleted) between the
2050 : : * time that the IDL originally read its contents and the time that the
2051 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
2052 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
2053 : : * change has already been received).
2054 : : *
2055 : : * The intention is that, to ensure that no transaction commits based on dirty
2056 : : * reads, an application should call this function any time "name" is
2057 : : * read as part of a read-modify-write operation.
2058 : : *
2059 : : * In some cases this function reduces to a no-op, because the current value
2060 : : * of "name" is already known:
2061 : : *
2062 : : * - If 'row' is a row created by the current transaction (returned by
2063 : : * sbrec_dhcp_options_insert()).
2064 : : *
2065 : : * - If "name" has already been modified (with
2066 : : * sbrec_dhcp_options_set_name()) within the current transaction.
2067 : : *
2068 : : * Because of the latter property, always call this function *before*
2069 : : * sbrec_dhcp_options_set_name() for a given read-modify-write.
2070 : : *
2071 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2072 : : void
2073 : 0 : sbrec_dhcp_options_verify_name(const struct sbrec_dhcp_options *row)
2074 : : {
2075 [ # # ]: 0 : ovs_assert(inited);
2076 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_NAME]);
2077 : 0 : }
2078 : :
2079 : : /* Causes the original contents of column "type" in 'row' to be
2080 : : * verified as a prerequisite to completing the transaction. That is, if
2081 : : * "type" in 'row' changed (or if 'row' was deleted) between the
2082 : : * time that the IDL originally read its contents and the time that the
2083 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
2084 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
2085 : : * change has already been received).
2086 : : *
2087 : : * The intention is that, to ensure that no transaction commits based on dirty
2088 : : * reads, an application should call this function any time "type" is
2089 : : * read as part of a read-modify-write operation.
2090 : : *
2091 : : * In some cases this function reduces to a no-op, because the current value
2092 : : * of "type" is already known:
2093 : : *
2094 : : * - If 'row' is a row created by the current transaction (returned by
2095 : : * sbrec_dhcp_options_insert()).
2096 : : *
2097 : : * - If "type" has already been modified (with
2098 : : * sbrec_dhcp_options_set_type()) within the current transaction.
2099 : : *
2100 : : * Because of the latter property, always call this function *before*
2101 : : * sbrec_dhcp_options_set_type() for a given read-modify-write.
2102 : : *
2103 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2104 : : void
2105 : 0 : sbrec_dhcp_options_verify_type(const struct sbrec_dhcp_options *row)
2106 : : {
2107 [ # # ]: 0 : ovs_assert(inited);
2108 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_TYPE]);
2109 : 0 : }
2110 : :
2111 : : /* Returns the "code" column's value from the "DHCP_Options" table in 'row'
2112 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
2113 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
2114 : : * for a given key than implementing the same operation on the "cooked"
2115 : : * form in 'row'.
2116 : : *
2117 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
2118 : : * (This helps to avoid silent bugs if someone changes code's
2119 : : * type without updating the caller.)
2120 : : *
2121 : : * The caller must not modify or free the returned value.
2122 : : *
2123 : : * Various kinds of changes can invalidate the returned value: modifying
2124 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2125 : : * If the returned value is needed for a long time, it is best to make a copy
2126 : : * of it with ovsdb_datum_clone().
2127 : : *
2128 : : * This function is rarely useful, since it is easier to access the value
2129 : : * directly through the "code" member in sbrec_dhcp_options. */
2130 : : const struct ovsdb_datum *
2131 : 0 : sbrec_dhcp_options_get_code(const struct sbrec_dhcp_options *row,
2132 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
2133 : : {
2134 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2135 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_dhcp_options_col_code);
2136 : : }
2137 : :
2138 : : /* Returns the "name" column's value from the "DHCP_Options" table in 'row'
2139 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
2140 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
2141 : : * for a given key than implementing the same operation on the "cooked"
2142 : : * form in 'row'.
2143 : : *
2144 : : * 'key_type' must be OVSDB_TYPE_STRING.
2145 : : * (This helps to avoid silent bugs if someone changes name's
2146 : : * type without updating the caller.)
2147 : : *
2148 : : * The caller must not modify or free the returned value.
2149 : : *
2150 : : * Various kinds of changes can invalidate the returned value: modifying
2151 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2152 : : * If the returned value is needed for a long time, it is best to make a copy
2153 : : * of it with ovsdb_datum_clone().
2154 : : *
2155 : : * This function is rarely useful, since it is easier to access the value
2156 : : * directly through the "name" member in sbrec_dhcp_options. */
2157 : : const struct ovsdb_datum *
2158 : 0 : sbrec_dhcp_options_get_name(const struct sbrec_dhcp_options *row,
2159 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
2160 : : {
2161 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
2162 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_dhcp_options_col_name);
2163 : : }
2164 : :
2165 : : /* Returns the "type" column's value from the "DHCP_Options" table in 'row'
2166 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
2167 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
2168 : : * for a given key than implementing the same operation on the "cooked"
2169 : : * form in 'row'.
2170 : : *
2171 : : * 'key_type' must be OVSDB_TYPE_STRING.
2172 : : * (This helps to avoid silent bugs if someone changes type's
2173 : : * type without updating the caller.)
2174 : : *
2175 : : * The caller must not modify or free the returned value.
2176 : : *
2177 : : * Various kinds of changes can invalidate the returned value: modifying
2178 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2179 : : * If the returned value is needed for a long time, it is best to make a copy
2180 : : * of it with ovsdb_datum_clone().
2181 : : *
2182 : : * This function is rarely useful, since it is easier to access the value
2183 : : * directly through the "type" member in sbrec_dhcp_options. */
2184 : : const struct ovsdb_datum *
2185 : 0 : sbrec_dhcp_options_get_type(const struct sbrec_dhcp_options *row,
2186 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
2187 : : {
2188 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
2189 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_dhcp_options_col_type);
2190 : : }
2191 : :
2192 : : /* Sets the "code" column from the "DHCP_Options" table in 'row' to
2193 : : * 'code'.
2194 : : *
2195 : : * Argument constraints: in range 0 to 254
2196 : : *
2197 : : * The caller retains ownership of the arguments. */
2198 : : void
2199 : 936 : sbrec_dhcp_options_set_code(const struct sbrec_dhcp_options *row, int64_t code)
2200 : : {
2201 : : struct ovsdb_datum datum;
2202 : : union ovsdb_atom key;
2203 : :
2204 [ - + ]: 936 : ovs_assert(inited);
2205 : 936 : datum.n = 1;
2206 : 936 : datum.keys = &key;
2207 : 936 : key.integer = code;
2208 : 936 : datum.values = NULL;
2209 : 936 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_CODE], &datum);
2210 : 936 : }
2211 : :
2212 : : /* Sets the "name" column from the "DHCP_Options" table in 'row' to
2213 : : * 'name'.
2214 : : *
2215 : : * The caller retains ownership of the arguments. */
2216 : : void
2217 : 936 : sbrec_dhcp_options_set_name(const struct sbrec_dhcp_options *row, const char *name)
2218 : : {
2219 : : struct ovsdb_datum datum;
2220 : : union ovsdb_atom key;
2221 : :
2222 [ - + ]: 936 : ovs_assert(inited);
2223 : 936 : datum.n = 1;
2224 : 936 : datum.keys = &key;
2225 : 936 : key.string = CONST_CAST(char *, name);
2226 : 936 : datum.values = NULL;
2227 : 936 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_NAME], &datum);
2228 : 936 : }
2229 : :
2230 : : /* Sets the "type" column from the "DHCP_Options" table in 'row' to
2231 : : * 'type'.
2232 : : *
2233 : : * Argument constraints: one of "static_routes", "uint8", "uint16", "bool", "ipv4", "str", or "uint32"
2234 : : *
2235 : : * The caller retains ownership of the arguments. */
2236 : : void
2237 : 936 : sbrec_dhcp_options_set_type(const struct sbrec_dhcp_options *row, const char *type)
2238 : : {
2239 : : struct ovsdb_datum datum;
2240 : : union ovsdb_atom key;
2241 : :
2242 [ - + ]: 936 : ovs_assert(inited);
2243 : 936 : datum.n = 1;
2244 : 936 : datum.keys = &key;
2245 : 936 : key.string = CONST_CAST(char *, type);
2246 : 936 : datum.values = NULL;
2247 : 936 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_TYPE], &datum);
2248 : 936 : }
2249 : :
2250 : : /* Sets the "code" column from the "DHCP_Options" table in 'row' to
2251 : : * 'code'.
2252 : : *
2253 : : * Argument constraints: in range 0 to 254
2254 : : *
2255 : : * The caller retains ownership of the arguments. */
2256 : : void
2257 : 0 : sbrec_dhcp_options_add_clause_code(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t code)
2258 : : {
2259 : : struct ovsdb_datum datum;
2260 : : union ovsdb_atom key;
2261 : :
2262 [ # # ]: 0 : ovs_assert(inited);
2263 : 0 : datum.n = 1;
2264 : 0 : datum.keys = &key;
2265 : 0 : key.integer = code;
2266 : 0 : datum.values = NULL;
2267 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS],
2268 : : function,
2269 : : &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_CODE],
2270 : : &datum);
2271 : 0 : }
2272 : :
2273 : : /* Sets the "name" column from the "DHCP_Options" table in 'row' to
2274 : : * 'name'.
2275 : : *
2276 : : * The caller retains ownership of the arguments. */
2277 : : void
2278 : 0 : sbrec_dhcp_options_add_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
2279 : : {
2280 : : struct ovsdb_datum datum;
2281 : : union ovsdb_atom key;
2282 : :
2283 [ # # ]: 0 : ovs_assert(inited);
2284 : 0 : datum.n = 1;
2285 : 0 : datum.keys = &key;
2286 : 0 : key.string = CONST_CAST(char *, name);
2287 : 0 : datum.values = NULL;
2288 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS],
2289 : : function,
2290 : : &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_NAME],
2291 : : &datum);
2292 : 0 : }
2293 : :
2294 : : /* Sets the "type" column from the "DHCP_Options" table in 'row' to
2295 : : * 'type'.
2296 : : *
2297 : : * Argument constraints: one of "static_routes", "uint8", "uint16", "bool", "ipv4", "str", or "uint32"
2298 : : *
2299 : : * The caller retains ownership of the arguments. */
2300 : : void
2301 : 0 : sbrec_dhcp_options_add_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
2302 : : {
2303 : : struct ovsdb_datum datum;
2304 : : union ovsdb_atom key;
2305 : :
2306 [ # # ]: 0 : ovs_assert(inited);
2307 : 0 : datum.n = 1;
2308 : 0 : datum.keys = &key;
2309 : 0 : key.string = CONST_CAST(char *, type);
2310 : 0 : datum.values = NULL;
2311 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS],
2312 : : function,
2313 : : &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_TYPE],
2314 : : &datum);
2315 : 0 : }
2316 : : void
2317 : 0 : sbrec_dhcp_options_add_clause_false(struct ovsdb_idl *idl)
2318 : : {
2319 : : struct ovsdb_datum datum;
2320 : :
2321 : 0 : ovsdb_datum_init_empty(&datum);
2322 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS], OVSDB_F_FALSE, NULL, &datum);
2323 : 0 : }
2324 : : void
2325 : 0 : sbrec_dhcp_options_add_clause_true(struct ovsdb_idl *idl)
2326 : : {
2327 : : struct ovsdb_datum datum;
2328 : :
2329 : 0 : ovsdb_datum_init_empty(&datum);
2330 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS], OVSDB_F_TRUE, NULL, &datum);
2331 : 0 : }
2332 : :
2333 : : /* Sets the "code" column from the "DHCP_Options" table in 'row' to
2334 : : * 'code'.
2335 : : *
2336 : : * Argument constraints: in range 0 to 254
2337 : : *
2338 : : * The caller retains ownership of the arguments. */
2339 : : void
2340 : 0 : sbrec_dhcp_options_remove_clause_code(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t code)
2341 : : {
2342 : : struct ovsdb_datum datum;
2343 : : union ovsdb_atom key;
2344 : :
2345 [ # # ]: 0 : ovs_assert(inited);
2346 : 0 : datum.n = 1;
2347 : 0 : datum.keys = &key;
2348 : 0 : key.integer = code;
2349 : 0 : datum.values = NULL;
2350 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS],
2351 : : function,
2352 : : &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_CODE],
2353 : : &datum);
2354 : 0 : }
2355 : :
2356 : : /* Sets the "name" column from the "DHCP_Options" table in 'row' to
2357 : : * 'name'.
2358 : : *
2359 : : * The caller retains ownership of the arguments. */
2360 : : void
2361 : 0 : sbrec_dhcp_options_remove_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
2362 : : {
2363 : : struct ovsdb_datum datum;
2364 : : union ovsdb_atom key;
2365 : :
2366 [ # # ]: 0 : ovs_assert(inited);
2367 : 0 : datum.n = 1;
2368 : 0 : datum.keys = &key;
2369 : 0 : key.string = CONST_CAST(char *, name);
2370 : 0 : datum.values = NULL;
2371 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS],
2372 : : function,
2373 : : &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_NAME],
2374 : : &datum);
2375 : 0 : }
2376 : :
2377 : : /* Sets the "type" column from the "DHCP_Options" table in 'row' to
2378 : : * 'type'.
2379 : : *
2380 : : * Argument constraints: one of "static_routes", "uint8", "uint16", "bool", "ipv4", "str", or "uint32"
2381 : : *
2382 : : * The caller retains ownership of the arguments. */
2383 : : void
2384 : 0 : sbrec_dhcp_options_remove_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
2385 : : {
2386 : : struct ovsdb_datum datum;
2387 : : union ovsdb_atom key;
2388 : :
2389 [ # # ]: 0 : ovs_assert(inited);
2390 : 0 : datum.n = 1;
2391 : 0 : datum.keys = &key;
2392 : 0 : key.string = CONST_CAST(char *, type);
2393 : 0 : datum.values = NULL;
2394 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS],
2395 : : function,
2396 : : &sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_COL_TYPE],
2397 : : &datum);
2398 : 0 : }
2399 : : void
2400 : 0 : sbrec_dhcp_options_remove_clause_false(struct ovsdb_idl *idl)
2401 : : {
2402 : : struct ovsdb_datum datum;
2403 : :
2404 : 0 : ovsdb_datum_init_empty(&datum);
2405 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS], OVSDB_F_FALSE, NULL, &datum);
2406 : 0 : }
2407 : : void
2408 : 0 : sbrec_dhcp_options_remove_clause_true(struct ovsdb_idl *idl)
2409 : : {
2410 : : struct ovsdb_datum datum;
2411 : :
2412 : 0 : ovsdb_datum_init_empty(&datum);
2413 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCP_OPTIONS], OVSDB_F_TRUE, NULL, &datum);
2414 : 0 : }
2415 : :
2416 : : struct ovsdb_idl_column sbrec_dhcp_options_columns[SBREC_DHCP_OPTIONS_N_COLUMNS];
2417 : :
2418 : : static void
2419 : 272 : sbrec_dhcp_options_columns_init(void)
2420 : : {
2421 : : struct ovsdb_idl_column *c;
2422 : :
2423 : : /* Initialize sbrec_dhcp_options_col_code. */
2424 : 272 : c = &sbrec_dhcp_options_col_code;
2425 : 272 : c->name = "code";
2426 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
2427 : 272 : c->type.key.u.integer.min = INT64_C(0);
2428 : 272 : c->type.key.u.integer.max = INT64_C(254);
2429 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2430 : 272 : c->type.n_min = 1;
2431 : 272 : c->type.n_max = 1;
2432 : 272 : c->mutable = true;
2433 : 272 : c->parse = sbrec_dhcp_options_parse_code;
2434 : 272 : c->unparse = sbrec_dhcp_options_unparse_code;
2435 : :
2436 : : /* Initialize sbrec_dhcp_options_col_name. */
2437 : 272 : c = &sbrec_dhcp_options_col_name;
2438 : 272 : c->name = "name";
2439 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2440 : 272 : c->type.key.u.string.minLen = 0;
2441 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2442 : 272 : c->type.n_min = 1;
2443 : 272 : c->type.n_max = 1;
2444 : 272 : c->mutable = true;
2445 : 272 : c->parse = sbrec_dhcp_options_parse_name;
2446 : 272 : c->unparse = sbrec_dhcp_options_unparse_name;
2447 : :
2448 : : /* Initialize sbrec_dhcp_options_col_type. */
2449 : 272 : c = &sbrec_dhcp_options_col_type;
2450 : 272 : c->name = "type";
2451 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2452 : 272 : c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
2453 : 272 : c->type.key.enum_->n = 7;
2454 : 272 : c->type.key.enum_->keys = xmalloc(7 * sizeof *c->type.key.enum_->keys);
2455 : 272 : c->type.key.enum_->keys[0].string = xstrdup("bool");
2456 : 272 : c->type.key.enum_->keys[1].string = xstrdup("ipv4");
2457 : 272 : c->type.key.enum_->keys[2].string = xstrdup("static_routes");
2458 : 272 : c->type.key.enum_->keys[3].string = xstrdup("str");
2459 : 272 : c->type.key.enum_->keys[4].string = xstrdup("uint16");
2460 : 272 : c->type.key.enum_->keys[5].string = xstrdup("uint32");
2461 : 272 : c->type.key.enum_->keys[6].string = xstrdup("uint8");
2462 : 272 : c->type.key.enum_->values = NULL;
2463 : 272 : ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
2464 : 272 : c->type.key.u.string.minLen = 0;
2465 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2466 : 272 : c->type.n_min = 1;
2467 : 272 : c->type.n_max = 1;
2468 : 272 : c->mutable = true;
2469 : 272 : c->parse = sbrec_dhcp_options_parse_type;
2470 : 272 : c->unparse = sbrec_dhcp_options_unparse_type;
2471 : 272 : }
2472 : :
2473 : : /* DHCPv6_Options table. */
2474 : :
2475 : : static void
2476 : 504 : sbrec_dhcpv6_options_parse_code(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
2477 : : {
2478 : 504 : struct sbrec_dhcpv6_options *row = sbrec_dhcpv6_options_cast(row_);
2479 : :
2480 [ - + ]: 504 : ovs_assert(inited);
2481 [ + - ]: 504 : if (datum->n >= 1) {
2482 : 504 : row->code = datum->keys[0].integer;
2483 : : } else {
2484 : 0 : row->code = 0;
2485 : : }
2486 : 504 : }
2487 : :
2488 : : static void
2489 : 504 : sbrec_dhcpv6_options_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
2490 : : {
2491 : 504 : struct sbrec_dhcpv6_options *row = sbrec_dhcpv6_options_cast(row_);
2492 : :
2493 [ - + ]: 504 : ovs_assert(inited);
2494 [ + - ]: 504 : if (datum->n >= 1) {
2495 : 504 : row->name = datum->keys[0].string;
2496 : : } else {
2497 : 0 : row->name = "";
2498 : : }
2499 : 504 : }
2500 : :
2501 : : static void
2502 : 504 : sbrec_dhcpv6_options_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
2503 : : {
2504 : 504 : struct sbrec_dhcpv6_options *row = sbrec_dhcpv6_options_cast(row_);
2505 : :
2506 [ - + ]: 504 : ovs_assert(inited);
2507 [ + - ]: 504 : if (datum->n >= 1) {
2508 : 504 : row->type = datum->keys[0].string;
2509 : : } else {
2510 : 0 : row->type = "";
2511 : : }
2512 : 504 : }
2513 : :
2514 : : static void
2515 : 660 : sbrec_dhcpv6_options_unparse_code(struct ovsdb_idl_row *row OVS_UNUSED)
2516 : : {
2517 : : /* Nothing to do. */
2518 : 660 : }
2519 : :
2520 : : static void
2521 : 660 : sbrec_dhcpv6_options_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
2522 : : {
2523 : : /* Nothing to do. */
2524 : 660 : }
2525 : :
2526 : : static void
2527 : 660 : sbrec_dhcpv6_options_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
2528 : : {
2529 : : /* Nothing to do. */
2530 : 660 : }
2531 : :
2532 : : static void
2533 : 504 : sbrec_dhcpv6_options_init__(struct ovsdb_idl_row *row)
2534 : : {
2535 : 504 : sbrec_dhcpv6_options_init(sbrec_dhcpv6_options_cast(row));
2536 : 504 : }
2537 : :
2538 : : /* Clears the contents of 'row' in table "DHCPv6_Options". */
2539 : : void
2540 : 504 : sbrec_dhcpv6_options_init(struct sbrec_dhcpv6_options *row)
2541 : : {
2542 : 504 : memset(row, 0, sizeof *row);
2543 : 504 : }
2544 : :
2545 : : /* Searches table "DHCPv6_Options" in 'idl' for a row with UUID 'uuid'. Returns
2546 : : * a pointer to the row if there is one, otherwise a null pointer. */
2547 : : const struct sbrec_dhcpv6_options *
2548 : 0 : sbrec_dhcpv6_options_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
2549 : : {
2550 : 0 : return sbrec_dhcpv6_options_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS], uuid));
2551 : : }
2552 : :
2553 : : /* Returns a row in table "DHCPv6_Options" in 'idl', or a null pointer if that
2554 : : * table is empty.
2555 : : *
2556 : : * Database tables are internally maintained as hash tables, so adding or
2557 : : * removing rows while traversing the same table can cause some rows to be
2558 : : * visited twice or not at apply. */
2559 : : const struct sbrec_dhcpv6_options *
2560 : 5638 : sbrec_dhcpv6_options_first(const struct ovsdb_idl *idl)
2561 : : {
2562 : 5638 : return sbrec_dhcpv6_options_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS]));
2563 : : }
2564 : :
2565 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
2566 : : * is the last row in its table. */
2567 : : const struct sbrec_dhcpv6_options *
2568 : 21812 : sbrec_dhcpv6_options_next(const struct sbrec_dhcpv6_options *row)
2569 : : {
2570 : 21812 : return sbrec_dhcpv6_options_cast(ovsdb_idl_next_row(&row->header_));
2571 : : }
2572 : :
2573 : 0 : unsigned int sbrec_dhcpv6_options_get_seqno(const struct ovsdb_idl *idl)
2574 : : {
2575 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS]);
2576 : : }
2577 : :
2578 : 0 : unsigned int sbrec_dhcpv6_options_row_get_seqno(const struct sbrec_dhcpv6_options *row, enum ovsdb_idl_change change)
2579 : : {
2580 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
2581 : : }
2582 : :
2583 : : const struct sbrec_dhcpv6_options *
2584 : 0 : sbrec_dhcpv6_options_track_get_first(const struct ovsdb_idl *idl)
2585 : : {
2586 : 0 : return sbrec_dhcpv6_options_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS]));
2587 : : }
2588 : :
2589 : : const struct sbrec_dhcpv6_options
2590 : 0 : *sbrec_dhcpv6_options_track_get_next(const struct sbrec_dhcpv6_options *row)
2591 : : {
2592 : 0 : return sbrec_dhcpv6_options_cast(ovsdb_idl_track_get_next(&row->header_));
2593 : : }
2594 : :
2595 : :
2596 : : /* Deletes 'row' from table "DHCPv6_Options". 'row' may be freed, so it must not be
2597 : : * accessed afterward.
2598 : : *
2599 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2600 : : void
2601 : 0 : sbrec_dhcpv6_options_delete(const struct sbrec_dhcpv6_options *row)
2602 : : {
2603 : 0 : ovsdb_idl_txn_delete(&row->header_);
2604 : 0 : }
2605 : :
2606 : : /* Inserts and returns a new row in the table "DHCPv6_Options" in the database
2607 : : * with open transaction 'txn'.
2608 : : *
2609 : : * The new row is assigned a randomly generated provisional UUID.
2610 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
2611 : : * but the IDL will replace any uses of the provisional UUID in the
2612 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
2613 : : struct sbrec_dhcpv6_options *
2614 : 156 : sbrec_dhcpv6_options_insert(struct ovsdb_idl_txn *txn)
2615 : : {
2616 : 156 : return sbrec_dhcpv6_options_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS], NULL));
2617 : : }
2618 : :
2619 : : bool
2620 : 0 : sbrec_dhcpv6_options_is_updated(const struct sbrec_dhcpv6_options *row, enum sbrec_dhcpv6_options_column_id column)
2621 : : {
2622 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_dhcpv6_options_columns[column]);
2623 : : }
2624 : :
2625 : : /* Causes the original contents of column "code" in 'row' to be
2626 : : * verified as a prerequisite to completing the transaction. That is, if
2627 : : * "code" in 'row' changed (or if 'row' was deleted) between the
2628 : : * time that the IDL originally read its contents and the time that the
2629 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
2630 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
2631 : : * change has already been received).
2632 : : *
2633 : : * The intention is that, to ensure that no transaction commits based on dirty
2634 : : * reads, an application should call this function any time "code" is
2635 : : * read as part of a read-modify-write operation.
2636 : : *
2637 : : * In some cases this function reduces to a no-op, because the current value
2638 : : * of "code" is already known:
2639 : : *
2640 : : * - If 'row' is a row created by the current transaction (returned by
2641 : : * sbrec_dhcpv6_options_insert()).
2642 : : *
2643 : : * - If "code" has already been modified (with
2644 : : * sbrec_dhcpv6_options_set_code()) within the current transaction.
2645 : : *
2646 : : * Because of the latter property, always call this function *before*
2647 : : * sbrec_dhcpv6_options_set_code() for a given read-modify-write.
2648 : : *
2649 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2650 : : void
2651 : 0 : sbrec_dhcpv6_options_verify_code(const struct sbrec_dhcpv6_options *row)
2652 : : {
2653 [ # # ]: 0 : ovs_assert(inited);
2654 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_CODE]);
2655 : 0 : }
2656 : :
2657 : : /* Causes the original contents of column "name" in 'row' to be
2658 : : * verified as a prerequisite to completing the transaction. That is, if
2659 : : * "name" in 'row' changed (or if 'row' was deleted) between the
2660 : : * time that the IDL originally read its contents and the time that the
2661 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
2662 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
2663 : : * change has already been received).
2664 : : *
2665 : : * The intention is that, to ensure that no transaction commits based on dirty
2666 : : * reads, an application should call this function any time "name" is
2667 : : * read as part of a read-modify-write operation.
2668 : : *
2669 : : * In some cases this function reduces to a no-op, because the current value
2670 : : * of "name" is already known:
2671 : : *
2672 : : * - If 'row' is a row created by the current transaction (returned by
2673 : : * sbrec_dhcpv6_options_insert()).
2674 : : *
2675 : : * - If "name" has already been modified (with
2676 : : * sbrec_dhcpv6_options_set_name()) within the current transaction.
2677 : : *
2678 : : * Because of the latter property, always call this function *before*
2679 : : * sbrec_dhcpv6_options_set_name() for a given read-modify-write.
2680 : : *
2681 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2682 : : void
2683 : 0 : sbrec_dhcpv6_options_verify_name(const struct sbrec_dhcpv6_options *row)
2684 : : {
2685 [ # # ]: 0 : ovs_assert(inited);
2686 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_NAME]);
2687 : 0 : }
2688 : :
2689 : : /* Causes the original contents of column "type" in 'row' to be
2690 : : * verified as a prerequisite to completing the transaction. That is, if
2691 : : * "type" in 'row' changed (or if 'row' was deleted) between the
2692 : : * time that the IDL originally read its contents and the time that the
2693 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
2694 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
2695 : : * change has already been received).
2696 : : *
2697 : : * The intention is that, to ensure that no transaction commits based on dirty
2698 : : * reads, an application should call this function any time "type" is
2699 : : * read as part of a read-modify-write operation.
2700 : : *
2701 : : * In some cases this function reduces to a no-op, because the current value
2702 : : * of "type" is already known:
2703 : : *
2704 : : * - If 'row' is a row created by the current transaction (returned by
2705 : : * sbrec_dhcpv6_options_insert()).
2706 : : *
2707 : : * - If "type" has already been modified (with
2708 : : * sbrec_dhcpv6_options_set_type()) within the current transaction.
2709 : : *
2710 : : * Because of the latter property, always call this function *before*
2711 : : * sbrec_dhcpv6_options_set_type() for a given read-modify-write.
2712 : : *
2713 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2714 : : void
2715 : 0 : sbrec_dhcpv6_options_verify_type(const struct sbrec_dhcpv6_options *row)
2716 : : {
2717 [ # # ]: 0 : ovs_assert(inited);
2718 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_TYPE]);
2719 : 0 : }
2720 : :
2721 : : /* Returns the "code" column's value from the "DHCPv6_Options" table in 'row'
2722 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
2723 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
2724 : : * for a given key than implementing the same operation on the "cooked"
2725 : : * form in 'row'.
2726 : : *
2727 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
2728 : : * (This helps to avoid silent bugs if someone changes code's
2729 : : * type without updating the caller.)
2730 : : *
2731 : : * The caller must not modify or free the returned value.
2732 : : *
2733 : : * Various kinds of changes can invalidate the returned value: modifying
2734 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2735 : : * If the returned value is needed for a long time, it is best to make a copy
2736 : : * of it with ovsdb_datum_clone().
2737 : : *
2738 : : * This function is rarely useful, since it is easier to access the value
2739 : : * directly through the "code" member in sbrec_dhcpv6_options. */
2740 : : const struct ovsdb_datum *
2741 : 0 : sbrec_dhcpv6_options_get_code(const struct sbrec_dhcpv6_options *row,
2742 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
2743 : : {
2744 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2745 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_dhcpv6_options_col_code);
2746 : : }
2747 : :
2748 : : /* Returns the "name" column's value from the "DHCPv6_Options" table in 'row'
2749 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
2750 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
2751 : : * for a given key than implementing the same operation on the "cooked"
2752 : : * form in 'row'.
2753 : : *
2754 : : * 'key_type' must be OVSDB_TYPE_STRING.
2755 : : * (This helps to avoid silent bugs if someone changes name's
2756 : : * type without updating the caller.)
2757 : : *
2758 : : * The caller must not modify or free the returned value.
2759 : : *
2760 : : * Various kinds of changes can invalidate the returned value: modifying
2761 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2762 : : * If the returned value is needed for a long time, it is best to make a copy
2763 : : * of it with ovsdb_datum_clone().
2764 : : *
2765 : : * This function is rarely useful, since it is easier to access the value
2766 : : * directly through the "name" member in sbrec_dhcpv6_options. */
2767 : : const struct ovsdb_datum *
2768 : 0 : sbrec_dhcpv6_options_get_name(const struct sbrec_dhcpv6_options *row,
2769 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
2770 : : {
2771 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
2772 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_dhcpv6_options_col_name);
2773 : : }
2774 : :
2775 : : /* Returns the "type" column's value from the "DHCPv6_Options" table in 'row'
2776 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
2777 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
2778 : : * for a given key than implementing the same operation on the "cooked"
2779 : : * form in 'row'.
2780 : : *
2781 : : * 'key_type' must be OVSDB_TYPE_STRING.
2782 : : * (This helps to avoid silent bugs if someone changes type's
2783 : : * type without updating the caller.)
2784 : : *
2785 : : * The caller must not modify or free the returned value.
2786 : : *
2787 : : * Various kinds of changes can invalidate the returned value: modifying
2788 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2789 : : * If the returned value is needed for a long time, it is best to make a copy
2790 : : * of it with ovsdb_datum_clone().
2791 : : *
2792 : : * This function is rarely useful, since it is easier to access the value
2793 : : * directly through the "type" member in sbrec_dhcpv6_options. */
2794 : : const struct ovsdb_datum *
2795 : 0 : sbrec_dhcpv6_options_get_type(const struct sbrec_dhcpv6_options *row,
2796 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
2797 : : {
2798 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
2799 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_dhcpv6_options_col_type);
2800 : : }
2801 : :
2802 : : /* Sets the "code" column from the "DHCPv6_Options" table in 'row' to
2803 : : * 'code'.
2804 : : *
2805 : : * Argument constraints: in range 0 to 254
2806 : : *
2807 : : * The caller retains ownership of the arguments. */
2808 : : void
2809 : 156 : sbrec_dhcpv6_options_set_code(const struct sbrec_dhcpv6_options *row, int64_t code)
2810 : : {
2811 : : struct ovsdb_datum datum;
2812 : : union ovsdb_atom key;
2813 : :
2814 [ - + ]: 156 : ovs_assert(inited);
2815 : 156 : datum.n = 1;
2816 : 156 : datum.keys = &key;
2817 : 156 : key.integer = code;
2818 : 156 : datum.values = NULL;
2819 : 156 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_CODE], &datum);
2820 : 156 : }
2821 : :
2822 : : /* Sets the "name" column from the "DHCPv6_Options" table in 'row' to
2823 : : * 'name'.
2824 : : *
2825 : : * The caller retains ownership of the arguments. */
2826 : : void
2827 : 156 : sbrec_dhcpv6_options_set_name(const struct sbrec_dhcpv6_options *row, const char *name)
2828 : : {
2829 : : struct ovsdb_datum datum;
2830 : : union ovsdb_atom key;
2831 : :
2832 [ - + ]: 156 : ovs_assert(inited);
2833 : 156 : datum.n = 1;
2834 : 156 : datum.keys = &key;
2835 : 156 : key.string = CONST_CAST(char *, name);
2836 : 156 : datum.values = NULL;
2837 : 156 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_NAME], &datum);
2838 : 156 : }
2839 : :
2840 : : /* Sets the "type" column from the "DHCPv6_Options" table in 'row' to
2841 : : * 'type'.
2842 : : *
2843 : : * Argument constraints: one of "mac", "str", or "ipv6"
2844 : : *
2845 : : * The caller retains ownership of the arguments. */
2846 : : void
2847 : 156 : sbrec_dhcpv6_options_set_type(const struct sbrec_dhcpv6_options *row, const char *type)
2848 : : {
2849 : : struct ovsdb_datum datum;
2850 : : union ovsdb_atom key;
2851 : :
2852 [ - + ]: 156 : ovs_assert(inited);
2853 : 156 : datum.n = 1;
2854 : 156 : datum.keys = &key;
2855 : 156 : key.string = CONST_CAST(char *, type);
2856 : 156 : datum.values = NULL;
2857 : 156 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_TYPE], &datum);
2858 : 156 : }
2859 : :
2860 : : /* Sets the "code" column from the "DHCPv6_Options" table in 'row' to
2861 : : * 'code'.
2862 : : *
2863 : : * Argument constraints: in range 0 to 254
2864 : : *
2865 : : * The caller retains ownership of the arguments. */
2866 : : void
2867 : 0 : sbrec_dhcpv6_options_add_clause_code(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t code)
2868 : : {
2869 : : struct ovsdb_datum datum;
2870 : : union ovsdb_atom key;
2871 : :
2872 [ # # ]: 0 : ovs_assert(inited);
2873 : 0 : datum.n = 1;
2874 : 0 : datum.keys = &key;
2875 : 0 : key.integer = code;
2876 : 0 : datum.values = NULL;
2877 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS],
2878 : : function,
2879 : : &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_CODE],
2880 : : &datum);
2881 : 0 : }
2882 : :
2883 : : /* Sets the "name" column from the "DHCPv6_Options" table in 'row' to
2884 : : * 'name'.
2885 : : *
2886 : : * The caller retains ownership of the arguments. */
2887 : : void
2888 : 0 : sbrec_dhcpv6_options_add_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
2889 : : {
2890 : : struct ovsdb_datum datum;
2891 : : union ovsdb_atom key;
2892 : :
2893 [ # # ]: 0 : ovs_assert(inited);
2894 : 0 : datum.n = 1;
2895 : 0 : datum.keys = &key;
2896 : 0 : key.string = CONST_CAST(char *, name);
2897 : 0 : datum.values = NULL;
2898 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS],
2899 : : function,
2900 : : &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_NAME],
2901 : : &datum);
2902 : 0 : }
2903 : :
2904 : : /* Sets the "type" column from the "DHCPv6_Options" table in 'row' to
2905 : : * 'type'.
2906 : : *
2907 : : * Argument constraints: one of "mac", "str", or "ipv6"
2908 : : *
2909 : : * The caller retains ownership of the arguments. */
2910 : : void
2911 : 0 : sbrec_dhcpv6_options_add_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
2912 : : {
2913 : : struct ovsdb_datum datum;
2914 : : union ovsdb_atom key;
2915 : :
2916 [ # # ]: 0 : ovs_assert(inited);
2917 : 0 : datum.n = 1;
2918 : 0 : datum.keys = &key;
2919 : 0 : key.string = CONST_CAST(char *, type);
2920 : 0 : datum.values = NULL;
2921 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS],
2922 : : function,
2923 : : &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_TYPE],
2924 : : &datum);
2925 : 0 : }
2926 : : void
2927 : 0 : sbrec_dhcpv6_options_add_clause_false(struct ovsdb_idl *idl)
2928 : : {
2929 : : struct ovsdb_datum datum;
2930 : :
2931 : 0 : ovsdb_datum_init_empty(&datum);
2932 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS], OVSDB_F_FALSE, NULL, &datum);
2933 : 0 : }
2934 : : void
2935 : 0 : sbrec_dhcpv6_options_add_clause_true(struct ovsdb_idl *idl)
2936 : : {
2937 : : struct ovsdb_datum datum;
2938 : :
2939 : 0 : ovsdb_datum_init_empty(&datum);
2940 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS], OVSDB_F_TRUE, NULL, &datum);
2941 : 0 : }
2942 : :
2943 : : /* Sets the "code" column from the "DHCPv6_Options" table in 'row' to
2944 : : * 'code'.
2945 : : *
2946 : : * Argument constraints: in range 0 to 254
2947 : : *
2948 : : * The caller retains ownership of the arguments. */
2949 : : void
2950 : 0 : sbrec_dhcpv6_options_remove_clause_code(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t code)
2951 : : {
2952 : : struct ovsdb_datum datum;
2953 : : union ovsdb_atom key;
2954 : :
2955 [ # # ]: 0 : ovs_assert(inited);
2956 : 0 : datum.n = 1;
2957 : 0 : datum.keys = &key;
2958 : 0 : key.integer = code;
2959 : 0 : datum.values = NULL;
2960 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS],
2961 : : function,
2962 : : &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_CODE],
2963 : : &datum);
2964 : 0 : }
2965 : :
2966 : : /* Sets the "name" column from the "DHCPv6_Options" table in 'row' to
2967 : : * 'name'.
2968 : : *
2969 : : * The caller retains ownership of the arguments. */
2970 : : void
2971 : 0 : sbrec_dhcpv6_options_remove_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
2972 : : {
2973 : : struct ovsdb_datum datum;
2974 : : union ovsdb_atom key;
2975 : :
2976 [ # # ]: 0 : ovs_assert(inited);
2977 : 0 : datum.n = 1;
2978 : 0 : datum.keys = &key;
2979 : 0 : key.string = CONST_CAST(char *, name);
2980 : 0 : datum.values = NULL;
2981 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS],
2982 : : function,
2983 : : &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_NAME],
2984 : : &datum);
2985 : 0 : }
2986 : :
2987 : : /* Sets the "type" column from the "DHCPv6_Options" table in 'row' to
2988 : : * 'type'.
2989 : : *
2990 : : * Argument constraints: one of "mac", "str", or "ipv6"
2991 : : *
2992 : : * The caller retains ownership of the arguments. */
2993 : : void
2994 : 0 : sbrec_dhcpv6_options_remove_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
2995 : : {
2996 : : struct ovsdb_datum datum;
2997 : : union ovsdb_atom key;
2998 : :
2999 [ # # ]: 0 : ovs_assert(inited);
3000 : 0 : datum.n = 1;
3001 : 0 : datum.keys = &key;
3002 : 0 : key.string = CONST_CAST(char *, type);
3003 : 0 : datum.values = NULL;
3004 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS],
3005 : : function,
3006 : : &sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_COL_TYPE],
3007 : : &datum);
3008 : 0 : }
3009 : : void
3010 : 0 : sbrec_dhcpv6_options_remove_clause_false(struct ovsdb_idl *idl)
3011 : : {
3012 : : struct ovsdb_datum datum;
3013 : :
3014 : 0 : ovsdb_datum_init_empty(&datum);
3015 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS], OVSDB_F_FALSE, NULL, &datum);
3016 : 0 : }
3017 : : void
3018 : 0 : sbrec_dhcpv6_options_remove_clause_true(struct ovsdb_idl *idl)
3019 : : {
3020 : : struct ovsdb_datum datum;
3021 : :
3022 : 0 : ovsdb_datum_init_empty(&datum);
3023 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DHCPV6_OPTIONS], OVSDB_F_TRUE, NULL, &datum);
3024 : 0 : }
3025 : :
3026 : : struct ovsdb_idl_column sbrec_dhcpv6_options_columns[SBREC_DHCPV6_OPTIONS_N_COLUMNS];
3027 : :
3028 : : static void
3029 : 272 : sbrec_dhcpv6_options_columns_init(void)
3030 : : {
3031 : : struct ovsdb_idl_column *c;
3032 : :
3033 : : /* Initialize sbrec_dhcpv6_options_col_code. */
3034 : 272 : c = &sbrec_dhcpv6_options_col_code;
3035 : 272 : c->name = "code";
3036 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
3037 : 272 : c->type.key.u.integer.min = INT64_C(0);
3038 : 272 : c->type.key.u.integer.max = INT64_C(254);
3039 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3040 : 272 : c->type.n_min = 1;
3041 : 272 : c->type.n_max = 1;
3042 : 272 : c->mutable = true;
3043 : 272 : c->parse = sbrec_dhcpv6_options_parse_code;
3044 : 272 : c->unparse = sbrec_dhcpv6_options_unparse_code;
3045 : :
3046 : : /* Initialize sbrec_dhcpv6_options_col_name. */
3047 : 272 : c = &sbrec_dhcpv6_options_col_name;
3048 : 272 : c->name = "name";
3049 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3050 : 272 : c->type.key.u.string.minLen = 0;
3051 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3052 : 272 : c->type.n_min = 1;
3053 : 272 : c->type.n_max = 1;
3054 : 272 : c->mutable = true;
3055 : 272 : c->parse = sbrec_dhcpv6_options_parse_name;
3056 : 272 : c->unparse = sbrec_dhcpv6_options_unparse_name;
3057 : :
3058 : : /* Initialize sbrec_dhcpv6_options_col_type. */
3059 : 272 : c = &sbrec_dhcpv6_options_col_type;
3060 : 272 : c->name = "type";
3061 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3062 : 272 : c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
3063 : 272 : c->type.key.enum_->n = 3;
3064 : 272 : c->type.key.enum_->keys = xmalloc(3 * sizeof *c->type.key.enum_->keys);
3065 : 272 : c->type.key.enum_->keys[0].string = xstrdup("ipv6");
3066 : 272 : c->type.key.enum_->keys[1].string = xstrdup("mac");
3067 : 272 : c->type.key.enum_->keys[2].string = xstrdup("str");
3068 : 272 : c->type.key.enum_->values = NULL;
3069 : 272 : ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
3070 : 272 : c->type.key.u.string.minLen = 0;
3071 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3072 : 272 : c->type.n_min = 1;
3073 : 272 : c->type.n_max = 1;
3074 : 272 : c->mutable = true;
3075 : 272 : c->parse = sbrec_dhcpv6_options_parse_type;
3076 : 272 : c->unparse = sbrec_dhcpv6_options_unparse_type;
3077 : 272 : }
3078 : :
3079 : : /* Datapath_Binding table. */
3080 : :
3081 : : static void
3082 : 500 : sbrec_datapath_binding_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3083 : : {
3084 : 500 : struct sbrec_datapath_binding *row = sbrec_datapath_binding_cast(row_);
3085 : : size_t i;
3086 : :
3087 [ - + ]: 500 : ovs_assert(inited);
3088 : 500 : smap_init(&row->external_ids);
3089 [ + + ]: 1348 : for (i = 0; i < datum->n; i++) {
3090 : 848 : smap_add(&row->external_ids,
3091 : 848 : datum->keys[i].string,
3092 : 848 : datum->values[i].string);
3093 : : }
3094 : 500 : }
3095 : :
3096 : : static void
3097 : 504 : sbrec_datapath_binding_parse_tunnel_key(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3098 : : {
3099 : 504 : struct sbrec_datapath_binding *row = sbrec_datapath_binding_cast(row_);
3100 : :
3101 [ - + ]: 504 : ovs_assert(inited);
3102 [ + - ]: 504 : if (datum->n >= 1) {
3103 : 504 : row->tunnel_key = datum->keys[0].integer;
3104 : : } else {
3105 : 0 : row->tunnel_key = 0;
3106 : : }
3107 : 504 : }
3108 : :
3109 : : static void
3110 : 604 : sbrec_datapath_binding_unparse_external_ids(struct ovsdb_idl_row *row_)
3111 : : {
3112 : 604 : struct sbrec_datapath_binding *row = sbrec_datapath_binding_cast(row_);
3113 : :
3114 [ - + ]: 604 : ovs_assert(inited);
3115 : 604 : smap_destroy(&row->external_ids);
3116 : 604 : }
3117 : :
3118 : : static void
3119 : 608 : sbrec_datapath_binding_unparse_tunnel_key(struct ovsdb_idl_row *row OVS_UNUSED)
3120 : : {
3121 : : /* Nothing to do. */
3122 : 608 : }
3123 : :
3124 : : static void
3125 : 558 : sbrec_datapath_binding_init__(struct ovsdb_idl_row *row)
3126 : : {
3127 : 558 : sbrec_datapath_binding_init(sbrec_datapath_binding_cast(row));
3128 : 558 : }
3129 : :
3130 : : /* Clears the contents of 'row' in table "Datapath_Binding". */
3131 : : void
3132 : 558 : sbrec_datapath_binding_init(struct sbrec_datapath_binding *row)
3133 : : {
3134 : 558 : memset(row, 0, sizeof *row);
3135 : 558 : smap_init(&row->external_ids);
3136 : 558 : }
3137 : :
3138 : : /* Searches table "Datapath_Binding" in 'idl' for a row with UUID 'uuid'. Returns
3139 : : * a pointer to the row if there is one, otherwise a null pointer. */
3140 : : const struct sbrec_datapath_binding *
3141 : 0 : sbrec_datapath_binding_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
3142 : : {
3143 : 0 : return sbrec_datapath_binding_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING], uuid));
3144 : : }
3145 : :
3146 : : /* Returns a row in table "Datapath_Binding" in 'idl', or a null pointer if that
3147 : : * table is empty.
3148 : : *
3149 : : * Database tables are internally maintained as hash tables, so adding or
3150 : : * removing rows while traversing the same table can cause some rows to be
3151 : : * visited twice or not at apply. */
3152 : : const struct sbrec_datapath_binding *
3153 : 2244 : sbrec_datapath_binding_first(const struct ovsdb_idl *idl)
3154 : : {
3155 : 2244 : return sbrec_datapath_binding_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING]));
3156 : : }
3157 : :
3158 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
3159 : : * is the last row in its table. */
3160 : : const struct sbrec_datapath_binding *
3161 : 6228 : sbrec_datapath_binding_next(const struct sbrec_datapath_binding *row)
3162 : : {
3163 : 6228 : return sbrec_datapath_binding_cast(ovsdb_idl_next_row(&row->header_));
3164 : : }
3165 : :
3166 : 0 : unsigned int sbrec_datapath_binding_get_seqno(const struct ovsdb_idl *idl)
3167 : : {
3168 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING]);
3169 : : }
3170 : :
3171 : 0 : unsigned int sbrec_datapath_binding_row_get_seqno(const struct sbrec_datapath_binding *row, enum ovsdb_idl_change change)
3172 : : {
3173 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
3174 : : }
3175 : :
3176 : : const struct sbrec_datapath_binding *
3177 : 0 : sbrec_datapath_binding_track_get_first(const struct ovsdb_idl *idl)
3178 : : {
3179 : 0 : return sbrec_datapath_binding_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING]));
3180 : : }
3181 : :
3182 : : const struct sbrec_datapath_binding
3183 : 0 : *sbrec_datapath_binding_track_get_next(const struct sbrec_datapath_binding *row)
3184 : : {
3185 : 0 : return sbrec_datapath_binding_cast(ovsdb_idl_track_get_next(&row->header_));
3186 : : }
3187 : :
3188 : :
3189 : : /* Deletes 'row' from table "Datapath_Binding". 'row' may be freed, so it must not be
3190 : : * accessed afterward.
3191 : : *
3192 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3193 : : void
3194 : 5 : sbrec_datapath_binding_delete(const struct sbrec_datapath_binding *row)
3195 : : {
3196 : 5 : ovsdb_idl_txn_delete(&row->header_);
3197 : 5 : }
3198 : :
3199 : : /* Inserts and returns a new row in the table "Datapath_Binding" in the database
3200 : : * with open transaction 'txn'.
3201 : : *
3202 : : * The new row is assigned a randomly generated provisional UUID.
3203 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
3204 : : * but the IDL will replace any uses of the provisional UUID in the
3205 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
3206 : : struct sbrec_datapath_binding *
3207 : 100 : sbrec_datapath_binding_insert(struct ovsdb_idl_txn *txn)
3208 : : {
3209 : 100 : return sbrec_datapath_binding_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING], NULL));
3210 : : }
3211 : :
3212 : : bool
3213 : 0 : sbrec_datapath_binding_is_updated(const struct sbrec_datapath_binding *row, enum sbrec_datapath_binding_column_id column)
3214 : : {
3215 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_datapath_binding_columns[column]);
3216 : : }
3217 : :
3218 : : /* Causes the original contents of column "external_ids" in 'row' to be
3219 : : * verified as a prerequisite to completing the transaction. That is, if
3220 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
3221 : : * time that the IDL originally read its contents and the time that the
3222 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
3223 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
3224 : : * change has already been received).
3225 : : *
3226 : : * The intention is that, to ensure that no transaction commits based on dirty
3227 : : * reads, an application should call this function any time "external_ids" is
3228 : : * read as part of a read-modify-write operation.
3229 : : *
3230 : : * In some cases this function reduces to a no-op, because the current value
3231 : : * of "external_ids" is already known:
3232 : : *
3233 : : * - If 'row' is a row created by the current transaction (returned by
3234 : : * sbrec_datapath_binding_insert()).
3235 : : *
3236 : : * - If "external_ids" has already been modified (with
3237 : : * sbrec_datapath_binding_set_external_ids()) within the current transaction.
3238 : : *
3239 : : * Because of the latter property, always call this function *before*
3240 : : * sbrec_datapath_binding_set_external_ids() for a given read-modify-write.
3241 : : *
3242 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3243 : : void
3244 : 0 : sbrec_datapath_binding_verify_external_ids(const struct sbrec_datapath_binding *row)
3245 : : {
3246 [ # # ]: 0 : ovs_assert(inited);
3247 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_COL_EXTERNAL_IDS]);
3248 : 0 : }
3249 : :
3250 : : /* Causes the original contents of column "tunnel_key" in 'row' to be
3251 : : * verified as a prerequisite to completing the transaction. That is, if
3252 : : * "tunnel_key" in 'row' changed (or if 'row' was deleted) between the
3253 : : * time that the IDL originally read its contents and the time that the
3254 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
3255 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
3256 : : * change has already been received).
3257 : : *
3258 : : * The intention is that, to ensure that no transaction commits based on dirty
3259 : : * reads, an application should call this function any time "tunnel_key" is
3260 : : * read as part of a read-modify-write operation.
3261 : : *
3262 : : * In some cases this function reduces to a no-op, because the current value
3263 : : * of "tunnel_key" is already known:
3264 : : *
3265 : : * - If 'row' is a row created by the current transaction (returned by
3266 : : * sbrec_datapath_binding_insert()).
3267 : : *
3268 : : * - If "tunnel_key" has already been modified (with
3269 : : * sbrec_datapath_binding_set_tunnel_key()) within the current transaction.
3270 : : *
3271 : : * Because of the latter property, always call this function *before*
3272 : : * sbrec_datapath_binding_set_tunnel_key() for a given read-modify-write.
3273 : : *
3274 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3275 : : void
3276 : 0 : sbrec_datapath_binding_verify_tunnel_key(const struct sbrec_datapath_binding *row)
3277 : : {
3278 [ # # ]: 0 : ovs_assert(inited);
3279 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_COL_TUNNEL_KEY]);
3280 : 0 : }
3281 : :
3282 : : /* Returns the "external_ids" column's value from the "Datapath_Binding" table in 'row'
3283 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
3284 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
3285 : : * for a given key than implementing the same operation on the "cooked"
3286 : : * form in 'row'.
3287 : : *
3288 : : * 'key_type' must be OVSDB_TYPE_STRING.
3289 : : * 'value_type' must be OVSDB_TYPE_STRING.
3290 : : * (This helps to avoid silent bugs if someone changes external_ids's
3291 : : * type without updating the caller.)
3292 : : *
3293 : : * The caller must not modify or free the returned value.
3294 : : *
3295 : : * Various kinds of changes can invalidate the returned value: modifying
3296 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3297 : : * If the returned value is needed for a long time, it is best to make a copy
3298 : : * of it with ovsdb_datum_clone().
3299 : : *
3300 : : * This function is rarely useful, since it is easier to access the value
3301 : : * directly through the "external_ids" member in sbrec_datapath_binding. */
3302 : : const struct ovsdb_datum *
3303 : 0 : sbrec_datapath_binding_get_external_ids(const struct sbrec_datapath_binding *row,
3304 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
3305 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
3306 : : {
3307 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
3308 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
3309 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_datapath_binding_col_external_ids);
3310 : : }
3311 : :
3312 : : /* Returns the "tunnel_key" column's value from the "Datapath_Binding" table in 'row'
3313 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
3314 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
3315 : : * for a given key than implementing the same operation on the "cooked"
3316 : : * form in 'row'.
3317 : : *
3318 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
3319 : : * (This helps to avoid silent bugs if someone changes tunnel_key's
3320 : : * type without updating the caller.)
3321 : : *
3322 : : * The caller must not modify or free the returned value.
3323 : : *
3324 : : * Various kinds of changes can invalidate the returned value: modifying
3325 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3326 : : * If the returned value is needed for a long time, it is best to make a copy
3327 : : * of it with ovsdb_datum_clone().
3328 : : *
3329 : : * This function is rarely useful, since it is easier to access the value
3330 : : * directly through the "tunnel_key" member in sbrec_datapath_binding. */
3331 : : const struct ovsdb_datum *
3332 : 0 : sbrec_datapath_binding_get_tunnel_key(const struct sbrec_datapath_binding *row,
3333 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
3334 : : {
3335 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
3336 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_datapath_binding_col_tunnel_key);
3337 : : }
3338 : :
3339 : : /* Sets the "external_ids" column's value from the "Datapath_Binding" table in 'row'
3340 : : * to 'external_ids'.
3341 : : *
3342 : : * The caller retains ownership of 'external_ids' and everything in it. */
3343 : : void
3344 : 100 : sbrec_datapath_binding_set_external_ids(const struct sbrec_datapath_binding *row, const struct smap *external_ids)
3345 : : {
3346 : : struct ovsdb_datum datum;
3347 : :
3348 [ - + ]: 100 : ovs_assert(inited);
3349 [ + - ]: 100 : if (external_ids) {
3350 : : struct smap_node *node;
3351 : : size_t i;
3352 : :
3353 : 100 : datum.n = smap_count(external_ids);
3354 : 100 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3355 : 100 : datum.values = xmalloc(datum.n * sizeof *datum.values);
3356 : :
3357 : 100 : i = 0;
3358 [ + + ][ - + ]: 300 : SMAP_FOR_EACH (node, external_ids) {
3359 : 200 : datum.keys[i].string = xstrdup(node->key);
3360 : 200 : datum.values[i].string = xstrdup(node->value);
3361 : 200 : i++;
3362 : : }
3363 : 100 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3364 : : } else {
3365 : 0 : ovsdb_datum_init_empty(&datum);
3366 : : }
3367 : 100 : ovsdb_idl_txn_write(&row->header_,
3368 : : &sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_COL_EXTERNAL_IDS],
3369 : : &datum);
3370 : 100 : }
3371 : :
3372 : :
3373 : : /* Sets the "tunnel_key" column from the "Datapath_Binding" table in 'row' to
3374 : : * 'tunnel_key'.
3375 : : *
3376 : : * Argument constraints: in range 1 to 16,777,215
3377 : : *
3378 : : * The caller retains ownership of the arguments. */
3379 : : void
3380 : 100 : sbrec_datapath_binding_set_tunnel_key(const struct sbrec_datapath_binding *row, int64_t tunnel_key)
3381 : : {
3382 : : struct ovsdb_datum datum;
3383 : : union ovsdb_atom key;
3384 : :
3385 [ - + ]: 100 : ovs_assert(inited);
3386 : 100 : datum.n = 1;
3387 : 100 : datum.keys = &key;
3388 : 100 : key.integer = tunnel_key;
3389 : 100 : datum.values = NULL;
3390 : 100 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_COL_TUNNEL_KEY], &datum);
3391 : 100 : }
3392 : :
3393 : : /* Sets an element of the "external_ids" map column from the "Datapath_Binding" table in 'row'
3394 : : * to 'new_value' given the key value 'new_key'.
3395 : : *
3396 : : */
3397 : : void
3398 : 0 : sbrec_datapath_binding_update_external_ids_setkey(const struct sbrec_datapath_binding *row, const char *new_key, const char *new_value)
3399 : : {
3400 : : struct ovsdb_datum *datum;
3401 : :
3402 [ # # ]: 0 : ovs_assert(inited);
3403 : :
3404 : 0 : datum = xmalloc(sizeof *datum);
3405 : 0 : datum->n = 1;
3406 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3407 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
3408 : :
3409 : 0 : datum->keys[0].string = xstrdup(new_key);
3410 : 0 : datum->values[0].string = xstrdup(new_value);
3411 : :
3412 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
3413 : : &sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_COL_EXTERNAL_IDS],
3414 : : datum);
3415 : 0 : }
3416 : :
3417 : : /* Deletes an element of the "external_ids" map column from the "Datapath_Binding" table in 'row'
3418 : : * given the key value 'delete_key'.
3419 : : *
3420 : : */
3421 : : void
3422 : 0 : sbrec_datapath_binding_update_external_ids_delkey(const struct sbrec_datapath_binding *row, const char *delete_key)
3423 : : {
3424 : : struct ovsdb_datum *datum;
3425 : :
3426 [ # # ]: 0 : ovs_assert(inited);
3427 : :
3428 : 0 : datum = xmalloc(sizeof *datum);
3429 : 0 : datum->n = 1;
3430 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3431 : 0 : datum->values = NULL;
3432 : :
3433 : 0 : datum->keys[0].string = xstrdup(delete_key);
3434 : :
3435 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
3436 : : &sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_COL_EXTERNAL_IDS],
3437 : : datum);
3438 : 0 : }
3439 : :
3440 : : /* Sets the "external_ids" column's value from the "Datapath_Binding" table in 'row'
3441 : : * to 'external_ids'.
3442 : : *
3443 : : * The caller retains ownership of 'external_ids' and everything in it. */
3444 : : void
3445 : 0 : sbrec_datapath_binding_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
3446 : : {
3447 : : struct ovsdb_datum datum;
3448 : :
3449 [ # # ]: 0 : ovs_assert(inited);
3450 [ # # ]: 0 : if (external_ids) {
3451 : : struct smap_node *node;
3452 : : size_t i;
3453 : :
3454 : 0 : datum.n = smap_count(external_ids);
3455 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3456 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
3457 : :
3458 : 0 : i = 0;
3459 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
3460 : 0 : datum.keys[i].string = xstrdup(node->key);
3461 : 0 : datum.values[i].string = xstrdup(node->value);
3462 : 0 : i++;
3463 : : }
3464 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3465 : : } else {
3466 : 0 : ovsdb_datum_init_empty(&datum);
3467 : : }
3468 : :
3469 : 0 : ovsdb_idl_condition_add_clause(idl,
3470 : : &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING],
3471 : : function,
3472 : : &sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_COL_EXTERNAL_IDS],
3473 : : &datum);
3474 : :
3475 : 0 : ovsdb_datum_destroy(&datum, &sbrec_datapath_binding_col_external_ids.type);
3476 : 0 : }
3477 : :
3478 : :
3479 : : /* Sets the "tunnel_key" column from the "Datapath_Binding" table in 'row' to
3480 : : * 'tunnel_key'.
3481 : : *
3482 : : * Argument constraints: in range 1 to 16,777,215
3483 : : *
3484 : : * The caller retains ownership of the arguments. */
3485 : : void
3486 : 0 : sbrec_datapath_binding_add_clause_tunnel_key(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t tunnel_key)
3487 : : {
3488 : : struct ovsdb_datum datum;
3489 : : union ovsdb_atom key;
3490 : :
3491 [ # # ]: 0 : ovs_assert(inited);
3492 : 0 : datum.n = 1;
3493 : 0 : datum.keys = &key;
3494 : 0 : key.integer = tunnel_key;
3495 : 0 : datum.values = NULL;
3496 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING],
3497 : : function,
3498 : : &sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_COL_TUNNEL_KEY],
3499 : : &datum);
3500 : 0 : }
3501 : : void
3502 : 0 : sbrec_datapath_binding_add_clause_false(struct ovsdb_idl *idl)
3503 : : {
3504 : : struct ovsdb_datum datum;
3505 : :
3506 : 0 : ovsdb_datum_init_empty(&datum);
3507 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING], OVSDB_F_FALSE, NULL, &datum);
3508 : 0 : }
3509 : : void
3510 : 0 : sbrec_datapath_binding_add_clause_true(struct ovsdb_idl *idl)
3511 : : {
3512 : : struct ovsdb_datum datum;
3513 : :
3514 : 0 : ovsdb_datum_init_empty(&datum);
3515 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING], OVSDB_F_TRUE, NULL, &datum);
3516 : 0 : }
3517 : :
3518 : : /* Sets the "external_ids" column's value from the "Datapath_Binding" table in 'row'
3519 : : * to 'external_ids'.
3520 : : *
3521 : : * The caller retains ownership of 'external_ids' and everything in it. */
3522 : : void
3523 : 0 : sbrec_datapath_binding_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
3524 : : {
3525 : : struct ovsdb_datum datum;
3526 : :
3527 [ # # ]: 0 : ovs_assert(inited);
3528 [ # # ]: 0 : if (external_ids) {
3529 : : struct smap_node *node;
3530 : : size_t i;
3531 : :
3532 : 0 : datum.n = smap_count(external_ids);
3533 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3534 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
3535 : :
3536 : 0 : i = 0;
3537 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
3538 : 0 : datum.keys[i].string = xstrdup(node->key);
3539 : 0 : datum.values[i].string = xstrdup(node->value);
3540 : 0 : i++;
3541 : : }
3542 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3543 : : } else {
3544 : 0 : ovsdb_datum_init_empty(&datum);
3545 : : }
3546 : :
3547 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING],
3548 : : function,
3549 : : &sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_COL_EXTERNAL_IDS],
3550 : : &datum);
3551 : :
3552 : 0 : ovsdb_datum_destroy(&datum, &sbrec_datapath_binding_col_external_ids.type);
3553 : 0 : }
3554 : :
3555 : :
3556 : : /* Sets the "tunnel_key" column from the "Datapath_Binding" table in 'row' to
3557 : : * 'tunnel_key'.
3558 : : *
3559 : : * Argument constraints: in range 1 to 16,777,215
3560 : : *
3561 : : * The caller retains ownership of the arguments. */
3562 : : void
3563 : 0 : sbrec_datapath_binding_remove_clause_tunnel_key(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t tunnel_key)
3564 : : {
3565 : : struct ovsdb_datum datum;
3566 : : union ovsdb_atom key;
3567 : :
3568 [ # # ]: 0 : ovs_assert(inited);
3569 : 0 : datum.n = 1;
3570 : 0 : datum.keys = &key;
3571 : 0 : key.integer = tunnel_key;
3572 : 0 : datum.values = NULL;
3573 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING],
3574 : : function,
3575 : : &sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_COL_TUNNEL_KEY],
3576 : : &datum);
3577 : 0 : }
3578 : : void
3579 : 0 : sbrec_datapath_binding_remove_clause_false(struct ovsdb_idl *idl)
3580 : : {
3581 : : struct ovsdb_datum datum;
3582 : :
3583 : 0 : ovsdb_datum_init_empty(&datum);
3584 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING], OVSDB_F_FALSE, NULL, &datum);
3585 : 0 : }
3586 : : void
3587 : 0 : sbrec_datapath_binding_remove_clause_true(struct ovsdb_idl *idl)
3588 : : {
3589 : : struct ovsdb_datum datum;
3590 : :
3591 : 0 : ovsdb_datum_init_empty(&datum);
3592 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING], OVSDB_F_TRUE, NULL, &datum);
3593 : 0 : }
3594 : :
3595 : : struct ovsdb_idl_column sbrec_datapath_binding_columns[SBREC_DATAPATH_BINDING_N_COLUMNS];
3596 : :
3597 : : static void
3598 : 272 : sbrec_datapath_binding_columns_init(void)
3599 : : {
3600 : : struct ovsdb_idl_column *c;
3601 : :
3602 : : /* Initialize sbrec_datapath_binding_col_external_ids. */
3603 : 272 : c = &sbrec_datapath_binding_col_external_ids;
3604 : 272 : c->name = "external_ids";
3605 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3606 : 272 : c->type.key.u.string.minLen = 0;
3607 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
3608 : 272 : c->type.value.u.string.minLen = 0;
3609 : 272 : c->type.n_min = 0;
3610 : 272 : c->type.n_max = UINT_MAX;
3611 : 272 : c->mutable = true;
3612 : 272 : c->parse = sbrec_datapath_binding_parse_external_ids;
3613 : 272 : c->unparse = sbrec_datapath_binding_unparse_external_ids;
3614 : :
3615 : : /* Initialize sbrec_datapath_binding_col_tunnel_key. */
3616 : 272 : c = &sbrec_datapath_binding_col_tunnel_key;
3617 : 272 : c->name = "tunnel_key";
3618 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
3619 : 272 : c->type.key.u.integer.min = INT64_C(1);
3620 : 272 : c->type.key.u.integer.max = INT64_C(16777215);
3621 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3622 : 272 : c->type.n_min = 1;
3623 : 272 : c->type.n_max = 1;
3624 : 272 : c->mutable = true;
3625 : 272 : c->parse = sbrec_datapath_binding_parse_tunnel_key;
3626 : 272 : c->unparse = sbrec_datapath_binding_unparse_tunnel_key;
3627 : 272 : }
3628 : :
3629 : : /* Encap table. */
3630 : :
3631 : : static void
3632 : 415 : sbrec_encap_parse_ip(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3633 : : {
3634 : 415 : struct sbrec_encap *row = sbrec_encap_cast(row_);
3635 : :
3636 [ - + ]: 415 : ovs_assert(inited);
3637 [ + - ]: 415 : if (datum->n >= 1) {
3638 : 415 : row->ip = datum->keys[0].string;
3639 : : } else {
3640 : 0 : row->ip = "";
3641 : : }
3642 : 415 : }
3643 : :
3644 : : static void
3645 : 412 : sbrec_encap_parse_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3646 : : {
3647 : 412 : struct sbrec_encap *row = sbrec_encap_cast(row_);
3648 : : size_t i;
3649 : :
3650 [ - + ]: 412 : ovs_assert(inited);
3651 : 412 : smap_init(&row->options);
3652 [ + + ]: 715 : for (i = 0; i < datum->n; i++) {
3653 : 303 : smap_add(&row->options,
3654 : 303 : datum->keys[i].string,
3655 : 303 : datum->values[i].string);
3656 : : }
3657 : 412 : }
3658 : :
3659 : : static void
3660 : 413 : sbrec_encap_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3661 : : {
3662 : 413 : struct sbrec_encap *row = sbrec_encap_cast(row_);
3663 : :
3664 [ - + ]: 413 : ovs_assert(inited);
3665 [ + - ]: 413 : if (datum->n >= 1) {
3666 : 413 : row->type = datum->keys[0].string;
3667 : : } else {
3668 : 0 : row->type = "";
3669 : : }
3670 : 413 : }
3671 : :
3672 : : static void
3673 : 522 : sbrec_encap_unparse_ip(struct ovsdb_idl_row *row OVS_UNUSED)
3674 : : {
3675 : : /* Nothing to do. */
3676 : 522 : }
3677 : :
3678 : : static void
3679 : 519 : sbrec_encap_unparse_options(struct ovsdb_idl_row *row_)
3680 : : {
3681 : 519 : struct sbrec_encap *row = sbrec_encap_cast(row_);
3682 : :
3683 [ - + ]: 519 : ovs_assert(inited);
3684 : 519 : smap_destroy(&row->options);
3685 : 519 : }
3686 : :
3687 : : static void
3688 : 520 : sbrec_encap_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
3689 : : {
3690 : : /* Nothing to do. */
3691 : 520 : }
3692 : :
3693 : : static void
3694 : 493 : sbrec_encap_init__(struct ovsdb_idl_row *row)
3695 : : {
3696 : 493 : sbrec_encap_init(sbrec_encap_cast(row));
3697 : 493 : }
3698 : :
3699 : : /* Clears the contents of 'row' in table "Encap". */
3700 : : void
3701 : 493 : sbrec_encap_init(struct sbrec_encap *row)
3702 : : {
3703 : 493 : memset(row, 0, sizeof *row);
3704 : 493 : smap_init(&row->options);
3705 : 493 : }
3706 : :
3707 : : /* Searches table "Encap" in 'idl' for a row with UUID 'uuid'. Returns
3708 : : * a pointer to the row if there is one, otherwise a null pointer. */
3709 : : const struct sbrec_encap *
3710 : 0 : sbrec_encap_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
3711 : : {
3712 : 0 : return sbrec_encap_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP], uuid));
3713 : : }
3714 : :
3715 : : /* Returns a row in table "Encap" in 'idl', or a null pointer if that
3716 : : * table is empty.
3717 : : *
3718 : : * Database tables are internally maintained as hash tables, so adding or
3719 : : * removing rows while traversing the same table can cause some rows to be
3720 : : * visited twice or not at apply. */
3721 : : const struct sbrec_encap *
3722 : 0 : sbrec_encap_first(const struct ovsdb_idl *idl)
3723 : : {
3724 : 0 : return sbrec_encap_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP]));
3725 : : }
3726 : :
3727 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
3728 : : * is the last row in its table. */
3729 : : const struct sbrec_encap *
3730 : 0 : sbrec_encap_next(const struct sbrec_encap *row)
3731 : : {
3732 : 0 : return sbrec_encap_cast(ovsdb_idl_next_row(&row->header_));
3733 : : }
3734 : :
3735 : 0 : unsigned int sbrec_encap_get_seqno(const struct ovsdb_idl *idl)
3736 : : {
3737 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP]);
3738 : : }
3739 : :
3740 : 0 : unsigned int sbrec_encap_row_get_seqno(const struct sbrec_encap *row, enum ovsdb_idl_change change)
3741 : : {
3742 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
3743 : : }
3744 : :
3745 : : const struct sbrec_encap *
3746 : 0 : sbrec_encap_track_get_first(const struct ovsdb_idl *idl)
3747 : : {
3748 : 0 : return sbrec_encap_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP]));
3749 : : }
3750 : :
3751 : : const struct sbrec_encap
3752 : 0 : *sbrec_encap_track_get_next(const struct sbrec_encap *row)
3753 : : {
3754 : 0 : return sbrec_encap_cast(ovsdb_idl_track_get_next(&row->header_));
3755 : : }
3756 : :
3757 : :
3758 : : /* Deletes 'row' from table "Encap". 'row' may be freed, so it must not be
3759 : : * accessed afterward.
3760 : : *
3761 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3762 : : void
3763 : 2 : sbrec_encap_delete(const struct sbrec_encap *row)
3764 : : {
3765 : 2 : ovsdb_idl_txn_delete(&row->header_);
3766 : 2 : }
3767 : :
3768 : : /* Inserts and returns a new row in the table "Encap" in the database
3769 : : * with open transaction 'txn'.
3770 : : *
3771 : : * The new row is assigned a randomly generated provisional UUID.
3772 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
3773 : : * but the IDL will replace any uses of the provisional UUID in the
3774 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
3775 : : struct sbrec_encap *
3776 : 106 : sbrec_encap_insert(struct ovsdb_idl_txn *txn)
3777 : : {
3778 : 106 : return sbrec_encap_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_ENCAP], NULL));
3779 : : }
3780 : :
3781 : : bool
3782 : 0 : sbrec_encap_is_updated(const struct sbrec_encap *row, enum sbrec_encap_column_id column)
3783 : : {
3784 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_encap_columns[column]);
3785 : : }
3786 : :
3787 : : /* Causes the original contents of column "ip" in 'row' to be
3788 : : * verified as a prerequisite to completing the transaction. That is, if
3789 : : * "ip" in 'row' changed (or if 'row' was deleted) between the
3790 : : * time that the IDL originally read its contents and the time that the
3791 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
3792 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
3793 : : * change has already been received).
3794 : : *
3795 : : * The intention is that, to ensure that no transaction commits based on dirty
3796 : : * reads, an application should call this function any time "ip" is
3797 : : * read as part of a read-modify-write operation.
3798 : : *
3799 : : * In some cases this function reduces to a no-op, because the current value
3800 : : * of "ip" is already known:
3801 : : *
3802 : : * - If 'row' is a row created by the current transaction (returned by
3803 : : * sbrec_encap_insert()).
3804 : : *
3805 : : * - If "ip" has already been modified (with
3806 : : * sbrec_encap_set_ip()) within the current transaction.
3807 : : *
3808 : : * Because of the latter property, always call this function *before*
3809 : : * sbrec_encap_set_ip() for a given read-modify-write.
3810 : : *
3811 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3812 : : void
3813 : 0 : sbrec_encap_verify_ip(const struct sbrec_encap *row)
3814 : : {
3815 [ # # ]: 0 : ovs_assert(inited);
3816 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_encap_columns[SBREC_ENCAP_COL_IP]);
3817 : 0 : }
3818 : :
3819 : : /* Causes the original contents of column "options" in 'row' to be
3820 : : * verified as a prerequisite to completing the transaction. That is, if
3821 : : * "options" in 'row' changed (or if 'row' was deleted) between the
3822 : : * time that the IDL originally read its contents and the time that the
3823 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
3824 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
3825 : : * change has already been received).
3826 : : *
3827 : : * The intention is that, to ensure that no transaction commits based on dirty
3828 : : * reads, an application should call this function any time "options" is
3829 : : * read as part of a read-modify-write operation.
3830 : : *
3831 : : * In some cases this function reduces to a no-op, because the current value
3832 : : * of "options" is already known:
3833 : : *
3834 : : * - If 'row' is a row created by the current transaction (returned by
3835 : : * sbrec_encap_insert()).
3836 : : *
3837 : : * - If "options" has already been modified (with
3838 : : * sbrec_encap_set_options()) within the current transaction.
3839 : : *
3840 : : * Because of the latter property, always call this function *before*
3841 : : * sbrec_encap_set_options() for a given read-modify-write.
3842 : : *
3843 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3844 : : void
3845 : 0 : sbrec_encap_verify_options(const struct sbrec_encap *row)
3846 : : {
3847 [ # # ]: 0 : ovs_assert(inited);
3848 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_encap_columns[SBREC_ENCAP_COL_OPTIONS]);
3849 : 0 : }
3850 : :
3851 : : /* Causes the original contents of column "type" in 'row' to be
3852 : : * verified as a prerequisite to completing the transaction. That is, if
3853 : : * "type" in 'row' changed (or if 'row' was deleted) between the
3854 : : * time that the IDL originally read its contents and the time that the
3855 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
3856 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
3857 : : * change has already been received).
3858 : : *
3859 : : * The intention is that, to ensure that no transaction commits based on dirty
3860 : : * reads, an application should call this function any time "type" is
3861 : : * read as part of a read-modify-write operation.
3862 : : *
3863 : : * In some cases this function reduces to a no-op, because the current value
3864 : : * of "type" is already known:
3865 : : *
3866 : : * - If 'row' is a row created by the current transaction (returned by
3867 : : * sbrec_encap_insert()).
3868 : : *
3869 : : * - If "type" has already been modified (with
3870 : : * sbrec_encap_set_type()) within the current transaction.
3871 : : *
3872 : : * Because of the latter property, always call this function *before*
3873 : : * sbrec_encap_set_type() for a given read-modify-write.
3874 : : *
3875 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
3876 : : void
3877 : 0 : sbrec_encap_verify_type(const struct sbrec_encap *row)
3878 : : {
3879 [ # # ]: 0 : ovs_assert(inited);
3880 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_encap_columns[SBREC_ENCAP_COL_TYPE]);
3881 : 0 : }
3882 : :
3883 : : /* Returns the "ip" column's value from the "Encap" table in 'row'
3884 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
3885 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
3886 : : * for a given key than implementing the same operation on the "cooked"
3887 : : * form in 'row'.
3888 : : *
3889 : : * 'key_type' must be OVSDB_TYPE_STRING.
3890 : : * (This helps to avoid silent bugs if someone changes ip's
3891 : : * type without updating the caller.)
3892 : : *
3893 : : * The caller must not modify or free the returned value.
3894 : : *
3895 : : * Various kinds of changes can invalidate the returned value: modifying
3896 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3897 : : * If the returned value is needed for a long time, it is best to make a copy
3898 : : * of it with ovsdb_datum_clone().
3899 : : *
3900 : : * This function is rarely useful, since it is easier to access the value
3901 : : * directly through the "ip" member in sbrec_encap. */
3902 : : const struct ovsdb_datum *
3903 : 0 : sbrec_encap_get_ip(const struct sbrec_encap *row,
3904 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
3905 : : {
3906 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
3907 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_encap_col_ip);
3908 : : }
3909 : :
3910 : : /* Returns the "options" column's value from the "Encap" table in 'row'
3911 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
3912 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
3913 : : * for a given key than implementing the same operation on the "cooked"
3914 : : * form in 'row'.
3915 : : *
3916 : : * 'key_type' must be OVSDB_TYPE_STRING.
3917 : : * 'value_type' must be OVSDB_TYPE_STRING.
3918 : : * (This helps to avoid silent bugs if someone changes options's
3919 : : * type without updating the caller.)
3920 : : *
3921 : : * The caller must not modify or free the returned value.
3922 : : *
3923 : : * Various kinds of changes can invalidate the returned value: modifying
3924 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3925 : : * If the returned value is needed for a long time, it is best to make a copy
3926 : : * of it with ovsdb_datum_clone().
3927 : : *
3928 : : * This function is rarely useful, since it is easier to access the value
3929 : : * directly through the "options" member in sbrec_encap. */
3930 : : const struct ovsdb_datum *
3931 : 0 : sbrec_encap_get_options(const struct sbrec_encap *row,
3932 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
3933 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
3934 : : {
3935 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
3936 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
3937 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_encap_col_options);
3938 : : }
3939 : :
3940 : : /* Returns the "type" column's value from the "Encap" table in 'row'
3941 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
3942 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
3943 : : * for a given key than implementing the same operation on the "cooked"
3944 : : * form in 'row'.
3945 : : *
3946 : : * 'key_type' must be OVSDB_TYPE_STRING.
3947 : : * (This helps to avoid silent bugs if someone changes type's
3948 : : * type without updating the caller.)
3949 : : *
3950 : : * The caller must not modify or free the returned value.
3951 : : *
3952 : : * Various kinds of changes can invalidate the returned value: modifying
3953 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3954 : : * If the returned value is needed for a long time, it is best to make a copy
3955 : : * of it with ovsdb_datum_clone().
3956 : : *
3957 : : * This function is rarely useful, since it is easier to access the value
3958 : : * directly through the "type" member in sbrec_encap. */
3959 : : const struct ovsdb_datum *
3960 : 0 : sbrec_encap_get_type(const struct sbrec_encap *row,
3961 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
3962 : : {
3963 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
3964 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_encap_col_type);
3965 : : }
3966 : :
3967 : : /* Sets the "ip" column from the "Encap" table in 'row' to
3968 : : * 'ip'.
3969 : : *
3970 : : * The caller retains ownership of the arguments. */
3971 : : void
3972 : 107 : sbrec_encap_set_ip(const struct sbrec_encap *row, const char *ip)
3973 : : {
3974 : : struct ovsdb_datum datum;
3975 : : union ovsdb_atom key;
3976 : :
3977 [ - + ]: 107 : ovs_assert(inited);
3978 : 107 : datum.n = 1;
3979 : 107 : datum.keys = &key;
3980 : 107 : key.string = CONST_CAST(char *, ip);
3981 : 107 : datum.values = NULL;
3982 : 107 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_encap_columns[SBREC_ENCAP_COL_IP], &datum);
3983 : 107 : }
3984 : :
3985 : : /* Sets the "options" column's value from the "Encap" table in 'row'
3986 : : * to 'options'.
3987 : : *
3988 : : * The caller retains ownership of 'options' and everything in it. */
3989 : : void
3990 : 106 : sbrec_encap_set_options(const struct sbrec_encap *row, const struct smap *options)
3991 : : {
3992 : : struct ovsdb_datum datum;
3993 : :
3994 [ - + ]: 106 : ovs_assert(inited);
3995 [ + - ]: 106 : if (options) {
3996 : : struct smap_node *node;
3997 : : size_t i;
3998 : :
3999 : 106 : datum.n = smap_count(options);
4000 : 106 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
4001 : 106 : datum.values = xmalloc(datum.n * sizeof *datum.values);
4002 : :
4003 : 106 : i = 0;
4004 [ + + ][ - + ]: 212 : SMAP_FOR_EACH (node, options) {
4005 : 106 : datum.keys[i].string = xstrdup(node->key);
4006 : 106 : datum.values[i].string = xstrdup(node->value);
4007 : 106 : i++;
4008 : : }
4009 : 106 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
4010 : : } else {
4011 : 0 : ovsdb_datum_init_empty(&datum);
4012 : : }
4013 : 106 : ovsdb_idl_txn_write(&row->header_,
4014 : : &sbrec_encap_columns[SBREC_ENCAP_COL_OPTIONS],
4015 : : &datum);
4016 : 106 : }
4017 : :
4018 : :
4019 : : /* Sets the "type" column from the "Encap" table in 'row' to
4020 : : * 'type'.
4021 : : *
4022 : : * Argument constraints: one of "stt", "geneve", or "vxlan"
4023 : : *
4024 : : * The caller retains ownership of the arguments. */
4025 : : void
4026 : 106 : sbrec_encap_set_type(const struct sbrec_encap *row, const char *type)
4027 : : {
4028 : : struct ovsdb_datum datum;
4029 : : union ovsdb_atom key;
4030 : :
4031 [ - + ]: 106 : ovs_assert(inited);
4032 : 106 : datum.n = 1;
4033 : 106 : datum.keys = &key;
4034 : 106 : key.string = CONST_CAST(char *, type);
4035 : 106 : datum.values = NULL;
4036 : 106 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_encap_columns[SBREC_ENCAP_COL_TYPE], &datum);
4037 : 106 : }
4038 : :
4039 : : /* Sets an element of the "options" map column from the "Encap" table in 'row'
4040 : : * to 'new_value' given the key value 'new_key'.
4041 : : *
4042 : : */
4043 : : void
4044 : 0 : sbrec_encap_update_options_setkey(const struct sbrec_encap *row, const char *new_key, const char *new_value)
4045 : : {
4046 : : struct ovsdb_datum *datum;
4047 : :
4048 [ # # ]: 0 : ovs_assert(inited);
4049 : :
4050 : 0 : datum = xmalloc(sizeof *datum);
4051 : 0 : datum->n = 1;
4052 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4053 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
4054 : :
4055 : 0 : datum->keys[0].string = xstrdup(new_key);
4056 : 0 : datum->values[0].string = xstrdup(new_value);
4057 : :
4058 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
4059 : : &sbrec_encap_columns[SBREC_ENCAP_COL_OPTIONS],
4060 : : datum);
4061 : 0 : }
4062 : :
4063 : : /* Deletes an element of the "options" map column from the "Encap" table in 'row'
4064 : : * given the key value 'delete_key'.
4065 : : *
4066 : : */
4067 : : void
4068 : 0 : sbrec_encap_update_options_delkey(const struct sbrec_encap *row, const char *delete_key)
4069 : : {
4070 : : struct ovsdb_datum *datum;
4071 : :
4072 [ # # ]: 0 : ovs_assert(inited);
4073 : :
4074 : 0 : datum = xmalloc(sizeof *datum);
4075 : 0 : datum->n = 1;
4076 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4077 : 0 : datum->values = NULL;
4078 : :
4079 : 0 : datum->keys[0].string = xstrdup(delete_key);
4080 : :
4081 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
4082 : : &sbrec_encap_columns[SBREC_ENCAP_COL_OPTIONS],
4083 : : datum);
4084 : 0 : }
4085 : :
4086 : : /* Sets the "ip" column from the "Encap" table in 'row' to
4087 : : * 'ip'.
4088 : : *
4089 : : * The caller retains ownership of the arguments. */
4090 : : void
4091 : 0 : sbrec_encap_add_clause_ip(struct ovsdb_idl *idl, enum ovsdb_function function, const char *ip)
4092 : : {
4093 : : struct ovsdb_datum datum;
4094 : : union ovsdb_atom key;
4095 : :
4096 [ # # ]: 0 : ovs_assert(inited);
4097 : 0 : datum.n = 1;
4098 : 0 : datum.keys = &key;
4099 : 0 : key.string = CONST_CAST(char *, ip);
4100 : 0 : datum.values = NULL;
4101 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP],
4102 : : function,
4103 : : &sbrec_encap_columns[SBREC_ENCAP_COL_IP],
4104 : : &datum);
4105 : 0 : }
4106 : :
4107 : : /* Sets the "options" column's value from the "Encap" table in 'row'
4108 : : * to 'options'.
4109 : : *
4110 : : * The caller retains ownership of 'options' and everything in it. */
4111 : : void
4112 : 0 : sbrec_encap_add_clause_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *options)
4113 : : {
4114 : : struct ovsdb_datum datum;
4115 : :
4116 [ # # ]: 0 : ovs_assert(inited);
4117 [ # # ]: 0 : if (options) {
4118 : : struct smap_node *node;
4119 : : size_t i;
4120 : :
4121 : 0 : datum.n = smap_count(options);
4122 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
4123 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
4124 : :
4125 : 0 : i = 0;
4126 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
4127 : 0 : datum.keys[i].string = xstrdup(node->key);
4128 : 0 : datum.values[i].string = xstrdup(node->value);
4129 : 0 : i++;
4130 : : }
4131 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
4132 : : } else {
4133 : 0 : ovsdb_datum_init_empty(&datum);
4134 : : }
4135 : :
4136 : 0 : ovsdb_idl_condition_add_clause(idl,
4137 : : &sbrec_table_classes[SBREC_TABLE_ENCAP],
4138 : : function,
4139 : : &sbrec_encap_columns[SBREC_ENCAP_COL_OPTIONS],
4140 : : &datum);
4141 : :
4142 : 0 : ovsdb_datum_destroy(&datum, &sbrec_encap_col_options.type);
4143 : 0 : }
4144 : :
4145 : :
4146 : : /* Sets the "type" column from the "Encap" table in 'row' to
4147 : : * 'type'.
4148 : : *
4149 : : * Argument constraints: one of "stt", "geneve", or "vxlan"
4150 : : *
4151 : : * The caller retains ownership of the arguments. */
4152 : : void
4153 : 0 : sbrec_encap_add_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
4154 : : {
4155 : : struct ovsdb_datum datum;
4156 : : union ovsdb_atom key;
4157 : :
4158 [ # # ]: 0 : ovs_assert(inited);
4159 : 0 : datum.n = 1;
4160 : 0 : datum.keys = &key;
4161 : 0 : key.string = CONST_CAST(char *, type);
4162 : 0 : datum.values = NULL;
4163 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP],
4164 : : function,
4165 : : &sbrec_encap_columns[SBREC_ENCAP_COL_TYPE],
4166 : : &datum);
4167 : 0 : }
4168 : : void
4169 : 0 : sbrec_encap_add_clause_false(struct ovsdb_idl *idl)
4170 : : {
4171 : : struct ovsdb_datum datum;
4172 : :
4173 : 0 : ovsdb_datum_init_empty(&datum);
4174 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP], OVSDB_F_FALSE, NULL, &datum);
4175 : 0 : }
4176 : : void
4177 : 0 : sbrec_encap_add_clause_true(struct ovsdb_idl *idl)
4178 : : {
4179 : : struct ovsdb_datum datum;
4180 : :
4181 : 0 : ovsdb_datum_init_empty(&datum);
4182 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP], OVSDB_F_TRUE, NULL, &datum);
4183 : 0 : }
4184 : :
4185 : : /* Sets the "ip" column from the "Encap" table in 'row' to
4186 : : * 'ip'.
4187 : : *
4188 : : * The caller retains ownership of the arguments. */
4189 : : void
4190 : 0 : sbrec_encap_remove_clause_ip(struct ovsdb_idl *idl, enum ovsdb_function function, const char *ip)
4191 : : {
4192 : : struct ovsdb_datum datum;
4193 : : union ovsdb_atom key;
4194 : :
4195 [ # # ]: 0 : ovs_assert(inited);
4196 : 0 : datum.n = 1;
4197 : 0 : datum.keys = &key;
4198 : 0 : key.string = CONST_CAST(char *, ip);
4199 : 0 : datum.values = NULL;
4200 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP],
4201 : : function,
4202 : : &sbrec_encap_columns[SBREC_ENCAP_COL_IP],
4203 : : &datum);
4204 : 0 : }
4205 : :
4206 : : /* Sets the "options" column's value from the "Encap" table in 'row'
4207 : : * to 'options'.
4208 : : *
4209 : : * The caller retains ownership of 'options' and everything in it. */
4210 : : void
4211 : 0 : sbrec_encap_remove_clause_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *options)
4212 : : {
4213 : : struct ovsdb_datum datum;
4214 : :
4215 [ # # ]: 0 : ovs_assert(inited);
4216 [ # # ]: 0 : if (options) {
4217 : : struct smap_node *node;
4218 : : size_t i;
4219 : :
4220 : 0 : datum.n = smap_count(options);
4221 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
4222 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
4223 : :
4224 : 0 : i = 0;
4225 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
4226 : 0 : datum.keys[i].string = xstrdup(node->key);
4227 : 0 : datum.values[i].string = xstrdup(node->value);
4228 : 0 : i++;
4229 : : }
4230 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
4231 : : } else {
4232 : 0 : ovsdb_datum_init_empty(&datum);
4233 : : }
4234 : :
4235 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP],
4236 : : function,
4237 : : &sbrec_encap_columns[SBREC_ENCAP_COL_OPTIONS],
4238 : : &datum);
4239 : :
4240 : 0 : ovsdb_datum_destroy(&datum, &sbrec_encap_col_options.type);
4241 : 0 : }
4242 : :
4243 : :
4244 : : /* Sets the "type" column from the "Encap" table in 'row' to
4245 : : * 'type'.
4246 : : *
4247 : : * Argument constraints: one of "stt", "geneve", or "vxlan"
4248 : : *
4249 : : * The caller retains ownership of the arguments. */
4250 : : void
4251 : 0 : sbrec_encap_remove_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
4252 : : {
4253 : : struct ovsdb_datum datum;
4254 : : union ovsdb_atom key;
4255 : :
4256 [ # # ]: 0 : ovs_assert(inited);
4257 : 0 : datum.n = 1;
4258 : 0 : datum.keys = &key;
4259 : 0 : key.string = CONST_CAST(char *, type);
4260 : 0 : datum.values = NULL;
4261 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP],
4262 : : function,
4263 : : &sbrec_encap_columns[SBREC_ENCAP_COL_TYPE],
4264 : : &datum);
4265 : 0 : }
4266 : : void
4267 : 0 : sbrec_encap_remove_clause_false(struct ovsdb_idl *idl)
4268 : : {
4269 : : struct ovsdb_datum datum;
4270 : :
4271 : 0 : ovsdb_datum_init_empty(&datum);
4272 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP], OVSDB_F_FALSE, NULL, &datum);
4273 : 0 : }
4274 : : void
4275 : 0 : sbrec_encap_remove_clause_true(struct ovsdb_idl *idl)
4276 : : {
4277 : : struct ovsdb_datum datum;
4278 : :
4279 : 0 : ovsdb_datum_init_empty(&datum);
4280 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_ENCAP], OVSDB_F_TRUE, NULL, &datum);
4281 : 0 : }
4282 : :
4283 : : struct ovsdb_idl_column sbrec_encap_columns[SBREC_ENCAP_N_COLUMNS];
4284 : :
4285 : : static void
4286 : 272 : sbrec_encap_columns_init(void)
4287 : : {
4288 : : struct ovsdb_idl_column *c;
4289 : :
4290 : : /* Initialize sbrec_encap_col_ip. */
4291 : 272 : c = &sbrec_encap_col_ip;
4292 : 272 : c->name = "ip";
4293 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
4294 : 272 : c->type.key.u.string.minLen = 0;
4295 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4296 : 272 : c->type.n_min = 1;
4297 : 272 : c->type.n_max = 1;
4298 : 272 : c->mutable = true;
4299 : 272 : c->parse = sbrec_encap_parse_ip;
4300 : 272 : c->unparse = sbrec_encap_unparse_ip;
4301 : :
4302 : : /* Initialize sbrec_encap_col_options. */
4303 : 272 : c = &sbrec_encap_col_options;
4304 : 272 : c->name = "options";
4305 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
4306 : 272 : c->type.key.u.string.minLen = 0;
4307 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
4308 : 272 : c->type.value.u.string.minLen = 0;
4309 : 272 : c->type.n_min = 0;
4310 : 272 : c->type.n_max = UINT_MAX;
4311 : 272 : c->mutable = true;
4312 : 272 : c->parse = sbrec_encap_parse_options;
4313 : 272 : c->unparse = sbrec_encap_unparse_options;
4314 : :
4315 : : /* Initialize sbrec_encap_col_type. */
4316 : 272 : c = &sbrec_encap_col_type;
4317 : 272 : c->name = "type";
4318 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
4319 : 272 : c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
4320 : 272 : c->type.key.enum_->n = 3;
4321 : 272 : c->type.key.enum_->keys = xmalloc(3 * sizeof *c->type.key.enum_->keys);
4322 : 272 : c->type.key.enum_->keys[0].string = xstrdup("geneve");
4323 : 272 : c->type.key.enum_->keys[1].string = xstrdup("stt");
4324 : 272 : c->type.key.enum_->keys[2].string = xstrdup("vxlan");
4325 : 272 : c->type.key.enum_->values = NULL;
4326 : 272 : ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
4327 : 272 : c->type.key.u.string.minLen = 0;
4328 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4329 : 272 : c->type.n_min = 1;
4330 : 272 : c->type.n_max = 1;
4331 : 272 : c->mutable = true;
4332 : 272 : c->parse = sbrec_encap_parse_type;
4333 : 272 : c->unparse = sbrec_encap_unparse_type;
4334 : 272 : }
4335 : :
4336 : : /* Logical_Flow table. */
4337 : :
4338 : : static void
4339 : 21156 : sbrec_logical_flow_parse_actions(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4340 : : {
4341 : 21156 : struct sbrec_logical_flow *row = sbrec_logical_flow_cast(row_);
4342 : :
4343 [ - + ]: 21156 : ovs_assert(inited);
4344 [ + - ]: 21156 : if (datum->n >= 1) {
4345 : 21156 : row->actions = datum->keys[0].string;
4346 : : } else {
4347 : 0 : row->actions = "";
4348 : : }
4349 : 21156 : }
4350 : :
4351 : : static void
4352 : 21156 : sbrec_logical_flow_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4353 : : {
4354 : 21156 : struct sbrec_logical_flow *row = sbrec_logical_flow_cast(row_);
4355 : : size_t i;
4356 : :
4357 [ - + ]: 21156 : ovs_assert(inited);
4358 : 21156 : smap_init(&row->external_ids);
4359 [ + + ]: 37479 : for (i = 0; i < datum->n; i++) {
4360 : 16323 : smap_add(&row->external_ids,
4361 : 16323 : datum->keys[i].string,
4362 : 16323 : datum->values[i].string);
4363 : : }
4364 : 21156 : }
4365 : :
4366 : : static void
4367 : 21156 : sbrec_logical_flow_parse_logical_datapath(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4368 : : {
4369 : 21156 : struct sbrec_logical_flow *row = sbrec_logical_flow_cast(row_);
4370 : :
4371 [ - + ]: 21156 : ovs_assert(inited);
4372 [ + - ]: 21156 : if (datum->n >= 1) {
4373 : 21156 : row->logical_datapath = sbrec_datapath_binding_cast(ovsdb_idl_get_row_arc(row_, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING], &datum->keys[0].uuid));
4374 : : } else {
4375 : 0 : row->logical_datapath = NULL;
4376 : : }
4377 : 21156 : }
4378 : :
4379 : : static void
4380 : 21156 : sbrec_logical_flow_parse_match(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4381 : : {
4382 : 21156 : struct sbrec_logical_flow *row = sbrec_logical_flow_cast(row_);
4383 : :
4384 [ - + ]: 21156 : ovs_assert(inited);
4385 [ + - ]: 21156 : if (datum->n >= 1) {
4386 : 21156 : row->match = datum->keys[0].string;
4387 : : } else {
4388 : 0 : row->match = "";
4389 : : }
4390 : 21156 : }
4391 : :
4392 : : static void
4393 : 21156 : sbrec_logical_flow_parse_pipeline(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4394 : : {
4395 : 21156 : struct sbrec_logical_flow *row = sbrec_logical_flow_cast(row_);
4396 : :
4397 [ - + ]: 21156 : ovs_assert(inited);
4398 [ + - ]: 21156 : if (datum->n >= 1) {
4399 : 21156 : row->pipeline = datum->keys[0].string;
4400 : : } else {
4401 : 0 : row->pipeline = "";
4402 : : }
4403 : 21156 : }
4404 : :
4405 : : static void
4406 : 19593 : sbrec_logical_flow_parse_priority(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4407 : : {
4408 : 19593 : struct sbrec_logical_flow *row = sbrec_logical_flow_cast(row_);
4409 : :
4410 [ - + ]: 19593 : ovs_assert(inited);
4411 [ + - ]: 19593 : if (datum->n >= 1) {
4412 : 19593 : row->priority = datum->keys[0].integer;
4413 : : } else {
4414 : 0 : row->priority = 0;
4415 : : }
4416 : 19593 : }
4417 : :
4418 : : static void
4419 : 20554 : sbrec_logical_flow_parse_table_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4420 : : {
4421 : 20554 : struct sbrec_logical_flow *row = sbrec_logical_flow_cast(row_);
4422 : :
4423 [ - + ]: 20554 : ovs_assert(inited);
4424 [ + - ]: 20554 : if (datum->n >= 1) {
4425 : 20554 : row->table_id = datum->keys[0].integer;
4426 : : } else {
4427 : 0 : row->table_id = 0;
4428 : : }
4429 : 20554 : }
4430 : :
4431 : : static void
4432 : 25806 : sbrec_logical_flow_unparse_actions(struct ovsdb_idl_row *row OVS_UNUSED)
4433 : : {
4434 : : /* Nothing to do. */
4435 : 25806 : }
4436 : :
4437 : : static void
4438 : 25806 : sbrec_logical_flow_unparse_external_ids(struct ovsdb_idl_row *row_)
4439 : : {
4440 : 25806 : struct sbrec_logical_flow *row = sbrec_logical_flow_cast(row_);
4441 : :
4442 [ - + ]: 25806 : ovs_assert(inited);
4443 : 25806 : smap_destroy(&row->external_ids);
4444 : 25806 : }
4445 : :
4446 : : static void
4447 : 25806 : sbrec_logical_flow_unparse_logical_datapath(struct ovsdb_idl_row *row OVS_UNUSED)
4448 : : {
4449 : : /* Nothing to do. */
4450 : 25806 : }
4451 : :
4452 : : static void
4453 : 25806 : sbrec_logical_flow_unparse_match(struct ovsdb_idl_row *row OVS_UNUSED)
4454 : : {
4455 : : /* Nothing to do. */
4456 : 25806 : }
4457 : :
4458 : : static void
4459 : 25806 : sbrec_logical_flow_unparse_pipeline(struct ovsdb_idl_row *row OVS_UNUSED)
4460 : : {
4461 : : /* Nothing to do. */
4462 : 25806 : }
4463 : :
4464 : : static void
4465 : 24243 : sbrec_logical_flow_unparse_priority(struct ovsdb_idl_row *row OVS_UNUSED)
4466 : : {
4467 : : /* Nothing to do. */
4468 : 24243 : }
4469 : :
4470 : : static void
4471 : 25204 : sbrec_logical_flow_unparse_table_id(struct ovsdb_idl_row *row OVS_UNUSED)
4472 : : {
4473 : : /* Nothing to do. */
4474 : 25204 : }
4475 : :
4476 : : static void
4477 : 18647 : sbrec_logical_flow_init__(struct ovsdb_idl_row *row)
4478 : : {
4479 : 18647 : sbrec_logical_flow_init(sbrec_logical_flow_cast(row));
4480 : 18647 : }
4481 : :
4482 : : /* Clears the contents of 'row' in table "Logical_Flow". */
4483 : : void
4484 : 18647 : sbrec_logical_flow_init(struct sbrec_logical_flow *row)
4485 : : {
4486 : 18647 : memset(row, 0, sizeof *row);
4487 : 18647 : smap_init(&row->external_ids);
4488 : 18647 : }
4489 : :
4490 : : /* Searches table "Logical_Flow" in 'idl' for a row with UUID 'uuid'. Returns
4491 : : * a pointer to the row if there is one, otherwise a null pointer. */
4492 : : const struct sbrec_logical_flow *
4493 : 0 : sbrec_logical_flow_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
4494 : : {
4495 : 0 : return sbrec_logical_flow_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW], uuid));
4496 : : }
4497 : :
4498 : : /* Returns a row in table "Logical_Flow" in 'idl', or a null pointer if that
4499 : : * table is empty.
4500 : : *
4501 : : * Database tables are internally maintained as hash tables, so adding or
4502 : : * removing rows while traversing the same table can cause some rows to be
4503 : : * visited twice or not at apply. */
4504 : : const struct sbrec_logical_flow *
4505 : 5420 : sbrec_logical_flow_first(const struct ovsdb_idl *idl)
4506 : : {
4507 : 5420 : return sbrec_logical_flow_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW]));
4508 : : }
4509 : :
4510 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
4511 : : * is the last row in its table. */
4512 : : const struct sbrec_logical_flow *
4513 : 980440 : sbrec_logical_flow_next(const struct sbrec_logical_flow *row)
4514 : : {
4515 : 980440 : return sbrec_logical_flow_cast(ovsdb_idl_next_row(&row->header_));
4516 : : }
4517 : :
4518 : 0 : unsigned int sbrec_logical_flow_get_seqno(const struct ovsdb_idl *idl)
4519 : : {
4520 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW]);
4521 : : }
4522 : :
4523 : 0 : unsigned int sbrec_logical_flow_row_get_seqno(const struct sbrec_logical_flow *row, enum ovsdb_idl_change change)
4524 : : {
4525 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
4526 : : }
4527 : :
4528 : : const struct sbrec_logical_flow *
4529 : 0 : sbrec_logical_flow_track_get_first(const struct ovsdb_idl *idl)
4530 : : {
4531 : 0 : return sbrec_logical_flow_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW]));
4532 : : }
4533 : :
4534 : : const struct sbrec_logical_flow
4535 : 0 : *sbrec_logical_flow_track_get_next(const struct sbrec_logical_flow *row)
4536 : : {
4537 : 0 : return sbrec_logical_flow_cast(ovsdb_idl_track_get_next(&row->header_));
4538 : : }
4539 : :
4540 : :
4541 : : /* Deletes 'row' from table "Logical_Flow". 'row' may be freed, so it must not be
4542 : : * accessed afterward.
4543 : : *
4544 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4545 : : void
4546 : 507 : sbrec_logical_flow_delete(const struct sbrec_logical_flow *row)
4547 : : {
4548 : 507 : ovsdb_idl_txn_delete(&row->header_);
4549 : 507 : }
4550 : :
4551 : : /* Inserts and returns a new row in the table "Logical_Flow" in the database
4552 : : * with open transaction 'txn'.
4553 : : *
4554 : : * The new row is assigned a randomly generated provisional UUID.
4555 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
4556 : : * but the IDL will replace any uses of the provisional UUID in the
4557 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
4558 : : struct sbrec_logical_flow *
4559 : 4650 : sbrec_logical_flow_insert(struct ovsdb_idl_txn *txn)
4560 : : {
4561 : 4650 : return sbrec_logical_flow_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW], NULL));
4562 : : }
4563 : :
4564 : : bool
4565 : 0 : sbrec_logical_flow_is_updated(const struct sbrec_logical_flow *row, enum sbrec_logical_flow_column_id column)
4566 : : {
4567 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_logical_flow_columns[column]);
4568 : : }
4569 : :
4570 : : /* Causes the original contents of column "actions" in 'row' to be
4571 : : * verified as a prerequisite to completing the transaction. That is, if
4572 : : * "actions" in 'row' changed (or if 'row' was deleted) between the
4573 : : * time that the IDL originally read its contents and the time that the
4574 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4575 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4576 : : * change has already been received).
4577 : : *
4578 : : * The intention is that, to ensure that no transaction commits based on dirty
4579 : : * reads, an application should call this function any time "actions" is
4580 : : * read as part of a read-modify-write operation.
4581 : : *
4582 : : * In some cases this function reduces to a no-op, because the current value
4583 : : * of "actions" is already known:
4584 : : *
4585 : : * - If 'row' is a row created by the current transaction (returned by
4586 : : * sbrec_logical_flow_insert()).
4587 : : *
4588 : : * - If "actions" has already been modified (with
4589 : : * sbrec_logical_flow_set_actions()) within the current transaction.
4590 : : *
4591 : : * Because of the latter property, always call this function *before*
4592 : : * sbrec_logical_flow_set_actions() for a given read-modify-write.
4593 : : *
4594 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4595 : : void
4596 : 0 : sbrec_logical_flow_verify_actions(const struct sbrec_logical_flow *row)
4597 : : {
4598 [ # # ]: 0 : ovs_assert(inited);
4599 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_ACTIONS]);
4600 : 0 : }
4601 : :
4602 : : /* Causes the original contents of column "external_ids" in 'row' to be
4603 : : * verified as a prerequisite to completing the transaction. That is, if
4604 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
4605 : : * time that the IDL originally read its contents and the time that the
4606 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4607 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4608 : : * change has already been received).
4609 : : *
4610 : : * The intention is that, to ensure that no transaction commits based on dirty
4611 : : * reads, an application should call this function any time "external_ids" is
4612 : : * read as part of a read-modify-write operation.
4613 : : *
4614 : : * In some cases this function reduces to a no-op, because the current value
4615 : : * of "external_ids" is already known:
4616 : : *
4617 : : * - If 'row' is a row created by the current transaction (returned by
4618 : : * sbrec_logical_flow_insert()).
4619 : : *
4620 : : * - If "external_ids" has already been modified (with
4621 : : * sbrec_logical_flow_set_external_ids()) within the current transaction.
4622 : : *
4623 : : * Because of the latter property, always call this function *before*
4624 : : * sbrec_logical_flow_set_external_ids() for a given read-modify-write.
4625 : : *
4626 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4627 : : void
4628 : 0 : sbrec_logical_flow_verify_external_ids(const struct sbrec_logical_flow *row)
4629 : : {
4630 [ # # ]: 0 : ovs_assert(inited);
4631 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_EXTERNAL_IDS]);
4632 : 0 : }
4633 : :
4634 : : /* Causes the original contents of column "logical_datapath" in 'row' to be
4635 : : * verified as a prerequisite to completing the transaction. That is, if
4636 : : * "logical_datapath" in 'row' changed (or if 'row' was deleted) between the
4637 : : * time that the IDL originally read its contents and the time that the
4638 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4639 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4640 : : * change has already been received).
4641 : : *
4642 : : * The intention is that, to ensure that no transaction commits based on dirty
4643 : : * reads, an application should call this function any time "logical_datapath" is
4644 : : * read as part of a read-modify-write operation.
4645 : : *
4646 : : * In some cases this function reduces to a no-op, because the current value
4647 : : * of "logical_datapath" is already known:
4648 : : *
4649 : : * - If 'row' is a row created by the current transaction (returned by
4650 : : * sbrec_logical_flow_insert()).
4651 : : *
4652 : : * - If "logical_datapath" has already been modified (with
4653 : : * sbrec_logical_flow_set_logical_datapath()) within the current transaction.
4654 : : *
4655 : : * Because of the latter property, always call this function *before*
4656 : : * sbrec_logical_flow_set_logical_datapath() for a given read-modify-write.
4657 : : *
4658 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4659 : : void
4660 : 0 : sbrec_logical_flow_verify_logical_datapath(const struct sbrec_logical_flow *row)
4661 : : {
4662 [ # # ]: 0 : ovs_assert(inited);
4663 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_LOGICAL_DATAPATH]);
4664 : 0 : }
4665 : :
4666 : : /* Causes the original contents of column "match" in 'row' to be
4667 : : * verified as a prerequisite to completing the transaction. That is, if
4668 : : * "match" in 'row' changed (or if 'row' was deleted) between the
4669 : : * time that the IDL originally read its contents and the time that the
4670 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4671 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4672 : : * change has already been received).
4673 : : *
4674 : : * The intention is that, to ensure that no transaction commits based on dirty
4675 : : * reads, an application should call this function any time "match" is
4676 : : * read as part of a read-modify-write operation.
4677 : : *
4678 : : * In some cases this function reduces to a no-op, because the current value
4679 : : * of "match" is already known:
4680 : : *
4681 : : * - If 'row' is a row created by the current transaction (returned by
4682 : : * sbrec_logical_flow_insert()).
4683 : : *
4684 : : * - If "match" has already been modified (with
4685 : : * sbrec_logical_flow_set_match()) within the current transaction.
4686 : : *
4687 : : * Because of the latter property, always call this function *before*
4688 : : * sbrec_logical_flow_set_match() for a given read-modify-write.
4689 : : *
4690 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4691 : : void
4692 : 0 : sbrec_logical_flow_verify_match(const struct sbrec_logical_flow *row)
4693 : : {
4694 [ # # ]: 0 : ovs_assert(inited);
4695 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_MATCH]);
4696 : 0 : }
4697 : :
4698 : : /* Causes the original contents of column "pipeline" in 'row' to be
4699 : : * verified as a prerequisite to completing the transaction. That is, if
4700 : : * "pipeline" in 'row' changed (or if 'row' was deleted) between the
4701 : : * time that the IDL originally read its contents and the time that the
4702 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4703 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4704 : : * change has already been received).
4705 : : *
4706 : : * The intention is that, to ensure that no transaction commits based on dirty
4707 : : * reads, an application should call this function any time "pipeline" is
4708 : : * read as part of a read-modify-write operation.
4709 : : *
4710 : : * In some cases this function reduces to a no-op, because the current value
4711 : : * of "pipeline" is already known:
4712 : : *
4713 : : * - If 'row' is a row created by the current transaction (returned by
4714 : : * sbrec_logical_flow_insert()).
4715 : : *
4716 : : * - If "pipeline" has already been modified (with
4717 : : * sbrec_logical_flow_set_pipeline()) within the current transaction.
4718 : : *
4719 : : * Because of the latter property, always call this function *before*
4720 : : * sbrec_logical_flow_set_pipeline() for a given read-modify-write.
4721 : : *
4722 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4723 : : void
4724 : 0 : sbrec_logical_flow_verify_pipeline(const struct sbrec_logical_flow *row)
4725 : : {
4726 [ # # ]: 0 : ovs_assert(inited);
4727 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_PIPELINE]);
4728 : 0 : }
4729 : :
4730 : : /* Causes the original contents of column "priority" in 'row' to be
4731 : : * verified as a prerequisite to completing the transaction. That is, if
4732 : : * "priority" in 'row' changed (or if 'row' was deleted) between the
4733 : : * time that the IDL originally read its contents and the time that the
4734 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4735 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4736 : : * change has already been received).
4737 : : *
4738 : : * The intention is that, to ensure that no transaction commits based on dirty
4739 : : * reads, an application should call this function any time "priority" is
4740 : : * read as part of a read-modify-write operation.
4741 : : *
4742 : : * In some cases this function reduces to a no-op, because the current value
4743 : : * of "priority" is already known:
4744 : : *
4745 : : * - If 'row' is a row created by the current transaction (returned by
4746 : : * sbrec_logical_flow_insert()).
4747 : : *
4748 : : * - If "priority" has already been modified (with
4749 : : * sbrec_logical_flow_set_priority()) within the current transaction.
4750 : : *
4751 : : * Because of the latter property, always call this function *before*
4752 : : * sbrec_logical_flow_set_priority() for a given read-modify-write.
4753 : : *
4754 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4755 : : void
4756 : 0 : sbrec_logical_flow_verify_priority(const struct sbrec_logical_flow *row)
4757 : : {
4758 [ # # ]: 0 : ovs_assert(inited);
4759 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_PRIORITY]);
4760 : 0 : }
4761 : :
4762 : : /* Causes the original contents of column "table_id" in 'row' to be
4763 : : * verified as a prerequisite to completing the transaction. That is, if
4764 : : * "table_id" in 'row' changed (or if 'row' was deleted) between the
4765 : : * time that the IDL originally read its contents and the time that the
4766 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
4767 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
4768 : : * change has already been received).
4769 : : *
4770 : : * The intention is that, to ensure that no transaction commits based on dirty
4771 : : * reads, an application should call this function any time "table_id" is
4772 : : * read as part of a read-modify-write operation.
4773 : : *
4774 : : * In some cases this function reduces to a no-op, because the current value
4775 : : * of "table_id" is already known:
4776 : : *
4777 : : * - If 'row' is a row created by the current transaction (returned by
4778 : : * sbrec_logical_flow_insert()).
4779 : : *
4780 : : * - If "table_id" has already been modified (with
4781 : : * sbrec_logical_flow_set_table_id()) within the current transaction.
4782 : : *
4783 : : * Because of the latter property, always call this function *before*
4784 : : * sbrec_logical_flow_set_table_id() for a given read-modify-write.
4785 : : *
4786 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
4787 : : void
4788 : 0 : sbrec_logical_flow_verify_table_id(const struct sbrec_logical_flow *row)
4789 : : {
4790 [ # # ]: 0 : ovs_assert(inited);
4791 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_TABLE_ID]);
4792 : 0 : }
4793 : :
4794 : : /* Returns the "actions" column's value from the "Logical_Flow" table in 'row'
4795 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4796 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4797 : : * for a given key than implementing the same operation on the "cooked"
4798 : : * form in 'row'.
4799 : : *
4800 : : * 'key_type' must be OVSDB_TYPE_STRING.
4801 : : * (This helps to avoid silent bugs if someone changes actions's
4802 : : * type without updating the caller.)
4803 : : *
4804 : : * The caller must not modify or free the returned value.
4805 : : *
4806 : : * Various kinds of changes can invalidate the returned value: modifying
4807 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4808 : : * If the returned value is needed for a long time, it is best to make a copy
4809 : : * of it with ovsdb_datum_clone().
4810 : : *
4811 : : * This function is rarely useful, since it is easier to access the value
4812 : : * directly through the "actions" member in sbrec_logical_flow. */
4813 : : const struct ovsdb_datum *
4814 : 0 : sbrec_logical_flow_get_actions(const struct sbrec_logical_flow *row,
4815 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4816 : : {
4817 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
4818 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_logical_flow_col_actions);
4819 : : }
4820 : :
4821 : : /* Returns the "external_ids" column's value from the "Logical_Flow" table in 'row'
4822 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4823 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4824 : : * for a given key than implementing the same operation on the "cooked"
4825 : : * form in 'row'.
4826 : : *
4827 : : * 'key_type' must be OVSDB_TYPE_STRING.
4828 : : * 'value_type' must be OVSDB_TYPE_STRING.
4829 : : * (This helps to avoid silent bugs if someone changes external_ids's
4830 : : * type without updating the caller.)
4831 : : *
4832 : : * The caller must not modify or free the returned value.
4833 : : *
4834 : : * Various kinds of changes can invalidate the returned value: modifying
4835 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4836 : : * If the returned value is needed for a long time, it is best to make a copy
4837 : : * of it with ovsdb_datum_clone().
4838 : : *
4839 : : * This function is rarely useful, since it is easier to access the value
4840 : : * directly through the "external_ids" member in sbrec_logical_flow. */
4841 : : const struct ovsdb_datum *
4842 : 0 : sbrec_logical_flow_get_external_ids(const struct sbrec_logical_flow *row,
4843 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
4844 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
4845 : : {
4846 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
4847 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
4848 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_logical_flow_col_external_ids);
4849 : : }
4850 : :
4851 : : /* Returns the "logical_datapath" column's value from the "Logical_Flow" table in 'row'
4852 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4853 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4854 : : * for a given key than implementing the same operation on the "cooked"
4855 : : * form in 'row'.
4856 : : *
4857 : : * 'key_type' must be OVSDB_TYPE_UUID.
4858 : : * (This helps to avoid silent bugs if someone changes logical_datapath's
4859 : : * type without updating the caller.)
4860 : : *
4861 : : * The caller must not modify or free the returned value.
4862 : : *
4863 : : * Various kinds of changes can invalidate the returned value: modifying
4864 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4865 : : * If the returned value is needed for a long time, it is best to make a copy
4866 : : * of it with ovsdb_datum_clone().
4867 : : *
4868 : : * This function is rarely useful, since it is easier to access the value
4869 : : * directly through the "logical_datapath" member in sbrec_logical_flow. */
4870 : : const struct ovsdb_datum *
4871 : 0 : sbrec_logical_flow_get_logical_datapath(const struct sbrec_logical_flow *row,
4872 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4873 : : {
4874 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
4875 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_logical_flow_col_logical_datapath);
4876 : : }
4877 : :
4878 : : /* Returns the "match" column's value from the "Logical_Flow" table in 'row'
4879 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4880 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4881 : : * for a given key than implementing the same operation on the "cooked"
4882 : : * form in 'row'.
4883 : : *
4884 : : * 'key_type' must be OVSDB_TYPE_STRING.
4885 : : * (This helps to avoid silent bugs if someone changes match's
4886 : : * type without updating the caller.)
4887 : : *
4888 : : * The caller must not modify or free the returned value.
4889 : : *
4890 : : * Various kinds of changes can invalidate the returned value: modifying
4891 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4892 : : * If the returned value is needed for a long time, it is best to make a copy
4893 : : * of it with ovsdb_datum_clone().
4894 : : *
4895 : : * This function is rarely useful, since it is easier to access the value
4896 : : * directly through the "match" member in sbrec_logical_flow. */
4897 : : const struct ovsdb_datum *
4898 : 0 : sbrec_logical_flow_get_match(const struct sbrec_logical_flow *row,
4899 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4900 : : {
4901 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
4902 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_logical_flow_col_match);
4903 : : }
4904 : :
4905 : : /* Returns the "pipeline" column's value from the "Logical_Flow" table in 'row'
4906 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4907 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4908 : : * for a given key than implementing the same operation on the "cooked"
4909 : : * form in 'row'.
4910 : : *
4911 : : * 'key_type' must be OVSDB_TYPE_STRING.
4912 : : * (This helps to avoid silent bugs if someone changes pipeline's
4913 : : * type without updating the caller.)
4914 : : *
4915 : : * The caller must not modify or free the returned value.
4916 : : *
4917 : : * Various kinds of changes can invalidate the returned value: modifying
4918 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4919 : : * If the returned value is needed for a long time, it is best to make a copy
4920 : : * of it with ovsdb_datum_clone().
4921 : : *
4922 : : * This function is rarely useful, since it is easier to access the value
4923 : : * directly through the "pipeline" member in sbrec_logical_flow. */
4924 : : const struct ovsdb_datum *
4925 : 0 : sbrec_logical_flow_get_pipeline(const struct sbrec_logical_flow *row,
4926 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4927 : : {
4928 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
4929 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_logical_flow_col_pipeline);
4930 : : }
4931 : :
4932 : : /* Returns the "priority" column's value from the "Logical_Flow" table in 'row'
4933 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4934 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4935 : : * for a given key than implementing the same operation on the "cooked"
4936 : : * form in 'row'.
4937 : : *
4938 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
4939 : : * (This helps to avoid silent bugs if someone changes priority's
4940 : : * type without updating the caller.)
4941 : : *
4942 : : * The caller must not modify or free the returned value.
4943 : : *
4944 : : * Various kinds of changes can invalidate the returned value: modifying
4945 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4946 : : * If the returned value is needed for a long time, it is best to make a copy
4947 : : * of it with ovsdb_datum_clone().
4948 : : *
4949 : : * This function is rarely useful, since it is easier to access the value
4950 : : * directly through the "priority" member in sbrec_logical_flow. */
4951 : : const struct ovsdb_datum *
4952 : 0 : sbrec_logical_flow_get_priority(const struct sbrec_logical_flow *row,
4953 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4954 : : {
4955 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4956 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_logical_flow_col_priority);
4957 : : }
4958 : :
4959 : : /* Returns the "table_id" column's value from the "Logical_Flow" table in 'row'
4960 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
4961 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
4962 : : * for a given key than implementing the same operation on the "cooked"
4963 : : * form in 'row'.
4964 : : *
4965 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
4966 : : * (This helps to avoid silent bugs if someone changes table_id's
4967 : : * type without updating the caller.)
4968 : : *
4969 : : * The caller must not modify or free the returned value.
4970 : : *
4971 : : * Various kinds of changes can invalidate the returned value: modifying
4972 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4973 : : * If the returned value is needed for a long time, it is best to make a copy
4974 : : * of it with ovsdb_datum_clone().
4975 : : *
4976 : : * This function is rarely useful, since it is easier to access the value
4977 : : * directly through the "table_id" member in sbrec_logical_flow. */
4978 : : const struct ovsdb_datum *
4979 : 0 : sbrec_logical_flow_get_table_id(const struct sbrec_logical_flow *row,
4980 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
4981 : : {
4982 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4983 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_logical_flow_col_table_id);
4984 : : }
4985 : :
4986 : : /* Sets the "actions" column from the "Logical_Flow" table in 'row' to
4987 : : * 'actions'.
4988 : : *
4989 : : * The caller retains ownership of the arguments. */
4990 : : void
4991 : 4650 : sbrec_logical_flow_set_actions(const struct sbrec_logical_flow *row, const char *actions)
4992 : : {
4993 : : struct ovsdb_datum datum;
4994 : : union ovsdb_atom key;
4995 : :
4996 [ - + ]: 4650 : ovs_assert(inited);
4997 : 4650 : datum.n = 1;
4998 : 4650 : datum.keys = &key;
4999 : 4650 : key.string = CONST_CAST(char *, actions);
5000 : 4650 : datum.values = NULL;
5001 : 4650 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_ACTIONS], &datum);
5002 : 4650 : }
5003 : :
5004 : : /* Sets the "external_ids" column's value from the "Logical_Flow" table in 'row'
5005 : : * to 'external_ids'.
5006 : : *
5007 : : * The caller retains ownership of 'external_ids' and everything in it. */
5008 : : void
5009 : 4650 : sbrec_logical_flow_set_external_ids(const struct sbrec_logical_flow *row, const struct smap *external_ids)
5010 : : {
5011 : : struct ovsdb_datum datum;
5012 : :
5013 [ - + ]: 4650 : ovs_assert(inited);
5014 [ + - ]: 4650 : if (external_ids) {
5015 : : struct smap_node *node;
5016 : : size_t i;
5017 : :
5018 : 4650 : datum.n = smap_count(external_ids);
5019 : 4650 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
5020 : 4650 : datum.values = xmalloc(datum.n * sizeof *datum.values);
5021 : :
5022 : 4650 : i = 0;
5023 [ + + ][ - + ]: 9300 : SMAP_FOR_EACH (node, external_ids) {
5024 : 4650 : datum.keys[i].string = xstrdup(node->key);
5025 : 4650 : datum.values[i].string = xstrdup(node->value);
5026 : 4650 : i++;
5027 : : }
5028 : 4650 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
5029 : : } else {
5030 : 0 : ovsdb_datum_init_empty(&datum);
5031 : : }
5032 : 4650 : ovsdb_idl_txn_write(&row->header_,
5033 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_EXTERNAL_IDS],
5034 : : &datum);
5035 : 4650 : }
5036 : :
5037 : :
5038 : : /* Sets the "logical_datapath" column from the "Logical_Flow" table in 'row' to
5039 : : * 'logical_datapath'.
5040 : : *
5041 : : * The caller retains ownership of the arguments. */
5042 : : void
5043 : 4650 : sbrec_logical_flow_set_logical_datapath(const struct sbrec_logical_flow *row, const struct sbrec_datapath_binding *logical_datapath)
5044 : : {
5045 : : struct ovsdb_datum datum;
5046 : : union ovsdb_atom key;
5047 : :
5048 [ - + ]: 4650 : ovs_assert(inited);
5049 : 4650 : datum.n = 1;
5050 : 4650 : datum.keys = &key;
5051 : 4650 : key.uuid = logical_datapath->header_.uuid;
5052 : 4650 : datum.values = NULL;
5053 : 4650 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_LOGICAL_DATAPATH], &datum);
5054 : 4650 : }
5055 : :
5056 : : /* Sets the "match" column from the "Logical_Flow" table in 'row' to
5057 : : * 'match'.
5058 : : *
5059 : : * The caller retains ownership of the arguments. */
5060 : : void
5061 : 4650 : sbrec_logical_flow_set_match(const struct sbrec_logical_flow *row, const char *match)
5062 : : {
5063 : : struct ovsdb_datum datum;
5064 : : union ovsdb_atom key;
5065 : :
5066 [ - + ]: 4650 : ovs_assert(inited);
5067 : 4650 : datum.n = 1;
5068 : 4650 : datum.keys = &key;
5069 : 4650 : key.string = CONST_CAST(char *, match);
5070 : 4650 : datum.values = NULL;
5071 : 4650 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_MATCH], &datum);
5072 : 4650 : }
5073 : :
5074 : : /* Sets the "pipeline" column from the "Logical_Flow" table in 'row' to
5075 : : * 'pipeline'.
5076 : : *
5077 : : * Argument constraints: either "ingress" or "egress"
5078 : : *
5079 : : * The caller retains ownership of the arguments. */
5080 : : void
5081 : 4650 : sbrec_logical_flow_set_pipeline(const struct sbrec_logical_flow *row, const char *pipeline)
5082 : : {
5083 : : struct ovsdb_datum datum;
5084 : : union ovsdb_atom key;
5085 : :
5086 [ - + ]: 4650 : ovs_assert(inited);
5087 : 4650 : datum.n = 1;
5088 : 4650 : datum.keys = &key;
5089 : 4650 : key.string = CONST_CAST(char *, pipeline);
5090 : 4650 : datum.values = NULL;
5091 : 4650 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_PIPELINE], &datum);
5092 : 4650 : }
5093 : :
5094 : : /* Sets the "priority" column from the "Logical_Flow" table in 'row' to
5095 : : * 'priority'.
5096 : : *
5097 : : * Argument constraints: in range 0 to 65,535
5098 : : *
5099 : : * The caller retains ownership of the arguments. */
5100 : : void
5101 : 4650 : sbrec_logical_flow_set_priority(const struct sbrec_logical_flow *row, int64_t priority)
5102 : : {
5103 : : struct ovsdb_datum datum;
5104 : : union ovsdb_atom key;
5105 : :
5106 [ - + ]: 4650 : ovs_assert(inited);
5107 : 4650 : datum.n = 1;
5108 : 4650 : datum.keys = &key;
5109 : 4650 : key.integer = priority;
5110 : 4650 : datum.values = NULL;
5111 : 4650 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_PRIORITY], &datum);
5112 : 4650 : }
5113 : :
5114 : : /* Sets the "table_id" column from the "Logical_Flow" table in 'row' to
5115 : : * 'table_id'.
5116 : : *
5117 : : * Argument constraints: in range 0 to 15
5118 : : *
5119 : : * The caller retains ownership of the arguments. */
5120 : : void
5121 : 4650 : sbrec_logical_flow_set_table_id(const struct sbrec_logical_flow *row, int64_t table_id)
5122 : : {
5123 : : struct ovsdb_datum datum;
5124 : : union ovsdb_atom key;
5125 : :
5126 [ - + ]: 4650 : ovs_assert(inited);
5127 : 4650 : datum.n = 1;
5128 : 4650 : datum.keys = &key;
5129 : 4650 : key.integer = table_id;
5130 : 4650 : datum.values = NULL;
5131 : 4650 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_TABLE_ID], &datum);
5132 : 4650 : }
5133 : :
5134 : : /* Sets an element of the "external_ids" map column from the "Logical_Flow" table in 'row'
5135 : : * to 'new_value' given the key value 'new_key'.
5136 : : *
5137 : : */
5138 : : void
5139 : 0 : sbrec_logical_flow_update_external_ids_setkey(const struct sbrec_logical_flow *row, const char *new_key, const char *new_value)
5140 : : {
5141 : : struct ovsdb_datum *datum;
5142 : :
5143 [ # # ]: 0 : ovs_assert(inited);
5144 : :
5145 : 0 : datum = xmalloc(sizeof *datum);
5146 : 0 : datum->n = 1;
5147 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
5148 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
5149 : :
5150 : 0 : datum->keys[0].string = xstrdup(new_key);
5151 : 0 : datum->values[0].string = xstrdup(new_value);
5152 : :
5153 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
5154 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_EXTERNAL_IDS],
5155 : : datum);
5156 : 0 : }
5157 : :
5158 : : /* Deletes an element of the "external_ids" map column from the "Logical_Flow" table in 'row'
5159 : : * given the key value 'delete_key'.
5160 : : *
5161 : : */
5162 : : void
5163 : 0 : sbrec_logical_flow_update_external_ids_delkey(const struct sbrec_logical_flow *row, const char *delete_key)
5164 : : {
5165 : : struct ovsdb_datum *datum;
5166 : :
5167 [ # # ]: 0 : ovs_assert(inited);
5168 : :
5169 : 0 : datum = xmalloc(sizeof *datum);
5170 : 0 : datum->n = 1;
5171 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
5172 : 0 : datum->values = NULL;
5173 : :
5174 : 0 : datum->keys[0].string = xstrdup(delete_key);
5175 : :
5176 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
5177 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_EXTERNAL_IDS],
5178 : : datum);
5179 : 0 : }
5180 : :
5181 : : /* Sets the "actions" column from the "Logical_Flow" table in 'row' to
5182 : : * 'actions'.
5183 : : *
5184 : : * The caller retains ownership of the arguments. */
5185 : : void
5186 : 0 : sbrec_logical_flow_add_clause_actions(struct ovsdb_idl *idl, enum ovsdb_function function, const char *actions)
5187 : : {
5188 : : struct ovsdb_datum datum;
5189 : : union ovsdb_atom key;
5190 : :
5191 [ # # ]: 0 : ovs_assert(inited);
5192 : 0 : datum.n = 1;
5193 : 0 : datum.keys = &key;
5194 : 0 : key.string = CONST_CAST(char *, actions);
5195 : 0 : datum.values = NULL;
5196 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5197 : : function,
5198 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_ACTIONS],
5199 : : &datum);
5200 : 0 : }
5201 : :
5202 : : /* Sets the "external_ids" column's value from the "Logical_Flow" table in 'row'
5203 : : * to 'external_ids'.
5204 : : *
5205 : : * The caller retains ownership of 'external_ids' and everything in it. */
5206 : : void
5207 : 0 : sbrec_logical_flow_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
5208 : : {
5209 : : struct ovsdb_datum datum;
5210 : :
5211 [ # # ]: 0 : ovs_assert(inited);
5212 [ # # ]: 0 : if (external_ids) {
5213 : : struct smap_node *node;
5214 : : size_t i;
5215 : :
5216 : 0 : datum.n = smap_count(external_ids);
5217 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
5218 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
5219 : :
5220 : 0 : i = 0;
5221 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
5222 : 0 : datum.keys[i].string = xstrdup(node->key);
5223 : 0 : datum.values[i].string = xstrdup(node->value);
5224 : 0 : i++;
5225 : : }
5226 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
5227 : : } else {
5228 : 0 : ovsdb_datum_init_empty(&datum);
5229 : : }
5230 : :
5231 : 0 : ovsdb_idl_condition_add_clause(idl,
5232 : : &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5233 : : function,
5234 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_EXTERNAL_IDS],
5235 : : &datum);
5236 : :
5237 : 0 : ovsdb_datum_destroy(&datum, &sbrec_logical_flow_col_external_ids.type);
5238 : 0 : }
5239 : :
5240 : :
5241 : : /* Sets the "logical_datapath" column from the "Logical_Flow" table in 'row' to
5242 : : * 'logical_datapath'.
5243 : : *
5244 : : * The caller retains ownership of the arguments. */
5245 : : void
5246 : 0 : sbrec_logical_flow_add_clause_logical_datapath(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *logical_datapath)
5247 : : {
5248 : : struct ovsdb_datum datum;
5249 : : union ovsdb_atom key;
5250 : :
5251 [ # # ]: 0 : ovs_assert(inited);
5252 : 0 : datum.n = 1;
5253 : 0 : datum.keys = &key;
5254 : 0 : key.uuid = *logical_datapath;
5255 : 0 : datum.values = NULL;
5256 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5257 : : function,
5258 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_LOGICAL_DATAPATH],
5259 : : &datum);
5260 : 0 : }
5261 : :
5262 : : /* Sets the "match" column from the "Logical_Flow" table in 'row' to
5263 : : * 'match'.
5264 : : *
5265 : : * The caller retains ownership of the arguments. */
5266 : : void
5267 : 0 : sbrec_logical_flow_add_clause_match(struct ovsdb_idl *idl, enum ovsdb_function function, const char *match)
5268 : : {
5269 : : struct ovsdb_datum datum;
5270 : : union ovsdb_atom key;
5271 : :
5272 [ # # ]: 0 : ovs_assert(inited);
5273 : 0 : datum.n = 1;
5274 : 0 : datum.keys = &key;
5275 : 0 : key.string = CONST_CAST(char *, match);
5276 : 0 : datum.values = NULL;
5277 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5278 : : function,
5279 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_MATCH],
5280 : : &datum);
5281 : 0 : }
5282 : :
5283 : : /* Sets the "pipeline" column from the "Logical_Flow" table in 'row' to
5284 : : * 'pipeline'.
5285 : : *
5286 : : * Argument constraints: either "ingress" or "egress"
5287 : : *
5288 : : * The caller retains ownership of the arguments. */
5289 : : void
5290 : 0 : sbrec_logical_flow_add_clause_pipeline(struct ovsdb_idl *idl, enum ovsdb_function function, const char *pipeline)
5291 : : {
5292 : : struct ovsdb_datum datum;
5293 : : union ovsdb_atom key;
5294 : :
5295 [ # # ]: 0 : ovs_assert(inited);
5296 : 0 : datum.n = 1;
5297 : 0 : datum.keys = &key;
5298 : 0 : key.string = CONST_CAST(char *, pipeline);
5299 : 0 : datum.values = NULL;
5300 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5301 : : function,
5302 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_PIPELINE],
5303 : : &datum);
5304 : 0 : }
5305 : :
5306 : : /* Sets the "priority" column from the "Logical_Flow" table in 'row' to
5307 : : * 'priority'.
5308 : : *
5309 : : * Argument constraints: in range 0 to 65,535
5310 : : *
5311 : : * The caller retains ownership of the arguments. */
5312 : : void
5313 : 0 : sbrec_logical_flow_add_clause_priority(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t priority)
5314 : : {
5315 : : struct ovsdb_datum datum;
5316 : : union ovsdb_atom key;
5317 : :
5318 [ # # ]: 0 : ovs_assert(inited);
5319 : 0 : datum.n = 1;
5320 : 0 : datum.keys = &key;
5321 : 0 : key.integer = priority;
5322 : 0 : datum.values = NULL;
5323 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5324 : : function,
5325 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_PRIORITY],
5326 : : &datum);
5327 : 0 : }
5328 : :
5329 : : /* Sets the "table_id" column from the "Logical_Flow" table in 'row' to
5330 : : * 'table_id'.
5331 : : *
5332 : : * Argument constraints: in range 0 to 15
5333 : : *
5334 : : * The caller retains ownership of the arguments. */
5335 : : void
5336 : 0 : sbrec_logical_flow_add_clause_table_id(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t table_id)
5337 : : {
5338 : : struct ovsdb_datum datum;
5339 : : union ovsdb_atom key;
5340 : :
5341 [ # # ]: 0 : ovs_assert(inited);
5342 : 0 : datum.n = 1;
5343 : 0 : datum.keys = &key;
5344 : 0 : key.integer = table_id;
5345 : 0 : datum.values = NULL;
5346 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5347 : : function,
5348 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_TABLE_ID],
5349 : : &datum);
5350 : 0 : }
5351 : : void
5352 : 0 : sbrec_logical_flow_add_clause_false(struct ovsdb_idl *idl)
5353 : : {
5354 : : struct ovsdb_datum datum;
5355 : :
5356 : 0 : ovsdb_datum_init_empty(&datum);
5357 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW], OVSDB_F_FALSE, NULL, &datum);
5358 : 0 : }
5359 : : void
5360 : 0 : sbrec_logical_flow_add_clause_true(struct ovsdb_idl *idl)
5361 : : {
5362 : : struct ovsdb_datum datum;
5363 : :
5364 : 0 : ovsdb_datum_init_empty(&datum);
5365 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW], OVSDB_F_TRUE, NULL, &datum);
5366 : 0 : }
5367 : :
5368 : : /* Sets the "actions" column from the "Logical_Flow" table in 'row' to
5369 : : * 'actions'.
5370 : : *
5371 : : * The caller retains ownership of the arguments. */
5372 : : void
5373 : 0 : sbrec_logical_flow_remove_clause_actions(struct ovsdb_idl *idl, enum ovsdb_function function, const char *actions)
5374 : : {
5375 : : struct ovsdb_datum datum;
5376 : : union ovsdb_atom key;
5377 : :
5378 [ # # ]: 0 : ovs_assert(inited);
5379 : 0 : datum.n = 1;
5380 : 0 : datum.keys = &key;
5381 : 0 : key.string = CONST_CAST(char *, actions);
5382 : 0 : datum.values = NULL;
5383 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5384 : : function,
5385 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_ACTIONS],
5386 : : &datum);
5387 : 0 : }
5388 : :
5389 : : /* Sets the "external_ids" column's value from the "Logical_Flow" table in 'row'
5390 : : * to 'external_ids'.
5391 : : *
5392 : : * The caller retains ownership of 'external_ids' and everything in it. */
5393 : : void
5394 : 0 : sbrec_logical_flow_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
5395 : : {
5396 : : struct ovsdb_datum datum;
5397 : :
5398 [ # # ]: 0 : ovs_assert(inited);
5399 [ # # ]: 0 : if (external_ids) {
5400 : : struct smap_node *node;
5401 : : size_t i;
5402 : :
5403 : 0 : datum.n = smap_count(external_ids);
5404 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
5405 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
5406 : :
5407 : 0 : i = 0;
5408 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
5409 : 0 : datum.keys[i].string = xstrdup(node->key);
5410 : 0 : datum.values[i].string = xstrdup(node->value);
5411 : 0 : i++;
5412 : : }
5413 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
5414 : : } else {
5415 : 0 : ovsdb_datum_init_empty(&datum);
5416 : : }
5417 : :
5418 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5419 : : function,
5420 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_EXTERNAL_IDS],
5421 : : &datum);
5422 : :
5423 : 0 : ovsdb_datum_destroy(&datum, &sbrec_logical_flow_col_external_ids.type);
5424 : 0 : }
5425 : :
5426 : :
5427 : : /* Sets the "logical_datapath" column from the "Logical_Flow" table in 'row' to
5428 : : * 'logical_datapath'.
5429 : : *
5430 : : * The caller retains ownership of the arguments. */
5431 : : void
5432 : 0 : sbrec_logical_flow_remove_clause_logical_datapath(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *logical_datapath)
5433 : : {
5434 : : struct ovsdb_datum datum;
5435 : : union ovsdb_atom key;
5436 : :
5437 [ # # ]: 0 : ovs_assert(inited);
5438 : 0 : datum.n = 1;
5439 : 0 : datum.keys = &key;
5440 : 0 : key.uuid = *logical_datapath;
5441 : 0 : datum.values = NULL;
5442 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5443 : : function,
5444 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_LOGICAL_DATAPATH],
5445 : : &datum);
5446 : 0 : }
5447 : :
5448 : : /* Sets the "match" column from the "Logical_Flow" table in 'row' to
5449 : : * 'match'.
5450 : : *
5451 : : * The caller retains ownership of the arguments. */
5452 : : void
5453 : 0 : sbrec_logical_flow_remove_clause_match(struct ovsdb_idl *idl, enum ovsdb_function function, const char *match)
5454 : : {
5455 : : struct ovsdb_datum datum;
5456 : : union ovsdb_atom key;
5457 : :
5458 [ # # ]: 0 : ovs_assert(inited);
5459 : 0 : datum.n = 1;
5460 : 0 : datum.keys = &key;
5461 : 0 : key.string = CONST_CAST(char *, match);
5462 : 0 : datum.values = NULL;
5463 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5464 : : function,
5465 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_MATCH],
5466 : : &datum);
5467 : 0 : }
5468 : :
5469 : : /* Sets the "pipeline" column from the "Logical_Flow" table in 'row' to
5470 : : * 'pipeline'.
5471 : : *
5472 : : * Argument constraints: either "ingress" or "egress"
5473 : : *
5474 : : * The caller retains ownership of the arguments. */
5475 : : void
5476 : 0 : sbrec_logical_flow_remove_clause_pipeline(struct ovsdb_idl *idl, enum ovsdb_function function, const char *pipeline)
5477 : : {
5478 : : struct ovsdb_datum datum;
5479 : : union ovsdb_atom key;
5480 : :
5481 [ # # ]: 0 : ovs_assert(inited);
5482 : 0 : datum.n = 1;
5483 : 0 : datum.keys = &key;
5484 : 0 : key.string = CONST_CAST(char *, pipeline);
5485 : 0 : datum.values = NULL;
5486 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5487 : : function,
5488 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_PIPELINE],
5489 : : &datum);
5490 : 0 : }
5491 : :
5492 : : /* Sets the "priority" column from the "Logical_Flow" table in 'row' to
5493 : : * 'priority'.
5494 : : *
5495 : : * Argument constraints: in range 0 to 65,535
5496 : : *
5497 : : * The caller retains ownership of the arguments. */
5498 : : void
5499 : 0 : sbrec_logical_flow_remove_clause_priority(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t priority)
5500 : : {
5501 : : struct ovsdb_datum datum;
5502 : : union ovsdb_atom key;
5503 : :
5504 [ # # ]: 0 : ovs_assert(inited);
5505 : 0 : datum.n = 1;
5506 : 0 : datum.keys = &key;
5507 : 0 : key.integer = priority;
5508 : 0 : datum.values = NULL;
5509 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5510 : : function,
5511 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_PRIORITY],
5512 : : &datum);
5513 : 0 : }
5514 : :
5515 : : /* Sets the "table_id" column from the "Logical_Flow" table in 'row' to
5516 : : * 'table_id'.
5517 : : *
5518 : : * Argument constraints: in range 0 to 15
5519 : : *
5520 : : * The caller retains ownership of the arguments. */
5521 : : void
5522 : 0 : sbrec_logical_flow_remove_clause_table_id(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t table_id)
5523 : : {
5524 : : struct ovsdb_datum datum;
5525 : : union ovsdb_atom key;
5526 : :
5527 [ # # ]: 0 : ovs_assert(inited);
5528 : 0 : datum.n = 1;
5529 : 0 : datum.keys = &key;
5530 : 0 : key.integer = table_id;
5531 : 0 : datum.values = NULL;
5532 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW],
5533 : : function,
5534 : : &sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_COL_TABLE_ID],
5535 : : &datum);
5536 : 0 : }
5537 : : void
5538 : 0 : sbrec_logical_flow_remove_clause_false(struct ovsdb_idl *idl)
5539 : : {
5540 : : struct ovsdb_datum datum;
5541 : :
5542 : 0 : ovsdb_datum_init_empty(&datum);
5543 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW], OVSDB_F_FALSE, NULL, &datum);
5544 : 0 : }
5545 : : void
5546 : 0 : sbrec_logical_flow_remove_clause_true(struct ovsdb_idl *idl)
5547 : : {
5548 : : struct ovsdb_datum datum;
5549 : :
5550 : 0 : ovsdb_datum_init_empty(&datum);
5551 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_LOGICAL_FLOW], OVSDB_F_TRUE, NULL, &datum);
5552 : 0 : }
5553 : :
5554 : : struct ovsdb_idl_column sbrec_logical_flow_columns[SBREC_LOGICAL_FLOW_N_COLUMNS];
5555 : :
5556 : : static void
5557 : 272 : sbrec_logical_flow_columns_init(void)
5558 : : {
5559 : : struct ovsdb_idl_column *c;
5560 : :
5561 : : /* Initialize sbrec_logical_flow_col_actions. */
5562 : 272 : c = &sbrec_logical_flow_col_actions;
5563 : 272 : c->name = "actions";
5564 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
5565 : 272 : c->type.key.u.string.minLen = 0;
5566 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5567 : 272 : c->type.n_min = 1;
5568 : 272 : c->type.n_max = 1;
5569 : 272 : c->mutable = true;
5570 : 272 : c->parse = sbrec_logical_flow_parse_actions;
5571 : 272 : c->unparse = sbrec_logical_flow_unparse_actions;
5572 : :
5573 : : /* Initialize sbrec_logical_flow_col_external_ids. */
5574 : 272 : c = &sbrec_logical_flow_col_external_ids;
5575 : 272 : c->name = "external_ids";
5576 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
5577 : 272 : c->type.key.u.string.minLen = 0;
5578 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
5579 : 272 : c->type.value.u.string.minLen = 0;
5580 : 272 : c->type.n_min = 0;
5581 : 272 : c->type.n_max = UINT_MAX;
5582 : 272 : c->mutable = true;
5583 : 272 : c->parse = sbrec_logical_flow_parse_external_ids;
5584 : 272 : c->unparse = sbrec_logical_flow_unparse_external_ids;
5585 : :
5586 : : /* Initialize sbrec_logical_flow_col_logical_datapath. */
5587 : 272 : c = &sbrec_logical_flow_col_logical_datapath;
5588 : 272 : c->name = "logical_datapath";
5589 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
5590 : 272 : c->type.key.u.uuid.refTableName = "Datapath_Binding";
5591 : 272 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
5592 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5593 : 272 : c->type.n_min = 1;
5594 : 272 : c->type.n_max = 1;
5595 : 272 : c->mutable = true;
5596 : 272 : c->parse = sbrec_logical_flow_parse_logical_datapath;
5597 : 272 : c->unparse = sbrec_logical_flow_unparse_logical_datapath;
5598 : :
5599 : : /* Initialize sbrec_logical_flow_col_match. */
5600 : 272 : c = &sbrec_logical_flow_col_match;
5601 : 272 : c->name = "match";
5602 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
5603 : 272 : c->type.key.u.string.minLen = 0;
5604 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5605 : 272 : c->type.n_min = 1;
5606 : 272 : c->type.n_max = 1;
5607 : 272 : c->mutable = true;
5608 : 272 : c->parse = sbrec_logical_flow_parse_match;
5609 : 272 : c->unparse = sbrec_logical_flow_unparse_match;
5610 : :
5611 : : /* Initialize sbrec_logical_flow_col_pipeline. */
5612 : 272 : c = &sbrec_logical_flow_col_pipeline;
5613 : 272 : c->name = "pipeline";
5614 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
5615 : 272 : c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
5616 : 272 : c->type.key.enum_->n = 2;
5617 : 272 : c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
5618 : 272 : c->type.key.enum_->keys[0].string = xstrdup("egress");
5619 : 272 : c->type.key.enum_->keys[1].string = xstrdup("ingress");
5620 : 272 : c->type.key.enum_->values = NULL;
5621 : 272 : ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
5622 : 272 : c->type.key.u.string.minLen = 0;
5623 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5624 : 272 : c->type.n_min = 1;
5625 : 272 : c->type.n_max = 1;
5626 : 272 : c->mutable = true;
5627 : 272 : c->parse = sbrec_logical_flow_parse_pipeline;
5628 : 272 : c->unparse = sbrec_logical_flow_unparse_pipeline;
5629 : :
5630 : : /* Initialize sbrec_logical_flow_col_priority. */
5631 : 272 : c = &sbrec_logical_flow_col_priority;
5632 : 272 : c->name = "priority";
5633 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
5634 : 272 : c->type.key.u.integer.min = INT64_C(0);
5635 : 272 : c->type.key.u.integer.max = INT64_C(65535);
5636 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5637 : 272 : c->type.n_min = 1;
5638 : 272 : c->type.n_max = 1;
5639 : 272 : c->mutable = true;
5640 : 272 : c->parse = sbrec_logical_flow_parse_priority;
5641 : 272 : c->unparse = sbrec_logical_flow_unparse_priority;
5642 : :
5643 : : /* Initialize sbrec_logical_flow_col_table_id. */
5644 : 272 : c = &sbrec_logical_flow_col_table_id;
5645 : 272 : c->name = "table_id";
5646 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
5647 : 272 : c->type.key.u.integer.min = INT64_C(0);
5648 : 272 : c->type.key.u.integer.max = INT64_C(15);
5649 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
5650 : 272 : c->type.n_min = 1;
5651 : 272 : c->type.n_max = 1;
5652 : 272 : c->mutable = true;
5653 : 272 : c->parse = sbrec_logical_flow_parse_table_id;
5654 : 272 : c->unparse = sbrec_logical_flow_unparse_table_id;
5655 : 272 : }
5656 : :
5657 : : /* MAC_Binding table. */
5658 : :
5659 : : static void
5660 : 1340 : sbrec_mac_binding_parse_datapath(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5661 : : {
5662 : 1340 : struct sbrec_mac_binding *row = sbrec_mac_binding_cast(row_);
5663 : :
5664 [ - + ]: 1340 : ovs_assert(inited);
5665 [ + - ]: 1340 : if (datum->n >= 1) {
5666 : 1340 : row->datapath = sbrec_datapath_binding_cast(ovsdb_idl_get_row_arc(row_, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING], &datum->keys[0].uuid));
5667 : : } else {
5668 : 0 : row->datapath = NULL;
5669 : : }
5670 : 1340 : }
5671 : :
5672 : : static void
5673 : 1340 : sbrec_mac_binding_parse_ip(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5674 : : {
5675 : 1340 : struct sbrec_mac_binding *row = sbrec_mac_binding_cast(row_);
5676 : :
5677 [ - + ]: 1340 : ovs_assert(inited);
5678 [ + - ]: 1340 : if (datum->n >= 1) {
5679 : 1340 : row->ip = datum->keys[0].string;
5680 : : } else {
5681 : 0 : row->ip = "";
5682 : : }
5683 : 1340 : }
5684 : :
5685 : : static void
5686 : 1340 : sbrec_mac_binding_parse_logical_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5687 : : {
5688 : 1340 : struct sbrec_mac_binding *row = sbrec_mac_binding_cast(row_);
5689 : :
5690 [ - + ]: 1340 : ovs_assert(inited);
5691 [ + - ]: 1340 : if (datum->n >= 1) {
5692 : 1340 : row->logical_port = datum->keys[0].string;
5693 : : } else {
5694 : 0 : row->logical_port = "";
5695 : : }
5696 : 1340 : }
5697 : :
5698 : : static void
5699 : 1340 : sbrec_mac_binding_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5700 : : {
5701 : 1340 : struct sbrec_mac_binding *row = sbrec_mac_binding_cast(row_);
5702 : :
5703 [ - + ]: 1340 : ovs_assert(inited);
5704 [ + - ]: 1340 : if (datum->n >= 1) {
5705 : 1340 : row->mac = datum->keys[0].string;
5706 : : } else {
5707 : 0 : row->mac = "";
5708 : : }
5709 : 1340 : }
5710 : :
5711 : : static void
5712 : 1568 : sbrec_mac_binding_unparse_datapath(struct ovsdb_idl_row *row OVS_UNUSED)
5713 : : {
5714 : : /* Nothing to do. */
5715 : 1568 : }
5716 : :
5717 : : static void
5718 : 1568 : sbrec_mac_binding_unparse_ip(struct ovsdb_idl_row *row OVS_UNUSED)
5719 : : {
5720 : : /* Nothing to do. */
5721 : 1568 : }
5722 : :
5723 : : static void
5724 : 1568 : sbrec_mac_binding_unparse_logical_port(struct ovsdb_idl_row *row OVS_UNUSED)
5725 : : {
5726 : : /* Nothing to do. */
5727 : 1568 : }
5728 : :
5729 : : static void
5730 : 1568 : sbrec_mac_binding_unparse_mac(struct ovsdb_idl_row *row OVS_UNUSED)
5731 : : {
5732 : : /* Nothing to do. */
5733 : 1568 : }
5734 : :
5735 : : static void
5736 : 1336 : sbrec_mac_binding_init__(struct ovsdb_idl_row *row)
5737 : : {
5738 : 1336 : sbrec_mac_binding_init(sbrec_mac_binding_cast(row));
5739 : 1336 : }
5740 : :
5741 : : /* Clears the contents of 'row' in table "MAC_Binding". */
5742 : : void
5743 : 1336 : sbrec_mac_binding_init(struct sbrec_mac_binding *row)
5744 : : {
5745 : 1336 : memset(row, 0, sizeof *row);
5746 : 1336 : }
5747 : :
5748 : : /* Searches table "MAC_Binding" in 'idl' for a row with UUID 'uuid'. Returns
5749 : : * a pointer to the row if there is one, otherwise a null pointer. */
5750 : : const struct sbrec_mac_binding *
5751 : 0 : sbrec_mac_binding_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
5752 : : {
5753 : 0 : return sbrec_mac_binding_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING], uuid));
5754 : : }
5755 : :
5756 : : /* Returns a row in table "MAC_Binding" in 'idl', or a null pointer if that
5757 : : * table is empty.
5758 : : *
5759 : : * Database tables are internally maintained as hash tables, so adding or
5760 : : * removing rows while traversing the same table can cause some rows to be
5761 : : * visited twice or not at apply. */
5762 : : const struct sbrec_mac_binding *
5763 : 3408 : sbrec_mac_binding_first(const struct ovsdb_idl *idl)
5764 : : {
5765 : 3408 : return sbrec_mac_binding_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING]));
5766 : : }
5767 : :
5768 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
5769 : : * is the last row in its table. */
5770 : : const struct sbrec_mac_binding *
5771 : 83836 : sbrec_mac_binding_next(const struct sbrec_mac_binding *row)
5772 : : {
5773 : 83836 : return sbrec_mac_binding_cast(ovsdb_idl_next_row(&row->header_));
5774 : : }
5775 : :
5776 : 0 : unsigned int sbrec_mac_binding_get_seqno(const struct ovsdb_idl *idl)
5777 : : {
5778 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING]);
5779 : : }
5780 : :
5781 : 0 : unsigned int sbrec_mac_binding_row_get_seqno(const struct sbrec_mac_binding *row, enum ovsdb_idl_change change)
5782 : : {
5783 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
5784 : : }
5785 : :
5786 : : const struct sbrec_mac_binding *
5787 : 0 : sbrec_mac_binding_track_get_first(const struct ovsdb_idl *idl)
5788 : : {
5789 : 0 : return sbrec_mac_binding_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING]));
5790 : : }
5791 : :
5792 : : const struct sbrec_mac_binding
5793 : 0 : *sbrec_mac_binding_track_get_next(const struct sbrec_mac_binding *row)
5794 : : {
5795 : 0 : return sbrec_mac_binding_cast(ovsdb_idl_track_get_next(&row->header_));
5796 : : }
5797 : :
5798 : :
5799 : : /* Deletes 'row' from table "MAC_Binding". 'row' may be freed, so it must not be
5800 : : * accessed afterward.
5801 : : *
5802 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5803 : : void
5804 : 2 : sbrec_mac_binding_delete(const struct sbrec_mac_binding *row)
5805 : : {
5806 : 2 : ovsdb_idl_txn_delete(&row->header_);
5807 : 2 : }
5808 : :
5809 : : /* Inserts and returns a new row in the table "MAC_Binding" in the database
5810 : : * with open transaction 'txn'.
5811 : : *
5812 : : * The new row is assigned a randomly generated provisional UUID.
5813 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
5814 : : * but the IDL will replace any uses of the provisional UUID in the
5815 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
5816 : : struct sbrec_mac_binding *
5817 : 226 : sbrec_mac_binding_insert(struct ovsdb_idl_txn *txn)
5818 : : {
5819 : 226 : return sbrec_mac_binding_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING], NULL));
5820 : : }
5821 : :
5822 : : bool
5823 : 0 : sbrec_mac_binding_is_updated(const struct sbrec_mac_binding *row, enum sbrec_mac_binding_column_id column)
5824 : : {
5825 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_mac_binding_columns[column]);
5826 : : }
5827 : :
5828 : : /* Causes the original contents of column "datapath" in 'row' to be
5829 : : * verified as a prerequisite to completing the transaction. That is, if
5830 : : * "datapath" in 'row' changed (or if 'row' was deleted) between the
5831 : : * time that the IDL originally read its contents and the time that the
5832 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
5833 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
5834 : : * change has already been received).
5835 : : *
5836 : : * The intention is that, to ensure that no transaction commits based on dirty
5837 : : * reads, an application should call this function any time "datapath" is
5838 : : * read as part of a read-modify-write operation.
5839 : : *
5840 : : * In some cases this function reduces to a no-op, because the current value
5841 : : * of "datapath" is already known:
5842 : : *
5843 : : * - If 'row' is a row created by the current transaction (returned by
5844 : : * sbrec_mac_binding_insert()).
5845 : : *
5846 : : * - If "datapath" has already been modified (with
5847 : : * sbrec_mac_binding_set_datapath()) within the current transaction.
5848 : : *
5849 : : * Because of the latter property, always call this function *before*
5850 : : * sbrec_mac_binding_set_datapath() for a given read-modify-write.
5851 : : *
5852 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5853 : : void
5854 : 0 : sbrec_mac_binding_verify_datapath(const struct sbrec_mac_binding *row)
5855 : : {
5856 [ # # ]: 0 : ovs_assert(inited);
5857 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_DATAPATH]);
5858 : 0 : }
5859 : :
5860 : : /* Causes the original contents of column "ip" in 'row' to be
5861 : : * verified as a prerequisite to completing the transaction. That is, if
5862 : : * "ip" in 'row' changed (or if 'row' was deleted) between the
5863 : : * time that the IDL originally read its contents and the time that the
5864 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
5865 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
5866 : : * change has already been received).
5867 : : *
5868 : : * The intention is that, to ensure that no transaction commits based on dirty
5869 : : * reads, an application should call this function any time "ip" is
5870 : : * read as part of a read-modify-write operation.
5871 : : *
5872 : : * In some cases this function reduces to a no-op, because the current value
5873 : : * of "ip" is already known:
5874 : : *
5875 : : * - If 'row' is a row created by the current transaction (returned by
5876 : : * sbrec_mac_binding_insert()).
5877 : : *
5878 : : * - If "ip" has already been modified (with
5879 : : * sbrec_mac_binding_set_ip()) within the current transaction.
5880 : : *
5881 : : * Because of the latter property, always call this function *before*
5882 : : * sbrec_mac_binding_set_ip() for a given read-modify-write.
5883 : : *
5884 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5885 : : void
5886 : 0 : sbrec_mac_binding_verify_ip(const struct sbrec_mac_binding *row)
5887 : : {
5888 [ # # ]: 0 : ovs_assert(inited);
5889 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_IP]);
5890 : 0 : }
5891 : :
5892 : : /* Causes the original contents of column "logical_port" in 'row' to be
5893 : : * verified as a prerequisite to completing the transaction. That is, if
5894 : : * "logical_port" in 'row' changed (or if 'row' was deleted) between the
5895 : : * time that the IDL originally read its contents and the time that the
5896 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
5897 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
5898 : : * change has already been received).
5899 : : *
5900 : : * The intention is that, to ensure that no transaction commits based on dirty
5901 : : * reads, an application should call this function any time "logical_port" is
5902 : : * read as part of a read-modify-write operation.
5903 : : *
5904 : : * In some cases this function reduces to a no-op, because the current value
5905 : : * of "logical_port" is already known:
5906 : : *
5907 : : * - If 'row' is a row created by the current transaction (returned by
5908 : : * sbrec_mac_binding_insert()).
5909 : : *
5910 : : * - If "logical_port" has already been modified (with
5911 : : * sbrec_mac_binding_set_logical_port()) within the current transaction.
5912 : : *
5913 : : * Because of the latter property, always call this function *before*
5914 : : * sbrec_mac_binding_set_logical_port() for a given read-modify-write.
5915 : : *
5916 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5917 : : void
5918 : 0 : sbrec_mac_binding_verify_logical_port(const struct sbrec_mac_binding *row)
5919 : : {
5920 [ # # ]: 0 : ovs_assert(inited);
5921 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_LOGICAL_PORT]);
5922 : 0 : }
5923 : :
5924 : : /* Causes the original contents of column "mac" in 'row' to be
5925 : : * verified as a prerequisite to completing the transaction. That is, if
5926 : : * "mac" in 'row' changed (or if 'row' was deleted) between the
5927 : : * time that the IDL originally read its contents and the time that the
5928 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
5929 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
5930 : : * change has already been received).
5931 : : *
5932 : : * The intention is that, to ensure that no transaction commits based on dirty
5933 : : * reads, an application should call this function any time "mac" is
5934 : : * read as part of a read-modify-write operation.
5935 : : *
5936 : : * In some cases this function reduces to a no-op, because the current value
5937 : : * of "mac" is already known:
5938 : : *
5939 : : * - If 'row' is a row created by the current transaction (returned by
5940 : : * sbrec_mac_binding_insert()).
5941 : : *
5942 : : * - If "mac" has already been modified (with
5943 : : * sbrec_mac_binding_set_mac()) within the current transaction.
5944 : : *
5945 : : * Because of the latter property, always call this function *before*
5946 : : * sbrec_mac_binding_set_mac() for a given read-modify-write.
5947 : : *
5948 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5949 : : void
5950 : 0 : sbrec_mac_binding_verify_mac(const struct sbrec_mac_binding *row)
5951 : : {
5952 [ # # ]: 0 : ovs_assert(inited);
5953 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_MAC]);
5954 : 0 : }
5955 : :
5956 : : /* Returns the "datapath" column's value from the "MAC_Binding" table in 'row'
5957 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
5958 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
5959 : : * for a given key than implementing the same operation on the "cooked"
5960 : : * form in 'row'.
5961 : : *
5962 : : * 'key_type' must be OVSDB_TYPE_UUID.
5963 : : * (This helps to avoid silent bugs if someone changes datapath's
5964 : : * type without updating the caller.)
5965 : : *
5966 : : * The caller must not modify or free the returned value.
5967 : : *
5968 : : * Various kinds of changes can invalidate the returned value: modifying
5969 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5970 : : * If the returned value is needed for a long time, it is best to make a copy
5971 : : * of it with ovsdb_datum_clone().
5972 : : *
5973 : : * This function is rarely useful, since it is easier to access the value
5974 : : * directly through the "datapath" member in sbrec_mac_binding. */
5975 : : const struct ovsdb_datum *
5976 : 0 : sbrec_mac_binding_get_datapath(const struct sbrec_mac_binding *row,
5977 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
5978 : : {
5979 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
5980 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_mac_binding_col_datapath);
5981 : : }
5982 : :
5983 : : /* Returns the "ip" column's value from the "MAC_Binding" table in 'row'
5984 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
5985 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
5986 : : * for a given key than implementing the same operation on the "cooked"
5987 : : * form in 'row'.
5988 : : *
5989 : : * 'key_type' must be OVSDB_TYPE_STRING.
5990 : : * (This helps to avoid silent bugs if someone changes ip's
5991 : : * type without updating the caller.)
5992 : : *
5993 : : * The caller must not modify or free the returned value.
5994 : : *
5995 : : * Various kinds of changes can invalidate the returned value: modifying
5996 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5997 : : * If the returned value is needed for a long time, it is best to make a copy
5998 : : * of it with ovsdb_datum_clone().
5999 : : *
6000 : : * This function is rarely useful, since it is easier to access the value
6001 : : * directly through the "ip" member in sbrec_mac_binding. */
6002 : : const struct ovsdb_datum *
6003 : 0 : sbrec_mac_binding_get_ip(const struct sbrec_mac_binding *row,
6004 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6005 : : {
6006 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
6007 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_mac_binding_col_ip);
6008 : : }
6009 : :
6010 : : /* Returns the "logical_port" column's value from the "MAC_Binding" table in 'row'
6011 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6012 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6013 : : * for a given key than implementing the same operation on the "cooked"
6014 : : * form in 'row'.
6015 : : *
6016 : : * 'key_type' must be OVSDB_TYPE_STRING.
6017 : : * (This helps to avoid silent bugs if someone changes logical_port's
6018 : : * type without updating the caller.)
6019 : : *
6020 : : * The caller must not modify or free the returned value.
6021 : : *
6022 : : * Various kinds of changes can invalidate the returned value: modifying
6023 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6024 : : * If the returned value is needed for a long time, it is best to make a copy
6025 : : * of it with ovsdb_datum_clone().
6026 : : *
6027 : : * This function is rarely useful, since it is easier to access the value
6028 : : * directly through the "logical_port" member in sbrec_mac_binding. */
6029 : : const struct ovsdb_datum *
6030 : 0 : sbrec_mac_binding_get_logical_port(const struct sbrec_mac_binding *row,
6031 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6032 : : {
6033 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
6034 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_mac_binding_col_logical_port);
6035 : : }
6036 : :
6037 : : /* Returns the "mac" column's value from the "MAC_Binding" table in 'row'
6038 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6039 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6040 : : * for a given key than implementing the same operation on the "cooked"
6041 : : * form in 'row'.
6042 : : *
6043 : : * 'key_type' must be OVSDB_TYPE_STRING.
6044 : : * (This helps to avoid silent bugs if someone changes mac's
6045 : : * type without updating the caller.)
6046 : : *
6047 : : * The caller must not modify or free the returned value.
6048 : : *
6049 : : * Various kinds of changes can invalidate the returned value: modifying
6050 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6051 : : * If the returned value is needed for a long time, it is best to make a copy
6052 : : * of it with ovsdb_datum_clone().
6053 : : *
6054 : : * This function is rarely useful, since it is easier to access the value
6055 : : * directly through the "mac" member in sbrec_mac_binding. */
6056 : : const struct ovsdb_datum *
6057 : 0 : sbrec_mac_binding_get_mac(const struct sbrec_mac_binding *row,
6058 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6059 : : {
6060 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
6061 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_mac_binding_col_mac);
6062 : : }
6063 : :
6064 : : /* Sets the "datapath" column from the "MAC_Binding" table in 'row' to
6065 : : * 'datapath'.
6066 : : *
6067 : : * The caller retains ownership of the arguments. */
6068 : : void
6069 : 226 : sbrec_mac_binding_set_datapath(const struct sbrec_mac_binding *row, const struct sbrec_datapath_binding *datapath)
6070 : : {
6071 : : struct ovsdb_datum datum;
6072 : : union ovsdb_atom key;
6073 : :
6074 [ - + ]: 226 : ovs_assert(inited);
6075 : 226 : datum.n = 1;
6076 : 226 : datum.keys = &key;
6077 : 226 : key.uuid = datapath->header_.uuid;
6078 : 226 : datum.values = NULL;
6079 : 226 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_DATAPATH], &datum);
6080 : 226 : }
6081 : :
6082 : : /* Sets the "ip" column from the "MAC_Binding" table in 'row' to
6083 : : * 'ip'.
6084 : : *
6085 : : * The caller retains ownership of the arguments. */
6086 : : void
6087 : 226 : sbrec_mac_binding_set_ip(const struct sbrec_mac_binding *row, const char *ip)
6088 : : {
6089 : : struct ovsdb_datum datum;
6090 : : union ovsdb_atom key;
6091 : :
6092 [ - + ]: 226 : ovs_assert(inited);
6093 : 226 : datum.n = 1;
6094 : 226 : datum.keys = &key;
6095 : 226 : key.string = CONST_CAST(char *, ip);
6096 : 226 : datum.values = NULL;
6097 : 226 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_IP], &datum);
6098 : 226 : }
6099 : :
6100 : : /* Sets the "logical_port" column from the "MAC_Binding" table in 'row' to
6101 : : * 'logical_port'.
6102 : : *
6103 : : * The caller retains ownership of the arguments. */
6104 : : void
6105 : 226 : sbrec_mac_binding_set_logical_port(const struct sbrec_mac_binding *row, const char *logical_port)
6106 : : {
6107 : : struct ovsdb_datum datum;
6108 : : union ovsdb_atom key;
6109 : :
6110 [ - + ]: 226 : ovs_assert(inited);
6111 : 226 : datum.n = 1;
6112 : 226 : datum.keys = &key;
6113 : 226 : key.string = CONST_CAST(char *, logical_port);
6114 : 226 : datum.values = NULL;
6115 : 226 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_LOGICAL_PORT], &datum);
6116 : 226 : }
6117 : :
6118 : : /* Sets the "mac" column from the "MAC_Binding" table in 'row' to
6119 : : * 'mac'.
6120 : : *
6121 : : * The caller retains ownership of the arguments. */
6122 : : void
6123 : 226 : sbrec_mac_binding_set_mac(const struct sbrec_mac_binding *row, const char *mac)
6124 : : {
6125 : : struct ovsdb_datum datum;
6126 : : union ovsdb_atom key;
6127 : :
6128 [ - + ]: 226 : ovs_assert(inited);
6129 : 226 : datum.n = 1;
6130 : 226 : datum.keys = &key;
6131 : 226 : key.string = CONST_CAST(char *, mac);
6132 : 226 : datum.values = NULL;
6133 : 226 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_MAC], &datum);
6134 : 226 : }
6135 : :
6136 : : /* Sets the "datapath" column from the "MAC_Binding" table in 'row' to
6137 : : * 'datapath'.
6138 : : *
6139 : : * The caller retains ownership of the arguments. */
6140 : : void
6141 : 0 : sbrec_mac_binding_add_clause_datapath(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *datapath)
6142 : : {
6143 : : struct ovsdb_datum datum;
6144 : : union ovsdb_atom key;
6145 : :
6146 [ # # ]: 0 : ovs_assert(inited);
6147 : 0 : datum.n = 1;
6148 : 0 : datum.keys = &key;
6149 : 0 : key.uuid = *datapath;
6150 : 0 : datum.values = NULL;
6151 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING],
6152 : : function,
6153 : : &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_DATAPATH],
6154 : : &datum);
6155 : 0 : }
6156 : :
6157 : : /* Sets the "ip" column from the "MAC_Binding" table in 'row' to
6158 : : * 'ip'.
6159 : : *
6160 : : * The caller retains ownership of the arguments. */
6161 : : void
6162 : 0 : sbrec_mac_binding_add_clause_ip(struct ovsdb_idl *idl, enum ovsdb_function function, const char *ip)
6163 : : {
6164 : : struct ovsdb_datum datum;
6165 : : union ovsdb_atom key;
6166 : :
6167 [ # # ]: 0 : ovs_assert(inited);
6168 : 0 : datum.n = 1;
6169 : 0 : datum.keys = &key;
6170 : 0 : key.string = CONST_CAST(char *, ip);
6171 : 0 : datum.values = NULL;
6172 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING],
6173 : : function,
6174 : : &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_IP],
6175 : : &datum);
6176 : 0 : }
6177 : :
6178 : : /* Sets the "logical_port" column from the "MAC_Binding" table in 'row' to
6179 : : * 'logical_port'.
6180 : : *
6181 : : * The caller retains ownership of the arguments. */
6182 : : void
6183 : 0 : sbrec_mac_binding_add_clause_logical_port(struct ovsdb_idl *idl, enum ovsdb_function function, const char *logical_port)
6184 : : {
6185 : : struct ovsdb_datum datum;
6186 : : union ovsdb_atom key;
6187 : :
6188 [ # # ]: 0 : ovs_assert(inited);
6189 : 0 : datum.n = 1;
6190 : 0 : datum.keys = &key;
6191 : 0 : key.string = CONST_CAST(char *, logical_port);
6192 : 0 : datum.values = NULL;
6193 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING],
6194 : : function,
6195 : : &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_LOGICAL_PORT],
6196 : : &datum);
6197 : 0 : }
6198 : :
6199 : : /* Sets the "mac" column from the "MAC_Binding" table in 'row' to
6200 : : * 'mac'.
6201 : : *
6202 : : * The caller retains ownership of the arguments. */
6203 : : void
6204 : 0 : sbrec_mac_binding_add_clause_mac(struct ovsdb_idl *idl, enum ovsdb_function function, const char *mac)
6205 : : {
6206 : : struct ovsdb_datum datum;
6207 : : union ovsdb_atom key;
6208 : :
6209 [ # # ]: 0 : ovs_assert(inited);
6210 : 0 : datum.n = 1;
6211 : 0 : datum.keys = &key;
6212 : 0 : key.string = CONST_CAST(char *, mac);
6213 : 0 : datum.values = NULL;
6214 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING],
6215 : : function,
6216 : : &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_MAC],
6217 : : &datum);
6218 : 0 : }
6219 : : void
6220 : 0 : sbrec_mac_binding_add_clause_false(struct ovsdb_idl *idl)
6221 : : {
6222 : : struct ovsdb_datum datum;
6223 : :
6224 : 0 : ovsdb_datum_init_empty(&datum);
6225 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING], OVSDB_F_FALSE, NULL, &datum);
6226 : 0 : }
6227 : : void
6228 : 0 : sbrec_mac_binding_add_clause_true(struct ovsdb_idl *idl)
6229 : : {
6230 : : struct ovsdb_datum datum;
6231 : :
6232 : 0 : ovsdb_datum_init_empty(&datum);
6233 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING], OVSDB_F_TRUE, NULL, &datum);
6234 : 0 : }
6235 : :
6236 : : /* Sets the "datapath" column from the "MAC_Binding" table in 'row' to
6237 : : * 'datapath'.
6238 : : *
6239 : : * The caller retains ownership of the arguments. */
6240 : : void
6241 : 0 : sbrec_mac_binding_remove_clause_datapath(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *datapath)
6242 : : {
6243 : : struct ovsdb_datum datum;
6244 : : union ovsdb_atom key;
6245 : :
6246 [ # # ]: 0 : ovs_assert(inited);
6247 : 0 : datum.n = 1;
6248 : 0 : datum.keys = &key;
6249 : 0 : key.uuid = *datapath;
6250 : 0 : datum.values = NULL;
6251 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING],
6252 : : function,
6253 : : &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_DATAPATH],
6254 : : &datum);
6255 : 0 : }
6256 : :
6257 : : /* Sets the "ip" column from the "MAC_Binding" table in 'row' to
6258 : : * 'ip'.
6259 : : *
6260 : : * The caller retains ownership of the arguments. */
6261 : : void
6262 : 0 : sbrec_mac_binding_remove_clause_ip(struct ovsdb_idl *idl, enum ovsdb_function function, const char *ip)
6263 : : {
6264 : : struct ovsdb_datum datum;
6265 : : union ovsdb_atom key;
6266 : :
6267 [ # # ]: 0 : ovs_assert(inited);
6268 : 0 : datum.n = 1;
6269 : 0 : datum.keys = &key;
6270 : 0 : key.string = CONST_CAST(char *, ip);
6271 : 0 : datum.values = NULL;
6272 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING],
6273 : : function,
6274 : : &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_IP],
6275 : : &datum);
6276 : 0 : }
6277 : :
6278 : : /* Sets the "logical_port" column from the "MAC_Binding" table in 'row' to
6279 : : * 'logical_port'.
6280 : : *
6281 : : * The caller retains ownership of the arguments. */
6282 : : void
6283 : 0 : sbrec_mac_binding_remove_clause_logical_port(struct ovsdb_idl *idl, enum ovsdb_function function, const char *logical_port)
6284 : : {
6285 : : struct ovsdb_datum datum;
6286 : : union ovsdb_atom key;
6287 : :
6288 [ # # ]: 0 : ovs_assert(inited);
6289 : 0 : datum.n = 1;
6290 : 0 : datum.keys = &key;
6291 : 0 : key.string = CONST_CAST(char *, logical_port);
6292 : 0 : datum.values = NULL;
6293 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING],
6294 : : function,
6295 : : &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_LOGICAL_PORT],
6296 : : &datum);
6297 : 0 : }
6298 : :
6299 : : /* Sets the "mac" column from the "MAC_Binding" table in 'row' to
6300 : : * 'mac'.
6301 : : *
6302 : : * The caller retains ownership of the arguments. */
6303 : : void
6304 : 0 : sbrec_mac_binding_remove_clause_mac(struct ovsdb_idl *idl, enum ovsdb_function function, const char *mac)
6305 : : {
6306 : : struct ovsdb_datum datum;
6307 : : union ovsdb_atom key;
6308 : :
6309 [ # # ]: 0 : ovs_assert(inited);
6310 : 0 : datum.n = 1;
6311 : 0 : datum.keys = &key;
6312 : 0 : key.string = CONST_CAST(char *, mac);
6313 : 0 : datum.values = NULL;
6314 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING],
6315 : : function,
6316 : : &sbrec_mac_binding_columns[SBREC_MAC_BINDING_COL_MAC],
6317 : : &datum);
6318 : 0 : }
6319 : : void
6320 : 0 : sbrec_mac_binding_remove_clause_false(struct ovsdb_idl *idl)
6321 : : {
6322 : : struct ovsdb_datum datum;
6323 : :
6324 : 0 : ovsdb_datum_init_empty(&datum);
6325 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING], OVSDB_F_FALSE, NULL, &datum);
6326 : 0 : }
6327 : : void
6328 : 0 : sbrec_mac_binding_remove_clause_true(struct ovsdb_idl *idl)
6329 : : {
6330 : : struct ovsdb_datum datum;
6331 : :
6332 : 0 : ovsdb_datum_init_empty(&datum);
6333 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MAC_BINDING], OVSDB_F_TRUE, NULL, &datum);
6334 : 0 : }
6335 : :
6336 : : struct ovsdb_idl_column sbrec_mac_binding_columns[SBREC_MAC_BINDING_N_COLUMNS];
6337 : :
6338 : : static void
6339 : 272 : sbrec_mac_binding_columns_init(void)
6340 : : {
6341 : : struct ovsdb_idl_column *c;
6342 : :
6343 : : /* Initialize sbrec_mac_binding_col_datapath. */
6344 : 272 : c = &sbrec_mac_binding_col_datapath;
6345 : 272 : c->name = "datapath";
6346 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
6347 : 272 : c->type.key.u.uuid.refTableName = "Datapath_Binding";
6348 : 272 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
6349 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
6350 : 272 : c->type.n_min = 1;
6351 : 272 : c->type.n_max = 1;
6352 : 272 : c->mutable = true;
6353 : 272 : c->parse = sbrec_mac_binding_parse_datapath;
6354 : 272 : c->unparse = sbrec_mac_binding_unparse_datapath;
6355 : :
6356 : : /* Initialize sbrec_mac_binding_col_ip. */
6357 : 272 : c = &sbrec_mac_binding_col_ip;
6358 : 272 : c->name = "ip";
6359 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
6360 : 272 : c->type.key.u.string.minLen = 0;
6361 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
6362 : 272 : c->type.n_min = 1;
6363 : 272 : c->type.n_max = 1;
6364 : 272 : c->mutable = true;
6365 : 272 : c->parse = sbrec_mac_binding_parse_ip;
6366 : 272 : c->unparse = sbrec_mac_binding_unparse_ip;
6367 : :
6368 : : /* Initialize sbrec_mac_binding_col_logical_port. */
6369 : 272 : c = &sbrec_mac_binding_col_logical_port;
6370 : 272 : c->name = "logical_port";
6371 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
6372 : 272 : c->type.key.u.string.minLen = 0;
6373 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
6374 : 272 : c->type.n_min = 1;
6375 : 272 : c->type.n_max = 1;
6376 : 272 : c->mutable = true;
6377 : 272 : c->parse = sbrec_mac_binding_parse_logical_port;
6378 : 272 : c->unparse = sbrec_mac_binding_unparse_logical_port;
6379 : :
6380 : : /* Initialize sbrec_mac_binding_col_mac. */
6381 : 272 : c = &sbrec_mac_binding_col_mac;
6382 : 272 : c->name = "mac";
6383 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
6384 : 272 : c->type.key.u.string.minLen = 0;
6385 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
6386 : 272 : c->type.n_min = 1;
6387 : 272 : c->type.n_max = 1;
6388 : 272 : c->mutable = true;
6389 : 272 : c->parse = sbrec_mac_binding_parse_mac;
6390 : 272 : c->unparse = sbrec_mac_binding_unparse_mac;
6391 : 272 : }
6392 : :
6393 : : /* Multicast_Group table. */
6394 : :
6395 : : static void
6396 : 1292 : sbrec_multicast_group_parse_datapath(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6397 : : {
6398 : 1292 : struct sbrec_multicast_group *row = sbrec_multicast_group_cast(row_);
6399 : :
6400 [ - + ]: 1292 : ovs_assert(inited);
6401 [ + - ]: 1292 : if (datum->n >= 1) {
6402 : 1292 : row->datapath = sbrec_datapath_binding_cast(ovsdb_idl_get_row_arc(row_, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING], &datum->keys[0].uuid));
6403 : : } else {
6404 : 0 : row->datapath = NULL;
6405 : : }
6406 : 1292 : }
6407 : :
6408 : : static void
6409 : 1292 : sbrec_multicast_group_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6410 : : {
6411 : 1292 : struct sbrec_multicast_group *row = sbrec_multicast_group_cast(row_);
6412 : :
6413 [ - + ]: 1292 : ovs_assert(inited);
6414 [ + - ]: 1292 : if (datum->n >= 1) {
6415 : 1292 : row->name = datum->keys[0].string;
6416 : : } else {
6417 : 0 : row->name = "";
6418 : : }
6419 : 1292 : }
6420 : :
6421 : : static void
6422 : 1461 : sbrec_multicast_group_parse_ports(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6423 : : {
6424 : 1461 : struct sbrec_multicast_group *row = sbrec_multicast_group_cast(row_);
6425 : : size_t i;
6426 : :
6427 [ - + ]: 1461 : ovs_assert(inited);
6428 : 1461 : row->ports = NULL;
6429 : 1461 : row->n_ports = 0;
6430 [ + + ]: 6678 : for (i = 0; i < datum->n; i++) {
6431 : 5217 : struct sbrec_port_binding *keyRow = sbrec_port_binding_cast(ovsdb_idl_get_row_arc(row_, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING], &datum->keys[i].uuid));
6432 [ + + ]: 5217 : if (keyRow) {
6433 [ + + ]: 4429 : if (!row->n_ports) {
6434 : 1308 : row->ports = xmalloc(datum->n * sizeof *row->ports);
6435 : : }
6436 : 4429 : row->ports[row->n_ports] = keyRow;
6437 : 4429 : row->n_ports++;
6438 : : }
6439 : : }
6440 : 1461 : }
6441 : :
6442 : : static void
6443 : 1292 : sbrec_multicast_group_parse_tunnel_key(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6444 : : {
6445 : 1292 : struct sbrec_multicast_group *row = sbrec_multicast_group_cast(row_);
6446 : :
6447 [ - + ]: 1292 : ovs_assert(inited);
6448 [ + - ]: 1292 : if (datum->n >= 1) {
6449 : 1292 : row->tunnel_key = datum->keys[0].integer;
6450 : : } else {
6451 : 0 : row->tunnel_key = 0;
6452 : : }
6453 : 1292 : }
6454 : :
6455 : : static void
6456 : 1375 : sbrec_multicast_group_unparse_datapath(struct ovsdb_idl_row *row OVS_UNUSED)
6457 : : {
6458 : : /* Nothing to do. */
6459 : 1375 : }
6460 : :
6461 : : static void
6462 : 1375 : sbrec_multicast_group_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
6463 : : {
6464 : : /* Nothing to do. */
6465 : 1375 : }
6466 : :
6467 : : static void
6468 : 1544 : sbrec_multicast_group_unparse_ports(struct ovsdb_idl_row *row_)
6469 : : {
6470 : 1544 : struct sbrec_multicast_group *row = sbrec_multicast_group_cast(row_);
6471 : :
6472 [ - + ]: 1544 : ovs_assert(inited);
6473 : 1544 : free(row->ports);
6474 : 1544 : }
6475 : :
6476 : : static void
6477 : 1375 : sbrec_multicast_group_unparse_tunnel_key(struct ovsdb_idl_row *row OVS_UNUSED)
6478 : : {
6479 : : /* Nothing to do. */
6480 : 1375 : }
6481 : :
6482 : : static void
6483 : 288 : sbrec_multicast_group_init__(struct ovsdb_idl_row *row)
6484 : : {
6485 : 288 : sbrec_multicast_group_init(sbrec_multicast_group_cast(row));
6486 : 288 : }
6487 : :
6488 : : /* Clears the contents of 'row' in table "Multicast_Group". */
6489 : : void
6490 : 288 : sbrec_multicast_group_init(struct sbrec_multicast_group *row)
6491 : : {
6492 : 288 : memset(row, 0, sizeof *row);
6493 : 288 : }
6494 : :
6495 : : /* Searches table "Multicast_Group" in 'idl' for a row with UUID 'uuid'. Returns
6496 : : * a pointer to the row if there is one, otherwise a null pointer. */
6497 : : const struct sbrec_multicast_group *
6498 : 0 : sbrec_multicast_group_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
6499 : : {
6500 : 0 : return sbrec_multicast_group_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP], uuid));
6501 : : }
6502 : :
6503 : : /* Returns a row in table "Multicast_Group" in 'idl', or a null pointer if that
6504 : : * table is empty.
6505 : : *
6506 : : * Database tables are internally maintained as hash tables, so adding or
6507 : : * removing rows while traversing the same table can cause some rows to be
6508 : : * visited twice or not at apply. */
6509 : : const struct sbrec_multicast_group *
6510 : 8578 : sbrec_multicast_group_first(const struct ovsdb_idl *idl)
6511 : : {
6512 : 8578 : return sbrec_multicast_group_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP]));
6513 : : }
6514 : :
6515 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
6516 : : * is the last row in its table. */
6517 : : const struct sbrec_multicast_group *
6518 : 28081 : sbrec_multicast_group_next(const struct sbrec_multicast_group *row)
6519 : : {
6520 : 28081 : return sbrec_multicast_group_cast(ovsdb_idl_next_row(&row->header_));
6521 : : }
6522 : :
6523 : 0 : unsigned int sbrec_multicast_group_get_seqno(const struct ovsdb_idl *idl)
6524 : : {
6525 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP]);
6526 : : }
6527 : :
6528 : 0 : unsigned int sbrec_multicast_group_row_get_seqno(const struct sbrec_multicast_group *row, enum ovsdb_idl_change change)
6529 : : {
6530 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
6531 : : }
6532 : :
6533 : : const struct sbrec_multicast_group *
6534 : 0 : sbrec_multicast_group_track_get_first(const struct ovsdb_idl *idl)
6535 : : {
6536 : 0 : return sbrec_multicast_group_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP]));
6537 : : }
6538 : :
6539 : : const struct sbrec_multicast_group
6540 : 0 : *sbrec_multicast_group_track_get_next(const struct sbrec_multicast_group *row)
6541 : : {
6542 : 0 : return sbrec_multicast_group_cast(ovsdb_idl_track_get_next(&row->header_));
6543 : : }
6544 : :
6545 : :
6546 : : /* Deletes 'row' from table "Multicast_Group". 'row' may be freed, so it must not be
6547 : : * accessed afterward.
6548 : : *
6549 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6550 : : void
6551 : 3 : sbrec_multicast_group_delete(const struct sbrec_multicast_group *row)
6552 : : {
6553 : 3 : ovsdb_idl_txn_delete(&row->header_);
6554 : 3 : }
6555 : :
6556 : : /* Inserts and returns a new row in the table "Multicast_Group" in the database
6557 : : * with open transaction 'txn'.
6558 : : *
6559 : : * The new row is assigned a randomly generated provisional UUID.
6560 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
6561 : : * but the IDL will replace any uses of the provisional UUID in the
6562 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
6563 : : struct sbrec_multicast_group *
6564 : 83 : sbrec_multicast_group_insert(struct ovsdb_idl_txn *txn)
6565 : : {
6566 : 83 : return sbrec_multicast_group_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP], NULL));
6567 : : }
6568 : :
6569 : : bool
6570 : 0 : sbrec_multicast_group_is_updated(const struct sbrec_multicast_group *row, enum sbrec_multicast_group_column_id column)
6571 : : {
6572 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_multicast_group_columns[column]);
6573 : : }
6574 : :
6575 : : /* Causes the original contents of column "datapath" in 'row' to be
6576 : : * verified as a prerequisite to completing the transaction. That is, if
6577 : : * "datapath" in 'row' changed (or if 'row' was deleted) between the
6578 : : * time that the IDL originally read its contents and the time that the
6579 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
6580 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
6581 : : * change has already been received).
6582 : : *
6583 : : * The intention is that, to ensure that no transaction commits based on dirty
6584 : : * reads, an application should call this function any time "datapath" is
6585 : : * read as part of a read-modify-write operation.
6586 : : *
6587 : : * In some cases this function reduces to a no-op, because the current value
6588 : : * of "datapath" is already known:
6589 : : *
6590 : : * - If 'row' is a row created by the current transaction (returned by
6591 : : * sbrec_multicast_group_insert()).
6592 : : *
6593 : : * - If "datapath" has already been modified (with
6594 : : * sbrec_multicast_group_set_datapath()) within the current transaction.
6595 : : *
6596 : : * Because of the latter property, always call this function *before*
6597 : : * sbrec_multicast_group_set_datapath() for a given read-modify-write.
6598 : : *
6599 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6600 : : void
6601 : 0 : sbrec_multicast_group_verify_datapath(const struct sbrec_multicast_group *row)
6602 : : {
6603 [ # # ]: 0 : ovs_assert(inited);
6604 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_DATAPATH]);
6605 : 0 : }
6606 : :
6607 : : /* Causes the original contents of column "name" in 'row' to be
6608 : : * verified as a prerequisite to completing the transaction. That is, if
6609 : : * "name" in 'row' changed (or if 'row' was deleted) between the
6610 : : * time that the IDL originally read its contents and the time that the
6611 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
6612 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
6613 : : * change has already been received).
6614 : : *
6615 : : * The intention is that, to ensure that no transaction commits based on dirty
6616 : : * reads, an application should call this function any time "name" is
6617 : : * read as part of a read-modify-write operation.
6618 : : *
6619 : : * In some cases this function reduces to a no-op, because the current value
6620 : : * of "name" is already known:
6621 : : *
6622 : : * - If 'row' is a row created by the current transaction (returned by
6623 : : * sbrec_multicast_group_insert()).
6624 : : *
6625 : : * - If "name" has already been modified (with
6626 : : * sbrec_multicast_group_set_name()) within the current transaction.
6627 : : *
6628 : : * Because of the latter property, always call this function *before*
6629 : : * sbrec_multicast_group_set_name() for a given read-modify-write.
6630 : : *
6631 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6632 : : void
6633 : 0 : sbrec_multicast_group_verify_name(const struct sbrec_multicast_group *row)
6634 : : {
6635 [ # # ]: 0 : ovs_assert(inited);
6636 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_NAME]);
6637 : 0 : }
6638 : :
6639 : : /* Causes the original contents of column "ports" in 'row' to be
6640 : : * verified as a prerequisite to completing the transaction. That is, if
6641 : : * "ports" in 'row' changed (or if 'row' was deleted) between the
6642 : : * time that the IDL originally read its contents and the time that the
6643 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
6644 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
6645 : : * change has already been received).
6646 : : *
6647 : : * The intention is that, to ensure that no transaction commits based on dirty
6648 : : * reads, an application should call this function any time "ports" is
6649 : : * read as part of a read-modify-write operation.
6650 : : *
6651 : : * In some cases this function reduces to a no-op, because the current value
6652 : : * of "ports" is already known:
6653 : : *
6654 : : * - If 'row' is a row created by the current transaction (returned by
6655 : : * sbrec_multicast_group_insert()).
6656 : : *
6657 : : * - If "ports" has already been modified (with
6658 : : * sbrec_multicast_group_set_ports()) within the current transaction.
6659 : : *
6660 : : * Because of the latter property, always call this function *before*
6661 : : * sbrec_multicast_group_set_ports() for a given read-modify-write.
6662 : : *
6663 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6664 : : void
6665 : 0 : sbrec_multicast_group_verify_ports(const struct sbrec_multicast_group *row)
6666 : : {
6667 [ # # ]: 0 : ovs_assert(inited);
6668 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_PORTS]);
6669 : 0 : }
6670 : :
6671 : : /* Causes the original contents of column "tunnel_key" in 'row' to be
6672 : : * verified as a prerequisite to completing the transaction. That is, if
6673 : : * "tunnel_key" in 'row' changed (or if 'row' was deleted) between the
6674 : : * time that the IDL originally read its contents and the time that the
6675 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
6676 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
6677 : : * change has already been received).
6678 : : *
6679 : : * The intention is that, to ensure that no transaction commits based on dirty
6680 : : * reads, an application should call this function any time "tunnel_key" is
6681 : : * read as part of a read-modify-write operation.
6682 : : *
6683 : : * In some cases this function reduces to a no-op, because the current value
6684 : : * of "tunnel_key" is already known:
6685 : : *
6686 : : * - If 'row' is a row created by the current transaction (returned by
6687 : : * sbrec_multicast_group_insert()).
6688 : : *
6689 : : * - If "tunnel_key" has already been modified (with
6690 : : * sbrec_multicast_group_set_tunnel_key()) within the current transaction.
6691 : : *
6692 : : * Because of the latter property, always call this function *before*
6693 : : * sbrec_multicast_group_set_tunnel_key() for a given read-modify-write.
6694 : : *
6695 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6696 : : void
6697 : 0 : sbrec_multicast_group_verify_tunnel_key(const struct sbrec_multicast_group *row)
6698 : : {
6699 [ # # ]: 0 : ovs_assert(inited);
6700 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_TUNNEL_KEY]);
6701 : 0 : }
6702 : :
6703 : : /* Returns the "datapath" column's value from the "Multicast_Group" table in 'row'
6704 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6705 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6706 : : * for a given key than implementing the same operation on the "cooked"
6707 : : * form in 'row'.
6708 : : *
6709 : : * 'key_type' must be OVSDB_TYPE_UUID.
6710 : : * (This helps to avoid silent bugs if someone changes datapath's
6711 : : * type without updating the caller.)
6712 : : *
6713 : : * The caller must not modify or free the returned value.
6714 : : *
6715 : : * Various kinds of changes can invalidate the returned value: modifying
6716 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6717 : : * If the returned value is needed for a long time, it is best to make a copy
6718 : : * of it with ovsdb_datum_clone().
6719 : : *
6720 : : * This function is rarely useful, since it is easier to access the value
6721 : : * directly through the "datapath" member in sbrec_multicast_group. */
6722 : : const struct ovsdb_datum *
6723 : 0 : sbrec_multicast_group_get_datapath(const struct sbrec_multicast_group *row,
6724 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6725 : : {
6726 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
6727 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_multicast_group_col_datapath);
6728 : : }
6729 : :
6730 : : /* Returns the "name" column's value from the "Multicast_Group" table in 'row'
6731 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6732 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6733 : : * for a given key than implementing the same operation on the "cooked"
6734 : : * form in 'row'.
6735 : : *
6736 : : * 'key_type' must be OVSDB_TYPE_STRING.
6737 : : * (This helps to avoid silent bugs if someone changes name's
6738 : : * type without updating the caller.)
6739 : : *
6740 : : * The caller must not modify or free the returned value.
6741 : : *
6742 : : * Various kinds of changes can invalidate the returned value: modifying
6743 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6744 : : * If the returned value is needed for a long time, it is best to make a copy
6745 : : * of it with ovsdb_datum_clone().
6746 : : *
6747 : : * This function is rarely useful, since it is easier to access the value
6748 : : * directly through the "name" member in sbrec_multicast_group. */
6749 : : const struct ovsdb_datum *
6750 : 0 : sbrec_multicast_group_get_name(const struct sbrec_multicast_group *row,
6751 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6752 : : {
6753 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
6754 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_multicast_group_col_name);
6755 : : }
6756 : :
6757 : : /* Returns the "ports" column's value from the "Multicast_Group" table in 'row'
6758 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6759 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6760 : : * for a given key than implementing the same operation on the "cooked"
6761 : : * form in 'row'.
6762 : : *
6763 : : * 'key_type' must be OVSDB_TYPE_UUID.
6764 : : * (This helps to avoid silent bugs if someone changes ports's
6765 : : * type without updating the caller.)
6766 : : *
6767 : : * The caller must not modify or free the returned value.
6768 : : *
6769 : : * Various kinds of changes can invalidate the returned value: modifying
6770 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6771 : : * If the returned value is needed for a long time, it is best to make a copy
6772 : : * of it with ovsdb_datum_clone().
6773 : : *
6774 : : * This function is rarely useful, since it is easier to access the value
6775 : : * directly through the "ports" member in sbrec_multicast_group. */
6776 : : const struct ovsdb_datum *
6777 : 0 : sbrec_multicast_group_get_ports(const struct sbrec_multicast_group *row,
6778 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6779 : : {
6780 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
6781 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_multicast_group_col_ports);
6782 : : }
6783 : :
6784 : : /* Returns the "tunnel_key" column's value from the "Multicast_Group" table in 'row'
6785 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
6786 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
6787 : : * for a given key than implementing the same operation on the "cooked"
6788 : : * form in 'row'.
6789 : : *
6790 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
6791 : : * (This helps to avoid silent bugs if someone changes tunnel_key's
6792 : : * type without updating the caller.)
6793 : : *
6794 : : * The caller must not modify or free the returned value.
6795 : : *
6796 : : * Various kinds of changes can invalidate the returned value: modifying
6797 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6798 : : * If the returned value is needed for a long time, it is best to make a copy
6799 : : * of it with ovsdb_datum_clone().
6800 : : *
6801 : : * This function is rarely useful, since it is easier to access the value
6802 : : * directly through the "tunnel_key" member in sbrec_multicast_group. */
6803 : : const struct ovsdb_datum *
6804 : 0 : sbrec_multicast_group_get_tunnel_key(const struct sbrec_multicast_group *row,
6805 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
6806 : : {
6807 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6808 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_multicast_group_col_tunnel_key);
6809 : : }
6810 : :
6811 : : /* Sets the "datapath" column from the "Multicast_Group" table in 'row' to
6812 : : * 'datapath'.
6813 : : *
6814 : : * The caller retains ownership of the arguments. */
6815 : : void
6816 : 83 : sbrec_multicast_group_set_datapath(const struct sbrec_multicast_group *row, const struct sbrec_datapath_binding *datapath)
6817 : : {
6818 : : struct ovsdb_datum datum;
6819 : : union ovsdb_atom key;
6820 : :
6821 [ - + ]: 83 : ovs_assert(inited);
6822 : 83 : datum.n = 1;
6823 : 83 : datum.keys = &key;
6824 : 83 : key.uuid = datapath->header_.uuid;
6825 : 83 : datum.values = NULL;
6826 : 83 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_DATAPATH], &datum);
6827 : 83 : }
6828 : :
6829 : : /* Sets the "name" column from the "Multicast_Group" table in 'row' to
6830 : : * 'name'.
6831 : : *
6832 : : * The caller retains ownership of the arguments. */
6833 : : void
6834 : 83 : sbrec_multicast_group_set_name(const struct sbrec_multicast_group *row, const char *name)
6835 : : {
6836 : : struct ovsdb_datum datum;
6837 : : union ovsdb_atom key;
6838 : :
6839 [ - + ]: 83 : ovs_assert(inited);
6840 : 83 : datum.n = 1;
6841 : 83 : datum.keys = &key;
6842 : 83 : key.string = CONST_CAST(char *, name);
6843 : 83 : datum.values = NULL;
6844 : 83 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_NAME], &datum);
6845 : 83 : }
6846 : :
6847 : : /* Sets the "ports" column from the "Multicast_Group" table in 'row' to
6848 : : * the 'ports' set with 'n_ports' entries.
6849 : : *
6850 : : * The caller retains ownership of the arguments. */
6851 : : void
6852 : 5813 : sbrec_multicast_group_set_ports(const struct sbrec_multicast_group *row, struct sbrec_port_binding **ports, size_t n_ports)
6853 : : {
6854 : : struct ovsdb_datum datum;
6855 : : size_t i;
6856 : :
6857 [ - + ]: 5813 : ovs_assert(inited);
6858 : 5813 : datum.n = n_ports;
6859 [ + - ]: 5813 : datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
6860 : 5813 : datum.values = NULL;
6861 [ + + ]: 28360 : for (i = 0; i < n_ports; i++) {
6862 : 22547 : datum.keys[i].uuid = ports[i]->header_.uuid;
6863 : : }
6864 : 5813 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
6865 : 5813 : ovsdb_idl_txn_write(&row->header_, &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_PORTS], &datum);
6866 : 5813 : }
6867 : :
6868 : : /* Sets the "tunnel_key" column from the "Multicast_Group" table in 'row' to
6869 : : * 'tunnel_key'.
6870 : : *
6871 : : * Argument constraints: in range 32,768 to 65,535
6872 : : *
6873 : : * The caller retains ownership of the arguments. */
6874 : : void
6875 : 83 : sbrec_multicast_group_set_tunnel_key(const struct sbrec_multicast_group *row, int64_t tunnel_key)
6876 : : {
6877 : : struct ovsdb_datum datum;
6878 : : union ovsdb_atom key;
6879 : :
6880 [ - + ]: 83 : ovs_assert(inited);
6881 : 83 : datum.n = 1;
6882 : 83 : datum.keys = &key;
6883 : 83 : key.integer = tunnel_key;
6884 : 83 : datum.values = NULL;
6885 : 83 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_TUNNEL_KEY], &datum);
6886 : 83 : }
6887 : :
6888 : : /* Adds the value 'new_value' to the "ports" set column from the "Multicast_Group" table
6889 : : * in 'row'.
6890 : : *
6891 : : */
6892 : : void
6893 : 0 : sbrec_multicast_group_update_ports_addvalue(const struct sbrec_multicast_group *row, const struct sbrec_port_binding *new_value)
6894 : : {
6895 : : struct ovsdb_datum *datum;
6896 : :
6897 [ # # ]: 0 : ovs_assert(inited);
6898 : :
6899 : 0 : datum = xmalloc(sizeof *datum);
6900 : 0 : datum->n = 1;
6901 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
6902 : 0 : datum->values = NULL;
6903 : :
6904 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
6905 : :
6906 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
6907 : : &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_PORTS],
6908 : : datum);
6909 : 0 : }
6910 : :
6911 : : /* Deletes the value 'delete_value' from the "ports" set column from the
6912 : : * "Multicast_Group" table in 'row'.
6913 : : *
6914 : : */
6915 : : void
6916 : 0 : sbrec_multicast_group_update_ports_delvalue(const struct sbrec_multicast_group *row, const struct sbrec_port_binding *delete_value)
6917 : : {
6918 : : struct ovsdb_datum *datum;
6919 : :
6920 [ # # ]: 0 : ovs_assert(inited);
6921 : :
6922 : 0 : datum = xmalloc(sizeof *datum);
6923 : 0 : datum->n = 1;
6924 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
6925 : 0 : datum->values = NULL;
6926 : :
6927 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
6928 : :
6929 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
6930 : : &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_PORTS],
6931 : : datum);
6932 : 0 : }
6933 : :
6934 : : /* Sets the "datapath" column from the "Multicast_Group" table in 'row' to
6935 : : * 'datapath'.
6936 : : *
6937 : : * The caller retains ownership of the arguments. */
6938 : : void
6939 : 0 : sbrec_multicast_group_add_clause_datapath(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *datapath)
6940 : : {
6941 : : struct ovsdb_datum datum;
6942 : : union ovsdb_atom key;
6943 : :
6944 [ # # ]: 0 : ovs_assert(inited);
6945 : 0 : datum.n = 1;
6946 : 0 : datum.keys = &key;
6947 : 0 : key.uuid = *datapath;
6948 : 0 : datum.values = NULL;
6949 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP],
6950 : : function,
6951 : : &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_DATAPATH],
6952 : : &datum);
6953 : 0 : }
6954 : :
6955 : : /* Sets the "name" column from the "Multicast_Group" table in 'row' to
6956 : : * 'name'.
6957 : : *
6958 : : * The caller retains ownership of the arguments. */
6959 : : void
6960 : 0 : sbrec_multicast_group_add_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
6961 : : {
6962 : : struct ovsdb_datum datum;
6963 : : union ovsdb_atom key;
6964 : :
6965 [ # # ]: 0 : ovs_assert(inited);
6966 : 0 : datum.n = 1;
6967 : 0 : datum.keys = &key;
6968 : 0 : key.string = CONST_CAST(char *, name);
6969 : 0 : datum.values = NULL;
6970 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP],
6971 : : function,
6972 : : &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_NAME],
6973 : : &datum);
6974 : 0 : }
6975 : :
6976 : : /* Sets the "ports" column from the "Multicast_Group" table in 'row' to
6977 : : * the 'ports' set with 'n_ports' entries.
6978 : : *
6979 : : * The caller retains ownership of the arguments. */
6980 : : void
6981 : 0 : sbrec_multicast_group_add_clause_ports(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **ports, size_t n_ports)
6982 : : {
6983 : : struct ovsdb_datum datum;
6984 : : size_t i;
6985 : :
6986 [ # # ]: 0 : ovs_assert(inited);
6987 : 0 : datum.n = n_ports;
6988 [ # # ]: 0 : datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
6989 : 0 : datum.values = NULL;
6990 [ # # ]: 0 : for (i = 0; i < n_ports; i++) {
6991 : 0 : datum.keys[i].uuid = *ports[i];
6992 : : }
6993 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
6994 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP],
6995 : : function,
6996 : : &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_PORTS],
6997 : : &datum);
6998 : 0 : free(datum.keys);
6999 : 0 : }
7000 : :
7001 : : /* Sets the "tunnel_key" column from the "Multicast_Group" table in 'row' to
7002 : : * 'tunnel_key'.
7003 : : *
7004 : : * Argument constraints: in range 32,768 to 65,535
7005 : : *
7006 : : * The caller retains ownership of the arguments. */
7007 : : void
7008 : 0 : sbrec_multicast_group_add_clause_tunnel_key(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t tunnel_key)
7009 : : {
7010 : : struct ovsdb_datum datum;
7011 : : union ovsdb_atom key;
7012 : :
7013 [ # # ]: 0 : ovs_assert(inited);
7014 : 0 : datum.n = 1;
7015 : 0 : datum.keys = &key;
7016 : 0 : key.integer = tunnel_key;
7017 : 0 : datum.values = NULL;
7018 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP],
7019 : : function,
7020 : : &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_TUNNEL_KEY],
7021 : : &datum);
7022 : 0 : }
7023 : : void
7024 : 0 : sbrec_multicast_group_add_clause_false(struct ovsdb_idl *idl)
7025 : : {
7026 : : struct ovsdb_datum datum;
7027 : :
7028 : 0 : ovsdb_datum_init_empty(&datum);
7029 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP], OVSDB_F_FALSE, NULL, &datum);
7030 : 0 : }
7031 : : void
7032 : 0 : sbrec_multicast_group_add_clause_true(struct ovsdb_idl *idl)
7033 : : {
7034 : : struct ovsdb_datum datum;
7035 : :
7036 : 0 : ovsdb_datum_init_empty(&datum);
7037 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP], OVSDB_F_TRUE, NULL, &datum);
7038 : 0 : }
7039 : :
7040 : : /* Sets the "datapath" column from the "Multicast_Group" table in 'row' to
7041 : : * 'datapath'.
7042 : : *
7043 : : * The caller retains ownership of the arguments. */
7044 : : void
7045 : 0 : sbrec_multicast_group_remove_clause_datapath(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *datapath)
7046 : : {
7047 : : struct ovsdb_datum datum;
7048 : : union ovsdb_atom key;
7049 : :
7050 [ # # ]: 0 : ovs_assert(inited);
7051 : 0 : datum.n = 1;
7052 : 0 : datum.keys = &key;
7053 : 0 : key.uuid = *datapath;
7054 : 0 : datum.values = NULL;
7055 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP],
7056 : : function,
7057 : : &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_DATAPATH],
7058 : : &datum);
7059 : 0 : }
7060 : :
7061 : : /* Sets the "name" column from the "Multicast_Group" table in 'row' to
7062 : : * 'name'.
7063 : : *
7064 : : * The caller retains ownership of the arguments. */
7065 : : void
7066 : 0 : sbrec_multicast_group_remove_clause_name(struct ovsdb_idl *idl, enum ovsdb_function function, const char *name)
7067 : : {
7068 : : struct ovsdb_datum datum;
7069 : : union ovsdb_atom key;
7070 : :
7071 [ # # ]: 0 : ovs_assert(inited);
7072 : 0 : datum.n = 1;
7073 : 0 : datum.keys = &key;
7074 : 0 : key.string = CONST_CAST(char *, name);
7075 : 0 : datum.values = NULL;
7076 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP],
7077 : : function,
7078 : : &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_NAME],
7079 : : &datum);
7080 : 0 : }
7081 : :
7082 : : /* Sets the "ports" column from the "Multicast_Group" table in 'row' to
7083 : : * the 'ports' set with 'n_ports' entries.
7084 : : *
7085 : : * The caller retains ownership of the arguments. */
7086 : : void
7087 : 0 : sbrec_multicast_group_remove_clause_ports(struct ovsdb_idl *idl, enum ovsdb_function function, struct uuid **ports, size_t n_ports)
7088 : : {
7089 : : struct ovsdb_datum datum;
7090 : : size_t i;
7091 : :
7092 [ # # ]: 0 : ovs_assert(inited);
7093 : 0 : datum.n = n_ports;
7094 [ # # ]: 0 : datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
7095 : 0 : datum.values = NULL;
7096 [ # # ]: 0 : for (i = 0; i < n_ports; i++) {
7097 : 0 : datum.keys[i].uuid = *ports[i];
7098 : : }
7099 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
7100 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP],
7101 : : function,
7102 : : &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_PORTS],
7103 : : &datum);
7104 : 0 : free(datum.keys);
7105 : 0 : }
7106 : :
7107 : : /* Sets the "tunnel_key" column from the "Multicast_Group" table in 'row' to
7108 : : * 'tunnel_key'.
7109 : : *
7110 : : * Argument constraints: in range 32,768 to 65,535
7111 : : *
7112 : : * The caller retains ownership of the arguments. */
7113 : : void
7114 : 0 : sbrec_multicast_group_remove_clause_tunnel_key(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t tunnel_key)
7115 : : {
7116 : : struct ovsdb_datum datum;
7117 : : union ovsdb_atom key;
7118 : :
7119 [ # # ]: 0 : ovs_assert(inited);
7120 : 0 : datum.n = 1;
7121 : 0 : datum.keys = &key;
7122 : 0 : key.integer = tunnel_key;
7123 : 0 : datum.values = NULL;
7124 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP],
7125 : : function,
7126 : : &sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_COL_TUNNEL_KEY],
7127 : : &datum);
7128 : 0 : }
7129 : : void
7130 : 0 : sbrec_multicast_group_remove_clause_false(struct ovsdb_idl *idl)
7131 : : {
7132 : : struct ovsdb_datum datum;
7133 : :
7134 : 0 : ovsdb_datum_init_empty(&datum);
7135 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP], OVSDB_F_FALSE, NULL, &datum);
7136 : 0 : }
7137 : : void
7138 : 0 : sbrec_multicast_group_remove_clause_true(struct ovsdb_idl *idl)
7139 : : {
7140 : : struct ovsdb_datum datum;
7141 : :
7142 : 0 : ovsdb_datum_init_empty(&datum);
7143 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_MULTICAST_GROUP], OVSDB_F_TRUE, NULL, &datum);
7144 : 0 : }
7145 : :
7146 : : struct ovsdb_idl_column sbrec_multicast_group_columns[SBREC_MULTICAST_GROUP_N_COLUMNS];
7147 : :
7148 : : static void
7149 : 272 : sbrec_multicast_group_columns_init(void)
7150 : : {
7151 : : struct ovsdb_idl_column *c;
7152 : :
7153 : : /* Initialize sbrec_multicast_group_col_datapath. */
7154 : 272 : c = &sbrec_multicast_group_col_datapath;
7155 : 272 : c->name = "datapath";
7156 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
7157 : 272 : c->type.key.u.uuid.refTableName = "Datapath_Binding";
7158 : 272 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
7159 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7160 : 272 : c->type.n_min = 1;
7161 : 272 : c->type.n_max = 1;
7162 : 272 : c->mutable = true;
7163 : 272 : c->parse = sbrec_multicast_group_parse_datapath;
7164 : 272 : c->unparse = sbrec_multicast_group_unparse_datapath;
7165 : :
7166 : : /* Initialize sbrec_multicast_group_col_name. */
7167 : 272 : c = &sbrec_multicast_group_col_name;
7168 : 272 : c->name = "name";
7169 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7170 : 272 : c->type.key.u.string.minLen = 0;
7171 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7172 : 272 : c->type.n_min = 1;
7173 : 272 : c->type.n_max = 1;
7174 : 272 : c->mutable = true;
7175 : 272 : c->parse = sbrec_multicast_group_parse_name;
7176 : 272 : c->unparse = sbrec_multicast_group_unparse_name;
7177 : :
7178 : : /* Initialize sbrec_multicast_group_col_ports. */
7179 : 272 : c = &sbrec_multicast_group_col_ports;
7180 : 272 : c->name = "ports";
7181 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
7182 : 272 : c->type.key.u.uuid.refTableName = "Port_Binding";
7183 : 272 : c->type.key.u.uuid.refType = OVSDB_REF_WEAK;
7184 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7185 : 272 : c->type.n_min = 1;
7186 : 272 : c->type.n_max = UINT_MAX;
7187 : 272 : c->mutable = true;
7188 : 272 : c->parse = sbrec_multicast_group_parse_ports;
7189 : 272 : c->unparse = sbrec_multicast_group_unparse_ports;
7190 : :
7191 : : /* Initialize sbrec_multicast_group_col_tunnel_key. */
7192 : 272 : c = &sbrec_multicast_group_col_tunnel_key;
7193 : 272 : c->name = "tunnel_key";
7194 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7195 : 272 : c->type.key.u.integer.min = INT64_C(32768);
7196 : 272 : c->type.key.u.integer.max = INT64_C(65535);
7197 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7198 : 272 : c->type.n_min = 1;
7199 : 272 : c->type.n_max = 1;
7200 : 272 : c->mutable = true;
7201 : 272 : c->parse = sbrec_multicast_group_parse_tunnel_key;
7202 : 272 : c->unparse = sbrec_multicast_group_unparse_tunnel_key;
7203 : 272 : }
7204 : :
7205 : : /* Port_Binding table. */
7206 : :
7207 : : static void
7208 : 3675 : sbrec_port_binding_parse_chassis(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7209 : : {
7210 : 3675 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7211 : :
7212 [ - + ]: 3675 : ovs_assert(inited);
7213 [ + + ]: 3675 : if (datum->n >= 1) {
7214 : 1510 : row->chassis = sbrec_chassis_cast(ovsdb_idl_get_row_arc(row_, &sbrec_table_classes[SBREC_TABLE_CHASSIS], &datum->keys[0].uuid));
7215 : : } else {
7216 : 2165 : row->chassis = NULL;
7217 : : }
7218 : 3675 : }
7219 : :
7220 : : static void
7221 : 3669 : sbrec_port_binding_parse_datapath(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7222 : : {
7223 : 3669 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7224 : :
7225 [ - + ]: 3669 : ovs_assert(inited);
7226 [ + - ]: 3669 : if (datum->n >= 1) {
7227 : 3669 : row->datapath = sbrec_datapath_binding_cast(ovsdb_idl_get_row_arc(row_, &sbrec_table_classes[SBREC_TABLE_DATAPATH_BINDING], &datum->keys[0].uuid));
7228 : : } else {
7229 : 0 : row->datapath = NULL;
7230 : : }
7231 : 3669 : }
7232 : :
7233 : : static void
7234 : 3671 : sbrec_port_binding_parse_logical_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7235 : : {
7236 : 3671 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7237 : :
7238 [ - + ]: 3671 : ovs_assert(inited);
7239 [ + - ]: 3671 : if (datum->n >= 1) {
7240 : 3671 : row->logical_port = datum->keys[0].string;
7241 : : } else {
7242 : 0 : row->logical_port = "";
7243 : : }
7244 : 3671 : }
7245 : :
7246 : : static void
7247 : 3588 : sbrec_port_binding_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7248 : : {
7249 : 3588 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7250 : : size_t i;
7251 : :
7252 [ - + ]: 3588 : ovs_assert(inited);
7253 : 3588 : row->mac = NULL;
7254 : 3588 : row->n_mac = 0;
7255 [ + + ]: 6074 : for (i = 0; i < datum->n; i++) {
7256 [ + + ]: 2486 : if (!row->n_mac) {
7257 : 2282 : row->mac = xmalloc(datum->n * sizeof *row->mac);
7258 : : }
7259 : 2486 : row->mac[row->n_mac] = datum->keys[i].string;
7260 : 2486 : row->n_mac++;
7261 : : }
7262 : 3588 : }
7263 : :
7264 : : static void
7265 : 3574 : sbrec_port_binding_parse_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7266 : : {
7267 : 3574 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7268 : : size_t i;
7269 : :
7270 [ - + ]: 3574 : ovs_assert(inited);
7271 : 3574 : smap_init(&row->options);
7272 [ + + ]: 5312 : for (i = 0; i < datum->n; i++) {
7273 : 1738 : smap_add(&row->options,
7274 : 1738 : datum->keys[i].string,
7275 : 1738 : datum->values[i].string);
7276 : : }
7277 : 3574 : }
7278 : :
7279 : : static void
7280 : 3381 : sbrec_port_binding_parse_parent_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7281 : : {
7282 : 3381 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7283 : :
7284 [ - + ]: 3381 : ovs_assert(inited);
7285 [ + + ]: 3381 : if (datum->n >= 1) {
7286 : 42 : row->parent_port = datum->keys[0].string;
7287 : : } else {
7288 : 3339 : row->parent_port = NULL;
7289 : : }
7290 : 3381 : }
7291 : :
7292 : : static void
7293 : 3381 : sbrec_port_binding_parse_tag(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7294 : : {
7295 : 3381 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7296 : 3381 : size_t n = MIN(1, datum->n);
7297 : : size_t i;
7298 : :
7299 [ - + ]: 3381 : ovs_assert(inited);
7300 : 3381 : row->tag = NULL;
7301 : 3381 : row->n_tag = 0;
7302 [ + + ]: 3449 : for (i = 0; i < n; i++) {
7303 [ + - ]: 68 : if (!row->n_tag) {
7304 : 68 : row->tag = xmalloc(n * sizeof *row->tag);
7305 : : }
7306 : 68 : row->tag[row->n_tag] = datum->keys[i].integer;
7307 : 68 : row->n_tag++;
7308 : : }
7309 : 3381 : }
7310 : :
7311 : : static void
7312 : 3669 : sbrec_port_binding_parse_tunnel_key(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7313 : : {
7314 : 3669 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7315 : :
7316 [ - + ]: 3669 : ovs_assert(inited);
7317 [ + - ]: 3669 : if (datum->n >= 1) {
7318 : 3669 : row->tunnel_key = datum->keys[0].integer;
7319 : : } else {
7320 : 0 : row->tunnel_key = 0;
7321 : : }
7322 : 3669 : }
7323 : :
7324 : : static void
7325 : 3518 : sbrec_port_binding_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7326 : : {
7327 : 3518 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7328 : :
7329 [ - + ]: 3518 : ovs_assert(inited);
7330 [ + - ]: 3518 : if (datum->n >= 1) {
7331 : 3518 : row->type = datum->keys[0].string;
7332 : : } else {
7333 : 0 : row->type = "";
7334 : : }
7335 : 3518 : }
7336 : :
7337 : : static void
7338 : 3971 : sbrec_port_binding_unparse_chassis(struct ovsdb_idl_row *row OVS_UNUSED)
7339 : : {
7340 : : /* Nothing to do. */
7341 : 3971 : }
7342 : :
7343 : : static void
7344 : 3965 : sbrec_port_binding_unparse_datapath(struct ovsdb_idl_row *row OVS_UNUSED)
7345 : : {
7346 : : /* Nothing to do. */
7347 : 3965 : }
7348 : :
7349 : : static void
7350 : 3967 : sbrec_port_binding_unparse_logical_port(struct ovsdb_idl_row *row OVS_UNUSED)
7351 : : {
7352 : : /* Nothing to do. */
7353 : 3967 : }
7354 : :
7355 : : static void
7356 : 3884 : sbrec_port_binding_unparse_mac(struct ovsdb_idl_row *row_)
7357 : : {
7358 : 3884 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7359 : :
7360 [ - + ]: 3884 : ovs_assert(inited);
7361 : 3884 : free(row->mac);
7362 : 3884 : }
7363 : :
7364 : : static void
7365 : 3870 : sbrec_port_binding_unparse_options(struct ovsdb_idl_row *row_)
7366 : : {
7367 : 3870 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7368 : :
7369 [ - + ]: 3870 : ovs_assert(inited);
7370 : 3870 : smap_destroy(&row->options);
7371 : 3870 : }
7372 : :
7373 : : static void
7374 : 3677 : sbrec_port_binding_unparse_parent_port(struct ovsdb_idl_row *row OVS_UNUSED)
7375 : : {
7376 : : /* Nothing to do. */
7377 : 3677 : }
7378 : :
7379 : : static void
7380 : 3677 : sbrec_port_binding_unparse_tag(struct ovsdb_idl_row *row_)
7381 : : {
7382 : 3677 : struct sbrec_port_binding *row = sbrec_port_binding_cast(row_);
7383 : :
7384 [ - + ]: 3677 : ovs_assert(inited);
7385 : 3677 : free(row->tag);
7386 : 3677 : }
7387 : :
7388 : : static void
7389 : 3965 : sbrec_port_binding_unparse_tunnel_key(struct ovsdb_idl_row *row OVS_UNUSED)
7390 : : {
7391 : : /* Nothing to do. */
7392 : 3965 : }
7393 : :
7394 : : static void
7395 : 3814 : sbrec_port_binding_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
7396 : : {
7397 : : /* Nothing to do. */
7398 : 3814 : }
7399 : :
7400 : : static void
7401 : 1404 : sbrec_port_binding_init__(struct ovsdb_idl_row *row)
7402 : : {
7403 : 1404 : sbrec_port_binding_init(sbrec_port_binding_cast(row));
7404 : 1404 : }
7405 : :
7406 : : /* Clears the contents of 'row' in table "Port_Binding". */
7407 : : void
7408 : 1404 : sbrec_port_binding_init(struct sbrec_port_binding *row)
7409 : : {
7410 : 1404 : memset(row, 0, sizeof *row);
7411 : 1404 : smap_init(&row->options);
7412 : 1404 : }
7413 : :
7414 : : /* Searches table "Port_Binding" in 'idl' for a row with UUID 'uuid'. Returns
7415 : : * a pointer to the row if there is one, otherwise a null pointer. */
7416 : : const struct sbrec_port_binding *
7417 : 0 : sbrec_port_binding_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
7418 : : {
7419 : 0 : return sbrec_port_binding_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING], uuid));
7420 : : }
7421 : :
7422 : : /* Returns a row in table "Port_Binding" in 'idl', or a null pointer if that
7423 : : * table is empty.
7424 : : *
7425 : : * Database tables are internally maintained as hash tables, so adding or
7426 : : * removing rows while traversing the same table can cause some rows to be
7427 : : * visited twice or not at apply. */
7428 : : const struct sbrec_port_binding *
7429 : 18521 : sbrec_port_binding_first(const struct ovsdb_idl *idl)
7430 : : {
7431 : 18521 : return sbrec_port_binding_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING]));
7432 : : }
7433 : :
7434 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
7435 : : * is the last row in its table. */
7436 : : const struct sbrec_port_binding *
7437 : 309507 : sbrec_port_binding_next(const struct sbrec_port_binding *row)
7438 : : {
7439 : 309507 : return sbrec_port_binding_cast(ovsdb_idl_next_row(&row->header_));
7440 : : }
7441 : :
7442 : 0 : unsigned int sbrec_port_binding_get_seqno(const struct ovsdb_idl *idl)
7443 : : {
7444 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING]);
7445 : : }
7446 : :
7447 : 0 : unsigned int sbrec_port_binding_row_get_seqno(const struct sbrec_port_binding *row, enum ovsdb_idl_change change)
7448 : : {
7449 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
7450 : : }
7451 : :
7452 : : const struct sbrec_port_binding *
7453 : 0 : sbrec_port_binding_track_get_first(const struct ovsdb_idl *idl)
7454 : : {
7455 : 0 : return sbrec_port_binding_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING]));
7456 : : }
7457 : :
7458 : : const struct sbrec_port_binding
7459 : 0 : *sbrec_port_binding_track_get_next(const struct sbrec_port_binding *row)
7460 : : {
7461 : 0 : return sbrec_port_binding_cast(ovsdb_idl_track_get_next(&row->header_));
7462 : : }
7463 : :
7464 : :
7465 : : /* Deletes 'row' from table "Port_Binding". 'row' may be freed, so it must not be
7466 : : * accessed afterward.
7467 : : *
7468 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7469 : : void
7470 : 13 : sbrec_port_binding_delete(const struct sbrec_port_binding *row)
7471 : : {
7472 : 13 : ovsdb_idl_txn_delete(&row->header_);
7473 : 13 : }
7474 : :
7475 : : /* Inserts and returns a new row in the table "Port_Binding" in the database
7476 : : * with open transaction 'txn'.
7477 : : *
7478 : : * The new row is assigned a randomly generated provisional UUID.
7479 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
7480 : : * but the IDL will replace any uses of the provisional UUID in the
7481 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
7482 : : struct sbrec_port_binding *
7483 : 291 : sbrec_port_binding_insert(struct ovsdb_idl_txn *txn)
7484 : : {
7485 : 291 : return sbrec_port_binding_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING], NULL));
7486 : : }
7487 : :
7488 : : bool
7489 : 0 : sbrec_port_binding_is_updated(const struct sbrec_port_binding *row, enum sbrec_port_binding_column_id column)
7490 : : {
7491 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_port_binding_columns[column]);
7492 : : }
7493 : :
7494 : : /* Causes the original contents of column "chassis" in 'row' to be
7495 : : * verified as a prerequisite to completing the transaction. That is, if
7496 : : * "chassis" in 'row' changed (or if 'row' was deleted) between the
7497 : : * time that the IDL originally read its contents and the time that the
7498 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7499 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7500 : : * change has already been received).
7501 : : *
7502 : : * The intention is that, to ensure that no transaction commits based on dirty
7503 : : * reads, an application should call this function any time "chassis" is
7504 : : * read as part of a read-modify-write operation.
7505 : : *
7506 : : * In some cases this function reduces to a no-op, because the current value
7507 : : * of "chassis" is already known:
7508 : : *
7509 : : * - If 'row' is a row created by the current transaction (returned by
7510 : : * sbrec_port_binding_insert()).
7511 : : *
7512 : : * - If "chassis" has already been modified (with
7513 : : * sbrec_port_binding_set_chassis()) within the current transaction.
7514 : : *
7515 : : * Because of the latter property, always call this function *before*
7516 : : * sbrec_port_binding_set_chassis() for a given read-modify-write.
7517 : : *
7518 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7519 : : void
7520 : 0 : sbrec_port_binding_verify_chassis(const struct sbrec_port_binding *row)
7521 : : {
7522 [ # # ]: 0 : ovs_assert(inited);
7523 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_CHASSIS]);
7524 : 0 : }
7525 : :
7526 : : /* Causes the original contents of column "datapath" in 'row' to be
7527 : : * verified as a prerequisite to completing the transaction. That is, if
7528 : : * "datapath" in 'row' changed (or if 'row' was deleted) between the
7529 : : * time that the IDL originally read its contents and the time that the
7530 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7531 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7532 : : * change has already been received).
7533 : : *
7534 : : * The intention is that, to ensure that no transaction commits based on dirty
7535 : : * reads, an application should call this function any time "datapath" is
7536 : : * read as part of a read-modify-write operation.
7537 : : *
7538 : : * In some cases this function reduces to a no-op, because the current value
7539 : : * of "datapath" is already known:
7540 : : *
7541 : : * - If 'row' is a row created by the current transaction (returned by
7542 : : * sbrec_port_binding_insert()).
7543 : : *
7544 : : * - If "datapath" has already been modified (with
7545 : : * sbrec_port_binding_set_datapath()) within the current transaction.
7546 : : *
7547 : : * Because of the latter property, always call this function *before*
7548 : : * sbrec_port_binding_set_datapath() for a given read-modify-write.
7549 : : *
7550 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7551 : : void
7552 : 0 : sbrec_port_binding_verify_datapath(const struct sbrec_port_binding *row)
7553 : : {
7554 [ # # ]: 0 : ovs_assert(inited);
7555 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_DATAPATH]);
7556 : 0 : }
7557 : :
7558 : : /* Causes the original contents of column "logical_port" in 'row' to be
7559 : : * verified as a prerequisite to completing the transaction. That is, if
7560 : : * "logical_port" in 'row' changed (or if 'row' was deleted) between the
7561 : : * time that the IDL originally read its contents and the time that the
7562 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7563 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7564 : : * change has already been received).
7565 : : *
7566 : : * The intention is that, to ensure that no transaction commits based on dirty
7567 : : * reads, an application should call this function any time "logical_port" is
7568 : : * read as part of a read-modify-write operation.
7569 : : *
7570 : : * In some cases this function reduces to a no-op, because the current value
7571 : : * of "logical_port" is already known:
7572 : : *
7573 : : * - If 'row' is a row created by the current transaction (returned by
7574 : : * sbrec_port_binding_insert()).
7575 : : *
7576 : : * - If "logical_port" has already been modified (with
7577 : : * sbrec_port_binding_set_logical_port()) within the current transaction.
7578 : : *
7579 : : * Because of the latter property, always call this function *before*
7580 : : * sbrec_port_binding_set_logical_port() for a given read-modify-write.
7581 : : *
7582 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7583 : : void
7584 : 0 : sbrec_port_binding_verify_logical_port(const struct sbrec_port_binding *row)
7585 : : {
7586 [ # # ]: 0 : ovs_assert(inited);
7587 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_LOGICAL_PORT]);
7588 : 0 : }
7589 : :
7590 : : /* Causes the original contents of column "mac" in 'row' to be
7591 : : * verified as a prerequisite to completing the transaction. That is, if
7592 : : * "mac" in 'row' changed (or if 'row' was deleted) between the
7593 : : * time that the IDL originally read its contents and the time that the
7594 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7595 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7596 : : * change has already been received).
7597 : : *
7598 : : * The intention is that, to ensure that no transaction commits based on dirty
7599 : : * reads, an application should call this function any time "mac" is
7600 : : * read as part of a read-modify-write operation.
7601 : : *
7602 : : * In some cases this function reduces to a no-op, because the current value
7603 : : * of "mac" is already known:
7604 : : *
7605 : : * - If 'row' is a row created by the current transaction (returned by
7606 : : * sbrec_port_binding_insert()).
7607 : : *
7608 : : * - If "mac" has already been modified (with
7609 : : * sbrec_port_binding_set_mac()) within the current transaction.
7610 : : *
7611 : : * Because of the latter property, always call this function *before*
7612 : : * sbrec_port_binding_set_mac() for a given read-modify-write.
7613 : : *
7614 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7615 : : void
7616 : 0 : sbrec_port_binding_verify_mac(const struct sbrec_port_binding *row)
7617 : : {
7618 [ # # ]: 0 : ovs_assert(inited);
7619 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_MAC]);
7620 : 0 : }
7621 : :
7622 : : /* Causes the original contents of column "options" in 'row' to be
7623 : : * verified as a prerequisite to completing the transaction. That is, if
7624 : : * "options" in 'row' changed (or if 'row' was deleted) between the
7625 : : * time that the IDL originally read its contents and the time that the
7626 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7627 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7628 : : * change has already been received).
7629 : : *
7630 : : * The intention is that, to ensure that no transaction commits based on dirty
7631 : : * reads, an application should call this function any time "options" is
7632 : : * read as part of a read-modify-write operation.
7633 : : *
7634 : : * In some cases this function reduces to a no-op, because the current value
7635 : : * of "options" is already known:
7636 : : *
7637 : : * - If 'row' is a row created by the current transaction (returned by
7638 : : * sbrec_port_binding_insert()).
7639 : : *
7640 : : * - If "options" has already been modified (with
7641 : : * sbrec_port_binding_set_options()) within the current transaction.
7642 : : *
7643 : : * Because of the latter property, always call this function *before*
7644 : : * sbrec_port_binding_set_options() for a given read-modify-write.
7645 : : *
7646 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7647 : : void
7648 : 0 : sbrec_port_binding_verify_options(const struct sbrec_port_binding *row)
7649 : : {
7650 [ # # ]: 0 : ovs_assert(inited);
7651 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_OPTIONS]);
7652 : 0 : }
7653 : :
7654 : : /* Causes the original contents of column "parent_port" in 'row' to be
7655 : : * verified as a prerequisite to completing the transaction. That is, if
7656 : : * "parent_port" in 'row' changed (or if 'row' was deleted) between the
7657 : : * time that the IDL originally read its contents and the time that the
7658 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7659 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7660 : : * change has already been received).
7661 : : *
7662 : : * The intention is that, to ensure that no transaction commits based on dirty
7663 : : * reads, an application should call this function any time "parent_port" is
7664 : : * read as part of a read-modify-write operation.
7665 : : *
7666 : : * In some cases this function reduces to a no-op, because the current value
7667 : : * of "parent_port" is already known:
7668 : : *
7669 : : * - If 'row' is a row created by the current transaction (returned by
7670 : : * sbrec_port_binding_insert()).
7671 : : *
7672 : : * - If "parent_port" has already been modified (with
7673 : : * sbrec_port_binding_set_parent_port()) within the current transaction.
7674 : : *
7675 : : * Because of the latter property, always call this function *before*
7676 : : * sbrec_port_binding_set_parent_port() for a given read-modify-write.
7677 : : *
7678 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7679 : : void
7680 : 0 : sbrec_port_binding_verify_parent_port(const struct sbrec_port_binding *row)
7681 : : {
7682 [ # # ]: 0 : ovs_assert(inited);
7683 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_PARENT_PORT]);
7684 : 0 : }
7685 : :
7686 : : /* Causes the original contents of column "tag" in 'row' to be
7687 : : * verified as a prerequisite to completing the transaction. That is, if
7688 : : * "tag" in 'row' changed (or if 'row' was deleted) between the
7689 : : * time that the IDL originally read its contents and the time that the
7690 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7691 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7692 : : * change has already been received).
7693 : : *
7694 : : * The intention is that, to ensure that no transaction commits based on dirty
7695 : : * reads, an application should call this function any time "tag" is
7696 : : * read as part of a read-modify-write operation.
7697 : : *
7698 : : * In some cases this function reduces to a no-op, because the current value
7699 : : * of "tag" is already known:
7700 : : *
7701 : : * - If 'row' is a row created by the current transaction (returned by
7702 : : * sbrec_port_binding_insert()).
7703 : : *
7704 : : * - If "tag" has already been modified (with
7705 : : * sbrec_port_binding_set_tag()) within the current transaction.
7706 : : *
7707 : : * Because of the latter property, always call this function *before*
7708 : : * sbrec_port_binding_set_tag() for a given read-modify-write.
7709 : : *
7710 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7711 : : void
7712 : 0 : sbrec_port_binding_verify_tag(const struct sbrec_port_binding *row)
7713 : : {
7714 [ # # ]: 0 : ovs_assert(inited);
7715 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TAG]);
7716 : 0 : }
7717 : :
7718 : : /* Causes the original contents of column "tunnel_key" in 'row' to be
7719 : : * verified as a prerequisite to completing the transaction. That is, if
7720 : : * "tunnel_key" in 'row' changed (or if 'row' was deleted) between the
7721 : : * time that the IDL originally read its contents and the time that the
7722 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7723 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7724 : : * change has already been received).
7725 : : *
7726 : : * The intention is that, to ensure that no transaction commits based on dirty
7727 : : * reads, an application should call this function any time "tunnel_key" is
7728 : : * read as part of a read-modify-write operation.
7729 : : *
7730 : : * In some cases this function reduces to a no-op, because the current value
7731 : : * of "tunnel_key" is already known:
7732 : : *
7733 : : * - If 'row' is a row created by the current transaction (returned by
7734 : : * sbrec_port_binding_insert()).
7735 : : *
7736 : : * - If "tunnel_key" has already been modified (with
7737 : : * sbrec_port_binding_set_tunnel_key()) within the current transaction.
7738 : : *
7739 : : * Because of the latter property, always call this function *before*
7740 : : * sbrec_port_binding_set_tunnel_key() for a given read-modify-write.
7741 : : *
7742 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7743 : : void
7744 : 0 : sbrec_port_binding_verify_tunnel_key(const struct sbrec_port_binding *row)
7745 : : {
7746 [ # # ]: 0 : ovs_assert(inited);
7747 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TUNNEL_KEY]);
7748 : 0 : }
7749 : :
7750 : : /* Causes the original contents of column "type" in 'row' to be
7751 : : * verified as a prerequisite to completing the transaction. That is, if
7752 : : * "type" in 'row' changed (or if 'row' was deleted) between the
7753 : : * time that the IDL originally read its contents and the time that the
7754 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
7755 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
7756 : : * change has already been received).
7757 : : *
7758 : : * The intention is that, to ensure that no transaction commits based on dirty
7759 : : * reads, an application should call this function any time "type" is
7760 : : * read as part of a read-modify-write operation.
7761 : : *
7762 : : * In some cases this function reduces to a no-op, because the current value
7763 : : * of "type" is already known:
7764 : : *
7765 : : * - If 'row' is a row created by the current transaction (returned by
7766 : : * sbrec_port_binding_insert()).
7767 : : *
7768 : : * - If "type" has already been modified (with
7769 : : * sbrec_port_binding_set_type()) within the current transaction.
7770 : : *
7771 : : * Because of the latter property, always call this function *before*
7772 : : * sbrec_port_binding_set_type() for a given read-modify-write.
7773 : : *
7774 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7775 : : void
7776 : 0 : sbrec_port_binding_verify_type(const struct sbrec_port_binding *row)
7777 : : {
7778 [ # # ]: 0 : ovs_assert(inited);
7779 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TYPE]);
7780 : 0 : }
7781 : :
7782 : : /* Returns the "chassis" column's value from the "Port_Binding" table in 'row'
7783 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7784 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7785 : : * for a given key than implementing the same operation on the "cooked"
7786 : : * form in 'row'.
7787 : : *
7788 : : * 'key_type' must be OVSDB_TYPE_UUID.
7789 : : * (This helps to avoid silent bugs if someone changes chassis's
7790 : : * type without updating the caller.)
7791 : : *
7792 : : * The caller must not modify or free the returned value.
7793 : : *
7794 : : * Various kinds of changes can invalidate the returned value: modifying
7795 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7796 : : * If the returned value is needed for a long time, it is best to make a copy
7797 : : * of it with ovsdb_datum_clone().
7798 : : *
7799 : : * This function is rarely useful, since it is easier to access the value
7800 : : * directly through the "chassis" member in sbrec_port_binding. */
7801 : : const struct ovsdb_datum *
7802 : 0 : sbrec_port_binding_get_chassis(const struct sbrec_port_binding *row,
7803 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
7804 : : {
7805 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
7806 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_port_binding_col_chassis);
7807 : : }
7808 : :
7809 : : /* Returns the "datapath" column's value from the "Port_Binding" table in 'row'
7810 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7811 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7812 : : * for a given key than implementing the same operation on the "cooked"
7813 : : * form in 'row'.
7814 : : *
7815 : : * 'key_type' must be OVSDB_TYPE_UUID.
7816 : : * (This helps to avoid silent bugs if someone changes datapath's
7817 : : * type without updating the caller.)
7818 : : *
7819 : : * The caller must not modify or free the returned value.
7820 : : *
7821 : : * Various kinds of changes can invalidate the returned value: modifying
7822 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7823 : : * If the returned value is needed for a long time, it is best to make a copy
7824 : : * of it with ovsdb_datum_clone().
7825 : : *
7826 : : * This function is rarely useful, since it is easier to access the value
7827 : : * directly through the "datapath" member in sbrec_port_binding. */
7828 : : const struct ovsdb_datum *
7829 : 0 : sbrec_port_binding_get_datapath(const struct sbrec_port_binding *row,
7830 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
7831 : : {
7832 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_UUID);
7833 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_port_binding_col_datapath);
7834 : : }
7835 : :
7836 : : /* Returns the "logical_port" column's value from the "Port_Binding" table in 'row'
7837 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7838 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7839 : : * for a given key than implementing the same operation on the "cooked"
7840 : : * form in 'row'.
7841 : : *
7842 : : * 'key_type' must be OVSDB_TYPE_STRING.
7843 : : * (This helps to avoid silent bugs if someone changes logical_port's
7844 : : * type without updating the caller.)
7845 : : *
7846 : : * The caller must not modify or free the returned value.
7847 : : *
7848 : : * Various kinds of changes can invalidate the returned value: modifying
7849 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7850 : : * If the returned value is needed for a long time, it is best to make a copy
7851 : : * of it with ovsdb_datum_clone().
7852 : : *
7853 : : * This function is rarely useful, since it is easier to access the value
7854 : : * directly through the "logical_port" member in sbrec_port_binding. */
7855 : : const struct ovsdb_datum *
7856 : 0 : sbrec_port_binding_get_logical_port(const struct sbrec_port_binding *row,
7857 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
7858 : : {
7859 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
7860 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_port_binding_col_logical_port);
7861 : : }
7862 : :
7863 : : /* Returns the "mac" column's value from the "Port_Binding" table in 'row'
7864 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7865 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7866 : : * for a given key than implementing the same operation on the "cooked"
7867 : : * form in 'row'.
7868 : : *
7869 : : * 'key_type' must be OVSDB_TYPE_STRING.
7870 : : * (This helps to avoid silent bugs if someone changes mac's
7871 : : * type without updating the caller.)
7872 : : *
7873 : : * The caller must not modify or free the returned value.
7874 : : *
7875 : : * Various kinds of changes can invalidate the returned value: modifying
7876 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7877 : : * If the returned value is needed for a long time, it is best to make a copy
7878 : : * of it with ovsdb_datum_clone().
7879 : : *
7880 : : * This function is rarely useful, since it is easier to access the value
7881 : : * directly through the "mac" member in sbrec_port_binding. */
7882 : : const struct ovsdb_datum *
7883 : 0 : sbrec_port_binding_get_mac(const struct sbrec_port_binding *row,
7884 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
7885 : : {
7886 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
7887 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_port_binding_col_mac);
7888 : : }
7889 : :
7890 : : /* Returns the "options" column's value from the "Port_Binding" table in 'row'
7891 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7892 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7893 : : * for a given key than implementing the same operation on the "cooked"
7894 : : * form in 'row'.
7895 : : *
7896 : : * 'key_type' must be OVSDB_TYPE_STRING.
7897 : : * 'value_type' must be OVSDB_TYPE_STRING.
7898 : : * (This helps to avoid silent bugs if someone changes options's
7899 : : * type without updating the caller.)
7900 : : *
7901 : : * The caller must not modify or free the returned value.
7902 : : *
7903 : : * Various kinds of changes can invalidate the returned value: modifying
7904 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7905 : : * If the returned value is needed for a long time, it is best to make a copy
7906 : : * of it with ovsdb_datum_clone().
7907 : : *
7908 : : * This function is rarely useful, since it is easier to access the value
7909 : : * directly through the "options" member in sbrec_port_binding. */
7910 : : const struct ovsdb_datum *
7911 : 0 : sbrec_port_binding_get_options(const struct sbrec_port_binding *row,
7912 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
7913 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
7914 : : {
7915 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
7916 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
7917 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_port_binding_col_options);
7918 : : }
7919 : :
7920 : : /* Returns the "parent_port" column's value from the "Port_Binding" table in 'row'
7921 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7922 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7923 : : * for a given key than implementing the same operation on the "cooked"
7924 : : * form in 'row'.
7925 : : *
7926 : : * 'key_type' must be OVSDB_TYPE_STRING.
7927 : : * (This helps to avoid silent bugs if someone changes parent_port's
7928 : : * type without updating the caller.)
7929 : : *
7930 : : * The caller must not modify or free the returned value.
7931 : : *
7932 : : * Various kinds of changes can invalidate the returned value: modifying
7933 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7934 : : * If the returned value is needed for a long time, it is best to make a copy
7935 : : * of it with ovsdb_datum_clone().
7936 : : *
7937 : : * This function is rarely useful, since it is easier to access the value
7938 : : * directly through the "parent_port" member in sbrec_port_binding. */
7939 : : const struct ovsdb_datum *
7940 : 0 : sbrec_port_binding_get_parent_port(const struct sbrec_port_binding *row,
7941 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
7942 : : {
7943 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
7944 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_port_binding_col_parent_port);
7945 : : }
7946 : :
7947 : : /* Returns the "tag" column's value from the "Port_Binding" table in 'row'
7948 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7949 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7950 : : * for a given key than implementing the same operation on the "cooked"
7951 : : * form in 'row'.
7952 : : *
7953 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
7954 : : * (This helps to avoid silent bugs if someone changes tag's
7955 : : * type without updating the caller.)
7956 : : *
7957 : : * The caller must not modify or free the returned value.
7958 : : *
7959 : : * Various kinds of changes can invalidate the returned value: modifying
7960 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7961 : : * If the returned value is needed for a long time, it is best to make a copy
7962 : : * of it with ovsdb_datum_clone().
7963 : : *
7964 : : * This function is rarely useful, since it is easier to access the value
7965 : : * directly through the "tag" member in sbrec_port_binding. */
7966 : : const struct ovsdb_datum *
7967 : 0 : sbrec_port_binding_get_tag(const struct sbrec_port_binding *row,
7968 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
7969 : : {
7970 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
7971 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_port_binding_col_tag);
7972 : : }
7973 : :
7974 : : /* Returns the "tunnel_key" column's value from the "Port_Binding" table in 'row'
7975 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
7976 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
7977 : : * for a given key than implementing the same operation on the "cooked"
7978 : : * form in 'row'.
7979 : : *
7980 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
7981 : : * (This helps to avoid silent bugs if someone changes tunnel_key's
7982 : : * type without updating the caller.)
7983 : : *
7984 : : * The caller must not modify or free the returned value.
7985 : : *
7986 : : * Various kinds of changes can invalidate the returned value: modifying
7987 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7988 : : * If the returned value is needed for a long time, it is best to make a copy
7989 : : * of it with ovsdb_datum_clone().
7990 : : *
7991 : : * This function is rarely useful, since it is easier to access the value
7992 : : * directly through the "tunnel_key" member in sbrec_port_binding. */
7993 : : const struct ovsdb_datum *
7994 : 0 : sbrec_port_binding_get_tunnel_key(const struct sbrec_port_binding *row,
7995 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
7996 : : {
7997 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
7998 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_port_binding_col_tunnel_key);
7999 : : }
8000 : :
8001 : : /* Returns the "type" column's value from the "Port_Binding" table in 'row'
8002 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
8003 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
8004 : : * for a given key than implementing the same operation on the "cooked"
8005 : : * form in 'row'.
8006 : : *
8007 : : * 'key_type' must be OVSDB_TYPE_STRING.
8008 : : * (This helps to avoid silent bugs if someone changes type's
8009 : : * type without updating the caller.)
8010 : : *
8011 : : * The caller must not modify or free the returned value.
8012 : : *
8013 : : * Various kinds of changes can invalidate the returned value: modifying
8014 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8015 : : * If the returned value is needed for a long time, it is best to make a copy
8016 : : * of it with ovsdb_datum_clone().
8017 : : *
8018 : : * This function is rarely useful, since it is easier to access the value
8019 : : * directly through the "type" member in sbrec_port_binding. */
8020 : : const struct ovsdb_datum *
8021 : 0 : sbrec_port_binding_get_type(const struct sbrec_port_binding *row,
8022 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
8023 : : {
8024 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
8025 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_port_binding_col_type);
8026 : : }
8027 : :
8028 : : /* Sets the "chassis" column from the "Port_Binding" table in 'row' to
8029 : : * the 'chassis' set.
8030 : : *
8031 : : * If "chassis" is null, the column will be the empty set,
8032 : : * otherwise it will contain the specified value.
8033 : : *
8034 : : * The caller retains ownership of the arguments. */
8035 : : void
8036 : 302 : sbrec_port_binding_set_chassis(const struct sbrec_port_binding *row, const struct sbrec_chassis *chassis)
8037 : : {
8038 : : struct ovsdb_datum datum;
8039 : : union ovsdb_atom key;
8040 : :
8041 [ - + ]: 302 : ovs_assert(inited);
8042 [ + + ]: 302 : if (chassis) {
8043 : 154 : datum.n = 1;
8044 : 154 : datum.keys = &key;
8045 : 154 : key.uuid = chassis->header_.uuid;
8046 : : } else {
8047 : 148 : datum.n = 0;
8048 : 148 : datum.keys = NULL;
8049 : : }
8050 : 302 : datum.values = NULL;
8051 : 302 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_CHASSIS], &datum);
8052 : 302 : }
8053 : :
8054 : : /* Sets the "datapath" column from the "Port_Binding" table in 'row' to
8055 : : * 'datapath'.
8056 : : *
8057 : : * The caller retains ownership of the arguments. */
8058 : : void
8059 : 25610 : sbrec_port_binding_set_datapath(const struct sbrec_port_binding *row, const struct sbrec_datapath_binding *datapath)
8060 : : {
8061 : : struct ovsdb_datum datum;
8062 : : union ovsdb_atom key;
8063 : :
8064 [ - + ]: 25610 : ovs_assert(inited);
8065 : 25610 : datum.n = 1;
8066 : 25610 : datum.keys = &key;
8067 : 25610 : key.uuid = datapath->header_.uuid;
8068 : 25610 : datum.values = NULL;
8069 : 25610 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_DATAPATH], &datum);
8070 : 25610 : }
8071 : :
8072 : : /* Sets the "logical_port" column from the "Port_Binding" table in 'row' to
8073 : : * 'logical_port'.
8074 : : *
8075 : : * The caller retains ownership of the arguments. */
8076 : : void
8077 : 291 : sbrec_port_binding_set_logical_port(const struct sbrec_port_binding *row, const char *logical_port)
8078 : : {
8079 : : struct ovsdb_datum datum;
8080 : : union ovsdb_atom key;
8081 : :
8082 [ - + ]: 291 : ovs_assert(inited);
8083 : 291 : datum.n = 1;
8084 : 291 : datum.keys = &key;
8085 : 291 : key.string = CONST_CAST(char *, logical_port);
8086 : 291 : datum.values = NULL;
8087 : 291 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_LOGICAL_PORT], &datum);
8088 : 291 : }
8089 : :
8090 : : /* Sets the "mac" column from the "Port_Binding" table in 'row' to
8091 : : * the 'mac' set with 'n_mac' entries.
8092 : : *
8093 : : * The caller retains ownership of the arguments. */
8094 : : void
8095 : 25610 : sbrec_port_binding_set_mac(const struct sbrec_port_binding *row, const char **mac, size_t n_mac)
8096 : : {
8097 : : struct ovsdb_datum datum;
8098 : : size_t i;
8099 : :
8100 [ - + ]: 25610 : ovs_assert(inited);
8101 : 25610 : datum.n = n_mac;
8102 [ + + ]: 25610 : datum.keys = n_mac ? xmalloc(n_mac * sizeof *datum.keys) : NULL;
8103 : 25610 : datum.values = NULL;
8104 [ + + ]: 47354 : for (i = 0; i < n_mac; i++) {
8105 : 21744 : datum.keys[i].string = xstrdup(mac[i]);
8106 : : }
8107 : 25610 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
8108 : 25610 : ovsdb_idl_txn_write(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_MAC], &datum);
8109 : 25610 : }
8110 : :
8111 : : /* Sets the "options" column's value from the "Port_Binding" table in 'row'
8112 : : * to 'options'.
8113 : : *
8114 : : * The caller retains ownership of 'options' and everything in it. */
8115 : : void
8116 : 25610 : sbrec_port_binding_set_options(const struct sbrec_port_binding *row, const struct smap *options)
8117 : : {
8118 : : struct ovsdb_datum datum;
8119 : :
8120 [ - + ]: 25610 : ovs_assert(inited);
8121 [ + - ]: 25610 : if (options) {
8122 : : struct smap_node *node;
8123 : : size_t i;
8124 : :
8125 : 25610 : datum.n = smap_count(options);
8126 : 25610 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8127 : 25610 : datum.values = xmalloc(datum.n * sizeof *datum.values);
8128 : :
8129 : 25610 : i = 0;
8130 [ + + ][ - + ]: 36800 : SMAP_FOR_EACH (node, options) {
8131 : 11190 : datum.keys[i].string = xstrdup(node->key);
8132 : 11190 : datum.values[i].string = xstrdup(node->value);
8133 : 11190 : i++;
8134 : : }
8135 : 25610 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8136 : : } else {
8137 : 0 : ovsdb_datum_init_empty(&datum);
8138 : : }
8139 : 25610 : ovsdb_idl_txn_write(&row->header_,
8140 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_OPTIONS],
8141 : : &datum);
8142 : 25610 : }
8143 : :
8144 : :
8145 : : /* Sets the "parent_port" column from the "Port_Binding" table in 'row' to
8146 : : * the 'parent_port' set.
8147 : : *
8148 : : * If "parent_port" is null, the column will be the empty set,
8149 : : * otherwise it will contain the specified value.
8150 : : *
8151 : : * The caller retains ownership of the arguments. */
8152 : : void
8153 : 25610 : sbrec_port_binding_set_parent_port(const struct sbrec_port_binding *row, const char *parent_port)
8154 : : {
8155 : : struct ovsdb_datum datum;
8156 : : union ovsdb_atom key;
8157 : :
8158 [ - + ]: 25610 : ovs_assert(inited);
8159 [ + + ]: 25610 : if (parent_port) {
8160 : 219 : datum.n = 1;
8161 : 219 : datum.keys = &key;
8162 : 219 : key.string = CONST_CAST(char *, parent_port);
8163 : : } else {
8164 : 25391 : datum.n = 0;
8165 : 25391 : datum.keys = NULL;
8166 : : }
8167 : 25610 : datum.values = NULL;
8168 : 25610 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_PARENT_PORT], &datum);
8169 : 25610 : }
8170 : :
8171 : : /* Sets the "tag" column from the "Port_Binding" table in 'row' to
8172 : : * the 'tag' set with 'n_tag' entries.
8173 : : *
8174 : : * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
8175 : : * may be NULL.
8176 : : *
8177 : : * Argument constraints: in range 1 to 4,095
8178 : : *
8179 : : * The caller retains ownership of the arguments. */
8180 : : void
8181 : 25610 : sbrec_port_binding_set_tag(const struct sbrec_port_binding *row, const int64_t *tag, size_t n_tag)
8182 : : {
8183 : : struct ovsdb_datum datum;
8184 : : union ovsdb_atom key;
8185 : :
8186 [ - + ]: 25610 : ovs_assert(inited);
8187 [ + + ]: 25610 : if (n_tag) {
8188 : 211 : datum.n = 1;
8189 : 211 : datum.keys = &key;
8190 : 211 : key.integer = *tag;
8191 : : } else {
8192 : 25399 : datum.n = 0;
8193 : 25399 : datum.keys = NULL;
8194 : : }
8195 : 25610 : datum.values = NULL;
8196 : 25610 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TAG], &datum);
8197 : 25610 : }
8198 : :
8199 : : /* Sets the "tunnel_key" column from the "Port_Binding" table in 'row' to
8200 : : * 'tunnel_key'.
8201 : : *
8202 : : * Argument constraints: in range 1 to 32,767
8203 : : *
8204 : : * The caller retains ownership of the arguments. */
8205 : : void
8206 : 291 : sbrec_port_binding_set_tunnel_key(const struct sbrec_port_binding *row, int64_t tunnel_key)
8207 : : {
8208 : : struct ovsdb_datum datum;
8209 : : union ovsdb_atom key;
8210 : :
8211 [ - + ]: 291 : ovs_assert(inited);
8212 : 291 : datum.n = 1;
8213 : 291 : datum.keys = &key;
8214 : 291 : key.integer = tunnel_key;
8215 : 291 : datum.values = NULL;
8216 : 291 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TUNNEL_KEY], &datum);
8217 : 291 : }
8218 : :
8219 : : /* Sets the "type" column from the "Port_Binding" table in 'row' to
8220 : : * 'type'.
8221 : : *
8222 : : * The caller retains ownership of the arguments. */
8223 : : void
8224 : 25610 : sbrec_port_binding_set_type(const struct sbrec_port_binding *row, const char *type)
8225 : : {
8226 : : struct ovsdb_datum datum;
8227 : : union ovsdb_atom key;
8228 : :
8229 [ - + ]: 25610 : ovs_assert(inited);
8230 : 25610 : datum.n = 1;
8231 : 25610 : datum.keys = &key;
8232 : 25610 : key.string = CONST_CAST(char *, type);
8233 : 25610 : datum.values = NULL;
8234 : 25610 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TYPE], &datum);
8235 : 25610 : }
8236 : :
8237 : : /* Adds the value 'new_value' to the "chassis" set column from the "Port_Binding" table
8238 : : * in 'row'.
8239 : : *
8240 : : */
8241 : : void
8242 : 0 : sbrec_port_binding_update_chassis_addvalue(const struct sbrec_port_binding *row, const struct sbrec_chassis *new_value)
8243 : : {
8244 : : struct ovsdb_datum *datum;
8245 : :
8246 [ # # ]: 0 : ovs_assert(inited);
8247 : :
8248 : 0 : datum = xmalloc(sizeof *datum);
8249 : 0 : datum->n = 1;
8250 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8251 : 0 : datum->values = NULL;
8252 : :
8253 : 0 : datum->keys[0].uuid = new_value->header_.uuid;
8254 : :
8255 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
8256 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_CHASSIS],
8257 : : datum);
8258 : 0 : }
8259 : :
8260 : : /* Deletes the value 'delete_value' from the "chassis" set column from the
8261 : : * "Port_Binding" table in 'row'.
8262 : : *
8263 : : */
8264 : : void
8265 : 0 : sbrec_port_binding_update_chassis_delvalue(const struct sbrec_port_binding *row, const struct sbrec_chassis *delete_value)
8266 : : {
8267 : : struct ovsdb_datum *datum;
8268 : :
8269 [ # # ]: 0 : ovs_assert(inited);
8270 : :
8271 : 0 : datum = xmalloc(sizeof *datum);
8272 : 0 : datum->n = 1;
8273 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8274 : 0 : datum->values = NULL;
8275 : :
8276 : 0 : datum->keys[0].uuid = delete_value->header_.uuid;
8277 : :
8278 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
8279 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_CHASSIS],
8280 : : datum);
8281 : 0 : }
8282 : :
8283 : : /* Adds the value 'new_value' to the "mac" set column from the "Port_Binding" table
8284 : : * in 'row'.
8285 : : *
8286 : : */
8287 : : void
8288 : 0 : sbrec_port_binding_update_mac_addvalue(const struct sbrec_port_binding *row, const char *new_value)
8289 : : {
8290 : : struct ovsdb_datum *datum;
8291 : :
8292 [ # # ]: 0 : ovs_assert(inited);
8293 : :
8294 : 0 : datum = xmalloc(sizeof *datum);
8295 : 0 : datum->n = 1;
8296 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8297 : 0 : datum->values = NULL;
8298 : :
8299 : 0 : datum->keys[0].string = xstrdup(new_value);
8300 : :
8301 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
8302 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_MAC],
8303 : : datum);
8304 : 0 : }
8305 : :
8306 : : /* Deletes the value 'delete_value' from the "mac" set column from the
8307 : : * "Port_Binding" table in 'row'.
8308 : : *
8309 : : */
8310 : : void
8311 : 0 : sbrec_port_binding_update_mac_delvalue(const struct sbrec_port_binding *row, const char *delete_value)
8312 : : {
8313 : : struct ovsdb_datum *datum;
8314 : :
8315 [ # # ]: 0 : ovs_assert(inited);
8316 : :
8317 : 0 : datum = xmalloc(sizeof *datum);
8318 : 0 : datum->n = 1;
8319 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8320 : 0 : datum->values = NULL;
8321 : :
8322 : 0 : datum->keys[0].string = xstrdup(delete_value);
8323 : :
8324 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
8325 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_MAC],
8326 : : datum);
8327 : 0 : }
8328 : :
8329 : : /* Sets an element of the "options" map column from the "Port_Binding" table in 'row'
8330 : : * to 'new_value' given the key value 'new_key'.
8331 : : *
8332 : : */
8333 : : void
8334 : 0 : sbrec_port_binding_update_options_setkey(const struct sbrec_port_binding *row, const char *new_key, const char *new_value)
8335 : : {
8336 : : struct ovsdb_datum *datum;
8337 : :
8338 [ # # ]: 0 : ovs_assert(inited);
8339 : :
8340 : 0 : datum = xmalloc(sizeof *datum);
8341 : 0 : datum->n = 1;
8342 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
8343 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
8344 : :
8345 : 0 : datum->keys[0].string = xstrdup(new_key);
8346 : 0 : datum->values[0].string = xstrdup(new_value);
8347 : :
8348 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
8349 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_OPTIONS],
8350 : : datum);
8351 : 0 : }
8352 : :
8353 : : /* Deletes an element of the "options" map column from the "Port_Binding" table in 'row'
8354 : : * given the key value 'delete_key'.
8355 : : *
8356 : : */
8357 : : void
8358 : 0 : sbrec_port_binding_update_options_delkey(const struct sbrec_port_binding *row, const char *delete_key)
8359 : : {
8360 : : struct ovsdb_datum *datum;
8361 : :
8362 [ # # ]: 0 : ovs_assert(inited);
8363 : :
8364 : 0 : datum = xmalloc(sizeof *datum);
8365 : 0 : datum->n = 1;
8366 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
8367 : 0 : datum->values = NULL;
8368 : :
8369 : 0 : datum->keys[0].string = xstrdup(delete_key);
8370 : :
8371 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
8372 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_OPTIONS],
8373 : : datum);
8374 : 0 : }
8375 : :
8376 : : /* Adds the value 'new_value' to the "parent_port" set column from the "Port_Binding" table
8377 : : * in 'row'.
8378 : : *
8379 : : */
8380 : : void
8381 : 0 : sbrec_port_binding_update_parent_port_addvalue(const struct sbrec_port_binding *row, const char *new_value)
8382 : : {
8383 : : struct ovsdb_datum *datum;
8384 : :
8385 [ # # ]: 0 : ovs_assert(inited);
8386 : :
8387 : 0 : datum = xmalloc(sizeof *datum);
8388 : 0 : datum->n = 1;
8389 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8390 : 0 : datum->values = NULL;
8391 : :
8392 : 0 : datum->keys[0].string = xstrdup(new_value);
8393 : :
8394 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
8395 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_PARENT_PORT],
8396 : : datum);
8397 : 0 : }
8398 : :
8399 : : /* Deletes the value 'delete_value' from the "parent_port" set column from the
8400 : : * "Port_Binding" table in 'row'.
8401 : : *
8402 : : */
8403 : : void
8404 : 0 : sbrec_port_binding_update_parent_port_delvalue(const struct sbrec_port_binding *row, const char *delete_value)
8405 : : {
8406 : : struct ovsdb_datum *datum;
8407 : :
8408 [ # # ]: 0 : ovs_assert(inited);
8409 : :
8410 : 0 : datum = xmalloc(sizeof *datum);
8411 : 0 : datum->n = 1;
8412 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8413 : 0 : datum->values = NULL;
8414 : :
8415 : 0 : datum->keys[0].string = xstrdup(delete_value);
8416 : :
8417 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
8418 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_PARENT_PORT],
8419 : : datum);
8420 : 0 : }
8421 : :
8422 : : /* Adds the value 'new_value' to the "tag" set column from the "Port_Binding" table
8423 : : * in 'row'.
8424 : : *
8425 : : */
8426 : : void
8427 : 0 : sbrec_port_binding_update_tag_addvalue(const struct sbrec_port_binding *row, int64_t new_value)
8428 : : {
8429 : : struct ovsdb_datum *datum;
8430 : :
8431 [ # # ]: 0 : ovs_assert(inited);
8432 : :
8433 : 0 : datum = xmalloc(sizeof *datum);
8434 : 0 : datum->n = 1;
8435 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8436 : 0 : datum->values = NULL;
8437 : :
8438 : 0 : datum->keys[0].integer = new_value;
8439 : :
8440 : 0 : ovsdb_idl_txn_write_partial_set(&row->header_,
8441 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TAG],
8442 : : datum);
8443 : 0 : }
8444 : :
8445 : : /* Deletes the value 'delete_value' from the "tag" set column from the
8446 : : * "Port_Binding" table in 'row'.
8447 : : *
8448 : : */
8449 : : void
8450 : 0 : sbrec_port_binding_update_tag_delvalue(const struct sbrec_port_binding *row, int64_t delete_value)
8451 : : {
8452 : : struct ovsdb_datum *datum;
8453 : :
8454 [ # # ]: 0 : ovs_assert(inited);
8455 : :
8456 : 0 : datum = xmalloc(sizeof *datum);
8457 : 0 : datum->n = 1;
8458 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->values);
8459 : 0 : datum->values = NULL;
8460 : :
8461 : 0 : datum->keys[0].integer = delete_value;
8462 : :
8463 : 0 : ovsdb_idl_txn_delete_partial_set(&row->header_,
8464 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TAG],
8465 : : datum);
8466 : 0 : }
8467 : :
8468 : : /* Sets the "chassis" column from the "Port_Binding" table in 'row' to
8469 : : * the 'chassis' set.
8470 : : *
8471 : : * If "chassis" is null, the column will be the empty set,
8472 : : * otherwise it will contain the specified value.
8473 : : *
8474 : : * The caller retains ownership of the arguments. */
8475 : : void
8476 : 0 : sbrec_port_binding_add_clause_chassis(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *chassis)
8477 : : {
8478 : : struct ovsdb_datum datum;
8479 : : union ovsdb_atom key;
8480 : :
8481 [ # # ]: 0 : ovs_assert(inited);
8482 [ # # ]: 0 : if (chassis) {
8483 : 0 : datum.n = 1;
8484 : 0 : datum.keys = &key;
8485 : 0 : key.uuid = *chassis;
8486 : : } else {
8487 : 0 : datum.n = 0;
8488 : 0 : datum.keys = NULL;
8489 : : }
8490 : 0 : datum.values = NULL;
8491 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8492 : : function,
8493 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_CHASSIS],
8494 : : &datum);
8495 : 0 : }
8496 : :
8497 : : /* Sets the "datapath" column from the "Port_Binding" table in 'row' to
8498 : : * 'datapath'.
8499 : : *
8500 : : * The caller retains ownership of the arguments. */
8501 : : void
8502 : 0 : sbrec_port_binding_add_clause_datapath(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *datapath)
8503 : : {
8504 : : struct ovsdb_datum datum;
8505 : : union ovsdb_atom key;
8506 : :
8507 [ # # ]: 0 : ovs_assert(inited);
8508 : 0 : datum.n = 1;
8509 : 0 : datum.keys = &key;
8510 : 0 : key.uuid = *datapath;
8511 : 0 : datum.values = NULL;
8512 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8513 : : function,
8514 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_DATAPATH],
8515 : : &datum);
8516 : 0 : }
8517 : :
8518 : : /* Sets the "logical_port" column from the "Port_Binding" table in 'row' to
8519 : : * 'logical_port'.
8520 : : *
8521 : : * The caller retains ownership of the arguments. */
8522 : : void
8523 : 0 : sbrec_port_binding_add_clause_logical_port(struct ovsdb_idl *idl, enum ovsdb_function function, const char *logical_port)
8524 : : {
8525 : : struct ovsdb_datum datum;
8526 : : union ovsdb_atom key;
8527 : :
8528 [ # # ]: 0 : ovs_assert(inited);
8529 : 0 : datum.n = 1;
8530 : 0 : datum.keys = &key;
8531 : 0 : key.string = CONST_CAST(char *, logical_port);
8532 : 0 : datum.values = NULL;
8533 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8534 : : function,
8535 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_LOGICAL_PORT],
8536 : : &datum);
8537 : 0 : }
8538 : :
8539 : : /* Sets the "mac" column from the "Port_Binding" table in 'row' to
8540 : : * the 'mac' set with 'n_mac' entries.
8541 : : *
8542 : : * The caller retains ownership of the arguments. */
8543 : : void
8544 : 0 : sbrec_port_binding_add_clause_mac(struct ovsdb_idl *idl, enum ovsdb_function function, const char **mac, size_t n_mac)
8545 : : {
8546 : : struct ovsdb_datum datum;
8547 : : size_t i;
8548 : :
8549 [ # # ]: 0 : ovs_assert(inited);
8550 : 0 : datum.n = n_mac;
8551 [ # # ]: 0 : datum.keys = n_mac ? xmalloc(n_mac * sizeof *datum.keys) : NULL;
8552 : 0 : datum.values = NULL;
8553 [ # # ]: 0 : for (i = 0; i < n_mac; i++) {
8554 : 0 : datum.keys[i].string = CONST_CAST(char *, mac[i]);
8555 : : }
8556 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
8557 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8558 : : function,
8559 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_MAC],
8560 : : &datum);
8561 : 0 : free(datum.keys);
8562 : 0 : }
8563 : :
8564 : : /* Sets the "options" column's value from the "Port_Binding" table in 'row'
8565 : : * to 'options'.
8566 : : *
8567 : : * The caller retains ownership of 'options' and everything in it. */
8568 : : void
8569 : 0 : sbrec_port_binding_add_clause_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *options)
8570 : : {
8571 : : struct ovsdb_datum datum;
8572 : :
8573 [ # # ]: 0 : ovs_assert(inited);
8574 [ # # ]: 0 : if (options) {
8575 : : struct smap_node *node;
8576 : : size_t i;
8577 : :
8578 : 0 : datum.n = smap_count(options);
8579 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8580 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
8581 : :
8582 : 0 : i = 0;
8583 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
8584 : 0 : datum.keys[i].string = xstrdup(node->key);
8585 : 0 : datum.values[i].string = xstrdup(node->value);
8586 : 0 : i++;
8587 : : }
8588 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8589 : : } else {
8590 : 0 : ovsdb_datum_init_empty(&datum);
8591 : : }
8592 : :
8593 : 0 : ovsdb_idl_condition_add_clause(idl,
8594 : : &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8595 : : function,
8596 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_OPTIONS],
8597 : : &datum);
8598 : :
8599 : 0 : ovsdb_datum_destroy(&datum, &sbrec_port_binding_col_options.type);
8600 : 0 : }
8601 : :
8602 : :
8603 : : /* Sets the "parent_port" column from the "Port_Binding" table in 'row' to
8604 : : * the 'parent_port' set.
8605 : : *
8606 : : * If "parent_port" is null, the column will be the empty set,
8607 : : * otherwise it will contain the specified value.
8608 : : *
8609 : : * The caller retains ownership of the arguments. */
8610 : : void
8611 : 0 : sbrec_port_binding_add_clause_parent_port(struct ovsdb_idl *idl, enum ovsdb_function function, const char *parent_port)
8612 : : {
8613 : : struct ovsdb_datum datum;
8614 : : union ovsdb_atom key;
8615 : :
8616 [ # # ]: 0 : ovs_assert(inited);
8617 [ # # ]: 0 : if (parent_port) {
8618 : 0 : datum.n = 1;
8619 : 0 : datum.keys = &key;
8620 : 0 : key.string = CONST_CAST(char *, parent_port);
8621 : : } else {
8622 : 0 : datum.n = 0;
8623 : 0 : datum.keys = NULL;
8624 : : }
8625 : 0 : datum.values = NULL;
8626 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8627 : : function,
8628 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_PARENT_PORT],
8629 : : &datum);
8630 : 0 : }
8631 : :
8632 : : /* Sets the "tag" column from the "Port_Binding" table in 'row' to
8633 : : * the 'tag' set with 'n_tag' entries.
8634 : : *
8635 : : * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
8636 : : * may be NULL.
8637 : : *
8638 : : * Argument constraints: in range 1 to 4,095
8639 : : *
8640 : : * The caller retains ownership of the arguments. */
8641 : : void
8642 : 0 : sbrec_port_binding_add_clause_tag(struct ovsdb_idl *idl, enum ovsdb_function function, const int64_t *tag, size_t n_tag)
8643 : : {
8644 : : struct ovsdb_datum datum;
8645 : : union ovsdb_atom key;
8646 : :
8647 [ # # ]: 0 : ovs_assert(inited);
8648 [ # # ]: 0 : if (n_tag) {
8649 : 0 : datum.n = 1;
8650 : 0 : datum.keys = &key;
8651 : 0 : key.integer = *tag;
8652 : : } else {
8653 : 0 : datum.n = 0;
8654 : 0 : datum.keys = NULL;
8655 : : }
8656 : 0 : datum.values = NULL;
8657 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8658 : : function,
8659 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TAG],
8660 : : &datum);
8661 : 0 : }
8662 : :
8663 : : /* Sets the "tunnel_key" column from the "Port_Binding" table in 'row' to
8664 : : * 'tunnel_key'.
8665 : : *
8666 : : * Argument constraints: in range 1 to 32,767
8667 : : *
8668 : : * The caller retains ownership of the arguments. */
8669 : : void
8670 : 0 : sbrec_port_binding_add_clause_tunnel_key(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t tunnel_key)
8671 : : {
8672 : : struct ovsdb_datum datum;
8673 : : union ovsdb_atom key;
8674 : :
8675 [ # # ]: 0 : ovs_assert(inited);
8676 : 0 : datum.n = 1;
8677 : 0 : datum.keys = &key;
8678 : 0 : key.integer = tunnel_key;
8679 : 0 : datum.values = NULL;
8680 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8681 : : function,
8682 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TUNNEL_KEY],
8683 : : &datum);
8684 : 0 : }
8685 : :
8686 : : /* Sets the "type" column from the "Port_Binding" table in 'row' to
8687 : : * 'type'.
8688 : : *
8689 : : * The caller retains ownership of the arguments. */
8690 : : void
8691 : 0 : sbrec_port_binding_add_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
8692 : : {
8693 : : struct ovsdb_datum datum;
8694 : : union ovsdb_atom key;
8695 : :
8696 [ # # ]: 0 : ovs_assert(inited);
8697 : 0 : datum.n = 1;
8698 : 0 : datum.keys = &key;
8699 : 0 : key.string = CONST_CAST(char *, type);
8700 : 0 : datum.values = NULL;
8701 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8702 : : function,
8703 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TYPE],
8704 : : &datum);
8705 : 0 : }
8706 : : void
8707 : 0 : sbrec_port_binding_add_clause_false(struct ovsdb_idl *idl)
8708 : : {
8709 : : struct ovsdb_datum datum;
8710 : :
8711 : 0 : ovsdb_datum_init_empty(&datum);
8712 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING], OVSDB_F_FALSE, NULL, &datum);
8713 : 0 : }
8714 : : void
8715 : 0 : sbrec_port_binding_add_clause_true(struct ovsdb_idl *idl)
8716 : : {
8717 : : struct ovsdb_datum datum;
8718 : :
8719 : 0 : ovsdb_datum_init_empty(&datum);
8720 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING], OVSDB_F_TRUE, NULL, &datum);
8721 : 0 : }
8722 : :
8723 : : /* Sets the "chassis" column from the "Port_Binding" table in 'row' to
8724 : : * the 'chassis' set.
8725 : : *
8726 : : * If "chassis" is null, the column will be the empty set,
8727 : : * otherwise it will contain the specified value.
8728 : : *
8729 : : * The caller retains ownership of the arguments. */
8730 : : void
8731 : 0 : sbrec_port_binding_remove_clause_chassis(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *chassis)
8732 : : {
8733 : : struct ovsdb_datum datum;
8734 : : union ovsdb_atom key;
8735 : :
8736 [ # # ]: 0 : ovs_assert(inited);
8737 [ # # ]: 0 : if (chassis) {
8738 : 0 : datum.n = 1;
8739 : 0 : datum.keys = &key;
8740 : 0 : key.uuid = *chassis;
8741 : : } else {
8742 : 0 : datum.n = 0;
8743 : 0 : datum.keys = NULL;
8744 : : }
8745 : 0 : datum.values = NULL;
8746 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8747 : : function,
8748 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_CHASSIS],
8749 : : &datum);
8750 : 0 : }
8751 : :
8752 : : /* Sets the "datapath" column from the "Port_Binding" table in 'row' to
8753 : : * 'datapath'.
8754 : : *
8755 : : * The caller retains ownership of the arguments. */
8756 : : void
8757 : 0 : sbrec_port_binding_remove_clause_datapath(struct ovsdb_idl *idl, enum ovsdb_function function, const struct uuid *datapath)
8758 : : {
8759 : : struct ovsdb_datum datum;
8760 : : union ovsdb_atom key;
8761 : :
8762 [ # # ]: 0 : ovs_assert(inited);
8763 : 0 : datum.n = 1;
8764 : 0 : datum.keys = &key;
8765 : 0 : key.uuid = *datapath;
8766 : 0 : datum.values = NULL;
8767 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8768 : : function,
8769 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_DATAPATH],
8770 : : &datum);
8771 : 0 : }
8772 : :
8773 : : /* Sets the "logical_port" column from the "Port_Binding" table in 'row' to
8774 : : * 'logical_port'.
8775 : : *
8776 : : * The caller retains ownership of the arguments. */
8777 : : void
8778 : 0 : sbrec_port_binding_remove_clause_logical_port(struct ovsdb_idl *idl, enum ovsdb_function function, const char *logical_port)
8779 : : {
8780 : : struct ovsdb_datum datum;
8781 : : union ovsdb_atom key;
8782 : :
8783 [ # # ]: 0 : ovs_assert(inited);
8784 : 0 : datum.n = 1;
8785 : 0 : datum.keys = &key;
8786 : 0 : key.string = CONST_CAST(char *, logical_port);
8787 : 0 : datum.values = NULL;
8788 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8789 : : function,
8790 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_LOGICAL_PORT],
8791 : : &datum);
8792 : 0 : }
8793 : :
8794 : : /* Sets the "mac" column from the "Port_Binding" table in 'row' to
8795 : : * the 'mac' set with 'n_mac' entries.
8796 : : *
8797 : : * The caller retains ownership of the arguments. */
8798 : : void
8799 : 0 : sbrec_port_binding_remove_clause_mac(struct ovsdb_idl *idl, enum ovsdb_function function, const char **mac, size_t n_mac)
8800 : : {
8801 : : struct ovsdb_datum datum;
8802 : : size_t i;
8803 : :
8804 [ # # ]: 0 : ovs_assert(inited);
8805 : 0 : datum.n = n_mac;
8806 [ # # ]: 0 : datum.keys = n_mac ? xmalloc(n_mac * sizeof *datum.keys) : NULL;
8807 : 0 : datum.values = NULL;
8808 [ # # ]: 0 : for (i = 0; i < n_mac; i++) {
8809 : 0 : datum.keys[i].string = CONST_CAST(char *, mac[i]);
8810 : : }
8811 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
8812 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8813 : : function,
8814 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_MAC],
8815 : : &datum);
8816 : 0 : free(datum.keys);
8817 : 0 : }
8818 : :
8819 : : /* Sets the "options" column's value from the "Port_Binding" table in 'row'
8820 : : * to 'options'.
8821 : : *
8822 : : * The caller retains ownership of 'options' and everything in it. */
8823 : : void
8824 : 0 : sbrec_port_binding_remove_clause_options(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *options)
8825 : : {
8826 : : struct ovsdb_datum datum;
8827 : :
8828 [ # # ]: 0 : ovs_assert(inited);
8829 [ # # ]: 0 : if (options) {
8830 : : struct smap_node *node;
8831 : : size_t i;
8832 : :
8833 : 0 : datum.n = smap_count(options);
8834 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8835 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
8836 : :
8837 : 0 : i = 0;
8838 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, options) {
8839 : 0 : datum.keys[i].string = xstrdup(node->key);
8840 : 0 : datum.values[i].string = xstrdup(node->value);
8841 : 0 : i++;
8842 : : }
8843 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8844 : : } else {
8845 : 0 : ovsdb_datum_init_empty(&datum);
8846 : : }
8847 : :
8848 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8849 : : function,
8850 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_OPTIONS],
8851 : : &datum);
8852 : :
8853 : 0 : ovsdb_datum_destroy(&datum, &sbrec_port_binding_col_options.type);
8854 : 0 : }
8855 : :
8856 : :
8857 : : /* Sets the "parent_port" column from the "Port_Binding" table in 'row' to
8858 : : * the 'parent_port' set.
8859 : : *
8860 : : * If "parent_port" is null, the column will be the empty set,
8861 : : * otherwise it will contain the specified value.
8862 : : *
8863 : : * The caller retains ownership of the arguments. */
8864 : : void
8865 : 0 : sbrec_port_binding_remove_clause_parent_port(struct ovsdb_idl *idl, enum ovsdb_function function, const char *parent_port)
8866 : : {
8867 : : struct ovsdb_datum datum;
8868 : : union ovsdb_atom key;
8869 : :
8870 [ # # ]: 0 : ovs_assert(inited);
8871 [ # # ]: 0 : if (parent_port) {
8872 : 0 : datum.n = 1;
8873 : 0 : datum.keys = &key;
8874 : 0 : key.string = CONST_CAST(char *, parent_port);
8875 : : } else {
8876 : 0 : datum.n = 0;
8877 : 0 : datum.keys = NULL;
8878 : : }
8879 : 0 : datum.values = NULL;
8880 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8881 : : function,
8882 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_PARENT_PORT],
8883 : : &datum);
8884 : 0 : }
8885 : :
8886 : : /* Sets the "tag" column from the "Port_Binding" table in 'row' to
8887 : : * the 'tag' set with 'n_tag' entries.
8888 : : *
8889 : : * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
8890 : : * may be NULL.
8891 : : *
8892 : : * Argument constraints: in range 1 to 4,095
8893 : : *
8894 : : * The caller retains ownership of the arguments. */
8895 : : void
8896 : 0 : sbrec_port_binding_remove_clause_tag(struct ovsdb_idl *idl, enum ovsdb_function function, const int64_t *tag, size_t n_tag)
8897 : : {
8898 : : struct ovsdb_datum datum;
8899 : : union ovsdb_atom key;
8900 : :
8901 [ # # ]: 0 : ovs_assert(inited);
8902 [ # # ]: 0 : if (n_tag) {
8903 : 0 : datum.n = 1;
8904 : 0 : datum.keys = &key;
8905 : 0 : key.integer = *tag;
8906 : : } else {
8907 : 0 : datum.n = 0;
8908 : 0 : datum.keys = NULL;
8909 : : }
8910 : 0 : datum.values = NULL;
8911 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8912 : : function,
8913 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TAG],
8914 : : &datum);
8915 : 0 : }
8916 : :
8917 : : /* Sets the "tunnel_key" column from the "Port_Binding" table in 'row' to
8918 : : * 'tunnel_key'.
8919 : : *
8920 : : * Argument constraints: in range 1 to 32,767
8921 : : *
8922 : : * The caller retains ownership of the arguments. */
8923 : : void
8924 : 0 : sbrec_port_binding_remove_clause_tunnel_key(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t tunnel_key)
8925 : : {
8926 : : struct ovsdb_datum datum;
8927 : : union ovsdb_atom key;
8928 : :
8929 [ # # ]: 0 : ovs_assert(inited);
8930 : 0 : datum.n = 1;
8931 : 0 : datum.keys = &key;
8932 : 0 : key.integer = tunnel_key;
8933 : 0 : datum.values = NULL;
8934 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8935 : : function,
8936 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TUNNEL_KEY],
8937 : : &datum);
8938 : 0 : }
8939 : :
8940 : : /* Sets the "type" column from the "Port_Binding" table in 'row' to
8941 : : * 'type'.
8942 : : *
8943 : : * The caller retains ownership of the arguments. */
8944 : : void
8945 : 0 : sbrec_port_binding_remove_clause_type(struct ovsdb_idl *idl, enum ovsdb_function function, const char *type)
8946 : : {
8947 : : struct ovsdb_datum datum;
8948 : : union ovsdb_atom key;
8949 : :
8950 [ # # ]: 0 : ovs_assert(inited);
8951 : 0 : datum.n = 1;
8952 : 0 : datum.keys = &key;
8953 : 0 : key.string = CONST_CAST(char *, type);
8954 : 0 : datum.values = NULL;
8955 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING],
8956 : : function,
8957 : : &sbrec_port_binding_columns[SBREC_PORT_BINDING_COL_TYPE],
8958 : : &datum);
8959 : 0 : }
8960 : : void
8961 : 0 : sbrec_port_binding_remove_clause_false(struct ovsdb_idl *idl)
8962 : : {
8963 : : struct ovsdb_datum datum;
8964 : :
8965 : 0 : ovsdb_datum_init_empty(&datum);
8966 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING], OVSDB_F_FALSE, NULL, &datum);
8967 : 0 : }
8968 : : void
8969 : 0 : sbrec_port_binding_remove_clause_true(struct ovsdb_idl *idl)
8970 : : {
8971 : : struct ovsdb_datum datum;
8972 : :
8973 : 0 : ovsdb_datum_init_empty(&datum);
8974 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_PORT_BINDING], OVSDB_F_TRUE, NULL, &datum);
8975 : 0 : }
8976 : :
8977 : : struct ovsdb_idl_column sbrec_port_binding_columns[SBREC_PORT_BINDING_N_COLUMNS];
8978 : :
8979 : : static void
8980 : 272 : sbrec_port_binding_columns_init(void)
8981 : : {
8982 : : struct ovsdb_idl_column *c;
8983 : :
8984 : : /* Initialize sbrec_port_binding_col_chassis. */
8985 : 272 : c = &sbrec_port_binding_col_chassis;
8986 : 272 : c->name = "chassis";
8987 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
8988 : 272 : c->type.key.u.uuid.refTableName = "Chassis";
8989 : 272 : c->type.key.u.uuid.refType = OVSDB_REF_WEAK;
8990 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8991 : 272 : c->type.n_min = 0;
8992 : 272 : c->type.n_max = 1;
8993 : 272 : c->mutable = true;
8994 : 272 : c->parse = sbrec_port_binding_parse_chassis;
8995 : 272 : c->unparse = sbrec_port_binding_unparse_chassis;
8996 : :
8997 : : /* Initialize sbrec_port_binding_col_datapath. */
8998 : 272 : c = &sbrec_port_binding_col_datapath;
8999 : 272 : c->name = "datapath";
9000 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
9001 : 272 : c->type.key.u.uuid.refTableName = "Datapath_Binding";
9002 : 272 : c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
9003 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9004 : 272 : c->type.n_min = 1;
9005 : 272 : c->type.n_max = 1;
9006 : 272 : c->mutable = true;
9007 : 272 : c->parse = sbrec_port_binding_parse_datapath;
9008 : 272 : c->unparse = sbrec_port_binding_unparse_datapath;
9009 : :
9010 : : /* Initialize sbrec_port_binding_col_logical_port. */
9011 : 272 : c = &sbrec_port_binding_col_logical_port;
9012 : 272 : c->name = "logical_port";
9013 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9014 : 272 : c->type.key.u.string.minLen = 0;
9015 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9016 : 272 : c->type.n_min = 1;
9017 : 272 : c->type.n_max = 1;
9018 : 272 : c->mutable = true;
9019 : 272 : c->parse = sbrec_port_binding_parse_logical_port;
9020 : 272 : c->unparse = sbrec_port_binding_unparse_logical_port;
9021 : :
9022 : : /* Initialize sbrec_port_binding_col_mac. */
9023 : 272 : c = &sbrec_port_binding_col_mac;
9024 : 272 : c->name = "mac";
9025 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9026 : 272 : c->type.key.u.string.minLen = 0;
9027 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9028 : 272 : c->type.n_min = 0;
9029 : 272 : c->type.n_max = UINT_MAX;
9030 : 272 : c->mutable = true;
9031 : 272 : c->parse = sbrec_port_binding_parse_mac;
9032 : 272 : c->unparse = sbrec_port_binding_unparse_mac;
9033 : :
9034 : : /* Initialize sbrec_port_binding_col_options. */
9035 : 272 : c = &sbrec_port_binding_col_options;
9036 : 272 : c->name = "options";
9037 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9038 : 272 : c->type.key.u.string.minLen = 0;
9039 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
9040 : 272 : c->type.value.u.string.minLen = 0;
9041 : 272 : c->type.n_min = 0;
9042 : 272 : c->type.n_max = UINT_MAX;
9043 : 272 : c->mutable = true;
9044 : 272 : c->parse = sbrec_port_binding_parse_options;
9045 : 272 : c->unparse = sbrec_port_binding_unparse_options;
9046 : :
9047 : : /* Initialize sbrec_port_binding_col_parent_port. */
9048 : 272 : c = &sbrec_port_binding_col_parent_port;
9049 : 272 : c->name = "parent_port";
9050 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9051 : 272 : c->type.key.u.string.minLen = 0;
9052 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9053 : 272 : c->type.n_min = 0;
9054 : 272 : c->type.n_max = 1;
9055 : 272 : c->mutable = true;
9056 : 272 : c->parse = sbrec_port_binding_parse_parent_port;
9057 : 272 : c->unparse = sbrec_port_binding_unparse_parent_port;
9058 : :
9059 : : /* Initialize sbrec_port_binding_col_tag. */
9060 : 272 : c = &sbrec_port_binding_col_tag;
9061 : 272 : c->name = "tag";
9062 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
9063 : 272 : c->type.key.u.integer.min = INT64_C(1);
9064 : 272 : c->type.key.u.integer.max = INT64_C(4095);
9065 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9066 : 272 : c->type.n_min = 0;
9067 : 272 : c->type.n_max = 1;
9068 : 272 : c->mutable = true;
9069 : 272 : c->parse = sbrec_port_binding_parse_tag;
9070 : 272 : c->unparse = sbrec_port_binding_unparse_tag;
9071 : :
9072 : : /* Initialize sbrec_port_binding_col_tunnel_key. */
9073 : 272 : c = &sbrec_port_binding_col_tunnel_key;
9074 : 272 : c->name = "tunnel_key";
9075 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
9076 : 272 : c->type.key.u.integer.min = INT64_C(1);
9077 : 272 : c->type.key.u.integer.max = INT64_C(32767);
9078 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9079 : 272 : c->type.n_min = 1;
9080 : 272 : c->type.n_max = 1;
9081 : 272 : c->mutable = true;
9082 : 272 : c->parse = sbrec_port_binding_parse_tunnel_key;
9083 : 272 : c->unparse = sbrec_port_binding_unparse_tunnel_key;
9084 : :
9085 : : /* Initialize sbrec_port_binding_col_type. */
9086 : 272 : c = &sbrec_port_binding_col_type;
9087 : 272 : c->name = "type";
9088 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9089 : 272 : c->type.key.u.string.minLen = 0;
9090 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9091 : 272 : c->type.n_min = 1;
9092 : 272 : c->type.n_max = 1;
9093 : 272 : c->mutable = true;
9094 : 272 : c->parse = sbrec_port_binding_parse_type;
9095 : 272 : c->unparse = sbrec_port_binding_unparse_type;
9096 : 272 : }
9097 : :
9098 : : /* SB_Global table. */
9099 : :
9100 : : static void
9101 : 287 : sbrec_sb_global_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9102 : : {
9103 : 287 : struct sbrec_sb_global *row = sbrec_sb_global_cast(row_);
9104 : : size_t i;
9105 : :
9106 [ - + ]: 287 : ovs_assert(inited);
9107 : 287 : smap_init(&row->external_ids);
9108 [ - + ]: 287 : for (i = 0; i < datum->n; i++) {
9109 : 0 : smap_add(&row->external_ids,
9110 : 0 : datum->keys[i].string,
9111 : 0 : datum->values[i].string);
9112 : : }
9113 : 287 : }
9114 : :
9115 : : static void
9116 : 295 : sbrec_sb_global_parse_nb_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9117 : : {
9118 : 295 : struct sbrec_sb_global *row = sbrec_sb_global_cast(row_);
9119 : :
9120 [ - + ]: 295 : ovs_assert(inited);
9121 [ + - ]: 295 : if (datum->n >= 1) {
9122 : 295 : row->nb_cfg = datum->keys[0].integer;
9123 : : } else {
9124 : 0 : row->nb_cfg = 0;
9125 : : }
9126 : 295 : }
9127 : :
9128 : : static void
9129 : 331 : sbrec_sb_global_unparse_external_ids(struct ovsdb_idl_row *row_)
9130 : : {
9131 : 331 : struct sbrec_sb_global *row = sbrec_sb_global_cast(row_);
9132 : :
9133 [ - + ]: 331 : ovs_assert(inited);
9134 : 331 : smap_destroy(&row->external_ids);
9135 : 331 : }
9136 : :
9137 : : static void
9138 : 339 : sbrec_sb_global_unparse_nb_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
9139 : : {
9140 : : /* Nothing to do. */
9141 : 339 : }
9142 : :
9143 : : static void
9144 : 315 : sbrec_sb_global_init__(struct ovsdb_idl_row *row)
9145 : : {
9146 : 315 : sbrec_sb_global_init(sbrec_sb_global_cast(row));
9147 : 315 : }
9148 : :
9149 : : /* Clears the contents of 'row' in table "SB_Global". */
9150 : : void
9151 : 315 : sbrec_sb_global_init(struct sbrec_sb_global *row)
9152 : : {
9153 : 315 : memset(row, 0, sizeof *row);
9154 : 315 : smap_init(&row->external_ids);
9155 : 315 : }
9156 : :
9157 : : /* Searches table "SB_Global" in 'idl' for a row with UUID 'uuid'. Returns
9158 : : * a pointer to the row if there is one, otherwise a null pointer. */
9159 : : const struct sbrec_sb_global *
9160 : 0 : sbrec_sb_global_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
9161 : : {
9162 : 0 : return sbrec_sb_global_cast(ovsdb_idl_get_row_for_uuid(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL], uuid));
9163 : : }
9164 : :
9165 : : /* Returns a row in table "SB_Global" in 'idl', or a null pointer if that
9166 : : * table is empty.
9167 : : *
9168 : : * Database tables are internally maintained as hash tables, so adding or
9169 : : * removing rows while traversing the same table can cause some rows to be
9170 : : * visited twice or not at apply. */
9171 : : const struct sbrec_sb_global *
9172 : 5592 : sbrec_sb_global_first(const struct ovsdb_idl *idl)
9173 : : {
9174 : 5592 : return sbrec_sb_global_cast(ovsdb_idl_first_row(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL]));
9175 : : }
9176 : :
9177 : : /* Returns a row following 'row' within its table, or a null pointer if 'row'
9178 : : * is the last row in its table. */
9179 : : const struct sbrec_sb_global *
9180 : 0 : sbrec_sb_global_next(const struct sbrec_sb_global *row)
9181 : : {
9182 : 0 : return sbrec_sb_global_cast(ovsdb_idl_next_row(&row->header_));
9183 : : }
9184 : :
9185 : 0 : unsigned int sbrec_sb_global_get_seqno(const struct ovsdb_idl *idl)
9186 : : {
9187 : 0 : return ovsdb_idl_table_get_seqno(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL]);
9188 : : }
9189 : :
9190 : 0 : unsigned int sbrec_sb_global_row_get_seqno(const struct sbrec_sb_global *row, enum ovsdb_idl_change change)
9191 : : {
9192 : 0 : return ovsdb_idl_row_get_seqno(&row->header_, change);
9193 : : }
9194 : :
9195 : : const struct sbrec_sb_global *
9196 : 0 : sbrec_sb_global_track_get_first(const struct ovsdb_idl *idl)
9197 : : {
9198 : 0 : return sbrec_sb_global_cast(ovsdb_idl_track_get_first(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL]));
9199 : : }
9200 : :
9201 : : const struct sbrec_sb_global
9202 : 0 : *sbrec_sb_global_track_get_next(const struct sbrec_sb_global *row)
9203 : : {
9204 : 0 : return sbrec_sb_global_cast(ovsdb_idl_track_get_next(&row->header_));
9205 : : }
9206 : :
9207 : :
9208 : : /* Deletes 'row' from table "SB_Global". 'row' may be freed, so it must not be
9209 : : * accessed afterward.
9210 : : *
9211 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9212 : : void
9213 : 0 : sbrec_sb_global_delete(const struct sbrec_sb_global *row)
9214 : : {
9215 : 0 : ovsdb_idl_txn_delete(&row->header_);
9216 : 0 : }
9217 : :
9218 : : /* Inserts and returns a new row in the table "SB_Global" in the database
9219 : : * with open transaction 'txn'.
9220 : : *
9221 : : * The new row is assigned a randomly generated provisional UUID.
9222 : : * ovsdb-server will assign a different UUID when 'txn' is committed,
9223 : : * but the IDL will replace any uses of the provisional UUID in the
9224 : : * data to be to be committed by the UUID assigned by ovsdb-server. */
9225 : : struct sbrec_sb_global *
9226 : 44 : sbrec_sb_global_insert(struct ovsdb_idl_txn *txn)
9227 : : {
9228 : 44 : return sbrec_sb_global_cast(ovsdb_idl_txn_insert(txn, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL], NULL));
9229 : : }
9230 : :
9231 : : bool
9232 : 0 : sbrec_sb_global_is_updated(const struct sbrec_sb_global *row, enum sbrec_sb_global_column_id column)
9233 : : {
9234 : 0 : return ovsdb_idl_track_is_updated(&row->header_, &sbrec_sb_global_columns[column]);
9235 : : }
9236 : :
9237 : : /* Causes the original contents of column "external_ids" in 'row' to be
9238 : : * verified as a prerequisite to completing the transaction. That is, if
9239 : : * "external_ids" in 'row' changed (or if 'row' was deleted) between the
9240 : : * time that the IDL originally read its contents and the time that the
9241 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9242 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9243 : : * change has already been received).
9244 : : *
9245 : : * The intention is that, to ensure that no transaction commits based on dirty
9246 : : * reads, an application should call this function any time "external_ids" is
9247 : : * read as part of a read-modify-write operation.
9248 : : *
9249 : : * In some cases this function reduces to a no-op, because the current value
9250 : : * of "external_ids" is already known:
9251 : : *
9252 : : * - If 'row' is a row created by the current transaction (returned by
9253 : : * sbrec_sb_global_insert()).
9254 : : *
9255 : : * - If "external_ids" has already been modified (with
9256 : : * sbrec_sb_global_set_external_ids()) within the current transaction.
9257 : : *
9258 : : * Because of the latter property, always call this function *before*
9259 : : * sbrec_sb_global_set_external_ids() for a given read-modify-write.
9260 : : *
9261 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9262 : : void
9263 : 0 : sbrec_sb_global_verify_external_ids(const struct sbrec_sb_global *row)
9264 : : {
9265 [ # # ]: 0 : ovs_assert(inited);
9266 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_sb_global_columns[SBREC_SB_GLOBAL_COL_EXTERNAL_IDS]);
9267 : 0 : }
9268 : :
9269 : : /* Causes the original contents of column "nb_cfg" in 'row' to be
9270 : : * verified as a prerequisite to completing the transaction. That is, if
9271 : : * "nb_cfg" in 'row' changed (or if 'row' was deleted) between the
9272 : : * time that the IDL originally read its contents and the time that the
9273 : : * transaction commits, then the transaction aborts and ovsdb_idl_txn_commit()
9274 : : * returns TXN_AGAIN_WAIT or TXN_AGAIN_NOW (depending on whether the database
9275 : : * change has already been received).
9276 : : *
9277 : : * The intention is that, to ensure that no transaction commits based on dirty
9278 : : * reads, an application should call this function any time "nb_cfg" is
9279 : : * read as part of a read-modify-write operation.
9280 : : *
9281 : : * In some cases this function reduces to a no-op, because the current value
9282 : : * of "nb_cfg" is already known:
9283 : : *
9284 : : * - If 'row' is a row created by the current transaction (returned by
9285 : : * sbrec_sb_global_insert()).
9286 : : *
9287 : : * - If "nb_cfg" has already been modified (with
9288 : : * sbrec_sb_global_set_nb_cfg()) within the current transaction.
9289 : : *
9290 : : * Because of the latter property, always call this function *before*
9291 : : * sbrec_sb_global_set_nb_cfg() for a given read-modify-write.
9292 : : *
9293 : : * The caller must have started a transaction with ovsdb_idl_txn_create(). */
9294 : : void
9295 : 0 : sbrec_sb_global_verify_nb_cfg(const struct sbrec_sb_global *row)
9296 : : {
9297 [ # # ]: 0 : ovs_assert(inited);
9298 : 0 : ovsdb_idl_txn_verify(&row->header_, &sbrec_sb_global_columns[SBREC_SB_GLOBAL_COL_NB_CFG]);
9299 : 0 : }
9300 : :
9301 : : /* Returns the "external_ids" column's value from the "SB_Global" table in 'row'
9302 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
9303 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
9304 : : * for a given key than implementing the same operation on the "cooked"
9305 : : * form in 'row'.
9306 : : *
9307 : : * 'key_type' must be OVSDB_TYPE_STRING.
9308 : : * 'value_type' must be OVSDB_TYPE_STRING.
9309 : : * (This helps to avoid silent bugs if someone changes external_ids's
9310 : : * type without updating the caller.)
9311 : : *
9312 : : * The caller must not modify or free the returned value.
9313 : : *
9314 : : * Various kinds of changes can invalidate the returned value: modifying
9315 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9316 : : * If the returned value is needed for a long time, it is best to make a copy
9317 : : * of it with ovsdb_datum_clone().
9318 : : *
9319 : : * This function is rarely useful, since it is easier to access the value
9320 : : * directly through the "external_ids" member in sbrec_sb_global. */
9321 : : const struct ovsdb_datum *
9322 : 0 : sbrec_sb_global_get_external_ids(const struct sbrec_sb_global *row,
9323 : : enum ovsdb_atomic_type key_type OVS_UNUSED,
9324 : : enum ovsdb_atomic_type value_type OVS_UNUSED)
9325 : : {
9326 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_STRING);
9327 [ # # ]: 0 : ovs_assert(value_type == OVSDB_TYPE_STRING);
9328 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_sb_global_col_external_ids);
9329 : : }
9330 : :
9331 : : /* Returns the "nb_cfg" column's value from the "SB_Global" table in 'row'
9332 : : * as a struct ovsdb_datum. This is useful occasionally: for example,
9333 : : * ovsdb_datum_find_key() is an easier and more efficient way to search
9334 : : * for a given key than implementing the same operation on the "cooked"
9335 : : * form in 'row'.
9336 : : *
9337 : : * 'key_type' must be OVSDB_TYPE_INTEGER.
9338 : : * (This helps to avoid silent bugs if someone changes nb_cfg's
9339 : : * type without updating the caller.)
9340 : : *
9341 : : * The caller must not modify or free the returned value.
9342 : : *
9343 : : * Various kinds of changes can invalidate the returned value: modifying
9344 : : * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9345 : : * If the returned value is needed for a long time, it is best to make a copy
9346 : : * of it with ovsdb_datum_clone().
9347 : : *
9348 : : * This function is rarely useful, since it is easier to access the value
9349 : : * directly through the "nb_cfg" member in sbrec_sb_global. */
9350 : : const struct ovsdb_datum *
9351 : 0 : sbrec_sb_global_get_nb_cfg(const struct sbrec_sb_global *row,
9352 : : enum ovsdb_atomic_type key_type OVS_UNUSED)
9353 : : {
9354 [ # # ]: 0 : ovs_assert(key_type == OVSDB_TYPE_INTEGER);
9355 : 0 : return ovsdb_idl_read(&row->header_, &sbrec_sb_global_col_nb_cfg);
9356 : : }
9357 : :
9358 : : /* Sets the "external_ids" column's value from the "SB_Global" table in 'row'
9359 : : * to 'external_ids'.
9360 : : *
9361 : : * The caller retains ownership of 'external_ids' and everything in it. */
9362 : : void
9363 : 0 : sbrec_sb_global_set_external_ids(const struct sbrec_sb_global *row, const struct smap *external_ids)
9364 : : {
9365 : : struct ovsdb_datum datum;
9366 : :
9367 [ # # ]: 0 : ovs_assert(inited);
9368 [ # # ]: 0 : if (external_ids) {
9369 : : struct smap_node *node;
9370 : : size_t i;
9371 : :
9372 : 0 : datum.n = smap_count(external_ids);
9373 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
9374 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
9375 : :
9376 : 0 : i = 0;
9377 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
9378 : 0 : datum.keys[i].string = xstrdup(node->key);
9379 : 0 : datum.values[i].string = xstrdup(node->value);
9380 : 0 : i++;
9381 : : }
9382 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
9383 : : } else {
9384 : 0 : ovsdb_datum_init_empty(&datum);
9385 : : }
9386 : 0 : ovsdb_idl_txn_write(&row->header_,
9387 : : &sbrec_sb_global_columns[SBREC_SB_GLOBAL_COL_EXTERNAL_IDS],
9388 : : &datum);
9389 : 0 : }
9390 : :
9391 : :
9392 : : /* Sets the "nb_cfg" column from the "SB_Global" table in 'row' to
9393 : : * 'nb_cfg'.
9394 : : *
9395 : : * The caller retains ownership of the arguments. */
9396 : : void
9397 : 2185 : sbrec_sb_global_set_nb_cfg(const struct sbrec_sb_global *row, int64_t nb_cfg)
9398 : : {
9399 : : struct ovsdb_datum datum;
9400 : : union ovsdb_atom key;
9401 : :
9402 [ - + ]: 2185 : ovs_assert(inited);
9403 : 2185 : datum.n = 1;
9404 : 2185 : datum.keys = &key;
9405 : 2185 : key.integer = nb_cfg;
9406 : 2185 : datum.values = NULL;
9407 : 2185 : ovsdb_idl_txn_write_clone(&row->header_, &sbrec_sb_global_columns[SBREC_SB_GLOBAL_COL_NB_CFG], &datum);
9408 : 2185 : }
9409 : :
9410 : : /* Sets an element of the "external_ids" map column from the "SB_Global" table in 'row'
9411 : : * to 'new_value' given the key value 'new_key'.
9412 : : *
9413 : : */
9414 : : void
9415 : 0 : sbrec_sb_global_update_external_ids_setkey(const struct sbrec_sb_global *row, const char *new_key, const char *new_value)
9416 : : {
9417 : : struct ovsdb_datum *datum;
9418 : :
9419 [ # # ]: 0 : ovs_assert(inited);
9420 : :
9421 : 0 : datum = xmalloc(sizeof *datum);
9422 : 0 : datum->n = 1;
9423 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
9424 : 0 : datum->values = xmalloc(datum->n * sizeof *datum->values);
9425 : :
9426 : 0 : datum->keys[0].string = xstrdup(new_key);
9427 : 0 : datum->values[0].string = xstrdup(new_value);
9428 : :
9429 : 0 : ovsdb_idl_txn_write_partial_map(&row->header_,
9430 : : &sbrec_sb_global_columns[SBREC_SB_GLOBAL_COL_EXTERNAL_IDS],
9431 : : datum);
9432 : 0 : }
9433 : :
9434 : : /* Deletes an element of the "external_ids" map column from the "SB_Global" table in 'row'
9435 : : * given the key value 'delete_key'.
9436 : : *
9437 : : */
9438 : : void
9439 : 0 : sbrec_sb_global_update_external_ids_delkey(const struct sbrec_sb_global *row, const char *delete_key)
9440 : : {
9441 : : struct ovsdb_datum *datum;
9442 : :
9443 [ # # ]: 0 : ovs_assert(inited);
9444 : :
9445 : 0 : datum = xmalloc(sizeof *datum);
9446 : 0 : datum->n = 1;
9447 : 0 : datum->keys = xmalloc(datum->n * sizeof *datum->keys);
9448 : 0 : datum->values = NULL;
9449 : :
9450 : 0 : datum->keys[0].string = xstrdup(delete_key);
9451 : :
9452 : 0 : ovsdb_idl_txn_delete_partial_map(&row->header_,
9453 : : &sbrec_sb_global_columns[SBREC_SB_GLOBAL_COL_EXTERNAL_IDS],
9454 : : datum);
9455 : 0 : }
9456 : :
9457 : : /* Sets the "external_ids" column's value from the "SB_Global" table in 'row'
9458 : : * to 'external_ids'.
9459 : : *
9460 : : * The caller retains ownership of 'external_ids' and everything in it. */
9461 : : void
9462 : 0 : sbrec_sb_global_add_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
9463 : : {
9464 : : struct ovsdb_datum datum;
9465 : :
9466 [ # # ]: 0 : ovs_assert(inited);
9467 [ # # ]: 0 : if (external_ids) {
9468 : : struct smap_node *node;
9469 : : size_t i;
9470 : :
9471 : 0 : datum.n = smap_count(external_ids);
9472 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
9473 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
9474 : :
9475 : 0 : i = 0;
9476 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
9477 : 0 : datum.keys[i].string = xstrdup(node->key);
9478 : 0 : datum.values[i].string = xstrdup(node->value);
9479 : 0 : i++;
9480 : : }
9481 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
9482 : : } else {
9483 : 0 : ovsdb_datum_init_empty(&datum);
9484 : : }
9485 : :
9486 : 0 : ovsdb_idl_condition_add_clause(idl,
9487 : : &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL],
9488 : : function,
9489 : : &sbrec_sb_global_columns[SBREC_SB_GLOBAL_COL_EXTERNAL_IDS],
9490 : : &datum);
9491 : :
9492 : 0 : ovsdb_datum_destroy(&datum, &sbrec_sb_global_col_external_ids.type);
9493 : 0 : }
9494 : :
9495 : :
9496 : : /* Sets the "nb_cfg" column from the "SB_Global" table in 'row' to
9497 : : * 'nb_cfg'.
9498 : : *
9499 : : * The caller retains ownership of the arguments. */
9500 : : void
9501 : 0 : sbrec_sb_global_add_clause_nb_cfg(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t nb_cfg)
9502 : : {
9503 : : struct ovsdb_datum datum;
9504 : : union ovsdb_atom key;
9505 : :
9506 [ # # ]: 0 : ovs_assert(inited);
9507 : 0 : datum.n = 1;
9508 : 0 : datum.keys = &key;
9509 : 0 : key.integer = nb_cfg;
9510 : 0 : datum.values = NULL;
9511 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL],
9512 : : function,
9513 : : &sbrec_sb_global_columns[SBREC_SB_GLOBAL_COL_NB_CFG],
9514 : : &datum);
9515 : 0 : }
9516 : : void
9517 : 0 : sbrec_sb_global_add_clause_false(struct ovsdb_idl *idl)
9518 : : {
9519 : : struct ovsdb_datum datum;
9520 : :
9521 : 0 : ovsdb_datum_init_empty(&datum);
9522 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL], OVSDB_F_FALSE, NULL, &datum);
9523 : 0 : }
9524 : : void
9525 : 0 : sbrec_sb_global_add_clause_true(struct ovsdb_idl *idl)
9526 : : {
9527 : : struct ovsdb_datum datum;
9528 : :
9529 : 0 : ovsdb_datum_init_empty(&datum);
9530 : 0 : ovsdb_idl_condition_add_clause(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL], OVSDB_F_TRUE, NULL, &datum);
9531 : 0 : }
9532 : :
9533 : : /* Sets the "external_ids" column's value from the "SB_Global" table in 'row'
9534 : : * to 'external_ids'.
9535 : : *
9536 : : * The caller retains ownership of 'external_ids' and everything in it. */
9537 : : void
9538 : 0 : sbrec_sb_global_remove_clause_external_ids(struct ovsdb_idl *idl, enum ovsdb_function function, const struct smap *external_ids)
9539 : : {
9540 : : struct ovsdb_datum datum;
9541 : :
9542 [ # # ]: 0 : ovs_assert(inited);
9543 [ # # ]: 0 : if (external_ids) {
9544 : : struct smap_node *node;
9545 : : size_t i;
9546 : :
9547 : 0 : datum.n = smap_count(external_ids);
9548 : 0 : datum.keys = xmalloc(datum.n * sizeof *datum.keys);
9549 : 0 : datum.values = xmalloc(datum.n * sizeof *datum.values);
9550 : :
9551 : 0 : i = 0;
9552 [ # # ][ # # ]: 0 : SMAP_FOR_EACH (node, external_ids) {
9553 : 0 : datum.keys[i].string = xstrdup(node->key);
9554 : 0 : datum.values[i].string = xstrdup(node->value);
9555 : 0 : i++;
9556 : : }
9557 : 0 : ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
9558 : : } else {
9559 : 0 : ovsdb_datum_init_empty(&datum);
9560 : : }
9561 : :
9562 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL],
9563 : : function,
9564 : : &sbrec_sb_global_columns[SBREC_SB_GLOBAL_COL_EXTERNAL_IDS],
9565 : : &datum);
9566 : :
9567 : 0 : ovsdb_datum_destroy(&datum, &sbrec_sb_global_col_external_ids.type);
9568 : 0 : }
9569 : :
9570 : :
9571 : : /* Sets the "nb_cfg" column from the "SB_Global" table in 'row' to
9572 : : * 'nb_cfg'.
9573 : : *
9574 : : * The caller retains ownership of the arguments. */
9575 : : void
9576 : 0 : sbrec_sb_global_remove_clause_nb_cfg(struct ovsdb_idl *idl, enum ovsdb_function function, int64_t nb_cfg)
9577 : : {
9578 : : struct ovsdb_datum datum;
9579 : : union ovsdb_atom key;
9580 : :
9581 [ # # ]: 0 : ovs_assert(inited);
9582 : 0 : datum.n = 1;
9583 : 0 : datum.keys = &key;
9584 : 0 : key.integer = nb_cfg;
9585 : 0 : datum.values = NULL;
9586 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL],
9587 : : function,
9588 : : &sbrec_sb_global_columns[SBREC_SB_GLOBAL_COL_NB_CFG],
9589 : : &datum);
9590 : 0 : }
9591 : : void
9592 : 0 : sbrec_sb_global_remove_clause_false(struct ovsdb_idl *idl)
9593 : : {
9594 : : struct ovsdb_datum datum;
9595 : :
9596 : 0 : ovsdb_datum_init_empty(&datum);
9597 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL], OVSDB_F_FALSE, NULL, &datum);
9598 : 0 : }
9599 : : void
9600 : 0 : sbrec_sb_global_remove_clause_true(struct ovsdb_idl *idl)
9601 : : {
9602 : : struct ovsdb_datum datum;
9603 : :
9604 : 0 : ovsdb_datum_init_empty(&datum);
9605 : 0 : ovsdb_idl_condition_remove_clause(idl, &sbrec_table_classes[SBREC_TABLE_SB_GLOBAL], OVSDB_F_TRUE, NULL, &datum);
9606 : 0 : }
9607 : :
9608 : : struct ovsdb_idl_column sbrec_sb_global_columns[SBREC_SB_GLOBAL_N_COLUMNS];
9609 : :
9610 : : static void
9611 : 272 : sbrec_sb_global_columns_init(void)
9612 : : {
9613 : : struct ovsdb_idl_column *c;
9614 : :
9615 : : /* Initialize sbrec_sb_global_col_external_ids. */
9616 : 272 : c = &sbrec_sb_global_col_external_ids;
9617 : 272 : c->name = "external_ids";
9618 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9619 : 272 : c->type.key.u.string.minLen = 0;
9620 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
9621 : 272 : c->type.value.u.string.minLen = 0;
9622 : 272 : c->type.n_min = 0;
9623 : 272 : c->type.n_max = UINT_MAX;
9624 : 272 : c->mutable = true;
9625 : 272 : c->parse = sbrec_sb_global_parse_external_ids;
9626 : 272 : c->unparse = sbrec_sb_global_unparse_external_ids;
9627 : :
9628 : : /* Initialize sbrec_sb_global_col_nb_cfg. */
9629 : 272 : c = &sbrec_sb_global_col_nb_cfg;
9630 : 272 : c->name = "nb_cfg";
9631 : 272 : ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
9632 : 272 : ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9633 : 272 : c->type.n_min = 1;
9634 : 272 : c->type.n_max = 1;
9635 : 272 : c->mutable = true;
9636 : 272 : c->parse = sbrec_sb_global_parse_nb_cfg;
9637 : 272 : c->unparse = sbrec_sb_global_unparse_nb_cfg;
9638 : 272 : }
9639 : :
9640 : : struct ovsdb_idl_table_class sbrec_table_classes[SBREC_N_TABLES] = {
9641 : : {"Address_Set", true,
9642 : : sbrec_address_set_columns, ARRAY_SIZE(sbrec_address_set_columns),
9643 : : sizeof(struct sbrec_address_set), sbrec_address_set_init__},
9644 : : {"Chassis", true,
9645 : : sbrec_chassis_columns, ARRAY_SIZE(sbrec_chassis_columns),
9646 : : sizeof(struct sbrec_chassis), sbrec_chassis_init__},
9647 : : {"DHCP_Options", true,
9648 : : sbrec_dhcp_options_columns, ARRAY_SIZE(sbrec_dhcp_options_columns),
9649 : : sizeof(struct sbrec_dhcp_options), sbrec_dhcp_options_init__},
9650 : : {"DHCPv6_Options", true,
9651 : : sbrec_dhcpv6_options_columns, ARRAY_SIZE(sbrec_dhcpv6_options_columns),
9652 : : sizeof(struct sbrec_dhcpv6_options), sbrec_dhcpv6_options_init__},
9653 : : {"Datapath_Binding", true,
9654 : : sbrec_datapath_binding_columns, ARRAY_SIZE(sbrec_datapath_binding_columns),
9655 : : sizeof(struct sbrec_datapath_binding), sbrec_datapath_binding_init__},
9656 : : {"Encap", false,
9657 : : sbrec_encap_columns, ARRAY_SIZE(sbrec_encap_columns),
9658 : : sizeof(struct sbrec_encap), sbrec_encap_init__},
9659 : : {"Logical_Flow", true,
9660 : : sbrec_logical_flow_columns, ARRAY_SIZE(sbrec_logical_flow_columns),
9661 : : sizeof(struct sbrec_logical_flow), sbrec_logical_flow_init__},
9662 : : {"MAC_Binding", true,
9663 : : sbrec_mac_binding_columns, ARRAY_SIZE(sbrec_mac_binding_columns),
9664 : : sizeof(struct sbrec_mac_binding), sbrec_mac_binding_init__},
9665 : : {"Multicast_Group", true,
9666 : : sbrec_multicast_group_columns, ARRAY_SIZE(sbrec_multicast_group_columns),
9667 : : sizeof(struct sbrec_multicast_group), sbrec_multicast_group_init__},
9668 : : {"Port_Binding", true,
9669 : : sbrec_port_binding_columns, ARRAY_SIZE(sbrec_port_binding_columns),
9670 : : sizeof(struct sbrec_port_binding), sbrec_port_binding_init__},
9671 : : {"SB_Global", true,
9672 : : sbrec_sb_global_columns, ARRAY_SIZE(sbrec_sb_global_columns),
9673 : : sizeof(struct sbrec_sb_global), sbrec_sb_global_init__},
9674 : : };
9675 : :
9676 : : struct ovsdb_idl_class sbrec_idl_class = {
9677 : : "OVN_Southbound", sbrec_table_classes, ARRAY_SIZE(sbrec_table_classes)
9678 : : };
9679 : :
9680 : : void
9681 : 272 : sbrec_init(void)
9682 : : {
9683 [ - + ]: 272 : if (inited) {
9684 : 0 : return;
9685 : : }
9686 : 272 : assert_single_threaded();
9687 : 272 : inited = true;
9688 : :
9689 : 272 : sbrec_address_set_columns_init();
9690 : 272 : sbrec_chassis_columns_init();
9691 : 272 : sbrec_dhcp_options_columns_init();
9692 : 272 : sbrec_dhcpv6_options_columns_init();
9693 : 272 : sbrec_datapath_binding_columns_init();
9694 : 272 : sbrec_encap_columns_init();
9695 : 272 : sbrec_logical_flow_columns_init();
9696 : 272 : sbrec_mac_binding_columns_init();
9697 : 272 : sbrec_multicast_group_columns_init();
9698 : 272 : sbrec_port_binding_columns_init();
9699 : 272 : sbrec_sb_global_columns_init();
9700 : : }
9701 : :
9702 : : /* Return the schema version. The caller must not free the returned value. */
9703 : : const char *
9704 : 0 : sbrec_get_db_version(void)
9705 : : {
9706 : 0 : return "1.8.0";
9707 : : }
9708 : :
|