Coverage Report

Created: 2025-07-18 06:07

/src/openvswitch/lib/vswitch-idl.c
Line
Count
Source (jump to first uncovered line)
1
/* Generated automatically -- do not modify!    -*- buffer-read-only: t -*- */
2
3
#include <config.h>
4
#include "lib/vswitch-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
12
13
14
15
static struct ovsrec_autoattach *
16
ovsrec_autoattach_cast(const struct ovsdb_idl_row *row)
17
0
{
18
0
    return row ? CONTAINER_OF(row, struct ovsrec_autoattach, header_) : NULL;
19
0
}
20
21
static struct ovsrec_bridge *
22
ovsrec_bridge_cast(const struct ovsdb_idl_row *row)
23
0
{
24
0
    return row ? CONTAINER_OF(row, struct ovsrec_bridge, header_) : NULL;
25
0
}
26
27
static struct ovsrec_ct_timeout_policy *
28
ovsrec_ct_timeout_policy_cast(const struct ovsdb_idl_row *row)
29
0
{
30
0
    return row ? CONTAINER_OF(row, struct ovsrec_ct_timeout_policy, header_) : NULL;
31
0
}
32
33
static struct ovsrec_ct_zone *
34
ovsrec_ct_zone_cast(const struct ovsdb_idl_row *row)
35
0
{
36
0
    return row ? CONTAINER_OF(row, struct ovsrec_ct_zone, header_) : NULL;
37
0
}
38
39
static struct ovsrec_controller *
40
ovsrec_controller_cast(const struct ovsdb_idl_row *row)
41
0
{
42
0
    return row ? CONTAINER_OF(row, struct ovsrec_controller, header_) : NULL;
43
0
}
44
45
static struct ovsrec_datapath *
46
ovsrec_datapath_cast(const struct ovsdb_idl_row *row)
47
0
{
48
0
    return row ? CONTAINER_OF(row, struct ovsrec_datapath, header_) : NULL;
49
0
}
50
51
static struct ovsrec_flow_sample_collector_set *
52
ovsrec_flow_sample_collector_set_cast(const struct ovsdb_idl_row *row)
53
0
{
54
0
    return row ? CONTAINER_OF(row, struct ovsrec_flow_sample_collector_set, header_) : NULL;
55
0
}
56
57
static struct ovsrec_flow_table *
58
ovsrec_flow_table_cast(const struct ovsdb_idl_row *row)
59
0
{
60
0
    return row ? CONTAINER_OF(row, struct ovsrec_flow_table, header_) : NULL;
61
0
}
62
63
static struct ovsrec_ipfix *
64
ovsrec_ipfix_cast(const struct ovsdb_idl_row *row)
65
0
{
66
0
    return row ? CONTAINER_OF(row, struct ovsrec_ipfix, header_) : NULL;
67
0
}
68
69
static struct ovsrec_interface *
70
ovsrec_interface_cast(const struct ovsdb_idl_row *row)
71
0
{
72
0
    return row ? CONTAINER_OF(row, struct ovsrec_interface, header_) : NULL;
73
0
}
74
75
static struct ovsrec_manager *
76
ovsrec_manager_cast(const struct ovsdb_idl_row *row)
77
0
{
78
0
    return row ? CONTAINER_OF(row, struct ovsrec_manager, header_) : NULL;
79
0
}
80
81
static struct ovsrec_mirror *
82
ovsrec_mirror_cast(const struct ovsdb_idl_row *row)
83
0
{
84
0
    return row ? CONTAINER_OF(row, struct ovsrec_mirror, header_) : NULL;
85
0
}
86
87
static struct ovsrec_netflow *
88
ovsrec_netflow_cast(const struct ovsdb_idl_row *row)
89
0
{
90
0
    return row ? CONTAINER_OF(row, struct ovsrec_netflow, header_) : NULL;
91
0
}
92
93
static struct ovsrec_open_vswitch *
94
ovsrec_open_vswitch_cast(const struct ovsdb_idl_row *row)
95
0
{
96
0
    return row ? CONTAINER_OF(row, struct ovsrec_open_vswitch, header_) : NULL;
97
0
}
98
99
static struct ovsrec_port *
100
ovsrec_port_cast(const struct ovsdb_idl_row *row)
101
0
{
102
0
    return row ? CONTAINER_OF(row, struct ovsrec_port, header_) : NULL;
103
0
}
104
105
static struct ovsrec_qos *
106
ovsrec_qos_cast(const struct ovsdb_idl_row *row)
107
0
{
108
0
    return row ? CONTAINER_OF(row, struct ovsrec_qos, header_) : NULL;
109
0
}
110
111
static struct ovsrec_queue *
112
ovsrec_queue_cast(const struct ovsdb_idl_row *row)
113
0
{
114
0
    return row ? CONTAINER_OF(row, struct ovsrec_queue, header_) : NULL;
115
0
}
116
117
static struct ovsrec_ssl *
118
ovsrec_ssl_cast(const struct ovsdb_idl_row *row)
119
0
{
120
0
    return row ? CONTAINER_OF(row, struct ovsrec_ssl, header_) : NULL;
121
0
}
122
123
static struct ovsrec_sflow *
124
ovsrec_sflow_cast(const struct ovsdb_idl_row *row)
125
0
{
126
0
    return row ? CONTAINER_OF(row, struct ovsrec_sflow, header_) : NULL;
127
0
}
128

129
/* AutoAttach table. */
130
131
bool
132
ovsrec_server_has_autoattach_table_col_mappings(const struct ovsdb_idl *idl)
133
0
{
134
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_autoattach_col_mappings);
135
0
}
136
137
const struct ovsdb_type *
138
ovsrec_autoattach_mappings_server_type(const struct ovsdb_idl *idl)
139
0
{
140
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_autoattach_col_mappings);
141
0
}
142
143
144
bool
145
ovsrec_server_has_autoattach_table_col_system_description(const struct ovsdb_idl *idl)
146
0
{
147
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_autoattach_col_system_description);
148
0
}
149
150
const struct ovsdb_type *
151
ovsrec_autoattach_system_description_server_type(const struct ovsdb_idl *idl)
152
0
{
153
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_autoattach_col_system_description);
154
0
}
155
156
157
bool
158
ovsrec_server_has_autoattach_table_col_system_name(const struct ovsdb_idl *idl)
159
0
{
160
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_autoattach_col_system_name);
161
0
}
162
163
const struct ovsdb_type *
164
ovsrec_autoattach_system_name_server_type(const struct ovsdb_idl *idl)
165
0
{
166
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_autoattach_col_system_name);
167
0
}
168
169
170
bool
171
ovsrec_server_has_autoattach_table(const struct ovsdb_idl *idl)
172
0
{
173
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_AUTOATTACH]);
174
0
}
175
176
177
const struct ovsrec_autoattach_table *
178
ovsrec_autoattach_table_get(const struct ovsdb_idl *idl)
179
0
{
180
0
    return (const struct ovsrec_autoattach_table *) idl;
181
0
}
182
183
const struct ovsrec_autoattach *
184
ovsrec_autoattach_table_first(const struct ovsrec_autoattach_table *table)
185
0
{
186
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
187
0
    return ovsrec_autoattach_first(idl);
188
0
}
189
190
191
const struct ovsrec_autoattach *
192
ovsrec_autoattach_table_track_get_first(const struct ovsrec_autoattach_table *table)
193
0
{
194
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
195
0
    return ovsrec_autoattach_track_get_first(idl);
196
0
}
197
198
199
static void
200
ovsrec_autoattach_parse_mappings(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
201
0
{
202
0
    struct ovsrec_autoattach *row = ovsrec_autoattach_cast(row_);
203
0
    row->key_mappings = NULL;
204
0
    row->value_mappings = NULL;
205
0
    row->n_mappings = 0;
206
0
    for (size_t i = 0; i < datum->n; i++) {
207
0
        if (!row->n_mappings) {
208
0
            row->key_mappings = xmalloc(datum->n * sizeof *row->key_mappings);
209
0
            row->value_mappings = xmalloc(datum->n * sizeof *row->value_mappings);
210
0
        }
211
0
        row->key_mappings[row->n_mappings] = datum->keys[i].integer;
212
0
        row->value_mappings[row->n_mappings] = datum->values[i].integer;
213
0
        row->n_mappings++;
214
0
    }
215
0
}
216
217
static void
218
ovsrec_autoattach_parse_system_description(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
219
0
{
220
0
    struct ovsrec_autoattach *row = ovsrec_autoattach_cast(row_);
221
222
0
    if (datum->n >= 1) {
223
0
        row->system_description = CONST_CAST(char *, json_string(datum->keys[0].s));
224
0
    } else {
225
0
        row->system_description = "";
226
0
    }
227
0
}
228
229
static void
230
ovsrec_autoattach_parse_system_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
231
0
{
232
0
    struct ovsrec_autoattach *row = ovsrec_autoattach_cast(row_);
233
234
0
    if (datum->n >= 1) {
235
0
        row->system_name = CONST_CAST(char *, json_string(datum->keys[0].s));
236
0
    } else {
237
0
        row->system_name = "";
238
0
    }
239
0
}
240
241
static void
242
ovsrec_autoattach_unparse_mappings(struct ovsdb_idl_row *row_)
243
0
{
244
0
    struct ovsrec_autoattach *row = ovsrec_autoattach_cast(row_);
245
0
    free(row->key_mappings);
246
0
    free(row->value_mappings);
247
0
}
248
249
static void
250
ovsrec_autoattach_unparse_system_description(struct ovsdb_idl_row *row OVS_UNUSED)
251
0
{
252
    /* Nothing to do. */
253
0
}
254
255
static void
256
ovsrec_autoattach_unparse_system_name(struct ovsdb_idl_row *row OVS_UNUSED)
257
0
{
258
    /* Nothing to do. */
259
0
}
260
261
static void
262
ovsrec_autoattach_init__(struct ovsdb_idl_row *row)
263
0
{
264
0
    ovsrec_autoattach_init(ovsrec_autoattach_cast(row));
265
0
}
266
267
/* Clears the contents of 'row' in table "AutoAttach". */
268
void
269
ovsrec_autoattach_init(struct ovsrec_autoattach *row)
270
0
{
271
0
    memset(row, 0, sizeof *row); 
272
0
    row->system_description = "";
273
0
    row->system_name = "";
274
0
}
275
276
/* Searches table "AutoAttach" in 'idl' for a row with UUID 'uuid'.  Returns
277
 * a pointer to the row if there is one, otherwise a null pointer.  */
278
const struct ovsrec_autoattach *
279
ovsrec_autoattach_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
280
0
{
281
0
    return ovsrec_autoattach_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_autoattach, uuid));
282
0
}
283
284
/* Searches table "AutoAttach" for a row with UUID 'uuid'.  Returns
285
 * a pointer to the row if there is one, otherwise a null pointer.  */
286
const struct ovsrec_autoattach *
287
ovsrec_autoattach_table_get_for_uuid(const struct ovsrec_autoattach_table *table, const struct uuid *uuid)
288
0
{
289
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
290
0
    return ovsrec_autoattach_get_for_uuid(idl, uuid);
291
0
}
292
293
/* Returns a row in table "AutoAttach" in 'idl', or a null pointer if that
294
 * table is empty.
295
 *
296
 * Database tables are internally maintained as hash tables, so adding or
297
 * removing rows while traversing the same table can cause some rows to be
298
 * visited twice or not at apply. */
299
const struct ovsrec_autoattach *
300
ovsrec_autoattach_first(const struct ovsdb_idl *idl)
301
0
{
302
0
    return ovsrec_autoattach_cast(ovsdb_idl_first_row(idl, &ovsrec_table_autoattach));
303
0
}
304
305
/* Returns a row following 'row' within its table, or a null pointer if 'row'
306
 * is the last row in its table. */
307
const struct ovsrec_autoattach *
308
ovsrec_autoattach_next(const struct ovsrec_autoattach *row)
309
0
{
310
0
    return ovsrec_autoattach_cast(ovsdb_idl_next_row(&row->header_));
311
0
}
312
313
unsigned int ovsrec_autoattach_get_seqno(const struct ovsdb_idl *idl)
314
0
{
315
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_autoattach);
316
0
}
317
318
unsigned int ovsrec_autoattach_row_get_seqno(const struct ovsrec_autoattach *row, enum ovsdb_idl_change change)
319
0
{
320
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
321
0
}
322
323
const struct ovsrec_autoattach *
324
ovsrec_autoattach_track_get_first(const struct ovsdb_idl *idl)
325
0
{
326
0
    return ovsrec_autoattach_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_autoattach));
327
0
}
328
329
const struct ovsrec_autoattach
330
*ovsrec_autoattach_track_get_next(const struct ovsrec_autoattach *row)
331
0
{
332
0
    return ovsrec_autoattach_cast(ovsdb_idl_track_get_next(&row->header_));
333
0
}
334
335
336
/* Deletes 'row' from table "AutoAttach".  'row' may be freed, so it must not be
337
 * accessed afterward.
338
 *
339
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
340
void
341
ovsrec_autoattach_delete(const struct ovsrec_autoattach *row)
342
0
{
343
0
    ovsdb_idl_txn_delete(&row->header_);
344
0
}
345
346
/* Inserts and returns a new row in the table "AutoAttach" in the database
347
 * with open transaction 'txn'.
348
 *
349
 * The new row is assigned a randomly generated provisional UUID.
350
 * ovsdb-server will assign a different UUID when 'txn' is committed,
351
 * but the IDL will replace any uses of the provisional UUID in the
352
 * data to be to be committed by the UUID assigned by ovsdb-server. */
353
struct ovsrec_autoattach *
354
ovsrec_autoattach_insert(struct ovsdb_idl_txn *txn)
355
0
{
356
0
    return ovsrec_autoattach_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_autoattach, NULL));
357
0
}
358
359
/* Inserts and returns a new row in the table "AutoAttach" in the database
360
 * with open transaction 'txn'.
361
 *
362
 * The new row is assigned the UUID specified in the 'uuid' parameter
363
 * (which cannot be null).  ovsdb-server will try to assign the same
364
 * UUID when 'txn' is committed. */
365
struct ovsrec_autoattach *
366
ovsrec_autoattach_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
367
0
{
368
0
    return ovsrec_autoattach_cast(ovsdb_idl_txn_insert_persist_uuid(
369
0
        txn, &ovsrec_table_autoattach, uuid));
370
0
}
371
372
bool
373
ovsrec_autoattach_is_updated(const struct ovsrec_autoattach *row, enum ovsrec_autoattach_column_id column)
374
0
{
375
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_autoattach_columns[column]);
376
0
}
377
378
/* Causes the original contents of column "mappings" in 'row' to be
379
 * verified as a prerequisite to completing the transaction.  That is, if
380
 * "mappings" in 'row' changed (or if 'row' was deleted) between the
381
 * time that the IDL originally read its contents and the time that the
382
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
383
 *
384
 * The intention is that, to ensure that no transaction commits based on dirty
385
 * reads, an application should call this function any time "mappings" is
386
 * read as part of a read-modify-write operation.
387
 *
388
 * In some cases this function reduces to a no-op, because the current value
389
 * of "mappings" is already known:
390
 *
391
 *   - If 'row' is a row created by the current transaction (returned by
392
 *     ovsrec_autoattach_insert()).
393
 *
394
 *   - If "mappings" has already been modified (with
395
 *     ovsrec_autoattach_set_mappings()) within the current transaction.
396
 *
397
 * Because of the latter property, always call this function *before*
398
 * ovsrec_autoattach_set_mappings() for a given read-modify-write.
399
 *
400
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
401
void
402
ovsrec_autoattach_verify_mappings(const struct ovsrec_autoattach *row)
403
0
{
404
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_autoattach_col_mappings);
405
0
}
406
407
/* Causes the original contents of column "system_description" in 'row' to be
408
 * verified as a prerequisite to completing the transaction.  That is, if
409
 * "system_description" in 'row' changed (or if 'row' was deleted) between the
410
 * time that the IDL originally read its contents and the time that the
411
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
412
 *
413
 * The intention is that, to ensure that no transaction commits based on dirty
414
 * reads, an application should call this function any time "system_description" is
415
 * read as part of a read-modify-write operation.
416
 *
417
 * In some cases this function reduces to a no-op, because the current value
418
 * of "system_description" is already known:
419
 *
420
 *   - If 'row' is a row created by the current transaction (returned by
421
 *     ovsrec_autoattach_insert()).
422
 *
423
 *   - If "system_description" has already been modified (with
424
 *     ovsrec_autoattach_set_system_description()) within the current transaction.
425
 *
426
 * Because of the latter property, always call this function *before*
427
 * ovsrec_autoattach_set_system_description() for a given read-modify-write.
428
 *
429
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
430
void
431
ovsrec_autoattach_verify_system_description(const struct ovsrec_autoattach *row)
432
0
{
433
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_autoattach_col_system_description);
434
0
}
435
436
/* Causes the original contents of column "system_name" in 'row' to be
437
 * verified as a prerequisite to completing the transaction.  That is, if
438
 * "system_name" in 'row' changed (or if 'row' was deleted) between the
439
 * time that the IDL originally read its contents and the time that the
440
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
441
 *
442
 * The intention is that, to ensure that no transaction commits based on dirty
443
 * reads, an application should call this function any time "system_name" is
444
 * read as part of a read-modify-write operation.
445
 *
446
 * In some cases this function reduces to a no-op, because the current value
447
 * of "system_name" is already known:
448
 *
449
 *   - If 'row' is a row created by the current transaction (returned by
450
 *     ovsrec_autoattach_insert()).
451
 *
452
 *   - If "system_name" has already been modified (with
453
 *     ovsrec_autoattach_set_system_name()) within the current transaction.
454
 *
455
 * Because of the latter property, always call this function *before*
456
 * ovsrec_autoattach_set_system_name() for a given read-modify-write.
457
 *
458
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
459
void
460
ovsrec_autoattach_verify_system_name(const struct ovsrec_autoattach *row)
461
0
{
462
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_autoattach_col_system_name);
463
0
}
464
465
/* Returns the "mappings" column's value from the "AutoAttach" table in 'row'
466
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
467
 * ovsdb_datum_find_key() is an easier and more efficient way to search
468
 * for a given key than implementing the same operation on the "cooked"
469
 * form in 'row'.
470
 *
471
 * 'key_type' must be OVSDB_TYPE_INTEGER.
472
 * 'value_type' must be OVSDB_TYPE_INTEGER.
473
 * (This helps to avoid silent bugs if someone changes mappings's
474
 * type without updating the caller.)
475
 *
476
 * The caller must not modify or free the returned value.
477
 *
478
 * Various kinds of changes can invalidate the returned value: modifying
479
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
480
 * If the returned value is needed for a long time, it is best to make a copy
481
 * of it with ovsdb_datum_clone().
482
 *
483
 * This function is rarely useful, since it is easier to access the value
484
 * directly through the "mappings" member in ovsrec_autoattach. */
485
const struct ovsdb_datum *
486
ovsrec_autoattach_get_mappings(const struct ovsrec_autoattach *row,
487
  enum ovsdb_atomic_type key_type OVS_UNUSED,
488
  enum ovsdb_atomic_type value_type OVS_UNUSED)
489
0
{
490
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
491
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
492
0
    return ovsdb_idl_read(&row->header_, &ovsrec_autoattach_col_mappings);
493
0
}
494
495
/* Returns the "system_description" column's value from the "AutoAttach" table in 'row'
496
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
497
 * ovsdb_datum_find_key() is an easier and more efficient way to search
498
 * for a given key than implementing the same operation on the "cooked"
499
 * form in 'row'.
500
 *
501
 * 'key_type' must be OVSDB_TYPE_STRING.
502
 * (This helps to avoid silent bugs if someone changes system_description's
503
 * type without updating the caller.)
504
 *
505
 * The caller must not modify or free the returned value.
506
 *
507
 * Various kinds of changes can invalidate the returned value: modifying
508
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
509
 * If the returned value is needed for a long time, it is best to make a copy
510
 * of it with ovsdb_datum_clone().
511
 *
512
 * This function is rarely useful, since it is easier to access the value
513
 * directly through the "system_description" member in ovsrec_autoattach. */
514
const struct ovsdb_datum *
515
ovsrec_autoattach_get_system_description(const struct ovsrec_autoattach *row,
516
  enum ovsdb_atomic_type key_type OVS_UNUSED)
517
0
{
518
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
519
0
    return ovsdb_idl_read(&row->header_, &ovsrec_autoattach_col_system_description);
520
0
}
521
522
/* Returns the "system_name" column's value from the "AutoAttach" table in 'row'
523
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
524
 * ovsdb_datum_find_key() is an easier and more efficient way to search
525
 * for a given key than implementing the same operation on the "cooked"
526
 * form in 'row'.
527
 *
528
 * 'key_type' must be OVSDB_TYPE_STRING.
529
 * (This helps to avoid silent bugs if someone changes system_name's
530
 * type without updating the caller.)
531
 *
532
 * The caller must not modify or free the returned value.
533
 *
534
 * Various kinds of changes can invalidate the returned value: modifying
535
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
536
 * If the returned value is needed for a long time, it is best to make a copy
537
 * of it with ovsdb_datum_clone().
538
 *
539
 * This function is rarely useful, since it is easier to access the value
540
 * directly through the "system_name" member in ovsrec_autoattach. */
541
const struct ovsdb_datum *
542
ovsrec_autoattach_get_system_name(const struct ovsrec_autoattach *row,
543
  enum ovsdb_atomic_type key_type OVS_UNUSED)
544
0
{
545
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
546
0
    return ovsdb_idl_read(&row->header_, &ovsrec_autoattach_col_system_name);
547
0
}
548
549
/* Sets the "mappings" column from the "AutoAttach" table in 'row' to
550
 * the map with keys 'key_mappings' and values 'value_mappings'
551
 * with 'n_mappings' entries.
552
 *
553
 * Argument constraints: key in range 0 to 16,777,215, value in range 0 to 4,095
554
 *
555
 * The caller retains ownership of the arguments. */
556
void
557
ovsrec_autoattach_set_mappings(const struct ovsrec_autoattach *row, const int64_t *key_mappings, const int64_t *value_mappings, size_t n_mappings)
558
0
{
559
0
    struct ovsdb_datum datum;
560
561
0
    datum.refcnt = NULL;
562
563
0
    datum.n = n_mappings;
564
0
    datum.keys = n_mappings ? xmalloc(n_mappings * sizeof *datum.keys) : NULL;
565
0
    datum.values = xmalloc(n_mappings * sizeof *datum.values);
566
0
    for (size_t i = 0; i < n_mappings; i++) {
567
0
        datum.keys[i].integer = key_mappings[i];
568
0
        datum.values[i].integer = value_mappings[i];
569
0
    }
570
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_autoattach_col_mappings, &datum);
571
0
}
572
573
/* Sets the "system_description" column from the "AutoAttach" table in 'row' to
574
 * 'system_description'.
575
 *
576
 * The caller retains ownership of the arguments. */
577
void
578
ovsrec_autoattach_set_system_description(const struct ovsrec_autoattach *row, const char *system_description)
579
0
{
580
0
    struct ovsdb_datum datum;
581
582
0
    datum.refcnt = NULL;
583
584
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
585
586
0
    datum.n = 1;
587
0
    datum.keys = key;
588
0
    key->s = ovsdb_atom_string_create(system_description);
589
0
    datum.values = NULL;
590
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_autoattach_col_system_description, &datum);
591
0
}
592
593
/* Sets the "system_name" column from the "AutoAttach" table in 'row' to
594
 * 'system_name'.
595
 *
596
 * The caller retains ownership of the arguments. */
597
void
598
ovsrec_autoattach_set_system_name(const struct ovsrec_autoattach *row, const char *system_name)
599
0
{
600
0
    struct ovsdb_datum datum;
601
602
0
    datum.refcnt = NULL;
603
604
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
605
606
0
    datum.n = 1;
607
0
    datum.keys = key;
608
0
    key->s = ovsdb_atom_string_create(system_name);
609
0
    datum.values = NULL;
610
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_autoattach_col_system_name, &datum);
611
0
}
612
613
/* Sets an element of the "mappings" map column from the "AutoAttach" table in 'row'
614
 * to 'new_value' given the key value 'new_key'.
615
 *
616
 */
617
void
618
ovsrec_autoattach_update_mappings_setkey(const struct ovsrec_autoattach *row, int64_t new_key, int64_t new_value)
619
0
{
620
0
    struct ovsdb_datum *datum;
621
622
0
    datum = xmalloc(sizeof *datum);
623
0
    datum->n = 1;
624
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
625
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
626
0
    datum->refcnt = NULL;
627
628
0
    datum->keys[0].integer = new_key;
629
0
    datum->values[0].integer = new_value;
630
631
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
632
0
                                    &ovsrec_autoattach_col_mappings,
633
0
                                    datum);
634
0
}
635
636
/* Deletes an element of the "mappings" map column from the "AutoAttach" table in 'row'
637
 * given the key value 'delete_key'.
638
 *
639
 */
640
void
641
ovsrec_autoattach_update_mappings_delkey(const struct ovsrec_autoattach *row, int64_t delete_key)
642
0
{
643
0
    struct ovsdb_datum *datum;
644
645
0
    datum = xmalloc(sizeof *datum);
646
0
    datum->n = 1;
647
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
648
0
    datum->values = NULL;
649
0
    datum->refcnt = NULL;
650
651
0
    datum->keys[0].integer = delete_key;
652
653
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
654
0
                                    &ovsrec_autoattach_col_mappings,
655
0
                                    datum);
656
0
}
657
658
/* Sets the "mappings" column from the "AutoAttach" table in 'row' to
659
 * the map with keys 'key_mappings' and values 'value_mappings'
660
 * with 'n_mappings' entries.
661
 *
662
 * Argument constraints: key in range 0 to 16,777,215, value in range 0 to 4,095
663
 *
664
 * The caller retains ownership of the arguments. */
665
void
666
ovsrec_autoattach_add_clause_mappings(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *key_mappings, const int64_t *value_mappings, size_t n_mappings)
667
0
{
668
0
    struct ovsdb_datum datum;
669
670
0
    datum.refcnt = NULL;
671
0
    datum.n = n_mappings;
672
0
    datum.keys = n_mappings ? xmalloc(n_mappings * sizeof *datum.keys) : NULL;
673
0
    datum.values = xmalloc(n_mappings * sizeof *datum.values);
674
0
    for (size_t i = 0; i < n_mappings; i++) {
675
0
        datum.keys[i].integer = key_mappings[i];
676
0
        datum.values[i].integer = value_mappings[i];
677
0
    }
678
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_autoattach_col_mappings.type);
679
0
    ovsdb_idl_condition_add_clause(cond,
680
0
                          function,
681
0
                          &ovsrec_autoattach_col_mappings,
682
0
                          &datum);
683
0
    ovsdb_datum_destroy(&datum, &ovsrec_autoattach_col_mappings.type);
684
0
}
685
686
/* Sets the "system_description" column from the "AutoAttach" table in 'row' to
687
 * 'system_description'.
688
 *
689
 * The caller retains ownership of the arguments. */
690
void
691
ovsrec_autoattach_add_clause_system_description(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *system_description)
692
0
{
693
0
    struct ovsdb_datum datum;
694
695
0
    datum.refcnt = NULL;
696
697
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
698
699
0
    datum.n = 1;
700
0
    datum.keys = key;
701
0
    key->s = ovsdb_atom_string_create(system_description);
702
0
    datum.values = NULL;
703
0
    ovsdb_idl_condition_add_clause(cond,
704
0
                          function,
705
0
                          &ovsrec_autoattach_col_system_description,
706
0
                          &datum);
707
0
    ovsdb_datum_destroy(&datum, &ovsrec_autoattach_col_system_description.type);
708
0
}
709
710
/* Sets the "system_name" column from the "AutoAttach" table in 'row' to
711
 * 'system_name'.
712
 *
713
 * The caller retains ownership of the arguments. */
714
void
715
ovsrec_autoattach_add_clause_system_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *system_name)
716
0
{
717
0
    struct ovsdb_datum datum;
718
719
0
    datum.refcnt = NULL;
720
721
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
722
723
0
    datum.n = 1;
724
0
    datum.keys = key;
725
0
    key->s = ovsdb_atom_string_create(system_name);
726
0
    datum.values = NULL;
727
0
    ovsdb_idl_condition_add_clause(cond,
728
0
                          function,
729
0
                          &ovsrec_autoattach_col_system_name,
730
0
                          &datum);
731
0
    ovsdb_datum_destroy(&datum, &ovsrec_autoattach_col_system_name.type);
732
0
}
733
734
/* Destroy 'row' of kind "AutoAttach". The row must have been
735
 * created with ovsdb_idl_index_init_row.
736
 */
737
void
738
ovsrec_autoattach_index_destroy_row(const struct ovsrec_autoattach *row)
739
0
{
740
0
    ovsdb_idl_index_destroy_row(&row->header_);
741
0
}
742
        
743
744
/* Creates a new row of kind "AutoAttach". */
745
struct ovsrec_autoattach *
746
ovsrec_autoattach_index_init_row(struct ovsdb_idl_index *index)
747
0
{
748
0
    ovs_assert(index->table->class_ == &ovsrec_table_autoattach);
749
0
    return ALIGNED_CAST(struct ovsrec_autoattach *, ovsdb_idl_index_init_row(index));
750
0
}
751
752
struct ovsrec_autoattach *
753
ovsrec_autoattach_index_find(struct ovsdb_idl_index *index, const struct ovsrec_autoattach *target)
754
0
{
755
0
    ovs_assert(index->table->class_ == &ovsrec_table_autoattach);
756
0
    return ovsrec_autoattach_cast(ovsdb_idl_index_find(index, &target->header_));
757
0
}
758
759
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
760
int
761
ovsrec_autoattach_index_compare(
762
    struct ovsdb_idl_index *index, 
763
    const struct ovsrec_autoattach *a, 
764
    const struct ovsrec_autoattach *b)
765
0
{
766
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
767
0
}
768
769
struct ovsdb_idl_cursor
770
ovsrec_autoattach_cursor_first(struct ovsdb_idl_index *index)
771
0
{
772
0
    ovs_assert(index->table->class_ == &ovsrec_table_autoattach);
773
0
    return ovsdb_idl_cursor_first(index);
774
0
}
775
776
struct ovsdb_idl_cursor
777
ovsrec_autoattach_cursor_first_eq(
778
    struct ovsdb_idl_index *index, const struct ovsrec_autoattach *target)
779
0
{
780
0
    ovs_assert(index->table->class_ == &ovsrec_table_autoattach);
781
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
782
0
}
783
784
struct ovsdb_idl_cursor
785
ovsrec_autoattach_cursor_first_ge(
786
    struct ovsdb_idl_index *index, const struct ovsrec_autoattach *target)
787
0
{
788
0
    ovs_assert(index->table->class_ == &ovsrec_table_autoattach);
789
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
790
0
}
791
792
struct ovsrec_autoattach *
793
ovsrec_autoattach_cursor_data(struct ovsdb_idl_cursor *cursor)
794
0
{
795
0
    return ovsrec_autoattach_cast(ovsdb_idl_cursor_data(cursor));
796
0
}
797
798
799
/* Sets the "mappings" column from the "AutoAttach" table in 'row' to
800
 * the map with keys 'key_mappings' and values 'value_mappings'
801
 * with 'n_mappings' entries.
802
 *
803
 * Argument constraints: key in range 0 to 16,777,215, value in range 0 to 4,095
804
 *
805
 * The caller retains ownership of the arguments. */
806
void
807
ovsrec_autoattach_index_set_mappings(const struct ovsrec_autoattach *row, const int64_t *key_mappings, const int64_t *value_mappings, size_t n_mappings)
808
0
{
809
0
    struct ovsdb_datum datum;
810
811
0
    datum.refcnt = NULL;
812
0
    size_t i;
813
814
0
    datum.n = n_mappings;
815
0
    datum.keys = n_mappings ? xmalloc(n_mappings * sizeof *datum.keys) : NULL;
816
0
    datum.values = xmalloc(n_mappings * sizeof *datum.values);
817
0
    for (i = 0; i < n_mappings; i++) {
818
0
        datum.keys[i].integer = key_mappings[i];
819
0
        datum.values[i].integer = value_mappings[i];
820
0
    }
821
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_autoattach_col_mappings.type);
822
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_autoattach_columns[ OVSREC_AUTOATTACH_COL_MAPPINGS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_AUTOATTACH]);
823
0
}
824
825
/* Sets the "system_description" column from the "AutoAttach" table in 'row' to
826
 * 'system_description'.
827
 *
828
 * The caller retains ownership of the arguments. */
829
void
830
ovsrec_autoattach_index_set_system_description(const struct ovsrec_autoattach *row, const char *system_description)
831
0
{
832
0
    struct ovsdb_datum datum;
833
834
0
    datum.refcnt = NULL;
835
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
836
837
0
    datum.n = 1;
838
0
    datum.keys = key;
839
0
    key->s = ovsdb_atom_string_create(system_description);
840
0
    datum.values = NULL;
841
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_autoattach_columns[ OVSREC_AUTOATTACH_COL_SYSTEM_DESCRIPTION ], &datum, &ovsrec_table_classes[OVSREC_TABLE_AUTOATTACH]);
842
0
}
843
844
/* Sets the "system_name" column from the "AutoAttach" table in 'row' to
845
 * 'system_name'.
846
 *
847
 * The caller retains ownership of the arguments. */
848
void
849
ovsrec_autoattach_index_set_system_name(const struct ovsrec_autoattach *row, const char *system_name)
850
0
{
851
0
    struct ovsdb_datum datum;
852
853
0
    datum.refcnt = NULL;
854
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
855
856
0
    datum.n = 1;
857
0
    datum.keys = key;
858
0
    key->s = ovsdb_atom_string_create(system_name);
859
0
    datum.values = NULL;
860
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_autoattach_columns[ OVSREC_AUTOATTACH_COL_SYSTEM_NAME ], &datum, &ovsrec_table_classes[OVSREC_TABLE_AUTOATTACH]);
861
0
}
862
863
struct ovsdb_idl_column ovsrec_autoattach_columns[OVSREC_AUTOATTACH_N_COLUMNS];
864
865
unsigned int
866
ovsrec_autoattach_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
867
0
{
868
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_autoattach, condition);
869
0
}
870
871
struct ovsdb_idl_column ovsrec_autoattach_columns[OVSREC_AUTOATTACH_N_COLUMNS] = {
872
    [OVSREC_AUTOATTACH_COL_MAPPINGS] = {
873
         .name = "mappings",
874
         .type = {
875
            .key = {
876
               .type = OVSDB_TYPE_INTEGER,
877
               .integer = { .min = INT64_C(0), .max = INT64_C(16777215) },
878
            },
879
            .value = {
880
                .type = OVSDB_TYPE_INTEGER,
881
                .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
882
            },
883
            .n_min = 0,
884
            .n_max = UINT_MAX,
885
         },
886
         .is_mutable = true,
887
         .is_synthetic = false,
888
         .parse = ovsrec_autoattach_parse_mappings,
889
         .unparse = ovsrec_autoattach_unparse_mappings,
890
    },
891
892
    [OVSREC_AUTOATTACH_COL_SYSTEM_DESCRIPTION] = {
893
         .name = "system_description",
894
         .type = {
895
            .key = {
896
               .type = OVSDB_TYPE_STRING,
897
               .string = { .minLen = 0, .maxLen = UINT_MAX },
898
            },
899
            .value = OVSDB_BASE_VOID_INIT,
900
            .n_min = 1,
901
            .n_max = 1,
902
         },
903
         .is_mutable = true,
904
         .is_synthetic = false,
905
         .parse = ovsrec_autoattach_parse_system_description,
906
         .unparse = ovsrec_autoattach_unparse_system_description,
907
    },
908
909
    [OVSREC_AUTOATTACH_COL_SYSTEM_NAME] = {
910
         .name = "system_name",
911
         .type = {
912
            .key = {
913
               .type = OVSDB_TYPE_STRING,
914
               .string = { .minLen = 0, .maxLen = UINT_MAX },
915
            },
916
            .value = OVSDB_BASE_VOID_INIT,
917
            .n_min = 1,
918
            .n_max = 1,
919
         },
920
         .is_mutable = true,
921
         .is_synthetic = false,
922
         .parse = ovsrec_autoattach_parse_system_name,
923
         .unparse = ovsrec_autoattach_unparse_system_name,
924
    },
925
926
};
927

928
/* Bridge table. */
929
930
bool
931
ovsrec_server_has_bridge_table_col_auto_attach(const struct ovsdb_idl *idl)
932
0
{
933
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_auto_attach);
934
0
}
935
936
const struct ovsdb_type *
937
ovsrec_bridge_auto_attach_server_type(const struct ovsdb_idl *idl)
938
0
{
939
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_auto_attach);
940
0
}
941
942
943
bool
944
ovsrec_server_has_bridge_table_col_controller(const struct ovsdb_idl *idl)
945
0
{
946
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_controller);
947
0
}
948
949
const struct ovsdb_type *
950
ovsrec_bridge_controller_server_type(const struct ovsdb_idl *idl)
951
0
{
952
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_controller);
953
0
}
954
955
956
bool
957
ovsrec_server_has_bridge_table_col_datapath_id(const struct ovsdb_idl *idl)
958
0
{
959
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_datapath_id);
960
0
}
961
962
const struct ovsdb_type *
963
ovsrec_bridge_datapath_id_server_type(const struct ovsdb_idl *idl)
964
0
{
965
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_datapath_id);
966
0
}
967
968
969
bool
970
ovsrec_server_has_bridge_table_col_datapath_type(const struct ovsdb_idl *idl)
971
0
{
972
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_datapath_type);
973
0
}
974
975
const struct ovsdb_type *
976
ovsrec_bridge_datapath_type_server_type(const struct ovsdb_idl *idl)
977
0
{
978
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_datapath_type);
979
0
}
980
981
982
bool
983
ovsrec_server_has_bridge_table_col_datapath_version(const struct ovsdb_idl *idl)
984
0
{
985
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_datapath_version);
986
0
}
987
988
const struct ovsdb_type *
989
ovsrec_bridge_datapath_version_server_type(const struct ovsdb_idl *idl)
990
0
{
991
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_datapath_version);
992
0
}
993
994
995
bool
996
ovsrec_server_has_bridge_table_col_external_ids(const struct ovsdb_idl *idl)
997
0
{
998
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_external_ids);
999
0
}
1000
1001
const struct ovsdb_type *
1002
ovsrec_bridge_external_ids_server_type(const struct ovsdb_idl *idl)
1003
0
{
1004
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_external_ids);
1005
0
}
1006
1007
1008
bool
1009
ovsrec_server_has_bridge_table_col_fail_mode(const struct ovsdb_idl *idl)
1010
0
{
1011
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_fail_mode);
1012
0
}
1013
1014
const struct ovsdb_type *
1015
ovsrec_bridge_fail_mode_server_type(const struct ovsdb_idl *idl)
1016
0
{
1017
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_fail_mode);
1018
0
}
1019
1020
1021
bool
1022
ovsrec_server_has_bridge_table_col_flood_vlans(const struct ovsdb_idl *idl)
1023
0
{
1024
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_flood_vlans);
1025
0
}
1026
1027
const struct ovsdb_type *
1028
ovsrec_bridge_flood_vlans_server_type(const struct ovsdb_idl *idl)
1029
0
{
1030
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_flood_vlans);
1031
0
}
1032
1033
1034
bool
1035
ovsrec_server_has_bridge_table_col_flow_tables(const struct ovsdb_idl *idl)
1036
0
{
1037
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_flow_tables);
1038
0
}
1039
1040
const struct ovsdb_type *
1041
ovsrec_bridge_flow_tables_server_type(const struct ovsdb_idl *idl)
1042
0
{
1043
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_flow_tables);
1044
0
}
1045
1046
1047
bool
1048
ovsrec_server_has_bridge_table_col_ipfix(const struct ovsdb_idl *idl)
1049
0
{
1050
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_ipfix);
1051
0
}
1052
1053
const struct ovsdb_type *
1054
ovsrec_bridge_ipfix_server_type(const struct ovsdb_idl *idl)
1055
0
{
1056
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_ipfix);
1057
0
}
1058
1059
1060
bool
1061
ovsrec_server_has_bridge_table_col_mcast_snooping_enable(const struct ovsdb_idl *idl)
1062
0
{
1063
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_mcast_snooping_enable);
1064
0
}
1065
1066
const struct ovsdb_type *
1067
ovsrec_bridge_mcast_snooping_enable_server_type(const struct ovsdb_idl *idl)
1068
0
{
1069
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_mcast_snooping_enable);
1070
0
}
1071
1072
1073
bool
1074
ovsrec_server_has_bridge_table_col_mirrors(const struct ovsdb_idl *idl)
1075
0
{
1076
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_mirrors);
1077
0
}
1078
1079
const struct ovsdb_type *
1080
ovsrec_bridge_mirrors_server_type(const struct ovsdb_idl *idl)
1081
0
{
1082
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_mirrors);
1083
0
}
1084
1085
1086
bool
1087
ovsrec_server_has_bridge_table_col_name(const struct ovsdb_idl *idl)
1088
0
{
1089
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_name);
1090
0
}
1091
1092
const struct ovsdb_type *
1093
ovsrec_bridge_name_server_type(const struct ovsdb_idl *idl)
1094
0
{
1095
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_name);
1096
0
}
1097
1098
1099
bool
1100
ovsrec_server_has_bridge_table_col_netflow(const struct ovsdb_idl *idl)
1101
0
{
1102
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_netflow);
1103
0
}
1104
1105
const struct ovsdb_type *
1106
ovsrec_bridge_netflow_server_type(const struct ovsdb_idl *idl)
1107
0
{
1108
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_netflow);
1109
0
}
1110
1111
1112
bool
1113
ovsrec_server_has_bridge_table_col_other_config(const struct ovsdb_idl *idl)
1114
0
{
1115
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_other_config);
1116
0
}
1117
1118
const struct ovsdb_type *
1119
ovsrec_bridge_other_config_server_type(const struct ovsdb_idl *idl)
1120
0
{
1121
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_other_config);
1122
0
}
1123
1124
1125
bool
1126
ovsrec_server_has_bridge_table_col_ports(const struct ovsdb_idl *idl)
1127
0
{
1128
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_ports);
1129
0
}
1130
1131
const struct ovsdb_type *
1132
ovsrec_bridge_ports_server_type(const struct ovsdb_idl *idl)
1133
0
{
1134
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_ports);
1135
0
}
1136
1137
1138
bool
1139
ovsrec_server_has_bridge_table_col_protocols(const struct ovsdb_idl *idl)
1140
0
{
1141
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_protocols);
1142
0
}
1143
1144
const struct ovsdb_type *
1145
ovsrec_bridge_protocols_server_type(const struct ovsdb_idl *idl)
1146
0
{
1147
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_protocols);
1148
0
}
1149
1150
1151
bool
1152
ovsrec_server_has_bridge_table_col_rstp_enable(const struct ovsdb_idl *idl)
1153
0
{
1154
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_rstp_enable);
1155
0
}
1156
1157
const struct ovsdb_type *
1158
ovsrec_bridge_rstp_enable_server_type(const struct ovsdb_idl *idl)
1159
0
{
1160
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_rstp_enable);
1161
0
}
1162
1163
1164
bool
1165
ovsrec_server_has_bridge_table_col_rstp_status(const struct ovsdb_idl *idl)
1166
0
{
1167
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_rstp_status);
1168
0
}
1169
1170
const struct ovsdb_type *
1171
ovsrec_bridge_rstp_status_server_type(const struct ovsdb_idl *idl)
1172
0
{
1173
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_rstp_status);
1174
0
}
1175
1176
1177
bool
1178
ovsrec_server_has_bridge_table_col_sflow(const struct ovsdb_idl *idl)
1179
0
{
1180
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_sflow);
1181
0
}
1182
1183
const struct ovsdb_type *
1184
ovsrec_bridge_sflow_server_type(const struct ovsdb_idl *idl)
1185
0
{
1186
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_sflow);
1187
0
}
1188
1189
1190
bool
1191
ovsrec_server_has_bridge_table_col_status(const struct ovsdb_idl *idl)
1192
0
{
1193
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_status);
1194
0
}
1195
1196
const struct ovsdb_type *
1197
ovsrec_bridge_status_server_type(const struct ovsdb_idl *idl)
1198
0
{
1199
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_status);
1200
0
}
1201
1202
1203
bool
1204
ovsrec_server_has_bridge_table_col_stp_enable(const struct ovsdb_idl *idl)
1205
0
{
1206
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_stp_enable);
1207
0
}
1208
1209
const struct ovsdb_type *
1210
ovsrec_bridge_stp_enable_server_type(const struct ovsdb_idl *idl)
1211
0
{
1212
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_bridge_col_stp_enable);
1213
0
}
1214
1215
1216
bool
1217
ovsrec_server_has_bridge_table(const struct ovsdb_idl *idl)
1218
0
{
1219
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
1220
0
}
1221
1222
1223
const struct ovsrec_bridge_table *
1224
ovsrec_bridge_table_get(const struct ovsdb_idl *idl)
1225
0
{
1226
0
    return (const struct ovsrec_bridge_table *) idl;
1227
0
}
1228
1229
const struct ovsrec_bridge *
1230
ovsrec_bridge_table_first(const struct ovsrec_bridge_table *table)
1231
0
{
1232
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
1233
0
    return ovsrec_bridge_first(idl);
1234
0
}
1235
1236
1237
const struct ovsrec_bridge *
1238
ovsrec_bridge_table_track_get_first(const struct ovsrec_bridge_table *table)
1239
0
{
1240
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
1241
0
    return ovsrec_bridge_track_get_first(idl);
1242
0
}
1243
1244
1245
static void
1246
ovsrec_bridge_parse_auto_attach(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1247
0
{
1248
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1249
1250
0
    if (datum->n >= 1) {
1251
0
        row->auto_attach = ovsrec_autoattach_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_autoattach, &datum->keys[0].uuid));
1252
0
    } else {
1253
0
        row->auto_attach = NULL;
1254
0
    }
1255
0
}
1256
1257
static void
1258
ovsrec_bridge_parse_controller(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1259
0
{
1260
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1261
0
    row->controller = NULL;
1262
0
    row->n_controller = 0;
1263
0
    for (size_t i = 0; i < datum->n; i++) {
1264
0
        struct ovsrec_controller *keyRow = ovsrec_controller_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_controller, &datum->keys[i].uuid));
1265
0
        if (!keyRow) {
1266
0
            continue;
1267
0
        }
1268
0
        if (!row->n_controller) {
1269
0
            row->controller = xmalloc(datum->n * sizeof *row->controller);
1270
0
        }
1271
0
        row->controller[row->n_controller] = keyRow;
1272
0
        row->n_controller++;
1273
0
    }
1274
0
}
1275
1276
static void
1277
ovsrec_bridge_parse_datapath_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1278
0
{
1279
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1280
1281
0
    if (datum->n >= 1) {
1282
0
        row->datapath_id = CONST_CAST(char *, json_string(datum->keys[0].s));
1283
0
    } else {
1284
0
        row->datapath_id = NULL;
1285
0
    }
1286
0
}
1287
1288
static void
1289
ovsrec_bridge_parse_datapath_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1290
0
{
1291
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1292
1293
0
    if (datum->n >= 1) {
1294
0
        row->datapath_type = CONST_CAST(char *, json_string(datum->keys[0].s));
1295
0
    } else {
1296
0
        row->datapath_type = "";
1297
0
    }
1298
0
}
1299
1300
static void
1301
ovsrec_bridge_parse_datapath_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1302
0
{
1303
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1304
1305
0
    if (datum->n >= 1) {
1306
0
        row->datapath_version = CONST_CAST(char *, json_string(datum->keys[0].s));
1307
0
    } else {
1308
0
        row->datapath_version = "";
1309
0
    }
1310
0
}
1311
1312
static void
1313
ovsrec_bridge_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1314
0
{
1315
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1316
0
    smap_init(&row->external_ids);
1317
0
    for (size_t i = 0; i < datum->n; i++) {
1318
0
        smap_add(&row->external_ids,
1319
0
                 json_string(datum->keys[i].s),
1320
0
                 json_string(datum->values[i].s));
1321
0
    }
1322
0
}
1323
1324
static void
1325
ovsrec_bridge_parse_fail_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1326
0
{
1327
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1328
1329
0
    if (datum->n >= 1) {
1330
0
        row->fail_mode = CONST_CAST(char *, json_string(datum->keys[0].s));
1331
0
    } else {
1332
0
        row->fail_mode = NULL;
1333
0
    }
1334
0
}
1335
1336
static void
1337
ovsrec_bridge_parse_flood_vlans(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1338
0
{
1339
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1340
0
    size_t n = MIN(4096, datum->n);
1341
0
    row->flood_vlans = NULL;
1342
0
    row->n_flood_vlans = 0;
1343
0
    for (size_t i = 0; i < n; i++) {
1344
0
        if (!row->n_flood_vlans) {
1345
0
            row->flood_vlans = xmalloc(n * sizeof *row->flood_vlans);
1346
0
        }
1347
0
        row->flood_vlans[row->n_flood_vlans] = datum->keys[i].integer;
1348
0
        row->n_flood_vlans++;
1349
0
    }
1350
0
}
1351
1352
static void
1353
ovsrec_bridge_parse_flow_tables(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1354
0
{
1355
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1356
0
    row->key_flow_tables = NULL;
1357
0
    row->value_flow_tables = NULL;
1358
0
    row->n_flow_tables = 0;
1359
0
    for (size_t i = 0; i < datum->n; i++) {
1360
0
        struct ovsrec_flow_table *valueRow = ovsrec_flow_table_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_flow_table, &datum->values[i].uuid));
1361
0
        if (!valueRow) {
1362
0
            continue;
1363
0
        }
1364
0
        if (!row->n_flow_tables) {
1365
0
            row->key_flow_tables = xmalloc(datum->n * sizeof *row->key_flow_tables);
1366
0
            row->value_flow_tables = xmalloc(datum->n * sizeof *row->value_flow_tables);
1367
0
        }
1368
0
        row->key_flow_tables[row->n_flow_tables] = datum->keys[i].integer;
1369
0
        row->value_flow_tables[row->n_flow_tables] = valueRow;
1370
0
        row->n_flow_tables++;
1371
0
    }
1372
0
}
1373
1374
static void
1375
ovsrec_bridge_parse_ipfix(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1376
0
{
1377
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1378
1379
0
    if (datum->n >= 1) {
1380
0
        row->ipfix = ovsrec_ipfix_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_ipfix, &datum->keys[0].uuid));
1381
0
    } else {
1382
0
        row->ipfix = NULL;
1383
0
    }
1384
0
}
1385
1386
static void
1387
ovsrec_bridge_parse_mcast_snooping_enable(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1388
0
{
1389
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1390
1391
0
    if (datum->n >= 1) {
1392
0
        row->mcast_snooping_enable = datum->keys[0].boolean;
1393
0
    } else {
1394
0
        row->mcast_snooping_enable = false;
1395
0
    }
1396
0
}
1397
1398
static void
1399
ovsrec_bridge_parse_mirrors(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1400
0
{
1401
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1402
0
    row->mirrors = NULL;
1403
0
    row->n_mirrors = 0;
1404
0
    for (size_t i = 0; i < datum->n; i++) {
1405
0
        struct ovsrec_mirror *keyRow = ovsrec_mirror_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_mirror, &datum->keys[i].uuid));
1406
0
        if (!keyRow) {
1407
0
            continue;
1408
0
        }
1409
0
        if (!row->n_mirrors) {
1410
0
            row->mirrors = xmalloc(datum->n * sizeof *row->mirrors);
1411
0
        }
1412
0
        row->mirrors[row->n_mirrors] = keyRow;
1413
0
        row->n_mirrors++;
1414
0
    }
1415
0
}
1416
1417
static void
1418
ovsrec_bridge_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1419
0
{
1420
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1421
1422
0
    if (datum->n >= 1) {
1423
0
        row->name = CONST_CAST(char *, json_string(datum->keys[0].s));
1424
0
    } else {
1425
0
        row->name = "";
1426
0
    }
1427
0
}
1428
1429
static void
1430
ovsrec_bridge_parse_netflow(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1431
0
{
1432
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1433
1434
0
    if (datum->n >= 1) {
1435
0
        row->netflow = ovsrec_netflow_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_netflow, &datum->keys[0].uuid));
1436
0
    } else {
1437
0
        row->netflow = NULL;
1438
0
    }
1439
0
}
1440
1441
static void
1442
ovsrec_bridge_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1443
0
{
1444
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1445
0
    smap_init(&row->other_config);
1446
0
    for (size_t i = 0; i < datum->n; i++) {
1447
0
        smap_add(&row->other_config,
1448
0
                 json_string(datum->keys[i].s),
1449
0
                 json_string(datum->values[i].s));
1450
0
    }
1451
0
}
1452
1453
static void
1454
ovsrec_bridge_parse_ports(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1455
0
{
1456
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1457
0
    row->ports = NULL;
1458
0
    row->n_ports = 0;
1459
0
    for (size_t i = 0; i < datum->n; i++) {
1460
0
        struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_port, &datum->keys[i].uuid));
1461
0
        if (!keyRow) {
1462
0
            continue;
1463
0
        }
1464
0
        if (!row->n_ports) {
1465
0
            row->ports = xmalloc(datum->n * sizeof *row->ports);
1466
0
        }
1467
0
        row->ports[row->n_ports] = keyRow;
1468
0
        row->n_ports++;
1469
0
    }
1470
0
}
1471
1472
static void
1473
ovsrec_bridge_parse_protocols(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1474
0
{
1475
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1476
0
    row->protocols = NULL;
1477
0
    row->n_protocols = 0;
1478
0
    for (size_t i = 0; i < datum->n; i++) {
1479
0
        if (!row->n_protocols) {
1480
0
            row->protocols = xmalloc(datum->n * sizeof *row->protocols);
1481
0
        }
1482
0
        row->protocols[row->n_protocols] = CONST_CAST(char *, json_string(datum->keys[i].s));
1483
0
        row->n_protocols++;
1484
0
    }
1485
0
}
1486
1487
static void
1488
ovsrec_bridge_parse_rstp_enable(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1489
0
{
1490
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1491
1492
0
    if (datum->n >= 1) {
1493
0
        row->rstp_enable = datum->keys[0].boolean;
1494
0
    } else {
1495
0
        row->rstp_enable = false;
1496
0
    }
1497
0
}
1498
1499
static void
1500
ovsrec_bridge_parse_rstp_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1501
0
{
1502
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1503
0
    smap_init(&row->rstp_status);
1504
0
    for (size_t i = 0; i < datum->n; i++) {
1505
0
        smap_add(&row->rstp_status,
1506
0
                 json_string(datum->keys[i].s),
1507
0
                 json_string(datum->values[i].s));
1508
0
    }
1509
0
}
1510
1511
static void
1512
ovsrec_bridge_parse_sflow(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1513
0
{
1514
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1515
1516
0
    if (datum->n >= 1) {
1517
0
        row->sflow = ovsrec_sflow_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_sflow, &datum->keys[0].uuid));
1518
0
    } else {
1519
0
        row->sflow = NULL;
1520
0
    }
1521
0
}
1522
1523
static void
1524
ovsrec_bridge_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1525
0
{
1526
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1527
0
    smap_init(&row->status);
1528
0
    for (size_t i = 0; i < datum->n; i++) {
1529
0
        smap_add(&row->status,
1530
0
                 json_string(datum->keys[i].s),
1531
0
                 json_string(datum->values[i].s));
1532
0
    }
1533
0
}
1534
1535
static void
1536
ovsrec_bridge_parse_stp_enable(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1537
0
{
1538
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1539
1540
0
    if (datum->n >= 1) {
1541
0
        row->stp_enable = datum->keys[0].boolean;
1542
0
    } else {
1543
0
        row->stp_enable = false;
1544
0
    }
1545
0
}
1546
1547
static void
1548
ovsrec_bridge_unparse_auto_attach(struct ovsdb_idl_row *row OVS_UNUSED)
1549
0
{
1550
    /* Nothing to do. */
1551
0
}
1552
1553
static void
1554
ovsrec_bridge_unparse_controller(struct ovsdb_idl_row *row_)
1555
0
{
1556
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1557
0
    free(row->controller);
1558
0
}
1559
1560
static void
1561
ovsrec_bridge_unparse_datapath_id(struct ovsdb_idl_row *row OVS_UNUSED)
1562
0
{
1563
    /* Nothing to do. */
1564
0
}
1565
1566
static void
1567
ovsrec_bridge_unparse_datapath_type(struct ovsdb_idl_row *row OVS_UNUSED)
1568
0
{
1569
    /* Nothing to do. */
1570
0
}
1571
1572
static void
1573
ovsrec_bridge_unparse_datapath_version(struct ovsdb_idl_row *row OVS_UNUSED)
1574
0
{
1575
    /* Nothing to do. */
1576
0
}
1577
1578
static void
1579
ovsrec_bridge_unparse_external_ids(struct ovsdb_idl_row *row_)
1580
0
{
1581
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1582
0
    smap_destroy(&row->external_ids);
1583
0
}
1584
1585
static void
1586
ovsrec_bridge_unparse_fail_mode(struct ovsdb_idl_row *row OVS_UNUSED)
1587
0
{
1588
    /* Nothing to do. */
1589
0
}
1590
1591
static void
1592
ovsrec_bridge_unparse_flood_vlans(struct ovsdb_idl_row *row_)
1593
0
{
1594
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1595
0
    free(row->flood_vlans);
1596
0
}
1597
1598
static void
1599
ovsrec_bridge_unparse_flow_tables(struct ovsdb_idl_row *row_)
1600
0
{
1601
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1602
0
    free(row->key_flow_tables);
1603
0
    free(row->value_flow_tables);
1604
0
}
1605
1606
static void
1607
ovsrec_bridge_unparse_ipfix(struct ovsdb_idl_row *row OVS_UNUSED)
1608
0
{
1609
    /* Nothing to do. */
1610
0
}
1611
1612
static void
1613
ovsrec_bridge_unparse_mcast_snooping_enable(struct ovsdb_idl_row *row OVS_UNUSED)
1614
0
{
1615
    /* Nothing to do. */
1616
0
}
1617
1618
static void
1619
ovsrec_bridge_unparse_mirrors(struct ovsdb_idl_row *row_)
1620
0
{
1621
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1622
0
    free(row->mirrors);
1623
0
}
1624
1625
static void
1626
ovsrec_bridge_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
1627
0
{
1628
    /* Nothing to do. */
1629
0
}
1630
1631
static void
1632
ovsrec_bridge_unparse_netflow(struct ovsdb_idl_row *row OVS_UNUSED)
1633
0
{
1634
    /* Nothing to do. */
1635
0
}
1636
1637
static void
1638
ovsrec_bridge_unparse_other_config(struct ovsdb_idl_row *row_)
1639
0
{
1640
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1641
0
    smap_destroy(&row->other_config);
1642
0
}
1643
1644
static void
1645
ovsrec_bridge_unparse_ports(struct ovsdb_idl_row *row_)
1646
0
{
1647
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1648
0
    free(row->ports);
1649
0
}
1650
1651
static void
1652
ovsrec_bridge_unparse_protocols(struct ovsdb_idl_row *row_)
1653
0
{
1654
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1655
0
    free(row->protocols);
1656
0
}
1657
1658
static void
1659
ovsrec_bridge_unparse_rstp_enable(struct ovsdb_idl_row *row OVS_UNUSED)
1660
0
{
1661
    /* Nothing to do. */
1662
0
}
1663
1664
static void
1665
ovsrec_bridge_unparse_rstp_status(struct ovsdb_idl_row *row_)
1666
0
{
1667
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1668
0
    smap_destroy(&row->rstp_status);
1669
0
}
1670
1671
static void
1672
ovsrec_bridge_unparse_sflow(struct ovsdb_idl_row *row OVS_UNUSED)
1673
0
{
1674
    /* Nothing to do. */
1675
0
}
1676
1677
static void
1678
ovsrec_bridge_unparse_status(struct ovsdb_idl_row *row_)
1679
0
{
1680
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1681
0
    smap_destroy(&row->status);
1682
0
}
1683
1684
static void
1685
ovsrec_bridge_unparse_stp_enable(struct ovsdb_idl_row *row OVS_UNUSED)
1686
0
{
1687
    /* Nothing to do. */
1688
0
}
1689
1690
static void
1691
ovsrec_bridge_init__(struct ovsdb_idl_row *row)
1692
0
{
1693
0
    ovsrec_bridge_init(ovsrec_bridge_cast(row));
1694
0
}
1695
1696
/* Clears the contents of 'row' in table "Bridge". */
1697
void
1698
ovsrec_bridge_init(struct ovsrec_bridge *row)
1699
0
{
1700
0
    memset(row, 0, sizeof *row); 
1701
0
    row->datapath_type = "";
1702
0
    row->datapath_version = "";
1703
0
    smap_init(&row->external_ids);
1704
0
    row->name = "";
1705
0
    smap_init(&row->other_config);
1706
0
    smap_init(&row->rstp_status);
1707
0
    smap_init(&row->status);
1708
0
}
1709
1710
/* Searches table "Bridge" in 'idl' for a row with UUID 'uuid'.  Returns
1711
 * a pointer to the row if there is one, otherwise a null pointer.  */
1712
const struct ovsrec_bridge *
1713
ovsrec_bridge_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
1714
0
{
1715
0
    return ovsrec_bridge_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_bridge, uuid));
1716
0
}
1717
1718
/* Searches table "Bridge" for a row with UUID 'uuid'.  Returns
1719
 * a pointer to the row if there is one, otherwise a null pointer.  */
1720
const struct ovsrec_bridge *
1721
ovsrec_bridge_table_get_for_uuid(const struct ovsrec_bridge_table *table, const struct uuid *uuid)
1722
0
{
1723
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
1724
0
    return ovsrec_bridge_get_for_uuid(idl, uuid);
1725
0
}
1726
1727
/* Returns a row in table "Bridge" in 'idl', or a null pointer if that
1728
 * table is empty.
1729
 *
1730
 * Database tables are internally maintained as hash tables, so adding or
1731
 * removing rows while traversing the same table can cause some rows to be
1732
 * visited twice or not at apply. */
1733
const struct ovsrec_bridge *
1734
ovsrec_bridge_first(const struct ovsdb_idl *idl)
1735
0
{
1736
0
    return ovsrec_bridge_cast(ovsdb_idl_first_row(idl, &ovsrec_table_bridge));
1737
0
}
1738
1739
/* Returns a row following 'row' within its table, or a null pointer if 'row'
1740
 * is the last row in its table. */
1741
const struct ovsrec_bridge *
1742
ovsrec_bridge_next(const struct ovsrec_bridge *row)
1743
0
{
1744
0
    return ovsrec_bridge_cast(ovsdb_idl_next_row(&row->header_));
1745
0
}
1746
1747
unsigned int ovsrec_bridge_get_seqno(const struct ovsdb_idl *idl)
1748
0
{
1749
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_bridge);
1750
0
}
1751
1752
unsigned int ovsrec_bridge_row_get_seqno(const struct ovsrec_bridge *row, enum ovsdb_idl_change change)
1753
0
{
1754
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
1755
0
}
1756
1757
const struct ovsrec_bridge *
1758
ovsrec_bridge_track_get_first(const struct ovsdb_idl *idl)
1759
0
{
1760
0
    return ovsrec_bridge_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_bridge));
1761
0
}
1762
1763
const struct ovsrec_bridge
1764
*ovsrec_bridge_track_get_next(const struct ovsrec_bridge *row)
1765
0
{
1766
0
    return ovsrec_bridge_cast(ovsdb_idl_track_get_next(&row->header_));
1767
0
}
1768
1769
1770
/* Deletes 'row' from table "Bridge".  'row' may be freed, so it must not be
1771
 * accessed afterward.
1772
 *
1773
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1774
void
1775
ovsrec_bridge_delete(const struct ovsrec_bridge *row)
1776
0
{
1777
0
    ovsdb_idl_txn_delete(&row->header_);
1778
0
}
1779
1780
/* Inserts and returns a new row in the table "Bridge" in the database
1781
 * with open transaction 'txn'.
1782
 *
1783
 * The new row is assigned a randomly generated provisional UUID.
1784
 * ovsdb-server will assign a different UUID when 'txn' is committed,
1785
 * but the IDL will replace any uses of the provisional UUID in the
1786
 * data to be to be committed by the UUID assigned by ovsdb-server. */
1787
struct ovsrec_bridge *
1788
ovsrec_bridge_insert(struct ovsdb_idl_txn *txn)
1789
0
{
1790
0
    return ovsrec_bridge_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_bridge, NULL));
1791
0
}
1792
1793
/* Inserts and returns a new row in the table "Bridge" in the database
1794
 * with open transaction 'txn'.
1795
 *
1796
 * The new row is assigned the UUID specified in the 'uuid' parameter
1797
 * (which cannot be null).  ovsdb-server will try to assign the same
1798
 * UUID when 'txn' is committed. */
1799
struct ovsrec_bridge *
1800
ovsrec_bridge_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
1801
0
{
1802
0
    return ovsrec_bridge_cast(ovsdb_idl_txn_insert_persist_uuid(
1803
0
        txn, &ovsrec_table_bridge, uuid));
1804
0
}
1805
1806
bool
1807
ovsrec_bridge_is_updated(const struct ovsrec_bridge *row, enum ovsrec_bridge_column_id column)
1808
0
{
1809
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_bridge_columns[column]);
1810
0
}
1811
1812
/* Causes the original contents of column "auto_attach" in 'row' to be
1813
 * verified as a prerequisite to completing the transaction.  That is, if
1814
 * "auto_attach" in 'row' changed (or if 'row' was deleted) between the
1815
 * time that the IDL originally read its contents and the time that the
1816
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1817
 *
1818
 * The intention is that, to ensure that no transaction commits based on dirty
1819
 * reads, an application should call this function any time "auto_attach" is
1820
 * read as part of a read-modify-write operation.
1821
 *
1822
 * In some cases this function reduces to a no-op, because the current value
1823
 * of "auto_attach" is already known:
1824
 *
1825
 *   - If 'row' is a row created by the current transaction (returned by
1826
 *     ovsrec_bridge_insert()).
1827
 *
1828
 *   - If "auto_attach" has already been modified (with
1829
 *     ovsrec_bridge_set_auto_attach()) within the current transaction.
1830
 *
1831
 * Because of the latter property, always call this function *before*
1832
 * ovsrec_bridge_set_auto_attach() for a given read-modify-write.
1833
 *
1834
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1835
void
1836
ovsrec_bridge_verify_auto_attach(const struct ovsrec_bridge *row)
1837
0
{
1838
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_auto_attach);
1839
0
}
1840
1841
/* Causes the original contents of column "controller" in 'row' to be
1842
 * verified as a prerequisite to completing the transaction.  That is, if
1843
 * "controller" in 'row' changed (or if 'row' was deleted) between the
1844
 * time that the IDL originally read its contents and the time that the
1845
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1846
 *
1847
 * The intention is that, to ensure that no transaction commits based on dirty
1848
 * reads, an application should call this function any time "controller" is
1849
 * read as part of a read-modify-write operation.
1850
 *
1851
 * In some cases this function reduces to a no-op, because the current value
1852
 * of "controller" is already known:
1853
 *
1854
 *   - If 'row' is a row created by the current transaction (returned by
1855
 *     ovsrec_bridge_insert()).
1856
 *
1857
 *   - If "controller" has already been modified (with
1858
 *     ovsrec_bridge_set_controller()) within the current transaction.
1859
 *
1860
 * Because of the latter property, always call this function *before*
1861
 * ovsrec_bridge_set_controller() for a given read-modify-write.
1862
 *
1863
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1864
void
1865
ovsrec_bridge_verify_controller(const struct ovsrec_bridge *row)
1866
0
{
1867
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_controller);
1868
0
}
1869
1870
/* Causes the original contents of column "datapath_id" in 'row' to be
1871
 * verified as a prerequisite to completing the transaction.  That is, if
1872
 * "datapath_id" in 'row' changed (or if 'row' was deleted) between the
1873
 * time that the IDL originally read its contents and the time that the
1874
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1875
 *
1876
 * The intention is that, to ensure that no transaction commits based on dirty
1877
 * reads, an application should call this function any time "datapath_id" is
1878
 * read as part of a read-modify-write operation.
1879
 *
1880
 * In some cases this function reduces to a no-op, because the current value
1881
 * of "datapath_id" is already known:
1882
 *
1883
 *   - If 'row' is a row created by the current transaction (returned by
1884
 *     ovsrec_bridge_insert()).
1885
 *
1886
 *   - If "datapath_id" has already been modified (with
1887
 *     ovsrec_bridge_set_datapath_id()) within the current transaction.
1888
 *
1889
 * Because of the latter property, always call this function *before*
1890
 * ovsrec_bridge_set_datapath_id() for a given read-modify-write.
1891
 *
1892
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1893
void
1894
ovsrec_bridge_verify_datapath_id(const struct ovsrec_bridge *row)
1895
0
{
1896
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_datapath_id);
1897
0
}
1898
1899
/* Causes the original contents of column "datapath_type" in 'row' to be
1900
 * verified as a prerequisite to completing the transaction.  That is, if
1901
 * "datapath_type" in 'row' changed (or if 'row' was deleted) between the
1902
 * time that the IDL originally read its contents and the time that the
1903
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1904
 *
1905
 * The intention is that, to ensure that no transaction commits based on dirty
1906
 * reads, an application should call this function any time "datapath_type" is
1907
 * read as part of a read-modify-write operation.
1908
 *
1909
 * In some cases this function reduces to a no-op, because the current value
1910
 * of "datapath_type" is already known:
1911
 *
1912
 *   - If 'row' is a row created by the current transaction (returned by
1913
 *     ovsrec_bridge_insert()).
1914
 *
1915
 *   - If "datapath_type" has already been modified (with
1916
 *     ovsrec_bridge_set_datapath_type()) within the current transaction.
1917
 *
1918
 * Because of the latter property, always call this function *before*
1919
 * ovsrec_bridge_set_datapath_type() for a given read-modify-write.
1920
 *
1921
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1922
void
1923
ovsrec_bridge_verify_datapath_type(const struct ovsrec_bridge *row)
1924
0
{
1925
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_datapath_type);
1926
0
}
1927
1928
/* Causes the original contents of column "datapath_version" in 'row' to be
1929
 * verified as a prerequisite to completing the transaction.  That is, if
1930
 * "datapath_version" in 'row' changed (or if 'row' was deleted) between the
1931
 * time that the IDL originally read its contents and the time that the
1932
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1933
 *
1934
 * The intention is that, to ensure that no transaction commits based on dirty
1935
 * reads, an application should call this function any time "datapath_version" is
1936
 * read as part of a read-modify-write operation.
1937
 *
1938
 * In some cases this function reduces to a no-op, because the current value
1939
 * of "datapath_version" is already known:
1940
 *
1941
 *   - If 'row' is a row created by the current transaction (returned by
1942
 *     ovsrec_bridge_insert()).
1943
 *
1944
 *   - If "datapath_version" has already been modified (with
1945
 *     ovsrec_bridge_set_datapath_version()) within the current transaction.
1946
 *
1947
 * Because of the latter property, always call this function *before*
1948
 * ovsrec_bridge_set_datapath_version() for a given read-modify-write.
1949
 *
1950
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1951
void
1952
ovsrec_bridge_verify_datapath_version(const struct ovsrec_bridge *row)
1953
0
{
1954
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_datapath_version);
1955
0
}
1956
1957
/* Causes the original contents of column "external_ids" in 'row' to be
1958
 * verified as a prerequisite to completing the transaction.  That is, if
1959
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
1960
 * time that the IDL originally read its contents and the time that the
1961
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1962
 *
1963
 * The intention is that, to ensure that no transaction commits based on dirty
1964
 * reads, an application should call this function any time "external_ids" is
1965
 * read as part of a read-modify-write operation.
1966
 *
1967
 * In some cases this function reduces to a no-op, because the current value
1968
 * of "external_ids" is already known:
1969
 *
1970
 *   - If 'row' is a row created by the current transaction (returned by
1971
 *     ovsrec_bridge_insert()).
1972
 *
1973
 *   - If "external_ids" has already been modified (with
1974
 *     ovsrec_bridge_set_external_ids()) within the current transaction.
1975
 *
1976
 * Because of the latter property, always call this function *before*
1977
 * ovsrec_bridge_set_external_ids() for a given read-modify-write.
1978
 *
1979
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1980
void
1981
ovsrec_bridge_verify_external_ids(const struct ovsrec_bridge *row)
1982
0
{
1983
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_external_ids);
1984
0
}
1985
1986
/* Causes the original contents of column "fail_mode" in 'row' to be
1987
 * verified as a prerequisite to completing the transaction.  That is, if
1988
 * "fail_mode" in 'row' changed (or if 'row' was deleted) between the
1989
 * time that the IDL originally read its contents and the time that the
1990
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1991
 *
1992
 * The intention is that, to ensure that no transaction commits based on dirty
1993
 * reads, an application should call this function any time "fail_mode" is
1994
 * read as part of a read-modify-write operation.
1995
 *
1996
 * In some cases this function reduces to a no-op, because the current value
1997
 * of "fail_mode" is already known:
1998
 *
1999
 *   - If 'row' is a row created by the current transaction (returned by
2000
 *     ovsrec_bridge_insert()).
2001
 *
2002
 *   - If "fail_mode" has already been modified (with
2003
 *     ovsrec_bridge_set_fail_mode()) within the current transaction.
2004
 *
2005
 * Because of the latter property, always call this function *before*
2006
 * ovsrec_bridge_set_fail_mode() for a given read-modify-write.
2007
 *
2008
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2009
void
2010
ovsrec_bridge_verify_fail_mode(const struct ovsrec_bridge *row)
2011
0
{
2012
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_fail_mode);
2013
0
}
2014
2015
/* Causes the original contents of column "flood_vlans" in 'row' to be
2016
 * verified as a prerequisite to completing the transaction.  That is, if
2017
 * "flood_vlans" 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 aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2020
 *
2021
 * The intention is that, to ensure that no transaction commits based on dirty
2022
 * reads, an application should call this function any time "flood_vlans" is
2023
 * read as part of a read-modify-write operation.
2024
 *
2025
 * In some cases this function reduces to a no-op, because the current value
2026
 * of "flood_vlans" is already known:
2027
 *
2028
 *   - If 'row' is a row created by the current transaction (returned by
2029
 *     ovsrec_bridge_insert()).
2030
 *
2031
 *   - If "flood_vlans" has already been modified (with
2032
 *     ovsrec_bridge_set_flood_vlans()) within the current transaction.
2033
 *
2034
 * Because of the latter property, always call this function *before*
2035
 * ovsrec_bridge_set_flood_vlans() for a given read-modify-write.
2036
 *
2037
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2038
void
2039
ovsrec_bridge_verify_flood_vlans(const struct ovsrec_bridge *row)
2040
0
{
2041
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_flood_vlans);
2042
0
}
2043
2044
/* Causes the original contents of column "flow_tables" in 'row' to be
2045
 * verified as a prerequisite to completing the transaction.  That is, if
2046
 * "flow_tables" in 'row' changed (or if 'row' was deleted) between the
2047
 * time that the IDL originally read its contents and the time that the
2048
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2049
 *
2050
 * The intention is that, to ensure that no transaction commits based on dirty
2051
 * reads, an application should call this function any time "flow_tables" is
2052
 * read as part of a read-modify-write operation.
2053
 *
2054
 * In some cases this function reduces to a no-op, because the current value
2055
 * of "flow_tables" is already known:
2056
 *
2057
 *   - If 'row' is a row created by the current transaction (returned by
2058
 *     ovsrec_bridge_insert()).
2059
 *
2060
 *   - If "flow_tables" has already been modified (with
2061
 *     ovsrec_bridge_set_flow_tables()) within the current transaction.
2062
 *
2063
 * Because of the latter property, always call this function *before*
2064
 * ovsrec_bridge_set_flow_tables() for a given read-modify-write.
2065
 *
2066
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2067
void
2068
ovsrec_bridge_verify_flow_tables(const struct ovsrec_bridge *row)
2069
0
{
2070
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_flow_tables);
2071
0
}
2072
2073
/* Causes the original contents of column "ipfix" in 'row' to be
2074
 * verified as a prerequisite to completing the transaction.  That is, if
2075
 * "ipfix" in 'row' changed (or if 'row' was deleted) between the
2076
 * time that the IDL originally read its contents and the time that the
2077
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2078
 *
2079
 * The intention is that, to ensure that no transaction commits based on dirty
2080
 * reads, an application should call this function any time "ipfix" is
2081
 * read as part of a read-modify-write operation.
2082
 *
2083
 * In some cases this function reduces to a no-op, because the current value
2084
 * of "ipfix" is already known:
2085
 *
2086
 *   - If 'row' is a row created by the current transaction (returned by
2087
 *     ovsrec_bridge_insert()).
2088
 *
2089
 *   - If "ipfix" has already been modified (with
2090
 *     ovsrec_bridge_set_ipfix()) within the current transaction.
2091
 *
2092
 * Because of the latter property, always call this function *before*
2093
 * ovsrec_bridge_set_ipfix() for a given read-modify-write.
2094
 *
2095
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2096
void
2097
ovsrec_bridge_verify_ipfix(const struct ovsrec_bridge *row)
2098
0
{
2099
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_ipfix);
2100
0
}
2101
2102
/* Causes the original contents of column "mcast_snooping_enable" in 'row' to be
2103
 * verified as a prerequisite to completing the transaction.  That is, if
2104
 * "mcast_snooping_enable" in 'row' changed (or if 'row' was deleted) between the
2105
 * time that the IDL originally read its contents and the time that the
2106
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2107
 *
2108
 * The intention is that, to ensure that no transaction commits based on dirty
2109
 * reads, an application should call this function any time "mcast_snooping_enable" is
2110
 * read as part of a read-modify-write operation.
2111
 *
2112
 * In some cases this function reduces to a no-op, because the current value
2113
 * of "mcast_snooping_enable" is already known:
2114
 *
2115
 *   - If 'row' is a row created by the current transaction (returned by
2116
 *     ovsrec_bridge_insert()).
2117
 *
2118
 *   - If "mcast_snooping_enable" has already been modified (with
2119
 *     ovsrec_bridge_set_mcast_snooping_enable()) within the current transaction.
2120
 *
2121
 * Because of the latter property, always call this function *before*
2122
 * ovsrec_bridge_set_mcast_snooping_enable() for a given read-modify-write.
2123
 *
2124
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2125
void
2126
ovsrec_bridge_verify_mcast_snooping_enable(const struct ovsrec_bridge *row)
2127
0
{
2128
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_mcast_snooping_enable);
2129
0
}
2130
2131
/* Causes the original contents of column "mirrors" in 'row' to be
2132
 * verified as a prerequisite to completing the transaction.  That is, if
2133
 * "mirrors" in 'row' changed (or if 'row' was deleted) between the
2134
 * time that the IDL originally read its contents and the time that the
2135
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2136
 *
2137
 * The intention is that, to ensure that no transaction commits based on dirty
2138
 * reads, an application should call this function any time "mirrors" is
2139
 * read as part of a read-modify-write operation.
2140
 *
2141
 * In some cases this function reduces to a no-op, because the current value
2142
 * of "mirrors" is already known:
2143
 *
2144
 *   - If 'row' is a row created by the current transaction (returned by
2145
 *     ovsrec_bridge_insert()).
2146
 *
2147
 *   - If "mirrors" has already been modified (with
2148
 *     ovsrec_bridge_set_mirrors()) within the current transaction.
2149
 *
2150
 * Because of the latter property, always call this function *before*
2151
 * ovsrec_bridge_set_mirrors() for a given read-modify-write.
2152
 *
2153
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2154
void
2155
ovsrec_bridge_verify_mirrors(const struct ovsrec_bridge *row)
2156
0
{
2157
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_mirrors);
2158
0
}
2159
2160
/* Causes the original contents of column "name" in 'row' to be
2161
 * verified as a prerequisite to completing the transaction.  That is, if
2162
 * "name" in 'row' changed (or if 'row' was deleted) between the
2163
 * time that the IDL originally read its contents and the time that the
2164
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2165
 *
2166
 * The intention is that, to ensure that no transaction commits based on dirty
2167
 * reads, an application should call this function any time "name" is
2168
 * read as part of a read-modify-write operation.
2169
 *
2170
 * In some cases this function reduces to a no-op, because the current value
2171
 * of "name" is already known:
2172
 *
2173
 *   - If 'row' is a row created by the current transaction (returned by
2174
 *     ovsrec_bridge_insert()).
2175
 *
2176
 *   - If "name" has already been modified (with
2177
 *     ovsrec_bridge_set_name()) within the current transaction.
2178
 *
2179
 * Because of the latter property, always call this function *before*
2180
 * ovsrec_bridge_set_name() for a given read-modify-write.
2181
 *
2182
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2183
void
2184
ovsrec_bridge_verify_name(const struct ovsrec_bridge *row)
2185
0
{
2186
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_name);
2187
0
}
2188
2189
/* Causes the original contents of column "netflow" in 'row' to be
2190
 * verified as a prerequisite to completing the transaction.  That is, if
2191
 * "netflow" in 'row' changed (or if 'row' was deleted) between the
2192
 * time that the IDL originally read its contents and the time that the
2193
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2194
 *
2195
 * The intention is that, to ensure that no transaction commits based on dirty
2196
 * reads, an application should call this function any time "netflow" is
2197
 * read as part of a read-modify-write operation.
2198
 *
2199
 * In some cases this function reduces to a no-op, because the current value
2200
 * of "netflow" is already known:
2201
 *
2202
 *   - If 'row' is a row created by the current transaction (returned by
2203
 *     ovsrec_bridge_insert()).
2204
 *
2205
 *   - If "netflow" has already been modified (with
2206
 *     ovsrec_bridge_set_netflow()) within the current transaction.
2207
 *
2208
 * Because of the latter property, always call this function *before*
2209
 * ovsrec_bridge_set_netflow() for a given read-modify-write.
2210
 *
2211
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2212
void
2213
ovsrec_bridge_verify_netflow(const struct ovsrec_bridge *row)
2214
0
{
2215
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_netflow);
2216
0
}
2217
2218
/* Causes the original contents of column "other_config" in 'row' to be
2219
 * verified as a prerequisite to completing the transaction.  That is, if
2220
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
2221
 * time that the IDL originally read its contents and the time that the
2222
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2223
 *
2224
 * The intention is that, to ensure that no transaction commits based on dirty
2225
 * reads, an application should call this function any time "other_config" is
2226
 * read as part of a read-modify-write operation.
2227
 *
2228
 * In some cases this function reduces to a no-op, because the current value
2229
 * of "other_config" is already known:
2230
 *
2231
 *   - If 'row' is a row created by the current transaction (returned by
2232
 *     ovsrec_bridge_insert()).
2233
 *
2234
 *   - If "other_config" has already been modified (with
2235
 *     ovsrec_bridge_set_other_config()) within the current transaction.
2236
 *
2237
 * Because of the latter property, always call this function *before*
2238
 * ovsrec_bridge_set_other_config() for a given read-modify-write.
2239
 *
2240
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2241
void
2242
ovsrec_bridge_verify_other_config(const struct ovsrec_bridge *row)
2243
0
{
2244
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_other_config);
2245
0
}
2246
2247
/* Causes the original contents of column "ports" in 'row' to be
2248
 * verified as a prerequisite to completing the transaction.  That is, if
2249
 * "ports" in 'row' changed (or if 'row' was deleted) between the
2250
 * time that the IDL originally read its contents and the time that the
2251
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2252
 *
2253
 * The intention is that, to ensure that no transaction commits based on dirty
2254
 * reads, an application should call this function any time "ports" is
2255
 * read as part of a read-modify-write operation.
2256
 *
2257
 * In some cases this function reduces to a no-op, because the current value
2258
 * of "ports" is already known:
2259
 *
2260
 *   - If 'row' is a row created by the current transaction (returned by
2261
 *     ovsrec_bridge_insert()).
2262
 *
2263
 *   - If "ports" has already been modified (with
2264
 *     ovsrec_bridge_set_ports()) within the current transaction.
2265
 *
2266
 * Because of the latter property, always call this function *before*
2267
 * ovsrec_bridge_set_ports() for a given read-modify-write.
2268
 *
2269
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2270
void
2271
ovsrec_bridge_verify_ports(const struct ovsrec_bridge *row)
2272
0
{
2273
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_ports);
2274
0
}
2275
2276
/* Causes the original contents of column "protocols" in 'row' to be
2277
 * verified as a prerequisite to completing the transaction.  That is, if
2278
 * "protocols" in 'row' changed (or if 'row' was deleted) between the
2279
 * time that the IDL originally read its contents and the time that the
2280
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2281
 *
2282
 * The intention is that, to ensure that no transaction commits based on dirty
2283
 * reads, an application should call this function any time "protocols" is
2284
 * read as part of a read-modify-write operation.
2285
 *
2286
 * In some cases this function reduces to a no-op, because the current value
2287
 * of "protocols" is already known:
2288
 *
2289
 *   - If 'row' is a row created by the current transaction (returned by
2290
 *     ovsrec_bridge_insert()).
2291
 *
2292
 *   - If "protocols" has already been modified (with
2293
 *     ovsrec_bridge_set_protocols()) within the current transaction.
2294
 *
2295
 * Because of the latter property, always call this function *before*
2296
 * ovsrec_bridge_set_protocols() for a given read-modify-write.
2297
 *
2298
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2299
void
2300
ovsrec_bridge_verify_protocols(const struct ovsrec_bridge *row)
2301
0
{
2302
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_protocols);
2303
0
}
2304
2305
/* Causes the original contents of column "rstp_enable" in 'row' to be
2306
 * verified as a prerequisite to completing the transaction.  That is, if
2307
 * "rstp_enable" in 'row' changed (or if 'row' was deleted) between the
2308
 * time that the IDL originally read its contents and the time that the
2309
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2310
 *
2311
 * The intention is that, to ensure that no transaction commits based on dirty
2312
 * reads, an application should call this function any time "rstp_enable" is
2313
 * read as part of a read-modify-write operation.
2314
 *
2315
 * In some cases this function reduces to a no-op, because the current value
2316
 * of "rstp_enable" is already known:
2317
 *
2318
 *   - If 'row' is a row created by the current transaction (returned by
2319
 *     ovsrec_bridge_insert()).
2320
 *
2321
 *   - If "rstp_enable" has already been modified (with
2322
 *     ovsrec_bridge_set_rstp_enable()) within the current transaction.
2323
 *
2324
 * Because of the latter property, always call this function *before*
2325
 * ovsrec_bridge_set_rstp_enable() for a given read-modify-write.
2326
 *
2327
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2328
void
2329
ovsrec_bridge_verify_rstp_enable(const struct ovsrec_bridge *row)
2330
0
{
2331
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_rstp_enable);
2332
0
}
2333
2334
/* Causes the original contents of column "rstp_status" in 'row' to be
2335
 * verified as a prerequisite to completing the transaction.  That is, if
2336
 * "rstp_status" in 'row' changed (or if 'row' was deleted) between the
2337
 * time that the IDL originally read its contents and the time that the
2338
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2339
 *
2340
 * The intention is that, to ensure that no transaction commits based on dirty
2341
 * reads, an application should call this function any time "rstp_status" is
2342
 * read as part of a read-modify-write operation.
2343
 *
2344
 * In some cases this function reduces to a no-op, because the current value
2345
 * of "rstp_status" is already known:
2346
 *
2347
 *   - If 'row' is a row created by the current transaction (returned by
2348
 *     ovsrec_bridge_insert()).
2349
 *
2350
 *   - If "rstp_status" has already been modified (with
2351
 *     ovsrec_bridge_set_rstp_status()) within the current transaction.
2352
 *
2353
 * Because of the latter property, always call this function *before*
2354
 * ovsrec_bridge_set_rstp_status() for a given read-modify-write.
2355
 *
2356
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2357
void
2358
ovsrec_bridge_verify_rstp_status(const struct ovsrec_bridge *row)
2359
0
{
2360
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_rstp_status);
2361
0
}
2362
2363
/* Causes the original contents of column "sflow" in 'row' to be
2364
 * verified as a prerequisite to completing the transaction.  That is, if
2365
 * "sflow" in 'row' changed (or if 'row' was deleted) between the
2366
 * time that the IDL originally read its contents and the time that the
2367
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2368
 *
2369
 * The intention is that, to ensure that no transaction commits based on dirty
2370
 * reads, an application should call this function any time "sflow" is
2371
 * read as part of a read-modify-write operation.
2372
 *
2373
 * In some cases this function reduces to a no-op, because the current value
2374
 * of "sflow" is already known:
2375
 *
2376
 *   - If 'row' is a row created by the current transaction (returned by
2377
 *     ovsrec_bridge_insert()).
2378
 *
2379
 *   - If "sflow" has already been modified (with
2380
 *     ovsrec_bridge_set_sflow()) within the current transaction.
2381
 *
2382
 * Because of the latter property, always call this function *before*
2383
 * ovsrec_bridge_set_sflow() for a given read-modify-write.
2384
 *
2385
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2386
void
2387
ovsrec_bridge_verify_sflow(const struct ovsrec_bridge *row)
2388
0
{
2389
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_sflow);
2390
0
}
2391
2392
/* Causes the original contents of column "status" in 'row' to be
2393
 * verified as a prerequisite to completing the transaction.  That is, if
2394
 * "status" in 'row' changed (or if 'row' was deleted) between the
2395
 * time that the IDL originally read its contents and the time that the
2396
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2397
 *
2398
 * The intention is that, to ensure that no transaction commits based on dirty
2399
 * reads, an application should call this function any time "status" is
2400
 * read as part of a read-modify-write operation.
2401
 *
2402
 * In some cases this function reduces to a no-op, because the current value
2403
 * of "status" is already known:
2404
 *
2405
 *   - If 'row' is a row created by the current transaction (returned by
2406
 *     ovsrec_bridge_insert()).
2407
 *
2408
 *   - If "status" has already been modified (with
2409
 *     ovsrec_bridge_set_status()) within the current transaction.
2410
 *
2411
 * Because of the latter property, always call this function *before*
2412
 * ovsrec_bridge_set_status() for a given read-modify-write.
2413
 *
2414
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2415
void
2416
ovsrec_bridge_verify_status(const struct ovsrec_bridge *row)
2417
0
{
2418
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_status);
2419
0
}
2420
2421
/* Causes the original contents of column "stp_enable" in 'row' to be
2422
 * verified as a prerequisite to completing the transaction.  That is, if
2423
 * "stp_enable" in 'row' changed (or if 'row' was deleted) between the
2424
 * time that the IDL originally read its contents and the time that the
2425
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2426
 *
2427
 * The intention is that, to ensure that no transaction commits based on dirty
2428
 * reads, an application should call this function any time "stp_enable" is
2429
 * read as part of a read-modify-write operation.
2430
 *
2431
 * In some cases this function reduces to a no-op, because the current value
2432
 * of "stp_enable" is already known:
2433
 *
2434
 *   - If 'row' is a row created by the current transaction (returned by
2435
 *     ovsrec_bridge_insert()).
2436
 *
2437
 *   - If "stp_enable" has already been modified (with
2438
 *     ovsrec_bridge_set_stp_enable()) within the current transaction.
2439
 *
2440
 * Because of the latter property, always call this function *before*
2441
 * ovsrec_bridge_set_stp_enable() for a given read-modify-write.
2442
 *
2443
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2444
void
2445
ovsrec_bridge_verify_stp_enable(const struct ovsrec_bridge *row)
2446
0
{
2447
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_stp_enable);
2448
0
}
2449
2450
/* Returns the "auto_attach" column's value from the "Bridge" table in 'row'
2451
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2452
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2453
 * for a given key than implementing the same operation on the "cooked"
2454
 * form in 'row'.
2455
 *
2456
 * 'key_type' must be OVSDB_TYPE_UUID.
2457
 * (This helps to avoid silent bugs if someone changes auto_attach's
2458
 * type without updating the caller.)
2459
 *
2460
 * The caller must not modify or free the returned value.
2461
 *
2462
 * Various kinds of changes can invalidate the returned value: modifying
2463
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2464
 * If the returned value is needed for a long time, it is best to make a copy
2465
 * of it with ovsdb_datum_clone().
2466
 *
2467
 * This function is rarely useful, since it is easier to access the value
2468
 * directly through the "auto_attach" member in ovsrec_bridge. */
2469
const struct ovsdb_datum *
2470
ovsrec_bridge_get_auto_attach(const struct ovsrec_bridge *row,
2471
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2472
0
{
2473
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2474
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_auto_attach);
2475
0
}
2476
2477
/* Returns the "controller" column's value from the "Bridge" table in 'row'
2478
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2479
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2480
 * for a given key than implementing the same operation on the "cooked"
2481
 * form in 'row'.
2482
 *
2483
 * 'key_type' must be OVSDB_TYPE_UUID.
2484
 * (This helps to avoid silent bugs if someone changes controller's
2485
 * type without updating the caller.)
2486
 *
2487
 * The caller must not modify or free the returned value.
2488
 *
2489
 * Various kinds of changes can invalidate the returned value: modifying
2490
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2491
 * If the returned value is needed for a long time, it is best to make a copy
2492
 * of it with ovsdb_datum_clone().
2493
 *
2494
 * This function is rarely useful, since it is easier to access the value
2495
 * directly through the "controller" member in ovsrec_bridge. */
2496
const struct ovsdb_datum *
2497
ovsrec_bridge_get_controller(const struct ovsrec_bridge *row,
2498
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2499
0
{
2500
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2501
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_controller);
2502
0
}
2503
2504
/* Returns the "datapath_id" column's value from the "Bridge" table in 'row'
2505
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2506
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2507
 * for a given key than implementing the same operation on the "cooked"
2508
 * form in 'row'.
2509
 *
2510
 * 'key_type' must be OVSDB_TYPE_STRING.
2511
 * (This helps to avoid silent bugs if someone changes datapath_id's
2512
 * type without updating the caller.)
2513
 *
2514
 * The caller must not modify or free the returned value.
2515
 *
2516
 * Various kinds of changes can invalidate the returned value: modifying
2517
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2518
 * If the returned value is needed for a long time, it is best to make a copy
2519
 * of it with ovsdb_datum_clone().
2520
 *
2521
 * This function is rarely useful, since it is easier to access the value
2522
 * directly through the "datapath_id" member in ovsrec_bridge. */
2523
const struct ovsdb_datum *
2524
ovsrec_bridge_get_datapath_id(const struct ovsrec_bridge *row,
2525
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2526
0
{
2527
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2528
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_datapath_id);
2529
0
}
2530
2531
/* Returns the "datapath_type" column's value from the "Bridge" table in 'row'
2532
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2533
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2534
 * for a given key than implementing the same operation on the "cooked"
2535
 * form in 'row'.
2536
 *
2537
 * 'key_type' must be OVSDB_TYPE_STRING.
2538
 * (This helps to avoid silent bugs if someone changes datapath_type's
2539
 * type without updating the caller.)
2540
 *
2541
 * The caller must not modify or free the returned value.
2542
 *
2543
 * Various kinds of changes can invalidate the returned value: modifying
2544
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2545
 * If the returned value is needed for a long time, it is best to make a copy
2546
 * of it with ovsdb_datum_clone().
2547
 *
2548
 * This function is rarely useful, since it is easier to access the value
2549
 * directly through the "datapath_type" member in ovsrec_bridge. */
2550
const struct ovsdb_datum *
2551
ovsrec_bridge_get_datapath_type(const struct ovsrec_bridge *row,
2552
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2553
0
{
2554
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2555
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_datapath_type);
2556
0
}
2557
2558
/* Returns the "datapath_version" column's value from the "Bridge" table in 'row'
2559
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2560
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2561
 * for a given key than implementing the same operation on the "cooked"
2562
 * form in 'row'.
2563
 *
2564
 * 'key_type' must be OVSDB_TYPE_STRING.
2565
 * (This helps to avoid silent bugs if someone changes datapath_version's
2566
 * type without updating the caller.)
2567
 *
2568
 * The caller must not modify or free the returned value.
2569
 *
2570
 * Various kinds of changes can invalidate the returned value: modifying
2571
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2572
 * If the returned value is needed for a long time, it is best to make a copy
2573
 * of it with ovsdb_datum_clone().
2574
 *
2575
 * This function is rarely useful, since it is easier to access the value
2576
 * directly through the "datapath_version" member in ovsrec_bridge. */
2577
const struct ovsdb_datum *
2578
ovsrec_bridge_get_datapath_version(const struct ovsrec_bridge *row,
2579
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2580
0
{
2581
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2582
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_datapath_version);
2583
0
}
2584
2585
/* Returns the "external_ids" column's value from the "Bridge" table in 'row'
2586
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2587
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2588
 * for a given key than implementing the same operation on the "cooked"
2589
 * form in 'row'.
2590
 *
2591
 * 'key_type' must be OVSDB_TYPE_STRING.
2592
 * 'value_type' must be OVSDB_TYPE_STRING.
2593
 * (This helps to avoid silent bugs if someone changes external_ids's
2594
 * type without updating the caller.)
2595
 *
2596
 * The caller must not modify or free the returned value.
2597
 *
2598
 * Various kinds of changes can invalidate the returned value: modifying
2599
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2600
 * If the returned value is needed for a long time, it is best to make a copy
2601
 * of it with ovsdb_datum_clone().
2602
 *
2603
 * This function is rarely useful, since it is easier to access the value
2604
 * directly through the "external_ids" member in ovsrec_bridge. */
2605
const struct ovsdb_datum *
2606
ovsrec_bridge_get_external_ids(const struct ovsrec_bridge *row,
2607
  enum ovsdb_atomic_type key_type OVS_UNUSED,
2608
  enum ovsdb_atomic_type value_type OVS_UNUSED)
2609
0
{
2610
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2611
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
2612
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_external_ids);
2613
0
}
2614
2615
/* Returns the "fail_mode" column's value from the "Bridge" table in 'row'
2616
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2617
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2618
 * for a given key than implementing the same operation on the "cooked"
2619
 * form in 'row'.
2620
 *
2621
 * 'key_type' must be OVSDB_TYPE_STRING.
2622
 * (This helps to avoid silent bugs if someone changes fail_mode's
2623
 * type without updating the caller.)
2624
 *
2625
 * The caller must not modify or free the returned value.
2626
 *
2627
 * Various kinds of changes can invalidate the returned value: modifying
2628
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2629
 * If the returned value is needed for a long time, it is best to make a copy
2630
 * of it with ovsdb_datum_clone().
2631
 *
2632
 * This function is rarely useful, since it is easier to access the value
2633
 * directly through the "fail_mode" member in ovsrec_bridge. */
2634
const struct ovsdb_datum *
2635
ovsrec_bridge_get_fail_mode(const struct ovsrec_bridge *row,
2636
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2637
0
{
2638
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2639
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_fail_mode);
2640
0
}
2641
2642
/* Returns the "flood_vlans" column's value from the "Bridge" table in 'row'
2643
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2644
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2645
 * for a given key than implementing the same operation on the "cooked"
2646
 * form in 'row'.
2647
 *
2648
 * 'key_type' must be OVSDB_TYPE_INTEGER.
2649
 * (This helps to avoid silent bugs if someone changes flood_vlans's
2650
 * type without updating the caller.)
2651
 *
2652
 * The caller must not modify or free the returned value.
2653
 *
2654
 * Various kinds of changes can invalidate the returned value: modifying
2655
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2656
 * If the returned value is needed for a long time, it is best to make a copy
2657
 * of it with ovsdb_datum_clone().
2658
 *
2659
 * This function is rarely useful, since it is easier to access the value
2660
 * directly through the "flood_vlans" member in ovsrec_bridge. */
2661
const struct ovsdb_datum *
2662
ovsrec_bridge_get_flood_vlans(const struct ovsrec_bridge *row,
2663
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2664
0
{
2665
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2666
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_flood_vlans);
2667
0
}
2668
2669
/* Returns the "flow_tables" column's value from the "Bridge" table in 'row'
2670
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2671
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2672
 * for a given key than implementing the same operation on the "cooked"
2673
 * form in 'row'.
2674
 *
2675
 * 'key_type' must be OVSDB_TYPE_INTEGER.
2676
 * 'value_type' must be OVSDB_TYPE_UUID.
2677
 * (This helps to avoid silent bugs if someone changes flow_tables's
2678
 * type without updating the caller.)
2679
 *
2680
 * The caller must not modify or free the returned value.
2681
 *
2682
 * Various kinds of changes can invalidate the returned value: modifying
2683
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2684
 * If the returned value is needed for a long time, it is best to make a copy
2685
 * of it with ovsdb_datum_clone().
2686
 *
2687
 * This function is rarely useful, since it is easier to access the value
2688
 * directly through the "flow_tables" member in ovsrec_bridge. */
2689
const struct ovsdb_datum *
2690
ovsrec_bridge_get_flow_tables(const struct ovsrec_bridge *row,
2691
  enum ovsdb_atomic_type key_type OVS_UNUSED,
2692
  enum ovsdb_atomic_type value_type OVS_UNUSED)
2693
0
{
2694
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2695
0
    ovs_assert(value_type == OVSDB_TYPE_UUID);
2696
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_flow_tables);
2697
0
}
2698
2699
/* Returns the "ipfix" column's value from the "Bridge" table in 'row'
2700
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2701
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2702
 * for a given key than implementing the same operation on the "cooked"
2703
 * form in 'row'.
2704
 *
2705
 * 'key_type' must be OVSDB_TYPE_UUID.
2706
 * (This helps to avoid silent bugs if someone changes ipfix's
2707
 * type without updating the caller.)
2708
 *
2709
 * The caller must not modify or free the returned value.
2710
 *
2711
 * Various kinds of changes can invalidate the returned value: modifying
2712
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2713
 * If the returned value is needed for a long time, it is best to make a copy
2714
 * of it with ovsdb_datum_clone().
2715
 *
2716
 * This function is rarely useful, since it is easier to access the value
2717
 * directly through the "ipfix" member in ovsrec_bridge. */
2718
const struct ovsdb_datum *
2719
ovsrec_bridge_get_ipfix(const struct ovsrec_bridge *row,
2720
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2721
0
{
2722
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2723
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_ipfix);
2724
0
}
2725
2726
/* Returns the "mcast_snooping_enable" column's value from the "Bridge" table in 'row'
2727
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2728
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2729
 * for a given key than implementing the same operation on the "cooked"
2730
 * form in 'row'.
2731
 *
2732
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
2733
 * (This helps to avoid silent bugs if someone changes mcast_snooping_enable's
2734
 * type without updating the caller.)
2735
 *
2736
 * The caller must not modify or free the returned value.
2737
 *
2738
 * Various kinds of changes can invalidate the returned value: modifying
2739
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2740
 * If the returned value is needed for a long time, it is best to make a copy
2741
 * of it with ovsdb_datum_clone().
2742
 *
2743
 * This function is rarely useful, since it is easier to access the value
2744
 * directly through the "mcast_snooping_enable" member in ovsrec_bridge. */
2745
const struct ovsdb_datum *
2746
ovsrec_bridge_get_mcast_snooping_enable(const struct ovsrec_bridge *row,
2747
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2748
0
{
2749
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
2750
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_mcast_snooping_enable);
2751
0
}
2752
2753
/* Returns the "mirrors" column's value from the "Bridge" table in 'row'
2754
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2755
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2756
 * for a given key than implementing the same operation on the "cooked"
2757
 * form in 'row'.
2758
 *
2759
 * 'key_type' must be OVSDB_TYPE_UUID.
2760
 * (This helps to avoid silent bugs if someone changes mirrors's
2761
 * type without updating the caller.)
2762
 *
2763
 * The caller must not modify or free the returned value.
2764
 *
2765
 * Various kinds of changes can invalidate the returned value: modifying
2766
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2767
 * If the returned value is needed for a long time, it is best to make a copy
2768
 * of it with ovsdb_datum_clone().
2769
 *
2770
 * This function is rarely useful, since it is easier to access the value
2771
 * directly through the "mirrors" member in ovsrec_bridge. */
2772
const struct ovsdb_datum *
2773
ovsrec_bridge_get_mirrors(const struct ovsrec_bridge *row,
2774
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2775
0
{
2776
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2777
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_mirrors);
2778
0
}
2779
2780
/* Returns the "name" column's value from the "Bridge" table in 'row'
2781
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2782
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2783
 * for a given key than implementing the same operation on the "cooked"
2784
 * form in 'row'.
2785
 *
2786
 * 'key_type' must be OVSDB_TYPE_STRING.
2787
 * (This helps to avoid silent bugs if someone changes name's
2788
 * type without updating the caller.)
2789
 *
2790
 * The caller must not modify or free the returned value.
2791
 *
2792
 * Various kinds of changes can invalidate the returned value: modifying
2793
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2794
 * If the returned value is needed for a long time, it is best to make a copy
2795
 * of it with ovsdb_datum_clone().
2796
 *
2797
 * This function is rarely useful, since it is easier to access the value
2798
 * directly through the "name" member in ovsrec_bridge. */
2799
const struct ovsdb_datum *
2800
ovsrec_bridge_get_name(const struct ovsrec_bridge *row,
2801
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2802
0
{
2803
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2804
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_name);
2805
0
}
2806
2807
/* Returns the "netflow" column's value from the "Bridge" table in 'row'
2808
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2809
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2810
 * for a given key than implementing the same operation on the "cooked"
2811
 * form in 'row'.
2812
 *
2813
 * 'key_type' must be OVSDB_TYPE_UUID.
2814
 * (This helps to avoid silent bugs if someone changes netflow's
2815
 * type without updating the caller.)
2816
 *
2817
 * The caller must not modify or free the returned value.
2818
 *
2819
 * Various kinds of changes can invalidate the returned value: modifying
2820
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2821
 * If the returned value is needed for a long time, it is best to make a copy
2822
 * of it with ovsdb_datum_clone().
2823
 *
2824
 * This function is rarely useful, since it is easier to access the value
2825
 * directly through the "netflow" member in ovsrec_bridge. */
2826
const struct ovsdb_datum *
2827
ovsrec_bridge_get_netflow(const struct ovsrec_bridge *row,
2828
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2829
0
{
2830
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2831
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_netflow);
2832
0
}
2833
2834
/* Returns the "other_config" column's value from the "Bridge" table in 'row'
2835
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2836
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2837
 * for a given key than implementing the same operation on the "cooked"
2838
 * form in 'row'.
2839
 *
2840
 * 'key_type' must be OVSDB_TYPE_STRING.
2841
 * 'value_type' must be OVSDB_TYPE_STRING.
2842
 * (This helps to avoid silent bugs if someone changes other_config's
2843
 * type without updating the caller.)
2844
 *
2845
 * The caller must not modify or free the returned value.
2846
 *
2847
 * Various kinds of changes can invalidate the returned value: modifying
2848
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2849
 * If the returned value is needed for a long time, it is best to make a copy
2850
 * of it with ovsdb_datum_clone().
2851
 *
2852
 * This function is rarely useful, since it is easier to access the value
2853
 * directly through the "other_config" member in ovsrec_bridge. */
2854
const struct ovsdb_datum *
2855
ovsrec_bridge_get_other_config(const struct ovsrec_bridge *row,
2856
  enum ovsdb_atomic_type key_type OVS_UNUSED,
2857
  enum ovsdb_atomic_type value_type OVS_UNUSED)
2858
0
{
2859
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2860
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
2861
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_other_config);
2862
0
}
2863
2864
/* Returns the "ports" column's value from the "Bridge" table in 'row'
2865
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2866
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2867
 * for a given key than implementing the same operation on the "cooked"
2868
 * form in 'row'.
2869
 *
2870
 * 'key_type' must be OVSDB_TYPE_UUID.
2871
 * (This helps to avoid silent bugs if someone changes ports's
2872
 * type without updating the caller.)
2873
 *
2874
 * The caller must not modify or free the returned value.
2875
 *
2876
 * Various kinds of changes can invalidate the returned value: modifying
2877
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2878
 * If the returned value is needed for a long time, it is best to make a copy
2879
 * of it with ovsdb_datum_clone().
2880
 *
2881
 * This function is rarely useful, since it is easier to access the value
2882
 * directly through the "ports" member in ovsrec_bridge. */
2883
const struct ovsdb_datum *
2884
ovsrec_bridge_get_ports(const struct ovsrec_bridge *row,
2885
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2886
0
{
2887
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2888
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_ports);
2889
0
}
2890
2891
/* Returns the "protocols" column's value from the "Bridge" table in 'row'
2892
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2893
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2894
 * for a given key than implementing the same operation on the "cooked"
2895
 * form in 'row'.
2896
 *
2897
 * 'key_type' must be OVSDB_TYPE_STRING.
2898
 * (This helps to avoid silent bugs if someone changes protocols's
2899
 * type without updating the caller.)
2900
 *
2901
 * The caller must not modify or free the returned value.
2902
 *
2903
 * Various kinds of changes can invalidate the returned value: modifying
2904
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2905
 * If the returned value is needed for a long time, it is best to make a copy
2906
 * of it with ovsdb_datum_clone().
2907
 *
2908
 * This function is rarely useful, since it is easier to access the value
2909
 * directly through the "protocols" member in ovsrec_bridge. */
2910
const struct ovsdb_datum *
2911
ovsrec_bridge_get_protocols(const struct ovsrec_bridge *row,
2912
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2913
0
{
2914
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2915
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_protocols);
2916
0
}
2917
2918
/* Returns the "rstp_enable" column's value from the "Bridge" table in 'row'
2919
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2920
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2921
 * for a given key than implementing the same operation on the "cooked"
2922
 * form in 'row'.
2923
 *
2924
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
2925
 * (This helps to avoid silent bugs if someone changes rstp_enable's
2926
 * type without updating the caller.)
2927
 *
2928
 * The caller must not modify or free the returned value.
2929
 *
2930
 * Various kinds of changes can invalidate the returned value: modifying
2931
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2932
 * If the returned value is needed for a long time, it is best to make a copy
2933
 * of it with ovsdb_datum_clone().
2934
 *
2935
 * This function is rarely useful, since it is easier to access the value
2936
 * directly through the "rstp_enable" member in ovsrec_bridge. */
2937
const struct ovsdb_datum *
2938
ovsrec_bridge_get_rstp_enable(const struct ovsrec_bridge *row,
2939
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2940
0
{
2941
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
2942
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_rstp_enable);
2943
0
}
2944
2945
/* Returns the "rstp_status" column's value from the "Bridge" table in 'row'
2946
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2947
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2948
 * for a given key than implementing the same operation on the "cooked"
2949
 * form in 'row'.
2950
 *
2951
 * 'key_type' must be OVSDB_TYPE_STRING.
2952
 * 'value_type' must be OVSDB_TYPE_STRING.
2953
 * (This helps to avoid silent bugs if someone changes rstp_status's
2954
 * type without updating the caller.)
2955
 *
2956
 * The caller must not modify or free the returned value.
2957
 *
2958
 * Various kinds of changes can invalidate the returned value: modifying
2959
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2960
 * If the returned value is needed for a long time, it is best to make a copy
2961
 * of it with ovsdb_datum_clone().
2962
 *
2963
 * This function is rarely useful, since it is easier to access the value
2964
 * directly through the "rstp_status" member in ovsrec_bridge. */
2965
const struct ovsdb_datum *
2966
ovsrec_bridge_get_rstp_status(const struct ovsrec_bridge *row,
2967
  enum ovsdb_atomic_type key_type OVS_UNUSED,
2968
  enum ovsdb_atomic_type value_type OVS_UNUSED)
2969
0
{
2970
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2971
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
2972
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_rstp_status);
2973
0
}
2974
2975
/* Returns the "sflow" column's value from the "Bridge" table in 'row'
2976
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2977
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2978
 * for a given key than implementing the same operation on the "cooked"
2979
 * form in 'row'.
2980
 *
2981
 * 'key_type' must be OVSDB_TYPE_UUID.
2982
 * (This helps to avoid silent bugs if someone changes sflow's
2983
 * type without updating the caller.)
2984
 *
2985
 * The caller must not modify or free the returned value.
2986
 *
2987
 * Various kinds of changes can invalidate the returned value: modifying
2988
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2989
 * If the returned value is needed for a long time, it is best to make a copy
2990
 * of it with ovsdb_datum_clone().
2991
 *
2992
 * This function is rarely useful, since it is easier to access the value
2993
 * directly through the "sflow" member in ovsrec_bridge. */
2994
const struct ovsdb_datum *
2995
ovsrec_bridge_get_sflow(const struct ovsrec_bridge *row,
2996
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2997
0
{
2998
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2999
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_sflow);
3000
0
}
3001
3002
/* Returns the "status" column's value from the "Bridge" table in 'row'
3003
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
3004
 * ovsdb_datum_find_key() is an easier and more efficient way to search
3005
 * for a given key than implementing the same operation on the "cooked"
3006
 * form in 'row'.
3007
 *
3008
 * 'key_type' must be OVSDB_TYPE_STRING.
3009
 * 'value_type' must be OVSDB_TYPE_STRING.
3010
 * (This helps to avoid silent bugs if someone changes status's
3011
 * type without updating the caller.)
3012
 *
3013
 * The caller must not modify or free the returned value.
3014
 *
3015
 * Various kinds of changes can invalidate the returned value: modifying
3016
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3017
 * If the returned value is needed for a long time, it is best to make a copy
3018
 * of it with ovsdb_datum_clone().
3019
 *
3020
 * This function is rarely useful, since it is easier to access the value
3021
 * directly through the "status" member in ovsrec_bridge. */
3022
const struct ovsdb_datum *
3023
ovsrec_bridge_get_status(const struct ovsrec_bridge *row,
3024
  enum ovsdb_atomic_type key_type OVS_UNUSED,
3025
  enum ovsdb_atomic_type value_type OVS_UNUSED)
3026
0
{
3027
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
3028
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
3029
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_status);
3030
0
}
3031
3032
/* Returns the "stp_enable" column's value from the "Bridge" table in 'row'
3033
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
3034
 * ovsdb_datum_find_key() is an easier and more efficient way to search
3035
 * for a given key than implementing the same operation on the "cooked"
3036
 * form in 'row'.
3037
 *
3038
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
3039
 * (This helps to avoid silent bugs if someone changes stp_enable's
3040
 * type without updating the caller.)
3041
 *
3042
 * The caller must not modify or free the returned value.
3043
 *
3044
 * Various kinds of changes can invalidate the returned value: modifying
3045
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3046
 * If the returned value is needed for a long time, it is best to make a copy
3047
 * of it with ovsdb_datum_clone().
3048
 *
3049
 * This function is rarely useful, since it is easier to access the value
3050
 * directly through the "stp_enable" member in ovsrec_bridge. */
3051
const struct ovsdb_datum *
3052
ovsrec_bridge_get_stp_enable(const struct ovsrec_bridge *row,
3053
  enum ovsdb_atomic_type key_type OVS_UNUSED)
3054
0
{
3055
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
3056
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_stp_enable);
3057
0
}
3058
3059
/* Sets the "auto_attach" column from the "Bridge" table in 'row' to
3060
 * the 'auto_attach' set.
3061
 *
3062
 * If "auto_attach" is null, the column will be the empty set,
3063
 * otherwise it will contain the specified value.
3064
 *
3065
 * The caller retains ownership of the arguments. */
3066
void
3067
ovsrec_bridge_set_auto_attach(const struct ovsrec_bridge *row, const struct ovsrec_autoattach *auto_attach)
3068
0
{
3069
0
    struct ovsdb_datum datum;
3070
3071
0
    datum.refcnt = NULL;
3072
3073
0
    if (auto_attach) {
3074
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
3075
0
        datum.n = 1;
3076
0
        datum.keys = key;
3077
0
        key->uuid = auto_attach->header_.uuid;
3078
0
    } else {
3079
0
        datum.n = 0;
3080
0
        datum.keys = NULL;
3081
0
    }
3082
0
    datum.values = NULL;
3083
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_auto_attach, &datum);
3084
0
}
3085
3086
/* Sets the "controller" column from the "Bridge" table in 'row' to
3087
 * the 'controller' set with 'n_controller' entries.
3088
 *
3089
 * The caller retains ownership of the arguments. */
3090
void
3091
ovsrec_bridge_set_controller(const struct ovsrec_bridge *row, struct ovsrec_controller **controller, size_t n_controller)
3092
0
{
3093
0
    struct ovsdb_datum datum;
3094
3095
0
    datum.refcnt = NULL;
3096
3097
0
    datum.n = n_controller;
3098
0
    datum.keys = n_controller ? xmalloc(n_controller * sizeof *datum.keys) : NULL;
3099
0
    datum.values = NULL;
3100
0
    for (size_t i = 0; i < n_controller; i++) {
3101
0
        datum.keys[i].uuid = controller[i]->header_.uuid;
3102
0
    }
3103
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_controller, &datum);
3104
0
}
3105
3106
/* Sets the "datapath_id" column from the "Bridge" table in 'row' to
3107
 * the 'datapath_id' set.
3108
 *
3109
 * If "datapath_id" is null, the column will be the empty set,
3110
 * otherwise it will contain the specified value.
3111
 *
3112
 * The caller retains ownership of the arguments. */
3113
void
3114
ovsrec_bridge_set_datapath_id(const struct ovsrec_bridge *row, const char *datapath_id)
3115
0
{
3116
0
    struct ovsdb_datum datum;
3117
3118
0
    datum.refcnt = NULL;
3119
3120
0
    if (datapath_id) {
3121
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
3122
0
        datum.n = 1;
3123
0
        datum.keys = key;
3124
0
        key->s = ovsdb_atom_string_create(datapath_id);
3125
0
    } else {
3126
0
        datum.n = 0;
3127
0
        datum.keys = NULL;
3128
0
    }
3129
0
    datum.values = NULL;
3130
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_datapath_id, &datum);
3131
0
}
3132
3133
/* Sets the "datapath_type" column from the "Bridge" table in 'row' to
3134
 * 'datapath_type'.
3135
 *
3136
 * The caller retains ownership of the arguments. */
3137
void
3138
ovsrec_bridge_set_datapath_type(const struct ovsrec_bridge *row, const char *datapath_type)
3139
0
{
3140
0
    struct ovsdb_datum datum;
3141
3142
0
    datum.refcnt = NULL;
3143
3144
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3145
3146
0
    datum.n = 1;
3147
0
    datum.keys = key;
3148
0
    key->s = ovsdb_atom_string_create(datapath_type);
3149
0
    datum.values = NULL;
3150
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_datapath_type, &datum);
3151
0
}
3152
3153
/* Sets the "datapath_version" column from the "Bridge" table in 'row' to
3154
 * 'datapath_version'.
3155
 *
3156
 * The caller retains ownership of the arguments. */
3157
void
3158
ovsrec_bridge_set_datapath_version(const struct ovsrec_bridge *row, const char *datapath_version)
3159
0
{
3160
0
    struct ovsdb_datum datum;
3161
3162
0
    datum.refcnt = NULL;
3163
3164
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3165
3166
0
    datum.n = 1;
3167
0
    datum.keys = key;
3168
0
    key->s = ovsdb_atom_string_create(datapath_version);
3169
0
    datum.values = NULL;
3170
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_datapath_version, &datum);
3171
0
}
3172
3173
/* Sets the "external_ids" column's value from the "Bridge" table in 'row'
3174
 * to 'external_ids'.
3175
 *
3176
 * The caller retains ownership of 'external_ids' and everything in it. */
3177
void
3178
ovsrec_bridge_set_external_ids(const struct ovsrec_bridge *row, const struct smap *external_ids)
3179
0
{
3180
0
    struct ovsdb_datum datum;
3181
3182
0
    if (external_ids) {
3183
0
        ovsdb_datum_from_smap(&datum, external_ids);
3184
0
    } else {
3185
0
        ovsdb_datum_init_empty(&datum);
3186
0
    }
3187
0
    ovsdb_idl_txn_write(&row->header_,
3188
0
                        &ovsrec_bridge_col_external_ids,
3189
0
                        &datum);
3190
0
}
3191
3192
3193
/* Sets the "fail_mode" column from the "Bridge" table in 'row' to
3194
 * the 'fail_mode' set.
3195
 *
3196
 * If "fail_mode" is null, the column will be the empty set,
3197
 * otherwise it will contain the specified value.
3198
 *
3199
 * Argument constraints: either "secure" or "standalone"
3200
 *
3201
 * The caller retains ownership of the arguments. */
3202
void
3203
ovsrec_bridge_set_fail_mode(const struct ovsrec_bridge *row, const char *fail_mode)
3204
0
{
3205
0
    struct ovsdb_datum datum;
3206
3207
0
    datum.refcnt = NULL;
3208
3209
0
    if (fail_mode) {
3210
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
3211
0
        datum.n = 1;
3212
0
        datum.keys = key;
3213
0
        key->s = ovsdb_atom_string_create(fail_mode);
3214
0
    } else {
3215
0
        datum.n = 0;
3216
0
        datum.keys = NULL;
3217
0
    }
3218
0
    datum.values = NULL;
3219
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_fail_mode, &datum);
3220
0
}
3221
3222
/* Sets the "flood_vlans" column from the "Bridge" table in 'row' to
3223
 * the 'flood_vlans' set with 'n_flood_vlans' entries.
3224
 *
3225
 * Argument constraints: in range 0 to 4,095
3226
 *
3227
 * The caller retains ownership of the arguments. */
3228
void
3229
ovsrec_bridge_set_flood_vlans(const struct ovsrec_bridge *row, const int64_t *flood_vlans, size_t n_flood_vlans)
3230
0
{
3231
0
    struct ovsdb_datum datum;
3232
3233
0
    datum.refcnt = NULL;
3234
3235
0
    datum.n = n_flood_vlans;
3236
0
    datum.keys = n_flood_vlans ? xmalloc(n_flood_vlans * sizeof *datum.keys) : NULL;
3237
0
    datum.values = NULL;
3238
0
    for (size_t i = 0; i < n_flood_vlans; i++) {
3239
0
        datum.keys[i].integer = flood_vlans[i];
3240
0
    }
3241
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_flood_vlans, &datum);
3242
0
}
3243
3244
/* Sets the "flow_tables" column from the "Bridge" table in 'row' to
3245
 * the map with keys 'key_flow_tables' and values 'value_flow_tables'
3246
 * with 'n_flow_tables' entries.
3247
 *
3248
 * Argument constraints: key in range 0 to 254
3249
 *
3250
 * The caller retains ownership of the arguments. */
3251
void
3252
ovsrec_bridge_set_flow_tables(const struct ovsrec_bridge *row, const int64_t *key_flow_tables, struct ovsrec_flow_table **value_flow_tables, size_t n_flow_tables)
3253
0
{
3254
0
    struct ovsdb_datum datum;
3255
3256
0
    datum.refcnt = NULL;
3257
3258
0
    datum.n = n_flow_tables;
3259
0
    datum.keys = n_flow_tables ? xmalloc(n_flow_tables * sizeof *datum.keys) : NULL;
3260
0
    datum.values = xmalloc(n_flow_tables * sizeof *datum.values);
3261
0
    for (size_t i = 0; i < n_flow_tables; i++) {
3262
0
        datum.keys[i].integer = key_flow_tables[i];
3263
0
        datum.values[i].uuid = value_flow_tables[i]->header_.uuid;
3264
0
    }
3265
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_flow_tables, &datum);
3266
0
}
3267
3268
/* Sets the "ipfix" column from the "Bridge" table in 'row' to
3269
 * the 'ipfix' set.
3270
 *
3271
 * If "ipfix" is null, the column will be the empty set,
3272
 * otherwise it will contain the specified value.
3273
 *
3274
 * The caller retains ownership of the arguments. */
3275
void
3276
ovsrec_bridge_set_ipfix(const struct ovsrec_bridge *row, const struct ovsrec_ipfix *ipfix)
3277
0
{
3278
0
    struct ovsdb_datum datum;
3279
3280
0
    datum.refcnt = NULL;
3281
3282
0
    if (ipfix) {
3283
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
3284
0
        datum.n = 1;
3285
0
        datum.keys = key;
3286
0
        key->uuid = ipfix->header_.uuid;
3287
0
    } else {
3288
0
        datum.n = 0;
3289
0
        datum.keys = NULL;
3290
0
    }
3291
0
    datum.values = NULL;
3292
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_ipfix, &datum);
3293
0
}
3294
3295
/* Sets the "mcast_snooping_enable" column from the "Bridge" table in 'row' to
3296
 * 'mcast_snooping_enable'.
3297
 *
3298
 * The caller retains ownership of the arguments. */
3299
void
3300
ovsrec_bridge_set_mcast_snooping_enable(const struct ovsrec_bridge *row, bool mcast_snooping_enable)
3301
0
{
3302
0
    struct ovsdb_datum datum;
3303
3304
0
    datum.refcnt = NULL;
3305
3306
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3307
3308
0
    datum.n = 1;
3309
0
    datum.keys = key;
3310
0
    key->boolean = mcast_snooping_enable;
3311
0
    datum.values = NULL;
3312
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_mcast_snooping_enable, &datum);
3313
0
}
3314
3315
/* Sets the "mirrors" column from the "Bridge" table in 'row' to
3316
 * the 'mirrors' set with 'n_mirrors' entries.
3317
 *
3318
 * The caller retains ownership of the arguments. */
3319
void
3320
ovsrec_bridge_set_mirrors(const struct ovsrec_bridge *row, struct ovsrec_mirror **mirrors, size_t n_mirrors)
3321
0
{
3322
0
    struct ovsdb_datum datum;
3323
3324
0
    datum.refcnt = NULL;
3325
3326
0
    datum.n = n_mirrors;
3327
0
    datum.keys = n_mirrors ? xmalloc(n_mirrors * sizeof *datum.keys) : NULL;
3328
0
    datum.values = NULL;
3329
0
    for (size_t i = 0; i < n_mirrors; i++) {
3330
0
        datum.keys[i].uuid = mirrors[i]->header_.uuid;
3331
0
    }
3332
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_mirrors, &datum);
3333
0
}
3334
3335
/* Sets the "name" column from the "Bridge" table in 'row' to
3336
 * 'name'.
3337
 *
3338
 * The caller retains ownership of the arguments. */
3339
void
3340
ovsrec_bridge_set_name(const struct ovsrec_bridge *row, const char *name)
3341
0
{
3342
0
    struct ovsdb_datum datum;
3343
3344
0
    datum.refcnt = NULL;
3345
3346
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3347
3348
0
    datum.n = 1;
3349
0
    datum.keys = key;
3350
0
    key->s = ovsdb_atom_string_create(name);
3351
0
    datum.values = NULL;
3352
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_name, &datum);
3353
0
}
3354
3355
/* Sets the "netflow" column from the "Bridge" table in 'row' to
3356
 * the 'netflow' set.
3357
 *
3358
 * If "netflow" is null, the column will be the empty set,
3359
 * otherwise it will contain the specified value.
3360
 *
3361
 * The caller retains ownership of the arguments. */
3362
void
3363
ovsrec_bridge_set_netflow(const struct ovsrec_bridge *row, const struct ovsrec_netflow *netflow)
3364
0
{
3365
0
    struct ovsdb_datum datum;
3366
3367
0
    datum.refcnt = NULL;
3368
3369
0
    if (netflow) {
3370
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
3371
0
        datum.n = 1;
3372
0
        datum.keys = key;
3373
0
        key->uuid = netflow->header_.uuid;
3374
0
    } else {
3375
0
        datum.n = 0;
3376
0
        datum.keys = NULL;
3377
0
    }
3378
0
    datum.values = NULL;
3379
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_netflow, &datum);
3380
0
}
3381
3382
/* Sets the "other_config" column's value from the "Bridge" table in 'row'
3383
 * to 'other_config'.
3384
 *
3385
 * The caller retains ownership of 'other_config' and everything in it. */
3386
void
3387
ovsrec_bridge_set_other_config(const struct ovsrec_bridge *row, const struct smap *other_config)
3388
0
{
3389
0
    struct ovsdb_datum datum;
3390
3391
0
    if (other_config) {
3392
0
        ovsdb_datum_from_smap(&datum, other_config);
3393
0
    } else {
3394
0
        ovsdb_datum_init_empty(&datum);
3395
0
    }
3396
0
    ovsdb_idl_txn_write(&row->header_,
3397
0
                        &ovsrec_bridge_col_other_config,
3398
0
                        &datum);
3399
0
}
3400
3401
3402
/* Sets the "ports" column from the "Bridge" table in 'row' to
3403
 * the 'ports' set with 'n_ports' entries.
3404
 *
3405
 * The caller retains ownership of the arguments. */
3406
void
3407
ovsrec_bridge_set_ports(const struct ovsrec_bridge *row, struct ovsrec_port **ports, size_t n_ports)
3408
0
{
3409
0
    struct ovsdb_datum datum;
3410
3411
0
    datum.refcnt = NULL;
3412
3413
0
    datum.n = n_ports;
3414
0
    datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
3415
0
    datum.values = NULL;
3416
0
    for (size_t i = 0; i < n_ports; i++) {
3417
0
        datum.keys[i].uuid = ports[i]->header_.uuid;
3418
0
    }
3419
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_ports, &datum);
3420
0
}
3421
3422
/* Sets the "protocols" column from the "Bridge" table in 'row' to
3423
 * the 'protocols' set with 'n_protocols' entries.
3424
 *
3425
 * Argument constraints: one of "OpenFlow10", "OpenFlow11", "OpenFlow12", "OpenFlow13", "OpenFlow14", or "OpenFlow15"
3426
 *
3427
 * The caller retains ownership of the arguments. */
3428
void
3429
ovsrec_bridge_set_protocols(const struct ovsrec_bridge *row, const char **protocols, size_t n_protocols)
3430
0
{
3431
0
    struct ovsdb_datum datum;
3432
3433
0
    datum.refcnt = NULL;
3434
3435
0
    datum.n = n_protocols;
3436
0
    datum.keys = n_protocols ? xmalloc(n_protocols * sizeof *datum.keys) : NULL;
3437
0
    datum.values = NULL;
3438
0
    for (size_t i = 0; i < n_protocols; i++) {
3439
0
        datum.keys[i].s = ovsdb_atom_string_create(protocols[i]);
3440
0
    }
3441
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_protocols, &datum);
3442
0
}
3443
3444
/* Sets the "rstp_enable" column from the "Bridge" table in 'row' to
3445
 * 'rstp_enable'.
3446
 *
3447
 * The caller retains ownership of the arguments. */
3448
void
3449
ovsrec_bridge_set_rstp_enable(const struct ovsrec_bridge *row, bool rstp_enable)
3450
0
{
3451
0
    struct ovsdb_datum datum;
3452
3453
0
    datum.refcnt = NULL;
3454
3455
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3456
3457
0
    datum.n = 1;
3458
0
    datum.keys = key;
3459
0
    key->boolean = rstp_enable;
3460
0
    datum.values = NULL;
3461
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_rstp_enable, &datum);
3462
0
}
3463
3464
/* Sets the "rstp_status" column's value from the "Bridge" table in 'row'
3465
 * to 'rstp_status'.
3466
 *
3467
 * The caller retains ownership of 'rstp_status' and everything in it. */
3468
void
3469
ovsrec_bridge_set_rstp_status(const struct ovsrec_bridge *row, const struct smap *rstp_status)
3470
0
{
3471
0
    struct ovsdb_datum datum;
3472
3473
0
    if (rstp_status) {
3474
0
        ovsdb_datum_from_smap(&datum, rstp_status);
3475
0
    } else {
3476
0
        ovsdb_datum_init_empty(&datum);
3477
0
    }
3478
0
    ovsdb_idl_txn_write(&row->header_,
3479
0
                        &ovsrec_bridge_col_rstp_status,
3480
0
                        &datum);
3481
0
}
3482
3483
3484
/* Sets the "sflow" column from the "Bridge" table in 'row' to
3485
 * the 'sflow' set.
3486
 *
3487
 * If "sflow" is null, the column will be the empty set,
3488
 * otherwise it will contain the specified value.
3489
 *
3490
 * The caller retains ownership of the arguments. */
3491
void
3492
ovsrec_bridge_set_sflow(const struct ovsrec_bridge *row, const struct ovsrec_sflow *sflow)
3493
0
{
3494
0
    struct ovsdb_datum datum;
3495
3496
0
    datum.refcnt = NULL;
3497
3498
0
    if (sflow) {
3499
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
3500
0
        datum.n = 1;
3501
0
        datum.keys = key;
3502
0
        key->uuid = sflow->header_.uuid;
3503
0
    } else {
3504
0
        datum.n = 0;
3505
0
        datum.keys = NULL;
3506
0
    }
3507
0
    datum.values = NULL;
3508
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_sflow, &datum);
3509
0
}
3510
3511
/* Sets the "status" column's value from the "Bridge" table in 'row'
3512
 * to 'status'.
3513
 *
3514
 * The caller retains ownership of 'status' and everything in it. */
3515
void
3516
ovsrec_bridge_set_status(const struct ovsrec_bridge *row, const struct smap *status)
3517
0
{
3518
0
    struct ovsdb_datum datum;
3519
3520
0
    if (status) {
3521
0
        ovsdb_datum_from_smap(&datum, status);
3522
0
    } else {
3523
0
        ovsdb_datum_init_empty(&datum);
3524
0
    }
3525
0
    ovsdb_idl_txn_write(&row->header_,
3526
0
                        &ovsrec_bridge_col_status,
3527
0
                        &datum);
3528
0
}
3529
3530
3531
/* Sets the "stp_enable" column from the "Bridge" table in 'row' to
3532
 * 'stp_enable'.
3533
 *
3534
 * The caller retains ownership of the arguments. */
3535
void
3536
ovsrec_bridge_set_stp_enable(const struct ovsrec_bridge *row, bool stp_enable)
3537
0
{
3538
0
    struct ovsdb_datum datum;
3539
3540
0
    datum.refcnt = NULL;
3541
3542
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3543
3544
0
    datum.n = 1;
3545
0
    datum.keys = key;
3546
0
    key->boolean = stp_enable;
3547
0
    datum.values = NULL;
3548
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_stp_enable, &datum);
3549
0
}
3550
3551
/* Adds the value 'new_value' to the "auto_attach" set column from the "Bridge" table
3552
 * in 'row'.
3553
 *
3554
 */
3555
void
3556
ovsrec_bridge_update_auto_attach_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_autoattach *new_value)
3557
0
{
3558
0
    struct ovsdb_datum *datum;
3559
3560
0
    datum = xmalloc(sizeof *datum);
3561
0
    datum->n = 1;
3562
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3563
0
    datum->values = NULL;
3564
0
    datum->refcnt = NULL;
3565
3566
0
    datum->keys[0].uuid = new_value->header_.uuid;
3567
3568
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3569
0
                                    &ovsrec_bridge_col_auto_attach,
3570
0
                                    datum);
3571
0
}
3572
3573
/* Deletes the value 'delete_value' from the "auto_attach" set column from the
3574
 * "Bridge" table in 'row'.
3575
 *
3576
 */
3577
void
3578
ovsrec_bridge_update_auto_attach_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_autoattach *delete_value)
3579
0
{
3580
0
    struct ovsdb_datum *datum;
3581
3582
0
    datum = xmalloc(sizeof *datum);
3583
0
    datum->n = 1;
3584
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3585
0
    datum->values = NULL;
3586
0
    datum->refcnt = NULL;
3587
3588
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3589
3590
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3591
0
                                    &ovsrec_bridge_col_auto_attach,
3592
0
                                    datum);
3593
0
}
3594
3595
/* Adds the value 'new_value' to the "controller" set column from the "Bridge" table
3596
 * in 'row'.
3597
 *
3598
 */
3599
void
3600
ovsrec_bridge_update_controller_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_controller *new_value)
3601
0
{
3602
0
    struct ovsdb_datum *datum;
3603
3604
0
    datum = xmalloc(sizeof *datum);
3605
0
    datum->n = 1;
3606
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3607
0
    datum->values = NULL;
3608
0
    datum->refcnt = NULL;
3609
3610
0
    datum->keys[0].uuid = new_value->header_.uuid;
3611
3612
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3613
0
                                    &ovsrec_bridge_col_controller,
3614
0
                                    datum);
3615
0
}
3616
3617
/* Deletes the value 'delete_value' from the "controller" set column from the
3618
 * "Bridge" table in 'row'.
3619
 *
3620
 */
3621
void
3622
ovsrec_bridge_update_controller_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_controller *delete_value)
3623
0
{
3624
0
    struct ovsdb_datum *datum;
3625
3626
0
    datum = xmalloc(sizeof *datum);
3627
0
    datum->n = 1;
3628
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3629
0
    datum->values = NULL;
3630
0
    datum->refcnt = NULL;
3631
3632
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3633
3634
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3635
0
                                    &ovsrec_bridge_col_controller,
3636
0
                                    datum);
3637
0
}
3638
3639
/* Adds the value 'new_value' to the "datapath_id" set column from the "Bridge" table
3640
 * in 'row'.
3641
 *
3642
 */
3643
void
3644
ovsrec_bridge_update_datapath_id_addvalue(const struct ovsrec_bridge *row, const char *new_value)
3645
0
{
3646
0
    struct ovsdb_datum *datum;
3647
3648
0
    datum = xmalloc(sizeof *datum);
3649
0
    datum->n = 1;
3650
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3651
0
    datum->values = NULL;
3652
0
    datum->refcnt = NULL;
3653
3654
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
3655
3656
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3657
0
                                    &ovsrec_bridge_col_datapath_id,
3658
0
                                    datum);
3659
0
}
3660
3661
/* Deletes the value 'delete_value' from the "datapath_id" set column from the
3662
 * "Bridge" table in 'row'.
3663
 *
3664
 */
3665
void
3666
ovsrec_bridge_update_datapath_id_delvalue(const struct ovsrec_bridge *row, const char *delete_value)
3667
0
{
3668
0
    struct ovsdb_datum *datum;
3669
3670
0
    datum = xmalloc(sizeof *datum);
3671
0
    datum->n = 1;
3672
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3673
0
    datum->values = NULL;
3674
0
    datum->refcnt = NULL;
3675
3676
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
3677
3678
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3679
0
                                    &ovsrec_bridge_col_datapath_id,
3680
0
                                    datum);
3681
0
}
3682
3683
/* Sets an element of the "external_ids" map column from the "Bridge" table in 'row'
3684
 * to 'new_value' given the key value 'new_key'.
3685
 *
3686
 */
3687
void
3688
ovsrec_bridge_update_external_ids_setkey(const struct ovsrec_bridge *row, const char *new_key, const char *new_value)
3689
0
{
3690
0
    struct ovsdb_datum *datum;
3691
3692
0
    datum = xmalloc(sizeof *datum);
3693
0
    datum->n = 1;
3694
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3695
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
3696
0
    datum->refcnt = NULL;
3697
3698
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
3699
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
3700
3701
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
3702
0
                                    &ovsrec_bridge_col_external_ids,
3703
0
                                    datum);
3704
0
}
3705
3706
/* Deletes an element of the "external_ids" map column from the "Bridge" table in 'row'
3707
 * given the key value 'delete_key'.
3708
 *
3709
 */
3710
void
3711
ovsrec_bridge_update_external_ids_delkey(const struct ovsrec_bridge *row, const char *delete_key)
3712
0
{
3713
0
    struct ovsdb_datum *datum;
3714
3715
0
    datum = xmalloc(sizeof *datum);
3716
0
    datum->n = 1;
3717
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3718
0
    datum->values = NULL;
3719
0
    datum->refcnt = NULL;
3720
3721
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
3722
3723
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
3724
0
                                    &ovsrec_bridge_col_external_ids,
3725
0
                                    datum);
3726
0
}
3727
3728
/* Adds the value 'new_value' to the "fail_mode" set column from the "Bridge" table
3729
 * in 'row'.
3730
 *
3731
 */
3732
void
3733
ovsrec_bridge_update_fail_mode_addvalue(const struct ovsrec_bridge *row, const char *new_value)
3734
0
{
3735
0
    struct ovsdb_datum *datum;
3736
3737
0
    datum = xmalloc(sizeof *datum);
3738
0
    datum->n = 1;
3739
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3740
0
    datum->values = NULL;
3741
0
    datum->refcnt = NULL;
3742
3743
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
3744
3745
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3746
0
                                    &ovsrec_bridge_col_fail_mode,
3747
0
                                    datum);
3748
0
}
3749
3750
/* Deletes the value 'delete_value' from the "fail_mode" set column from the
3751
 * "Bridge" table in 'row'.
3752
 *
3753
 */
3754
void
3755
ovsrec_bridge_update_fail_mode_delvalue(const struct ovsrec_bridge *row, const char *delete_value)
3756
0
{
3757
0
    struct ovsdb_datum *datum;
3758
3759
0
    datum = xmalloc(sizeof *datum);
3760
0
    datum->n = 1;
3761
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3762
0
    datum->values = NULL;
3763
0
    datum->refcnt = NULL;
3764
3765
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
3766
3767
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3768
0
                                    &ovsrec_bridge_col_fail_mode,
3769
0
                                    datum);
3770
0
}
3771
3772
/* Adds the value 'new_value' to the "flood_vlans" set column from the "Bridge" table
3773
 * in 'row'.
3774
 *
3775
 */
3776
void
3777
ovsrec_bridge_update_flood_vlans_addvalue(const struct ovsrec_bridge *row, int64_t new_value)
3778
0
{
3779
0
    struct ovsdb_datum *datum;
3780
3781
0
    datum = xmalloc(sizeof *datum);
3782
0
    datum->n = 1;
3783
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3784
0
    datum->values = NULL;
3785
0
    datum->refcnt = NULL;
3786
3787
0
    datum->keys[0].integer = new_value;
3788
3789
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3790
0
                                    &ovsrec_bridge_col_flood_vlans,
3791
0
                                    datum);
3792
0
}
3793
3794
/* Deletes the value 'delete_value' from the "flood_vlans" set column from the
3795
 * "Bridge" table in 'row'.
3796
 *
3797
 */
3798
void
3799
ovsrec_bridge_update_flood_vlans_delvalue(const struct ovsrec_bridge *row, int64_t delete_value)
3800
0
{
3801
0
    struct ovsdb_datum *datum;
3802
3803
0
    datum = xmalloc(sizeof *datum);
3804
0
    datum->n = 1;
3805
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3806
0
    datum->values = NULL;
3807
0
    datum->refcnt = NULL;
3808
3809
0
    datum->keys[0].integer = delete_value;
3810
3811
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3812
0
                                    &ovsrec_bridge_col_flood_vlans,
3813
0
                                    datum);
3814
0
}
3815
3816
/* Sets an element of the "flow_tables" map column from the "Bridge" table in 'row'
3817
 * to 'new_value' given the key value 'new_key'.
3818
 *
3819
 */
3820
void
3821
ovsrec_bridge_update_flow_tables_setkey(const struct ovsrec_bridge *row, int64_t new_key, const struct ovsrec_flow_table *new_value)
3822
0
{
3823
0
    struct ovsdb_datum *datum;
3824
3825
0
    datum = xmalloc(sizeof *datum);
3826
0
    datum->n = 1;
3827
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3828
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
3829
0
    datum->refcnt = NULL;
3830
3831
0
    datum->keys[0].integer = new_key;
3832
0
    datum->values[0].uuid = new_value->header_.uuid;
3833
3834
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
3835
0
                                    &ovsrec_bridge_col_flow_tables,
3836
0
                                    datum);
3837
0
}
3838
3839
/* Deletes an element of the "flow_tables" map column from the "Bridge" table in 'row'
3840
 * given the key value 'delete_key'.
3841
 *
3842
 */
3843
void
3844
ovsrec_bridge_update_flow_tables_delkey(const struct ovsrec_bridge *row, int64_t delete_key)
3845
0
{
3846
0
    struct ovsdb_datum *datum;
3847
3848
0
    datum = xmalloc(sizeof *datum);
3849
0
    datum->n = 1;
3850
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3851
0
    datum->values = NULL;
3852
0
    datum->refcnt = NULL;
3853
3854
0
    datum->keys[0].integer = delete_key;
3855
3856
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
3857
0
                                    &ovsrec_bridge_col_flow_tables,
3858
0
                                    datum);
3859
0
}
3860
3861
/* Adds the value 'new_value' to the "ipfix" set column from the "Bridge" table
3862
 * in 'row'.
3863
 *
3864
 */
3865
void
3866
ovsrec_bridge_update_ipfix_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_ipfix *new_value)
3867
0
{
3868
0
    struct ovsdb_datum *datum;
3869
3870
0
    datum = xmalloc(sizeof *datum);
3871
0
    datum->n = 1;
3872
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3873
0
    datum->values = NULL;
3874
0
    datum->refcnt = NULL;
3875
3876
0
    datum->keys[0].uuid = new_value->header_.uuid;
3877
3878
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3879
0
                                    &ovsrec_bridge_col_ipfix,
3880
0
                                    datum);
3881
0
}
3882
3883
/* Deletes the value 'delete_value' from the "ipfix" set column from the
3884
 * "Bridge" table in 'row'.
3885
 *
3886
 */
3887
void
3888
ovsrec_bridge_update_ipfix_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_ipfix *delete_value)
3889
0
{
3890
0
    struct ovsdb_datum *datum;
3891
3892
0
    datum = xmalloc(sizeof *datum);
3893
0
    datum->n = 1;
3894
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3895
0
    datum->values = NULL;
3896
0
    datum->refcnt = NULL;
3897
3898
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3899
3900
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3901
0
                                    &ovsrec_bridge_col_ipfix,
3902
0
                                    datum);
3903
0
}
3904
3905
/* Adds the value 'new_value' to the "mirrors" set column from the "Bridge" table
3906
 * in 'row'.
3907
 *
3908
 */
3909
void
3910
ovsrec_bridge_update_mirrors_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_mirror *new_value)
3911
0
{
3912
0
    struct ovsdb_datum *datum;
3913
3914
0
    datum = xmalloc(sizeof *datum);
3915
0
    datum->n = 1;
3916
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3917
0
    datum->values = NULL;
3918
0
    datum->refcnt = NULL;
3919
3920
0
    datum->keys[0].uuid = new_value->header_.uuid;
3921
3922
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3923
0
                                    &ovsrec_bridge_col_mirrors,
3924
0
                                    datum);
3925
0
}
3926
3927
/* Deletes the value 'delete_value' from the "mirrors" set column from the
3928
 * "Bridge" table in 'row'.
3929
 *
3930
 */
3931
void
3932
ovsrec_bridge_update_mirrors_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_mirror *delete_value)
3933
0
{
3934
0
    struct ovsdb_datum *datum;
3935
3936
0
    datum = xmalloc(sizeof *datum);
3937
0
    datum->n = 1;
3938
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3939
0
    datum->values = NULL;
3940
0
    datum->refcnt = NULL;
3941
3942
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3943
3944
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3945
0
                                    &ovsrec_bridge_col_mirrors,
3946
0
                                    datum);
3947
0
}
3948
3949
/* Adds the value 'new_value' to the "netflow" set column from the "Bridge" table
3950
 * in 'row'.
3951
 *
3952
 */
3953
void
3954
ovsrec_bridge_update_netflow_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_netflow *new_value)
3955
0
{
3956
0
    struct ovsdb_datum *datum;
3957
3958
0
    datum = xmalloc(sizeof *datum);
3959
0
    datum->n = 1;
3960
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3961
0
    datum->values = NULL;
3962
0
    datum->refcnt = NULL;
3963
3964
0
    datum->keys[0].uuid = new_value->header_.uuid;
3965
3966
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3967
0
                                    &ovsrec_bridge_col_netflow,
3968
0
                                    datum);
3969
0
}
3970
3971
/* Deletes the value 'delete_value' from the "netflow" set column from the
3972
 * "Bridge" table in 'row'.
3973
 *
3974
 */
3975
void
3976
ovsrec_bridge_update_netflow_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_netflow *delete_value)
3977
0
{
3978
0
    struct ovsdb_datum *datum;
3979
3980
0
    datum = xmalloc(sizeof *datum);
3981
0
    datum->n = 1;
3982
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3983
0
    datum->values = NULL;
3984
0
    datum->refcnt = NULL;
3985
3986
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3987
3988
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3989
0
                                    &ovsrec_bridge_col_netflow,
3990
0
                                    datum);
3991
0
}
3992
3993
/* Sets an element of the "other_config" map column from the "Bridge" table in 'row'
3994
 * to 'new_value' given the key value 'new_key'.
3995
 *
3996
 */
3997
void
3998
ovsrec_bridge_update_other_config_setkey(const struct ovsrec_bridge *row, const char *new_key, const char *new_value)
3999
0
{
4000
0
    struct ovsdb_datum *datum;
4001
4002
0
    datum = xmalloc(sizeof *datum);
4003
0
    datum->n = 1;
4004
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4005
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
4006
0
    datum->refcnt = NULL;
4007
4008
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
4009
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
4010
4011
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
4012
0
                                    &ovsrec_bridge_col_other_config,
4013
0
                                    datum);
4014
0
}
4015
4016
/* Deletes an element of the "other_config" map column from the "Bridge" table in 'row'
4017
 * given the key value 'delete_key'.
4018
 *
4019
 */
4020
void
4021
ovsrec_bridge_update_other_config_delkey(const struct ovsrec_bridge *row, const char *delete_key)
4022
0
{
4023
0
    struct ovsdb_datum *datum;
4024
4025
0
    datum = xmalloc(sizeof *datum);
4026
0
    datum->n = 1;
4027
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4028
0
    datum->values = NULL;
4029
0
    datum->refcnt = NULL;
4030
4031
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
4032
4033
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
4034
0
                                    &ovsrec_bridge_col_other_config,
4035
0
                                    datum);
4036
0
}
4037
4038
/* Adds the value 'new_value' to the "ports" set column from the "Bridge" table
4039
 * in 'row'.
4040
 *
4041
 */
4042
void
4043
ovsrec_bridge_update_ports_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_port *new_value)
4044
0
{
4045
0
    struct ovsdb_datum *datum;
4046
4047
0
    datum = xmalloc(sizeof *datum);
4048
0
    datum->n = 1;
4049
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
4050
0
    datum->values = NULL;
4051
0
    datum->refcnt = NULL;
4052
4053
0
    datum->keys[0].uuid = new_value->header_.uuid;
4054
4055
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
4056
0
                                    &ovsrec_bridge_col_ports,
4057
0
                                    datum);
4058
0
}
4059
4060
/* Deletes the value 'delete_value' from the "ports" set column from the
4061
 * "Bridge" table in 'row'.
4062
 *
4063
 */
4064
void
4065
ovsrec_bridge_update_ports_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_port *delete_value)
4066
0
{
4067
0
    struct ovsdb_datum *datum;
4068
4069
0
    datum = xmalloc(sizeof *datum);
4070
0
    datum->n = 1;
4071
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
4072
0
    datum->values = NULL;
4073
0
    datum->refcnt = NULL;
4074
4075
0
    datum->keys[0].uuid = delete_value->header_.uuid;
4076
4077
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
4078
0
                                    &ovsrec_bridge_col_ports,
4079
0
                                    datum);
4080
0
}
4081
4082
/* Adds the value 'new_value' to the "protocols" set column from the "Bridge" table
4083
 * in 'row'.
4084
 *
4085
 */
4086
void
4087
ovsrec_bridge_update_protocols_addvalue(const struct ovsrec_bridge *row, const char *new_value)
4088
0
{
4089
0
    struct ovsdb_datum *datum;
4090
4091
0
    datum = xmalloc(sizeof *datum);
4092
0
    datum->n = 1;
4093
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
4094
0
    datum->values = NULL;
4095
0
    datum->refcnt = NULL;
4096
4097
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
4098
4099
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
4100
0
                                    &ovsrec_bridge_col_protocols,
4101
0
                                    datum);
4102
0
}
4103
4104
/* Deletes the value 'delete_value' from the "protocols" set column from the
4105
 * "Bridge" table in 'row'.
4106
 *
4107
 */
4108
void
4109
ovsrec_bridge_update_protocols_delvalue(const struct ovsrec_bridge *row, const char *delete_value)
4110
0
{
4111
0
    struct ovsdb_datum *datum;
4112
4113
0
    datum = xmalloc(sizeof *datum);
4114
0
    datum->n = 1;
4115
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
4116
0
    datum->values = NULL;
4117
0
    datum->refcnt = NULL;
4118
4119
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
4120
4121
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
4122
0
                                    &ovsrec_bridge_col_protocols,
4123
0
                                    datum);
4124
0
}
4125
4126
/* Sets an element of the "rstp_status" map column from the "Bridge" table in 'row'
4127
 * to 'new_value' given the key value 'new_key'.
4128
 *
4129
 */
4130
void
4131
ovsrec_bridge_update_rstp_status_setkey(const struct ovsrec_bridge *row, const char *new_key, const char *new_value)
4132
0
{
4133
0
    struct ovsdb_datum *datum;
4134
4135
0
    datum = xmalloc(sizeof *datum);
4136
0
    datum->n = 1;
4137
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4138
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
4139
0
    datum->refcnt = NULL;
4140
4141
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
4142
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
4143
4144
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
4145
0
                                    &ovsrec_bridge_col_rstp_status,
4146
0
                                    datum);
4147
0
}
4148
4149
/* Deletes an element of the "rstp_status" map column from the "Bridge" table in 'row'
4150
 * given the key value 'delete_key'.
4151
 *
4152
 */
4153
void
4154
ovsrec_bridge_update_rstp_status_delkey(const struct ovsrec_bridge *row, const char *delete_key)
4155
0
{
4156
0
    struct ovsdb_datum *datum;
4157
4158
0
    datum = xmalloc(sizeof *datum);
4159
0
    datum->n = 1;
4160
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4161
0
    datum->values = NULL;
4162
0
    datum->refcnt = NULL;
4163
4164
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
4165
4166
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
4167
0
                                    &ovsrec_bridge_col_rstp_status,
4168
0
                                    datum);
4169
0
}
4170
4171
/* Adds the value 'new_value' to the "sflow" set column from the "Bridge" table
4172
 * in 'row'.
4173
 *
4174
 */
4175
void
4176
ovsrec_bridge_update_sflow_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_sflow *new_value)
4177
0
{
4178
0
    struct ovsdb_datum *datum;
4179
4180
0
    datum = xmalloc(sizeof *datum);
4181
0
    datum->n = 1;
4182
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
4183
0
    datum->values = NULL;
4184
0
    datum->refcnt = NULL;
4185
4186
0
    datum->keys[0].uuid = new_value->header_.uuid;
4187
4188
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
4189
0
                                    &ovsrec_bridge_col_sflow,
4190
0
                                    datum);
4191
0
}
4192
4193
/* Deletes the value 'delete_value' from the "sflow" set column from the
4194
 * "Bridge" table in 'row'.
4195
 *
4196
 */
4197
void
4198
ovsrec_bridge_update_sflow_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_sflow *delete_value)
4199
0
{
4200
0
    struct ovsdb_datum *datum;
4201
4202
0
    datum = xmalloc(sizeof *datum);
4203
0
    datum->n = 1;
4204
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
4205
0
    datum->values = NULL;
4206
0
    datum->refcnt = NULL;
4207
4208
0
    datum->keys[0].uuid = delete_value->header_.uuid;
4209
4210
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
4211
0
                                    &ovsrec_bridge_col_sflow,
4212
0
                                    datum);
4213
0
}
4214
4215
/* Sets an element of the "status" map column from the "Bridge" table in 'row'
4216
 * to 'new_value' given the key value 'new_key'.
4217
 *
4218
 */
4219
void
4220
ovsrec_bridge_update_status_setkey(const struct ovsrec_bridge *row, const char *new_key, const char *new_value)
4221
0
{
4222
0
    struct ovsdb_datum *datum;
4223
4224
0
    datum = xmalloc(sizeof *datum);
4225
0
    datum->n = 1;
4226
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4227
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
4228
0
    datum->refcnt = NULL;
4229
4230
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
4231
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
4232
4233
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
4234
0
                                    &ovsrec_bridge_col_status,
4235
0
                                    datum);
4236
0
}
4237
4238
/* Deletes an element of the "status" map column from the "Bridge" table in 'row'
4239
 * given the key value 'delete_key'.
4240
 *
4241
 */
4242
void
4243
ovsrec_bridge_update_status_delkey(const struct ovsrec_bridge *row, const char *delete_key)
4244
0
{
4245
0
    struct ovsdb_datum *datum;
4246
4247
0
    datum = xmalloc(sizeof *datum);
4248
0
    datum->n = 1;
4249
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4250
0
    datum->values = NULL;
4251
0
    datum->refcnt = NULL;
4252
4253
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
4254
4255
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
4256
0
                                    &ovsrec_bridge_col_status,
4257
0
                                    datum);
4258
0
}
4259
4260
/* Sets the "auto_attach" column from the "Bridge" table in 'row' to
4261
 * the 'auto_attach' set.
4262
 *
4263
 * If "auto_attach" is null, the column will be the empty set,
4264
 * otherwise it will contain the specified value.
4265
 *
4266
 * The caller retains ownership of the arguments. */
4267
void
4268
ovsrec_bridge_add_clause_auto_attach(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *auto_attach)
4269
0
{
4270
0
    struct ovsdb_datum datum;
4271
4272
0
    datum.refcnt = NULL;
4273
4274
0
    if (auto_attach) {
4275
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4276
0
        datum.n = 1;
4277
0
        datum.keys = key;
4278
0
        key->uuid = *auto_attach;
4279
0
    } else {
4280
0
        datum.n = 0;
4281
0
        datum.keys = NULL;
4282
0
    }
4283
0
    datum.values = NULL;
4284
0
    ovsdb_idl_condition_add_clause(cond,
4285
0
                          function,
4286
0
                          &ovsrec_bridge_col_auto_attach,
4287
0
                          &datum);
4288
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_auto_attach.type);
4289
0
}
4290
4291
/* Sets the "controller" column from the "Bridge" table in 'row' to
4292
 * the 'controller' set with 'n_controller' entries.
4293
 *
4294
 * The caller retains ownership of the arguments. */
4295
void
4296
ovsrec_bridge_add_clause_controller(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **controller, size_t n_controller)
4297
0
{
4298
0
    struct ovsdb_datum datum;
4299
4300
0
    datum.refcnt = NULL;
4301
0
    datum.n = n_controller;
4302
0
    datum.keys = n_controller ? xmalloc(n_controller * sizeof *datum.keys) : NULL;
4303
0
    datum.values = NULL;
4304
0
    for (size_t i = 0; i < n_controller; i++) {
4305
0
        datum.keys[i].uuid = *controller[i];
4306
0
    }
4307
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_controller.type);
4308
0
    ovsdb_idl_condition_add_clause(cond,
4309
0
                          function,
4310
0
                          &ovsrec_bridge_col_controller,
4311
0
                          &datum);
4312
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_controller.type);
4313
0
}
4314
4315
/* Sets the "datapath_id" column from the "Bridge" table in 'row' to
4316
 * the 'datapath_id' set.
4317
 *
4318
 * If "datapath_id" is null, the column will be the empty set,
4319
 * otherwise it will contain the specified value.
4320
 *
4321
 * The caller retains ownership of the arguments. */
4322
void
4323
ovsrec_bridge_add_clause_datapath_id(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *datapath_id)
4324
0
{
4325
0
    struct ovsdb_datum datum;
4326
4327
0
    datum.refcnt = NULL;
4328
4329
0
    if (datapath_id) {
4330
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4331
0
        datum.n = 1;
4332
0
        datum.keys = key;
4333
0
        key->s = ovsdb_atom_string_create(datapath_id);
4334
0
    } else {
4335
0
        datum.n = 0;
4336
0
        datum.keys = NULL;
4337
0
    }
4338
0
    datum.values = NULL;
4339
0
    ovsdb_idl_condition_add_clause(cond,
4340
0
                          function,
4341
0
                          &ovsrec_bridge_col_datapath_id,
4342
0
                          &datum);
4343
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_datapath_id.type);
4344
0
}
4345
4346
/* Sets the "datapath_type" column from the "Bridge" table in 'row' to
4347
 * 'datapath_type'.
4348
 *
4349
 * The caller retains ownership of the arguments. */
4350
void
4351
ovsrec_bridge_add_clause_datapath_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *datapath_type)
4352
0
{
4353
0
    struct ovsdb_datum datum;
4354
4355
0
    datum.refcnt = NULL;
4356
4357
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4358
4359
0
    datum.n = 1;
4360
0
    datum.keys = key;
4361
0
    key->s = ovsdb_atom_string_create(datapath_type);
4362
0
    datum.values = NULL;
4363
0
    ovsdb_idl_condition_add_clause(cond,
4364
0
                          function,
4365
0
                          &ovsrec_bridge_col_datapath_type,
4366
0
                          &datum);
4367
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_datapath_type.type);
4368
0
}
4369
4370
/* Sets the "datapath_version" column from the "Bridge" table in 'row' to
4371
 * 'datapath_version'.
4372
 *
4373
 * The caller retains ownership of the arguments. */
4374
void
4375
ovsrec_bridge_add_clause_datapath_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *datapath_version)
4376
0
{
4377
0
    struct ovsdb_datum datum;
4378
4379
0
    datum.refcnt = NULL;
4380
4381
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4382
4383
0
    datum.n = 1;
4384
0
    datum.keys = key;
4385
0
    key->s = ovsdb_atom_string_create(datapath_version);
4386
0
    datum.values = NULL;
4387
0
    ovsdb_idl_condition_add_clause(cond,
4388
0
                          function,
4389
0
                          &ovsrec_bridge_col_datapath_version,
4390
0
                          &datum);
4391
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_datapath_version.type);
4392
0
}
4393
4394
/* Sets the "external_ids" column's value from the "Bridge" table in 'row'
4395
 * to 'external_ids'.
4396
 *
4397
 * The caller retains ownership of 'external_ids' and everything in it. */
4398
void
4399
ovsrec_bridge_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
4400
0
{
4401
0
    struct ovsdb_datum datum;
4402
4403
0
    if (external_ids) {
4404
0
        ovsdb_datum_from_smap(&datum, external_ids);
4405
0
    } else {
4406
0
        ovsdb_datum_init_empty(&datum);
4407
0
    }
4408
4409
0
    ovsdb_idl_condition_add_clause(cond,
4410
0
                                   function,
4411
0
                                   &ovsrec_bridge_col_external_ids,
4412
0
                                   &datum);
4413
4414
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_external_ids.type);
4415
0
}
4416
4417
4418
/* Sets the "fail_mode" column from the "Bridge" table in 'row' to
4419
 * the 'fail_mode' set.
4420
 *
4421
 * If "fail_mode" is null, the column will be the empty set,
4422
 * otherwise it will contain the specified value.
4423
 *
4424
 * Argument constraints: either "secure" or "standalone"
4425
 *
4426
 * The caller retains ownership of the arguments. */
4427
void
4428
ovsrec_bridge_add_clause_fail_mode(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *fail_mode)
4429
0
{
4430
0
    struct ovsdb_datum datum;
4431
4432
0
    datum.refcnt = NULL;
4433
4434
0
    if (fail_mode) {
4435
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4436
0
        datum.n = 1;
4437
0
        datum.keys = key;
4438
0
        key->s = ovsdb_atom_string_create(fail_mode);
4439
0
    } else {
4440
0
        datum.n = 0;
4441
0
        datum.keys = NULL;
4442
0
    }
4443
0
    datum.values = NULL;
4444
0
    ovsdb_idl_condition_add_clause(cond,
4445
0
                          function,
4446
0
                          &ovsrec_bridge_col_fail_mode,
4447
0
                          &datum);
4448
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_fail_mode.type);
4449
0
}
4450
4451
/* Sets the "flood_vlans" column from the "Bridge" table in 'row' to
4452
 * the 'flood_vlans' set with 'n_flood_vlans' entries.
4453
 *
4454
 * Argument constraints: in range 0 to 4,095
4455
 *
4456
 * The caller retains ownership of the arguments. */
4457
void
4458
ovsrec_bridge_add_clause_flood_vlans(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *flood_vlans, size_t n_flood_vlans)
4459
0
{
4460
0
    struct ovsdb_datum datum;
4461
4462
0
    datum.refcnt = NULL;
4463
0
    datum.n = n_flood_vlans;
4464
0
    datum.keys = n_flood_vlans ? xmalloc(n_flood_vlans * sizeof *datum.keys) : NULL;
4465
0
    datum.values = NULL;
4466
0
    for (size_t i = 0; i < n_flood_vlans; i++) {
4467
0
        datum.keys[i].integer = flood_vlans[i];
4468
0
    }
4469
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_flood_vlans.type);
4470
0
    ovsdb_idl_condition_add_clause(cond,
4471
0
                          function,
4472
0
                          &ovsrec_bridge_col_flood_vlans,
4473
0
                          &datum);
4474
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_flood_vlans.type);
4475
0
}
4476
4477
/* Sets the "flow_tables" column from the "Bridge" table in 'row' to
4478
 * the map with keys 'key_flow_tables' and values 'value_flow_tables'
4479
 * with 'n_flow_tables' entries.
4480
 *
4481
 * Argument constraints: key in range 0 to 254
4482
 *
4483
 * The caller retains ownership of the arguments. */
4484
void
4485
ovsrec_bridge_add_clause_flow_tables(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *key_flow_tables, struct uuid **value_flow_tables, size_t n_flow_tables)
4486
0
{
4487
0
    struct ovsdb_datum datum;
4488
4489
0
    datum.refcnt = NULL;
4490
0
    datum.n = n_flow_tables;
4491
0
    datum.keys = n_flow_tables ? xmalloc(n_flow_tables * sizeof *datum.keys) : NULL;
4492
0
    datum.values = xmalloc(n_flow_tables * sizeof *datum.values);
4493
0
    for (size_t i = 0; i < n_flow_tables; i++) {
4494
0
        datum.keys[i].integer = key_flow_tables[i];
4495
0
        datum.values[i].uuid = *value_flow_tables[i];
4496
0
    }
4497
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_flow_tables.type);
4498
0
    ovsdb_idl_condition_add_clause(cond,
4499
0
                          function,
4500
0
                          &ovsrec_bridge_col_flow_tables,
4501
0
                          &datum);
4502
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_flow_tables.type);
4503
0
}
4504
4505
/* Sets the "ipfix" column from the "Bridge" table in 'row' to
4506
 * the 'ipfix' set.
4507
 *
4508
 * If "ipfix" is null, the column will be the empty set,
4509
 * otherwise it will contain the specified value.
4510
 *
4511
 * The caller retains ownership of the arguments. */
4512
void
4513
ovsrec_bridge_add_clause_ipfix(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *ipfix)
4514
0
{
4515
0
    struct ovsdb_datum datum;
4516
4517
0
    datum.refcnt = NULL;
4518
4519
0
    if (ipfix) {
4520
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4521
0
        datum.n = 1;
4522
0
        datum.keys = key;
4523
0
        key->uuid = *ipfix;
4524
0
    } else {
4525
0
        datum.n = 0;
4526
0
        datum.keys = NULL;
4527
0
    }
4528
0
    datum.values = NULL;
4529
0
    ovsdb_idl_condition_add_clause(cond,
4530
0
                          function,
4531
0
                          &ovsrec_bridge_col_ipfix,
4532
0
                          &datum);
4533
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_ipfix.type);
4534
0
}
4535
4536
/* Sets the "mcast_snooping_enable" column from the "Bridge" table in 'row' to
4537
 * 'mcast_snooping_enable'.
4538
 *
4539
 * The caller retains ownership of the arguments. */
4540
void
4541
ovsrec_bridge_add_clause_mcast_snooping_enable(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool mcast_snooping_enable)
4542
0
{
4543
0
    struct ovsdb_datum datum;
4544
4545
0
    datum.refcnt = NULL;
4546
4547
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4548
4549
0
    datum.n = 1;
4550
0
    datum.keys = key;
4551
0
    key->boolean = mcast_snooping_enable;
4552
0
    datum.values = NULL;
4553
0
    ovsdb_idl_condition_add_clause(cond,
4554
0
                          function,
4555
0
                          &ovsrec_bridge_col_mcast_snooping_enable,
4556
0
                          &datum);
4557
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_mcast_snooping_enable.type);
4558
0
}
4559
4560
/* Sets the "mirrors" column from the "Bridge" table in 'row' to
4561
 * the 'mirrors' set with 'n_mirrors' entries.
4562
 *
4563
 * The caller retains ownership of the arguments. */
4564
void
4565
ovsrec_bridge_add_clause_mirrors(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **mirrors, size_t n_mirrors)
4566
0
{
4567
0
    struct ovsdb_datum datum;
4568
4569
0
    datum.refcnt = NULL;
4570
0
    datum.n = n_mirrors;
4571
0
    datum.keys = n_mirrors ? xmalloc(n_mirrors * sizeof *datum.keys) : NULL;
4572
0
    datum.values = NULL;
4573
0
    for (size_t i = 0; i < n_mirrors; i++) {
4574
0
        datum.keys[i].uuid = *mirrors[i];
4575
0
    }
4576
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_mirrors.type);
4577
0
    ovsdb_idl_condition_add_clause(cond,
4578
0
                          function,
4579
0
                          &ovsrec_bridge_col_mirrors,
4580
0
                          &datum);
4581
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_mirrors.type);
4582
0
}
4583
4584
/* Sets the "name" column from the "Bridge" table in 'row' to
4585
 * 'name'.
4586
 *
4587
 * The caller retains ownership of the arguments. */
4588
void
4589
ovsrec_bridge_add_clause_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *name)
4590
0
{
4591
0
    struct ovsdb_datum datum;
4592
4593
0
    datum.refcnt = NULL;
4594
4595
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4596
4597
0
    datum.n = 1;
4598
0
    datum.keys = key;
4599
0
    key->s = ovsdb_atom_string_create(name);
4600
0
    datum.values = NULL;
4601
0
    ovsdb_idl_condition_add_clause(cond,
4602
0
                          function,
4603
0
                          &ovsrec_bridge_col_name,
4604
0
                          &datum);
4605
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_name.type);
4606
0
}
4607
4608
/* Sets the "netflow" column from the "Bridge" table in 'row' to
4609
 * the 'netflow' set.
4610
 *
4611
 * If "netflow" is null, the column will be the empty set,
4612
 * otherwise it will contain the specified value.
4613
 *
4614
 * The caller retains ownership of the arguments. */
4615
void
4616
ovsrec_bridge_add_clause_netflow(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *netflow)
4617
0
{
4618
0
    struct ovsdb_datum datum;
4619
4620
0
    datum.refcnt = NULL;
4621
4622
0
    if (netflow) {
4623
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4624
0
        datum.n = 1;
4625
0
        datum.keys = key;
4626
0
        key->uuid = *netflow;
4627
0
    } else {
4628
0
        datum.n = 0;
4629
0
        datum.keys = NULL;
4630
0
    }
4631
0
    datum.values = NULL;
4632
0
    ovsdb_idl_condition_add_clause(cond,
4633
0
                          function,
4634
0
                          &ovsrec_bridge_col_netflow,
4635
0
                          &datum);
4636
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_netflow.type);
4637
0
}
4638
4639
/* Sets the "other_config" column's value from the "Bridge" table in 'row'
4640
 * to 'other_config'.
4641
 *
4642
 * The caller retains ownership of 'other_config' and everything in it. */
4643
void
4644
ovsrec_bridge_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
4645
0
{
4646
0
    struct ovsdb_datum datum;
4647
4648
0
    if (other_config) {
4649
0
        ovsdb_datum_from_smap(&datum, other_config);
4650
0
    } else {
4651
0
        ovsdb_datum_init_empty(&datum);
4652
0
    }
4653
4654
0
    ovsdb_idl_condition_add_clause(cond,
4655
0
                                   function,
4656
0
                                   &ovsrec_bridge_col_other_config,
4657
0
                                   &datum);
4658
4659
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_other_config.type);
4660
0
}
4661
4662
4663
/* Sets the "ports" column from the "Bridge" table in 'row' to
4664
 * the 'ports' set with 'n_ports' entries.
4665
 *
4666
 * The caller retains ownership of the arguments. */
4667
void
4668
ovsrec_bridge_add_clause_ports(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **ports, size_t n_ports)
4669
0
{
4670
0
    struct ovsdb_datum datum;
4671
4672
0
    datum.refcnt = NULL;
4673
0
    datum.n = n_ports;
4674
0
    datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
4675
0
    datum.values = NULL;
4676
0
    for (size_t i = 0; i < n_ports; i++) {
4677
0
        datum.keys[i].uuid = *ports[i];
4678
0
    }
4679
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_ports.type);
4680
0
    ovsdb_idl_condition_add_clause(cond,
4681
0
                          function,
4682
0
                          &ovsrec_bridge_col_ports,
4683
0
                          &datum);
4684
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_ports.type);
4685
0
}
4686
4687
/* Sets the "protocols" column from the "Bridge" table in 'row' to
4688
 * the 'protocols' set with 'n_protocols' entries.
4689
 *
4690
 * Argument constraints: one of "OpenFlow10", "OpenFlow11", "OpenFlow12", "OpenFlow13", "OpenFlow14", or "OpenFlow15"
4691
 *
4692
 * The caller retains ownership of the arguments. */
4693
void
4694
ovsrec_bridge_add_clause_protocols(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **protocols, size_t n_protocols)
4695
0
{
4696
0
    struct ovsdb_datum datum;
4697
4698
0
    datum.refcnt = NULL;
4699
0
    datum.n = n_protocols;
4700
0
    datum.keys = n_protocols ? xmalloc(n_protocols * sizeof *datum.keys) : NULL;
4701
0
    datum.values = NULL;
4702
0
    for (size_t i = 0; i < n_protocols; i++) {
4703
0
        datum.keys[i].s = ovsdb_atom_string_create(protocols[i]);
4704
0
    }
4705
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_protocols.type);
4706
0
    ovsdb_idl_condition_add_clause(cond,
4707
0
                          function,
4708
0
                          &ovsrec_bridge_col_protocols,
4709
0
                          &datum);
4710
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_protocols.type);
4711
0
}
4712
4713
/* Sets the "rstp_enable" column from the "Bridge" table in 'row' to
4714
 * 'rstp_enable'.
4715
 *
4716
 * The caller retains ownership of the arguments. */
4717
void
4718
ovsrec_bridge_add_clause_rstp_enable(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool rstp_enable)
4719
0
{
4720
0
    struct ovsdb_datum datum;
4721
4722
0
    datum.refcnt = NULL;
4723
4724
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4725
4726
0
    datum.n = 1;
4727
0
    datum.keys = key;
4728
0
    key->boolean = rstp_enable;
4729
0
    datum.values = NULL;
4730
0
    ovsdb_idl_condition_add_clause(cond,
4731
0
                          function,
4732
0
                          &ovsrec_bridge_col_rstp_enable,
4733
0
                          &datum);
4734
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_rstp_enable.type);
4735
0
}
4736
4737
/* Sets the "rstp_status" column's value from the "Bridge" table in 'row'
4738
 * to 'rstp_status'.
4739
 *
4740
 * The caller retains ownership of 'rstp_status' and everything in it. */
4741
void
4742
ovsrec_bridge_add_clause_rstp_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *rstp_status)
4743
0
{
4744
0
    struct ovsdb_datum datum;
4745
4746
0
    if (rstp_status) {
4747
0
        ovsdb_datum_from_smap(&datum, rstp_status);
4748
0
    } else {
4749
0
        ovsdb_datum_init_empty(&datum);
4750
0
    }
4751
4752
0
    ovsdb_idl_condition_add_clause(cond,
4753
0
                                   function,
4754
0
                                   &ovsrec_bridge_col_rstp_status,
4755
0
                                   &datum);
4756
4757
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_rstp_status.type);
4758
0
}
4759
4760
4761
/* Sets the "sflow" column from the "Bridge" table in 'row' to
4762
 * the 'sflow' set.
4763
 *
4764
 * If "sflow" is null, the column will be the empty set,
4765
 * otherwise it will contain the specified value.
4766
 *
4767
 * The caller retains ownership of the arguments. */
4768
void
4769
ovsrec_bridge_add_clause_sflow(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *sflow)
4770
0
{
4771
0
    struct ovsdb_datum datum;
4772
4773
0
    datum.refcnt = NULL;
4774
4775
0
    if (sflow) {
4776
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4777
0
        datum.n = 1;
4778
0
        datum.keys = key;
4779
0
        key->uuid = *sflow;
4780
0
    } else {
4781
0
        datum.n = 0;
4782
0
        datum.keys = NULL;
4783
0
    }
4784
0
    datum.values = NULL;
4785
0
    ovsdb_idl_condition_add_clause(cond,
4786
0
                          function,
4787
0
                          &ovsrec_bridge_col_sflow,
4788
0
                          &datum);
4789
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_sflow.type);
4790
0
}
4791
4792
/* Sets the "status" column's value from the "Bridge" table in 'row'
4793
 * to 'status'.
4794
 *
4795
 * The caller retains ownership of 'status' and everything in it. */
4796
void
4797
ovsrec_bridge_add_clause_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *status)
4798
0
{
4799
0
    struct ovsdb_datum datum;
4800
4801
0
    if (status) {
4802
0
        ovsdb_datum_from_smap(&datum, status);
4803
0
    } else {
4804
0
        ovsdb_datum_init_empty(&datum);
4805
0
    }
4806
4807
0
    ovsdb_idl_condition_add_clause(cond,
4808
0
                                   function,
4809
0
                                   &ovsrec_bridge_col_status,
4810
0
                                   &datum);
4811
4812
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_status.type);
4813
0
}
4814
4815
4816
/* Sets the "stp_enable" column from the "Bridge" table in 'row' to
4817
 * 'stp_enable'.
4818
 *
4819
 * The caller retains ownership of the arguments. */
4820
void
4821
ovsrec_bridge_add_clause_stp_enable(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool stp_enable)
4822
0
{
4823
0
    struct ovsdb_datum datum;
4824
4825
0
    datum.refcnt = NULL;
4826
4827
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4828
4829
0
    datum.n = 1;
4830
0
    datum.keys = key;
4831
0
    key->boolean = stp_enable;
4832
0
    datum.values = NULL;
4833
0
    ovsdb_idl_condition_add_clause(cond,
4834
0
                          function,
4835
0
                          &ovsrec_bridge_col_stp_enable,
4836
0
                          &datum);
4837
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_stp_enable.type);
4838
0
}
4839
4840
/* Destroy 'row' of kind "Bridge". The row must have been
4841
 * created with ovsdb_idl_index_init_row.
4842
 */
4843
void
4844
ovsrec_bridge_index_destroy_row(const struct ovsrec_bridge *row)
4845
0
{
4846
0
    ovsdb_idl_index_destroy_row(&row->header_);
4847
0
}
4848
        
4849
4850
/* Creates a new row of kind "Bridge". */
4851
struct ovsrec_bridge *
4852
ovsrec_bridge_index_init_row(struct ovsdb_idl_index *index)
4853
0
{
4854
0
    ovs_assert(index->table->class_ == &ovsrec_table_bridge);
4855
0
    return ALIGNED_CAST(struct ovsrec_bridge *, ovsdb_idl_index_init_row(index));
4856
0
}
4857
4858
struct ovsrec_bridge *
4859
ovsrec_bridge_index_find(struct ovsdb_idl_index *index, const struct ovsrec_bridge *target)
4860
0
{
4861
0
    ovs_assert(index->table->class_ == &ovsrec_table_bridge);
4862
0
    return ovsrec_bridge_cast(ovsdb_idl_index_find(index, &target->header_));
4863
0
}
4864
4865
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
4866
int
4867
ovsrec_bridge_index_compare(
4868
    struct ovsdb_idl_index *index, 
4869
    const struct ovsrec_bridge *a, 
4870
    const struct ovsrec_bridge *b)
4871
0
{
4872
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
4873
0
}
4874
4875
struct ovsdb_idl_cursor
4876
ovsrec_bridge_cursor_first(struct ovsdb_idl_index *index)
4877
0
{
4878
0
    ovs_assert(index->table->class_ == &ovsrec_table_bridge);
4879
0
    return ovsdb_idl_cursor_first(index);
4880
0
}
4881
4882
struct ovsdb_idl_cursor
4883
ovsrec_bridge_cursor_first_eq(
4884
    struct ovsdb_idl_index *index, const struct ovsrec_bridge *target)
4885
0
{
4886
0
    ovs_assert(index->table->class_ == &ovsrec_table_bridge);
4887
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
4888
0
}
4889
4890
struct ovsdb_idl_cursor
4891
ovsrec_bridge_cursor_first_ge(
4892
    struct ovsdb_idl_index *index, const struct ovsrec_bridge *target)
4893
0
{
4894
0
    ovs_assert(index->table->class_ == &ovsrec_table_bridge);
4895
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
4896
0
}
4897
4898
struct ovsrec_bridge *
4899
ovsrec_bridge_cursor_data(struct ovsdb_idl_cursor *cursor)
4900
0
{
4901
0
    return ovsrec_bridge_cast(ovsdb_idl_cursor_data(cursor));
4902
0
}
4903
4904
4905
/* Sets the "auto_attach" column from the "Bridge" table in 'row' to
4906
 * the 'auto_attach' set.
4907
 *
4908
 * If "auto_attach" is null, the column will be the empty set,
4909
 * otherwise it will contain the specified value.
4910
 *
4911
 * The caller retains ownership of the arguments. */
4912
void
4913
ovsrec_bridge_index_set_auto_attach(const struct ovsrec_bridge *row, const struct ovsrec_autoattach *auto_attach)
4914
0
{
4915
0
    struct ovsdb_datum datum;
4916
4917
0
    datum.refcnt = NULL;
4918
0
    union ovsdb_atom *key;
4919
4920
0
    if (auto_attach) {
4921
0
        key = xmalloc(sizeof (union ovsdb_atom));
4922
0
        datum.n = 1;
4923
0
        datum.keys = key;
4924
0
        key->uuid = auto_attach->header_.uuid;
4925
0
    } else {
4926
0
        datum.n = 0;
4927
0
        datum.keys = NULL;
4928
0
    }
4929
0
    datum.values = NULL;
4930
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_AUTO_ATTACH ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
4931
0
}
4932
4933
/* Sets the "controller" column from the "Bridge" table in 'row' to
4934
 * the 'controller' set with 'n_controller' entries.
4935
 *
4936
 * The caller retains ownership of the arguments. */
4937
void
4938
ovsrec_bridge_index_set_controller(const struct ovsrec_bridge *row, struct ovsrec_controller **controller, size_t n_controller)
4939
0
{
4940
0
    struct ovsdb_datum datum;
4941
4942
0
    datum.refcnt = NULL;
4943
0
    size_t i;
4944
4945
0
    datum.n = n_controller;
4946
0
    datum.keys = n_controller ? xmalloc(n_controller * sizeof *datum.keys) : NULL;
4947
0
    datum.values = NULL;
4948
0
    for (i = 0; i < n_controller; i++) {
4949
0
        datum.keys[i].uuid = controller[i]->header_.uuid;
4950
0
    }
4951
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_controller.type);
4952
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_CONTROLLER ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
4953
0
}
4954
4955
/* Sets the "datapath_id" column from the "Bridge" table in 'row' to
4956
 * the 'datapath_id' set.
4957
 *
4958
 * If "datapath_id" is null, the column will be the empty set,
4959
 * otherwise it will contain the specified value.
4960
 *
4961
 * The caller retains ownership of the arguments. */
4962
void
4963
ovsrec_bridge_index_set_datapath_id(const struct ovsrec_bridge *row, const char *datapath_id)
4964
0
{
4965
0
    struct ovsdb_datum datum;
4966
4967
0
    datum.refcnt = NULL;
4968
0
    union ovsdb_atom *key;
4969
4970
0
    if (datapath_id) {
4971
0
        key = xmalloc(sizeof (union ovsdb_atom));
4972
0
        datum.n = 1;
4973
0
        datum.keys = key;
4974
0
        key->s = ovsdb_atom_string_create(datapath_id);
4975
0
    } else {
4976
0
        datum.n = 0;
4977
0
        datum.keys = NULL;
4978
0
    }
4979
0
    datum.values = NULL;
4980
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_DATAPATH_ID ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
4981
0
}
4982
4983
/* Sets the "datapath_type" column from the "Bridge" table in 'row' to
4984
 * 'datapath_type'.
4985
 *
4986
 * The caller retains ownership of the arguments. */
4987
void
4988
ovsrec_bridge_index_set_datapath_type(const struct ovsrec_bridge *row, const char *datapath_type)
4989
0
{
4990
0
    struct ovsdb_datum datum;
4991
4992
0
    datum.refcnt = NULL;
4993
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
4994
4995
0
    datum.n = 1;
4996
0
    datum.keys = key;
4997
0
    key->s = ovsdb_atom_string_create(datapath_type);
4998
0
    datum.values = NULL;
4999
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_DATAPATH_TYPE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5000
0
}
5001
5002
/* Sets the "datapath_version" column from the "Bridge" table in 'row' to
5003
 * 'datapath_version'.
5004
 *
5005
 * The caller retains ownership of the arguments. */
5006
void
5007
ovsrec_bridge_index_set_datapath_version(const struct ovsrec_bridge *row, const char *datapath_version)
5008
0
{
5009
0
    struct ovsdb_datum datum;
5010
5011
0
    datum.refcnt = NULL;
5012
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
5013
5014
0
    datum.n = 1;
5015
0
    datum.keys = key;
5016
0
    key->s = ovsdb_atom_string_create(datapath_version);
5017
0
    datum.values = NULL;
5018
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_DATAPATH_VERSION ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5019
0
}
5020
5021
/* Sets the "external_ids" column's value from the "Bridge" table in 'row'
5022
 * to 'external_ids'.
5023
 *
5024
 * The caller retains ownership of 'external_ids' and everything in it. */
5025
void
5026
ovsrec_bridge_index_set_external_ids(const struct ovsrec_bridge *row, const struct smap *external_ids)
5027
0
{
5028
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
5029
5030
0
    if (external_ids) {
5031
0
        struct smap_node *node;
5032
0
        size_t i;
5033
5034
0
        datum->n = smap_count(external_ids);
5035
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
5036
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
5037
0
        datum->refcnt = NULL;
5038
5039
0
        i = 0;
5040
0
        SMAP_FOR_EACH (node, external_ids) {
5041
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
5042
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
5043
0
            i++;
5044
0
        }
5045
0
        ovsdb_datum_sort_unique(datum, &ovsrec_bridge_col_external_ids.type);
5046
0
    } else {
5047
0
        ovsdb_datum_init_empty(datum);
5048
0
    }
5049
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
5050
0
                          &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_EXTERNAL_IDS],
5051
0
                          datum,
5052
0
                          &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5053
0
    free(datum);
5054
0
}
5055
5056
5057
/* Sets the "fail_mode" column from the "Bridge" table in 'row' to
5058
 * the 'fail_mode' set.
5059
 *
5060
 * If "fail_mode" is null, the column will be the empty set,
5061
 * otherwise it will contain the specified value.
5062
 *
5063
 * Argument constraints: either "secure" or "standalone"
5064
 *
5065
 * The caller retains ownership of the arguments. */
5066
void
5067
ovsrec_bridge_index_set_fail_mode(const struct ovsrec_bridge *row, const char *fail_mode)
5068
0
{
5069
0
    struct ovsdb_datum datum;
5070
5071
0
    datum.refcnt = NULL;
5072
0
    union ovsdb_atom *key;
5073
5074
0
    if (fail_mode) {
5075
0
        key = xmalloc(sizeof (union ovsdb_atom));
5076
0
        datum.n = 1;
5077
0
        datum.keys = key;
5078
0
        key->s = ovsdb_atom_string_create(fail_mode);
5079
0
    } else {
5080
0
        datum.n = 0;
5081
0
        datum.keys = NULL;
5082
0
    }
5083
0
    datum.values = NULL;
5084
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_FAIL_MODE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5085
0
}
5086
5087
/* Sets the "flood_vlans" column from the "Bridge" table in 'row' to
5088
 * the 'flood_vlans' set with 'n_flood_vlans' entries.
5089
 *
5090
 * Argument constraints: in range 0 to 4,095
5091
 *
5092
 * The caller retains ownership of the arguments. */
5093
void
5094
ovsrec_bridge_index_set_flood_vlans(const struct ovsrec_bridge *row, const int64_t *flood_vlans, size_t n_flood_vlans)
5095
0
{
5096
0
    struct ovsdb_datum datum;
5097
5098
0
    datum.refcnt = NULL;
5099
0
    size_t i;
5100
5101
0
    datum.n = n_flood_vlans;
5102
0
    datum.keys = n_flood_vlans ? xmalloc(n_flood_vlans * sizeof *datum.keys) : NULL;
5103
0
    datum.values = NULL;
5104
0
    for (i = 0; i < n_flood_vlans; i++) {
5105
0
        datum.keys[i].integer = flood_vlans[i];
5106
0
    }
5107
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_flood_vlans.type);
5108
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_FLOOD_VLANS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5109
0
}
5110
5111
/* Sets the "flow_tables" column from the "Bridge" table in 'row' to
5112
 * the map with keys 'key_flow_tables' and values 'value_flow_tables'
5113
 * with 'n_flow_tables' entries.
5114
 *
5115
 * Argument constraints: key in range 0 to 254
5116
 *
5117
 * The caller retains ownership of the arguments. */
5118
void
5119
ovsrec_bridge_index_set_flow_tables(const struct ovsrec_bridge *row, const int64_t *key_flow_tables, struct ovsrec_flow_table **value_flow_tables, size_t n_flow_tables)
5120
0
{
5121
0
    struct ovsdb_datum datum;
5122
5123
0
    datum.refcnt = NULL;
5124
0
    size_t i;
5125
5126
0
    datum.n = n_flow_tables;
5127
0
    datum.keys = n_flow_tables ? xmalloc(n_flow_tables * sizeof *datum.keys) : NULL;
5128
0
    datum.values = xmalloc(n_flow_tables * sizeof *datum.values);
5129
0
    for (i = 0; i < n_flow_tables; i++) {
5130
0
        datum.keys[i].integer = key_flow_tables[i];
5131
0
        datum.values[i].uuid = value_flow_tables[i]->header_.uuid;
5132
0
    }
5133
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_flow_tables.type);
5134
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_FLOW_TABLES ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5135
0
}
5136
5137
/* Sets the "ipfix" column from the "Bridge" table in 'row' to
5138
 * the 'ipfix' set.
5139
 *
5140
 * If "ipfix" is null, the column will be the empty set,
5141
 * otherwise it will contain the specified value.
5142
 *
5143
 * The caller retains ownership of the arguments. */
5144
void
5145
ovsrec_bridge_index_set_ipfix(const struct ovsrec_bridge *row, const struct ovsrec_ipfix *ipfix)
5146
0
{
5147
0
    struct ovsdb_datum datum;
5148
5149
0
    datum.refcnt = NULL;
5150
0
    union ovsdb_atom *key;
5151
5152
0
    if (ipfix) {
5153
0
        key = xmalloc(sizeof (union ovsdb_atom));
5154
0
        datum.n = 1;
5155
0
        datum.keys = key;
5156
0
        key->uuid = ipfix->header_.uuid;
5157
0
    } else {
5158
0
        datum.n = 0;
5159
0
        datum.keys = NULL;
5160
0
    }
5161
0
    datum.values = NULL;
5162
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_IPFIX ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5163
0
}
5164
5165
/* Sets the "mcast_snooping_enable" column from the "Bridge" table in 'row' to
5166
 * 'mcast_snooping_enable'.
5167
 *
5168
 * The caller retains ownership of the arguments. */
5169
void
5170
ovsrec_bridge_index_set_mcast_snooping_enable(const struct ovsrec_bridge *row, bool mcast_snooping_enable)
5171
0
{
5172
0
    struct ovsdb_datum datum;
5173
5174
0
    datum.refcnt = NULL;
5175
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
5176
5177
0
    datum.n = 1;
5178
0
    datum.keys = key;
5179
0
    key->boolean = mcast_snooping_enable;
5180
0
    datum.values = NULL;
5181
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_MCAST_SNOOPING_ENABLE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5182
0
}
5183
5184
/* Sets the "mirrors" column from the "Bridge" table in 'row' to
5185
 * the 'mirrors' set with 'n_mirrors' entries.
5186
 *
5187
 * The caller retains ownership of the arguments. */
5188
void
5189
ovsrec_bridge_index_set_mirrors(const struct ovsrec_bridge *row, struct ovsrec_mirror **mirrors, size_t n_mirrors)
5190
0
{
5191
0
    struct ovsdb_datum datum;
5192
5193
0
    datum.refcnt = NULL;
5194
0
    size_t i;
5195
5196
0
    datum.n = n_mirrors;
5197
0
    datum.keys = n_mirrors ? xmalloc(n_mirrors * sizeof *datum.keys) : NULL;
5198
0
    datum.values = NULL;
5199
0
    for (i = 0; i < n_mirrors; i++) {
5200
0
        datum.keys[i].uuid = mirrors[i]->header_.uuid;
5201
0
    }
5202
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_mirrors.type);
5203
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_MIRRORS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5204
0
}
5205
5206
/* Sets the "name" column from the "Bridge" table in 'row' to
5207
 * 'name'.
5208
 *
5209
 * The caller retains ownership of the arguments. */
5210
void
5211
ovsrec_bridge_index_set_name(const struct ovsrec_bridge *row, const char *name)
5212
0
{
5213
0
    struct ovsdb_datum datum;
5214
5215
0
    datum.refcnt = NULL;
5216
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
5217
5218
0
    datum.n = 1;
5219
0
    datum.keys = key;
5220
0
    key->s = ovsdb_atom_string_create(name);
5221
0
    datum.values = NULL;
5222
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_NAME ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5223
0
}
5224
5225
/* Sets the "netflow" column from the "Bridge" table in 'row' to
5226
 * the 'netflow' set.
5227
 *
5228
 * If "netflow" is null, the column will be the empty set,
5229
 * otherwise it will contain the specified value.
5230
 *
5231
 * The caller retains ownership of the arguments. */
5232
void
5233
ovsrec_bridge_index_set_netflow(const struct ovsrec_bridge *row, const struct ovsrec_netflow *netflow)
5234
0
{
5235
0
    struct ovsdb_datum datum;
5236
5237
0
    datum.refcnt = NULL;
5238
0
    union ovsdb_atom *key;
5239
5240
0
    if (netflow) {
5241
0
        key = xmalloc(sizeof (union ovsdb_atom));
5242
0
        datum.n = 1;
5243
0
        datum.keys = key;
5244
0
        key->uuid = netflow->header_.uuid;
5245
0
    } else {
5246
0
        datum.n = 0;
5247
0
        datum.keys = NULL;
5248
0
    }
5249
0
    datum.values = NULL;
5250
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_NETFLOW ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5251
0
}
5252
5253
/* Sets the "other_config" column's value from the "Bridge" table in 'row'
5254
 * to 'other_config'.
5255
 *
5256
 * The caller retains ownership of 'other_config' and everything in it. */
5257
void
5258
ovsrec_bridge_index_set_other_config(const struct ovsrec_bridge *row, const struct smap *other_config)
5259
0
{
5260
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
5261
5262
0
    if (other_config) {
5263
0
        struct smap_node *node;
5264
0
        size_t i;
5265
5266
0
        datum->n = smap_count(other_config);
5267
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
5268
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
5269
0
        datum->refcnt = NULL;
5270
5271
0
        i = 0;
5272
0
        SMAP_FOR_EACH (node, other_config) {
5273
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
5274
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
5275
0
            i++;
5276
0
        }
5277
0
        ovsdb_datum_sort_unique(datum, &ovsrec_bridge_col_other_config.type);
5278
0
    } else {
5279
0
        ovsdb_datum_init_empty(datum);
5280
0
    }
5281
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
5282
0
                          &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_OTHER_CONFIG],
5283
0
                          datum,
5284
0
                          &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5285
0
    free(datum);
5286
0
}
5287
5288
5289
/* Sets the "ports" column from the "Bridge" table in 'row' to
5290
 * the 'ports' set with 'n_ports' entries.
5291
 *
5292
 * The caller retains ownership of the arguments. */
5293
void
5294
ovsrec_bridge_index_set_ports(const struct ovsrec_bridge *row, struct ovsrec_port **ports, size_t n_ports)
5295
0
{
5296
0
    struct ovsdb_datum datum;
5297
5298
0
    datum.refcnt = NULL;
5299
0
    size_t i;
5300
5301
0
    datum.n = n_ports;
5302
0
    datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
5303
0
    datum.values = NULL;
5304
0
    for (i = 0; i < n_ports; i++) {
5305
0
        datum.keys[i].uuid = ports[i]->header_.uuid;
5306
0
    }
5307
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_ports.type);
5308
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_PORTS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5309
0
}
5310
5311
/* Sets the "protocols" column from the "Bridge" table in 'row' to
5312
 * the 'protocols' set with 'n_protocols' entries.
5313
 *
5314
 * Argument constraints: one of "OpenFlow10", "OpenFlow11", "OpenFlow12", "OpenFlow13", "OpenFlow14", or "OpenFlow15"
5315
 *
5316
 * The caller retains ownership of the arguments. */
5317
void
5318
ovsrec_bridge_index_set_protocols(const struct ovsrec_bridge *row, const char **protocols, size_t n_protocols)
5319
0
{
5320
0
    struct ovsdb_datum datum;
5321
5322
0
    datum.refcnt = NULL;
5323
0
    size_t i;
5324
5325
0
    datum.n = n_protocols;
5326
0
    datum.keys = n_protocols ? xmalloc(n_protocols * sizeof *datum.keys) : NULL;
5327
0
    datum.values = NULL;
5328
0
    for (i = 0; i < n_protocols; i++) {
5329
0
        datum.keys[i].s = ovsdb_atom_string_create(protocols[i]);
5330
0
    }
5331
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_protocols.type);
5332
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_PROTOCOLS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5333
0
}
5334
5335
/* Sets the "rstp_enable" column from the "Bridge" table in 'row' to
5336
 * 'rstp_enable'.
5337
 *
5338
 * The caller retains ownership of the arguments. */
5339
void
5340
ovsrec_bridge_index_set_rstp_enable(const struct ovsrec_bridge *row, bool rstp_enable)
5341
0
{
5342
0
    struct ovsdb_datum datum;
5343
5344
0
    datum.refcnt = NULL;
5345
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
5346
5347
0
    datum.n = 1;
5348
0
    datum.keys = key;
5349
0
    key->boolean = rstp_enable;
5350
0
    datum.values = NULL;
5351
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_RSTP_ENABLE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5352
0
}
5353
5354
/* Sets the "rstp_status" column's value from the "Bridge" table in 'row'
5355
 * to 'rstp_status'.
5356
 *
5357
 * The caller retains ownership of 'rstp_status' and everything in it. */
5358
void
5359
ovsrec_bridge_index_set_rstp_status(const struct ovsrec_bridge *row, const struct smap *rstp_status)
5360
0
{
5361
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
5362
5363
0
    if (rstp_status) {
5364
0
        struct smap_node *node;
5365
0
        size_t i;
5366
5367
0
        datum->n = smap_count(rstp_status);
5368
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
5369
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
5370
0
        datum->refcnt = NULL;
5371
5372
0
        i = 0;
5373
0
        SMAP_FOR_EACH (node, rstp_status) {
5374
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
5375
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
5376
0
            i++;
5377
0
        }
5378
0
        ovsdb_datum_sort_unique(datum, &ovsrec_bridge_col_rstp_status.type);
5379
0
    } else {
5380
0
        ovsdb_datum_init_empty(datum);
5381
0
    }
5382
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
5383
0
                          &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_RSTP_STATUS],
5384
0
                          datum,
5385
0
                          &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5386
0
    free(datum);
5387
0
}
5388
5389
5390
/* Sets the "sflow" column from the "Bridge" table in 'row' to
5391
 * the 'sflow' set.
5392
 *
5393
 * If "sflow" is null, the column will be the empty set,
5394
 * otherwise it will contain the specified value.
5395
 *
5396
 * The caller retains ownership of the arguments. */
5397
void
5398
ovsrec_bridge_index_set_sflow(const struct ovsrec_bridge *row, const struct ovsrec_sflow *sflow)
5399
0
{
5400
0
    struct ovsdb_datum datum;
5401
5402
0
    datum.refcnt = NULL;
5403
0
    union ovsdb_atom *key;
5404
5405
0
    if (sflow) {
5406
0
        key = xmalloc(sizeof (union ovsdb_atom));
5407
0
        datum.n = 1;
5408
0
        datum.keys = key;
5409
0
        key->uuid = sflow->header_.uuid;
5410
0
    } else {
5411
0
        datum.n = 0;
5412
0
        datum.keys = NULL;
5413
0
    }
5414
0
    datum.values = NULL;
5415
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_SFLOW ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5416
0
}
5417
5418
/* Sets the "status" column's value from the "Bridge" table in 'row'
5419
 * to 'status'.
5420
 *
5421
 * The caller retains ownership of 'status' and everything in it. */
5422
void
5423
ovsrec_bridge_index_set_status(const struct ovsrec_bridge *row, const struct smap *status)
5424
0
{
5425
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
5426
5427
0
    if (status) {
5428
0
        struct smap_node *node;
5429
0
        size_t i;
5430
5431
0
        datum->n = smap_count(status);
5432
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
5433
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
5434
0
        datum->refcnt = NULL;
5435
5436
0
        i = 0;
5437
0
        SMAP_FOR_EACH (node, status) {
5438
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
5439
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
5440
0
            i++;
5441
0
        }
5442
0
        ovsdb_datum_sort_unique(datum, &ovsrec_bridge_col_status.type);
5443
0
    } else {
5444
0
        ovsdb_datum_init_empty(datum);
5445
0
    }
5446
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
5447
0
                          &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_STATUS],
5448
0
                          datum,
5449
0
                          &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5450
0
    free(datum);
5451
0
}
5452
5453
5454
/* Sets the "stp_enable" column from the "Bridge" table in 'row' to
5455
 * 'stp_enable'.
5456
 *
5457
 * The caller retains ownership of the arguments. */
5458
void
5459
ovsrec_bridge_index_set_stp_enable(const struct ovsrec_bridge *row, bool stp_enable)
5460
0
{
5461
0
    struct ovsdb_datum datum;
5462
5463
0
    datum.refcnt = NULL;
5464
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
5465
5466
0
    datum.n = 1;
5467
0
    datum.keys = key;
5468
0
    key->boolean = stp_enable;
5469
0
    datum.values = NULL;
5470
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_bridge_columns[ OVSREC_BRIDGE_COL_STP_ENABLE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5471
0
}
5472
5473
struct ovsdb_idl_column ovsrec_bridge_columns[OVSREC_BRIDGE_N_COLUMNS];
5474
5475
unsigned int
5476
ovsrec_bridge_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
5477
0
{
5478
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_bridge, condition);
5479
0
}
5480
static struct json Bridge_col_fail_mode_key_enum_key_strings[2] = {
5481
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "secure", .count = 2 },
5482
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "standalone", .count = 2 },
5483
};
5484
static union ovsdb_atom Bridge_col_fail_mode_key_enum_keys[2] = {
5485
    { .s = &Bridge_col_fail_mode_key_enum_key_strings[0] },
5486
    { .s = &Bridge_col_fail_mode_key_enum_key_strings[1] },
5487
};
5488
static struct ovsdb_datum Bridge_col_fail_mode_key_enum = {
5489
    .n = 2,
5490
    .keys = Bridge_col_fail_mode_key_enum_keys,
5491
};
5492
static struct json Bridge_col_protocols_key_enum_key_strings[6] = {
5493
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "OpenFlow10", .count = 2 },
5494
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "OpenFlow11", .count = 2 },
5495
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "OpenFlow12", .count = 2 },
5496
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "OpenFlow13", .count = 2 },
5497
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "OpenFlow14", .count = 2 },
5498
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "OpenFlow15", .count = 2 },
5499
};
5500
static union ovsdb_atom Bridge_col_protocols_key_enum_keys[6] = {
5501
    { .s = &Bridge_col_protocols_key_enum_key_strings[0] },
5502
    { .s = &Bridge_col_protocols_key_enum_key_strings[1] },
5503
    { .s = &Bridge_col_protocols_key_enum_key_strings[2] },
5504
    { .s = &Bridge_col_protocols_key_enum_key_strings[3] },
5505
    { .s = &Bridge_col_protocols_key_enum_key_strings[4] },
5506
    { .s = &Bridge_col_protocols_key_enum_key_strings[5] },
5507
};
5508
static struct ovsdb_datum Bridge_col_protocols_key_enum = {
5509
    .n = 6,
5510
    .keys = Bridge_col_protocols_key_enum_keys,
5511
};
5512
5513
struct ovsdb_idl_column ovsrec_bridge_columns[OVSREC_BRIDGE_N_COLUMNS] = {
5514
    [OVSREC_BRIDGE_COL_AUTO_ATTACH] = {
5515
         .name = "auto_attach",
5516
         .type = {
5517
            .key = {
5518
               .type = OVSDB_TYPE_UUID,
5519
               .uuid = { .refTableName = "AutoAttach", .refType = OVSDB_REF_STRONG },
5520
            },
5521
            .value = OVSDB_BASE_VOID_INIT,
5522
            .n_min = 0,
5523
            .n_max = 1,
5524
         },
5525
         .is_mutable = true,
5526
         .is_synthetic = false,
5527
         .parse = ovsrec_bridge_parse_auto_attach,
5528
         .unparse = ovsrec_bridge_unparse_auto_attach,
5529
    },
5530
5531
    [OVSREC_BRIDGE_COL_CONTROLLER] = {
5532
         .name = "controller",
5533
         .type = {
5534
            .key = {
5535
               .type = OVSDB_TYPE_UUID,
5536
               .uuid = { .refTableName = "Controller", .refType = OVSDB_REF_STRONG },
5537
            },
5538
            .value = OVSDB_BASE_VOID_INIT,
5539
            .n_min = 0,
5540
            .n_max = UINT_MAX,
5541
         },
5542
         .is_mutable = true,
5543
         .is_synthetic = false,
5544
         .parse = ovsrec_bridge_parse_controller,
5545
         .unparse = ovsrec_bridge_unparse_controller,
5546
    },
5547
5548
    [OVSREC_BRIDGE_COL_DATAPATH_ID] = {
5549
         .name = "datapath_id",
5550
         .type = {
5551
            .key = {
5552
               .type = OVSDB_TYPE_STRING,
5553
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5554
            },
5555
            .value = OVSDB_BASE_VOID_INIT,
5556
            .n_min = 0,
5557
            .n_max = 1,
5558
         },
5559
         .is_mutable = true,
5560
         .is_synthetic = false,
5561
         .parse = ovsrec_bridge_parse_datapath_id,
5562
         .unparse = ovsrec_bridge_unparse_datapath_id,
5563
    },
5564
5565
    [OVSREC_BRIDGE_COL_DATAPATH_TYPE] = {
5566
         .name = "datapath_type",
5567
         .type = {
5568
            .key = {
5569
               .type = OVSDB_TYPE_STRING,
5570
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5571
            },
5572
            .value = OVSDB_BASE_VOID_INIT,
5573
            .n_min = 1,
5574
            .n_max = 1,
5575
         },
5576
         .is_mutable = true,
5577
         .is_synthetic = false,
5578
         .parse = ovsrec_bridge_parse_datapath_type,
5579
         .unparse = ovsrec_bridge_unparse_datapath_type,
5580
    },
5581
5582
    [OVSREC_BRIDGE_COL_DATAPATH_VERSION] = {
5583
         .name = "datapath_version",
5584
         .type = {
5585
            .key = {
5586
               .type = OVSDB_TYPE_STRING,
5587
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5588
            },
5589
            .value = OVSDB_BASE_VOID_INIT,
5590
            .n_min = 1,
5591
            .n_max = 1,
5592
         },
5593
         .is_mutable = true,
5594
         .is_synthetic = false,
5595
         .parse = ovsrec_bridge_parse_datapath_version,
5596
         .unparse = ovsrec_bridge_unparse_datapath_version,
5597
    },
5598
5599
    [OVSREC_BRIDGE_COL_EXTERNAL_IDS] = {
5600
         .name = "external_ids",
5601
         .type = {
5602
            .key = {
5603
               .type = OVSDB_TYPE_STRING,
5604
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5605
            },
5606
            .value = {
5607
                .type = OVSDB_TYPE_STRING,
5608
                .string = { .minLen = 0, .maxLen = UINT_MAX },
5609
            },
5610
            .n_min = 0,
5611
            .n_max = UINT_MAX,
5612
         },
5613
         .is_mutable = true,
5614
         .is_synthetic = false,
5615
         .parse = ovsrec_bridge_parse_external_ids,
5616
         .unparse = ovsrec_bridge_unparse_external_ids,
5617
    },
5618
5619
    [OVSREC_BRIDGE_COL_FAIL_MODE] = {
5620
         .name = "fail_mode",
5621
         .type = {
5622
            .key = {
5623
               .type = OVSDB_TYPE_STRING,
5624
               .enum_ = &Bridge_col_fail_mode_key_enum,
5625
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5626
            },
5627
            .value = OVSDB_BASE_VOID_INIT,
5628
            .n_min = 0,
5629
            .n_max = 1,
5630
         },
5631
         .is_mutable = true,
5632
         .is_synthetic = false,
5633
         .parse = ovsrec_bridge_parse_fail_mode,
5634
         .unparse = ovsrec_bridge_unparse_fail_mode,
5635
    },
5636
5637
    [OVSREC_BRIDGE_COL_FLOOD_VLANS] = {
5638
         .name = "flood_vlans",
5639
         .type = {
5640
            .key = {
5641
               .type = OVSDB_TYPE_INTEGER,
5642
               .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
5643
            },
5644
            .value = OVSDB_BASE_VOID_INIT,
5645
            .n_min = 0,
5646
            .n_max = 4096,
5647
         },
5648
         .is_mutable = true,
5649
         .is_synthetic = false,
5650
         .parse = ovsrec_bridge_parse_flood_vlans,
5651
         .unparse = ovsrec_bridge_unparse_flood_vlans,
5652
    },
5653
5654
    [OVSREC_BRIDGE_COL_FLOW_TABLES] = {
5655
         .name = "flow_tables",
5656
         .type = {
5657
            .key = {
5658
               .type = OVSDB_TYPE_INTEGER,
5659
               .integer = { .min = INT64_C(0), .max = INT64_C(254) },
5660
            },
5661
            .value = {
5662
                .type = OVSDB_TYPE_UUID,
5663
                .uuid = { .refTableName = "Flow_Table", .refType = OVSDB_REF_STRONG },
5664
            },
5665
            .n_min = 0,
5666
            .n_max = UINT_MAX,
5667
         },
5668
         .is_mutable = true,
5669
         .is_synthetic = false,
5670
         .parse = ovsrec_bridge_parse_flow_tables,
5671
         .unparse = ovsrec_bridge_unparse_flow_tables,
5672
    },
5673
5674
    [OVSREC_BRIDGE_COL_IPFIX] = {
5675
         .name = "ipfix",
5676
         .type = {
5677
            .key = {
5678
               .type = OVSDB_TYPE_UUID,
5679
               .uuid = { .refTableName = "IPFIX", .refType = OVSDB_REF_STRONG },
5680
            },
5681
            .value = OVSDB_BASE_VOID_INIT,
5682
            .n_min = 0,
5683
            .n_max = 1,
5684
         },
5685
         .is_mutable = true,
5686
         .is_synthetic = false,
5687
         .parse = ovsrec_bridge_parse_ipfix,
5688
         .unparse = ovsrec_bridge_unparse_ipfix,
5689
    },
5690
5691
    [OVSREC_BRIDGE_COL_MCAST_SNOOPING_ENABLE] = {
5692
         .name = "mcast_snooping_enable",
5693
         .type = {
5694
            .key = {
5695
               .type = OVSDB_TYPE_BOOLEAN,
5696
            },
5697
            .value = OVSDB_BASE_VOID_INIT,
5698
            .n_min = 1,
5699
            .n_max = 1,
5700
         },
5701
         .is_mutable = true,
5702
         .is_synthetic = false,
5703
         .parse = ovsrec_bridge_parse_mcast_snooping_enable,
5704
         .unparse = ovsrec_bridge_unparse_mcast_snooping_enable,
5705
    },
5706
5707
    [OVSREC_BRIDGE_COL_MIRRORS] = {
5708
         .name = "mirrors",
5709
         .type = {
5710
            .key = {
5711
               .type = OVSDB_TYPE_UUID,
5712
               .uuid = { .refTableName = "Mirror", .refType = OVSDB_REF_STRONG },
5713
            },
5714
            .value = OVSDB_BASE_VOID_INIT,
5715
            .n_min = 0,
5716
            .n_max = UINT_MAX,
5717
         },
5718
         .is_mutable = true,
5719
         .is_synthetic = false,
5720
         .parse = ovsrec_bridge_parse_mirrors,
5721
         .unparse = ovsrec_bridge_unparse_mirrors,
5722
    },
5723
5724
    [OVSREC_BRIDGE_COL_NAME] = {
5725
         .name = "name",
5726
         .type = {
5727
            .key = {
5728
               .type = OVSDB_TYPE_STRING,
5729
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5730
            },
5731
            .value = OVSDB_BASE_VOID_INIT,
5732
            .n_min = 1,
5733
            .n_max = 1,
5734
         },
5735
         .is_mutable = false,
5736
         .is_synthetic = false,
5737
         .parse = ovsrec_bridge_parse_name,
5738
         .unparse = ovsrec_bridge_unparse_name,
5739
    },
5740
5741
    [OVSREC_BRIDGE_COL_NETFLOW] = {
5742
         .name = "netflow",
5743
         .type = {
5744
            .key = {
5745
               .type = OVSDB_TYPE_UUID,
5746
               .uuid = { .refTableName = "NetFlow", .refType = OVSDB_REF_STRONG },
5747
            },
5748
            .value = OVSDB_BASE_VOID_INIT,
5749
            .n_min = 0,
5750
            .n_max = 1,
5751
         },
5752
         .is_mutable = true,
5753
         .is_synthetic = false,
5754
         .parse = ovsrec_bridge_parse_netflow,
5755
         .unparse = ovsrec_bridge_unparse_netflow,
5756
    },
5757
5758
    [OVSREC_BRIDGE_COL_OTHER_CONFIG] = {
5759
         .name = "other_config",
5760
         .type = {
5761
            .key = {
5762
               .type = OVSDB_TYPE_STRING,
5763
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5764
            },
5765
            .value = {
5766
                .type = OVSDB_TYPE_STRING,
5767
                .string = { .minLen = 0, .maxLen = UINT_MAX },
5768
            },
5769
            .n_min = 0,
5770
            .n_max = UINT_MAX,
5771
         },
5772
         .is_mutable = true,
5773
         .is_synthetic = false,
5774
         .parse = ovsrec_bridge_parse_other_config,
5775
         .unparse = ovsrec_bridge_unparse_other_config,
5776
    },
5777
5778
    [OVSREC_BRIDGE_COL_PORTS] = {
5779
         .name = "ports",
5780
         .type = {
5781
            .key = {
5782
               .type = OVSDB_TYPE_UUID,
5783
               .uuid = { .refTableName = "Port", .refType = OVSDB_REF_STRONG },
5784
            },
5785
            .value = OVSDB_BASE_VOID_INIT,
5786
            .n_min = 0,
5787
            .n_max = UINT_MAX,
5788
         },
5789
         .is_mutable = true,
5790
         .is_synthetic = false,
5791
         .parse = ovsrec_bridge_parse_ports,
5792
         .unparse = ovsrec_bridge_unparse_ports,
5793
    },
5794
5795
    [OVSREC_BRIDGE_COL_PROTOCOLS] = {
5796
         .name = "protocols",
5797
         .type = {
5798
            .key = {
5799
               .type = OVSDB_TYPE_STRING,
5800
               .enum_ = &Bridge_col_protocols_key_enum,
5801
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5802
            },
5803
            .value = OVSDB_BASE_VOID_INIT,
5804
            .n_min = 0,
5805
            .n_max = UINT_MAX,
5806
         },
5807
         .is_mutable = true,
5808
         .is_synthetic = false,
5809
         .parse = ovsrec_bridge_parse_protocols,
5810
         .unparse = ovsrec_bridge_unparse_protocols,
5811
    },
5812
5813
    [OVSREC_BRIDGE_COL_RSTP_ENABLE] = {
5814
         .name = "rstp_enable",
5815
         .type = {
5816
            .key = {
5817
               .type = OVSDB_TYPE_BOOLEAN,
5818
            },
5819
            .value = OVSDB_BASE_VOID_INIT,
5820
            .n_min = 1,
5821
            .n_max = 1,
5822
         },
5823
         .is_mutable = true,
5824
         .is_synthetic = false,
5825
         .parse = ovsrec_bridge_parse_rstp_enable,
5826
         .unparse = ovsrec_bridge_unparse_rstp_enable,
5827
    },
5828
5829
    [OVSREC_BRIDGE_COL_RSTP_STATUS] = {
5830
         .name = "rstp_status",
5831
         .type = {
5832
            .key = {
5833
               .type = OVSDB_TYPE_STRING,
5834
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5835
            },
5836
            .value = {
5837
                .type = OVSDB_TYPE_STRING,
5838
                .string = { .minLen = 0, .maxLen = UINT_MAX },
5839
            },
5840
            .n_min = 0,
5841
            .n_max = UINT_MAX,
5842
         },
5843
         .is_mutable = true,
5844
         .is_synthetic = false,
5845
         .parse = ovsrec_bridge_parse_rstp_status,
5846
         .unparse = ovsrec_bridge_unparse_rstp_status,
5847
    },
5848
5849
    [OVSREC_BRIDGE_COL_SFLOW] = {
5850
         .name = "sflow",
5851
         .type = {
5852
            .key = {
5853
               .type = OVSDB_TYPE_UUID,
5854
               .uuid = { .refTableName = "sFlow", .refType = OVSDB_REF_STRONG },
5855
            },
5856
            .value = OVSDB_BASE_VOID_INIT,
5857
            .n_min = 0,
5858
            .n_max = 1,
5859
         },
5860
         .is_mutable = true,
5861
         .is_synthetic = false,
5862
         .parse = ovsrec_bridge_parse_sflow,
5863
         .unparse = ovsrec_bridge_unparse_sflow,
5864
    },
5865
5866
    [OVSREC_BRIDGE_COL_STATUS] = {
5867
         .name = "status",
5868
         .type = {
5869
            .key = {
5870
               .type = OVSDB_TYPE_STRING,
5871
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5872
            },
5873
            .value = {
5874
                .type = OVSDB_TYPE_STRING,
5875
                .string = { .minLen = 0, .maxLen = UINT_MAX },
5876
            },
5877
            .n_min = 0,
5878
            .n_max = UINT_MAX,
5879
         },
5880
         .is_mutable = true,
5881
         .is_synthetic = false,
5882
         .parse = ovsrec_bridge_parse_status,
5883
         .unparse = ovsrec_bridge_unparse_status,
5884
    },
5885
5886
    [OVSREC_BRIDGE_COL_STP_ENABLE] = {
5887
         .name = "stp_enable",
5888
         .type = {
5889
            .key = {
5890
               .type = OVSDB_TYPE_BOOLEAN,
5891
            },
5892
            .value = OVSDB_BASE_VOID_INIT,
5893
            .n_min = 1,
5894
            .n_max = 1,
5895
         },
5896
         .is_mutable = true,
5897
         .is_synthetic = false,
5898
         .parse = ovsrec_bridge_parse_stp_enable,
5899
         .unparse = ovsrec_bridge_unparse_stp_enable,
5900
    },
5901
5902
};
5903

5904
/* CT_Timeout_Policy table. */
5905
5906
bool
5907
ovsrec_server_has_ct_timeout_policy_table_col_external_ids(const struct ovsdb_idl *idl)
5908
0
{
5909
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ct_timeout_policy_col_external_ids);
5910
0
}
5911
5912
const struct ovsdb_type *
5913
ovsrec_ct_timeout_policy_external_ids_server_type(const struct ovsdb_idl *idl)
5914
0
{
5915
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ct_timeout_policy_col_external_ids);
5916
0
}
5917
5918
5919
bool
5920
ovsrec_server_has_ct_timeout_policy_table_col_timeouts(const struct ovsdb_idl *idl)
5921
0
{
5922
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ct_timeout_policy_col_timeouts);
5923
0
}
5924
5925
const struct ovsdb_type *
5926
ovsrec_ct_timeout_policy_timeouts_server_type(const struct ovsdb_idl *idl)
5927
0
{
5928
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ct_timeout_policy_col_timeouts);
5929
0
}
5930
5931
5932
bool
5933
ovsrec_server_has_ct_timeout_policy_table(const struct ovsdb_idl *idl)
5934
0
{
5935
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_CT_TIMEOUT_POLICY]);
5936
0
}
5937
5938
5939
const struct ovsrec_ct_timeout_policy_table *
5940
ovsrec_ct_timeout_policy_table_get(const struct ovsdb_idl *idl)
5941
0
{
5942
0
    return (const struct ovsrec_ct_timeout_policy_table *) idl;
5943
0
}
5944
5945
const struct ovsrec_ct_timeout_policy *
5946
ovsrec_ct_timeout_policy_table_first(const struct ovsrec_ct_timeout_policy_table *table)
5947
0
{
5948
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
5949
0
    return ovsrec_ct_timeout_policy_first(idl);
5950
0
}
5951
5952
5953
const struct ovsrec_ct_timeout_policy *
5954
ovsrec_ct_timeout_policy_table_track_get_first(const struct ovsrec_ct_timeout_policy_table *table)
5955
0
{
5956
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
5957
0
    return ovsrec_ct_timeout_policy_track_get_first(idl);
5958
0
}
5959
5960
5961
static void
5962
ovsrec_ct_timeout_policy_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5963
0
{
5964
0
    struct ovsrec_ct_timeout_policy *row = ovsrec_ct_timeout_policy_cast(row_);
5965
0
    smap_init(&row->external_ids);
5966
0
    for (size_t i = 0; i < datum->n; i++) {
5967
0
        smap_add(&row->external_ids,
5968
0
                 json_string(datum->keys[i].s),
5969
0
                 json_string(datum->values[i].s));
5970
0
    }
5971
0
}
5972
5973
static void
5974
ovsrec_ct_timeout_policy_parse_timeouts(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5975
0
{
5976
0
    struct ovsrec_ct_timeout_policy *row = ovsrec_ct_timeout_policy_cast(row_);
5977
0
    row->key_timeouts = NULL;
5978
0
    row->value_timeouts = NULL;
5979
0
    row->n_timeouts = 0;
5980
0
    for (size_t i = 0; i < datum->n; i++) {
5981
0
        if (!row->n_timeouts) {
5982
0
            row->key_timeouts = xmalloc(datum->n * sizeof *row->key_timeouts);
5983
0
            row->value_timeouts = xmalloc(datum->n * sizeof *row->value_timeouts);
5984
0
        }
5985
0
        row->key_timeouts[row->n_timeouts] = CONST_CAST(char *, json_string(datum->keys[i].s));
5986
0
        row->value_timeouts[row->n_timeouts] = datum->values[i].integer;
5987
0
        row->n_timeouts++;
5988
0
    }
5989
0
}
5990
5991
static void
5992
ovsrec_ct_timeout_policy_unparse_external_ids(struct ovsdb_idl_row *row_)
5993
0
{
5994
0
    struct ovsrec_ct_timeout_policy *row = ovsrec_ct_timeout_policy_cast(row_);
5995
0
    smap_destroy(&row->external_ids);
5996
0
}
5997
5998
static void
5999
ovsrec_ct_timeout_policy_unparse_timeouts(struct ovsdb_idl_row *row_)
6000
0
{
6001
0
    struct ovsrec_ct_timeout_policy *row = ovsrec_ct_timeout_policy_cast(row_);
6002
0
    free(row->key_timeouts);
6003
0
    free(row->value_timeouts);
6004
0
}
6005
6006
static void
6007
ovsrec_ct_timeout_policy_init__(struct ovsdb_idl_row *row)
6008
0
{
6009
0
    ovsrec_ct_timeout_policy_init(ovsrec_ct_timeout_policy_cast(row));
6010
0
}
6011
6012
/* Clears the contents of 'row' in table "CT_Timeout_Policy". */
6013
void
6014
ovsrec_ct_timeout_policy_init(struct ovsrec_ct_timeout_policy *row)
6015
0
{
6016
0
    memset(row, 0, sizeof *row); 
6017
0
    smap_init(&row->external_ids);
6018
0
}
6019
6020
/* Searches table "CT_Timeout_Policy" in 'idl' for a row with UUID 'uuid'.  Returns
6021
 * a pointer to the row if there is one, otherwise a null pointer.  */
6022
const struct ovsrec_ct_timeout_policy *
6023
ovsrec_ct_timeout_policy_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
6024
0
{
6025
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_ct_timeout_policy, uuid));
6026
0
}
6027
6028
/* Searches table "CT_Timeout_Policy" for a row with UUID 'uuid'.  Returns
6029
 * a pointer to the row if there is one, otherwise a null pointer.  */
6030
const struct ovsrec_ct_timeout_policy *
6031
ovsrec_ct_timeout_policy_table_get_for_uuid(const struct ovsrec_ct_timeout_policy_table *table, const struct uuid *uuid)
6032
0
{
6033
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
6034
0
    return ovsrec_ct_timeout_policy_get_for_uuid(idl, uuid);
6035
0
}
6036
6037
/* Returns a row in table "CT_Timeout_Policy" in 'idl', or a null pointer if that
6038
 * table is empty.
6039
 *
6040
 * Database tables are internally maintained as hash tables, so adding or
6041
 * removing rows while traversing the same table can cause some rows to be
6042
 * visited twice or not at apply. */
6043
const struct ovsrec_ct_timeout_policy *
6044
ovsrec_ct_timeout_policy_first(const struct ovsdb_idl *idl)
6045
0
{
6046
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_first_row(idl, &ovsrec_table_ct_timeout_policy));
6047
0
}
6048
6049
/* Returns a row following 'row' within its table, or a null pointer if 'row'
6050
 * is the last row in its table. */
6051
const struct ovsrec_ct_timeout_policy *
6052
ovsrec_ct_timeout_policy_next(const struct ovsrec_ct_timeout_policy *row)
6053
0
{
6054
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_next_row(&row->header_));
6055
0
}
6056
6057
unsigned int ovsrec_ct_timeout_policy_get_seqno(const struct ovsdb_idl *idl)
6058
0
{
6059
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_ct_timeout_policy);
6060
0
}
6061
6062
unsigned int ovsrec_ct_timeout_policy_row_get_seqno(const struct ovsrec_ct_timeout_policy *row, enum ovsdb_idl_change change)
6063
0
{
6064
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
6065
0
}
6066
6067
const struct ovsrec_ct_timeout_policy *
6068
ovsrec_ct_timeout_policy_track_get_first(const struct ovsdb_idl *idl)
6069
0
{
6070
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_ct_timeout_policy));
6071
0
}
6072
6073
const struct ovsrec_ct_timeout_policy
6074
*ovsrec_ct_timeout_policy_track_get_next(const struct ovsrec_ct_timeout_policy *row)
6075
0
{
6076
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_track_get_next(&row->header_));
6077
0
}
6078
6079
6080
/* Deletes 'row' from table "CT_Timeout_Policy".  'row' may be freed, so it must not be
6081
 * accessed afterward.
6082
 *
6083
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6084
void
6085
ovsrec_ct_timeout_policy_delete(const struct ovsrec_ct_timeout_policy *row)
6086
0
{
6087
0
    ovsdb_idl_txn_delete(&row->header_);
6088
0
}
6089
6090
/* Inserts and returns a new row in the table "CT_Timeout_Policy" in the database
6091
 * with open transaction 'txn'.
6092
 *
6093
 * The new row is assigned a randomly generated provisional UUID.
6094
 * ovsdb-server will assign a different UUID when 'txn' is committed,
6095
 * but the IDL will replace any uses of the provisional UUID in the
6096
 * data to be to be committed by the UUID assigned by ovsdb-server. */
6097
struct ovsrec_ct_timeout_policy *
6098
ovsrec_ct_timeout_policy_insert(struct ovsdb_idl_txn *txn)
6099
0
{
6100
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_ct_timeout_policy, NULL));
6101
0
}
6102
6103
/* Inserts and returns a new row in the table "CT_Timeout_Policy" in the database
6104
 * with open transaction 'txn'.
6105
 *
6106
 * The new row is assigned the UUID specified in the 'uuid' parameter
6107
 * (which cannot be null).  ovsdb-server will try to assign the same
6108
 * UUID when 'txn' is committed. */
6109
struct ovsrec_ct_timeout_policy *
6110
ovsrec_ct_timeout_policy_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
6111
0
{
6112
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_txn_insert_persist_uuid(
6113
0
        txn, &ovsrec_table_ct_timeout_policy, uuid));
6114
0
}
6115
6116
bool
6117
ovsrec_ct_timeout_policy_is_updated(const struct ovsrec_ct_timeout_policy *row, enum ovsrec_ct_timeout_policy_column_id column)
6118
0
{
6119
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_ct_timeout_policy_columns[column]);
6120
0
}
6121
6122
/* Causes the original contents of column "external_ids" in 'row' to be
6123
 * verified as a prerequisite to completing the transaction.  That is, if
6124
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
6125
 * time that the IDL originally read its contents and the time that the
6126
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
6127
 *
6128
 * The intention is that, to ensure that no transaction commits based on dirty
6129
 * reads, an application should call this function any time "external_ids" is
6130
 * read as part of a read-modify-write operation.
6131
 *
6132
 * In some cases this function reduces to a no-op, because the current value
6133
 * of "external_ids" is already known:
6134
 *
6135
 *   - If 'row' is a row created by the current transaction (returned by
6136
 *     ovsrec_ct_timeout_policy_insert()).
6137
 *
6138
 *   - If "external_ids" has already been modified (with
6139
 *     ovsrec_ct_timeout_policy_set_external_ids()) within the current transaction.
6140
 *
6141
 * Because of the latter property, always call this function *before*
6142
 * ovsrec_ct_timeout_policy_set_external_ids() for a given read-modify-write.
6143
 *
6144
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6145
void
6146
ovsrec_ct_timeout_policy_verify_external_ids(const struct ovsrec_ct_timeout_policy *row)
6147
0
{
6148
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ct_timeout_policy_col_external_ids);
6149
0
}
6150
6151
/* Causes the original contents of column "timeouts" in 'row' to be
6152
 * verified as a prerequisite to completing the transaction.  That is, if
6153
 * "timeouts" in 'row' changed (or if 'row' was deleted) between the
6154
 * time that the IDL originally read its contents and the time that the
6155
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
6156
 *
6157
 * The intention is that, to ensure that no transaction commits based on dirty
6158
 * reads, an application should call this function any time "timeouts" is
6159
 * read as part of a read-modify-write operation.
6160
 *
6161
 * In some cases this function reduces to a no-op, because the current value
6162
 * of "timeouts" is already known:
6163
 *
6164
 *   - If 'row' is a row created by the current transaction (returned by
6165
 *     ovsrec_ct_timeout_policy_insert()).
6166
 *
6167
 *   - If "timeouts" has already been modified (with
6168
 *     ovsrec_ct_timeout_policy_set_timeouts()) within the current transaction.
6169
 *
6170
 * Because of the latter property, always call this function *before*
6171
 * ovsrec_ct_timeout_policy_set_timeouts() for a given read-modify-write.
6172
 *
6173
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6174
void
6175
ovsrec_ct_timeout_policy_verify_timeouts(const struct ovsrec_ct_timeout_policy *row)
6176
0
{
6177
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ct_timeout_policy_col_timeouts);
6178
0
}
6179
6180
/* Returns the "external_ids" column's value from the "CT_Timeout_Policy" table in 'row'
6181
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
6182
 * ovsdb_datum_find_key() is an easier and more efficient way to search
6183
 * for a given key than implementing the same operation on the "cooked"
6184
 * form in 'row'.
6185
 *
6186
 * 'key_type' must be OVSDB_TYPE_STRING.
6187
 * 'value_type' must be OVSDB_TYPE_STRING.
6188
 * (This helps to avoid silent bugs if someone changes external_ids's
6189
 * type without updating the caller.)
6190
 *
6191
 * The caller must not modify or free the returned value.
6192
 *
6193
 * Various kinds of changes can invalidate the returned value: modifying
6194
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6195
 * If the returned value is needed for a long time, it is best to make a copy
6196
 * of it with ovsdb_datum_clone().
6197
 *
6198
 * This function is rarely useful, since it is easier to access the value
6199
 * directly through the "external_ids" member in ovsrec_ct_timeout_policy. */
6200
const struct ovsdb_datum *
6201
ovsrec_ct_timeout_policy_get_external_ids(const struct ovsrec_ct_timeout_policy *row,
6202
  enum ovsdb_atomic_type key_type OVS_UNUSED,
6203
  enum ovsdb_atomic_type value_type OVS_UNUSED)
6204
0
{
6205
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6206
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
6207
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ct_timeout_policy_col_external_ids);
6208
0
}
6209
6210
/* Returns the "timeouts" column's value from the "CT_Timeout_Policy" table in 'row'
6211
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
6212
 * ovsdb_datum_find_key() is an easier and more efficient way to search
6213
 * for a given key than implementing the same operation on the "cooked"
6214
 * form in 'row'.
6215
 *
6216
 * 'key_type' must be OVSDB_TYPE_STRING.
6217
 * 'value_type' must be OVSDB_TYPE_INTEGER.
6218
 * (This helps to avoid silent bugs if someone changes timeouts's
6219
 * type without updating the caller.)
6220
 *
6221
 * The caller must not modify or free the returned value.
6222
 *
6223
 * Various kinds of changes can invalidate the returned value: modifying
6224
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6225
 * If the returned value is needed for a long time, it is best to make a copy
6226
 * of it with ovsdb_datum_clone().
6227
 *
6228
 * This function is rarely useful, since it is easier to access the value
6229
 * directly through the "timeouts" member in ovsrec_ct_timeout_policy. */
6230
const struct ovsdb_datum *
6231
ovsrec_ct_timeout_policy_get_timeouts(const struct ovsrec_ct_timeout_policy *row,
6232
  enum ovsdb_atomic_type key_type OVS_UNUSED,
6233
  enum ovsdb_atomic_type value_type OVS_UNUSED)
6234
0
{
6235
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6236
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
6237
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ct_timeout_policy_col_timeouts);
6238
0
}
6239
6240
/* Sets the "external_ids" column's value from the "CT_Timeout_Policy" table in 'row'
6241
 * to 'external_ids'.
6242
 *
6243
 * The caller retains ownership of 'external_ids' and everything in it. */
6244
void
6245
ovsrec_ct_timeout_policy_set_external_ids(const struct ovsrec_ct_timeout_policy *row, const struct smap *external_ids)
6246
0
{
6247
0
    struct ovsdb_datum datum;
6248
6249
0
    if (external_ids) {
6250
0
        ovsdb_datum_from_smap(&datum, external_ids);
6251
0
    } else {
6252
0
        ovsdb_datum_init_empty(&datum);
6253
0
    }
6254
0
    ovsdb_idl_txn_write(&row->header_,
6255
0
                        &ovsrec_ct_timeout_policy_col_external_ids,
6256
0
                        &datum);
6257
0
}
6258
6259
6260
/* Sets the "timeouts" column from the "CT_Timeout_Policy" table in 'row' to
6261
 * the map with keys 'key_timeouts' and values 'value_timeouts'
6262
 * with 'n_timeouts' entries.
6263
 *
6264
 * Argument constraints: key one of "icmp_first", "icmp_reply", "tcp_close", "tcp_close_wait", "tcp_established", "tcp_fin_wait", "tcp_last_ack", "tcp_retransmit", "tcp_syn_recv", "tcp_syn_sent", "tcp_syn_sent2", "tcp_time_wait", "tcp_unack", "udp_first", "udp_multiple", or "udp_single", value in range 0 to 4,294,967,295
6265
 *
6266
 * The caller retains ownership of the arguments. */
6267
void
6268
ovsrec_ct_timeout_policy_set_timeouts(const struct ovsrec_ct_timeout_policy *row, const char **key_timeouts, const int64_t *value_timeouts, size_t n_timeouts)
6269
0
{
6270
0
    struct ovsdb_datum datum;
6271
6272
0
    datum.refcnt = NULL;
6273
6274
0
    datum.n = n_timeouts;
6275
0
    datum.keys = n_timeouts ? xmalloc(n_timeouts * sizeof *datum.keys) : NULL;
6276
0
    datum.values = xmalloc(n_timeouts * sizeof *datum.values);
6277
0
    for (size_t i = 0; i < n_timeouts; i++) {
6278
0
        datum.keys[i].s = ovsdb_atom_string_create(key_timeouts[i]);
6279
0
        datum.values[i].integer = value_timeouts[i];
6280
0
    }
6281
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ct_timeout_policy_col_timeouts, &datum);
6282
0
}
6283
6284
/* Sets an element of the "external_ids" map column from the "CT_Timeout_Policy" table in 'row'
6285
 * to 'new_value' given the key value 'new_key'.
6286
 *
6287
 */
6288
void
6289
ovsrec_ct_timeout_policy_update_external_ids_setkey(const struct ovsrec_ct_timeout_policy *row, const char *new_key, const char *new_value)
6290
0
{
6291
0
    struct ovsdb_datum *datum;
6292
6293
0
    datum = xmalloc(sizeof *datum);
6294
0
    datum->n = 1;
6295
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6296
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
6297
0
    datum->refcnt = NULL;
6298
6299
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
6300
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
6301
6302
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
6303
0
                                    &ovsrec_ct_timeout_policy_col_external_ids,
6304
0
                                    datum);
6305
0
}
6306
6307
/* Deletes an element of the "external_ids" map column from the "CT_Timeout_Policy" table in 'row'
6308
 * given the key value 'delete_key'.
6309
 *
6310
 */
6311
void
6312
ovsrec_ct_timeout_policy_update_external_ids_delkey(const struct ovsrec_ct_timeout_policy *row, const char *delete_key)
6313
0
{
6314
0
    struct ovsdb_datum *datum;
6315
6316
0
    datum = xmalloc(sizeof *datum);
6317
0
    datum->n = 1;
6318
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6319
0
    datum->values = NULL;
6320
0
    datum->refcnt = NULL;
6321
6322
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
6323
6324
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
6325
0
                                    &ovsrec_ct_timeout_policy_col_external_ids,
6326
0
                                    datum);
6327
0
}
6328
6329
/* Sets an element of the "timeouts" map column from the "CT_Timeout_Policy" table in 'row'
6330
 * to 'new_value' given the key value 'new_key'.
6331
 *
6332
 */
6333
void
6334
ovsrec_ct_timeout_policy_update_timeouts_setkey(const struct ovsrec_ct_timeout_policy *row, const char *new_key, int64_t new_value)
6335
0
{
6336
0
    struct ovsdb_datum *datum;
6337
6338
0
    datum = xmalloc(sizeof *datum);
6339
0
    datum->n = 1;
6340
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6341
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
6342
0
    datum->refcnt = NULL;
6343
6344
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
6345
0
    datum->values[0].integer = new_value;
6346
6347
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
6348
0
                                    &ovsrec_ct_timeout_policy_col_timeouts,
6349
0
                                    datum);
6350
0
}
6351
6352
/* Deletes an element of the "timeouts" map column from the "CT_Timeout_Policy" table in 'row'
6353
 * given the key value 'delete_key'.
6354
 *
6355
 */
6356
void
6357
ovsrec_ct_timeout_policy_update_timeouts_delkey(const struct ovsrec_ct_timeout_policy *row, const char *delete_key)
6358
0
{
6359
0
    struct ovsdb_datum *datum;
6360
6361
0
    datum = xmalloc(sizeof *datum);
6362
0
    datum->n = 1;
6363
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6364
0
    datum->values = NULL;
6365
0
    datum->refcnt = NULL;
6366
6367
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
6368
6369
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
6370
0
                                    &ovsrec_ct_timeout_policy_col_timeouts,
6371
0
                                    datum);
6372
0
}
6373
6374
/* Sets the "external_ids" column's value from the "CT_Timeout_Policy" table in 'row'
6375
 * to 'external_ids'.
6376
 *
6377
 * The caller retains ownership of 'external_ids' and everything in it. */
6378
void
6379
ovsrec_ct_timeout_policy_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
6380
0
{
6381
0
    struct ovsdb_datum datum;
6382
6383
0
    if (external_ids) {
6384
0
        ovsdb_datum_from_smap(&datum, external_ids);
6385
0
    } else {
6386
0
        ovsdb_datum_init_empty(&datum);
6387
0
    }
6388
6389
0
    ovsdb_idl_condition_add_clause(cond,
6390
0
                                   function,
6391
0
                                   &ovsrec_ct_timeout_policy_col_external_ids,
6392
0
                                   &datum);
6393
6394
0
    ovsdb_datum_destroy(&datum, &ovsrec_ct_timeout_policy_col_external_ids.type);
6395
0
}
6396
6397
6398
/* Sets the "timeouts" column from the "CT_Timeout_Policy" table in 'row' to
6399
 * the map with keys 'key_timeouts' and values 'value_timeouts'
6400
 * with 'n_timeouts' entries.
6401
 *
6402
 * Argument constraints: key one of "icmp_first", "icmp_reply", "tcp_close", "tcp_close_wait", "tcp_established", "tcp_fin_wait", "tcp_last_ack", "tcp_retransmit", "tcp_syn_recv", "tcp_syn_sent", "tcp_syn_sent2", "tcp_time_wait", "tcp_unack", "udp_first", "udp_multiple", or "udp_single", value in range 0 to 4,294,967,295
6403
 *
6404
 * The caller retains ownership of the arguments. */
6405
void
6406
ovsrec_ct_timeout_policy_add_clause_timeouts(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **key_timeouts, const int64_t *value_timeouts, size_t n_timeouts)
6407
0
{
6408
0
    struct ovsdb_datum datum;
6409
6410
0
    datum.refcnt = NULL;
6411
0
    datum.n = n_timeouts;
6412
0
    datum.keys = n_timeouts ? xmalloc(n_timeouts * sizeof *datum.keys) : NULL;
6413
0
    datum.values = xmalloc(n_timeouts * sizeof *datum.values);
6414
0
    for (size_t i = 0; i < n_timeouts; i++) {
6415
0
        datum.keys[i].s = ovsdb_atom_string_create(key_timeouts[i]);
6416
0
        datum.values[i].integer = value_timeouts[i];
6417
0
    }
6418
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_ct_timeout_policy_col_timeouts.type);
6419
0
    ovsdb_idl_condition_add_clause(cond,
6420
0
                          function,
6421
0
                          &ovsrec_ct_timeout_policy_col_timeouts,
6422
0
                          &datum);
6423
0
    ovsdb_datum_destroy(&datum, &ovsrec_ct_timeout_policy_col_timeouts.type);
6424
0
}
6425
6426
/* Destroy 'row' of kind "CT_Timeout_Policy". The row must have been
6427
 * created with ovsdb_idl_index_init_row.
6428
 */
6429
void
6430
ovsrec_ct_timeout_policy_index_destroy_row(const struct ovsrec_ct_timeout_policy *row)
6431
0
{
6432
0
    ovsdb_idl_index_destroy_row(&row->header_);
6433
0
}
6434
        
6435
6436
/* Creates a new row of kind "CT_Timeout_Policy". */
6437
struct ovsrec_ct_timeout_policy *
6438
ovsrec_ct_timeout_policy_index_init_row(struct ovsdb_idl_index *index)
6439
0
{
6440
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_timeout_policy);
6441
0
    return ALIGNED_CAST(struct ovsrec_ct_timeout_policy *, ovsdb_idl_index_init_row(index));
6442
0
}
6443
6444
struct ovsrec_ct_timeout_policy *
6445
ovsrec_ct_timeout_policy_index_find(struct ovsdb_idl_index *index, const struct ovsrec_ct_timeout_policy *target)
6446
0
{
6447
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_timeout_policy);
6448
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_index_find(index, &target->header_));
6449
0
}
6450
6451
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
6452
int
6453
ovsrec_ct_timeout_policy_index_compare(
6454
    struct ovsdb_idl_index *index, 
6455
    const struct ovsrec_ct_timeout_policy *a, 
6456
    const struct ovsrec_ct_timeout_policy *b)
6457
0
{
6458
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
6459
0
}
6460
6461
struct ovsdb_idl_cursor
6462
ovsrec_ct_timeout_policy_cursor_first(struct ovsdb_idl_index *index)
6463
0
{
6464
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_timeout_policy);
6465
0
    return ovsdb_idl_cursor_first(index);
6466
0
}
6467
6468
struct ovsdb_idl_cursor
6469
ovsrec_ct_timeout_policy_cursor_first_eq(
6470
    struct ovsdb_idl_index *index, const struct ovsrec_ct_timeout_policy *target)
6471
0
{
6472
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_timeout_policy);
6473
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
6474
0
}
6475
6476
struct ovsdb_idl_cursor
6477
ovsrec_ct_timeout_policy_cursor_first_ge(
6478
    struct ovsdb_idl_index *index, const struct ovsrec_ct_timeout_policy *target)
6479
0
{
6480
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_timeout_policy);
6481
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
6482
0
}
6483
6484
struct ovsrec_ct_timeout_policy *
6485
ovsrec_ct_timeout_policy_cursor_data(struct ovsdb_idl_cursor *cursor)
6486
0
{
6487
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_cursor_data(cursor));
6488
0
}
6489
6490
6491
/* Sets the "external_ids" column's value from the "CT_Timeout_Policy" table in 'row'
6492
 * to 'external_ids'.
6493
 *
6494
 * The caller retains ownership of 'external_ids' and everything in it. */
6495
void
6496
ovsrec_ct_timeout_policy_index_set_external_ids(const struct ovsrec_ct_timeout_policy *row, const struct smap *external_ids)
6497
0
{
6498
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
6499
6500
0
    if (external_ids) {
6501
0
        struct smap_node *node;
6502
0
        size_t i;
6503
6504
0
        datum->n = smap_count(external_ids);
6505
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6506
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
6507
0
        datum->refcnt = NULL;
6508
6509
0
        i = 0;
6510
0
        SMAP_FOR_EACH (node, external_ids) {
6511
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
6512
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
6513
0
            i++;
6514
0
        }
6515
0
        ovsdb_datum_sort_unique(datum, &ovsrec_ct_timeout_policy_col_external_ids.type);
6516
0
    } else {
6517
0
        ovsdb_datum_init_empty(datum);
6518
0
    }
6519
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
6520
0
                          &ovsrec_ct_timeout_policy_columns[OVSREC_CT_TIMEOUT_POLICY_COL_EXTERNAL_IDS],
6521
0
                          datum,
6522
0
                          &ovsrec_table_classes[OVSREC_TABLE_CT_TIMEOUT_POLICY]);
6523
0
    free(datum);
6524
0
}
6525
6526
6527
/* Sets the "timeouts" column from the "CT_Timeout_Policy" table in 'row' to
6528
 * the map with keys 'key_timeouts' and values 'value_timeouts'
6529
 * with 'n_timeouts' entries.
6530
 *
6531
 * Argument constraints: key one of "icmp_first", "icmp_reply", "tcp_close", "tcp_close_wait", "tcp_established", "tcp_fin_wait", "tcp_last_ack", "tcp_retransmit", "tcp_syn_recv", "tcp_syn_sent", "tcp_syn_sent2", "tcp_time_wait", "tcp_unack", "udp_first", "udp_multiple", or "udp_single", value in range 0 to 4,294,967,295
6532
 *
6533
 * The caller retains ownership of the arguments. */
6534
void
6535
ovsrec_ct_timeout_policy_index_set_timeouts(const struct ovsrec_ct_timeout_policy *row, const char **key_timeouts, const int64_t *value_timeouts, size_t n_timeouts)
6536
0
{
6537
0
    struct ovsdb_datum datum;
6538
6539
0
    datum.refcnt = NULL;
6540
0
    size_t i;
6541
6542
0
    datum.n = n_timeouts;
6543
0
    datum.keys = n_timeouts ? xmalloc(n_timeouts * sizeof *datum.keys) : NULL;
6544
0
    datum.values = xmalloc(n_timeouts * sizeof *datum.values);
6545
0
    for (i = 0; i < n_timeouts; i++) {
6546
0
        datum.keys[i].s = ovsdb_atom_string_create(key_timeouts[i]);
6547
0
        datum.values[i].integer = value_timeouts[i];
6548
0
    }
6549
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_ct_timeout_policy_col_timeouts.type);
6550
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ct_timeout_policy_columns[ OVSREC_CT_TIMEOUT_POLICY_COL_TIMEOUTS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CT_TIMEOUT_POLICY]);
6551
0
}
6552
6553
struct ovsdb_idl_column ovsrec_ct_timeout_policy_columns[OVSREC_CT_TIMEOUT_POLICY_N_COLUMNS];
6554
6555
unsigned int
6556
ovsrec_ct_timeout_policy_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
6557
0
{
6558
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_ct_timeout_policy, condition);
6559
0
}
6560
static struct json CT_Timeout_Policy_col_timeouts_key_enum_key_strings[16] = {
6561
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "icmp_first", .count = 2 },
6562
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "icmp_reply", .count = 2 },
6563
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_close", .count = 2 },
6564
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_close_wait", .count = 2 },
6565
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_established", .count = 2 },
6566
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_fin_wait", .count = 2 },
6567
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_last_ack", .count = 2 },
6568
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_retransmit", .count = 2 },
6569
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_syn_recv", .count = 2 },
6570
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_syn_sent", .count = 2 },
6571
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_syn_sent2", .count = 2 },
6572
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_time_wait", .count = 2 },
6573
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "tcp_unack", .count = 2 },
6574
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "udp_first", .count = 2 },
6575
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "udp_multiple", .count = 2 },
6576
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "udp_single", .count = 2 },
6577
};
6578
static union ovsdb_atom CT_Timeout_Policy_col_timeouts_key_enum_keys[16] = {
6579
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[0] },
6580
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[1] },
6581
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[2] },
6582
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[3] },
6583
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[4] },
6584
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[5] },
6585
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[6] },
6586
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[7] },
6587
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[8] },
6588
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[9] },
6589
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[10] },
6590
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[11] },
6591
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[12] },
6592
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[13] },
6593
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[14] },
6594
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[15] },
6595
};
6596
static struct ovsdb_datum CT_Timeout_Policy_col_timeouts_key_enum = {
6597
    .n = 16,
6598
    .keys = CT_Timeout_Policy_col_timeouts_key_enum_keys,
6599
};
6600
6601
struct ovsdb_idl_column ovsrec_ct_timeout_policy_columns[OVSREC_CT_TIMEOUT_POLICY_N_COLUMNS] = {
6602
    [OVSREC_CT_TIMEOUT_POLICY_COL_EXTERNAL_IDS] = {
6603
         .name = "external_ids",
6604
         .type = {
6605
            .key = {
6606
               .type = OVSDB_TYPE_STRING,
6607
               .string = { .minLen = 0, .maxLen = UINT_MAX },
6608
            },
6609
            .value = {
6610
                .type = OVSDB_TYPE_STRING,
6611
                .string = { .minLen = 0, .maxLen = UINT_MAX },
6612
            },
6613
            .n_min = 0,
6614
            .n_max = UINT_MAX,
6615
         },
6616
         .is_mutable = true,
6617
         .is_synthetic = false,
6618
         .parse = ovsrec_ct_timeout_policy_parse_external_ids,
6619
         .unparse = ovsrec_ct_timeout_policy_unparse_external_ids,
6620
    },
6621
6622
    [OVSREC_CT_TIMEOUT_POLICY_COL_TIMEOUTS] = {
6623
         .name = "timeouts",
6624
         .type = {
6625
            .key = {
6626
               .type = OVSDB_TYPE_STRING,
6627
               .enum_ = &CT_Timeout_Policy_col_timeouts_key_enum,
6628
               .string = { .minLen = 0, .maxLen = UINT_MAX },
6629
            },
6630
            .value = {
6631
                .type = OVSDB_TYPE_INTEGER,
6632
                .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
6633
            },
6634
            .n_min = 0,
6635
            .n_max = UINT_MAX,
6636
         },
6637
         .is_mutable = true,
6638
         .is_synthetic = false,
6639
         .parse = ovsrec_ct_timeout_policy_parse_timeouts,
6640
         .unparse = ovsrec_ct_timeout_policy_unparse_timeouts,
6641
    },
6642
6643
};
6644

6645
/* CT_Zone table. */
6646
6647
bool
6648
ovsrec_server_has_ct_zone_table_col_external_ids(const struct ovsdb_idl *idl)
6649
0
{
6650
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ct_zone_col_external_ids);
6651
0
}
6652
6653
const struct ovsdb_type *
6654
ovsrec_ct_zone_external_ids_server_type(const struct ovsdb_idl *idl)
6655
0
{
6656
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ct_zone_col_external_ids);
6657
0
}
6658
6659
6660
bool
6661
ovsrec_server_has_ct_zone_table_col_limit(const struct ovsdb_idl *idl)
6662
0
{
6663
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ct_zone_col_limit);
6664
0
}
6665
6666
const struct ovsdb_type *
6667
ovsrec_ct_zone_limit_server_type(const struct ovsdb_idl *idl)
6668
0
{
6669
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ct_zone_col_limit);
6670
0
}
6671
6672
6673
bool
6674
ovsrec_server_has_ct_zone_table_col_timeout_policy(const struct ovsdb_idl *idl)
6675
0
{
6676
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ct_zone_col_timeout_policy);
6677
0
}
6678
6679
const struct ovsdb_type *
6680
ovsrec_ct_zone_timeout_policy_server_type(const struct ovsdb_idl *idl)
6681
0
{
6682
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ct_zone_col_timeout_policy);
6683
0
}
6684
6685
6686
bool
6687
ovsrec_server_has_ct_zone_table(const struct ovsdb_idl *idl)
6688
0
{
6689
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_CT_ZONE]);
6690
0
}
6691
6692
6693
const struct ovsrec_ct_zone_table *
6694
ovsrec_ct_zone_table_get(const struct ovsdb_idl *idl)
6695
0
{
6696
0
    return (const struct ovsrec_ct_zone_table *) idl;
6697
0
}
6698
6699
const struct ovsrec_ct_zone *
6700
ovsrec_ct_zone_table_first(const struct ovsrec_ct_zone_table *table)
6701
0
{
6702
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
6703
0
    return ovsrec_ct_zone_first(idl);
6704
0
}
6705
6706
6707
const struct ovsrec_ct_zone *
6708
ovsrec_ct_zone_table_track_get_first(const struct ovsrec_ct_zone_table *table)
6709
0
{
6710
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
6711
0
    return ovsrec_ct_zone_track_get_first(idl);
6712
0
}
6713
6714
6715
static void
6716
ovsrec_ct_zone_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6717
0
{
6718
0
    struct ovsrec_ct_zone *row = ovsrec_ct_zone_cast(row_);
6719
0
    smap_init(&row->external_ids);
6720
0
    for (size_t i = 0; i < datum->n; i++) {
6721
0
        smap_add(&row->external_ids,
6722
0
                 json_string(datum->keys[i].s),
6723
0
                 json_string(datum->values[i].s));
6724
0
    }
6725
0
}
6726
6727
static void
6728
ovsrec_ct_zone_parse_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6729
0
{
6730
0
    struct ovsrec_ct_zone *row = ovsrec_ct_zone_cast(row_);
6731
0
    size_t n = MIN(1, datum->n);
6732
0
    row->limit = NULL;
6733
0
    row->n_limit = 0;
6734
0
    for (size_t i = 0; i < n; i++) {
6735
0
        if (!row->n_limit) {
6736
0
            row->limit = xmalloc(n * sizeof *row->limit);
6737
0
        }
6738
0
        row->limit[row->n_limit] = datum->keys[i].integer;
6739
0
        row->n_limit++;
6740
0
    }
6741
0
}
6742
6743
static void
6744
ovsrec_ct_zone_parse_timeout_policy(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6745
0
{
6746
0
    struct ovsrec_ct_zone *row = ovsrec_ct_zone_cast(row_);
6747
6748
0
    if (datum->n >= 1) {
6749
0
        row->timeout_policy = ovsrec_ct_timeout_policy_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_ct_timeout_policy, &datum->keys[0].uuid));
6750
0
    } else {
6751
0
        row->timeout_policy = NULL;
6752
0
    }
6753
0
}
6754
6755
static void
6756
ovsrec_ct_zone_unparse_external_ids(struct ovsdb_idl_row *row_)
6757
0
{
6758
0
    struct ovsrec_ct_zone *row = ovsrec_ct_zone_cast(row_);
6759
0
    smap_destroy(&row->external_ids);
6760
0
}
6761
6762
static void
6763
ovsrec_ct_zone_unparse_limit(struct ovsdb_idl_row *row_)
6764
0
{
6765
0
    struct ovsrec_ct_zone *row = ovsrec_ct_zone_cast(row_);
6766
0
    free(row->limit);
6767
0
}
6768
6769
static void
6770
ovsrec_ct_zone_unparse_timeout_policy(struct ovsdb_idl_row *row OVS_UNUSED)
6771
0
{
6772
    /* Nothing to do. */
6773
0
}
6774
6775
static void
6776
ovsrec_ct_zone_init__(struct ovsdb_idl_row *row)
6777
0
{
6778
0
    ovsrec_ct_zone_init(ovsrec_ct_zone_cast(row));
6779
0
}
6780
6781
/* Clears the contents of 'row' in table "CT_Zone". */
6782
void
6783
ovsrec_ct_zone_init(struct ovsrec_ct_zone *row)
6784
0
{
6785
0
    memset(row, 0, sizeof *row); 
6786
0
    smap_init(&row->external_ids);
6787
0
}
6788
6789
/* Searches table "CT_Zone" in 'idl' for a row with UUID 'uuid'.  Returns
6790
 * a pointer to the row if there is one, otherwise a null pointer.  */
6791
const struct ovsrec_ct_zone *
6792
ovsrec_ct_zone_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
6793
0
{
6794
0
    return ovsrec_ct_zone_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_ct_zone, uuid));
6795
0
}
6796
6797
/* Searches table "CT_Zone" for a row with UUID 'uuid'.  Returns
6798
 * a pointer to the row if there is one, otherwise a null pointer.  */
6799
const struct ovsrec_ct_zone *
6800
ovsrec_ct_zone_table_get_for_uuid(const struct ovsrec_ct_zone_table *table, const struct uuid *uuid)
6801
0
{
6802
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
6803
0
    return ovsrec_ct_zone_get_for_uuid(idl, uuid);
6804
0
}
6805
6806
/* Returns a row in table "CT_Zone" in 'idl', or a null pointer if that
6807
 * table is empty.
6808
 *
6809
 * Database tables are internally maintained as hash tables, so adding or
6810
 * removing rows while traversing the same table can cause some rows to be
6811
 * visited twice or not at apply. */
6812
const struct ovsrec_ct_zone *
6813
ovsrec_ct_zone_first(const struct ovsdb_idl *idl)
6814
0
{
6815
0
    return ovsrec_ct_zone_cast(ovsdb_idl_first_row(idl, &ovsrec_table_ct_zone));
6816
0
}
6817
6818
/* Returns a row following 'row' within its table, or a null pointer if 'row'
6819
 * is the last row in its table. */
6820
const struct ovsrec_ct_zone *
6821
ovsrec_ct_zone_next(const struct ovsrec_ct_zone *row)
6822
0
{
6823
0
    return ovsrec_ct_zone_cast(ovsdb_idl_next_row(&row->header_));
6824
0
}
6825
6826
unsigned int ovsrec_ct_zone_get_seqno(const struct ovsdb_idl *idl)
6827
0
{
6828
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_ct_zone);
6829
0
}
6830
6831
unsigned int ovsrec_ct_zone_row_get_seqno(const struct ovsrec_ct_zone *row, enum ovsdb_idl_change change)
6832
0
{
6833
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
6834
0
}
6835
6836
const struct ovsrec_ct_zone *
6837
ovsrec_ct_zone_track_get_first(const struct ovsdb_idl *idl)
6838
0
{
6839
0
    return ovsrec_ct_zone_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_ct_zone));
6840
0
}
6841
6842
const struct ovsrec_ct_zone
6843
*ovsrec_ct_zone_track_get_next(const struct ovsrec_ct_zone *row)
6844
0
{
6845
0
    return ovsrec_ct_zone_cast(ovsdb_idl_track_get_next(&row->header_));
6846
0
}
6847
6848
6849
/* Deletes 'row' from table "CT_Zone".  'row' may be freed, so it must not be
6850
 * accessed afterward.
6851
 *
6852
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6853
void
6854
ovsrec_ct_zone_delete(const struct ovsrec_ct_zone *row)
6855
0
{
6856
0
    ovsdb_idl_txn_delete(&row->header_);
6857
0
}
6858
6859
/* Inserts and returns a new row in the table "CT_Zone" in the database
6860
 * with open transaction 'txn'.
6861
 *
6862
 * The new row is assigned a randomly generated provisional UUID.
6863
 * ovsdb-server will assign a different UUID when 'txn' is committed,
6864
 * but the IDL will replace any uses of the provisional UUID in the
6865
 * data to be to be committed by the UUID assigned by ovsdb-server. */
6866
struct ovsrec_ct_zone *
6867
ovsrec_ct_zone_insert(struct ovsdb_idl_txn *txn)
6868
0
{
6869
0
    return ovsrec_ct_zone_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_ct_zone, NULL));
6870
0
}
6871
6872
/* Inserts and returns a new row in the table "CT_Zone" in the database
6873
 * with open transaction 'txn'.
6874
 *
6875
 * The new row is assigned the UUID specified in the 'uuid' parameter
6876
 * (which cannot be null).  ovsdb-server will try to assign the same
6877
 * UUID when 'txn' is committed. */
6878
struct ovsrec_ct_zone *
6879
ovsrec_ct_zone_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
6880
0
{
6881
0
    return ovsrec_ct_zone_cast(ovsdb_idl_txn_insert_persist_uuid(
6882
0
        txn, &ovsrec_table_ct_zone, uuid));
6883
0
}
6884
6885
bool
6886
ovsrec_ct_zone_is_updated(const struct ovsrec_ct_zone *row, enum ovsrec_ct_zone_column_id column)
6887
0
{
6888
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_ct_zone_columns[column]);
6889
0
}
6890
6891
/* Causes the original contents of column "external_ids" in 'row' to be
6892
 * verified as a prerequisite to completing the transaction.  That is, if
6893
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
6894
 * time that the IDL originally read its contents and the time that the
6895
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
6896
 *
6897
 * The intention is that, to ensure that no transaction commits based on dirty
6898
 * reads, an application should call this function any time "external_ids" is
6899
 * read as part of a read-modify-write operation.
6900
 *
6901
 * In some cases this function reduces to a no-op, because the current value
6902
 * of "external_ids" is already known:
6903
 *
6904
 *   - If 'row' is a row created by the current transaction (returned by
6905
 *     ovsrec_ct_zone_insert()).
6906
 *
6907
 *   - If "external_ids" has already been modified (with
6908
 *     ovsrec_ct_zone_set_external_ids()) within the current transaction.
6909
 *
6910
 * Because of the latter property, always call this function *before*
6911
 * ovsrec_ct_zone_set_external_ids() for a given read-modify-write.
6912
 *
6913
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6914
void
6915
ovsrec_ct_zone_verify_external_ids(const struct ovsrec_ct_zone *row)
6916
0
{
6917
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ct_zone_col_external_ids);
6918
0
}
6919
6920
/* Causes the original contents of column "limit" in 'row' to be
6921
 * verified as a prerequisite to completing the transaction.  That is, if
6922
 * "limit" in 'row' changed (or if 'row' was deleted) between the
6923
 * time that the IDL originally read its contents and the time that the
6924
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
6925
 *
6926
 * The intention is that, to ensure that no transaction commits based on dirty
6927
 * reads, an application should call this function any time "limit" is
6928
 * read as part of a read-modify-write operation.
6929
 *
6930
 * In some cases this function reduces to a no-op, because the current value
6931
 * of "limit" is already known:
6932
 *
6933
 *   - If 'row' is a row created by the current transaction (returned by
6934
 *     ovsrec_ct_zone_insert()).
6935
 *
6936
 *   - If "limit" has already been modified (with
6937
 *     ovsrec_ct_zone_set_limit()) within the current transaction.
6938
 *
6939
 * Because of the latter property, always call this function *before*
6940
 * ovsrec_ct_zone_set_limit() for a given read-modify-write.
6941
 *
6942
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6943
void
6944
ovsrec_ct_zone_verify_limit(const struct ovsrec_ct_zone *row)
6945
0
{
6946
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ct_zone_col_limit);
6947
0
}
6948
6949
/* Causes the original contents of column "timeout_policy" in 'row' to be
6950
 * verified as a prerequisite to completing the transaction.  That is, if
6951
 * "timeout_policy" in 'row' changed (or if 'row' was deleted) between the
6952
 * time that the IDL originally read its contents and the time that the
6953
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
6954
 *
6955
 * The intention is that, to ensure that no transaction commits based on dirty
6956
 * reads, an application should call this function any time "timeout_policy" is
6957
 * read as part of a read-modify-write operation.
6958
 *
6959
 * In some cases this function reduces to a no-op, because the current value
6960
 * of "timeout_policy" is already known:
6961
 *
6962
 *   - If 'row' is a row created by the current transaction (returned by
6963
 *     ovsrec_ct_zone_insert()).
6964
 *
6965
 *   - If "timeout_policy" has already been modified (with
6966
 *     ovsrec_ct_zone_set_timeout_policy()) within the current transaction.
6967
 *
6968
 * Because of the latter property, always call this function *before*
6969
 * ovsrec_ct_zone_set_timeout_policy() for a given read-modify-write.
6970
 *
6971
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6972
void
6973
ovsrec_ct_zone_verify_timeout_policy(const struct ovsrec_ct_zone *row)
6974
0
{
6975
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ct_zone_col_timeout_policy);
6976
0
}
6977
6978
/* Returns the "external_ids" column's value from the "CT_Zone" table in 'row'
6979
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
6980
 * ovsdb_datum_find_key() is an easier and more efficient way to search
6981
 * for a given key than implementing the same operation on the "cooked"
6982
 * form in 'row'.
6983
 *
6984
 * 'key_type' must be OVSDB_TYPE_STRING.
6985
 * 'value_type' must be OVSDB_TYPE_STRING.
6986
 * (This helps to avoid silent bugs if someone changes external_ids's
6987
 * type without updating the caller.)
6988
 *
6989
 * The caller must not modify or free the returned value.
6990
 *
6991
 * Various kinds of changes can invalidate the returned value: modifying
6992
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6993
 * If the returned value is needed for a long time, it is best to make a copy
6994
 * of it with ovsdb_datum_clone().
6995
 *
6996
 * This function is rarely useful, since it is easier to access the value
6997
 * directly through the "external_ids" member in ovsrec_ct_zone. */
6998
const struct ovsdb_datum *
6999
ovsrec_ct_zone_get_external_ids(const struct ovsrec_ct_zone *row,
7000
  enum ovsdb_atomic_type key_type OVS_UNUSED,
7001
  enum ovsdb_atomic_type value_type OVS_UNUSED)
7002
0
{
7003
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
7004
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
7005
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ct_zone_col_external_ids);
7006
0
}
7007
7008
/* Returns the "limit" column's value from the "CT_Zone" table in 'row'
7009
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
7010
 * ovsdb_datum_find_key() is an easier and more efficient way to search
7011
 * for a given key than implementing the same operation on the "cooked"
7012
 * form in 'row'.
7013
 *
7014
 * 'key_type' must be OVSDB_TYPE_INTEGER.
7015
 * (This helps to avoid silent bugs if someone changes limit's
7016
 * type without updating the caller.)
7017
 *
7018
 * The caller must not modify or free the returned value.
7019
 *
7020
 * Various kinds of changes can invalidate the returned value: modifying
7021
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7022
 * If the returned value is needed for a long time, it is best to make a copy
7023
 * of it with ovsdb_datum_clone().
7024
 *
7025
 * This function is rarely useful, since it is easier to access the value
7026
 * directly through the "limit" member in ovsrec_ct_zone. */
7027
const struct ovsdb_datum *
7028
ovsrec_ct_zone_get_limit(const struct ovsrec_ct_zone *row,
7029
  enum ovsdb_atomic_type key_type OVS_UNUSED)
7030
0
{
7031
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
7032
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ct_zone_col_limit);
7033
0
}
7034
7035
/* Returns the "timeout_policy" column's value from the "CT_Zone" table in 'row'
7036
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
7037
 * ovsdb_datum_find_key() is an easier and more efficient way to search
7038
 * for a given key than implementing the same operation on the "cooked"
7039
 * form in 'row'.
7040
 *
7041
 * 'key_type' must be OVSDB_TYPE_UUID.
7042
 * (This helps to avoid silent bugs if someone changes timeout_policy's
7043
 * type without updating the caller.)
7044
 *
7045
 * The caller must not modify or free the returned value.
7046
 *
7047
 * Various kinds of changes can invalidate the returned value: modifying
7048
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7049
 * If the returned value is needed for a long time, it is best to make a copy
7050
 * of it with ovsdb_datum_clone().
7051
 *
7052
 * This function is rarely useful, since it is easier to access the value
7053
 * directly through the "timeout_policy" member in ovsrec_ct_zone. */
7054
const struct ovsdb_datum *
7055
ovsrec_ct_zone_get_timeout_policy(const struct ovsrec_ct_zone *row,
7056
  enum ovsdb_atomic_type key_type OVS_UNUSED)
7057
0
{
7058
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
7059
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ct_zone_col_timeout_policy);
7060
0
}
7061
7062
/* Sets the "external_ids" column's value from the "CT_Zone" table in 'row'
7063
 * to 'external_ids'.
7064
 *
7065
 * The caller retains ownership of 'external_ids' and everything in it. */
7066
void
7067
ovsrec_ct_zone_set_external_ids(const struct ovsrec_ct_zone *row, const struct smap *external_ids)
7068
0
{
7069
0
    struct ovsdb_datum datum;
7070
7071
0
    if (external_ids) {
7072
0
        ovsdb_datum_from_smap(&datum, external_ids);
7073
0
    } else {
7074
0
        ovsdb_datum_init_empty(&datum);
7075
0
    }
7076
0
    ovsdb_idl_txn_write(&row->header_,
7077
0
                        &ovsrec_ct_zone_col_external_ids,
7078
0
                        &datum);
7079
0
}
7080
7081
7082
/* Sets the "limit" column from the "CT_Zone" table in 'row' to
7083
 * the 'limit' set with 'n_limit' entries.
7084
 *
7085
 * 'n_limit' may be 0 or 1; if it is 0, then 'limit'
7086
 * may be NULL.
7087
 *
7088
 * Argument constraints: in range 0 to 4,294,967,295
7089
 *
7090
 * The caller retains ownership of the arguments. */
7091
void
7092
ovsrec_ct_zone_set_limit(const struct ovsrec_ct_zone *row, const int64_t *limit, size_t n_limit)
7093
0
{
7094
0
    struct ovsdb_datum datum;
7095
7096
0
    datum.refcnt = NULL;
7097
7098
0
    if (n_limit) {
7099
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
7100
0
        datum.n = 1;
7101
0
        datum.keys = key;
7102
0
        key->integer = *limit;
7103
0
    } else {
7104
0
        datum.n = 0;
7105
0
        datum.keys = NULL;
7106
0
    }
7107
0
    datum.values = NULL;
7108
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ct_zone_col_limit, &datum);
7109
0
}
7110
7111
/* Sets the "timeout_policy" column from the "CT_Zone" table in 'row' to
7112
 * the 'timeout_policy' set.
7113
 *
7114
 * If "timeout_policy" is null, the column will be the empty set,
7115
 * otherwise it will contain the specified value.
7116
 *
7117
 * The caller retains ownership of the arguments. */
7118
void
7119
ovsrec_ct_zone_set_timeout_policy(const struct ovsrec_ct_zone *row, const struct ovsrec_ct_timeout_policy *timeout_policy)
7120
0
{
7121
0
    struct ovsdb_datum datum;
7122
7123
0
    datum.refcnt = NULL;
7124
7125
0
    if (timeout_policy) {
7126
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
7127
0
        datum.n = 1;
7128
0
        datum.keys = key;
7129
0
        key->uuid = timeout_policy->header_.uuid;
7130
0
    } else {
7131
0
        datum.n = 0;
7132
0
        datum.keys = NULL;
7133
0
    }
7134
0
    datum.values = NULL;
7135
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ct_zone_col_timeout_policy, &datum);
7136
0
}
7137
7138
/* Sets an element of the "external_ids" map column from the "CT_Zone" table in 'row'
7139
 * to 'new_value' given the key value 'new_key'.
7140
 *
7141
 */
7142
void
7143
ovsrec_ct_zone_update_external_ids_setkey(const struct ovsrec_ct_zone *row, const char *new_key, const char *new_value)
7144
0
{
7145
0
    struct ovsdb_datum *datum;
7146
7147
0
    datum = xmalloc(sizeof *datum);
7148
0
    datum->n = 1;
7149
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
7150
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
7151
0
    datum->refcnt = NULL;
7152
7153
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
7154
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
7155
7156
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
7157
0
                                    &ovsrec_ct_zone_col_external_ids,
7158
0
                                    datum);
7159
0
}
7160
7161
/* Deletes an element of the "external_ids" map column from the "CT_Zone" table in 'row'
7162
 * given the key value 'delete_key'.
7163
 *
7164
 */
7165
void
7166
ovsrec_ct_zone_update_external_ids_delkey(const struct ovsrec_ct_zone *row, const char *delete_key)
7167
0
{
7168
0
    struct ovsdb_datum *datum;
7169
7170
0
    datum = xmalloc(sizeof *datum);
7171
0
    datum->n = 1;
7172
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
7173
0
    datum->values = NULL;
7174
0
    datum->refcnt = NULL;
7175
7176
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
7177
7178
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
7179
0
                                    &ovsrec_ct_zone_col_external_ids,
7180
0
                                    datum);
7181
0
}
7182
7183
/* Adds the value 'new_value' to the "limit" set column from the "CT_Zone" table
7184
 * in 'row'.
7185
 *
7186
 */
7187
void
7188
ovsrec_ct_zone_update_limit_addvalue(const struct ovsrec_ct_zone *row, int64_t new_value)
7189
0
{
7190
0
    struct ovsdb_datum *datum;
7191
7192
0
    datum = xmalloc(sizeof *datum);
7193
0
    datum->n = 1;
7194
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
7195
0
    datum->values = NULL;
7196
0
    datum->refcnt = NULL;
7197
7198
0
    datum->keys[0].integer = new_value;
7199
7200
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
7201
0
                                    &ovsrec_ct_zone_col_limit,
7202
0
                                    datum);
7203
0
}
7204
7205
/* Deletes the value 'delete_value' from the "limit" set column from the
7206
 * "CT_Zone" table in 'row'.
7207
 *
7208
 */
7209
void
7210
ovsrec_ct_zone_update_limit_delvalue(const struct ovsrec_ct_zone *row, int64_t delete_value)
7211
0
{
7212
0
    struct ovsdb_datum *datum;
7213
7214
0
    datum = xmalloc(sizeof *datum);
7215
0
    datum->n = 1;
7216
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
7217
0
    datum->values = NULL;
7218
0
    datum->refcnt = NULL;
7219
7220
0
    datum->keys[0].integer = delete_value;
7221
7222
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
7223
0
                                    &ovsrec_ct_zone_col_limit,
7224
0
                                    datum);
7225
0
}
7226
7227
/* Adds the value 'new_value' to the "timeout_policy" set column from the "CT_Zone" table
7228
 * in 'row'.
7229
 *
7230
 */
7231
void
7232
ovsrec_ct_zone_update_timeout_policy_addvalue(const struct ovsrec_ct_zone *row, const struct ovsrec_ct_timeout_policy *new_value)
7233
0
{
7234
0
    struct ovsdb_datum *datum;
7235
7236
0
    datum = xmalloc(sizeof *datum);
7237
0
    datum->n = 1;
7238
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
7239
0
    datum->values = NULL;
7240
0
    datum->refcnt = NULL;
7241
7242
0
    datum->keys[0].uuid = new_value->header_.uuid;
7243
7244
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
7245
0
                                    &ovsrec_ct_zone_col_timeout_policy,
7246
0
                                    datum);
7247
0
}
7248
7249
/* Deletes the value 'delete_value' from the "timeout_policy" set column from the
7250
 * "CT_Zone" table in 'row'.
7251
 *
7252
 */
7253
void
7254
ovsrec_ct_zone_update_timeout_policy_delvalue(const struct ovsrec_ct_zone *row, const struct ovsrec_ct_timeout_policy *delete_value)
7255
0
{
7256
0
    struct ovsdb_datum *datum;
7257
7258
0
    datum = xmalloc(sizeof *datum);
7259
0
    datum->n = 1;
7260
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
7261
0
    datum->values = NULL;
7262
0
    datum->refcnt = NULL;
7263
7264
0
    datum->keys[0].uuid = delete_value->header_.uuid;
7265
7266
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
7267
0
                                    &ovsrec_ct_zone_col_timeout_policy,
7268
0
                                    datum);
7269
0
}
7270
7271
/* Sets the "external_ids" column's value from the "CT_Zone" table in 'row'
7272
 * to 'external_ids'.
7273
 *
7274
 * The caller retains ownership of 'external_ids' and everything in it. */
7275
void
7276
ovsrec_ct_zone_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
7277
0
{
7278
0
    struct ovsdb_datum datum;
7279
7280
0
    if (external_ids) {
7281
0
        ovsdb_datum_from_smap(&datum, external_ids);
7282
0
    } else {
7283
0
        ovsdb_datum_init_empty(&datum);
7284
0
    }
7285
7286
0
    ovsdb_idl_condition_add_clause(cond,
7287
0
                                   function,
7288
0
                                   &ovsrec_ct_zone_col_external_ids,
7289
0
                                   &datum);
7290
7291
0
    ovsdb_datum_destroy(&datum, &ovsrec_ct_zone_col_external_ids.type);
7292
0
}
7293
7294
7295
/* Sets the "limit" column from the "CT_Zone" table in 'row' to
7296
 * the 'limit' set with 'n_limit' entries.
7297
 *
7298
 * 'n_limit' may be 0 or 1; if it is 0, then 'limit'
7299
 * may be NULL.
7300
 *
7301
 * Argument constraints: in range 0 to 4,294,967,295
7302
 *
7303
 * The caller retains ownership of the arguments. */
7304
void
7305
ovsrec_ct_zone_add_clause_limit(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *limit, size_t n_limit)
7306
0
{
7307
0
    struct ovsdb_datum datum;
7308
7309
0
    datum.refcnt = NULL;
7310
7311
0
    if (n_limit) {
7312
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
7313
0
        datum.n = 1;
7314
0
        datum.keys = key;
7315
0
        key->integer = *limit;
7316
0
    } else {
7317
0
        datum.n = 0;
7318
0
        datum.keys = NULL;
7319
0
    }
7320
0
    datum.values = NULL;
7321
0
    ovsdb_idl_condition_add_clause(cond,
7322
0
                          function,
7323
0
                          &ovsrec_ct_zone_col_limit,
7324
0
                          &datum);
7325
0
    ovsdb_datum_destroy(&datum, &ovsrec_ct_zone_col_limit.type);
7326
0
}
7327
7328
/* Sets the "timeout_policy" column from the "CT_Zone" table in 'row' to
7329
 * the 'timeout_policy' set.
7330
 *
7331
 * If "timeout_policy" is null, the column will be the empty set,
7332
 * otherwise it will contain the specified value.
7333
 *
7334
 * The caller retains ownership of the arguments. */
7335
void
7336
ovsrec_ct_zone_add_clause_timeout_policy(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *timeout_policy)
7337
0
{
7338
0
    struct ovsdb_datum datum;
7339
7340
0
    datum.refcnt = NULL;
7341
7342
0
    if (timeout_policy) {
7343
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
7344
0
        datum.n = 1;
7345
0
        datum.keys = key;
7346
0
        key->uuid = *timeout_policy;
7347
0
    } else {
7348
0
        datum.n = 0;
7349
0
        datum.keys = NULL;
7350
0
    }
7351
0
    datum.values = NULL;
7352
0
    ovsdb_idl_condition_add_clause(cond,
7353
0
                          function,
7354
0
                          &ovsrec_ct_zone_col_timeout_policy,
7355
0
                          &datum);
7356
0
    ovsdb_datum_destroy(&datum, &ovsrec_ct_zone_col_timeout_policy.type);
7357
0
}
7358
7359
/* Destroy 'row' of kind "CT_Zone". The row must have been
7360
 * created with ovsdb_idl_index_init_row.
7361
 */
7362
void
7363
ovsrec_ct_zone_index_destroy_row(const struct ovsrec_ct_zone *row)
7364
0
{
7365
0
    ovsdb_idl_index_destroy_row(&row->header_);
7366
0
}
7367
        
7368
7369
/* Creates a new row of kind "CT_Zone". */
7370
struct ovsrec_ct_zone *
7371
ovsrec_ct_zone_index_init_row(struct ovsdb_idl_index *index)
7372
0
{
7373
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_zone);
7374
0
    return ALIGNED_CAST(struct ovsrec_ct_zone *, ovsdb_idl_index_init_row(index));
7375
0
}
7376
7377
struct ovsrec_ct_zone *
7378
ovsrec_ct_zone_index_find(struct ovsdb_idl_index *index, const struct ovsrec_ct_zone *target)
7379
0
{
7380
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_zone);
7381
0
    return ovsrec_ct_zone_cast(ovsdb_idl_index_find(index, &target->header_));
7382
0
}
7383
7384
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
7385
int
7386
ovsrec_ct_zone_index_compare(
7387
    struct ovsdb_idl_index *index, 
7388
    const struct ovsrec_ct_zone *a, 
7389
    const struct ovsrec_ct_zone *b)
7390
0
{
7391
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
7392
0
}
7393
7394
struct ovsdb_idl_cursor
7395
ovsrec_ct_zone_cursor_first(struct ovsdb_idl_index *index)
7396
0
{
7397
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_zone);
7398
0
    return ovsdb_idl_cursor_first(index);
7399
0
}
7400
7401
struct ovsdb_idl_cursor
7402
ovsrec_ct_zone_cursor_first_eq(
7403
    struct ovsdb_idl_index *index, const struct ovsrec_ct_zone *target)
7404
0
{
7405
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_zone);
7406
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
7407
0
}
7408
7409
struct ovsdb_idl_cursor
7410
ovsrec_ct_zone_cursor_first_ge(
7411
    struct ovsdb_idl_index *index, const struct ovsrec_ct_zone *target)
7412
0
{
7413
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_zone);
7414
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
7415
0
}
7416
7417
struct ovsrec_ct_zone *
7418
ovsrec_ct_zone_cursor_data(struct ovsdb_idl_cursor *cursor)
7419
0
{
7420
0
    return ovsrec_ct_zone_cast(ovsdb_idl_cursor_data(cursor));
7421
0
}
7422
7423
7424
/* Sets the "external_ids" column's value from the "CT_Zone" table in 'row'
7425
 * to 'external_ids'.
7426
 *
7427
 * The caller retains ownership of 'external_ids' and everything in it. */
7428
void
7429
ovsrec_ct_zone_index_set_external_ids(const struct ovsrec_ct_zone *row, const struct smap *external_ids)
7430
0
{
7431
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
7432
7433
0
    if (external_ids) {
7434
0
        struct smap_node *node;
7435
0
        size_t i;
7436
7437
0
        datum->n = smap_count(external_ids);
7438
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
7439
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
7440
0
        datum->refcnt = NULL;
7441
7442
0
        i = 0;
7443
0
        SMAP_FOR_EACH (node, external_ids) {
7444
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
7445
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
7446
0
            i++;
7447
0
        }
7448
0
        ovsdb_datum_sort_unique(datum, &ovsrec_ct_zone_col_external_ids.type);
7449
0
    } else {
7450
0
        ovsdb_datum_init_empty(datum);
7451
0
    }
7452
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
7453
0
                          &ovsrec_ct_zone_columns[OVSREC_CT_ZONE_COL_EXTERNAL_IDS],
7454
0
                          datum,
7455
0
                          &ovsrec_table_classes[OVSREC_TABLE_CT_ZONE]);
7456
0
    free(datum);
7457
0
}
7458
7459
7460
/* Sets the "limit" column from the "CT_Zone" table in 'row' to
7461
 * the 'limit' set with 'n_limit' entries.
7462
 *
7463
 * 'n_limit' may be 0 or 1; if it is 0, then 'limit'
7464
 * may be NULL.
7465
 *
7466
 * Argument constraints: in range 0 to 4,294,967,295
7467
 *
7468
 * The caller retains ownership of the arguments. */
7469
void
7470
ovsrec_ct_zone_index_set_limit(const struct ovsrec_ct_zone *row, const int64_t *limit, size_t n_limit)
7471
0
{
7472
0
    struct ovsdb_datum datum;
7473
7474
0
    datum.refcnt = NULL;
7475
0
    union ovsdb_atom *key;
7476
7477
0
    if (n_limit) {
7478
0
        key = xmalloc(sizeof(union ovsdb_atom));
7479
0
        datum.n = 1;
7480
0
        datum.keys = key;
7481
0
        key->integer = *limit;
7482
0
    } else {
7483
0
        datum.n = 0;
7484
0
        datum.keys = NULL;
7485
0
    }
7486
0
    datum.values = NULL;
7487
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ct_zone_columns[ OVSREC_CT_ZONE_COL_LIMIT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CT_ZONE]);
7488
0
}
7489
7490
/* Sets the "timeout_policy" column from the "CT_Zone" table in 'row' to
7491
 * the 'timeout_policy' set.
7492
 *
7493
 * If "timeout_policy" is null, the column will be the empty set,
7494
 * otherwise it will contain the specified value.
7495
 *
7496
 * The caller retains ownership of the arguments. */
7497
void
7498
ovsrec_ct_zone_index_set_timeout_policy(const struct ovsrec_ct_zone *row, const struct ovsrec_ct_timeout_policy *timeout_policy)
7499
0
{
7500
0
    struct ovsdb_datum datum;
7501
7502
0
    datum.refcnt = NULL;
7503
0
    union ovsdb_atom *key;
7504
7505
0
    if (timeout_policy) {
7506
0
        key = xmalloc(sizeof (union ovsdb_atom));
7507
0
        datum.n = 1;
7508
0
        datum.keys = key;
7509
0
        key->uuid = timeout_policy->header_.uuid;
7510
0
    } else {
7511
0
        datum.n = 0;
7512
0
        datum.keys = NULL;
7513
0
    }
7514
0
    datum.values = NULL;
7515
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ct_zone_columns[ OVSREC_CT_ZONE_COL_TIMEOUT_POLICY ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CT_ZONE]);
7516
0
}
7517
7518
struct ovsdb_idl_column ovsrec_ct_zone_columns[OVSREC_CT_ZONE_N_COLUMNS];
7519
7520
unsigned int
7521
ovsrec_ct_zone_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
7522
0
{
7523
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_ct_zone, condition);
7524
0
}
7525
7526
struct ovsdb_idl_column ovsrec_ct_zone_columns[OVSREC_CT_ZONE_N_COLUMNS] = {
7527
    [OVSREC_CT_ZONE_COL_EXTERNAL_IDS] = {
7528
         .name = "external_ids",
7529
         .type = {
7530
            .key = {
7531
               .type = OVSDB_TYPE_STRING,
7532
               .string = { .minLen = 0, .maxLen = UINT_MAX },
7533
            },
7534
            .value = {
7535
                .type = OVSDB_TYPE_STRING,
7536
                .string = { .minLen = 0, .maxLen = UINT_MAX },
7537
            },
7538
            .n_min = 0,
7539
            .n_max = UINT_MAX,
7540
         },
7541
         .is_mutable = true,
7542
         .is_synthetic = false,
7543
         .parse = ovsrec_ct_zone_parse_external_ids,
7544
         .unparse = ovsrec_ct_zone_unparse_external_ids,
7545
    },
7546
7547
    [OVSREC_CT_ZONE_COL_LIMIT] = {
7548
         .name = "limit",
7549
         .type = {
7550
            .key = {
7551
               .type = OVSDB_TYPE_INTEGER,
7552
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
7553
            },
7554
            .value = OVSDB_BASE_VOID_INIT,
7555
            .n_min = 0,
7556
            .n_max = 1,
7557
         },
7558
         .is_mutable = true,
7559
         .is_synthetic = false,
7560
         .parse = ovsrec_ct_zone_parse_limit,
7561
         .unparse = ovsrec_ct_zone_unparse_limit,
7562
    },
7563
7564
    [OVSREC_CT_ZONE_COL_TIMEOUT_POLICY] = {
7565
         .name = "timeout_policy",
7566
         .type = {
7567
            .key = {
7568
               .type = OVSDB_TYPE_UUID,
7569
               .uuid = { .refTableName = "CT_Timeout_Policy", .refType = OVSDB_REF_STRONG },
7570
            },
7571
            .value = OVSDB_BASE_VOID_INIT,
7572
            .n_min = 0,
7573
            .n_max = 1,
7574
         },
7575
         .is_mutable = true,
7576
         .is_synthetic = false,
7577
         .parse = ovsrec_ct_zone_parse_timeout_policy,
7578
         .unparse = ovsrec_ct_zone_unparse_timeout_policy,
7579
    },
7580
7581
};
7582

7583
/* Controller table. */
7584
7585
bool
7586
ovsrec_server_has_controller_table_col_connection_mode(const struct ovsdb_idl *idl)
7587
0
{
7588
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_connection_mode);
7589
0
}
7590
7591
const struct ovsdb_type *
7592
ovsrec_controller_connection_mode_server_type(const struct ovsdb_idl *idl)
7593
0
{
7594
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_connection_mode);
7595
0
}
7596
7597
7598
bool
7599
ovsrec_server_has_controller_table_col_controller_burst_limit(const struct ovsdb_idl *idl)
7600
0
{
7601
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_controller_burst_limit);
7602
0
}
7603
7604
const struct ovsdb_type *
7605
ovsrec_controller_controller_burst_limit_server_type(const struct ovsdb_idl *idl)
7606
0
{
7607
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_controller_burst_limit);
7608
0
}
7609
7610
7611
bool
7612
ovsrec_server_has_controller_table_col_controller_queue_size(const struct ovsdb_idl *idl)
7613
0
{
7614
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_controller_queue_size);
7615
0
}
7616
7617
const struct ovsdb_type *
7618
ovsrec_controller_controller_queue_size_server_type(const struct ovsdb_idl *idl)
7619
0
{
7620
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_controller_queue_size);
7621
0
}
7622
7623
7624
bool
7625
ovsrec_server_has_controller_table_col_controller_rate_limit(const struct ovsdb_idl *idl)
7626
0
{
7627
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_controller_rate_limit);
7628
0
}
7629
7630
const struct ovsdb_type *
7631
ovsrec_controller_controller_rate_limit_server_type(const struct ovsdb_idl *idl)
7632
0
{
7633
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_controller_rate_limit);
7634
0
}
7635
7636
7637
bool
7638
ovsrec_server_has_controller_table_col_enable_async_messages(const struct ovsdb_idl *idl)
7639
0
{
7640
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_enable_async_messages);
7641
0
}
7642
7643
const struct ovsdb_type *
7644
ovsrec_controller_enable_async_messages_server_type(const struct ovsdb_idl *idl)
7645
0
{
7646
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_enable_async_messages);
7647
0
}
7648
7649
7650
bool
7651
ovsrec_server_has_controller_table_col_external_ids(const struct ovsdb_idl *idl)
7652
0
{
7653
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_external_ids);
7654
0
}
7655
7656
const struct ovsdb_type *
7657
ovsrec_controller_external_ids_server_type(const struct ovsdb_idl *idl)
7658
0
{
7659
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_external_ids);
7660
0
}
7661
7662
7663
bool
7664
ovsrec_server_has_controller_table_col_inactivity_probe(const struct ovsdb_idl *idl)
7665
0
{
7666
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_inactivity_probe);
7667
0
}
7668
7669
const struct ovsdb_type *
7670
ovsrec_controller_inactivity_probe_server_type(const struct ovsdb_idl *idl)
7671
0
{
7672
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_inactivity_probe);
7673
0
}
7674
7675
7676
bool
7677
ovsrec_server_has_controller_table_col_is_connected(const struct ovsdb_idl *idl)
7678
0
{
7679
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_is_connected);
7680
0
}
7681
7682
const struct ovsdb_type *
7683
ovsrec_controller_is_connected_server_type(const struct ovsdb_idl *idl)
7684
0
{
7685
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_is_connected);
7686
0
}
7687
7688
7689
bool
7690
ovsrec_server_has_controller_table_col_local_gateway(const struct ovsdb_idl *idl)
7691
0
{
7692
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_local_gateway);
7693
0
}
7694
7695
const struct ovsdb_type *
7696
ovsrec_controller_local_gateway_server_type(const struct ovsdb_idl *idl)
7697
0
{
7698
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_local_gateway);
7699
0
}
7700
7701
7702
bool
7703
ovsrec_server_has_controller_table_col_local_ip(const struct ovsdb_idl *idl)
7704
0
{
7705
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_local_ip);
7706
0
}
7707
7708
const struct ovsdb_type *
7709
ovsrec_controller_local_ip_server_type(const struct ovsdb_idl *idl)
7710
0
{
7711
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_local_ip);
7712
0
}
7713
7714
7715
bool
7716
ovsrec_server_has_controller_table_col_local_netmask(const struct ovsdb_idl *idl)
7717
0
{
7718
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_local_netmask);
7719
0
}
7720
7721
const struct ovsdb_type *
7722
ovsrec_controller_local_netmask_server_type(const struct ovsdb_idl *idl)
7723
0
{
7724
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_local_netmask);
7725
0
}
7726
7727
7728
bool
7729
ovsrec_server_has_controller_table_col_max_backoff(const struct ovsdb_idl *idl)
7730
0
{
7731
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_max_backoff);
7732
0
}
7733
7734
const struct ovsdb_type *
7735
ovsrec_controller_max_backoff_server_type(const struct ovsdb_idl *idl)
7736
0
{
7737
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_max_backoff);
7738
0
}
7739
7740
7741
bool
7742
ovsrec_server_has_controller_table_col_other_config(const struct ovsdb_idl *idl)
7743
0
{
7744
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_other_config);
7745
0
}
7746
7747
const struct ovsdb_type *
7748
ovsrec_controller_other_config_server_type(const struct ovsdb_idl *idl)
7749
0
{
7750
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_other_config);
7751
0
}
7752
7753
7754
bool
7755
ovsrec_server_has_controller_table_col_role(const struct ovsdb_idl *idl)
7756
0
{
7757
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_role);
7758
0
}
7759
7760
const struct ovsdb_type *
7761
ovsrec_controller_role_server_type(const struct ovsdb_idl *idl)
7762
0
{
7763
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_role);
7764
0
}
7765
7766
7767
bool
7768
ovsrec_server_has_controller_table_col_status(const struct ovsdb_idl *idl)
7769
0
{
7770
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_status);
7771
0
}
7772
7773
const struct ovsdb_type *
7774
ovsrec_controller_status_server_type(const struct ovsdb_idl *idl)
7775
0
{
7776
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_status);
7777
0
}
7778
7779
7780
bool
7781
ovsrec_server_has_controller_table_col_target(const struct ovsdb_idl *idl)
7782
0
{
7783
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_target);
7784
0
}
7785
7786
const struct ovsdb_type *
7787
ovsrec_controller_target_server_type(const struct ovsdb_idl *idl)
7788
0
{
7789
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_target);
7790
0
}
7791
7792
7793
bool
7794
ovsrec_server_has_controller_table_col_type(const struct ovsdb_idl *idl)
7795
0
{
7796
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_type);
7797
0
}
7798
7799
const struct ovsdb_type *
7800
ovsrec_controller_type_server_type(const struct ovsdb_idl *idl)
7801
0
{
7802
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_controller_col_type);
7803
0
}
7804
7805
7806
bool
7807
ovsrec_server_has_controller_table(const struct ovsdb_idl *idl)
7808
0
{
7809
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
7810
0
}
7811
7812
7813
const struct ovsrec_controller_table *
7814
ovsrec_controller_table_get(const struct ovsdb_idl *idl)
7815
0
{
7816
0
    return (const struct ovsrec_controller_table *) idl;
7817
0
}
7818
7819
const struct ovsrec_controller *
7820
ovsrec_controller_table_first(const struct ovsrec_controller_table *table)
7821
0
{
7822
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
7823
0
    return ovsrec_controller_first(idl);
7824
0
}
7825
7826
7827
const struct ovsrec_controller *
7828
ovsrec_controller_table_track_get_first(const struct ovsrec_controller_table *table)
7829
0
{
7830
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
7831
0
    return ovsrec_controller_track_get_first(idl);
7832
0
}
7833
7834
7835
static void
7836
ovsrec_controller_parse_connection_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7837
0
{
7838
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7839
7840
0
    if (datum->n >= 1) {
7841
0
        row->connection_mode = CONST_CAST(char *, json_string(datum->keys[0].s));
7842
0
    } else {
7843
0
        row->connection_mode = NULL;
7844
0
    }
7845
0
}
7846
7847
static void
7848
ovsrec_controller_parse_controller_burst_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7849
0
{
7850
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7851
0
    size_t n = MIN(1, datum->n);
7852
0
    row->controller_burst_limit = NULL;
7853
0
    row->n_controller_burst_limit = 0;
7854
0
    for (size_t i = 0; i < n; i++) {
7855
0
        if (!row->n_controller_burst_limit) {
7856
0
            row->controller_burst_limit = xmalloc(n * sizeof *row->controller_burst_limit);
7857
0
        }
7858
0
        row->controller_burst_limit[row->n_controller_burst_limit] = datum->keys[i].integer;
7859
0
        row->n_controller_burst_limit++;
7860
0
    }
7861
0
}
7862
7863
static void
7864
ovsrec_controller_parse_controller_queue_size(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7865
0
{
7866
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7867
0
    size_t n = MIN(1, datum->n);
7868
0
    row->controller_queue_size = NULL;
7869
0
    row->n_controller_queue_size = 0;
7870
0
    for (size_t i = 0; i < n; i++) {
7871
0
        if (!row->n_controller_queue_size) {
7872
0
            row->controller_queue_size = xmalloc(n * sizeof *row->controller_queue_size);
7873
0
        }
7874
0
        row->controller_queue_size[row->n_controller_queue_size] = datum->keys[i].integer;
7875
0
        row->n_controller_queue_size++;
7876
0
    }
7877
0
}
7878
7879
static void
7880
ovsrec_controller_parse_controller_rate_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7881
0
{
7882
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7883
0
    size_t n = MIN(1, datum->n);
7884
0
    row->controller_rate_limit = NULL;
7885
0
    row->n_controller_rate_limit = 0;
7886
0
    for (size_t i = 0; i < n; i++) {
7887
0
        if (!row->n_controller_rate_limit) {
7888
0
            row->controller_rate_limit = xmalloc(n * sizeof *row->controller_rate_limit);
7889
0
        }
7890
0
        row->controller_rate_limit[row->n_controller_rate_limit] = datum->keys[i].integer;
7891
0
        row->n_controller_rate_limit++;
7892
0
    }
7893
0
}
7894
7895
static void
7896
ovsrec_controller_parse_enable_async_messages(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7897
0
{
7898
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7899
0
    size_t n = MIN(1, datum->n);
7900
0
    row->enable_async_messages = NULL;
7901
0
    row->n_enable_async_messages = 0;
7902
0
    for (size_t i = 0; i < n; i++) {
7903
0
        if (!row->n_enable_async_messages) {
7904
0
            row->enable_async_messages = xmalloc(n * sizeof *row->enable_async_messages);
7905
0
        }
7906
0
        row->enable_async_messages[row->n_enable_async_messages] = datum->keys[i].boolean;
7907
0
        row->n_enable_async_messages++;
7908
0
    }
7909
0
}
7910
7911
static void
7912
ovsrec_controller_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7913
0
{
7914
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7915
0
    smap_init(&row->external_ids);
7916
0
    for (size_t i = 0; i < datum->n; i++) {
7917
0
        smap_add(&row->external_ids,
7918
0
                 json_string(datum->keys[i].s),
7919
0
                 json_string(datum->values[i].s));
7920
0
    }
7921
0
}
7922
7923
static void
7924
ovsrec_controller_parse_inactivity_probe(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7925
0
{
7926
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7927
0
    size_t n = MIN(1, datum->n);
7928
0
    row->inactivity_probe = NULL;
7929
0
    row->n_inactivity_probe = 0;
7930
0
    for (size_t i = 0; i < n; i++) {
7931
0
        if (!row->n_inactivity_probe) {
7932
0
            row->inactivity_probe = xmalloc(n * sizeof *row->inactivity_probe);
7933
0
        }
7934
0
        row->inactivity_probe[row->n_inactivity_probe] = datum->keys[i].integer;
7935
0
        row->n_inactivity_probe++;
7936
0
    }
7937
0
}
7938
7939
static void
7940
ovsrec_controller_parse_is_connected(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7941
0
{
7942
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7943
7944
0
    if (datum->n >= 1) {
7945
0
        row->is_connected = datum->keys[0].boolean;
7946
0
    } else {
7947
0
        row->is_connected = false;
7948
0
    }
7949
0
}
7950
7951
static void
7952
ovsrec_controller_parse_local_gateway(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7953
0
{
7954
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7955
7956
0
    if (datum->n >= 1) {
7957
0
        row->local_gateway = CONST_CAST(char *, json_string(datum->keys[0].s));
7958
0
    } else {
7959
0
        row->local_gateway = NULL;
7960
0
    }
7961
0
}
7962
7963
static void
7964
ovsrec_controller_parse_local_ip(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7965
0
{
7966
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7967
7968
0
    if (datum->n >= 1) {
7969
0
        row->local_ip = CONST_CAST(char *, json_string(datum->keys[0].s));
7970
0
    } else {
7971
0
        row->local_ip = NULL;
7972
0
    }
7973
0
}
7974
7975
static void
7976
ovsrec_controller_parse_local_netmask(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7977
0
{
7978
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7979
7980
0
    if (datum->n >= 1) {
7981
0
        row->local_netmask = CONST_CAST(char *, json_string(datum->keys[0].s));
7982
0
    } else {
7983
0
        row->local_netmask = NULL;
7984
0
    }
7985
0
}
7986
7987
static void
7988
ovsrec_controller_parse_max_backoff(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7989
0
{
7990
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7991
0
    size_t n = MIN(1, datum->n);
7992
0
    row->max_backoff = NULL;
7993
0
    row->n_max_backoff = 0;
7994
0
    for (size_t i = 0; i < n; i++) {
7995
0
        if (!row->n_max_backoff) {
7996
0
            row->max_backoff = xmalloc(n * sizeof *row->max_backoff);
7997
0
        }
7998
0
        row->max_backoff[row->n_max_backoff] = datum->keys[i].integer;
7999
0
        row->n_max_backoff++;
8000
0
    }
8001
0
}
8002
8003
static void
8004
ovsrec_controller_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8005
0
{
8006
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8007
0
    smap_init(&row->other_config);
8008
0
    for (size_t i = 0; i < datum->n; i++) {
8009
0
        smap_add(&row->other_config,
8010
0
                 json_string(datum->keys[i].s),
8011
0
                 json_string(datum->values[i].s));
8012
0
    }
8013
0
}
8014
8015
static void
8016
ovsrec_controller_parse_role(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8017
0
{
8018
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8019
8020
0
    if (datum->n >= 1) {
8021
0
        row->role = CONST_CAST(char *, json_string(datum->keys[0].s));
8022
0
    } else {
8023
0
        row->role = NULL;
8024
0
    }
8025
0
}
8026
8027
static void
8028
ovsrec_controller_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8029
0
{
8030
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8031
0
    smap_init(&row->status);
8032
0
    for (size_t i = 0; i < datum->n; i++) {
8033
0
        smap_add(&row->status,
8034
0
                 json_string(datum->keys[i].s),
8035
0
                 json_string(datum->values[i].s));
8036
0
    }
8037
0
}
8038
8039
static void
8040
ovsrec_controller_parse_target(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8041
0
{
8042
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8043
8044
0
    if (datum->n >= 1) {
8045
0
        row->target = CONST_CAST(char *, json_string(datum->keys[0].s));
8046
0
    } else {
8047
0
        row->target = "";
8048
0
    }
8049
0
}
8050
8051
static void
8052
ovsrec_controller_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8053
0
{
8054
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8055
8056
0
    if (datum->n >= 1) {
8057
0
        row->type = CONST_CAST(char *, json_string(datum->keys[0].s));
8058
0
    } else {
8059
0
        row->type = NULL;
8060
0
    }
8061
0
}
8062
8063
static void
8064
ovsrec_controller_unparse_connection_mode(struct ovsdb_idl_row *row OVS_UNUSED)
8065
0
{
8066
    /* Nothing to do. */
8067
0
}
8068
8069
static void
8070
ovsrec_controller_unparse_controller_burst_limit(struct ovsdb_idl_row *row_)
8071
0
{
8072
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8073
0
    free(row->controller_burst_limit);
8074
0
}
8075
8076
static void
8077
ovsrec_controller_unparse_controller_queue_size(struct ovsdb_idl_row *row_)
8078
0
{
8079
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8080
0
    free(row->controller_queue_size);
8081
0
}
8082
8083
static void
8084
ovsrec_controller_unparse_controller_rate_limit(struct ovsdb_idl_row *row_)
8085
0
{
8086
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8087
0
    free(row->controller_rate_limit);
8088
0
}
8089
8090
static void
8091
ovsrec_controller_unparse_enable_async_messages(struct ovsdb_idl_row *row_)
8092
0
{
8093
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8094
0
    free(row->enable_async_messages);
8095
0
}
8096
8097
static void
8098
ovsrec_controller_unparse_external_ids(struct ovsdb_idl_row *row_)
8099
0
{
8100
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8101
0
    smap_destroy(&row->external_ids);
8102
0
}
8103
8104
static void
8105
ovsrec_controller_unparse_inactivity_probe(struct ovsdb_idl_row *row_)
8106
0
{
8107
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8108
0
    free(row->inactivity_probe);
8109
0
}
8110
8111
static void
8112
ovsrec_controller_unparse_is_connected(struct ovsdb_idl_row *row OVS_UNUSED)
8113
0
{
8114
    /* Nothing to do. */
8115
0
}
8116
8117
static void
8118
ovsrec_controller_unparse_local_gateway(struct ovsdb_idl_row *row OVS_UNUSED)
8119
0
{
8120
    /* Nothing to do. */
8121
0
}
8122
8123
static void
8124
ovsrec_controller_unparse_local_ip(struct ovsdb_idl_row *row OVS_UNUSED)
8125
0
{
8126
    /* Nothing to do. */
8127
0
}
8128
8129
static void
8130
ovsrec_controller_unparse_local_netmask(struct ovsdb_idl_row *row OVS_UNUSED)
8131
0
{
8132
    /* Nothing to do. */
8133
0
}
8134
8135
static void
8136
ovsrec_controller_unparse_max_backoff(struct ovsdb_idl_row *row_)
8137
0
{
8138
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8139
0
    free(row->max_backoff);
8140
0
}
8141
8142
static void
8143
ovsrec_controller_unparse_other_config(struct ovsdb_idl_row *row_)
8144
0
{
8145
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8146
0
    smap_destroy(&row->other_config);
8147
0
}
8148
8149
static void
8150
ovsrec_controller_unparse_role(struct ovsdb_idl_row *row OVS_UNUSED)
8151
0
{
8152
    /* Nothing to do. */
8153
0
}
8154
8155
static void
8156
ovsrec_controller_unparse_status(struct ovsdb_idl_row *row_)
8157
0
{
8158
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
8159
0
    smap_destroy(&row->status);
8160
0
}
8161
8162
static void
8163
ovsrec_controller_unparse_target(struct ovsdb_idl_row *row OVS_UNUSED)
8164
0
{
8165
    /* Nothing to do. */
8166
0
}
8167
8168
static void
8169
ovsrec_controller_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
8170
0
{
8171
    /* Nothing to do. */
8172
0
}
8173
8174
static void
8175
ovsrec_controller_init__(struct ovsdb_idl_row *row)
8176
0
{
8177
0
    ovsrec_controller_init(ovsrec_controller_cast(row));
8178
0
}
8179
8180
/* Clears the contents of 'row' in table "Controller". */
8181
void
8182
ovsrec_controller_init(struct ovsrec_controller *row)
8183
0
{
8184
0
    memset(row, 0, sizeof *row); 
8185
0
    smap_init(&row->external_ids);
8186
0
    smap_init(&row->other_config);
8187
0
    smap_init(&row->status);
8188
0
    row->target = "";
8189
0
}
8190
8191
/* Searches table "Controller" in 'idl' for a row with UUID 'uuid'.  Returns
8192
 * a pointer to the row if there is one, otherwise a null pointer.  */
8193
const struct ovsrec_controller *
8194
ovsrec_controller_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
8195
0
{
8196
0
    return ovsrec_controller_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_controller, uuid));
8197
0
}
8198
8199
/* Searches table "Controller" for a row with UUID 'uuid'.  Returns
8200
 * a pointer to the row if there is one, otherwise a null pointer.  */
8201
const struct ovsrec_controller *
8202
ovsrec_controller_table_get_for_uuid(const struct ovsrec_controller_table *table, const struct uuid *uuid)
8203
0
{
8204
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
8205
0
    return ovsrec_controller_get_for_uuid(idl, uuid);
8206
0
}
8207
8208
/* Returns a row in table "Controller" in 'idl', or a null pointer if that
8209
 * table is empty.
8210
 *
8211
 * Database tables are internally maintained as hash tables, so adding or
8212
 * removing rows while traversing the same table can cause some rows to be
8213
 * visited twice or not at apply. */
8214
const struct ovsrec_controller *
8215
ovsrec_controller_first(const struct ovsdb_idl *idl)
8216
0
{
8217
0
    return ovsrec_controller_cast(ovsdb_idl_first_row(idl, &ovsrec_table_controller));
8218
0
}
8219
8220
/* Returns a row following 'row' within its table, or a null pointer if 'row'
8221
 * is the last row in its table. */
8222
const struct ovsrec_controller *
8223
ovsrec_controller_next(const struct ovsrec_controller *row)
8224
0
{
8225
0
    return ovsrec_controller_cast(ovsdb_idl_next_row(&row->header_));
8226
0
}
8227
8228
unsigned int ovsrec_controller_get_seqno(const struct ovsdb_idl *idl)
8229
0
{
8230
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_controller);
8231
0
}
8232
8233
unsigned int ovsrec_controller_row_get_seqno(const struct ovsrec_controller *row, enum ovsdb_idl_change change)
8234
0
{
8235
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
8236
0
}
8237
8238
const struct ovsrec_controller *
8239
ovsrec_controller_track_get_first(const struct ovsdb_idl *idl)
8240
0
{
8241
0
    return ovsrec_controller_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_controller));
8242
0
}
8243
8244
const struct ovsrec_controller
8245
*ovsrec_controller_track_get_next(const struct ovsrec_controller *row)
8246
0
{
8247
0
    return ovsrec_controller_cast(ovsdb_idl_track_get_next(&row->header_));
8248
0
}
8249
8250
8251
/* Deletes 'row' from table "Controller".  'row' may be freed, so it must not be
8252
 * accessed afterward.
8253
 *
8254
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8255
void
8256
ovsrec_controller_delete(const struct ovsrec_controller *row)
8257
0
{
8258
0
    ovsdb_idl_txn_delete(&row->header_);
8259
0
}
8260
8261
/* Inserts and returns a new row in the table "Controller" in the database
8262
 * with open transaction 'txn'.
8263
 *
8264
 * The new row is assigned a randomly generated provisional UUID.
8265
 * ovsdb-server will assign a different UUID when 'txn' is committed,
8266
 * but the IDL will replace any uses of the provisional UUID in the
8267
 * data to be to be committed by the UUID assigned by ovsdb-server. */
8268
struct ovsrec_controller *
8269
ovsrec_controller_insert(struct ovsdb_idl_txn *txn)
8270
0
{
8271
0
    return ovsrec_controller_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_controller, NULL));
8272
0
}
8273
8274
/* Inserts and returns a new row in the table "Controller" in the database
8275
 * with open transaction 'txn'.
8276
 *
8277
 * The new row is assigned the UUID specified in the 'uuid' parameter
8278
 * (which cannot be null).  ovsdb-server will try to assign the same
8279
 * UUID when 'txn' is committed. */
8280
struct ovsrec_controller *
8281
ovsrec_controller_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
8282
0
{
8283
0
    return ovsrec_controller_cast(ovsdb_idl_txn_insert_persist_uuid(
8284
0
        txn, &ovsrec_table_controller, uuid));
8285
0
}
8286
8287
bool
8288
ovsrec_controller_is_updated(const struct ovsrec_controller *row, enum ovsrec_controller_column_id column)
8289
0
{
8290
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_controller_columns[column]);
8291
0
}
8292
8293
/* Causes the original contents of column "connection_mode" in 'row' to be
8294
 * verified as a prerequisite to completing the transaction.  That is, if
8295
 * "connection_mode" in 'row' changed (or if 'row' was deleted) between the
8296
 * time that the IDL originally read its contents and the time that the
8297
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8298
 *
8299
 * The intention is that, to ensure that no transaction commits based on dirty
8300
 * reads, an application should call this function any time "connection_mode" is
8301
 * read as part of a read-modify-write operation.
8302
 *
8303
 * In some cases this function reduces to a no-op, because the current value
8304
 * of "connection_mode" is already known:
8305
 *
8306
 *   - If 'row' is a row created by the current transaction (returned by
8307
 *     ovsrec_controller_insert()).
8308
 *
8309
 *   - If "connection_mode" has already been modified (with
8310
 *     ovsrec_controller_set_connection_mode()) within the current transaction.
8311
 *
8312
 * Because of the latter property, always call this function *before*
8313
 * ovsrec_controller_set_connection_mode() for a given read-modify-write.
8314
 *
8315
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8316
void
8317
ovsrec_controller_verify_connection_mode(const struct ovsrec_controller *row)
8318
0
{
8319
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_connection_mode);
8320
0
}
8321
8322
/* Causes the original contents of column "controller_burst_limit" in 'row' to be
8323
 * verified as a prerequisite to completing the transaction.  That is, if
8324
 * "controller_burst_limit" in 'row' changed (or if 'row' was deleted) between the
8325
 * time that the IDL originally read its contents and the time that the
8326
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8327
 *
8328
 * The intention is that, to ensure that no transaction commits based on dirty
8329
 * reads, an application should call this function any time "controller_burst_limit" is
8330
 * read as part of a read-modify-write operation.
8331
 *
8332
 * In some cases this function reduces to a no-op, because the current value
8333
 * of "controller_burst_limit" is already known:
8334
 *
8335
 *   - If 'row' is a row created by the current transaction (returned by
8336
 *     ovsrec_controller_insert()).
8337
 *
8338
 *   - If "controller_burst_limit" has already been modified (with
8339
 *     ovsrec_controller_set_controller_burst_limit()) within the current transaction.
8340
 *
8341
 * Because of the latter property, always call this function *before*
8342
 * ovsrec_controller_set_controller_burst_limit() for a given read-modify-write.
8343
 *
8344
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8345
void
8346
ovsrec_controller_verify_controller_burst_limit(const struct ovsrec_controller *row)
8347
0
{
8348
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_controller_burst_limit);
8349
0
}
8350
8351
/* Causes the original contents of column "controller_queue_size" in 'row' to be
8352
 * verified as a prerequisite to completing the transaction.  That is, if
8353
 * "controller_queue_size" in 'row' changed (or if 'row' was deleted) between the
8354
 * time that the IDL originally read its contents and the time that the
8355
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8356
 *
8357
 * The intention is that, to ensure that no transaction commits based on dirty
8358
 * reads, an application should call this function any time "controller_queue_size" is
8359
 * read as part of a read-modify-write operation.
8360
 *
8361
 * In some cases this function reduces to a no-op, because the current value
8362
 * of "controller_queue_size" is already known:
8363
 *
8364
 *   - If 'row' is a row created by the current transaction (returned by
8365
 *     ovsrec_controller_insert()).
8366
 *
8367
 *   - If "controller_queue_size" has already been modified (with
8368
 *     ovsrec_controller_set_controller_queue_size()) within the current transaction.
8369
 *
8370
 * Because of the latter property, always call this function *before*
8371
 * ovsrec_controller_set_controller_queue_size() for a given read-modify-write.
8372
 *
8373
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8374
void
8375
ovsrec_controller_verify_controller_queue_size(const struct ovsrec_controller *row)
8376
0
{
8377
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_controller_queue_size);
8378
0
}
8379
8380
/* Causes the original contents of column "controller_rate_limit" in 'row' to be
8381
 * verified as a prerequisite to completing the transaction.  That is, if
8382
 * "controller_rate_limit" in 'row' changed (or if 'row' was deleted) between the
8383
 * time that the IDL originally read its contents and the time that the
8384
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8385
 *
8386
 * The intention is that, to ensure that no transaction commits based on dirty
8387
 * reads, an application should call this function any time "controller_rate_limit" is
8388
 * read as part of a read-modify-write operation.
8389
 *
8390
 * In some cases this function reduces to a no-op, because the current value
8391
 * of "controller_rate_limit" is already known:
8392
 *
8393
 *   - If 'row' is a row created by the current transaction (returned by
8394
 *     ovsrec_controller_insert()).
8395
 *
8396
 *   - If "controller_rate_limit" has already been modified (with
8397
 *     ovsrec_controller_set_controller_rate_limit()) within the current transaction.
8398
 *
8399
 * Because of the latter property, always call this function *before*
8400
 * ovsrec_controller_set_controller_rate_limit() for a given read-modify-write.
8401
 *
8402
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8403
void
8404
ovsrec_controller_verify_controller_rate_limit(const struct ovsrec_controller *row)
8405
0
{
8406
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_controller_rate_limit);
8407
0
}
8408
8409
/* Causes the original contents of column "enable_async_messages" in 'row' to be
8410
 * verified as a prerequisite to completing the transaction.  That is, if
8411
 * "enable_async_messages" in 'row' changed (or if 'row' was deleted) between the
8412
 * time that the IDL originally read its contents and the time that the
8413
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8414
 *
8415
 * The intention is that, to ensure that no transaction commits based on dirty
8416
 * reads, an application should call this function any time "enable_async_messages" is
8417
 * read as part of a read-modify-write operation.
8418
 *
8419
 * In some cases this function reduces to a no-op, because the current value
8420
 * of "enable_async_messages" is already known:
8421
 *
8422
 *   - If 'row' is a row created by the current transaction (returned by
8423
 *     ovsrec_controller_insert()).
8424
 *
8425
 *   - If "enable_async_messages" has already been modified (with
8426
 *     ovsrec_controller_set_enable_async_messages()) within the current transaction.
8427
 *
8428
 * Because of the latter property, always call this function *before*
8429
 * ovsrec_controller_set_enable_async_messages() for a given read-modify-write.
8430
 *
8431
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8432
void
8433
ovsrec_controller_verify_enable_async_messages(const struct ovsrec_controller *row)
8434
0
{
8435
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_enable_async_messages);
8436
0
}
8437
8438
/* Causes the original contents of column "external_ids" in 'row' to be
8439
 * verified as a prerequisite to completing the transaction.  That is, if
8440
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
8441
 * time that the IDL originally read its contents and the time that the
8442
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8443
 *
8444
 * The intention is that, to ensure that no transaction commits based on dirty
8445
 * reads, an application should call this function any time "external_ids" is
8446
 * read as part of a read-modify-write operation.
8447
 *
8448
 * In some cases this function reduces to a no-op, because the current value
8449
 * of "external_ids" is already known:
8450
 *
8451
 *   - If 'row' is a row created by the current transaction (returned by
8452
 *     ovsrec_controller_insert()).
8453
 *
8454
 *   - If "external_ids" has already been modified (with
8455
 *     ovsrec_controller_set_external_ids()) within the current transaction.
8456
 *
8457
 * Because of the latter property, always call this function *before*
8458
 * ovsrec_controller_set_external_ids() for a given read-modify-write.
8459
 *
8460
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8461
void
8462
ovsrec_controller_verify_external_ids(const struct ovsrec_controller *row)
8463
0
{
8464
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_external_ids);
8465
0
}
8466
8467
/* Causes the original contents of column "inactivity_probe" in 'row' to be
8468
 * verified as a prerequisite to completing the transaction.  That is, if
8469
 * "inactivity_probe" in 'row' changed (or if 'row' was deleted) between the
8470
 * time that the IDL originally read its contents and the time that the
8471
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8472
 *
8473
 * The intention is that, to ensure that no transaction commits based on dirty
8474
 * reads, an application should call this function any time "inactivity_probe" is
8475
 * read as part of a read-modify-write operation.
8476
 *
8477
 * In some cases this function reduces to a no-op, because the current value
8478
 * of "inactivity_probe" is already known:
8479
 *
8480
 *   - If 'row' is a row created by the current transaction (returned by
8481
 *     ovsrec_controller_insert()).
8482
 *
8483
 *   - If "inactivity_probe" has already been modified (with
8484
 *     ovsrec_controller_set_inactivity_probe()) within the current transaction.
8485
 *
8486
 * Because of the latter property, always call this function *before*
8487
 * ovsrec_controller_set_inactivity_probe() for a given read-modify-write.
8488
 *
8489
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8490
void
8491
ovsrec_controller_verify_inactivity_probe(const struct ovsrec_controller *row)
8492
0
{
8493
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_inactivity_probe);
8494
0
}
8495
8496
/* Causes the original contents of column "is_connected" in 'row' to be
8497
 * verified as a prerequisite to completing the transaction.  That is, if
8498
 * "is_connected" in 'row' changed (or if 'row' was deleted) between the
8499
 * time that the IDL originally read its contents and the time that the
8500
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8501
 *
8502
 * The intention is that, to ensure that no transaction commits based on dirty
8503
 * reads, an application should call this function any time "is_connected" is
8504
 * read as part of a read-modify-write operation.
8505
 *
8506
 * In some cases this function reduces to a no-op, because the current value
8507
 * of "is_connected" is already known:
8508
 *
8509
 *   - If 'row' is a row created by the current transaction (returned by
8510
 *     ovsrec_controller_insert()).
8511
 *
8512
 *   - If "is_connected" has already been modified (with
8513
 *     ovsrec_controller_set_is_connected()) within the current transaction.
8514
 *
8515
 * Because of the latter property, always call this function *before*
8516
 * ovsrec_controller_set_is_connected() for a given read-modify-write.
8517
 *
8518
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8519
void
8520
ovsrec_controller_verify_is_connected(const struct ovsrec_controller *row)
8521
0
{
8522
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_is_connected);
8523
0
}
8524
8525
/* Causes the original contents of column "local_gateway" in 'row' to be
8526
 * verified as a prerequisite to completing the transaction.  That is, if
8527
 * "local_gateway" in 'row' changed (or if 'row' was deleted) between the
8528
 * time that the IDL originally read its contents and the time that the
8529
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8530
 *
8531
 * The intention is that, to ensure that no transaction commits based on dirty
8532
 * reads, an application should call this function any time "local_gateway" is
8533
 * read as part of a read-modify-write operation.
8534
 *
8535
 * In some cases this function reduces to a no-op, because the current value
8536
 * of "local_gateway" is already known:
8537
 *
8538
 *   - If 'row' is a row created by the current transaction (returned by
8539
 *     ovsrec_controller_insert()).
8540
 *
8541
 *   - If "local_gateway" has already been modified (with
8542
 *     ovsrec_controller_set_local_gateway()) within the current transaction.
8543
 *
8544
 * Because of the latter property, always call this function *before*
8545
 * ovsrec_controller_set_local_gateway() for a given read-modify-write.
8546
 *
8547
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8548
void
8549
ovsrec_controller_verify_local_gateway(const struct ovsrec_controller *row)
8550
0
{
8551
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_local_gateway);
8552
0
}
8553
8554
/* Causes the original contents of column "local_ip" in 'row' to be
8555
 * verified as a prerequisite to completing the transaction.  That is, if
8556
 * "local_ip" in 'row' changed (or if 'row' was deleted) between the
8557
 * time that the IDL originally read its contents and the time that the
8558
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8559
 *
8560
 * The intention is that, to ensure that no transaction commits based on dirty
8561
 * reads, an application should call this function any time "local_ip" is
8562
 * read as part of a read-modify-write operation.
8563
 *
8564
 * In some cases this function reduces to a no-op, because the current value
8565
 * of "local_ip" is already known:
8566
 *
8567
 *   - If 'row' is a row created by the current transaction (returned by
8568
 *     ovsrec_controller_insert()).
8569
 *
8570
 *   - If "local_ip" has already been modified (with
8571
 *     ovsrec_controller_set_local_ip()) within the current transaction.
8572
 *
8573
 * Because of the latter property, always call this function *before*
8574
 * ovsrec_controller_set_local_ip() for a given read-modify-write.
8575
 *
8576
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8577
void
8578
ovsrec_controller_verify_local_ip(const struct ovsrec_controller *row)
8579
0
{
8580
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_local_ip);
8581
0
}
8582
8583
/* Causes the original contents of column "local_netmask" in 'row' to be
8584
 * verified as a prerequisite to completing the transaction.  That is, if
8585
 * "local_netmask" in 'row' changed (or if 'row' was deleted) between the
8586
 * time that the IDL originally read its contents and the time that the
8587
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8588
 *
8589
 * The intention is that, to ensure that no transaction commits based on dirty
8590
 * reads, an application should call this function any time "local_netmask" is
8591
 * read as part of a read-modify-write operation.
8592
 *
8593
 * In some cases this function reduces to a no-op, because the current value
8594
 * of "local_netmask" is already known:
8595
 *
8596
 *   - If 'row' is a row created by the current transaction (returned by
8597
 *     ovsrec_controller_insert()).
8598
 *
8599
 *   - If "local_netmask" has already been modified (with
8600
 *     ovsrec_controller_set_local_netmask()) within the current transaction.
8601
 *
8602
 * Because of the latter property, always call this function *before*
8603
 * ovsrec_controller_set_local_netmask() for a given read-modify-write.
8604
 *
8605
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8606
void
8607
ovsrec_controller_verify_local_netmask(const struct ovsrec_controller *row)
8608
0
{
8609
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_local_netmask);
8610
0
}
8611
8612
/* Causes the original contents of column "max_backoff" in 'row' to be
8613
 * verified as a prerequisite to completing the transaction.  That is, if
8614
 * "max_backoff" in 'row' changed (or if 'row' was deleted) between the
8615
 * time that the IDL originally read its contents and the time that the
8616
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8617
 *
8618
 * The intention is that, to ensure that no transaction commits based on dirty
8619
 * reads, an application should call this function any time "max_backoff" is
8620
 * read as part of a read-modify-write operation.
8621
 *
8622
 * In some cases this function reduces to a no-op, because the current value
8623
 * of "max_backoff" is already known:
8624
 *
8625
 *   - If 'row' is a row created by the current transaction (returned by
8626
 *     ovsrec_controller_insert()).
8627
 *
8628
 *   - If "max_backoff" has already been modified (with
8629
 *     ovsrec_controller_set_max_backoff()) within the current transaction.
8630
 *
8631
 * Because of the latter property, always call this function *before*
8632
 * ovsrec_controller_set_max_backoff() for a given read-modify-write.
8633
 *
8634
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8635
void
8636
ovsrec_controller_verify_max_backoff(const struct ovsrec_controller *row)
8637
0
{
8638
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_max_backoff);
8639
0
}
8640
8641
/* Causes the original contents of column "other_config" in 'row' to be
8642
 * verified as a prerequisite to completing the transaction.  That is, if
8643
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
8644
 * time that the IDL originally read its contents and the time that the
8645
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8646
 *
8647
 * The intention is that, to ensure that no transaction commits based on dirty
8648
 * reads, an application should call this function any time "other_config" is
8649
 * read as part of a read-modify-write operation.
8650
 *
8651
 * In some cases this function reduces to a no-op, because the current value
8652
 * of "other_config" is already known:
8653
 *
8654
 *   - If 'row' is a row created by the current transaction (returned by
8655
 *     ovsrec_controller_insert()).
8656
 *
8657
 *   - If "other_config" has already been modified (with
8658
 *     ovsrec_controller_set_other_config()) within the current transaction.
8659
 *
8660
 * Because of the latter property, always call this function *before*
8661
 * ovsrec_controller_set_other_config() for a given read-modify-write.
8662
 *
8663
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8664
void
8665
ovsrec_controller_verify_other_config(const struct ovsrec_controller *row)
8666
0
{
8667
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_other_config);
8668
0
}
8669
8670
/* Causes the original contents of column "role" in 'row' to be
8671
 * verified as a prerequisite to completing the transaction.  That is, if
8672
 * "role" in 'row' changed (or if 'row' was deleted) between the
8673
 * time that the IDL originally read its contents and the time that the
8674
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8675
 *
8676
 * The intention is that, to ensure that no transaction commits based on dirty
8677
 * reads, an application should call this function any time "role" is
8678
 * read as part of a read-modify-write operation.
8679
 *
8680
 * In some cases this function reduces to a no-op, because the current value
8681
 * of "role" is already known:
8682
 *
8683
 *   - If 'row' is a row created by the current transaction (returned by
8684
 *     ovsrec_controller_insert()).
8685
 *
8686
 *   - If "role" has already been modified (with
8687
 *     ovsrec_controller_set_role()) within the current transaction.
8688
 *
8689
 * Because of the latter property, always call this function *before*
8690
 * ovsrec_controller_set_role() for a given read-modify-write.
8691
 *
8692
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8693
void
8694
ovsrec_controller_verify_role(const struct ovsrec_controller *row)
8695
0
{
8696
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_role);
8697
0
}
8698
8699
/* Causes the original contents of column "status" in 'row' to be
8700
 * verified as a prerequisite to completing the transaction.  That is, if
8701
 * "status" in 'row' changed (or if 'row' was deleted) between the
8702
 * time that the IDL originally read its contents and the time that the
8703
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8704
 *
8705
 * The intention is that, to ensure that no transaction commits based on dirty
8706
 * reads, an application should call this function any time "status" is
8707
 * read as part of a read-modify-write operation.
8708
 *
8709
 * In some cases this function reduces to a no-op, because the current value
8710
 * of "status" is already known:
8711
 *
8712
 *   - If 'row' is a row created by the current transaction (returned by
8713
 *     ovsrec_controller_insert()).
8714
 *
8715
 *   - If "status" has already been modified (with
8716
 *     ovsrec_controller_set_status()) within the current transaction.
8717
 *
8718
 * Because of the latter property, always call this function *before*
8719
 * ovsrec_controller_set_status() for a given read-modify-write.
8720
 *
8721
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8722
void
8723
ovsrec_controller_verify_status(const struct ovsrec_controller *row)
8724
0
{
8725
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_status);
8726
0
}
8727
8728
/* Causes the original contents of column "target" in 'row' to be
8729
 * verified as a prerequisite to completing the transaction.  That is, if
8730
 * "target" in 'row' changed (or if 'row' was deleted) between the
8731
 * time that the IDL originally read its contents and the time that the
8732
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8733
 *
8734
 * The intention is that, to ensure that no transaction commits based on dirty
8735
 * reads, an application should call this function any time "target" is
8736
 * read as part of a read-modify-write operation.
8737
 *
8738
 * In some cases this function reduces to a no-op, because the current value
8739
 * of "target" is already known:
8740
 *
8741
 *   - If 'row' is a row created by the current transaction (returned by
8742
 *     ovsrec_controller_insert()).
8743
 *
8744
 *   - If "target" has already been modified (with
8745
 *     ovsrec_controller_set_target()) within the current transaction.
8746
 *
8747
 * Because of the latter property, always call this function *before*
8748
 * ovsrec_controller_set_target() for a given read-modify-write.
8749
 *
8750
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8751
void
8752
ovsrec_controller_verify_target(const struct ovsrec_controller *row)
8753
0
{
8754
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_target);
8755
0
}
8756
8757
/* Causes the original contents of column "type" in 'row' to be
8758
 * verified as a prerequisite to completing the transaction.  That is, if
8759
 * "type" in 'row' changed (or if 'row' was deleted) between the
8760
 * time that the IDL originally read its contents and the time that the
8761
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8762
 *
8763
 * The intention is that, to ensure that no transaction commits based on dirty
8764
 * reads, an application should call this function any time "type" is
8765
 * read as part of a read-modify-write operation.
8766
 *
8767
 * In some cases this function reduces to a no-op, because the current value
8768
 * of "type" is already known:
8769
 *
8770
 *   - If 'row' is a row created by the current transaction (returned by
8771
 *     ovsrec_controller_insert()).
8772
 *
8773
 *   - If "type" has already been modified (with
8774
 *     ovsrec_controller_set_type()) within the current transaction.
8775
 *
8776
 * Because of the latter property, always call this function *before*
8777
 * ovsrec_controller_set_type() for a given read-modify-write.
8778
 *
8779
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8780
void
8781
ovsrec_controller_verify_type(const struct ovsrec_controller *row)
8782
0
{
8783
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_type);
8784
0
}
8785
8786
/* Returns the "connection_mode" column's value from the "Controller" table in 'row'
8787
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8788
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8789
 * for a given key than implementing the same operation on the "cooked"
8790
 * form in 'row'.
8791
 *
8792
 * 'key_type' must be OVSDB_TYPE_STRING.
8793
 * (This helps to avoid silent bugs if someone changes connection_mode's
8794
 * type without updating the caller.)
8795
 *
8796
 * The caller must not modify or free the returned value.
8797
 *
8798
 * Various kinds of changes can invalidate the returned value: modifying
8799
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8800
 * If the returned value is needed for a long time, it is best to make a copy
8801
 * of it with ovsdb_datum_clone().
8802
 *
8803
 * This function is rarely useful, since it is easier to access the value
8804
 * directly through the "connection_mode" member in ovsrec_controller. */
8805
const struct ovsdb_datum *
8806
ovsrec_controller_get_connection_mode(const struct ovsrec_controller *row,
8807
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8808
0
{
8809
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8810
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_connection_mode);
8811
0
}
8812
8813
/* Returns the "controller_burst_limit" column's value from the "Controller" table in 'row'
8814
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8815
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8816
 * for a given key than implementing the same operation on the "cooked"
8817
 * form in 'row'.
8818
 *
8819
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8820
 * (This helps to avoid silent bugs if someone changes controller_burst_limit's
8821
 * type without updating the caller.)
8822
 *
8823
 * The caller must not modify or free the returned value.
8824
 *
8825
 * Various kinds of changes can invalidate the returned value: modifying
8826
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8827
 * If the returned value is needed for a long time, it is best to make a copy
8828
 * of it with ovsdb_datum_clone().
8829
 *
8830
 * This function is rarely useful, since it is easier to access the value
8831
 * directly through the "controller_burst_limit" member in ovsrec_controller. */
8832
const struct ovsdb_datum *
8833
ovsrec_controller_get_controller_burst_limit(const struct ovsrec_controller *row,
8834
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8835
0
{
8836
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8837
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_controller_burst_limit);
8838
0
}
8839
8840
/* Returns the "controller_queue_size" column's value from the "Controller" table in 'row'
8841
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8842
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8843
 * for a given key than implementing the same operation on the "cooked"
8844
 * form in 'row'.
8845
 *
8846
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8847
 * (This helps to avoid silent bugs if someone changes controller_queue_size's
8848
 * type without updating the caller.)
8849
 *
8850
 * The caller must not modify or free the returned value.
8851
 *
8852
 * Various kinds of changes can invalidate the returned value: modifying
8853
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8854
 * If the returned value is needed for a long time, it is best to make a copy
8855
 * of it with ovsdb_datum_clone().
8856
 *
8857
 * This function is rarely useful, since it is easier to access the value
8858
 * directly through the "controller_queue_size" member in ovsrec_controller. */
8859
const struct ovsdb_datum *
8860
ovsrec_controller_get_controller_queue_size(const struct ovsrec_controller *row,
8861
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8862
0
{
8863
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8864
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_controller_queue_size);
8865
0
}
8866
8867
/* Returns the "controller_rate_limit" column's value from the "Controller" table in 'row'
8868
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8869
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8870
 * for a given key than implementing the same operation on the "cooked"
8871
 * form in 'row'.
8872
 *
8873
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8874
 * (This helps to avoid silent bugs if someone changes controller_rate_limit's
8875
 * type without updating the caller.)
8876
 *
8877
 * The caller must not modify or free the returned value.
8878
 *
8879
 * Various kinds of changes can invalidate the returned value: modifying
8880
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8881
 * If the returned value is needed for a long time, it is best to make a copy
8882
 * of it with ovsdb_datum_clone().
8883
 *
8884
 * This function is rarely useful, since it is easier to access the value
8885
 * directly through the "controller_rate_limit" member in ovsrec_controller. */
8886
const struct ovsdb_datum *
8887
ovsrec_controller_get_controller_rate_limit(const struct ovsrec_controller *row,
8888
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8889
0
{
8890
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8891
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_controller_rate_limit);
8892
0
}
8893
8894
/* Returns the "enable_async_messages" column's value from the "Controller" table in 'row'
8895
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8896
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8897
 * for a given key than implementing the same operation on the "cooked"
8898
 * form in 'row'.
8899
 *
8900
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
8901
 * (This helps to avoid silent bugs if someone changes enable_async_messages's
8902
 * type without updating the caller.)
8903
 *
8904
 * The caller must not modify or free the returned value.
8905
 *
8906
 * Various kinds of changes can invalidate the returned value: modifying
8907
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8908
 * If the returned value is needed for a long time, it is best to make a copy
8909
 * of it with ovsdb_datum_clone().
8910
 *
8911
 * This function is rarely useful, since it is easier to access the value
8912
 * directly through the "enable_async_messages" member in ovsrec_controller. */
8913
const struct ovsdb_datum *
8914
ovsrec_controller_get_enable_async_messages(const struct ovsrec_controller *row,
8915
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8916
0
{
8917
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
8918
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_enable_async_messages);
8919
0
}
8920
8921
/* Returns the "external_ids" column's value from the "Controller" table in 'row'
8922
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8923
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8924
 * for a given key than implementing the same operation on the "cooked"
8925
 * form in 'row'.
8926
 *
8927
 * 'key_type' must be OVSDB_TYPE_STRING.
8928
 * 'value_type' must be OVSDB_TYPE_STRING.
8929
 * (This helps to avoid silent bugs if someone changes external_ids's
8930
 * type without updating the caller.)
8931
 *
8932
 * The caller must not modify or free the returned value.
8933
 *
8934
 * Various kinds of changes can invalidate the returned value: modifying
8935
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8936
 * If the returned value is needed for a long time, it is best to make a copy
8937
 * of it with ovsdb_datum_clone().
8938
 *
8939
 * This function is rarely useful, since it is easier to access the value
8940
 * directly through the "external_ids" member in ovsrec_controller. */
8941
const struct ovsdb_datum *
8942
ovsrec_controller_get_external_ids(const struct ovsrec_controller *row,
8943
  enum ovsdb_atomic_type key_type OVS_UNUSED,
8944
  enum ovsdb_atomic_type value_type OVS_UNUSED)
8945
0
{
8946
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8947
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
8948
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_external_ids);
8949
0
}
8950
8951
/* Returns the "inactivity_probe" column's value from the "Controller" table in 'row'
8952
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8953
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8954
 * for a given key than implementing the same operation on the "cooked"
8955
 * form in 'row'.
8956
 *
8957
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8958
 * (This helps to avoid silent bugs if someone changes inactivity_probe's
8959
 * type without updating the caller.)
8960
 *
8961
 * The caller must not modify or free the returned value.
8962
 *
8963
 * Various kinds of changes can invalidate the returned value: modifying
8964
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8965
 * If the returned value is needed for a long time, it is best to make a copy
8966
 * of it with ovsdb_datum_clone().
8967
 *
8968
 * This function is rarely useful, since it is easier to access the value
8969
 * directly through the "inactivity_probe" member in ovsrec_controller. */
8970
const struct ovsdb_datum *
8971
ovsrec_controller_get_inactivity_probe(const struct ovsrec_controller *row,
8972
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8973
0
{
8974
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8975
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_inactivity_probe);
8976
0
}
8977
8978
/* Returns the "is_connected" column's value from the "Controller" table in 'row'
8979
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8980
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8981
 * for a given key than implementing the same operation on the "cooked"
8982
 * form in 'row'.
8983
 *
8984
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
8985
 * (This helps to avoid silent bugs if someone changes is_connected's
8986
 * type without updating the caller.)
8987
 *
8988
 * The caller must not modify or free the returned value.
8989
 *
8990
 * Various kinds of changes can invalidate the returned value: modifying
8991
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8992
 * If the returned value is needed for a long time, it is best to make a copy
8993
 * of it with ovsdb_datum_clone().
8994
 *
8995
 * This function is rarely useful, since it is easier to access the value
8996
 * directly through the "is_connected" member in ovsrec_controller. */
8997
const struct ovsdb_datum *
8998
ovsrec_controller_get_is_connected(const struct ovsrec_controller *row,
8999
  enum ovsdb_atomic_type key_type OVS_UNUSED)
9000
0
{
9001
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
9002
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_is_connected);
9003
0
}
9004
9005
/* Returns the "local_gateway" column's value from the "Controller" table in 'row'
9006
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
9007
 * ovsdb_datum_find_key() is an easier and more efficient way to search
9008
 * for a given key than implementing the same operation on the "cooked"
9009
 * form in 'row'.
9010
 *
9011
 * 'key_type' must be OVSDB_TYPE_STRING.
9012
 * (This helps to avoid silent bugs if someone changes local_gateway's
9013
 * type without updating the caller.)
9014
 *
9015
 * The caller must not modify or free the returned value.
9016
 *
9017
 * Various kinds of changes can invalidate the returned value: modifying
9018
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9019
 * If the returned value is needed for a long time, it is best to make a copy
9020
 * of it with ovsdb_datum_clone().
9021
 *
9022
 * This function is rarely useful, since it is easier to access the value
9023
 * directly through the "local_gateway" member in ovsrec_controller. */
9024
const struct ovsdb_datum *
9025
ovsrec_controller_get_local_gateway(const struct ovsrec_controller *row,
9026
  enum ovsdb_atomic_type key_type OVS_UNUSED)
9027
0
{
9028
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
9029
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_gateway);
9030
0
}
9031
9032
/* Returns the "local_ip" column's value from the "Controller" table in 'row'
9033
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
9034
 * ovsdb_datum_find_key() is an easier and more efficient way to search
9035
 * for a given key than implementing the same operation on the "cooked"
9036
 * form in 'row'.
9037
 *
9038
 * 'key_type' must be OVSDB_TYPE_STRING.
9039
 * (This helps to avoid silent bugs if someone changes local_ip's
9040
 * type without updating the caller.)
9041
 *
9042
 * The caller must not modify or free the returned value.
9043
 *
9044
 * Various kinds of changes can invalidate the returned value: modifying
9045
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9046
 * If the returned value is needed for a long time, it is best to make a copy
9047
 * of it with ovsdb_datum_clone().
9048
 *
9049
 * This function is rarely useful, since it is easier to access the value
9050
 * directly through the "local_ip" member in ovsrec_controller. */
9051
const struct ovsdb_datum *
9052
ovsrec_controller_get_local_ip(const struct ovsrec_controller *row,
9053
  enum ovsdb_atomic_type key_type OVS_UNUSED)
9054
0
{
9055
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
9056
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_ip);
9057
0
}
9058
9059
/* Returns the "local_netmask" column's value from the "Controller" table in 'row'
9060
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
9061
 * ovsdb_datum_find_key() is an easier and more efficient way to search
9062
 * for a given key than implementing the same operation on the "cooked"
9063
 * form in 'row'.
9064
 *
9065
 * 'key_type' must be OVSDB_TYPE_STRING.
9066
 * (This helps to avoid silent bugs if someone changes local_netmask's
9067
 * type without updating the caller.)
9068
 *
9069
 * The caller must not modify or free the returned value.
9070
 *
9071
 * Various kinds of changes can invalidate the returned value: modifying
9072
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9073
 * If the returned value is needed for a long time, it is best to make a copy
9074
 * of it with ovsdb_datum_clone().
9075
 *
9076
 * This function is rarely useful, since it is easier to access the value
9077
 * directly through the "local_netmask" member in ovsrec_controller. */
9078
const struct ovsdb_datum *
9079
ovsrec_controller_get_local_netmask(const struct ovsrec_controller *row,
9080
  enum ovsdb_atomic_type key_type OVS_UNUSED)
9081
0
{
9082
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
9083
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_netmask);
9084
0
}
9085
9086
/* Returns the "max_backoff" column's value from the "Controller" table in 'row'
9087
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
9088
 * ovsdb_datum_find_key() is an easier and more efficient way to search
9089
 * for a given key than implementing the same operation on the "cooked"
9090
 * form in 'row'.
9091
 *
9092
 * 'key_type' must be OVSDB_TYPE_INTEGER.
9093
 * (This helps to avoid silent bugs if someone changes max_backoff's
9094
 * type without updating the caller.)
9095
 *
9096
 * The caller must not modify or free the returned value.
9097
 *
9098
 * Various kinds of changes can invalidate the returned value: modifying
9099
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9100
 * If the returned value is needed for a long time, it is best to make a copy
9101
 * of it with ovsdb_datum_clone().
9102
 *
9103
 * This function is rarely useful, since it is easier to access the value
9104
 * directly through the "max_backoff" member in ovsrec_controller. */
9105
const struct ovsdb_datum *
9106
ovsrec_controller_get_max_backoff(const struct ovsrec_controller *row,
9107
  enum ovsdb_atomic_type key_type OVS_UNUSED)
9108
0
{
9109
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
9110
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_max_backoff);
9111
0
}
9112
9113
/* Returns the "other_config" column's value from the "Controller" table in 'row'
9114
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
9115
 * ovsdb_datum_find_key() is an easier and more efficient way to search
9116
 * for a given key than implementing the same operation on the "cooked"
9117
 * form in 'row'.
9118
 *
9119
 * 'key_type' must be OVSDB_TYPE_STRING.
9120
 * 'value_type' must be OVSDB_TYPE_STRING.
9121
 * (This helps to avoid silent bugs if someone changes other_config's
9122
 * type without updating the caller.)
9123
 *
9124
 * The caller must not modify or free the returned value.
9125
 *
9126
 * Various kinds of changes can invalidate the returned value: modifying
9127
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9128
 * If the returned value is needed for a long time, it is best to make a copy
9129
 * of it with ovsdb_datum_clone().
9130
 *
9131
 * This function is rarely useful, since it is easier to access the value
9132
 * directly through the "other_config" member in ovsrec_controller. */
9133
const struct ovsdb_datum *
9134
ovsrec_controller_get_other_config(const struct ovsrec_controller *row,
9135
  enum ovsdb_atomic_type key_type OVS_UNUSED,
9136
  enum ovsdb_atomic_type value_type OVS_UNUSED)
9137
0
{
9138
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
9139
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
9140
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_other_config);
9141
0
}
9142
9143
/* Returns the "role" column's value from the "Controller" table in 'row'
9144
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
9145
 * ovsdb_datum_find_key() is an easier and more efficient way to search
9146
 * for a given key than implementing the same operation on the "cooked"
9147
 * form in 'row'.
9148
 *
9149
 * 'key_type' must be OVSDB_TYPE_STRING.
9150
 * (This helps to avoid silent bugs if someone changes role's
9151
 * type without updating the caller.)
9152
 *
9153
 * The caller must not modify or free the returned value.
9154
 *
9155
 * Various kinds of changes can invalidate the returned value: modifying
9156
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9157
 * If the returned value is needed for a long time, it is best to make a copy
9158
 * of it with ovsdb_datum_clone().
9159
 *
9160
 * This function is rarely useful, since it is easier to access the value
9161
 * directly through the "role" member in ovsrec_controller. */
9162
const struct ovsdb_datum *
9163
ovsrec_controller_get_role(const struct ovsrec_controller *row,
9164
  enum ovsdb_atomic_type key_type OVS_UNUSED)
9165
0
{
9166
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
9167
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_role);
9168
0
}
9169
9170
/* Returns the "status" column's value from the "Controller" table in 'row'
9171
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
9172
 * ovsdb_datum_find_key() is an easier and more efficient way to search
9173
 * for a given key than implementing the same operation on the "cooked"
9174
 * form in 'row'.
9175
 *
9176
 * 'key_type' must be OVSDB_TYPE_STRING.
9177
 * 'value_type' must be OVSDB_TYPE_STRING.
9178
 * (This helps to avoid silent bugs if someone changes status's
9179
 * type without updating the caller.)
9180
 *
9181
 * The caller must not modify or free the returned value.
9182
 *
9183
 * Various kinds of changes can invalidate the returned value: modifying
9184
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9185
 * If the returned value is needed for a long time, it is best to make a copy
9186
 * of it with ovsdb_datum_clone().
9187
 *
9188
 * This function is rarely useful, since it is easier to access the value
9189
 * directly through the "status" member in ovsrec_controller. */
9190
const struct ovsdb_datum *
9191
ovsrec_controller_get_status(const struct ovsrec_controller *row,
9192
  enum ovsdb_atomic_type key_type OVS_UNUSED,
9193
  enum ovsdb_atomic_type value_type OVS_UNUSED)
9194
0
{
9195
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
9196
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
9197
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_status);
9198
0
}
9199
9200
/* Returns the "target" column's value from the "Controller" table in 'row'
9201
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
9202
 * ovsdb_datum_find_key() is an easier and more efficient way to search
9203
 * for a given key than implementing the same operation on the "cooked"
9204
 * form in 'row'.
9205
 *
9206
 * 'key_type' must be OVSDB_TYPE_STRING.
9207
 * (This helps to avoid silent bugs if someone changes target's
9208
 * type without updating the caller.)
9209
 *
9210
 * The caller must not modify or free the returned value.
9211
 *
9212
 * Various kinds of changes can invalidate the returned value: modifying
9213
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9214
 * If the returned value is needed for a long time, it is best to make a copy
9215
 * of it with ovsdb_datum_clone().
9216
 *
9217
 * This function is rarely useful, since it is easier to access the value
9218
 * directly through the "target" member in ovsrec_controller. */
9219
const struct ovsdb_datum *
9220
ovsrec_controller_get_target(const struct ovsrec_controller *row,
9221
  enum ovsdb_atomic_type key_type OVS_UNUSED)
9222
0
{
9223
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
9224
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_target);
9225
0
}
9226
9227
/* Returns the "type" column's value from the "Controller" table in 'row'
9228
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
9229
 * ovsdb_datum_find_key() is an easier and more efficient way to search
9230
 * for a given key than implementing the same operation on the "cooked"
9231
 * form in 'row'.
9232
 *
9233
 * 'key_type' must be OVSDB_TYPE_STRING.
9234
 * (This helps to avoid silent bugs if someone changes type's
9235
 * type without updating the caller.)
9236
 *
9237
 * The caller must not modify or free the returned value.
9238
 *
9239
 * Various kinds of changes can invalidate the returned value: modifying
9240
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9241
 * If the returned value is needed for a long time, it is best to make a copy
9242
 * of it with ovsdb_datum_clone().
9243
 *
9244
 * This function is rarely useful, since it is easier to access the value
9245
 * directly through the "type" member in ovsrec_controller. */
9246
const struct ovsdb_datum *
9247
ovsrec_controller_get_type(const struct ovsrec_controller *row,
9248
  enum ovsdb_atomic_type key_type OVS_UNUSED)
9249
0
{
9250
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
9251
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_type);
9252
0
}
9253
9254
/* Sets the "connection_mode" column from the "Controller" table in 'row' to
9255
 * the 'connection_mode' set.
9256
 *
9257
 * If "connection_mode" is null, the column will be the empty set,
9258
 * otherwise it will contain the specified value.
9259
 *
9260
 * Argument constraints: either "in-band" or "out-of-band"
9261
 *
9262
 * The caller retains ownership of the arguments. */
9263
void
9264
ovsrec_controller_set_connection_mode(const struct ovsrec_controller *row, const char *connection_mode)
9265
0
{
9266
0
    struct ovsdb_datum datum;
9267
9268
0
    datum.refcnt = NULL;
9269
9270
0
    if (connection_mode) {
9271
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9272
0
        datum.n = 1;
9273
0
        datum.keys = key;
9274
0
        key->s = ovsdb_atom_string_create(connection_mode);
9275
0
    } else {
9276
0
        datum.n = 0;
9277
0
        datum.keys = NULL;
9278
0
    }
9279
0
    datum.values = NULL;
9280
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_connection_mode, &datum);
9281
0
}
9282
9283
/* Sets the "controller_burst_limit" column from the "Controller" table in 'row' to
9284
 * the 'controller_burst_limit' set with 'n_controller_burst_limit' entries.
9285
 *
9286
 * 'n_controller_burst_limit' may be 0 or 1; if it is 0, then 'controller_burst_limit'
9287
 * may be NULL.
9288
 *
9289
 * Argument constraints: at least 25
9290
 *
9291
 * The caller retains ownership of the arguments. */
9292
void
9293
ovsrec_controller_set_controller_burst_limit(const struct ovsrec_controller *row, const int64_t *controller_burst_limit, size_t n_controller_burst_limit)
9294
0
{
9295
0
    struct ovsdb_datum datum;
9296
9297
0
    datum.refcnt = NULL;
9298
9299
0
    if (n_controller_burst_limit) {
9300
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9301
0
        datum.n = 1;
9302
0
        datum.keys = key;
9303
0
        key->integer = *controller_burst_limit;
9304
0
    } else {
9305
0
        datum.n = 0;
9306
0
        datum.keys = NULL;
9307
0
    }
9308
0
    datum.values = NULL;
9309
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_controller_burst_limit, &datum);
9310
0
}
9311
9312
/* Sets the "controller_queue_size" column from the "Controller" table in 'row' to
9313
 * the 'controller_queue_size' set with 'n_controller_queue_size' entries.
9314
 *
9315
 * 'n_controller_queue_size' may be 0 or 1; if it is 0, then 'controller_queue_size'
9316
 * may be NULL.
9317
 *
9318
 * Argument constraints: in range 1 to 512
9319
 *
9320
 * The caller retains ownership of the arguments. */
9321
void
9322
ovsrec_controller_set_controller_queue_size(const struct ovsrec_controller *row, const int64_t *controller_queue_size, size_t n_controller_queue_size)
9323
0
{
9324
0
    struct ovsdb_datum datum;
9325
9326
0
    datum.refcnt = NULL;
9327
9328
0
    if (n_controller_queue_size) {
9329
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9330
0
        datum.n = 1;
9331
0
        datum.keys = key;
9332
0
        key->integer = *controller_queue_size;
9333
0
    } else {
9334
0
        datum.n = 0;
9335
0
        datum.keys = NULL;
9336
0
    }
9337
0
    datum.values = NULL;
9338
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_controller_queue_size, &datum);
9339
0
}
9340
9341
/* Sets the "controller_rate_limit" column from the "Controller" table in 'row' to
9342
 * the 'controller_rate_limit' set with 'n_controller_rate_limit' entries.
9343
 *
9344
 * 'n_controller_rate_limit' may be 0 or 1; if it is 0, then 'controller_rate_limit'
9345
 * may be NULL.
9346
 *
9347
 * Argument constraints: at least 100
9348
 *
9349
 * The caller retains ownership of the arguments. */
9350
void
9351
ovsrec_controller_set_controller_rate_limit(const struct ovsrec_controller *row, const int64_t *controller_rate_limit, size_t n_controller_rate_limit)
9352
0
{
9353
0
    struct ovsdb_datum datum;
9354
9355
0
    datum.refcnt = NULL;
9356
9357
0
    if (n_controller_rate_limit) {
9358
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9359
0
        datum.n = 1;
9360
0
        datum.keys = key;
9361
0
        key->integer = *controller_rate_limit;
9362
0
    } else {
9363
0
        datum.n = 0;
9364
0
        datum.keys = NULL;
9365
0
    }
9366
0
    datum.values = NULL;
9367
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_controller_rate_limit, &datum);
9368
0
}
9369
9370
/* Sets the "enable_async_messages" column from the "Controller" table in 'row' to
9371
 * the 'enable_async_messages' set with 'n_enable_async_messages' entries.
9372
 *
9373
 * 'n_enable_async_messages' may be 0 or 1; if it is 0, then 'enable_async_messages'
9374
 * may be NULL.
9375
 *
9376
 * The caller retains ownership of the arguments. */
9377
void
9378
ovsrec_controller_set_enable_async_messages(const struct ovsrec_controller *row, const bool *enable_async_messages, size_t n_enable_async_messages)
9379
0
{
9380
0
    struct ovsdb_datum datum;
9381
9382
0
    datum.refcnt = NULL;
9383
9384
0
    if (n_enable_async_messages) {
9385
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9386
0
        datum.n = 1;
9387
0
        datum.keys = key;
9388
0
        key->boolean = *enable_async_messages;
9389
0
    } else {
9390
0
        datum.n = 0;
9391
0
        datum.keys = NULL;
9392
0
    }
9393
0
    datum.values = NULL;
9394
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_enable_async_messages, &datum);
9395
0
}
9396
9397
/* Sets the "external_ids" column's value from the "Controller" table in 'row'
9398
 * to 'external_ids'.
9399
 *
9400
 * The caller retains ownership of 'external_ids' and everything in it. */
9401
void
9402
ovsrec_controller_set_external_ids(const struct ovsrec_controller *row, const struct smap *external_ids)
9403
0
{
9404
0
    struct ovsdb_datum datum;
9405
9406
0
    if (external_ids) {
9407
0
        ovsdb_datum_from_smap(&datum, external_ids);
9408
0
    } else {
9409
0
        ovsdb_datum_init_empty(&datum);
9410
0
    }
9411
0
    ovsdb_idl_txn_write(&row->header_,
9412
0
                        &ovsrec_controller_col_external_ids,
9413
0
                        &datum);
9414
0
}
9415
9416
9417
/* Sets the "inactivity_probe" column from the "Controller" table in 'row' to
9418
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
9419
 *
9420
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
9421
 * may be NULL.
9422
 *
9423
 * The caller retains ownership of the arguments. */
9424
void
9425
ovsrec_controller_set_inactivity_probe(const struct ovsrec_controller *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
9426
0
{
9427
0
    struct ovsdb_datum datum;
9428
9429
0
    datum.refcnt = NULL;
9430
9431
0
    if (n_inactivity_probe) {
9432
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9433
0
        datum.n = 1;
9434
0
        datum.keys = key;
9435
0
        key->integer = *inactivity_probe;
9436
0
    } else {
9437
0
        datum.n = 0;
9438
0
        datum.keys = NULL;
9439
0
    }
9440
0
    datum.values = NULL;
9441
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_inactivity_probe, &datum);
9442
0
}
9443
9444
/* Sets the "is_connected" column from the "Controller" table in 'row' to
9445
 * 'is_connected'.
9446
 *
9447
 * The caller retains ownership of the arguments. */
9448
void
9449
ovsrec_controller_set_is_connected(const struct ovsrec_controller *row, bool is_connected)
9450
0
{
9451
0
    struct ovsdb_datum datum;
9452
9453
0
    datum.refcnt = NULL;
9454
9455
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
9456
9457
0
    datum.n = 1;
9458
0
    datum.keys = key;
9459
0
    key->boolean = is_connected;
9460
0
    datum.values = NULL;
9461
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_is_connected, &datum);
9462
0
}
9463
9464
/* Sets the "local_gateway" column from the "Controller" table in 'row' to
9465
 * the 'local_gateway' set.
9466
 *
9467
 * If "local_gateway" is null, the column will be the empty set,
9468
 * otherwise it will contain the specified value.
9469
 *
9470
 * The caller retains ownership of the arguments. */
9471
void
9472
ovsrec_controller_set_local_gateway(const struct ovsrec_controller *row, const char *local_gateway)
9473
0
{
9474
0
    struct ovsdb_datum datum;
9475
9476
0
    datum.refcnt = NULL;
9477
9478
0
    if (local_gateway) {
9479
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9480
0
        datum.n = 1;
9481
0
        datum.keys = key;
9482
0
        key->s = ovsdb_atom_string_create(local_gateway);
9483
0
    } else {
9484
0
        datum.n = 0;
9485
0
        datum.keys = NULL;
9486
0
    }
9487
0
    datum.values = NULL;
9488
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_local_gateway, &datum);
9489
0
}
9490
9491
/* Sets the "local_ip" column from the "Controller" table in 'row' to
9492
 * the 'local_ip' set.
9493
 *
9494
 * If "local_ip" is null, the column will be the empty set,
9495
 * otherwise it will contain the specified value.
9496
 *
9497
 * The caller retains ownership of the arguments. */
9498
void
9499
ovsrec_controller_set_local_ip(const struct ovsrec_controller *row, const char *local_ip)
9500
0
{
9501
0
    struct ovsdb_datum datum;
9502
9503
0
    datum.refcnt = NULL;
9504
9505
0
    if (local_ip) {
9506
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9507
0
        datum.n = 1;
9508
0
        datum.keys = key;
9509
0
        key->s = ovsdb_atom_string_create(local_ip);
9510
0
    } else {
9511
0
        datum.n = 0;
9512
0
        datum.keys = NULL;
9513
0
    }
9514
0
    datum.values = NULL;
9515
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_local_ip, &datum);
9516
0
}
9517
9518
/* Sets the "local_netmask" column from the "Controller" table in 'row' to
9519
 * the 'local_netmask' set.
9520
 *
9521
 * If "local_netmask" is null, the column will be the empty set,
9522
 * otherwise it will contain the specified value.
9523
 *
9524
 * The caller retains ownership of the arguments. */
9525
void
9526
ovsrec_controller_set_local_netmask(const struct ovsrec_controller *row, const char *local_netmask)
9527
0
{
9528
0
    struct ovsdb_datum datum;
9529
9530
0
    datum.refcnt = NULL;
9531
9532
0
    if (local_netmask) {
9533
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9534
0
        datum.n = 1;
9535
0
        datum.keys = key;
9536
0
        key->s = ovsdb_atom_string_create(local_netmask);
9537
0
    } else {
9538
0
        datum.n = 0;
9539
0
        datum.keys = NULL;
9540
0
    }
9541
0
    datum.values = NULL;
9542
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_local_netmask, &datum);
9543
0
}
9544
9545
/* Sets the "max_backoff" column from the "Controller" table in 'row' to
9546
 * the 'max_backoff' set with 'n_max_backoff' entries.
9547
 *
9548
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
9549
 * may be NULL.
9550
 *
9551
 * Argument constraints: at least 1,000
9552
 *
9553
 * The caller retains ownership of the arguments. */
9554
void
9555
ovsrec_controller_set_max_backoff(const struct ovsrec_controller *row, const int64_t *max_backoff, size_t n_max_backoff)
9556
0
{
9557
0
    struct ovsdb_datum datum;
9558
9559
0
    datum.refcnt = NULL;
9560
9561
0
    if (n_max_backoff) {
9562
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9563
0
        datum.n = 1;
9564
0
        datum.keys = key;
9565
0
        key->integer = *max_backoff;
9566
0
    } else {
9567
0
        datum.n = 0;
9568
0
        datum.keys = NULL;
9569
0
    }
9570
0
    datum.values = NULL;
9571
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_max_backoff, &datum);
9572
0
}
9573
9574
/* Sets the "other_config" column's value from the "Controller" table in 'row'
9575
 * to 'other_config'.
9576
 *
9577
 * The caller retains ownership of 'other_config' and everything in it. */
9578
void
9579
ovsrec_controller_set_other_config(const struct ovsrec_controller *row, const struct smap *other_config)
9580
0
{
9581
0
    struct ovsdb_datum datum;
9582
9583
0
    if (other_config) {
9584
0
        ovsdb_datum_from_smap(&datum, other_config);
9585
0
    } else {
9586
0
        ovsdb_datum_init_empty(&datum);
9587
0
    }
9588
0
    ovsdb_idl_txn_write(&row->header_,
9589
0
                        &ovsrec_controller_col_other_config,
9590
0
                        &datum);
9591
0
}
9592
9593
9594
/* Sets the "role" column from the "Controller" table in 'row' to
9595
 * the 'role' set.
9596
 *
9597
 * If "role" is null, the column will be the empty set,
9598
 * otherwise it will contain the specified value.
9599
 *
9600
 * Argument constraints: one of "master", "other", or "slave"
9601
 *
9602
 * The caller retains ownership of the arguments. */
9603
void
9604
ovsrec_controller_set_role(const struct ovsrec_controller *row, const char *role)
9605
0
{
9606
0
    struct ovsdb_datum datum;
9607
9608
0
    datum.refcnt = NULL;
9609
9610
0
    if (role) {
9611
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9612
0
        datum.n = 1;
9613
0
        datum.keys = key;
9614
0
        key->s = ovsdb_atom_string_create(role);
9615
0
    } else {
9616
0
        datum.n = 0;
9617
0
        datum.keys = NULL;
9618
0
    }
9619
0
    datum.values = NULL;
9620
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_role, &datum);
9621
0
}
9622
9623
/* Sets the "status" column's value from the "Controller" table in 'row'
9624
 * to 'status'.
9625
 *
9626
 * The caller retains ownership of 'status' and everything in it. */
9627
void
9628
ovsrec_controller_set_status(const struct ovsrec_controller *row, const struct smap *status)
9629
0
{
9630
0
    struct ovsdb_datum datum;
9631
9632
0
    if (status) {
9633
0
        ovsdb_datum_from_smap(&datum, status);
9634
0
    } else {
9635
0
        ovsdb_datum_init_empty(&datum);
9636
0
    }
9637
0
    ovsdb_idl_txn_write(&row->header_,
9638
0
                        &ovsrec_controller_col_status,
9639
0
                        &datum);
9640
0
}
9641
9642
9643
/* Sets the "target" column from the "Controller" table in 'row' to
9644
 * 'target'.
9645
 *
9646
 * The caller retains ownership of the arguments. */
9647
void
9648
ovsrec_controller_set_target(const struct ovsrec_controller *row, const char *target)
9649
0
{
9650
0
    struct ovsdb_datum datum;
9651
9652
0
    datum.refcnt = NULL;
9653
9654
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
9655
9656
0
    datum.n = 1;
9657
0
    datum.keys = key;
9658
0
    key->s = ovsdb_atom_string_create(target);
9659
0
    datum.values = NULL;
9660
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_target, &datum);
9661
0
}
9662
9663
/* Sets the "type" column from the "Controller" table in 'row' to
9664
 * the 'type' set.
9665
 *
9666
 * If "type" is null, the column will be the empty set,
9667
 * otherwise it will contain the specified value.
9668
 *
9669
 * Argument constraints: either "primary" or "service"
9670
 *
9671
 * The caller retains ownership of the arguments. */
9672
void
9673
ovsrec_controller_set_type(const struct ovsrec_controller *row, const char *type)
9674
0
{
9675
0
    struct ovsdb_datum datum;
9676
9677
0
    datum.refcnt = NULL;
9678
9679
0
    if (type) {
9680
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9681
0
        datum.n = 1;
9682
0
        datum.keys = key;
9683
0
        key->s = ovsdb_atom_string_create(type);
9684
0
    } else {
9685
0
        datum.n = 0;
9686
0
        datum.keys = NULL;
9687
0
    }
9688
0
    datum.values = NULL;
9689
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_type, &datum);
9690
0
}
9691
9692
/* Adds the value 'new_value' to the "connection_mode" set column from the "Controller" table
9693
 * in 'row'.
9694
 *
9695
 */
9696
void
9697
ovsrec_controller_update_connection_mode_addvalue(const struct ovsrec_controller *row, const char *new_value)
9698
0
{
9699
0
    struct ovsdb_datum *datum;
9700
9701
0
    datum = xmalloc(sizeof *datum);
9702
0
    datum->n = 1;
9703
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9704
0
    datum->values = NULL;
9705
0
    datum->refcnt = NULL;
9706
9707
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
9708
9709
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9710
0
                                    &ovsrec_controller_col_connection_mode,
9711
0
                                    datum);
9712
0
}
9713
9714
/* Deletes the value 'delete_value' from the "connection_mode" set column from the
9715
 * "Controller" table in 'row'.
9716
 *
9717
 */
9718
void
9719
ovsrec_controller_update_connection_mode_delvalue(const struct ovsrec_controller *row, const char *delete_value)
9720
0
{
9721
0
    struct ovsdb_datum *datum;
9722
9723
0
    datum = xmalloc(sizeof *datum);
9724
0
    datum->n = 1;
9725
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9726
0
    datum->values = NULL;
9727
0
    datum->refcnt = NULL;
9728
9729
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
9730
9731
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9732
0
                                    &ovsrec_controller_col_connection_mode,
9733
0
                                    datum);
9734
0
}
9735
9736
/* Adds the value 'new_value' to the "controller_burst_limit" set column from the "Controller" table
9737
 * in 'row'.
9738
 *
9739
 */
9740
void
9741
ovsrec_controller_update_controller_burst_limit_addvalue(const struct ovsrec_controller *row, int64_t new_value)
9742
0
{
9743
0
    struct ovsdb_datum *datum;
9744
9745
0
    datum = xmalloc(sizeof *datum);
9746
0
    datum->n = 1;
9747
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9748
0
    datum->values = NULL;
9749
0
    datum->refcnt = NULL;
9750
9751
0
    datum->keys[0].integer = new_value;
9752
9753
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9754
0
                                    &ovsrec_controller_col_controller_burst_limit,
9755
0
                                    datum);
9756
0
}
9757
9758
/* Deletes the value 'delete_value' from the "controller_burst_limit" set column from the
9759
 * "Controller" table in 'row'.
9760
 *
9761
 */
9762
void
9763
ovsrec_controller_update_controller_burst_limit_delvalue(const struct ovsrec_controller *row, int64_t delete_value)
9764
0
{
9765
0
    struct ovsdb_datum *datum;
9766
9767
0
    datum = xmalloc(sizeof *datum);
9768
0
    datum->n = 1;
9769
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9770
0
    datum->values = NULL;
9771
0
    datum->refcnt = NULL;
9772
9773
0
    datum->keys[0].integer = delete_value;
9774
9775
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9776
0
                                    &ovsrec_controller_col_controller_burst_limit,
9777
0
                                    datum);
9778
0
}
9779
9780
/* Adds the value 'new_value' to the "controller_queue_size" set column from the "Controller" table
9781
 * in 'row'.
9782
 *
9783
 */
9784
void
9785
ovsrec_controller_update_controller_queue_size_addvalue(const struct ovsrec_controller *row, int64_t new_value)
9786
0
{
9787
0
    struct ovsdb_datum *datum;
9788
9789
0
    datum = xmalloc(sizeof *datum);
9790
0
    datum->n = 1;
9791
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9792
0
    datum->values = NULL;
9793
0
    datum->refcnt = NULL;
9794
9795
0
    datum->keys[0].integer = new_value;
9796
9797
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9798
0
                                    &ovsrec_controller_col_controller_queue_size,
9799
0
                                    datum);
9800
0
}
9801
9802
/* Deletes the value 'delete_value' from the "controller_queue_size" set column from the
9803
 * "Controller" table in 'row'.
9804
 *
9805
 */
9806
void
9807
ovsrec_controller_update_controller_queue_size_delvalue(const struct ovsrec_controller *row, int64_t delete_value)
9808
0
{
9809
0
    struct ovsdb_datum *datum;
9810
9811
0
    datum = xmalloc(sizeof *datum);
9812
0
    datum->n = 1;
9813
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9814
0
    datum->values = NULL;
9815
0
    datum->refcnt = NULL;
9816
9817
0
    datum->keys[0].integer = delete_value;
9818
9819
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9820
0
                                    &ovsrec_controller_col_controller_queue_size,
9821
0
                                    datum);
9822
0
}
9823
9824
/* Adds the value 'new_value' to the "controller_rate_limit" set column from the "Controller" table
9825
 * in 'row'.
9826
 *
9827
 */
9828
void
9829
ovsrec_controller_update_controller_rate_limit_addvalue(const struct ovsrec_controller *row, int64_t new_value)
9830
0
{
9831
0
    struct ovsdb_datum *datum;
9832
9833
0
    datum = xmalloc(sizeof *datum);
9834
0
    datum->n = 1;
9835
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9836
0
    datum->values = NULL;
9837
0
    datum->refcnt = NULL;
9838
9839
0
    datum->keys[0].integer = new_value;
9840
9841
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9842
0
                                    &ovsrec_controller_col_controller_rate_limit,
9843
0
                                    datum);
9844
0
}
9845
9846
/* Deletes the value 'delete_value' from the "controller_rate_limit" set column from the
9847
 * "Controller" table in 'row'.
9848
 *
9849
 */
9850
void
9851
ovsrec_controller_update_controller_rate_limit_delvalue(const struct ovsrec_controller *row, int64_t delete_value)
9852
0
{
9853
0
    struct ovsdb_datum *datum;
9854
9855
0
    datum = xmalloc(sizeof *datum);
9856
0
    datum->n = 1;
9857
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9858
0
    datum->values = NULL;
9859
0
    datum->refcnt = NULL;
9860
9861
0
    datum->keys[0].integer = delete_value;
9862
9863
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9864
0
                                    &ovsrec_controller_col_controller_rate_limit,
9865
0
                                    datum);
9866
0
}
9867
9868
/* Adds the value 'new_value' to the "enable_async_messages" set column from the "Controller" table
9869
 * in 'row'.
9870
 *
9871
 */
9872
void
9873
ovsrec_controller_update_enable_async_messages_addvalue(const struct ovsrec_controller *row, bool new_value)
9874
0
{
9875
0
    struct ovsdb_datum *datum;
9876
9877
0
    datum = xmalloc(sizeof *datum);
9878
0
    datum->n = 1;
9879
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9880
0
    datum->values = NULL;
9881
0
    datum->refcnt = NULL;
9882
9883
0
    datum->keys[0].boolean = new_value;
9884
9885
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9886
0
                                    &ovsrec_controller_col_enable_async_messages,
9887
0
                                    datum);
9888
0
}
9889
9890
/* Deletes the value 'delete_value' from the "enable_async_messages" set column from the
9891
 * "Controller" table in 'row'.
9892
 *
9893
 */
9894
void
9895
ovsrec_controller_update_enable_async_messages_delvalue(const struct ovsrec_controller *row, bool delete_value)
9896
0
{
9897
0
    struct ovsdb_datum *datum;
9898
9899
0
    datum = xmalloc(sizeof *datum);
9900
0
    datum->n = 1;
9901
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9902
0
    datum->values = NULL;
9903
0
    datum->refcnt = NULL;
9904
9905
0
    datum->keys[0].boolean = delete_value;
9906
9907
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9908
0
                                    &ovsrec_controller_col_enable_async_messages,
9909
0
                                    datum);
9910
0
}
9911
9912
/* Sets an element of the "external_ids" map column from the "Controller" table in 'row'
9913
 * to 'new_value' given the key value 'new_key'.
9914
 *
9915
 */
9916
void
9917
ovsrec_controller_update_external_ids_setkey(const struct ovsrec_controller *row, const char *new_key, const char *new_value)
9918
0
{
9919
0
    struct ovsdb_datum *datum;
9920
9921
0
    datum = xmalloc(sizeof *datum);
9922
0
    datum->n = 1;
9923
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
9924
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
9925
0
    datum->refcnt = NULL;
9926
9927
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
9928
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
9929
9930
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
9931
0
                                    &ovsrec_controller_col_external_ids,
9932
0
                                    datum);
9933
0
}
9934
9935
/* Deletes an element of the "external_ids" map column from the "Controller" table in 'row'
9936
 * given the key value 'delete_key'.
9937
 *
9938
 */
9939
void
9940
ovsrec_controller_update_external_ids_delkey(const struct ovsrec_controller *row, const char *delete_key)
9941
0
{
9942
0
    struct ovsdb_datum *datum;
9943
9944
0
    datum = xmalloc(sizeof *datum);
9945
0
    datum->n = 1;
9946
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
9947
0
    datum->values = NULL;
9948
0
    datum->refcnt = NULL;
9949
9950
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
9951
9952
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
9953
0
                                    &ovsrec_controller_col_external_ids,
9954
0
                                    datum);
9955
0
}
9956
9957
/* Adds the value 'new_value' to the "inactivity_probe" set column from the "Controller" table
9958
 * in 'row'.
9959
 *
9960
 */
9961
void
9962
ovsrec_controller_update_inactivity_probe_addvalue(const struct ovsrec_controller *row, int64_t new_value)
9963
0
{
9964
0
    struct ovsdb_datum *datum;
9965
9966
0
    datum = xmalloc(sizeof *datum);
9967
0
    datum->n = 1;
9968
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9969
0
    datum->values = NULL;
9970
0
    datum->refcnt = NULL;
9971
9972
0
    datum->keys[0].integer = new_value;
9973
9974
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9975
0
                                    &ovsrec_controller_col_inactivity_probe,
9976
0
                                    datum);
9977
0
}
9978
9979
/* Deletes the value 'delete_value' from the "inactivity_probe" set column from the
9980
 * "Controller" table in 'row'.
9981
 *
9982
 */
9983
void
9984
ovsrec_controller_update_inactivity_probe_delvalue(const struct ovsrec_controller *row, int64_t delete_value)
9985
0
{
9986
0
    struct ovsdb_datum *datum;
9987
9988
0
    datum = xmalloc(sizeof *datum);
9989
0
    datum->n = 1;
9990
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9991
0
    datum->values = NULL;
9992
0
    datum->refcnt = NULL;
9993
9994
0
    datum->keys[0].integer = delete_value;
9995
9996
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9997
0
                                    &ovsrec_controller_col_inactivity_probe,
9998
0
                                    datum);
9999
0
}
10000
10001
/* Adds the value 'new_value' to the "local_gateway" set column from the "Controller" table
10002
 * in 'row'.
10003
 *
10004
 */
10005
void
10006
ovsrec_controller_update_local_gateway_addvalue(const struct ovsrec_controller *row, const char *new_value)
10007
0
{
10008
0
    struct ovsdb_datum *datum;
10009
10010
0
    datum = xmalloc(sizeof *datum);
10011
0
    datum->n = 1;
10012
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10013
0
    datum->values = NULL;
10014
0
    datum->refcnt = NULL;
10015
10016
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
10017
10018
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
10019
0
                                    &ovsrec_controller_col_local_gateway,
10020
0
                                    datum);
10021
0
}
10022
10023
/* Deletes the value 'delete_value' from the "local_gateway" set column from the
10024
 * "Controller" table in 'row'.
10025
 *
10026
 */
10027
void
10028
ovsrec_controller_update_local_gateway_delvalue(const struct ovsrec_controller *row, const char *delete_value)
10029
0
{
10030
0
    struct ovsdb_datum *datum;
10031
10032
0
    datum = xmalloc(sizeof *datum);
10033
0
    datum->n = 1;
10034
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10035
0
    datum->values = NULL;
10036
0
    datum->refcnt = NULL;
10037
10038
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
10039
10040
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
10041
0
                                    &ovsrec_controller_col_local_gateway,
10042
0
                                    datum);
10043
0
}
10044
10045
/* Adds the value 'new_value' to the "local_ip" set column from the "Controller" table
10046
 * in 'row'.
10047
 *
10048
 */
10049
void
10050
ovsrec_controller_update_local_ip_addvalue(const struct ovsrec_controller *row, const char *new_value)
10051
0
{
10052
0
    struct ovsdb_datum *datum;
10053
10054
0
    datum = xmalloc(sizeof *datum);
10055
0
    datum->n = 1;
10056
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10057
0
    datum->values = NULL;
10058
0
    datum->refcnt = NULL;
10059
10060
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
10061
10062
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
10063
0
                                    &ovsrec_controller_col_local_ip,
10064
0
                                    datum);
10065
0
}
10066
10067
/* Deletes the value 'delete_value' from the "local_ip" set column from the
10068
 * "Controller" table in 'row'.
10069
 *
10070
 */
10071
void
10072
ovsrec_controller_update_local_ip_delvalue(const struct ovsrec_controller *row, const char *delete_value)
10073
0
{
10074
0
    struct ovsdb_datum *datum;
10075
10076
0
    datum = xmalloc(sizeof *datum);
10077
0
    datum->n = 1;
10078
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10079
0
    datum->values = NULL;
10080
0
    datum->refcnt = NULL;
10081
10082
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
10083
10084
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
10085
0
                                    &ovsrec_controller_col_local_ip,
10086
0
                                    datum);
10087
0
}
10088
10089
/* Adds the value 'new_value' to the "local_netmask" set column from the "Controller" table
10090
 * in 'row'.
10091
 *
10092
 */
10093
void
10094
ovsrec_controller_update_local_netmask_addvalue(const struct ovsrec_controller *row, const char *new_value)
10095
0
{
10096
0
    struct ovsdb_datum *datum;
10097
10098
0
    datum = xmalloc(sizeof *datum);
10099
0
    datum->n = 1;
10100
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10101
0
    datum->values = NULL;
10102
0
    datum->refcnt = NULL;
10103
10104
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
10105
10106
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
10107
0
                                    &ovsrec_controller_col_local_netmask,
10108
0
                                    datum);
10109
0
}
10110
10111
/* Deletes the value 'delete_value' from the "local_netmask" set column from the
10112
 * "Controller" table in 'row'.
10113
 *
10114
 */
10115
void
10116
ovsrec_controller_update_local_netmask_delvalue(const struct ovsrec_controller *row, const char *delete_value)
10117
0
{
10118
0
    struct ovsdb_datum *datum;
10119
10120
0
    datum = xmalloc(sizeof *datum);
10121
0
    datum->n = 1;
10122
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10123
0
    datum->values = NULL;
10124
0
    datum->refcnt = NULL;
10125
10126
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
10127
10128
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
10129
0
                                    &ovsrec_controller_col_local_netmask,
10130
0
                                    datum);
10131
0
}
10132
10133
/* Adds the value 'new_value' to the "max_backoff" set column from the "Controller" table
10134
 * in 'row'.
10135
 *
10136
 */
10137
void
10138
ovsrec_controller_update_max_backoff_addvalue(const struct ovsrec_controller *row, int64_t new_value)
10139
0
{
10140
0
    struct ovsdb_datum *datum;
10141
10142
0
    datum = xmalloc(sizeof *datum);
10143
0
    datum->n = 1;
10144
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10145
0
    datum->values = NULL;
10146
0
    datum->refcnt = NULL;
10147
10148
0
    datum->keys[0].integer = new_value;
10149
10150
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
10151
0
                                    &ovsrec_controller_col_max_backoff,
10152
0
                                    datum);
10153
0
}
10154
10155
/* Deletes the value 'delete_value' from the "max_backoff" set column from the
10156
 * "Controller" table in 'row'.
10157
 *
10158
 */
10159
void
10160
ovsrec_controller_update_max_backoff_delvalue(const struct ovsrec_controller *row, int64_t delete_value)
10161
0
{
10162
0
    struct ovsdb_datum *datum;
10163
10164
0
    datum = xmalloc(sizeof *datum);
10165
0
    datum->n = 1;
10166
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10167
0
    datum->values = NULL;
10168
0
    datum->refcnt = NULL;
10169
10170
0
    datum->keys[0].integer = delete_value;
10171
10172
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
10173
0
                                    &ovsrec_controller_col_max_backoff,
10174
0
                                    datum);
10175
0
}
10176
10177
/* Sets an element of the "other_config" map column from the "Controller" table in 'row'
10178
 * to 'new_value' given the key value 'new_key'.
10179
 *
10180
 */
10181
void
10182
ovsrec_controller_update_other_config_setkey(const struct ovsrec_controller *row, const char *new_key, const char *new_value)
10183
0
{
10184
0
    struct ovsdb_datum *datum;
10185
10186
0
    datum = xmalloc(sizeof *datum);
10187
0
    datum->n = 1;
10188
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
10189
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
10190
0
    datum->refcnt = NULL;
10191
10192
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
10193
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
10194
10195
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
10196
0
                                    &ovsrec_controller_col_other_config,
10197
0
                                    datum);
10198
0
}
10199
10200
/* Deletes an element of the "other_config" map column from the "Controller" table in 'row'
10201
 * given the key value 'delete_key'.
10202
 *
10203
 */
10204
void
10205
ovsrec_controller_update_other_config_delkey(const struct ovsrec_controller *row, const char *delete_key)
10206
0
{
10207
0
    struct ovsdb_datum *datum;
10208
10209
0
    datum = xmalloc(sizeof *datum);
10210
0
    datum->n = 1;
10211
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
10212
0
    datum->values = NULL;
10213
0
    datum->refcnt = NULL;
10214
10215
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
10216
10217
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
10218
0
                                    &ovsrec_controller_col_other_config,
10219
0
                                    datum);
10220
0
}
10221
10222
/* Adds the value 'new_value' to the "role" set column from the "Controller" table
10223
 * in 'row'.
10224
 *
10225
 */
10226
void
10227
ovsrec_controller_update_role_addvalue(const struct ovsrec_controller *row, const char *new_value)
10228
0
{
10229
0
    struct ovsdb_datum *datum;
10230
10231
0
    datum = xmalloc(sizeof *datum);
10232
0
    datum->n = 1;
10233
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10234
0
    datum->values = NULL;
10235
0
    datum->refcnt = NULL;
10236
10237
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
10238
10239
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
10240
0
                                    &ovsrec_controller_col_role,
10241
0
                                    datum);
10242
0
}
10243
10244
/* Deletes the value 'delete_value' from the "role" set column from the
10245
 * "Controller" table in 'row'.
10246
 *
10247
 */
10248
void
10249
ovsrec_controller_update_role_delvalue(const struct ovsrec_controller *row, const char *delete_value)
10250
0
{
10251
0
    struct ovsdb_datum *datum;
10252
10253
0
    datum = xmalloc(sizeof *datum);
10254
0
    datum->n = 1;
10255
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10256
0
    datum->values = NULL;
10257
0
    datum->refcnt = NULL;
10258
10259
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
10260
10261
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
10262
0
                                    &ovsrec_controller_col_role,
10263
0
                                    datum);
10264
0
}
10265
10266
/* Sets an element of the "status" map column from the "Controller" table in 'row'
10267
 * to 'new_value' given the key value 'new_key'.
10268
 *
10269
 */
10270
void
10271
ovsrec_controller_update_status_setkey(const struct ovsrec_controller *row, const char *new_key, const char *new_value)
10272
0
{
10273
0
    struct ovsdb_datum *datum;
10274
10275
0
    datum = xmalloc(sizeof *datum);
10276
0
    datum->n = 1;
10277
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
10278
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
10279
0
    datum->refcnt = NULL;
10280
10281
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
10282
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
10283
10284
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
10285
0
                                    &ovsrec_controller_col_status,
10286
0
                                    datum);
10287
0
}
10288
10289
/* Deletes an element of the "status" map column from the "Controller" table in 'row'
10290
 * given the key value 'delete_key'.
10291
 *
10292
 */
10293
void
10294
ovsrec_controller_update_status_delkey(const struct ovsrec_controller *row, const char *delete_key)
10295
0
{
10296
0
    struct ovsdb_datum *datum;
10297
10298
0
    datum = xmalloc(sizeof *datum);
10299
0
    datum->n = 1;
10300
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
10301
0
    datum->values = NULL;
10302
0
    datum->refcnt = NULL;
10303
10304
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
10305
10306
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
10307
0
                                    &ovsrec_controller_col_status,
10308
0
                                    datum);
10309
0
}
10310
10311
/* Adds the value 'new_value' to the "type" set column from the "Controller" table
10312
 * in 'row'.
10313
 *
10314
 */
10315
void
10316
ovsrec_controller_update_type_addvalue(const struct ovsrec_controller *row, const char *new_value)
10317
0
{
10318
0
    struct ovsdb_datum *datum;
10319
10320
0
    datum = xmalloc(sizeof *datum);
10321
0
    datum->n = 1;
10322
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10323
0
    datum->values = NULL;
10324
0
    datum->refcnt = NULL;
10325
10326
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
10327
10328
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
10329
0
                                    &ovsrec_controller_col_type,
10330
0
                                    datum);
10331
0
}
10332
10333
/* Deletes the value 'delete_value' from the "type" set column from the
10334
 * "Controller" table in 'row'.
10335
 *
10336
 */
10337
void
10338
ovsrec_controller_update_type_delvalue(const struct ovsrec_controller *row, const char *delete_value)
10339
0
{
10340
0
    struct ovsdb_datum *datum;
10341
10342
0
    datum = xmalloc(sizeof *datum);
10343
0
    datum->n = 1;
10344
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
10345
0
    datum->values = NULL;
10346
0
    datum->refcnt = NULL;
10347
10348
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
10349
10350
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
10351
0
                                    &ovsrec_controller_col_type,
10352
0
                                    datum);
10353
0
}
10354
10355
/* Sets the "connection_mode" column from the "Controller" table in 'row' to
10356
 * the 'connection_mode' set.
10357
 *
10358
 * If "connection_mode" is null, the column will be the empty set,
10359
 * otherwise it will contain the specified value.
10360
 *
10361
 * Argument constraints: either "in-band" or "out-of-band"
10362
 *
10363
 * The caller retains ownership of the arguments. */
10364
void
10365
ovsrec_controller_add_clause_connection_mode(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *connection_mode)
10366
0
{
10367
0
    struct ovsdb_datum datum;
10368
10369
0
    datum.refcnt = NULL;
10370
10371
0
    if (connection_mode) {
10372
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10373
0
        datum.n = 1;
10374
0
        datum.keys = key;
10375
0
        key->s = ovsdb_atom_string_create(connection_mode);
10376
0
    } else {
10377
0
        datum.n = 0;
10378
0
        datum.keys = NULL;
10379
0
    }
10380
0
    datum.values = NULL;
10381
0
    ovsdb_idl_condition_add_clause(cond,
10382
0
                          function,
10383
0
                          &ovsrec_controller_col_connection_mode,
10384
0
                          &datum);
10385
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_connection_mode.type);
10386
0
}
10387
10388
/* Sets the "controller_burst_limit" column from the "Controller" table in 'row' to
10389
 * the 'controller_burst_limit' set with 'n_controller_burst_limit' entries.
10390
 *
10391
 * 'n_controller_burst_limit' may be 0 or 1; if it is 0, then 'controller_burst_limit'
10392
 * may be NULL.
10393
 *
10394
 * Argument constraints: at least 25
10395
 *
10396
 * The caller retains ownership of the arguments. */
10397
void
10398
ovsrec_controller_add_clause_controller_burst_limit(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *controller_burst_limit, size_t n_controller_burst_limit)
10399
0
{
10400
0
    struct ovsdb_datum datum;
10401
10402
0
    datum.refcnt = NULL;
10403
10404
0
    if (n_controller_burst_limit) {
10405
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10406
0
        datum.n = 1;
10407
0
        datum.keys = key;
10408
0
        key->integer = *controller_burst_limit;
10409
0
    } else {
10410
0
        datum.n = 0;
10411
0
        datum.keys = NULL;
10412
0
    }
10413
0
    datum.values = NULL;
10414
0
    ovsdb_idl_condition_add_clause(cond,
10415
0
                          function,
10416
0
                          &ovsrec_controller_col_controller_burst_limit,
10417
0
                          &datum);
10418
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_controller_burst_limit.type);
10419
0
}
10420
10421
/* Sets the "controller_queue_size" column from the "Controller" table in 'row' to
10422
 * the 'controller_queue_size' set with 'n_controller_queue_size' entries.
10423
 *
10424
 * 'n_controller_queue_size' may be 0 or 1; if it is 0, then 'controller_queue_size'
10425
 * may be NULL.
10426
 *
10427
 * Argument constraints: in range 1 to 512
10428
 *
10429
 * The caller retains ownership of the arguments. */
10430
void
10431
ovsrec_controller_add_clause_controller_queue_size(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *controller_queue_size, size_t n_controller_queue_size)
10432
0
{
10433
0
    struct ovsdb_datum datum;
10434
10435
0
    datum.refcnt = NULL;
10436
10437
0
    if (n_controller_queue_size) {
10438
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10439
0
        datum.n = 1;
10440
0
        datum.keys = key;
10441
0
        key->integer = *controller_queue_size;
10442
0
    } else {
10443
0
        datum.n = 0;
10444
0
        datum.keys = NULL;
10445
0
    }
10446
0
    datum.values = NULL;
10447
0
    ovsdb_idl_condition_add_clause(cond,
10448
0
                          function,
10449
0
                          &ovsrec_controller_col_controller_queue_size,
10450
0
                          &datum);
10451
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_controller_queue_size.type);
10452
0
}
10453
10454
/* Sets the "controller_rate_limit" column from the "Controller" table in 'row' to
10455
 * the 'controller_rate_limit' set with 'n_controller_rate_limit' entries.
10456
 *
10457
 * 'n_controller_rate_limit' may be 0 or 1; if it is 0, then 'controller_rate_limit'
10458
 * may be NULL.
10459
 *
10460
 * Argument constraints: at least 100
10461
 *
10462
 * The caller retains ownership of the arguments. */
10463
void
10464
ovsrec_controller_add_clause_controller_rate_limit(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *controller_rate_limit, size_t n_controller_rate_limit)
10465
0
{
10466
0
    struct ovsdb_datum datum;
10467
10468
0
    datum.refcnt = NULL;
10469
10470
0
    if (n_controller_rate_limit) {
10471
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10472
0
        datum.n = 1;
10473
0
        datum.keys = key;
10474
0
        key->integer = *controller_rate_limit;
10475
0
    } else {
10476
0
        datum.n = 0;
10477
0
        datum.keys = NULL;
10478
0
    }
10479
0
    datum.values = NULL;
10480
0
    ovsdb_idl_condition_add_clause(cond,
10481
0
                          function,
10482
0
                          &ovsrec_controller_col_controller_rate_limit,
10483
0
                          &datum);
10484
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_controller_rate_limit.type);
10485
0
}
10486
10487
/* Sets the "enable_async_messages" column from the "Controller" table in 'row' to
10488
 * the 'enable_async_messages' set with 'n_enable_async_messages' entries.
10489
 *
10490
 * 'n_enable_async_messages' may be 0 or 1; if it is 0, then 'enable_async_messages'
10491
 * may be NULL.
10492
 *
10493
 * The caller retains ownership of the arguments. */
10494
void
10495
ovsrec_controller_add_clause_enable_async_messages(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const bool *enable_async_messages, size_t n_enable_async_messages)
10496
0
{
10497
0
    struct ovsdb_datum datum;
10498
10499
0
    datum.refcnt = NULL;
10500
10501
0
    if (n_enable_async_messages) {
10502
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10503
0
        datum.n = 1;
10504
0
        datum.keys = key;
10505
0
        key->boolean = *enable_async_messages;
10506
0
    } else {
10507
0
        datum.n = 0;
10508
0
        datum.keys = NULL;
10509
0
    }
10510
0
    datum.values = NULL;
10511
0
    ovsdb_idl_condition_add_clause(cond,
10512
0
                          function,
10513
0
                          &ovsrec_controller_col_enable_async_messages,
10514
0
                          &datum);
10515
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_enable_async_messages.type);
10516
0
}
10517
10518
/* Sets the "external_ids" column's value from the "Controller" table in 'row'
10519
 * to 'external_ids'.
10520
 *
10521
 * The caller retains ownership of 'external_ids' and everything in it. */
10522
void
10523
ovsrec_controller_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
10524
0
{
10525
0
    struct ovsdb_datum datum;
10526
10527
0
    if (external_ids) {
10528
0
        ovsdb_datum_from_smap(&datum, external_ids);
10529
0
    } else {
10530
0
        ovsdb_datum_init_empty(&datum);
10531
0
    }
10532
10533
0
    ovsdb_idl_condition_add_clause(cond,
10534
0
                                   function,
10535
0
                                   &ovsrec_controller_col_external_ids,
10536
0
                                   &datum);
10537
10538
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_external_ids.type);
10539
0
}
10540
10541
10542
/* Sets the "inactivity_probe" column from the "Controller" table in 'row' to
10543
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
10544
 *
10545
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
10546
 * may be NULL.
10547
 *
10548
 * The caller retains ownership of the arguments. */
10549
void
10550
ovsrec_controller_add_clause_inactivity_probe(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *inactivity_probe, size_t n_inactivity_probe)
10551
0
{
10552
0
    struct ovsdb_datum datum;
10553
10554
0
    datum.refcnt = NULL;
10555
10556
0
    if (n_inactivity_probe) {
10557
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10558
0
        datum.n = 1;
10559
0
        datum.keys = key;
10560
0
        key->integer = *inactivity_probe;
10561
0
    } else {
10562
0
        datum.n = 0;
10563
0
        datum.keys = NULL;
10564
0
    }
10565
0
    datum.values = NULL;
10566
0
    ovsdb_idl_condition_add_clause(cond,
10567
0
                          function,
10568
0
                          &ovsrec_controller_col_inactivity_probe,
10569
0
                          &datum);
10570
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_inactivity_probe.type);
10571
0
}
10572
10573
/* Sets the "is_connected" column from the "Controller" table in 'row' to
10574
 * 'is_connected'.
10575
 *
10576
 * The caller retains ownership of the arguments. */
10577
void
10578
ovsrec_controller_add_clause_is_connected(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool is_connected)
10579
0
{
10580
0
    struct ovsdb_datum datum;
10581
10582
0
    datum.refcnt = NULL;
10583
10584
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
10585
10586
0
    datum.n = 1;
10587
0
    datum.keys = key;
10588
0
    key->boolean = is_connected;
10589
0
    datum.values = NULL;
10590
0
    ovsdb_idl_condition_add_clause(cond,
10591
0
                          function,
10592
0
                          &ovsrec_controller_col_is_connected,
10593
0
                          &datum);
10594
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_is_connected.type);
10595
0
}
10596
10597
/* Sets the "local_gateway" column from the "Controller" table in 'row' to
10598
 * the 'local_gateway' set.
10599
 *
10600
 * If "local_gateway" is null, the column will be the empty set,
10601
 * otherwise it will contain the specified value.
10602
 *
10603
 * The caller retains ownership of the arguments. */
10604
void
10605
ovsrec_controller_add_clause_local_gateway(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *local_gateway)
10606
0
{
10607
0
    struct ovsdb_datum datum;
10608
10609
0
    datum.refcnt = NULL;
10610
10611
0
    if (local_gateway) {
10612
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10613
0
        datum.n = 1;
10614
0
        datum.keys = key;
10615
0
        key->s = ovsdb_atom_string_create(local_gateway);
10616
0
    } else {
10617
0
        datum.n = 0;
10618
0
        datum.keys = NULL;
10619
0
    }
10620
0
    datum.values = NULL;
10621
0
    ovsdb_idl_condition_add_clause(cond,
10622
0
                          function,
10623
0
                          &ovsrec_controller_col_local_gateway,
10624
0
                          &datum);
10625
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_local_gateway.type);
10626
0
}
10627
10628
/* Sets the "local_ip" column from the "Controller" table in 'row' to
10629
 * the 'local_ip' set.
10630
 *
10631
 * If "local_ip" is null, the column will be the empty set,
10632
 * otherwise it will contain the specified value.
10633
 *
10634
 * The caller retains ownership of the arguments. */
10635
void
10636
ovsrec_controller_add_clause_local_ip(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *local_ip)
10637
0
{
10638
0
    struct ovsdb_datum datum;
10639
10640
0
    datum.refcnt = NULL;
10641
10642
0
    if (local_ip) {
10643
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10644
0
        datum.n = 1;
10645
0
        datum.keys = key;
10646
0
        key->s = ovsdb_atom_string_create(local_ip);
10647
0
    } else {
10648
0
        datum.n = 0;
10649
0
        datum.keys = NULL;
10650
0
    }
10651
0
    datum.values = NULL;
10652
0
    ovsdb_idl_condition_add_clause(cond,
10653
0
                          function,
10654
0
                          &ovsrec_controller_col_local_ip,
10655
0
                          &datum);
10656
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_local_ip.type);
10657
0
}
10658
10659
/* Sets the "local_netmask" column from the "Controller" table in 'row' to
10660
 * the 'local_netmask' set.
10661
 *
10662
 * If "local_netmask" is null, the column will be the empty set,
10663
 * otherwise it will contain the specified value.
10664
 *
10665
 * The caller retains ownership of the arguments. */
10666
void
10667
ovsrec_controller_add_clause_local_netmask(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *local_netmask)
10668
0
{
10669
0
    struct ovsdb_datum datum;
10670
10671
0
    datum.refcnt = NULL;
10672
10673
0
    if (local_netmask) {
10674
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10675
0
        datum.n = 1;
10676
0
        datum.keys = key;
10677
0
        key->s = ovsdb_atom_string_create(local_netmask);
10678
0
    } else {
10679
0
        datum.n = 0;
10680
0
        datum.keys = NULL;
10681
0
    }
10682
0
    datum.values = NULL;
10683
0
    ovsdb_idl_condition_add_clause(cond,
10684
0
                          function,
10685
0
                          &ovsrec_controller_col_local_netmask,
10686
0
                          &datum);
10687
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_local_netmask.type);
10688
0
}
10689
10690
/* Sets the "max_backoff" column from the "Controller" table in 'row' to
10691
 * the 'max_backoff' set with 'n_max_backoff' entries.
10692
 *
10693
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
10694
 * may be NULL.
10695
 *
10696
 * Argument constraints: at least 1,000
10697
 *
10698
 * The caller retains ownership of the arguments. */
10699
void
10700
ovsrec_controller_add_clause_max_backoff(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *max_backoff, size_t n_max_backoff)
10701
0
{
10702
0
    struct ovsdb_datum datum;
10703
10704
0
    datum.refcnt = NULL;
10705
10706
0
    if (n_max_backoff) {
10707
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10708
0
        datum.n = 1;
10709
0
        datum.keys = key;
10710
0
        key->integer = *max_backoff;
10711
0
    } else {
10712
0
        datum.n = 0;
10713
0
        datum.keys = NULL;
10714
0
    }
10715
0
    datum.values = NULL;
10716
0
    ovsdb_idl_condition_add_clause(cond,
10717
0
                          function,
10718
0
                          &ovsrec_controller_col_max_backoff,
10719
0
                          &datum);
10720
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_max_backoff.type);
10721
0
}
10722
10723
/* Sets the "other_config" column's value from the "Controller" table in 'row'
10724
 * to 'other_config'.
10725
 *
10726
 * The caller retains ownership of 'other_config' and everything in it. */
10727
void
10728
ovsrec_controller_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
10729
0
{
10730
0
    struct ovsdb_datum datum;
10731
10732
0
    if (other_config) {
10733
0
        ovsdb_datum_from_smap(&datum, other_config);
10734
0
    } else {
10735
0
        ovsdb_datum_init_empty(&datum);
10736
0
    }
10737
10738
0
    ovsdb_idl_condition_add_clause(cond,
10739
0
                                   function,
10740
0
                                   &ovsrec_controller_col_other_config,
10741
0
                                   &datum);
10742
10743
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_other_config.type);
10744
0
}
10745
10746
10747
/* Sets the "role" column from the "Controller" table in 'row' to
10748
 * the 'role' set.
10749
 *
10750
 * If "role" is null, the column will be the empty set,
10751
 * otherwise it will contain the specified value.
10752
 *
10753
 * Argument constraints: one of "master", "other", or "slave"
10754
 *
10755
 * The caller retains ownership of the arguments. */
10756
void
10757
ovsrec_controller_add_clause_role(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *role)
10758
0
{
10759
0
    struct ovsdb_datum datum;
10760
10761
0
    datum.refcnt = NULL;
10762
10763
0
    if (role) {
10764
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10765
0
        datum.n = 1;
10766
0
        datum.keys = key;
10767
0
        key->s = ovsdb_atom_string_create(role);
10768
0
    } else {
10769
0
        datum.n = 0;
10770
0
        datum.keys = NULL;
10771
0
    }
10772
0
    datum.values = NULL;
10773
0
    ovsdb_idl_condition_add_clause(cond,
10774
0
                          function,
10775
0
                          &ovsrec_controller_col_role,
10776
0
                          &datum);
10777
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_role.type);
10778
0
}
10779
10780
/* Sets the "status" column's value from the "Controller" table in 'row'
10781
 * to 'status'.
10782
 *
10783
 * The caller retains ownership of 'status' and everything in it. */
10784
void
10785
ovsrec_controller_add_clause_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *status)
10786
0
{
10787
0
    struct ovsdb_datum datum;
10788
10789
0
    if (status) {
10790
0
        ovsdb_datum_from_smap(&datum, status);
10791
0
    } else {
10792
0
        ovsdb_datum_init_empty(&datum);
10793
0
    }
10794
10795
0
    ovsdb_idl_condition_add_clause(cond,
10796
0
                                   function,
10797
0
                                   &ovsrec_controller_col_status,
10798
0
                                   &datum);
10799
10800
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_status.type);
10801
0
}
10802
10803
10804
/* Sets the "target" column from the "Controller" table in 'row' to
10805
 * 'target'.
10806
 *
10807
 * The caller retains ownership of the arguments. */
10808
void
10809
ovsrec_controller_add_clause_target(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *target)
10810
0
{
10811
0
    struct ovsdb_datum datum;
10812
10813
0
    datum.refcnt = NULL;
10814
10815
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
10816
10817
0
    datum.n = 1;
10818
0
    datum.keys = key;
10819
0
    key->s = ovsdb_atom_string_create(target);
10820
0
    datum.values = NULL;
10821
0
    ovsdb_idl_condition_add_clause(cond,
10822
0
                          function,
10823
0
                          &ovsrec_controller_col_target,
10824
0
                          &datum);
10825
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_target.type);
10826
0
}
10827
10828
/* Sets the "type" column from the "Controller" table in 'row' to
10829
 * the 'type' set.
10830
 *
10831
 * If "type" is null, the column will be the empty set,
10832
 * otherwise it will contain the specified value.
10833
 *
10834
 * Argument constraints: either "primary" or "service"
10835
 *
10836
 * The caller retains ownership of the arguments. */
10837
void
10838
ovsrec_controller_add_clause_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *type)
10839
0
{
10840
0
    struct ovsdb_datum datum;
10841
10842
0
    datum.refcnt = NULL;
10843
10844
0
    if (type) {
10845
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10846
0
        datum.n = 1;
10847
0
        datum.keys = key;
10848
0
        key->s = ovsdb_atom_string_create(type);
10849
0
    } else {
10850
0
        datum.n = 0;
10851
0
        datum.keys = NULL;
10852
0
    }
10853
0
    datum.values = NULL;
10854
0
    ovsdb_idl_condition_add_clause(cond,
10855
0
                          function,
10856
0
                          &ovsrec_controller_col_type,
10857
0
                          &datum);
10858
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_type.type);
10859
0
}
10860
10861
/* Destroy 'row' of kind "Controller". The row must have been
10862
 * created with ovsdb_idl_index_init_row.
10863
 */
10864
void
10865
ovsrec_controller_index_destroy_row(const struct ovsrec_controller *row)
10866
0
{
10867
0
    ovsdb_idl_index_destroy_row(&row->header_);
10868
0
}
10869
        
10870
10871
/* Creates a new row of kind "Controller". */
10872
struct ovsrec_controller *
10873
ovsrec_controller_index_init_row(struct ovsdb_idl_index *index)
10874
0
{
10875
0
    ovs_assert(index->table->class_ == &ovsrec_table_controller);
10876
0
    return ALIGNED_CAST(struct ovsrec_controller *, ovsdb_idl_index_init_row(index));
10877
0
}
10878
10879
struct ovsrec_controller *
10880
ovsrec_controller_index_find(struct ovsdb_idl_index *index, const struct ovsrec_controller *target)
10881
0
{
10882
0
    ovs_assert(index->table->class_ == &ovsrec_table_controller);
10883
0
    return ovsrec_controller_cast(ovsdb_idl_index_find(index, &target->header_));
10884
0
}
10885
10886
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
10887
int
10888
ovsrec_controller_index_compare(
10889
    struct ovsdb_idl_index *index, 
10890
    const struct ovsrec_controller *a, 
10891
    const struct ovsrec_controller *b)
10892
0
{
10893
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
10894
0
}
10895
10896
struct ovsdb_idl_cursor
10897
ovsrec_controller_cursor_first(struct ovsdb_idl_index *index)
10898
0
{
10899
0
    ovs_assert(index->table->class_ == &ovsrec_table_controller);
10900
0
    return ovsdb_idl_cursor_first(index);
10901
0
}
10902
10903
struct ovsdb_idl_cursor
10904
ovsrec_controller_cursor_first_eq(
10905
    struct ovsdb_idl_index *index, const struct ovsrec_controller *target)
10906
0
{
10907
0
    ovs_assert(index->table->class_ == &ovsrec_table_controller);
10908
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
10909
0
}
10910
10911
struct ovsdb_idl_cursor
10912
ovsrec_controller_cursor_first_ge(
10913
    struct ovsdb_idl_index *index, const struct ovsrec_controller *target)
10914
0
{
10915
0
    ovs_assert(index->table->class_ == &ovsrec_table_controller);
10916
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
10917
0
}
10918
10919
struct ovsrec_controller *
10920
ovsrec_controller_cursor_data(struct ovsdb_idl_cursor *cursor)
10921
0
{
10922
0
    return ovsrec_controller_cast(ovsdb_idl_cursor_data(cursor));
10923
0
}
10924
10925
10926
/* Sets the "connection_mode" column from the "Controller" table in 'row' to
10927
 * the 'connection_mode' set.
10928
 *
10929
 * If "connection_mode" is null, the column will be the empty set,
10930
 * otherwise it will contain the specified value.
10931
 *
10932
 * Argument constraints: either "in-band" or "out-of-band"
10933
 *
10934
 * The caller retains ownership of the arguments. */
10935
void
10936
ovsrec_controller_index_set_connection_mode(const struct ovsrec_controller *row, const char *connection_mode)
10937
0
{
10938
0
    struct ovsdb_datum datum;
10939
10940
0
    datum.refcnt = NULL;
10941
0
    union ovsdb_atom *key;
10942
10943
0
    if (connection_mode) {
10944
0
        key = xmalloc(sizeof (union ovsdb_atom));
10945
0
        datum.n = 1;
10946
0
        datum.keys = key;
10947
0
        key->s = ovsdb_atom_string_create(connection_mode);
10948
0
    } else {
10949
0
        datum.n = 0;
10950
0
        datum.keys = NULL;
10951
0
    }
10952
0
    datum.values = NULL;
10953
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_CONNECTION_MODE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
10954
0
}
10955
10956
/* Sets the "controller_burst_limit" column from the "Controller" table in 'row' to
10957
 * the 'controller_burst_limit' set with 'n_controller_burst_limit' entries.
10958
 *
10959
 * 'n_controller_burst_limit' may be 0 or 1; if it is 0, then 'controller_burst_limit'
10960
 * may be NULL.
10961
 *
10962
 * Argument constraints: at least 25
10963
 *
10964
 * The caller retains ownership of the arguments. */
10965
void
10966
ovsrec_controller_index_set_controller_burst_limit(const struct ovsrec_controller *row, const int64_t *controller_burst_limit, size_t n_controller_burst_limit)
10967
0
{
10968
0
    struct ovsdb_datum datum;
10969
10970
0
    datum.refcnt = NULL;
10971
0
    union ovsdb_atom *key;
10972
10973
0
    if (n_controller_burst_limit) {
10974
0
        key = xmalloc(sizeof(union ovsdb_atom));
10975
0
        datum.n = 1;
10976
0
        datum.keys = key;
10977
0
        key->integer = *controller_burst_limit;
10978
0
    } else {
10979
0
        datum.n = 0;
10980
0
        datum.keys = NULL;
10981
0
    }
10982
0
    datum.values = NULL;
10983
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_CONTROLLER_BURST_LIMIT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
10984
0
}
10985
10986
/* Sets the "controller_queue_size" column from the "Controller" table in 'row' to
10987
 * the 'controller_queue_size' set with 'n_controller_queue_size' entries.
10988
 *
10989
 * 'n_controller_queue_size' may be 0 or 1; if it is 0, then 'controller_queue_size'
10990
 * may be NULL.
10991
 *
10992
 * Argument constraints: in range 1 to 512
10993
 *
10994
 * The caller retains ownership of the arguments. */
10995
void
10996
ovsrec_controller_index_set_controller_queue_size(const struct ovsrec_controller *row, const int64_t *controller_queue_size, size_t n_controller_queue_size)
10997
0
{
10998
0
    struct ovsdb_datum datum;
10999
11000
0
    datum.refcnt = NULL;
11001
0
    union ovsdb_atom *key;
11002
11003
0
    if (n_controller_queue_size) {
11004
0
        key = xmalloc(sizeof(union ovsdb_atom));
11005
0
        datum.n = 1;
11006
0
        datum.keys = key;
11007
0
        key->integer = *controller_queue_size;
11008
0
    } else {
11009
0
        datum.n = 0;
11010
0
        datum.keys = NULL;
11011
0
    }
11012
0
    datum.values = NULL;
11013
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_CONTROLLER_QUEUE_SIZE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11014
0
}
11015
11016
/* Sets the "controller_rate_limit" column from the "Controller" table in 'row' to
11017
 * the 'controller_rate_limit' set with 'n_controller_rate_limit' entries.
11018
 *
11019
 * 'n_controller_rate_limit' may be 0 or 1; if it is 0, then 'controller_rate_limit'
11020
 * may be NULL.
11021
 *
11022
 * Argument constraints: at least 100
11023
 *
11024
 * The caller retains ownership of the arguments. */
11025
void
11026
ovsrec_controller_index_set_controller_rate_limit(const struct ovsrec_controller *row, const int64_t *controller_rate_limit, size_t n_controller_rate_limit)
11027
0
{
11028
0
    struct ovsdb_datum datum;
11029
11030
0
    datum.refcnt = NULL;
11031
0
    union ovsdb_atom *key;
11032
11033
0
    if (n_controller_rate_limit) {
11034
0
        key = xmalloc(sizeof(union ovsdb_atom));
11035
0
        datum.n = 1;
11036
0
        datum.keys = key;
11037
0
        key->integer = *controller_rate_limit;
11038
0
    } else {
11039
0
        datum.n = 0;
11040
0
        datum.keys = NULL;
11041
0
    }
11042
0
    datum.values = NULL;
11043
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_CONTROLLER_RATE_LIMIT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11044
0
}
11045
11046
/* Sets the "enable_async_messages" column from the "Controller" table in 'row' to
11047
 * the 'enable_async_messages' set with 'n_enable_async_messages' entries.
11048
 *
11049
 * 'n_enable_async_messages' may be 0 or 1; if it is 0, then 'enable_async_messages'
11050
 * may be NULL.
11051
 *
11052
 * The caller retains ownership of the arguments. */
11053
void
11054
ovsrec_controller_index_set_enable_async_messages(const struct ovsrec_controller *row, const bool *enable_async_messages, size_t n_enable_async_messages)
11055
0
{
11056
0
    struct ovsdb_datum datum;
11057
11058
0
    datum.refcnt = NULL;
11059
0
    union ovsdb_atom *key;
11060
11061
0
    if (n_enable_async_messages) {
11062
0
        key = xmalloc(sizeof(union ovsdb_atom));
11063
0
        datum.n = 1;
11064
0
        datum.keys = key;
11065
0
        key->boolean = *enable_async_messages;
11066
0
    } else {
11067
0
        datum.n = 0;
11068
0
        datum.keys = NULL;
11069
0
    }
11070
0
    datum.values = NULL;
11071
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_ENABLE_ASYNC_MESSAGES ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11072
0
}
11073
11074
/* Sets the "external_ids" column's value from the "Controller" table in 'row'
11075
 * to 'external_ids'.
11076
 *
11077
 * The caller retains ownership of 'external_ids' and everything in it. */
11078
void
11079
ovsrec_controller_index_set_external_ids(const struct ovsrec_controller *row, const struct smap *external_ids)
11080
0
{
11081
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
11082
11083
0
    if (external_ids) {
11084
0
        struct smap_node *node;
11085
0
        size_t i;
11086
11087
0
        datum->n = smap_count(external_ids);
11088
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
11089
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
11090
0
        datum->refcnt = NULL;
11091
11092
0
        i = 0;
11093
0
        SMAP_FOR_EACH (node, external_ids) {
11094
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
11095
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
11096
0
            i++;
11097
0
        }
11098
0
        ovsdb_datum_sort_unique(datum, &ovsrec_controller_col_external_ids.type);
11099
0
    } else {
11100
0
        ovsdb_datum_init_empty(datum);
11101
0
    }
11102
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
11103
0
                          &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_EXTERNAL_IDS],
11104
0
                          datum,
11105
0
                          &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11106
0
    free(datum);
11107
0
}
11108
11109
11110
/* Sets the "inactivity_probe" column from the "Controller" table in 'row' to
11111
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
11112
 *
11113
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
11114
 * may be NULL.
11115
 *
11116
 * The caller retains ownership of the arguments. */
11117
void
11118
ovsrec_controller_index_set_inactivity_probe(const struct ovsrec_controller *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
11119
0
{
11120
0
    struct ovsdb_datum datum;
11121
11122
0
    datum.refcnt = NULL;
11123
0
    union ovsdb_atom *key;
11124
11125
0
    if (n_inactivity_probe) {
11126
0
        key = xmalloc(sizeof(union ovsdb_atom));
11127
0
        datum.n = 1;
11128
0
        datum.keys = key;
11129
0
        key->integer = *inactivity_probe;
11130
0
    } else {
11131
0
        datum.n = 0;
11132
0
        datum.keys = NULL;
11133
0
    }
11134
0
    datum.values = NULL;
11135
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_INACTIVITY_PROBE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11136
0
}
11137
11138
/* Sets the "is_connected" column from the "Controller" table in 'row' to
11139
 * 'is_connected'.
11140
 *
11141
 * The caller retains ownership of the arguments. */
11142
void
11143
ovsrec_controller_index_set_is_connected(const struct ovsrec_controller *row, bool is_connected)
11144
0
{
11145
0
    struct ovsdb_datum datum;
11146
11147
0
    datum.refcnt = NULL;
11148
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
11149
11150
0
    datum.n = 1;
11151
0
    datum.keys = key;
11152
0
    key->boolean = is_connected;
11153
0
    datum.values = NULL;
11154
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_IS_CONNECTED ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11155
0
}
11156
11157
/* Sets the "local_gateway" column from the "Controller" table in 'row' to
11158
 * the 'local_gateway' set.
11159
 *
11160
 * If "local_gateway" is null, the column will be the empty set,
11161
 * otherwise it will contain the specified value.
11162
 *
11163
 * The caller retains ownership of the arguments. */
11164
void
11165
ovsrec_controller_index_set_local_gateway(const struct ovsrec_controller *row, const char *local_gateway)
11166
0
{
11167
0
    struct ovsdb_datum datum;
11168
11169
0
    datum.refcnt = NULL;
11170
0
    union ovsdb_atom *key;
11171
11172
0
    if (local_gateway) {
11173
0
        key = xmalloc(sizeof (union ovsdb_atom));
11174
0
        datum.n = 1;
11175
0
        datum.keys = key;
11176
0
        key->s = ovsdb_atom_string_create(local_gateway);
11177
0
    } else {
11178
0
        datum.n = 0;
11179
0
        datum.keys = NULL;
11180
0
    }
11181
0
    datum.values = NULL;
11182
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_LOCAL_GATEWAY ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11183
0
}
11184
11185
/* Sets the "local_ip" column from the "Controller" table in 'row' to
11186
 * the 'local_ip' set.
11187
 *
11188
 * If "local_ip" is null, the column will be the empty set,
11189
 * otherwise it will contain the specified value.
11190
 *
11191
 * The caller retains ownership of the arguments. */
11192
void
11193
ovsrec_controller_index_set_local_ip(const struct ovsrec_controller *row, const char *local_ip)
11194
0
{
11195
0
    struct ovsdb_datum datum;
11196
11197
0
    datum.refcnt = NULL;
11198
0
    union ovsdb_atom *key;
11199
11200
0
    if (local_ip) {
11201
0
        key = xmalloc(sizeof (union ovsdb_atom));
11202
0
        datum.n = 1;
11203
0
        datum.keys = key;
11204
0
        key->s = ovsdb_atom_string_create(local_ip);
11205
0
    } else {
11206
0
        datum.n = 0;
11207
0
        datum.keys = NULL;
11208
0
    }
11209
0
    datum.values = NULL;
11210
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_LOCAL_IP ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11211
0
}
11212
11213
/* Sets the "local_netmask" column from the "Controller" table in 'row' to
11214
 * the 'local_netmask' set.
11215
 *
11216
 * If "local_netmask" is null, the column will be the empty set,
11217
 * otherwise it will contain the specified value.
11218
 *
11219
 * The caller retains ownership of the arguments. */
11220
void
11221
ovsrec_controller_index_set_local_netmask(const struct ovsrec_controller *row, const char *local_netmask)
11222
0
{
11223
0
    struct ovsdb_datum datum;
11224
11225
0
    datum.refcnt = NULL;
11226
0
    union ovsdb_atom *key;
11227
11228
0
    if (local_netmask) {
11229
0
        key = xmalloc(sizeof (union ovsdb_atom));
11230
0
        datum.n = 1;
11231
0
        datum.keys = key;
11232
0
        key->s = ovsdb_atom_string_create(local_netmask);
11233
0
    } else {
11234
0
        datum.n = 0;
11235
0
        datum.keys = NULL;
11236
0
    }
11237
0
    datum.values = NULL;
11238
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_LOCAL_NETMASK ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11239
0
}
11240
11241
/* Sets the "max_backoff" column from the "Controller" table in 'row' to
11242
 * the 'max_backoff' set with 'n_max_backoff' entries.
11243
 *
11244
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
11245
 * may be NULL.
11246
 *
11247
 * Argument constraints: at least 1,000
11248
 *
11249
 * The caller retains ownership of the arguments. */
11250
void
11251
ovsrec_controller_index_set_max_backoff(const struct ovsrec_controller *row, const int64_t *max_backoff, size_t n_max_backoff)
11252
0
{
11253
0
    struct ovsdb_datum datum;
11254
11255
0
    datum.refcnt = NULL;
11256
0
    union ovsdb_atom *key;
11257
11258
0
    if (n_max_backoff) {
11259
0
        key = xmalloc(sizeof(union ovsdb_atom));
11260
0
        datum.n = 1;
11261
0
        datum.keys = key;
11262
0
        key->integer = *max_backoff;
11263
0
    } else {
11264
0
        datum.n = 0;
11265
0
        datum.keys = NULL;
11266
0
    }
11267
0
    datum.values = NULL;
11268
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_MAX_BACKOFF ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11269
0
}
11270
11271
/* Sets the "other_config" column's value from the "Controller" table in 'row'
11272
 * to 'other_config'.
11273
 *
11274
 * The caller retains ownership of 'other_config' and everything in it. */
11275
void
11276
ovsrec_controller_index_set_other_config(const struct ovsrec_controller *row, const struct smap *other_config)
11277
0
{
11278
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
11279
11280
0
    if (other_config) {
11281
0
        struct smap_node *node;
11282
0
        size_t i;
11283
11284
0
        datum->n = smap_count(other_config);
11285
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
11286
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
11287
0
        datum->refcnt = NULL;
11288
11289
0
        i = 0;
11290
0
        SMAP_FOR_EACH (node, other_config) {
11291
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
11292
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
11293
0
            i++;
11294
0
        }
11295
0
        ovsdb_datum_sort_unique(datum, &ovsrec_controller_col_other_config.type);
11296
0
    } else {
11297
0
        ovsdb_datum_init_empty(datum);
11298
0
    }
11299
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
11300
0
                          &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_OTHER_CONFIG],
11301
0
                          datum,
11302
0
                          &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11303
0
    free(datum);
11304
0
}
11305
11306
11307
/* Sets the "role" column from the "Controller" table in 'row' to
11308
 * the 'role' set.
11309
 *
11310
 * If "role" is null, the column will be the empty set,
11311
 * otherwise it will contain the specified value.
11312
 *
11313
 * Argument constraints: one of "master", "other", or "slave"
11314
 *
11315
 * The caller retains ownership of the arguments. */
11316
void
11317
ovsrec_controller_index_set_role(const struct ovsrec_controller *row, const char *role)
11318
0
{
11319
0
    struct ovsdb_datum datum;
11320
11321
0
    datum.refcnt = NULL;
11322
0
    union ovsdb_atom *key;
11323
11324
0
    if (role) {
11325
0
        key = xmalloc(sizeof (union ovsdb_atom));
11326
0
        datum.n = 1;
11327
0
        datum.keys = key;
11328
0
        key->s = ovsdb_atom_string_create(role);
11329
0
    } else {
11330
0
        datum.n = 0;
11331
0
        datum.keys = NULL;
11332
0
    }
11333
0
    datum.values = NULL;
11334
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_ROLE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11335
0
}
11336
11337
/* Sets the "status" column's value from the "Controller" table in 'row'
11338
 * to 'status'.
11339
 *
11340
 * The caller retains ownership of 'status' and everything in it. */
11341
void
11342
ovsrec_controller_index_set_status(const struct ovsrec_controller *row, const struct smap *status)
11343
0
{
11344
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
11345
11346
0
    if (status) {
11347
0
        struct smap_node *node;
11348
0
        size_t i;
11349
11350
0
        datum->n = smap_count(status);
11351
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
11352
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
11353
0
        datum->refcnt = NULL;
11354
11355
0
        i = 0;
11356
0
        SMAP_FOR_EACH (node, status) {
11357
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
11358
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
11359
0
            i++;
11360
0
        }
11361
0
        ovsdb_datum_sort_unique(datum, &ovsrec_controller_col_status.type);
11362
0
    } else {
11363
0
        ovsdb_datum_init_empty(datum);
11364
0
    }
11365
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
11366
0
                          &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_STATUS],
11367
0
                          datum,
11368
0
                          &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11369
0
    free(datum);
11370
0
}
11371
11372
11373
/* Sets the "target" column from the "Controller" table in 'row' to
11374
 * 'target'.
11375
 *
11376
 * The caller retains ownership of the arguments. */
11377
void
11378
ovsrec_controller_index_set_target(const struct ovsrec_controller *row, const char *target)
11379
0
{
11380
0
    struct ovsdb_datum datum;
11381
11382
0
    datum.refcnt = NULL;
11383
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
11384
11385
0
    datum.n = 1;
11386
0
    datum.keys = key;
11387
0
    key->s = ovsdb_atom_string_create(target);
11388
0
    datum.values = NULL;
11389
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_TARGET ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11390
0
}
11391
11392
/* Sets the "type" column from the "Controller" table in 'row' to
11393
 * the 'type' set.
11394
 *
11395
 * If "type" is null, the column will be the empty set,
11396
 * otherwise it will contain the specified value.
11397
 *
11398
 * Argument constraints: either "primary" or "service"
11399
 *
11400
 * The caller retains ownership of the arguments. */
11401
void
11402
ovsrec_controller_index_set_type(const struct ovsrec_controller *row, const char *type)
11403
0
{
11404
0
    struct ovsdb_datum datum;
11405
11406
0
    datum.refcnt = NULL;
11407
0
    union ovsdb_atom *key;
11408
11409
0
    if (type) {
11410
0
        key = xmalloc(sizeof (union ovsdb_atom));
11411
0
        datum.n = 1;
11412
0
        datum.keys = key;
11413
0
        key->s = ovsdb_atom_string_create(type);
11414
0
    } else {
11415
0
        datum.n = 0;
11416
0
        datum.keys = NULL;
11417
0
    }
11418
0
    datum.values = NULL;
11419
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_controller_columns[ OVSREC_CONTROLLER_COL_TYPE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
11420
0
}
11421
11422
struct ovsdb_idl_column ovsrec_controller_columns[OVSREC_CONTROLLER_N_COLUMNS];
11423
11424
unsigned int
11425
ovsrec_controller_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
11426
0
{
11427
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_controller, condition);
11428
0
}
11429
static struct json Controller_col_connection_mode_key_enum_key_strings[2] = {
11430
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "in-band", .count = 2 },
11431
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "out-of-band", .count = 2 },
11432
};
11433
static union ovsdb_atom Controller_col_connection_mode_key_enum_keys[2] = {
11434
    { .s = &Controller_col_connection_mode_key_enum_key_strings[0] },
11435
    { .s = &Controller_col_connection_mode_key_enum_key_strings[1] },
11436
};
11437
static struct ovsdb_datum Controller_col_connection_mode_key_enum = {
11438
    .n = 2,
11439
    .keys = Controller_col_connection_mode_key_enum_keys,
11440
};
11441
static struct json Controller_col_role_key_enum_key_strings[3] = {
11442
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "master", .count = 2 },
11443
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "other", .count = 2 },
11444
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "slave", .count = 2 },
11445
};
11446
static union ovsdb_atom Controller_col_role_key_enum_keys[3] = {
11447
    { .s = &Controller_col_role_key_enum_key_strings[0] },
11448
    { .s = &Controller_col_role_key_enum_key_strings[1] },
11449
    { .s = &Controller_col_role_key_enum_key_strings[2] },
11450
};
11451
static struct ovsdb_datum Controller_col_role_key_enum = {
11452
    .n = 3,
11453
    .keys = Controller_col_role_key_enum_keys,
11454
};
11455
static struct json Controller_col_type_key_enum_key_strings[2] = {
11456
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "primary", .count = 2 },
11457
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "service", .count = 2 },
11458
};
11459
static union ovsdb_atom Controller_col_type_key_enum_keys[2] = {
11460
    { .s = &Controller_col_type_key_enum_key_strings[0] },
11461
    { .s = &Controller_col_type_key_enum_key_strings[1] },
11462
};
11463
static struct ovsdb_datum Controller_col_type_key_enum = {
11464
    .n = 2,
11465
    .keys = Controller_col_type_key_enum_keys,
11466
};
11467
11468
struct ovsdb_idl_column ovsrec_controller_columns[OVSREC_CONTROLLER_N_COLUMNS] = {
11469
    [OVSREC_CONTROLLER_COL_CONNECTION_MODE] = {
11470
         .name = "connection_mode",
11471
         .type = {
11472
            .key = {
11473
               .type = OVSDB_TYPE_STRING,
11474
               .enum_ = &Controller_col_connection_mode_key_enum,
11475
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11476
            },
11477
            .value = OVSDB_BASE_VOID_INIT,
11478
            .n_min = 0,
11479
            .n_max = 1,
11480
         },
11481
         .is_mutable = true,
11482
         .is_synthetic = false,
11483
         .parse = ovsrec_controller_parse_connection_mode,
11484
         .unparse = ovsrec_controller_unparse_connection_mode,
11485
    },
11486
11487
    [OVSREC_CONTROLLER_COL_CONTROLLER_BURST_LIMIT] = {
11488
         .name = "controller_burst_limit",
11489
         .type = {
11490
            .key = {
11491
               .type = OVSDB_TYPE_INTEGER,
11492
               .integer = { .min = INT64_C(25), .max = INT64_MAX },
11493
            },
11494
            .value = OVSDB_BASE_VOID_INIT,
11495
            .n_min = 0,
11496
            .n_max = 1,
11497
         },
11498
         .is_mutable = true,
11499
         .is_synthetic = false,
11500
         .parse = ovsrec_controller_parse_controller_burst_limit,
11501
         .unparse = ovsrec_controller_unparse_controller_burst_limit,
11502
    },
11503
11504
    [OVSREC_CONTROLLER_COL_CONTROLLER_QUEUE_SIZE] = {
11505
         .name = "controller_queue_size",
11506
         .type = {
11507
            .key = {
11508
               .type = OVSDB_TYPE_INTEGER,
11509
               .integer = { .min = INT64_C(1), .max = INT64_C(512) },
11510
            },
11511
            .value = OVSDB_BASE_VOID_INIT,
11512
            .n_min = 0,
11513
            .n_max = 1,
11514
         },
11515
         .is_mutable = true,
11516
         .is_synthetic = false,
11517
         .parse = ovsrec_controller_parse_controller_queue_size,
11518
         .unparse = ovsrec_controller_unparse_controller_queue_size,
11519
    },
11520
11521
    [OVSREC_CONTROLLER_COL_CONTROLLER_RATE_LIMIT] = {
11522
         .name = "controller_rate_limit",
11523
         .type = {
11524
            .key = {
11525
               .type = OVSDB_TYPE_INTEGER,
11526
               .integer = { .min = INT64_C(100), .max = INT64_MAX },
11527
            },
11528
            .value = OVSDB_BASE_VOID_INIT,
11529
            .n_min = 0,
11530
            .n_max = 1,
11531
         },
11532
         .is_mutable = true,
11533
         .is_synthetic = false,
11534
         .parse = ovsrec_controller_parse_controller_rate_limit,
11535
         .unparse = ovsrec_controller_unparse_controller_rate_limit,
11536
    },
11537
11538
    [OVSREC_CONTROLLER_COL_ENABLE_ASYNC_MESSAGES] = {
11539
         .name = "enable_async_messages",
11540
         .type = {
11541
            .key = {
11542
               .type = OVSDB_TYPE_BOOLEAN,
11543
            },
11544
            .value = OVSDB_BASE_VOID_INIT,
11545
            .n_min = 0,
11546
            .n_max = 1,
11547
         },
11548
         .is_mutable = true,
11549
         .is_synthetic = false,
11550
         .parse = ovsrec_controller_parse_enable_async_messages,
11551
         .unparse = ovsrec_controller_unparse_enable_async_messages,
11552
    },
11553
11554
    [OVSREC_CONTROLLER_COL_EXTERNAL_IDS] = {
11555
         .name = "external_ids",
11556
         .type = {
11557
            .key = {
11558
               .type = OVSDB_TYPE_STRING,
11559
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11560
            },
11561
            .value = {
11562
                .type = OVSDB_TYPE_STRING,
11563
                .string = { .minLen = 0, .maxLen = UINT_MAX },
11564
            },
11565
            .n_min = 0,
11566
            .n_max = UINT_MAX,
11567
         },
11568
         .is_mutable = true,
11569
         .is_synthetic = false,
11570
         .parse = ovsrec_controller_parse_external_ids,
11571
         .unparse = ovsrec_controller_unparse_external_ids,
11572
    },
11573
11574
    [OVSREC_CONTROLLER_COL_INACTIVITY_PROBE] = {
11575
         .name = "inactivity_probe",
11576
         .type = {
11577
            .key = {
11578
               .type = OVSDB_TYPE_INTEGER,
11579
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
11580
            },
11581
            .value = OVSDB_BASE_VOID_INIT,
11582
            .n_min = 0,
11583
            .n_max = 1,
11584
         },
11585
         .is_mutable = true,
11586
         .is_synthetic = false,
11587
         .parse = ovsrec_controller_parse_inactivity_probe,
11588
         .unparse = ovsrec_controller_unparse_inactivity_probe,
11589
    },
11590
11591
    [OVSREC_CONTROLLER_COL_IS_CONNECTED] = {
11592
         .name = "is_connected",
11593
         .type = {
11594
            .key = {
11595
               .type = OVSDB_TYPE_BOOLEAN,
11596
            },
11597
            .value = OVSDB_BASE_VOID_INIT,
11598
            .n_min = 1,
11599
            .n_max = 1,
11600
         },
11601
         .is_mutable = true,
11602
         .is_synthetic = false,
11603
         .parse = ovsrec_controller_parse_is_connected,
11604
         .unparse = ovsrec_controller_unparse_is_connected,
11605
    },
11606
11607
    [OVSREC_CONTROLLER_COL_LOCAL_GATEWAY] = {
11608
         .name = "local_gateway",
11609
         .type = {
11610
            .key = {
11611
               .type = OVSDB_TYPE_STRING,
11612
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11613
            },
11614
            .value = OVSDB_BASE_VOID_INIT,
11615
            .n_min = 0,
11616
            .n_max = 1,
11617
         },
11618
         .is_mutable = true,
11619
         .is_synthetic = false,
11620
         .parse = ovsrec_controller_parse_local_gateway,
11621
         .unparse = ovsrec_controller_unparse_local_gateway,
11622
    },
11623
11624
    [OVSREC_CONTROLLER_COL_LOCAL_IP] = {
11625
         .name = "local_ip",
11626
         .type = {
11627
            .key = {
11628
               .type = OVSDB_TYPE_STRING,
11629
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11630
            },
11631
            .value = OVSDB_BASE_VOID_INIT,
11632
            .n_min = 0,
11633
            .n_max = 1,
11634
         },
11635
         .is_mutable = true,
11636
         .is_synthetic = false,
11637
         .parse = ovsrec_controller_parse_local_ip,
11638
         .unparse = ovsrec_controller_unparse_local_ip,
11639
    },
11640
11641
    [OVSREC_CONTROLLER_COL_LOCAL_NETMASK] = {
11642
         .name = "local_netmask",
11643
         .type = {
11644
            .key = {
11645
               .type = OVSDB_TYPE_STRING,
11646
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11647
            },
11648
            .value = OVSDB_BASE_VOID_INIT,
11649
            .n_min = 0,
11650
            .n_max = 1,
11651
         },
11652
         .is_mutable = true,
11653
         .is_synthetic = false,
11654
         .parse = ovsrec_controller_parse_local_netmask,
11655
         .unparse = ovsrec_controller_unparse_local_netmask,
11656
    },
11657
11658
    [OVSREC_CONTROLLER_COL_MAX_BACKOFF] = {
11659
         .name = "max_backoff",
11660
         .type = {
11661
            .key = {
11662
               .type = OVSDB_TYPE_INTEGER,
11663
               .integer = { .min = INT64_C(1000), .max = INT64_MAX },
11664
            },
11665
            .value = OVSDB_BASE_VOID_INIT,
11666
            .n_min = 0,
11667
            .n_max = 1,
11668
         },
11669
         .is_mutable = true,
11670
         .is_synthetic = false,
11671
         .parse = ovsrec_controller_parse_max_backoff,
11672
         .unparse = ovsrec_controller_unparse_max_backoff,
11673
    },
11674
11675
    [OVSREC_CONTROLLER_COL_OTHER_CONFIG] = {
11676
         .name = "other_config",
11677
         .type = {
11678
            .key = {
11679
               .type = OVSDB_TYPE_STRING,
11680
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11681
            },
11682
            .value = {
11683
                .type = OVSDB_TYPE_STRING,
11684
                .string = { .minLen = 0, .maxLen = UINT_MAX },
11685
            },
11686
            .n_min = 0,
11687
            .n_max = UINT_MAX,
11688
         },
11689
         .is_mutable = true,
11690
         .is_synthetic = false,
11691
         .parse = ovsrec_controller_parse_other_config,
11692
         .unparse = ovsrec_controller_unparse_other_config,
11693
    },
11694
11695
    [OVSREC_CONTROLLER_COL_ROLE] = {
11696
         .name = "role",
11697
         .type = {
11698
            .key = {
11699
               .type = OVSDB_TYPE_STRING,
11700
               .enum_ = &Controller_col_role_key_enum,
11701
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11702
            },
11703
            .value = OVSDB_BASE_VOID_INIT,
11704
            .n_min = 0,
11705
            .n_max = 1,
11706
         },
11707
         .is_mutable = true,
11708
         .is_synthetic = false,
11709
         .parse = ovsrec_controller_parse_role,
11710
         .unparse = ovsrec_controller_unparse_role,
11711
    },
11712
11713
    [OVSREC_CONTROLLER_COL_STATUS] = {
11714
         .name = "status",
11715
         .type = {
11716
            .key = {
11717
               .type = OVSDB_TYPE_STRING,
11718
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11719
            },
11720
            .value = {
11721
                .type = OVSDB_TYPE_STRING,
11722
                .string = { .minLen = 0, .maxLen = UINT_MAX },
11723
            },
11724
            .n_min = 0,
11725
            .n_max = UINT_MAX,
11726
         },
11727
         .is_mutable = true,
11728
         .is_synthetic = false,
11729
         .parse = ovsrec_controller_parse_status,
11730
         .unparse = ovsrec_controller_unparse_status,
11731
    },
11732
11733
    [OVSREC_CONTROLLER_COL_TARGET] = {
11734
         .name = "target",
11735
         .type = {
11736
            .key = {
11737
               .type = OVSDB_TYPE_STRING,
11738
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11739
            },
11740
            .value = OVSDB_BASE_VOID_INIT,
11741
            .n_min = 1,
11742
            .n_max = 1,
11743
         },
11744
         .is_mutable = true,
11745
         .is_synthetic = false,
11746
         .parse = ovsrec_controller_parse_target,
11747
         .unparse = ovsrec_controller_unparse_target,
11748
    },
11749
11750
    [OVSREC_CONTROLLER_COL_TYPE] = {
11751
         .name = "type",
11752
         .type = {
11753
            .key = {
11754
               .type = OVSDB_TYPE_STRING,
11755
               .enum_ = &Controller_col_type_key_enum,
11756
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11757
            },
11758
            .value = OVSDB_BASE_VOID_INIT,
11759
            .n_min = 0,
11760
            .n_max = 1,
11761
         },
11762
         .is_mutable = true,
11763
         .is_synthetic = false,
11764
         .parse = ovsrec_controller_parse_type,
11765
         .unparse = ovsrec_controller_unparse_type,
11766
    },
11767
11768
};
11769

11770
/* Datapath table. */
11771
11772
bool
11773
ovsrec_server_has_datapath_table_col_capabilities(const struct ovsdb_idl *idl)
11774
0
{
11775
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_datapath_col_capabilities);
11776
0
}
11777
11778
const struct ovsdb_type *
11779
ovsrec_datapath_capabilities_server_type(const struct ovsdb_idl *idl)
11780
0
{
11781
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_datapath_col_capabilities);
11782
0
}
11783
11784
11785
bool
11786
ovsrec_server_has_datapath_table_col_ct_zone_default_limit(const struct ovsdb_idl *idl)
11787
0
{
11788
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_datapath_col_ct_zone_default_limit);
11789
0
}
11790
11791
const struct ovsdb_type *
11792
ovsrec_datapath_ct_zone_default_limit_server_type(const struct ovsdb_idl *idl)
11793
0
{
11794
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_datapath_col_ct_zone_default_limit);
11795
0
}
11796
11797
11798
bool
11799
ovsrec_server_has_datapath_table_col_ct_zones(const struct ovsdb_idl *idl)
11800
0
{
11801
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_datapath_col_ct_zones);
11802
0
}
11803
11804
const struct ovsdb_type *
11805
ovsrec_datapath_ct_zones_server_type(const struct ovsdb_idl *idl)
11806
0
{
11807
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_datapath_col_ct_zones);
11808
0
}
11809
11810
11811
bool
11812
ovsrec_server_has_datapath_table_col_datapath_version(const struct ovsdb_idl *idl)
11813
0
{
11814
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_datapath_col_datapath_version);
11815
0
}
11816
11817
const struct ovsdb_type *
11818
ovsrec_datapath_datapath_version_server_type(const struct ovsdb_idl *idl)
11819
0
{
11820
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_datapath_col_datapath_version);
11821
0
}
11822
11823
11824
bool
11825
ovsrec_server_has_datapath_table_col_external_ids(const struct ovsdb_idl *idl)
11826
0
{
11827
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_datapath_col_external_ids);
11828
0
}
11829
11830
const struct ovsdb_type *
11831
ovsrec_datapath_external_ids_server_type(const struct ovsdb_idl *idl)
11832
0
{
11833
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_datapath_col_external_ids);
11834
0
}
11835
11836
11837
bool
11838
ovsrec_server_has_datapath_table(const struct ovsdb_idl *idl)
11839
0
{
11840
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_DATAPATH]);
11841
0
}
11842
11843
11844
const struct ovsrec_datapath_table *
11845
ovsrec_datapath_table_get(const struct ovsdb_idl *idl)
11846
0
{
11847
0
    return (const struct ovsrec_datapath_table *) idl;
11848
0
}
11849
11850
const struct ovsrec_datapath *
11851
ovsrec_datapath_table_first(const struct ovsrec_datapath_table *table)
11852
0
{
11853
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
11854
0
    return ovsrec_datapath_first(idl);
11855
0
}
11856
11857
11858
const struct ovsrec_datapath *
11859
ovsrec_datapath_table_track_get_first(const struct ovsrec_datapath_table *table)
11860
0
{
11861
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
11862
0
    return ovsrec_datapath_track_get_first(idl);
11863
0
}
11864
11865
11866
static void
11867
ovsrec_datapath_parse_capabilities(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
11868
0
{
11869
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11870
0
    smap_init(&row->capabilities);
11871
0
    for (size_t i = 0; i < datum->n; i++) {
11872
0
        smap_add(&row->capabilities,
11873
0
                 json_string(datum->keys[i].s),
11874
0
                 json_string(datum->values[i].s));
11875
0
    }
11876
0
}
11877
11878
static void
11879
ovsrec_datapath_parse_ct_zone_default_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
11880
0
{
11881
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11882
0
    size_t n = MIN(1, datum->n);
11883
0
    row->ct_zone_default_limit = NULL;
11884
0
    row->n_ct_zone_default_limit = 0;
11885
0
    for (size_t i = 0; i < n; i++) {
11886
0
        if (!row->n_ct_zone_default_limit) {
11887
0
            row->ct_zone_default_limit = xmalloc(n * sizeof *row->ct_zone_default_limit);
11888
0
        }
11889
0
        row->ct_zone_default_limit[row->n_ct_zone_default_limit] = datum->keys[i].integer;
11890
0
        row->n_ct_zone_default_limit++;
11891
0
    }
11892
0
}
11893
11894
static void
11895
ovsrec_datapath_parse_ct_zones(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
11896
0
{
11897
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11898
0
    row->key_ct_zones = NULL;
11899
0
    row->value_ct_zones = NULL;
11900
0
    row->n_ct_zones = 0;
11901
0
    for (size_t i = 0; i < datum->n; i++) {
11902
0
        struct ovsrec_ct_zone *valueRow = ovsrec_ct_zone_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_ct_zone, &datum->values[i].uuid));
11903
0
        if (!valueRow) {
11904
0
            continue;
11905
0
        }
11906
0
        if (!row->n_ct_zones) {
11907
0
            row->key_ct_zones = xmalloc(datum->n * sizeof *row->key_ct_zones);
11908
0
            row->value_ct_zones = xmalloc(datum->n * sizeof *row->value_ct_zones);
11909
0
        }
11910
0
        row->key_ct_zones[row->n_ct_zones] = datum->keys[i].integer;
11911
0
        row->value_ct_zones[row->n_ct_zones] = valueRow;
11912
0
        row->n_ct_zones++;
11913
0
    }
11914
0
}
11915
11916
static void
11917
ovsrec_datapath_parse_datapath_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
11918
0
{
11919
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11920
11921
0
    if (datum->n >= 1) {
11922
0
        row->datapath_version = CONST_CAST(char *, json_string(datum->keys[0].s));
11923
0
    } else {
11924
0
        row->datapath_version = "";
11925
0
    }
11926
0
}
11927
11928
static void
11929
ovsrec_datapath_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
11930
0
{
11931
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11932
0
    smap_init(&row->external_ids);
11933
0
    for (size_t i = 0; i < datum->n; i++) {
11934
0
        smap_add(&row->external_ids,
11935
0
                 json_string(datum->keys[i].s),
11936
0
                 json_string(datum->values[i].s));
11937
0
    }
11938
0
}
11939
11940
static void
11941
ovsrec_datapath_unparse_capabilities(struct ovsdb_idl_row *row_)
11942
0
{
11943
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11944
0
    smap_destroy(&row->capabilities);
11945
0
}
11946
11947
static void
11948
ovsrec_datapath_unparse_ct_zone_default_limit(struct ovsdb_idl_row *row_)
11949
0
{
11950
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11951
0
    free(row->ct_zone_default_limit);
11952
0
}
11953
11954
static void
11955
ovsrec_datapath_unparse_ct_zones(struct ovsdb_idl_row *row_)
11956
0
{
11957
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11958
0
    free(row->key_ct_zones);
11959
0
    free(row->value_ct_zones);
11960
0
}
11961
11962
static void
11963
ovsrec_datapath_unparse_datapath_version(struct ovsdb_idl_row *row OVS_UNUSED)
11964
0
{
11965
    /* Nothing to do. */
11966
0
}
11967
11968
static void
11969
ovsrec_datapath_unparse_external_ids(struct ovsdb_idl_row *row_)
11970
0
{
11971
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11972
0
    smap_destroy(&row->external_ids);
11973
0
}
11974
11975
static void
11976
ovsrec_datapath_init__(struct ovsdb_idl_row *row)
11977
0
{
11978
0
    ovsrec_datapath_init(ovsrec_datapath_cast(row));
11979
0
}
11980
11981
/* Clears the contents of 'row' in table "Datapath". */
11982
void
11983
ovsrec_datapath_init(struct ovsrec_datapath *row)
11984
0
{
11985
0
    memset(row, 0, sizeof *row); 
11986
0
    smap_init(&row->capabilities);
11987
0
    row->datapath_version = "";
11988
0
    smap_init(&row->external_ids);
11989
0
}
11990
11991
/* Searches table "Datapath" in 'idl' for a row with UUID 'uuid'.  Returns
11992
 * a pointer to the row if there is one, otherwise a null pointer.  */
11993
const struct ovsrec_datapath *
11994
ovsrec_datapath_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
11995
0
{
11996
0
    return ovsrec_datapath_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_datapath, uuid));
11997
0
}
11998
11999
/* Searches table "Datapath" for a row with UUID 'uuid'.  Returns
12000
 * a pointer to the row if there is one, otherwise a null pointer.  */
12001
const struct ovsrec_datapath *
12002
ovsrec_datapath_table_get_for_uuid(const struct ovsrec_datapath_table *table, const struct uuid *uuid)
12003
0
{
12004
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
12005
0
    return ovsrec_datapath_get_for_uuid(idl, uuid);
12006
0
}
12007
12008
/* Returns a row in table "Datapath" in 'idl', or a null pointer if that
12009
 * table is empty.
12010
 *
12011
 * Database tables are internally maintained as hash tables, so adding or
12012
 * removing rows while traversing the same table can cause some rows to be
12013
 * visited twice or not at apply. */
12014
const struct ovsrec_datapath *
12015
ovsrec_datapath_first(const struct ovsdb_idl *idl)
12016
0
{
12017
0
    return ovsrec_datapath_cast(ovsdb_idl_first_row(idl, &ovsrec_table_datapath));
12018
0
}
12019
12020
/* Returns a row following 'row' within its table, or a null pointer if 'row'
12021
 * is the last row in its table. */
12022
const struct ovsrec_datapath *
12023
ovsrec_datapath_next(const struct ovsrec_datapath *row)
12024
0
{
12025
0
    return ovsrec_datapath_cast(ovsdb_idl_next_row(&row->header_));
12026
0
}
12027
12028
unsigned int ovsrec_datapath_get_seqno(const struct ovsdb_idl *idl)
12029
0
{
12030
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_datapath);
12031
0
}
12032
12033
unsigned int ovsrec_datapath_row_get_seqno(const struct ovsrec_datapath *row, enum ovsdb_idl_change change)
12034
0
{
12035
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
12036
0
}
12037
12038
const struct ovsrec_datapath *
12039
ovsrec_datapath_track_get_first(const struct ovsdb_idl *idl)
12040
0
{
12041
0
    return ovsrec_datapath_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_datapath));
12042
0
}
12043
12044
const struct ovsrec_datapath
12045
*ovsrec_datapath_track_get_next(const struct ovsrec_datapath *row)
12046
0
{
12047
0
    return ovsrec_datapath_cast(ovsdb_idl_track_get_next(&row->header_));
12048
0
}
12049
12050
12051
/* Deletes 'row' from table "Datapath".  'row' may be freed, so it must not be
12052
 * accessed afterward.
12053
 *
12054
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12055
void
12056
ovsrec_datapath_delete(const struct ovsrec_datapath *row)
12057
0
{
12058
0
    ovsdb_idl_txn_delete(&row->header_);
12059
0
}
12060
12061
/* Inserts and returns a new row in the table "Datapath" in the database
12062
 * with open transaction 'txn'.
12063
 *
12064
 * The new row is assigned a randomly generated provisional UUID.
12065
 * ovsdb-server will assign a different UUID when 'txn' is committed,
12066
 * but the IDL will replace any uses of the provisional UUID in the
12067
 * data to be to be committed by the UUID assigned by ovsdb-server. */
12068
struct ovsrec_datapath *
12069
ovsrec_datapath_insert(struct ovsdb_idl_txn *txn)
12070
0
{
12071
0
    return ovsrec_datapath_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_datapath, NULL));
12072
0
}
12073
12074
/* Inserts and returns a new row in the table "Datapath" in the database
12075
 * with open transaction 'txn'.
12076
 *
12077
 * The new row is assigned the UUID specified in the 'uuid' parameter
12078
 * (which cannot be null).  ovsdb-server will try to assign the same
12079
 * UUID when 'txn' is committed. */
12080
struct ovsrec_datapath *
12081
ovsrec_datapath_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
12082
0
{
12083
0
    return ovsrec_datapath_cast(ovsdb_idl_txn_insert_persist_uuid(
12084
0
        txn, &ovsrec_table_datapath, uuid));
12085
0
}
12086
12087
bool
12088
ovsrec_datapath_is_updated(const struct ovsrec_datapath *row, enum ovsrec_datapath_column_id column)
12089
0
{
12090
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_datapath_columns[column]);
12091
0
}
12092
12093
/* Causes the original contents of column "capabilities" in 'row' to be
12094
 * verified as a prerequisite to completing the transaction.  That is, if
12095
 * "capabilities" in 'row' changed (or if 'row' was deleted) between the
12096
 * time that the IDL originally read its contents and the time that the
12097
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
12098
 *
12099
 * The intention is that, to ensure that no transaction commits based on dirty
12100
 * reads, an application should call this function any time "capabilities" is
12101
 * read as part of a read-modify-write operation.
12102
 *
12103
 * In some cases this function reduces to a no-op, because the current value
12104
 * of "capabilities" is already known:
12105
 *
12106
 *   - If 'row' is a row created by the current transaction (returned by
12107
 *     ovsrec_datapath_insert()).
12108
 *
12109
 *   - If "capabilities" has already been modified (with
12110
 *     ovsrec_datapath_set_capabilities()) within the current transaction.
12111
 *
12112
 * Because of the latter property, always call this function *before*
12113
 * ovsrec_datapath_set_capabilities() for a given read-modify-write.
12114
 *
12115
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12116
void
12117
ovsrec_datapath_verify_capabilities(const struct ovsrec_datapath *row)
12118
0
{
12119
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_datapath_col_capabilities);
12120
0
}
12121
12122
/* Causes the original contents of column "ct_zone_default_limit" in 'row' to be
12123
 * verified as a prerequisite to completing the transaction.  That is, if
12124
 * "ct_zone_default_limit" in 'row' changed (or if 'row' was deleted) between the
12125
 * time that the IDL originally read its contents and the time that the
12126
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
12127
 *
12128
 * The intention is that, to ensure that no transaction commits based on dirty
12129
 * reads, an application should call this function any time "ct_zone_default_limit" is
12130
 * read as part of a read-modify-write operation.
12131
 *
12132
 * In some cases this function reduces to a no-op, because the current value
12133
 * of "ct_zone_default_limit" is already known:
12134
 *
12135
 *   - If 'row' is a row created by the current transaction (returned by
12136
 *     ovsrec_datapath_insert()).
12137
 *
12138
 *   - If "ct_zone_default_limit" has already been modified (with
12139
 *     ovsrec_datapath_set_ct_zone_default_limit()) within the current transaction.
12140
 *
12141
 * Because of the latter property, always call this function *before*
12142
 * ovsrec_datapath_set_ct_zone_default_limit() for a given read-modify-write.
12143
 *
12144
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12145
void
12146
ovsrec_datapath_verify_ct_zone_default_limit(const struct ovsrec_datapath *row)
12147
0
{
12148
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_datapath_col_ct_zone_default_limit);
12149
0
}
12150
12151
/* Causes the original contents of column "ct_zones" in 'row' to be
12152
 * verified as a prerequisite to completing the transaction.  That is, if
12153
 * "ct_zones" in 'row' changed (or if 'row' was deleted) between the
12154
 * time that the IDL originally read its contents and the time that the
12155
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
12156
 *
12157
 * The intention is that, to ensure that no transaction commits based on dirty
12158
 * reads, an application should call this function any time "ct_zones" is
12159
 * read as part of a read-modify-write operation.
12160
 *
12161
 * In some cases this function reduces to a no-op, because the current value
12162
 * of "ct_zones" is already known:
12163
 *
12164
 *   - If 'row' is a row created by the current transaction (returned by
12165
 *     ovsrec_datapath_insert()).
12166
 *
12167
 *   - If "ct_zones" has already been modified (with
12168
 *     ovsrec_datapath_set_ct_zones()) within the current transaction.
12169
 *
12170
 * Because of the latter property, always call this function *before*
12171
 * ovsrec_datapath_set_ct_zones() for a given read-modify-write.
12172
 *
12173
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12174
void
12175
ovsrec_datapath_verify_ct_zones(const struct ovsrec_datapath *row)
12176
0
{
12177
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_datapath_col_ct_zones);
12178
0
}
12179
12180
/* Causes the original contents of column "datapath_version" in 'row' to be
12181
 * verified as a prerequisite to completing the transaction.  That is, if
12182
 * "datapath_version" in 'row' changed (or if 'row' was deleted) between the
12183
 * time that the IDL originally read its contents and the time that the
12184
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
12185
 *
12186
 * The intention is that, to ensure that no transaction commits based on dirty
12187
 * reads, an application should call this function any time "datapath_version" is
12188
 * read as part of a read-modify-write operation.
12189
 *
12190
 * In some cases this function reduces to a no-op, because the current value
12191
 * of "datapath_version" is already known:
12192
 *
12193
 *   - If 'row' is a row created by the current transaction (returned by
12194
 *     ovsrec_datapath_insert()).
12195
 *
12196
 *   - If "datapath_version" has already been modified (with
12197
 *     ovsrec_datapath_set_datapath_version()) within the current transaction.
12198
 *
12199
 * Because of the latter property, always call this function *before*
12200
 * ovsrec_datapath_set_datapath_version() for a given read-modify-write.
12201
 *
12202
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12203
void
12204
ovsrec_datapath_verify_datapath_version(const struct ovsrec_datapath *row)
12205
0
{
12206
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_datapath_col_datapath_version);
12207
0
}
12208
12209
/* Causes the original contents of column "external_ids" in 'row' to be
12210
 * verified as a prerequisite to completing the transaction.  That is, if
12211
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
12212
 * time that the IDL originally read its contents and the time that the
12213
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
12214
 *
12215
 * The intention is that, to ensure that no transaction commits based on dirty
12216
 * reads, an application should call this function any time "external_ids" is
12217
 * read as part of a read-modify-write operation.
12218
 *
12219
 * In some cases this function reduces to a no-op, because the current value
12220
 * of "external_ids" is already known:
12221
 *
12222
 *   - If 'row' is a row created by the current transaction (returned by
12223
 *     ovsrec_datapath_insert()).
12224
 *
12225
 *   - If "external_ids" has already been modified (with
12226
 *     ovsrec_datapath_set_external_ids()) within the current transaction.
12227
 *
12228
 * Because of the latter property, always call this function *before*
12229
 * ovsrec_datapath_set_external_ids() for a given read-modify-write.
12230
 *
12231
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12232
void
12233
ovsrec_datapath_verify_external_ids(const struct ovsrec_datapath *row)
12234
0
{
12235
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_datapath_col_external_ids);
12236
0
}
12237
12238
/* Returns the "capabilities" column's value from the "Datapath" table in 'row'
12239
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
12240
 * ovsdb_datum_find_key() is an easier and more efficient way to search
12241
 * for a given key than implementing the same operation on the "cooked"
12242
 * form in 'row'.
12243
 *
12244
 * 'key_type' must be OVSDB_TYPE_STRING.
12245
 * 'value_type' must be OVSDB_TYPE_STRING.
12246
 * (This helps to avoid silent bugs if someone changes capabilities's
12247
 * type without updating the caller.)
12248
 *
12249
 * The caller must not modify or free the returned value.
12250
 *
12251
 * Various kinds of changes can invalidate the returned value: modifying
12252
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12253
 * If the returned value is needed for a long time, it is best to make a copy
12254
 * of it with ovsdb_datum_clone().
12255
 *
12256
 * This function is rarely useful, since it is easier to access the value
12257
 * directly through the "capabilities" member in ovsrec_datapath. */
12258
const struct ovsdb_datum *
12259
ovsrec_datapath_get_capabilities(const struct ovsrec_datapath *row,
12260
  enum ovsdb_atomic_type key_type OVS_UNUSED,
12261
  enum ovsdb_atomic_type value_type OVS_UNUSED)
12262
0
{
12263
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
12264
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
12265
0
    return ovsdb_idl_read(&row->header_, &ovsrec_datapath_col_capabilities);
12266
0
}
12267
12268
/* Returns the "ct_zone_default_limit" column's value from the "Datapath" table in 'row'
12269
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
12270
 * ovsdb_datum_find_key() is an easier and more efficient way to search
12271
 * for a given key than implementing the same operation on the "cooked"
12272
 * form in 'row'.
12273
 *
12274
 * 'key_type' must be OVSDB_TYPE_INTEGER.
12275
 * (This helps to avoid silent bugs if someone changes ct_zone_default_limit's
12276
 * type without updating the caller.)
12277
 *
12278
 * The caller must not modify or free the returned value.
12279
 *
12280
 * Various kinds of changes can invalidate the returned value: modifying
12281
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12282
 * If the returned value is needed for a long time, it is best to make a copy
12283
 * of it with ovsdb_datum_clone().
12284
 *
12285
 * This function is rarely useful, since it is easier to access the value
12286
 * directly through the "ct_zone_default_limit" member in ovsrec_datapath. */
12287
const struct ovsdb_datum *
12288
ovsrec_datapath_get_ct_zone_default_limit(const struct ovsrec_datapath *row,
12289
  enum ovsdb_atomic_type key_type OVS_UNUSED)
12290
0
{
12291
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
12292
0
    return ovsdb_idl_read(&row->header_, &ovsrec_datapath_col_ct_zone_default_limit);
12293
0
}
12294
12295
/* Returns the "ct_zones" column's value from the "Datapath" table in 'row'
12296
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
12297
 * ovsdb_datum_find_key() is an easier and more efficient way to search
12298
 * for a given key than implementing the same operation on the "cooked"
12299
 * form in 'row'.
12300
 *
12301
 * 'key_type' must be OVSDB_TYPE_INTEGER.
12302
 * 'value_type' must be OVSDB_TYPE_UUID.
12303
 * (This helps to avoid silent bugs if someone changes ct_zones's
12304
 * type without updating the caller.)
12305
 *
12306
 * The caller must not modify or free the returned value.
12307
 *
12308
 * Various kinds of changes can invalidate the returned value: modifying
12309
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12310
 * If the returned value is needed for a long time, it is best to make a copy
12311
 * of it with ovsdb_datum_clone().
12312
 *
12313
 * This function is rarely useful, since it is easier to access the value
12314
 * directly through the "ct_zones" member in ovsrec_datapath. */
12315
const struct ovsdb_datum *
12316
ovsrec_datapath_get_ct_zones(const struct ovsrec_datapath *row,
12317
  enum ovsdb_atomic_type key_type OVS_UNUSED,
12318
  enum ovsdb_atomic_type value_type OVS_UNUSED)
12319
0
{
12320
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
12321
0
    ovs_assert(value_type == OVSDB_TYPE_UUID);
12322
0
    return ovsdb_idl_read(&row->header_, &ovsrec_datapath_col_ct_zones);
12323
0
}
12324
12325
/* Returns the "datapath_version" column's value from the "Datapath" table in 'row'
12326
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
12327
 * ovsdb_datum_find_key() is an easier and more efficient way to search
12328
 * for a given key than implementing the same operation on the "cooked"
12329
 * form in 'row'.
12330
 *
12331
 * 'key_type' must be OVSDB_TYPE_STRING.
12332
 * (This helps to avoid silent bugs if someone changes datapath_version's
12333
 * type without updating the caller.)
12334
 *
12335
 * The caller must not modify or free the returned value.
12336
 *
12337
 * Various kinds of changes can invalidate the returned value: modifying
12338
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12339
 * If the returned value is needed for a long time, it is best to make a copy
12340
 * of it with ovsdb_datum_clone().
12341
 *
12342
 * This function is rarely useful, since it is easier to access the value
12343
 * directly through the "datapath_version" member in ovsrec_datapath. */
12344
const struct ovsdb_datum *
12345
ovsrec_datapath_get_datapath_version(const struct ovsrec_datapath *row,
12346
  enum ovsdb_atomic_type key_type OVS_UNUSED)
12347
0
{
12348
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
12349
0
    return ovsdb_idl_read(&row->header_, &ovsrec_datapath_col_datapath_version);
12350
0
}
12351
12352
/* Returns the "external_ids" column's value from the "Datapath" table in 'row'
12353
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
12354
 * ovsdb_datum_find_key() is an easier and more efficient way to search
12355
 * for a given key than implementing the same operation on the "cooked"
12356
 * form in 'row'.
12357
 *
12358
 * 'key_type' must be OVSDB_TYPE_STRING.
12359
 * 'value_type' must be OVSDB_TYPE_STRING.
12360
 * (This helps to avoid silent bugs if someone changes external_ids's
12361
 * type without updating the caller.)
12362
 *
12363
 * The caller must not modify or free the returned value.
12364
 *
12365
 * Various kinds of changes can invalidate the returned value: modifying
12366
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12367
 * If the returned value is needed for a long time, it is best to make a copy
12368
 * of it with ovsdb_datum_clone().
12369
 *
12370
 * This function is rarely useful, since it is easier to access the value
12371
 * directly through the "external_ids" member in ovsrec_datapath. */
12372
const struct ovsdb_datum *
12373
ovsrec_datapath_get_external_ids(const struct ovsrec_datapath *row,
12374
  enum ovsdb_atomic_type key_type OVS_UNUSED,
12375
  enum ovsdb_atomic_type value_type OVS_UNUSED)
12376
0
{
12377
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
12378
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
12379
0
    return ovsdb_idl_read(&row->header_, &ovsrec_datapath_col_external_ids);
12380
0
}
12381
12382
/* Sets the "capabilities" column's value from the "Datapath" table in 'row'
12383
 * to 'capabilities'.
12384
 *
12385
 * The caller retains ownership of 'capabilities' and everything in it. */
12386
void
12387
ovsrec_datapath_set_capabilities(const struct ovsrec_datapath *row, const struct smap *capabilities)
12388
0
{
12389
0
    struct ovsdb_datum datum;
12390
12391
0
    if (capabilities) {
12392
0
        ovsdb_datum_from_smap(&datum, capabilities);
12393
0
    } else {
12394
0
        ovsdb_datum_init_empty(&datum);
12395
0
    }
12396
0
    ovsdb_idl_txn_write(&row->header_,
12397
0
                        &ovsrec_datapath_col_capabilities,
12398
0
                        &datum);
12399
0
}
12400
12401
12402
/* Sets the "ct_zone_default_limit" column from the "Datapath" table in 'row' to
12403
 * the 'ct_zone_default_limit' set with 'n_ct_zone_default_limit' entries.
12404
 *
12405
 * 'n_ct_zone_default_limit' may be 0 or 1; if it is 0, then 'ct_zone_default_limit'
12406
 * may be NULL.
12407
 *
12408
 * Argument constraints: in range 0 to 4,294,967,295
12409
 *
12410
 * The caller retains ownership of the arguments. */
12411
void
12412
ovsrec_datapath_set_ct_zone_default_limit(const struct ovsrec_datapath *row, const int64_t *ct_zone_default_limit, size_t n_ct_zone_default_limit)
12413
0
{
12414
0
    struct ovsdb_datum datum;
12415
12416
0
    datum.refcnt = NULL;
12417
12418
0
    if (n_ct_zone_default_limit) {
12419
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
12420
0
        datum.n = 1;
12421
0
        datum.keys = key;
12422
0
        key->integer = *ct_zone_default_limit;
12423
0
    } else {
12424
0
        datum.n = 0;
12425
0
        datum.keys = NULL;
12426
0
    }
12427
0
    datum.values = NULL;
12428
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_datapath_col_ct_zone_default_limit, &datum);
12429
0
}
12430
12431
/* Sets the "ct_zones" column from the "Datapath" table in 'row' to
12432
 * the map with keys 'key_ct_zones' and values 'value_ct_zones'
12433
 * with 'n_ct_zones' entries.
12434
 *
12435
 * Argument constraints: key in range 0 to 65,535
12436
 *
12437
 * The caller retains ownership of the arguments. */
12438
void
12439
ovsrec_datapath_set_ct_zones(const struct ovsrec_datapath *row, const int64_t *key_ct_zones, struct ovsrec_ct_zone **value_ct_zones, size_t n_ct_zones)
12440
0
{
12441
0
    struct ovsdb_datum datum;
12442
12443
0
    datum.refcnt = NULL;
12444
12445
0
    datum.n = n_ct_zones;
12446
0
    datum.keys = n_ct_zones ? xmalloc(n_ct_zones * sizeof *datum.keys) : NULL;
12447
0
    datum.values = xmalloc(n_ct_zones * sizeof *datum.values);
12448
0
    for (size_t i = 0; i < n_ct_zones; i++) {
12449
0
        datum.keys[i].integer = key_ct_zones[i];
12450
0
        datum.values[i].uuid = value_ct_zones[i]->header_.uuid;
12451
0
    }
12452
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_datapath_col_ct_zones, &datum);
12453
0
}
12454
12455
/* Sets the "datapath_version" column from the "Datapath" table in 'row' to
12456
 * 'datapath_version'.
12457
 *
12458
 * The caller retains ownership of the arguments. */
12459
void
12460
ovsrec_datapath_set_datapath_version(const struct ovsrec_datapath *row, const char *datapath_version)
12461
0
{
12462
0
    struct ovsdb_datum datum;
12463
12464
0
    datum.refcnt = NULL;
12465
12466
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
12467
12468
0
    datum.n = 1;
12469
0
    datum.keys = key;
12470
0
    key->s = ovsdb_atom_string_create(datapath_version);
12471
0
    datum.values = NULL;
12472
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_datapath_col_datapath_version, &datum);
12473
0
}
12474
12475
/* Sets the "external_ids" column's value from the "Datapath" table in 'row'
12476
 * to 'external_ids'.
12477
 *
12478
 * The caller retains ownership of 'external_ids' and everything in it. */
12479
void
12480
ovsrec_datapath_set_external_ids(const struct ovsrec_datapath *row, const struct smap *external_ids)
12481
0
{
12482
0
    struct ovsdb_datum datum;
12483
12484
0
    if (external_ids) {
12485
0
        ovsdb_datum_from_smap(&datum, external_ids);
12486
0
    } else {
12487
0
        ovsdb_datum_init_empty(&datum);
12488
0
    }
12489
0
    ovsdb_idl_txn_write(&row->header_,
12490
0
                        &ovsrec_datapath_col_external_ids,
12491
0
                        &datum);
12492
0
}
12493
12494
12495
/* Sets an element of the "capabilities" map column from the "Datapath" table in 'row'
12496
 * to 'new_value' given the key value 'new_key'.
12497
 *
12498
 */
12499
void
12500
ovsrec_datapath_update_capabilities_setkey(const struct ovsrec_datapath *row, const char *new_key, const char *new_value)
12501
0
{
12502
0
    struct ovsdb_datum *datum;
12503
12504
0
    datum = xmalloc(sizeof *datum);
12505
0
    datum->n = 1;
12506
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12507
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
12508
0
    datum->refcnt = NULL;
12509
12510
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
12511
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
12512
12513
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
12514
0
                                    &ovsrec_datapath_col_capabilities,
12515
0
                                    datum);
12516
0
}
12517
12518
/* Deletes an element of the "capabilities" map column from the "Datapath" table in 'row'
12519
 * given the key value 'delete_key'.
12520
 *
12521
 */
12522
void
12523
ovsrec_datapath_update_capabilities_delkey(const struct ovsrec_datapath *row, const char *delete_key)
12524
0
{
12525
0
    struct ovsdb_datum *datum;
12526
12527
0
    datum = xmalloc(sizeof *datum);
12528
0
    datum->n = 1;
12529
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12530
0
    datum->values = NULL;
12531
0
    datum->refcnt = NULL;
12532
12533
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
12534
12535
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
12536
0
                                    &ovsrec_datapath_col_capabilities,
12537
0
                                    datum);
12538
0
}
12539
12540
/* Adds the value 'new_value' to the "ct_zone_default_limit" set column from the "Datapath" table
12541
 * in 'row'.
12542
 *
12543
 */
12544
void
12545
ovsrec_datapath_update_ct_zone_default_limit_addvalue(const struct ovsrec_datapath *row, int64_t new_value)
12546
0
{
12547
0
    struct ovsdb_datum *datum;
12548
12549
0
    datum = xmalloc(sizeof *datum);
12550
0
    datum->n = 1;
12551
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
12552
0
    datum->values = NULL;
12553
0
    datum->refcnt = NULL;
12554
12555
0
    datum->keys[0].integer = new_value;
12556
12557
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
12558
0
                                    &ovsrec_datapath_col_ct_zone_default_limit,
12559
0
                                    datum);
12560
0
}
12561
12562
/* Deletes the value 'delete_value' from the "ct_zone_default_limit" set column from the
12563
 * "Datapath" table in 'row'.
12564
 *
12565
 */
12566
void
12567
ovsrec_datapath_update_ct_zone_default_limit_delvalue(const struct ovsrec_datapath *row, int64_t delete_value)
12568
0
{
12569
0
    struct ovsdb_datum *datum;
12570
12571
0
    datum = xmalloc(sizeof *datum);
12572
0
    datum->n = 1;
12573
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
12574
0
    datum->values = NULL;
12575
0
    datum->refcnt = NULL;
12576
12577
0
    datum->keys[0].integer = delete_value;
12578
12579
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
12580
0
                                    &ovsrec_datapath_col_ct_zone_default_limit,
12581
0
                                    datum);
12582
0
}
12583
12584
/* Sets an element of the "ct_zones" map column from the "Datapath" table in 'row'
12585
 * to 'new_value' given the key value 'new_key'.
12586
 *
12587
 */
12588
void
12589
ovsrec_datapath_update_ct_zones_setkey(const struct ovsrec_datapath *row, int64_t new_key, const struct ovsrec_ct_zone *new_value)
12590
0
{
12591
0
    struct ovsdb_datum *datum;
12592
12593
0
    datum = xmalloc(sizeof *datum);
12594
0
    datum->n = 1;
12595
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12596
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
12597
0
    datum->refcnt = NULL;
12598
12599
0
    datum->keys[0].integer = new_key;
12600
0
    datum->values[0].uuid = new_value->header_.uuid;
12601
12602
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
12603
0
                                    &ovsrec_datapath_col_ct_zones,
12604
0
                                    datum);
12605
0
}
12606
12607
/* Deletes an element of the "ct_zones" map column from the "Datapath" table in 'row'
12608
 * given the key value 'delete_key'.
12609
 *
12610
 */
12611
void
12612
ovsrec_datapath_update_ct_zones_delkey(const struct ovsrec_datapath *row, int64_t delete_key)
12613
0
{
12614
0
    struct ovsdb_datum *datum;
12615
12616
0
    datum = xmalloc(sizeof *datum);
12617
0
    datum->n = 1;
12618
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12619
0
    datum->values = NULL;
12620
0
    datum->refcnt = NULL;
12621
12622
0
    datum->keys[0].integer = delete_key;
12623
12624
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
12625
0
                                    &ovsrec_datapath_col_ct_zones,
12626
0
                                    datum);
12627
0
}
12628
12629
/* Sets an element of the "external_ids" map column from the "Datapath" table in 'row'
12630
 * to 'new_value' given the key value 'new_key'.
12631
 *
12632
 */
12633
void
12634
ovsrec_datapath_update_external_ids_setkey(const struct ovsrec_datapath *row, const char *new_key, const char *new_value)
12635
0
{
12636
0
    struct ovsdb_datum *datum;
12637
12638
0
    datum = xmalloc(sizeof *datum);
12639
0
    datum->n = 1;
12640
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12641
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
12642
0
    datum->refcnt = NULL;
12643
12644
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
12645
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
12646
12647
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
12648
0
                                    &ovsrec_datapath_col_external_ids,
12649
0
                                    datum);
12650
0
}
12651
12652
/* Deletes an element of the "external_ids" map column from the "Datapath" table in 'row'
12653
 * given the key value 'delete_key'.
12654
 *
12655
 */
12656
void
12657
ovsrec_datapath_update_external_ids_delkey(const struct ovsrec_datapath *row, const char *delete_key)
12658
0
{
12659
0
    struct ovsdb_datum *datum;
12660
12661
0
    datum = xmalloc(sizeof *datum);
12662
0
    datum->n = 1;
12663
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12664
0
    datum->values = NULL;
12665
0
    datum->refcnt = NULL;
12666
12667
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
12668
12669
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
12670
0
                                    &ovsrec_datapath_col_external_ids,
12671
0
                                    datum);
12672
0
}
12673
12674
/* Sets the "capabilities" column's value from the "Datapath" table in 'row'
12675
 * to 'capabilities'.
12676
 *
12677
 * The caller retains ownership of 'capabilities' and everything in it. */
12678
void
12679
ovsrec_datapath_add_clause_capabilities(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *capabilities)
12680
0
{
12681
0
    struct ovsdb_datum datum;
12682
12683
0
    if (capabilities) {
12684
0
        ovsdb_datum_from_smap(&datum, capabilities);
12685
0
    } else {
12686
0
        ovsdb_datum_init_empty(&datum);
12687
0
    }
12688
12689
0
    ovsdb_idl_condition_add_clause(cond,
12690
0
                                   function,
12691
0
                                   &ovsrec_datapath_col_capabilities,
12692
0
                                   &datum);
12693
12694
0
    ovsdb_datum_destroy(&datum, &ovsrec_datapath_col_capabilities.type);
12695
0
}
12696
12697
12698
/* Sets the "ct_zone_default_limit" column from the "Datapath" table in 'row' to
12699
 * the 'ct_zone_default_limit' set with 'n_ct_zone_default_limit' entries.
12700
 *
12701
 * 'n_ct_zone_default_limit' may be 0 or 1; if it is 0, then 'ct_zone_default_limit'
12702
 * may be NULL.
12703
 *
12704
 * Argument constraints: in range 0 to 4,294,967,295
12705
 *
12706
 * The caller retains ownership of the arguments. */
12707
void
12708
ovsrec_datapath_add_clause_ct_zone_default_limit(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *ct_zone_default_limit, size_t n_ct_zone_default_limit)
12709
0
{
12710
0
    struct ovsdb_datum datum;
12711
12712
0
    datum.refcnt = NULL;
12713
12714
0
    if (n_ct_zone_default_limit) {
12715
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
12716
0
        datum.n = 1;
12717
0
        datum.keys = key;
12718
0
        key->integer = *ct_zone_default_limit;
12719
0
    } else {
12720
0
        datum.n = 0;
12721
0
        datum.keys = NULL;
12722
0
    }
12723
0
    datum.values = NULL;
12724
0
    ovsdb_idl_condition_add_clause(cond,
12725
0
                          function,
12726
0
                          &ovsrec_datapath_col_ct_zone_default_limit,
12727
0
                          &datum);
12728
0
    ovsdb_datum_destroy(&datum, &ovsrec_datapath_col_ct_zone_default_limit.type);
12729
0
}
12730
12731
/* Sets the "ct_zones" column from the "Datapath" table in 'row' to
12732
 * the map with keys 'key_ct_zones' and values 'value_ct_zones'
12733
 * with 'n_ct_zones' entries.
12734
 *
12735
 * Argument constraints: key in range 0 to 65,535
12736
 *
12737
 * The caller retains ownership of the arguments. */
12738
void
12739
ovsrec_datapath_add_clause_ct_zones(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *key_ct_zones, struct uuid **value_ct_zones, size_t n_ct_zones)
12740
0
{
12741
0
    struct ovsdb_datum datum;
12742
12743
0
    datum.refcnt = NULL;
12744
0
    datum.n = n_ct_zones;
12745
0
    datum.keys = n_ct_zones ? xmalloc(n_ct_zones * sizeof *datum.keys) : NULL;
12746
0
    datum.values = xmalloc(n_ct_zones * sizeof *datum.values);
12747
0
    for (size_t i = 0; i < n_ct_zones; i++) {
12748
0
        datum.keys[i].integer = key_ct_zones[i];
12749
0
        datum.values[i].uuid = *value_ct_zones[i];
12750
0
    }
12751
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_datapath_col_ct_zones.type);
12752
0
    ovsdb_idl_condition_add_clause(cond,
12753
0
                          function,
12754
0
                          &ovsrec_datapath_col_ct_zones,
12755
0
                          &datum);
12756
0
    ovsdb_datum_destroy(&datum, &ovsrec_datapath_col_ct_zones.type);
12757
0
}
12758
12759
/* Sets the "datapath_version" column from the "Datapath" table in 'row' to
12760
 * 'datapath_version'.
12761
 *
12762
 * The caller retains ownership of the arguments. */
12763
void
12764
ovsrec_datapath_add_clause_datapath_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *datapath_version)
12765
0
{
12766
0
    struct ovsdb_datum datum;
12767
12768
0
    datum.refcnt = NULL;
12769
12770
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
12771
12772
0
    datum.n = 1;
12773
0
    datum.keys = key;
12774
0
    key->s = ovsdb_atom_string_create(datapath_version);
12775
0
    datum.values = NULL;
12776
0
    ovsdb_idl_condition_add_clause(cond,
12777
0
                          function,
12778
0
                          &ovsrec_datapath_col_datapath_version,
12779
0
                          &datum);
12780
0
    ovsdb_datum_destroy(&datum, &ovsrec_datapath_col_datapath_version.type);
12781
0
}
12782
12783
/* Sets the "external_ids" column's value from the "Datapath" table in 'row'
12784
 * to 'external_ids'.
12785
 *
12786
 * The caller retains ownership of 'external_ids' and everything in it. */
12787
void
12788
ovsrec_datapath_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
12789
0
{
12790
0
    struct ovsdb_datum datum;
12791
12792
0
    if (external_ids) {
12793
0
        ovsdb_datum_from_smap(&datum, external_ids);
12794
0
    } else {
12795
0
        ovsdb_datum_init_empty(&datum);
12796
0
    }
12797
12798
0
    ovsdb_idl_condition_add_clause(cond,
12799
0
                                   function,
12800
0
                                   &ovsrec_datapath_col_external_ids,
12801
0
                                   &datum);
12802
12803
0
    ovsdb_datum_destroy(&datum, &ovsrec_datapath_col_external_ids.type);
12804
0
}
12805
12806
12807
/* Destroy 'row' of kind "Datapath". The row must have been
12808
 * created with ovsdb_idl_index_init_row.
12809
 */
12810
void
12811
ovsrec_datapath_index_destroy_row(const struct ovsrec_datapath *row)
12812
0
{
12813
0
    ovsdb_idl_index_destroy_row(&row->header_);
12814
0
}
12815
        
12816
12817
/* Creates a new row of kind "Datapath". */
12818
struct ovsrec_datapath *
12819
ovsrec_datapath_index_init_row(struct ovsdb_idl_index *index)
12820
0
{
12821
0
    ovs_assert(index->table->class_ == &ovsrec_table_datapath);
12822
0
    return ALIGNED_CAST(struct ovsrec_datapath *, ovsdb_idl_index_init_row(index));
12823
0
}
12824
12825
struct ovsrec_datapath *
12826
ovsrec_datapath_index_find(struct ovsdb_idl_index *index, const struct ovsrec_datapath *target)
12827
0
{
12828
0
    ovs_assert(index->table->class_ == &ovsrec_table_datapath);
12829
0
    return ovsrec_datapath_cast(ovsdb_idl_index_find(index, &target->header_));
12830
0
}
12831
12832
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
12833
int
12834
ovsrec_datapath_index_compare(
12835
    struct ovsdb_idl_index *index, 
12836
    const struct ovsrec_datapath *a, 
12837
    const struct ovsrec_datapath *b)
12838
0
{
12839
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
12840
0
}
12841
12842
struct ovsdb_idl_cursor
12843
ovsrec_datapath_cursor_first(struct ovsdb_idl_index *index)
12844
0
{
12845
0
    ovs_assert(index->table->class_ == &ovsrec_table_datapath);
12846
0
    return ovsdb_idl_cursor_first(index);
12847
0
}
12848
12849
struct ovsdb_idl_cursor
12850
ovsrec_datapath_cursor_first_eq(
12851
    struct ovsdb_idl_index *index, const struct ovsrec_datapath *target)
12852
0
{
12853
0
    ovs_assert(index->table->class_ == &ovsrec_table_datapath);
12854
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
12855
0
}
12856
12857
struct ovsdb_idl_cursor
12858
ovsrec_datapath_cursor_first_ge(
12859
    struct ovsdb_idl_index *index, const struct ovsrec_datapath *target)
12860
0
{
12861
0
    ovs_assert(index->table->class_ == &ovsrec_table_datapath);
12862
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
12863
0
}
12864
12865
struct ovsrec_datapath *
12866
ovsrec_datapath_cursor_data(struct ovsdb_idl_cursor *cursor)
12867
0
{
12868
0
    return ovsrec_datapath_cast(ovsdb_idl_cursor_data(cursor));
12869
0
}
12870
12871
12872
/* Sets the "capabilities" column's value from the "Datapath" table in 'row'
12873
 * to 'capabilities'.
12874
 *
12875
 * The caller retains ownership of 'capabilities' and everything in it. */
12876
void
12877
ovsrec_datapath_index_set_capabilities(const struct ovsrec_datapath *row, const struct smap *capabilities)
12878
0
{
12879
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
12880
12881
0
    if (capabilities) {
12882
0
        struct smap_node *node;
12883
0
        size_t i;
12884
12885
0
        datum->n = smap_count(capabilities);
12886
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12887
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
12888
0
        datum->refcnt = NULL;
12889
12890
0
        i = 0;
12891
0
        SMAP_FOR_EACH (node, capabilities) {
12892
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
12893
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
12894
0
            i++;
12895
0
        }
12896
0
        ovsdb_datum_sort_unique(datum, &ovsrec_datapath_col_capabilities.type);
12897
0
    } else {
12898
0
        ovsdb_datum_init_empty(datum);
12899
0
    }
12900
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
12901
0
                          &ovsrec_datapath_columns[OVSREC_DATAPATH_COL_CAPABILITIES],
12902
0
                          datum,
12903
0
                          &ovsrec_table_classes[OVSREC_TABLE_DATAPATH]);
12904
0
    free(datum);
12905
0
}
12906
12907
12908
/* Sets the "ct_zone_default_limit" column from the "Datapath" table in 'row' to
12909
 * the 'ct_zone_default_limit' set with 'n_ct_zone_default_limit' entries.
12910
 *
12911
 * 'n_ct_zone_default_limit' may be 0 or 1; if it is 0, then 'ct_zone_default_limit'
12912
 * may be NULL.
12913
 *
12914
 * Argument constraints: in range 0 to 4,294,967,295
12915
 *
12916
 * The caller retains ownership of the arguments. */
12917
void
12918
ovsrec_datapath_index_set_ct_zone_default_limit(const struct ovsrec_datapath *row, const int64_t *ct_zone_default_limit, size_t n_ct_zone_default_limit)
12919
0
{
12920
0
    struct ovsdb_datum datum;
12921
12922
0
    datum.refcnt = NULL;
12923
0
    union ovsdb_atom *key;
12924
12925
0
    if (n_ct_zone_default_limit) {
12926
0
        key = xmalloc(sizeof(union ovsdb_atom));
12927
0
        datum.n = 1;
12928
0
        datum.keys = key;
12929
0
        key->integer = *ct_zone_default_limit;
12930
0
    } else {
12931
0
        datum.n = 0;
12932
0
        datum.keys = NULL;
12933
0
    }
12934
0
    datum.values = NULL;
12935
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_datapath_columns[ OVSREC_DATAPATH_COL_CT_ZONE_DEFAULT_LIMIT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_DATAPATH]);
12936
0
}
12937
12938
/* Sets the "ct_zones" column from the "Datapath" table in 'row' to
12939
 * the map with keys 'key_ct_zones' and values 'value_ct_zones'
12940
 * with 'n_ct_zones' entries.
12941
 *
12942
 * Argument constraints: key in range 0 to 65,535
12943
 *
12944
 * The caller retains ownership of the arguments. */
12945
void
12946
ovsrec_datapath_index_set_ct_zones(const struct ovsrec_datapath *row, const int64_t *key_ct_zones, struct ovsrec_ct_zone **value_ct_zones, size_t n_ct_zones)
12947
0
{
12948
0
    struct ovsdb_datum datum;
12949
12950
0
    datum.refcnt = NULL;
12951
0
    size_t i;
12952
12953
0
    datum.n = n_ct_zones;
12954
0
    datum.keys = n_ct_zones ? xmalloc(n_ct_zones * sizeof *datum.keys) : NULL;
12955
0
    datum.values = xmalloc(n_ct_zones * sizeof *datum.values);
12956
0
    for (i = 0; i < n_ct_zones; i++) {
12957
0
        datum.keys[i].integer = key_ct_zones[i];
12958
0
        datum.values[i].uuid = value_ct_zones[i]->header_.uuid;
12959
0
    }
12960
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_datapath_col_ct_zones.type);
12961
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_datapath_columns[ OVSREC_DATAPATH_COL_CT_ZONES ], &datum, &ovsrec_table_classes[OVSREC_TABLE_DATAPATH]);
12962
0
}
12963
12964
/* Sets the "datapath_version" column from the "Datapath" table in 'row' to
12965
 * 'datapath_version'.
12966
 *
12967
 * The caller retains ownership of the arguments. */
12968
void
12969
ovsrec_datapath_index_set_datapath_version(const struct ovsrec_datapath *row, const char *datapath_version)
12970
0
{
12971
0
    struct ovsdb_datum datum;
12972
12973
0
    datum.refcnt = NULL;
12974
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
12975
12976
0
    datum.n = 1;
12977
0
    datum.keys = key;
12978
0
    key->s = ovsdb_atom_string_create(datapath_version);
12979
0
    datum.values = NULL;
12980
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_datapath_columns[ OVSREC_DATAPATH_COL_DATAPATH_VERSION ], &datum, &ovsrec_table_classes[OVSREC_TABLE_DATAPATH]);
12981
0
}
12982
12983
/* Sets the "external_ids" column's value from the "Datapath" table in 'row'
12984
 * to 'external_ids'.
12985
 *
12986
 * The caller retains ownership of 'external_ids' and everything in it. */
12987
void
12988
ovsrec_datapath_index_set_external_ids(const struct ovsrec_datapath *row, const struct smap *external_ids)
12989
0
{
12990
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
12991
12992
0
    if (external_ids) {
12993
0
        struct smap_node *node;
12994
0
        size_t i;
12995
12996
0
        datum->n = smap_count(external_ids);
12997
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12998
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
12999
0
        datum->refcnt = NULL;
13000
13001
0
        i = 0;
13002
0
        SMAP_FOR_EACH (node, external_ids) {
13003
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
13004
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
13005
0
            i++;
13006
0
        }
13007
0
        ovsdb_datum_sort_unique(datum, &ovsrec_datapath_col_external_ids.type);
13008
0
    } else {
13009
0
        ovsdb_datum_init_empty(datum);
13010
0
    }
13011
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
13012
0
                          &ovsrec_datapath_columns[OVSREC_DATAPATH_COL_EXTERNAL_IDS],
13013
0
                          datum,
13014
0
                          &ovsrec_table_classes[OVSREC_TABLE_DATAPATH]);
13015
0
    free(datum);
13016
0
}
13017
13018
13019
struct ovsdb_idl_column ovsrec_datapath_columns[OVSREC_DATAPATH_N_COLUMNS];
13020
13021
unsigned int
13022
ovsrec_datapath_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
13023
0
{
13024
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_datapath, condition);
13025
0
}
13026
13027
struct ovsdb_idl_column ovsrec_datapath_columns[OVSREC_DATAPATH_N_COLUMNS] = {
13028
    [OVSREC_DATAPATH_COL_CAPABILITIES] = {
13029
         .name = "capabilities",
13030
         .type = {
13031
            .key = {
13032
               .type = OVSDB_TYPE_STRING,
13033
               .string = { .minLen = 0, .maxLen = UINT_MAX },
13034
            },
13035
            .value = {
13036
                .type = OVSDB_TYPE_STRING,
13037
                .string = { .minLen = 0, .maxLen = UINT_MAX },
13038
            },
13039
            .n_min = 0,
13040
            .n_max = UINT_MAX,
13041
         },
13042
         .is_mutable = true,
13043
         .is_synthetic = false,
13044
         .parse = ovsrec_datapath_parse_capabilities,
13045
         .unparse = ovsrec_datapath_unparse_capabilities,
13046
    },
13047
13048
    [OVSREC_DATAPATH_COL_CT_ZONE_DEFAULT_LIMIT] = {
13049
         .name = "ct_zone_default_limit",
13050
         .type = {
13051
            .key = {
13052
               .type = OVSDB_TYPE_INTEGER,
13053
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
13054
            },
13055
            .value = OVSDB_BASE_VOID_INIT,
13056
            .n_min = 0,
13057
            .n_max = 1,
13058
         },
13059
         .is_mutable = true,
13060
         .is_synthetic = false,
13061
         .parse = ovsrec_datapath_parse_ct_zone_default_limit,
13062
         .unparse = ovsrec_datapath_unparse_ct_zone_default_limit,
13063
    },
13064
13065
    [OVSREC_DATAPATH_COL_CT_ZONES] = {
13066
         .name = "ct_zones",
13067
         .type = {
13068
            .key = {
13069
               .type = OVSDB_TYPE_INTEGER,
13070
               .integer = { .min = INT64_C(0), .max = INT64_C(65535) },
13071
            },
13072
            .value = {
13073
                .type = OVSDB_TYPE_UUID,
13074
                .uuid = { .refTableName = "CT_Zone", .refType = OVSDB_REF_STRONG },
13075
            },
13076
            .n_min = 0,
13077
            .n_max = UINT_MAX,
13078
         },
13079
         .is_mutable = true,
13080
         .is_synthetic = false,
13081
         .parse = ovsrec_datapath_parse_ct_zones,
13082
         .unparse = ovsrec_datapath_unparse_ct_zones,
13083
    },
13084
13085
    [OVSREC_DATAPATH_COL_DATAPATH_VERSION] = {
13086
         .name = "datapath_version",
13087
         .type = {
13088
            .key = {
13089
               .type = OVSDB_TYPE_STRING,
13090
               .string = { .minLen = 0, .maxLen = UINT_MAX },
13091
            },
13092
            .value = OVSDB_BASE_VOID_INIT,
13093
            .n_min = 1,
13094
            .n_max = 1,
13095
         },
13096
         .is_mutable = true,
13097
         .is_synthetic = false,
13098
         .parse = ovsrec_datapath_parse_datapath_version,
13099
         .unparse = ovsrec_datapath_unparse_datapath_version,
13100
    },
13101
13102
    [OVSREC_DATAPATH_COL_EXTERNAL_IDS] = {
13103
         .name = "external_ids",
13104
         .type = {
13105
            .key = {
13106
               .type = OVSDB_TYPE_STRING,
13107
               .string = { .minLen = 0, .maxLen = UINT_MAX },
13108
            },
13109
            .value = {
13110
                .type = OVSDB_TYPE_STRING,
13111
                .string = { .minLen = 0, .maxLen = UINT_MAX },
13112
            },
13113
            .n_min = 0,
13114
            .n_max = UINT_MAX,
13115
         },
13116
         .is_mutable = true,
13117
         .is_synthetic = false,
13118
         .parse = ovsrec_datapath_parse_external_ids,
13119
         .unparse = ovsrec_datapath_unparse_external_ids,
13120
    },
13121
13122
};
13123

13124
/* Flow_Sample_Collector_Set table. */
13125
13126
bool
13127
ovsrec_server_has_flow_sample_collector_set_table_col_bridge(const struct ovsdb_idl *idl)
13128
0
{
13129
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_sample_collector_set_col_bridge);
13130
0
}
13131
13132
const struct ovsdb_type *
13133
ovsrec_flow_sample_collector_set_bridge_server_type(const struct ovsdb_idl *idl)
13134
0
{
13135
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_sample_collector_set_col_bridge);
13136
0
}
13137
13138
13139
bool
13140
ovsrec_server_has_flow_sample_collector_set_table_col_external_ids(const struct ovsdb_idl *idl)
13141
0
{
13142
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_sample_collector_set_col_external_ids);
13143
0
}
13144
13145
const struct ovsdb_type *
13146
ovsrec_flow_sample_collector_set_external_ids_server_type(const struct ovsdb_idl *idl)
13147
0
{
13148
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_sample_collector_set_col_external_ids);
13149
0
}
13150
13151
13152
bool
13153
ovsrec_server_has_flow_sample_collector_set_table_col_id(const struct ovsdb_idl *idl)
13154
0
{
13155
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_sample_collector_set_col_id);
13156
0
}
13157
13158
const struct ovsdb_type *
13159
ovsrec_flow_sample_collector_set_id_server_type(const struct ovsdb_idl *idl)
13160
0
{
13161
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_sample_collector_set_col_id);
13162
0
}
13163
13164
13165
bool
13166
ovsrec_server_has_flow_sample_collector_set_table_col_ipfix(const struct ovsdb_idl *idl)
13167
0
{
13168
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_sample_collector_set_col_ipfix);
13169
0
}
13170
13171
const struct ovsdb_type *
13172
ovsrec_flow_sample_collector_set_ipfix_server_type(const struct ovsdb_idl *idl)
13173
0
{
13174
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_sample_collector_set_col_ipfix);
13175
0
}
13176
13177
13178
bool
13179
ovsrec_server_has_flow_sample_collector_set_table_col_local_group_id(const struct ovsdb_idl *idl)
13180
0
{
13181
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_sample_collector_set_col_local_group_id);
13182
0
}
13183
13184
const struct ovsdb_type *
13185
ovsrec_flow_sample_collector_set_local_group_id_server_type(const struct ovsdb_idl *idl)
13186
0
{
13187
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_sample_collector_set_col_local_group_id);
13188
0
}
13189
13190
13191
bool
13192
ovsrec_server_has_flow_sample_collector_set_table(const struct ovsdb_idl *idl)
13193
0
{
13194
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET]);
13195
0
}
13196
13197
13198
const struct ovsrec_flow_sample_collector_set_table *
13199
ovsrec_flow_sample_collector_set_table_get(const struct ovsdb_idl *idl)
13200
0
{
13201
0
    return (const struct ovsrec_flow_sample_collector_set_table *) idl;
13202
0
}
13203
13204
const struct ovsrec_flow_sample_collector_set *
13205
ovsrec_flow_sample_collector_set_table_first(const struct ovsrec_flow_sample_collector_set_table *table)
13206
0
{
13207
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
13208
0
    return ovsrec_flow_sample_collector_set_first(idl);
13209
0
}
13210
13211
13212
const struct ovsrec_flow_sample_collector_set *
13213
ovsrec_flow_sample_collector_set_table_track_get_first(const struct ovsrec_flow_sample_collector_set_table *table)
13214
0
{
13215
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
13216
0
    return ovsrec_flow_sample_collector_set_track_get_first(idl);
13217
0
}
13218
13219
13220
static void
13221
ovsrec_flow_sample_collector_set_parse_bridge(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13222
0
{
13223
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
13224
13225
0
    if (datum->n >= 1) {
13226
0
        row->bridge = ovsrec_bridge_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_bridge, &datum->keys[0].uuid));
13227
0
    } else {
13228
0
        row->bridge = NULL;
13229
0
    }
13230
0
}
13231
13232
static void
13233
ovsrec_flow_sample_collector_set_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13234
0
{
13235
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
13236
0
    smap_init(&row->external_ids);
13237
0
    for (size_t i = 0; i < datum->n; i++) {
13238
0
        smap_add(&row->external_ids,
13239
0
                 json_string(datum->keys[i].s),
13240
0
                 json_string(datum->values[i].s));
13241
0
    }
13242
0
}
13243
13244
static void
13245
ovsrec_flow_sample_collector_set_parse_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13246
0
{
13247
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
13248
13249
0
    if (datum->n >= 1) {
13250
0
        row->id = datum->keys[0].integer;
13251
0
    } else {
13252
0
        row->id = 0;
13253
0
    }
13254
0
}
13255
13256
static void
13257
ovsrec_flow_sample_collector_set_parse_ipfix(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13258
0
{
13259
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
13260
13261
0
    if (datum->n >= 1) {
13262
0
        row->ipfix = ovsrec_ipfix_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_ipfix, &datum->keys[0].uuid));
13263
0
    } else {
13264
0
        row->ipfix = NULL;
13265
0
    }
13266
0
}
13267
13268
static void
13269
ovsrec_flow_sample_collector_set_parse_local_group_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13270
0
{
13271
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
13272
0
    size_t n = MIN(1, datum->n);
13273
0
    row->local_group_id = NULL;
13274
0
    row->n_local_group_id = 0;
13275
0
    for (size_t i = 0; i < n; i++) {
13276
0
        if (!row->n_local_group_id) {
13277
0
            row->local_group_id = xmalloc(n * sizeof *row->local_group_id);
13278
0
        }
13279
0
        row->local_group_id[row->n_local_group_id] = datum->keys[i].integer;
13280
0
        row->n_local_group_id++;
13281
0
    }
13282
0
}
13283
13284
static void
13285
ovsrec_flow_sample_collector_set_unparse_bridge(struct ovsdb_idl_row *row OVS_UNUSED)
13286
0
{
13287
    /* Nothing to do. */
13288
0
}
13289
13290
static void
13291
ovsrec_flow_sample_collector_set_unparse_external_ids(struct ovsdb_idl_row *row_)
13292
0
{
13293
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
13294
0
    smap_destroy(&row->external_ids);
13295
0
}
13296
13297
static void
13298
ovsrec_flow_sample_collector_set_unparse_id(struct ovsdb_idl_row *row OVS_UNUSED)
13299
0
{
13300
    /* Nothing to do. */
13301
0
}
13302
13303
static void
13304
ovsrec_flow_sample_collector_set_unparse_ipfix(struct ovsdb_idl_row *row OVS_UNUSED)
13305
0
{
13306
    /* Nothing to do. */
13307
0
}
13308
13309
static void
13310
ovsrec_flow_sample_collector_set_unparse_local_group_id(struct ovsdb_idl_row *row_)
13311
0
{
13312
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
13313
0
    free(row->local_group_id);
13314
0
}
13315
13316
static void
13317
ovsrec_flow_sample_collector_set_init__(struct ovsdb_idl_row *row)
13318
0
{
13319
0
    ovsrec_flow_sample_collector_set_init(ovsrec_flow_sample_collector_set_cast(row));
13320
0
}
13321
13322
/* Clears the contents of 'row' in table "Flow_Sample_Collector_Set". */
13323
void
13324
ovsrec_flow_sample_collector_set_init(struct ovsrec_flow_sample_collector_set *row)
13325
0
{
13326
0
    memset(row, 0, sizeof *row); 
13327
0
    smap_init(&row->external_ids);
13328
0
}
13329
13330
/* Searches table "Flow_Sample_Collector_Set" in 'idl' for a row with UUID 'uuid'.  Returns
13331
 * a pointer to the row if there is one, otherwise a null pointer.  */
13332
const struct ovsrec_flow_sample_collector_set *
13333
ovsrec_flow_sample_collector_set_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
13334
0
{
13335
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_flow_sample_collector_set, uuid));
13336
0
}
13337
13338
/* Searches table "Flow_Sample_Collector_Set" for a row with UUID 'uuid'.  Returns
13339
 * a pointer to the row if there is one, otherwise a null pointer.  */
13340
const struct ovsrec_flow_sample_collector_set *
13341
ovsrec_flow_sample_collector_set_table_get_for_uuid(const struct ovsrec_flow_sample_collector_set_table *table, const struct uuid *uuid)
13342
0
{
13343
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
13344
0
    return ovsrec_flow_sample_collector_set_get_for_uuid(idl, uuid);
13345
0
}
13346
13347
/* Returns a row in table "Flow_Sample_Collector_Set" in 'idl', or a null pointer if that
13348
 * table is empty.
13349
 *
13350
 * Database tables are internally maintained as hash tables, so adding or
13351
 * removing rows while traversing the same table can cause some rows to be
13352
 * visited twice or not at apply. */
13353
const struct ovsrec_flow_sample_collector_set *
13354
ovsrec_flow_sample_collector_set_first(const struct ovsdb_idl *idl)
13355
0
{
13356
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_first_row(idl, &ovsrec_table_flow_sample_collector_set));
13357
0
}
13358
13359
/* Returns a row following 'row' within its table, or a null pointer if 'row'
13360
 * is the last row in its table. */
13361
const struct ovsrec_flow_sample_collector_set *
13362
ovsrec_flow_sample_collector_set_next(const struct ovsrec_flow_sample_collector_set *row)
13363
0
{
13364
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_next_row(&row->header_));
13365
0
}
13366
13367
unsigned int ovsrec_flow_sample_collector_set_get_seqno(const struct ovsdb_idl *idl)
13368
0
{
13369
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_flow_sample_collector_set);
13370
0
}
13371
13372
unsigned int ovsrec_flow_sample_collector_set_row_get_seqno(const struct ovsrec_flow_sample_collector_set *row, enum ovsdb_idl_change change)
13373
0
{
13374
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
13375
0
}
13376
13377
const struct ovsrec_flow_sample_collector_set *
13378
ovsrec_flow_sample_collector_set_track_get_first(const struct ovsdb_idl *idl)
13379
0
{
13380
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_flow_sample_collector_set));
13381
0
}
13382
13383
const struct ovsrec_flow_sample_collector_set
13384
*ovsrec_flow_sample_collector_set_track_get_next(const struct ovsrec_flow_sample_collector_set *row)
13385
0
{
13386
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_track_get_next(&row->header_));
13387
0
}
13388
13389
13390
/* Deletes 'row' from table "Flow_Sample_Collector_Set".  'row' may be freed, so it must not be
13391
 * accessed afterward.
13392
 *
13393
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13394
void
13395
ovsrec_flow_sample_collector_set_delete(const struct ovsrec_flow_sample_collector_set *row)
13396
0
{
13397
0
    ovsdb_idl_txn_delete(&row->header_);
13398
0
}
13399
13400
/* Inserts and returns a new row in the table "Flow_Sample_Collector_Set" in the database
13401
 * with open transaction 'txn'.
13402
 *
13403
 * The new row is assigned a randomly generated provisional UUID.
13404
 * ovsdb-server will assign a different UUID when 'txn' is committed,
13405
 * but the IDL will replace any uses of the provisional UUID in the
13406
 * data to be to be committed by the UUID assigned by ovsdb-server. */
13407
struct ovsrec_flow_sample_collector_set *
13408
ovsrec_flow_sample_collector_set_insert(struct ovsdb_idl_txn *txn)
13409
0
{
13410
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_flow_sample_collector_set, NULL));
13411
0
}
13412
13413
/* Inserts and returns a new row in the table "Flow_Sample_Collector_Set" in the database
13414
 * with open transaction 'txn'.
13415
 *
13416
 * The new row is assigned the UUID specified in the 'uuid' parameter
13417
 * (which cannot be null).  ovsdb-server will try to assign the same
13418
 * UUID when 'txn' is committed. */
13419
struct ovsrec_flow_sample_collector_set *
13420
ovsrec_flow_sample_collector_set_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
13421
0
{
13422
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_txn_insert_persist_uuid(
13423
0
        txn, &ovsrec_table_flow_sample_collector_set, uuid));
13424
0
}
13425
13426
bool
13427
ovsrec_flow_sample_collector_set_is_updated(const struct ovsrec_flow_sample_collector_set *row, enum ovsrec_flow_sample_collector_set_column_id column)
13428
0
{
13429
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_flow_sample_collector_set_columns[column]);
13430
0
}
13431
13432
/* Causes the original contents of column "bridge" in 'row' to be
13433
 * verified as a prerequisite to completing the transaction.  That is, if
13434
 * "bridge" in 'row' changed (or if 'row' was deleted) between the
13435
 * time that the IDL originally read its contents and the time that the
13436
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13437
 *
13438
 * The intention is that, to ensure that no transaction commits based on dirty
13439
 * reads, an application should call this function any time "bridge" is
13440
 * read as part of a read-modify-write operation.
13441
 *
13442
 * In some cases this function reduces to a no-op, because the current value
13443
 * of "bridge" is already known:
13444
 *
13445
 *   - If 'row' is a row created by the current transaction (returned by
13446
 *     ovsrec_flow_sample_collector_set_insert()).
13447
 *
13448
 *   - If "bridge" has already been modified (with
13449
 *     ovsrec_flow_sample_collector_set_set_bridge()) within the current transaction.
13450
 *
13451
 * Because of the latter property, always call this function *before*
13452
 * ovsrec_flow_sample_collector_set_set_bridge() for a given read-modify-write.
13453
 *
13454
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13455
void
13456
ovsrec_flow_sample_collector_set_verify_bridge(const struct ovsrec_flow_sample_collector_set *row)
13457
0
{
13458
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_col_bridge);
13459
0
}
13460
13461
/* Causes the original contents of column "external_ids" in 'row' to be
13462
 * verified as a prerequisite to completing the transaction.  That is, if
13463
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
13464
 * time that the IDL originally read its contents and the time that the
13465
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13466
 *
13467
 * The intention is that, to ensure that no transaction commits based on dirty
13468
 * reads, an application should call this function any time "external_ids" is
13469
 * read as part of a read-modify-write operation.
13470
 *
13471
 * In some cases this function reduces to a no-op, because the current value
13472
 * of "external_ids" is already known:
13473
 *
13474
 *   - If 'row' is a row created by the current transaction (returned by
13475
 *     ovsrec_flow_sample_collector_set_insert()).
13476
 *
13477
 *   - If "external_ids" has already been modified (with
13478
 *     ovsrec_flow_sample_collector_set_set_external_ids()) within the current transaction.
13479
 *
13480
 * Because of the latter property, always call this function *before*
13481
 * ovsrec_flow_sample_collector_set_set_external_ids() for a given read-modify-write.
13482
 *
13483
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13484
void
13485
ovsrec_flow_sample_collector_set_verify_external_ids(const struct ovsrec_flow_sample_collector_set *row)
13486
0
{
13487
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_col_external_ids);
13488
0
}
13489
13490
/* Causes the original contents of column "id" in 'row' to be
13491
 * verified as a prerequisite to completing the transaction.  That is, if
13492
 * "id" in 'row' changed (or if 'row' was deleted) between the
13493
 * time that the IDL originally read its contents and the time that the
13494
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13495
 *
13496
 * The intention is that, to ensure that no transaction commits based on dirty
13497
 * reads, an application should call this function any time "id" is
13498
 * read as part of a read-modify-write operation.
13499
 *
13500
 * In some cases this function reduces to a no-op, because the current value
13501
 * of "id" is already known:
13502
 *
13503
 *   - If 'row' is a row created by the current transaction (returned by
13504
 *     ovsrec_flow_sample_collector_set_insert()).
13505
 *
13506
 *   - If "id" has already been modified (with
13507
 *     ovsrec_flow_sample_collector_set_set_id()) within the current transaction.
13508
 *
13509
 * Because of the latter property, always call this function *before*
13510
 * ovsrec_flow_sample_collector_set_set_id() for a given read-modify-write.
13511
 *
13512
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13513
void
13514
ovsrec_flow_sample_collector_set_verify_id(const struct ovsrec_flow_sample_collector_set *row)
13515
0
{
13516
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_col_id);
13517
0
}
13518
13519
/* Causes the original contents of column "ipfix" in 'row' to be
13520
 * verified as a prerequisite to completing the transaction.  That is, if
13521
 * "ipfix" in 'row' changed (or if 'row' was deleted) between the
13522
 * time that the IDL originally read its contents and the time that the
13523
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13524
 *
13525
 * The intention is that, to ensure that no transaction commits based on dirty
13526
 * reads, an application should call this function any time "ipfix" is
13527
 * read as part of a read-modify-write operation.
13528
 *
13529
 * In some cases this function reduces to a no-op, because the current value
13530
 * of "ipfix" is already known:
13531
 *
13532
 *   - If 'row' is a row created by the current transaction (returned by
13533
 *     ovsrec_flow_sample_collector_set_insert()).
13534
 *
13535
 *   - If "ipfix" has already been modified (with
13536
 *     ovsrec_flow_sample_collector_set_set_ipfix()) within the current transaction.
13537
 *
13538
 * Because of the latter property, always call this function *before*
13539
 * ovsrec_flow_sample_collector_set_set_ipfix() for a given read-modify-write.
13540
 *
13541
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13542
void
13543
ovsrec_flow_sample_collector_set_verify_ipfix(const struct ovsrec_flow_sample_collector_set *row)
13544
0
{
13545
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_col_ipfix);
13546
0
}
13547
13548
/* Causes the original contents of column "local_group_id" in 'row' to be
13549
 * verified as a prerequisite to completing the transaction.  That is, if
13550
 * "local_group_id" in 'row' changed (or if 'row' was deleted) between the
13551
 * time that the IDL originally read its contents and the time that the
13552
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13553
 *
13554
 * The intention is that, to ensure that no transaction commits based on dirty
13555
 * reads, an application should call this function any time "local_group_id" is
13556
 * read as part of a read-modify-write operation.
13557
 *
13558
 * In some cases this function reduces to a no-op, because the current value
13559
 * of "local_group_id" is already known:
13560
 *
13561
 *   - If 'row' is a row created by the current transaction (returned by
13562
 *     ovsrec_flow_sample_collector_set_insert()).
13563
 *
13564
 *   - If "local_group_id" has already been modified (with
13565
 *     ovsrec_flow_sample_collector_set_set_local_group_id()) within the current transaction.
13566
 *
13567
 * Because of the latter property, always call this function *before*
13568
 * ovsrec_flow_sample_collector_set_set_local_group_id() for a given read-modify-write.
13569
 *
13570
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13571
void
13572
ovsrec_flow_sample_collector_set_verify_local_group_id(const struct ovsrec_flow_sample_collector_set *row)
13573
0
{
13574
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_col_local_group_id);
13575
0
}
13576
13577
/* Returns the "bridge" column's value from the "Flow_Sample_Collector_Set" table in 'row'
13578
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13579
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13580
 * for a given key than implementing the same operation on the "cooked"
13581
 * form in 'row'.
13582
 *
13583
 * 'key_type' must be OVSDB_TYPE_UUID.
13584
 * (This helps to avoid silent bugs if someone changes bridge's
13585
 * type without updating the caller.)
13586
 *
13587
 * The caller must not modify or free the returned value.
13588
 *
13589
 * Various kinds of changes can invalidate the returned value: modifying
13590
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13591
 * If the returned value is needed for a long time, it is best to make a copy
13592
 * of it with ovsdb_datum_clone().
13593
 *
13594
 * This function is rarely useful, since it is easier to access the value
13595
 * directly through the "bridge" member in ovsrec_flow_sample_collector_set. */
13596
const struct ovsdb_datum *
13597
ovsrec_flow_sample_collector_set_get_bridge(const struct ovsrec_flow_sample_collector_set *row,
13598
  enum ovsdb_atomic_type key_type OVS_UNUSED)
13599
0
{
13600
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
13601
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_bridge);
13602
0
}
13603
13604
/* Returns the "external_ids" column's value from the "Flow_Sample_Collector_Set" table in 'row'
13605
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13606
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13607
 * for a given key than implementing the same operation on the "cooked"
13608
 * form in 'row'.
13609
 *
13610
 * 'key_type' must be OVSDB_TYPE_STRING.
13611
 * 'value_type' must be OVSDB_TYPE_STRING.
13612
 * (This helps to avoid silent bugs if someone changes external_ids's
13613
 * type without updating the caller.)
13614
 *
13615
 * The caller must not modify or free the returned value.
13616
 *
13617
 * Various kinds of changes can invalidate the returned value: modifying
13618
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13619
 * If the returned value is needed for a long time, it is best to make a copy
13620
 * of it with ovsdb_datum_clone().
13621
 *
13622
 * This function is rarely useful, since it is easier to access the value
13623
 * directly through the "external_ids" member in ovsrec_flow_sample_collector_set. */
13624
const struct ovsdb_datum *
13625
ovsrec_flow_sample_collector_set_get_external_ids(const struct ovsrec_flow_sample_collector_set *row,
13626
  enum ovsdb_atomic_type key_type OVS_UNUSED,
13627
  enum ovsdb_atomic_type value_type OVS_UNUSED)
13628
0
{
13629
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13630
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
13631
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_external_ids);
13632
0
}
13633
13634
/* Returns the "id" column's value from the "Flow_Sample_Collector_Set" table in 'row'
13635
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13636
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13637
 * for a given key than implementing the same operation on the "cooked"
13638
 * form in 'row'.
13639
 *
13640
 * 'key_type' must be OVSDB_TYPE_INTEGER.
13641
 * (This helps to avoid silent bugs if someone changes id's
13642
 * type without updating the caller.)
13643
 *
13644
 * The caller must not modify or free the returned value.
13645
 *
13646
 * Various kinds of changes can invalidate the returned value: modifying
13647
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13648
 * If the returned value is needed for a long time, it is best to make a copy
13649
 * of it with ovsdb_datum_clone().
13650
 *
13651
 * This function is rarely useful, since it is easier to access the value
13652
 * directly through the "id" member in ovsrec_flow_sample_collector_set. */
13653
const struct ovsdb_datum *
13654
ovsrec_flow_sample_collector_set_get_id(const struct ovsrec_flow_sample_collector_set *row,
13655
  enum ovsdb_atomic_type key_type OVS_UNUSED)
13656
0
{
13657
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13658
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_id);
13659
0
}
13660
13661
/* Returns the "ipfix" column's value from the "Flow_Sample_Collector_Set" table in 'row'
13662
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13663
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13664
 * for a given key than implementing the same operation on the "cooked"
13665
 * form in 'row'.
13666
 *
13667
 * 'key_type' must be OVSDB_TYPE_UUID.
13668
 * (This helps to avoid silent bugs if someone changes ipfix's
13669
 * type without updating the caller.)
13670
 *
13671
 * The caller must not modify or free the returned value.
13672
 *
13673
 * Various kinds of changes can invalidate the returned value: modifying
13674
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13675
 * If the returned value is needed for a long time, it is best to make a copy
13676
 * of it with ovsdb_datum_clone().
13677
 *
13678
 * This function is rarely useful, since it is easier to access the value
13679
 * directly through the "ipfix" member in ovsrec_flow_sample_collector_set. */
13680
const struct ovsdb_datum *
13681
ovsrec_flow_sample_collector_set_get_ipfix(const struct ovsrec_flow_sample_collector_set *row,
13682
  enum ovsdb_atomic_type key_type OVS_UNUSED)
13683
0
{
13684
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
13685
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_ipfix);
13686
0
}
13687
13688
/* Returns the "local_group_id" column's value from the "Flow_Sample_Collector_Set" table in 'row'
13689
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13690
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13691
 * for a given key than implementing the same operation on the "cooked"
13692
 * form in 'row'.
13693
 *
13694
 * 'key_type' must be OVSDB_TYPE_INTEGER.
13695
 * (This helps to avoid silent bugs if someone changes local_group_id's
13696
 * type without updating the caller.)
13697
 *
13698
 * The caller must not modify or free the returned value.
13699
 *
13700
 * Various kinds of changes can invalidate the returned value: modifying
13701
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13702
 * If the returned value is needed for a long time, it is best to make a copy
13703
 * of it with ovsdb_datum_clone().
13704
 *
13705
 * This function is rarely useful, since it is easier to access the value
13706
 * directly through the "local_group_id" member in ovsrec_flow_sample_collector_set. */
13707
const struct ovsdb_datum *
13708
ovsrec_flow_sample_collector_set_get_local_group_id(const struct ovsrec_flow_sample_collector_set *row,
13709
  enum ovsdb_atomic_type key_type OVS_UNUSED)
13710
0
{
13711
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13712
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_local_group_id);
13713
0
}
13714
13715
/* Sets the "bridge" column from the "Flow_Sample_Collector_Set" table in 'row' to
13716
 * 'bridge'.
13717
 *
13718
 * The caller retains ownership of the arguments. */
13719
void
13720
ovsrec_flow_sample_collector_set_set_bridge(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_bridge *bridge)
13721
0
{
13722
0
    struct ovsdb_datum datum;
13723
13724
0
    datum.refcnt = NULL;
13725
13726
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
13727
13728
0
    datum.n = 1;
13729
0
    datum.keys = key;
13730
0
    key->uuid = bridge->header_.uuid;
13731
0
    datum.values = NULL;
13732
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_sample_collector_set_col_bridge, &datum);
13733
0
}
13734
13735
/* Sets the "external_ids" column's value from the "Flow_Sample_Collector_Set" table in 'row'
13736
 * to 'external_ids'.
13737
 *
13738
 * The caller retains ownership of 'external_ids' and everything in it. */
13739
void
13740
ovsrec_flow_sample_collector_set_set_external_ids(const struct ovsrec_flow_sample_collector_set *row, const struct smap *external_ids)
13741
0
{
13742
0
    struct ovsdb_datum datum;
13743
13744
0
    if (external_ids) {
13745
0
        ovsdb_datum_from_smap(&datum, external_ids);
13746
0
    } else {
13747
0
        ovsdb_datum_init_empty(&datum);
13748
0
    }
13749
0
    ovsdb_idl_txn_write(&row->header_,
13750
0
                        &ovsrec_flow_sample_collector_set_col_external_ids,
13751
0
                        &datum);
13752
0
}
13753
13754
13755
/* Sets the "id" column from the "Flow_Sample_Collector_Set" table in 'row' to
13756
 * 'id'.
13757
 *
13758
 * Argument constraints: in range 0 to 4,294,967,295
13759
 *
13760
 * The caller retains ownership of the arguments. */
13761
void
13762
ovsrec_flow_sample_collector_set_set_id(const struct ovsrec_flow_sample_collector_set *row, int64_t id)
13763
0
{
13764
0
    struct ovsdb_datum datum;
13765
13766
0
    datum.refcnt = NULL;
13767
13768
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
13769
13770
0
    datum.n = 1;
13771
0
    datum.keys = key;
13772
0
    key->integer = id;
13773
0
    datum.values = NULL;
13774
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_sample_collector_set_col_id, &datum);
13775
0
}
13776
13777
/* Sets the "ipfix" column from the "Flow_Sample_Collector_Set" table in 'row' to
13778
 * the 'ipfix' set.
13779
 *
13780
 * If "ipfix" is null, the column will be the empty set,
13781
 * otherwise it will contain the specified value.
13782
 *
13783
 * The caller retains ownership of the arguments. */
13784
void
13785
ovsrec_flow_sample_collector_set_set_ipfix(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_ipfix *ipfix)
13786
0
{
13787
0
    struct ovsdb_datum datum;
13788
13789
0
    datum.refcnt = NULL;
13790
13791
0
    if (ipfix) {
13792
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
13793
0
        datum.n = 1;
13794
0
        datum.keys = key;
13795
0
        key->uuid = ipfix->header_.uuid;
13796
0
    } else {
13797
0
        datum.n = 0;
13798
0
        datum.keys = NULL;
13799
0
    }
13800
0
    datum.values = NULL;
13801
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_sample_collector_set_col_ipfix, &datum);
13802
0
}
13803
13804
/* Sets the "local_group_id" column from the "Flow_Sample_Collector_Set" table in 'row' to
13805
 * the 'local_group_id' set with 'n_local_group_id' entries.
13806
 *
13807
 * 'n_local_group_id' may be 0 or 1; if it is 0, then 'local_group_id'
13808
 * may be NULL.
13809
 *
13810
 * Argument constraints: in range 0 to 4,294,967,295
13811
 *
13812
 * The caller retains ownership of the arguments. */
13813
void
13814
ovsrec_flow_sample_collector_set_set_local_group_id(const struct ovsrec_flow_sample_collector_set *row, const int64_t *local_group_id, size_t n_local_group_id)
13815
0
{
13816
0
    struct ovsdb_datum datum;
13817
13818
0
    datum.refcnt = NULL;
13819
13820
0
    if (n_local_group_id) {
13821
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
13822
0
        datum.n = 1;
13823
0
        datum.keys = key;
13824
0
        key->integer = *local_group_id;
13825
0
    } else {
13826
0
        datum.n = 0;
13827
0
        datum.keys = NULL;
13828
0
    }
13829
0
    datum.values = NULL;
13830
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_sample_collector_set_col_local_group_id, &datum);
13831
0
}
13832
13833
/* Sets an element of the "external_ids" map column from the "Flow_Sample_Collector_Set" table in 'row'
13834
 * to 'new_value' given the key value 'new_key'.
13835
 *
13836
 */
13837
void
13838
ovsrec_flow_sample_collector_set_update_external_ids_setkey(const struct ovsrec_flow_sample_collector_set *row, const char *new_key, const char *new_value)
13839
0
{
13840
0
    struct ovsdb_datum *datum;
13841
13842
0
    datum = xmalloc(sizeof *datum);
13843
0
    datum->n = 1;
13844
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
13845
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
13846
0
    datum->refcnt = NULL;
13847
13848
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
13849
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
13850
13851
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
13852
0
                                    &ovsrec_flow_sample_collector_set_col_external_ids,
13853
0
                                    datum);
13854
0
}
13855
13856
/* Deletes an element of the "external_ids" map column from the "Flow_Sample_Collector_Set" table in 'row'
13857
 * given the key value 'delete_key'.
13858
 *
13859
 */
13860
void
13861
ovsrec_flow_sample_collector_set_update_external_ids_delkey(const struct ovsrec_flow_sample_collector_set *row, const char *delete_key)
13862
0
{
13863
0
    struct ovsdb_datum *datum;
13864
13865
0
    datum = xmalloc(sizeof *datum);
13866
0
    datum->n = 1;
13867
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
13868
0
    datum->values = NULL;
13869
0
    datum->refcnt = NULL;
13870
13871
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
13872
13873
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
13874
0
                                    &ovsrec_flow_sample_collector_set_col_external_ids,
13875
0
                                    datum);
13876
0
}
13877
13878
/* Adds the value 'new_value' to the "ipfix" set column from the "Flow_Sample_Collector_Set" table
13879
 * in 'row'.
13880
 *
13881
 */
13882
void
13883
ovsrec_flow_sample_collector_set_update_ipfix_addvalue(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_ipfix *new_value)
13884
0
{
13885
0
    struct ovsdb_datum *datum;
13886
13887
0
    datum = xmalloc(sizeof *datum);
13888
0
    datum->n = 1;
13889
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
13890
0
    datum->values = NULL;
13891
0
    datum->refcnt = NULL;
13892
13893
0
    datum->keys[0].uuid = new_value->header_.uuid;
13894
13895
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
13896
0
                                    &ovsrec_flow_sample_collector_set_col_ipfix,
13897
0
                                    datum);
13898
0
}
13899
13900
/* Deletes the value 'delete_value' from the "ipfix" set column from the
13901
 * "Flow_Sample_Collector_Set" table in 'row'.
13902
 *
13903
 */
13904
void
13905
ovsrec_flow_sample_collector_set_update_ipfix_delvalue(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_ipfix *delete_value)
13906
0
{
13907
0
    struct ovsdb_datum *datum;
13908
13909
0
    datum = xmalloc(sizeof *datum);
13910
0
    datum->n = 1;
13911
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
13912
0
    datum->values = NULL;
13913
0
    datum->refcnt = NULL;
13914
13915
0
    datum->keys[0].uuid = delete_value->header_.uuid;
13916
13917
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
13918
0
                                    &ovsrec_flow_sample_collector_set_col_ipfix,
13919
0
                                    datum);
13920
0
}
13921
13922
/* Adds the value 'new_value' to the "local_group_id" set column from the "Flow_Sample_Collector_Set" table
13923
 * in 'row'.
13924
 *
13925
 */
13926
void
13927
ovsrec_flow_sample_collector_set_update_local_group_id_addvalue(const struct ovsrec_flow_sample_collector_set *row, int64_t new_value)
13928
0
{
13929
0
    struct ovsdb_datum *datum;
13930
13931
0
    datum = xmalloc(sizeof *datum);
13932
0
    datum->n = 1;
13933
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
13934
0
    datum->values = NULL;
13935
0
    datum->refcnt = NULL;
13936
13937
0
    datum->keys[0].integer = new_value;
13938
13939
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
13940
0
                                    &ovsrec_flow_sample_collector_set_col_local_group_id,
13941
0
                                    datum);
13942
0
}
13943
13944
/* Deletes the value 'delete_value' from the "local_group_id" set column from the
13945
 * "Flow_Sample_Collector_Set" table in 'row'.
13946
 *
13947
 */
13948
void
13949
ovsrec_flow_sample_collector_set_update_local_group_id_delvalue(const struct ovsrec_flow_sample_collector_set *row, int64_t delete_value)
13950
0
{
13951
0
    struct ovsdb_datum *datum;
13952
13953
0
    datum = xmalloc(sizeof *datum);
13954
0
    datum->n = 1;
13955
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
13956
0
    datum->values = NULL;
13957
0
    datum->refcnt = NULL;
13958
13959
0
    datum->keys[0].integer = delete_value;
13960
13961
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
13962
0
                                    &ovsrec_flow_sample_collector_set_col_local_group_id,
13963
0
                                    datum);
13964
0
}
13965
13966
/* Sets the "bridge" column from the "Flow_Sample_Collector_Set" table in 'row' to
13967
 * 'bridge'.
13968
 *
13969
 * The caller retains ownership of the arguments. */
13970
void
13971
ovsrec_flow_sample_collector_set_add_clause_bridge(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *bridge)
13972
0
{
13973
0
    struct ovsdb_datum datum;
13974
13975
0
    datum.refcnt = NULL;
13976
13977
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
13978
13979
0
    datum.n = 1;
13980
0
    datum.keys = key;
13981
0
    key->uuid = *bridge;
13982
0
    datum.values = NULL;
13983
0
    ovsdb_idl_condition_add_clause(cond,
13984
0
                          function,
13985
0
                          &ovsrec_flow_sample_collector_set_col_bridge,
13986
0
                          &datum);
13987
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_sample_collector_set_col_bridge.type);
13988
0
}
13989
13990
/* Sets the "external_ids" column's value from the "Flow_Sample_Collector_Set" table in 'row'
13991
 * to 'external_ids'.
13992
 *
13993
 * The caller retains ownership of 'external_ids' and everything in it. */
13994
void
13995
ovsrec_flow_sample_collector_set_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
13996
0
{
13997
0
    struct ovsdb_datum datum;
13998
13999
0
    if (external_ids) {
14000
0
        ovsdb_datum_from_smap(&datum, external_ids);
14001
0
    } else {
14002
0
        ovsdb_datum_init_empty(&datum);
14003
0
    }
14004
14005
0
    ovsdb_idl_condition_add_clause(cond,
14006
0
                                   function,
14007
0
                                   &ovsrec_flow_sample_collector_set_col_external_ids,
14008
0
                                   &datum);
14009
14010
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_sample_collector_set_col_external_ids.type);
14011
0
}
14012
14013
14014
/* Sets the "id" column from the "Flow_Sample_Collector_Set" table in 'row' to
14015
 * 'id'.
14016
 *
14017
 * Argument constraints: in range 0 to 4,294,967,295
14018
 *
14019
 * The caller retains ownership of the arguments. */
14020
void
14021
ovsrec_flow_sample_collector_set_add_clause_id(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t id)
14022
0
{
14023
0
    struct ovsdb_datum datum;
14024
14025
0
    datum.refcnt = NULL;
14026
14027
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
14028
14029
0
    datum.n = 1;
14030
0
    datum.keys = key;
14031
0
    key->integer = id;
14032
0
    datum.values = NULL;
14033
0
    ovsdb_idl_condition_add_clause(cond,
14034
0
                          function,
14035
0
                          &ovsrec_flow_sample_collector_set_col_id,
14036
0
                          &datum);
14037
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_sample_collector_set_col_id.type);
14038
0
}
14039
14040
/* Sets the "ipfix" column from the "Flow_Sample_Collector_Set" table in 'row' to
14041
 * the 'ipfix' set.
14042
 *
14043
 * If "ipfix" is null, the column will be the empty set,
14044
 * otherwise it will contain the specified value.
14045
 *
14046
 * The caller retains ownership of the arguments. */
14047
void
14048
ovsrec_flow_sample_collector_set_add_clause_ipfix(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *ipfix)
14049
0
{
14050
0
    struct ovsdb_datum datum;
14051
14052
0
    datum.refcnt = NULL;
14053
14054
0
    if (ipfix) {
14055
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
14056
0
        datum.n = 1;
14057
0
        datum.keys = key;
14058
0
        key->uuid = *ipfix;
14059
0
    } else {
14060
0
        datum.n = 0;
14061
0
        datum.keys = NULL;
14062
0
    }
14063
0
    datum.values = NULL;
14064
0
    ovsdb_idl_condition_add_clause(cond,
14065
0
                          function,
14066
0
                          &ovsrec_flow_sample_collector_set_col_ipfix,
14067
0
                          &datum);
14068
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_sample_collector_set_col_ipfix.type);
14069
0
}
14070
14071
/* Sets the "local_group_id" column from the "Flow_Sample_Collector_Set" table in 'row' to
14072
 * the 'local_group_id' set with 'n_local_group_id' entries.
14073
 *
14074
 * 'n_local_group_id' may be 0 or 1; if it is 0, then 'local_group_id'
14075
 * may be NULL.
14076
 *
14077
 * Argument constraints: in range 0 to 4,294,967,295
14078
 *
14079
 * The caller retains ownership of the arguments. */
14080
void
14081
ovsrec_flow_sample_collector_set_add_clause_local_group_id(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *local_group_id, size_t n_local_group_id)
14082
0
{
14083
0
    struct ovsdb_datum datum;
14084
14085
0
    datum.refcnt = NULL;
14086
14087
0
    if (n_local_group_id) {
14088
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
14089
0
        datum.n = 1;
14090
0
        datum.keys = key;
14091
0
        key->integer = *local_group_id;
14092
0
    } else {
14093
0
        datum.n = 0;
14094
0
        datum.keys = NULL;
14095
0
    }
14096
0
    datum.values = NULL;
14097
0
    ovsdb_idl_condition_add_clause(cond,
14098
0
                          function,
14099
0
                          &ovsrec_flow_sample_collector_set_col_local_group_id,
14100
0
                          &datum);
14101
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_sample_collector_set_col_local_group_id.type);
14102
0
}
14103
14104
/* Destroy 'row' of kind "Flow_Sample_Collector_Set". The row must have been
14105
 * created with ovsdb_idl_index_init_row.
14106
 */
14107
void
14108
ovsrec_flow_sample_collector_set_index_destroy_row(const struct ovsrec_flow_sample_collector_set *row)
14109
0
{
14110
0
    ovsdb_idl_index_destroy_row(&row->header_);
14111
0
}
14112
        
14113
14114
/* Creates a new row of kind "Flow_Sample_Collector_Set". */
14115
struct ovsrec_flow_sample_collector_set *
14116
ovsrec_flow_sample_collector_set_index_init_row(struct ovsdb_idl_index *index)
14117
0
{
14118
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_sample_collector_set);
14119
0
    return ALIGNED_CAST(struct ovsrec_flow_sample_collector_set *, ovsdb_idl_index_init_row(index));
14120
0
}
14121
14122
struct ovsrec_flow_sample_collector_set *
14123
ovsrec_flow_sample_collector_set_index_find(struct ovsdb_idl_index *index, const struct ovsrec_flow_sample_collector_set *target)
14124
0
{
14125
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_sample_collector_set);
14126
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_index_find(index, &target->header_));
14127
0
}
14128
14129
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
14130
int
14131
ovsrec_flow_sample_collector_set_index_compare(
14132
    struct ovsdb_idl_index *index, 
14133
    const struct ovsrec_flow_sample_collector_set *a, 
14134
    const struct ovsrec_flow_sample_collector_set *b)
14135
0
{
14136
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
14137
0
}
14138
14139
struct ovsdb_idl_cursor
14140
ovsrec_flow_sample_collector_set_cursor_first(struct ovsdb_idl_index *index)
14141
0
{
14142
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_sample_collector_set);
14143
0
    return ovsdb_idl_cursor_first(index);
14144
0
}
14145
14146
struct ovsdb_idl_cursor
14147
ovsrec_flow_sample_collector_set_cursor_first_eq(
14148
    struct ovsdb_idl_index *index, const struct ovsrec_flow_sample_collector_set *target)
14149
0
{
14150
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_sample_collector_set);
14151
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
14152
0
}
14153
14154
struct ovsdb_idl_cursor
14155
ovsrec_flow_sample_collector_set_cursor_first_ge(
14156
    struct ovsdb_idl_index *index, const struct ovsrec_flow_sample_collector_set *target)
14157
0
{
14158
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_sample_collector_set);
14159
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
14160
0
}
14161
14162
struct ovsrec_flow_sample_collector_set *
14163
ovsrec_flow_sample_collector_set_cursor_data(struct ovsdb_idl_cursor *cursor)
14164
0
{
14165
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_cursor_data(cursor));
14166
0
}
14167
14168
14169
/* Sets the "bridge" column from the "Flow_Sample_Collector_Set" table in 'row' to
14170
 * 'bridge'.
14171
 *
14172
 * The caller retains ownership of the arguments. */
14173
void
14174
ovsrec_flow_sample_collector_set_index_set_bridge(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_bridge *bridge)
14175
0
{
14176
0
    struct ovsdb_datum datum;
14177
14178
0
    datum.refcnt = NULL;
14179
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
14180
14181
0
    datum.n = 1;
14182
0
    datum.keys = key;
14183
0
    key->uuid = bridge->header_.uuid;
14184
0
    datum.values = NULL;
14185
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_flow_sample_collector_set_columns[ OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_BRIDGE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET]);
14186
0
}
14187
14188
/* Sets the "external_ids" column's value from the "Flow_Sample_Collector_Set" table in 'row'
14189
 * to 'external_ids'.
14190
 *
14191
 * The caller retains ownership of 'external_ids' and everything in it. */
14192
void
14193
ovsrec_flow_sample_collector_set_index_set_external_ids(const struct ovsrec_flow_sample_collector_set *row, const struct smap *external_ids)
14194
0
{
14195
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
14196
14197
0
    if (external_ids) {
14198
0
        struct smap_node *node;
14199
0
        size_t i;
14200
14201
0
        datum->n = smap_count(external_ids);
14202
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
14203
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
14204
0
        datum->refcnt = NULL;
14205
14206
0
        i = 0;
14207
0
        SMAP_FOR_EACH (node, external_ids) {
14208
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
14209
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
14210
0
            i++;
14211
0
        }
14212
0
        ovsdb_datum_sort_unique(datum, &ovsrec_flow_sample_collector_set_col_external_ids.type);
14213
0
    } else {
14214
0
        ovsdb_datum_init_empty(datum);
14215
0
    }
14216
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
14217
0
                          &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_EXTERNAL_IDS],
14218
0
                          datum,
14219
0
                          &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET]);
14220
0
    free(datum);
14221
0
}
14222
14223
14224
/* Sets the "id" column from the "Flow_Sample_Collector_Set" table in 'row' to
14225
 * 'id'.
14226
 *
14227
 * Argument constraints: in range 0 to 4,294,967,295
14228
 *
14229
 * The caller retains ownership of the arguments. */
14230
void
14231
ovsrec_flow_sample_collector_set_index_set_id(const struct ovsrec_flow_sample_collector_set *row, int64_t id)
14232
0
{
14233
0
    struct ovsdb_datum datum;
14234
14235
0
    datum.refcnt = NULL;
14236
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
14237
14238
0
    datum.n = 1;
14239
0
    datum.keys = key;
14240
0
    key->integer = id;
14241
0
    datum.values = NULL;
14242
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_flow_sample_collector_set_columns[ OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_ID ], &datum, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET]);
14243
0
}
14244
14245
/* Sets the "ipfix" column from the "Flow_Sample_Collector_Set" table in 'row' to
14246
 * the 'ipfix' set.
14247
 *
14248
 * If "ipfix" is null, the column will be the empty set,
14249
 * otherwise it will contain the specified value.
14250
 *
14251
 * The caller retains ownership of the arguments. */
14252
void
14253
ovsrec_flow_sample_collector_set_index_set_ipfix(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_ipfix *ipfix)
14254
0
{
14255
0
    struct ovsdb_datum datum;
14256
14257
0
    datum.refcnt = NULL;
14258
0
    union ovsdb_atom *key;
14259
14260
0
    if (ipfix) {
14261
0
        key = xmalloc(sizeof (union ovsdb_atom));
14262
0
        datum.n = 1;
14263
0
        datum.keys = key;
14264
0
        key->uuid = ipfix->header_.uuid;
14265
0
    } else {
14266
0
        datum.n = 0;
14267
0
        datum.keys = NULL;
14268
0
    }
14269
0
    datum.values = NULL;
14270
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_flow_sample_collector_set_columns[ OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_IPFIX ], &datum, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET]);
14271
0
}
14272
14273
/* Sets the "local_group_id" column from the "Flow_Sample_Collector_Set" table in 'row' to
14274
 * the 'local_group_id' set with 'n_local_group_id' entries.
14275
 *
14276
 * 'n_local_group_id' may be 0 or 1; if it is 0, then 'local_group_id'
14277
 * may be NULL.
14278
 *
14279
 * Argument constraints: in range 0 to 4,294,967,295
14280
 *
14281
 * The caller retains ownership of the arguments. */
14282
void
14283
ovsrec_flow_sample_collector_set_index_set_local_group_id(const struct ovsrec_flow_sample_collector_set *row, const int64_t *local_group_id, size_t n_local_group_id)
14284
0
{
14285
0
    struct ovsdb_datum datum;
14286
14287
0
    datum.refcnt = NULL;
14288
0
    union ovsdb_atom *key;
14289
14290
0
    if (n_local_group_id) {
14291
0
        key = xmalloc(sizeof(union ovsdb_atom));
14292
0
        datum.n = 1;
14293
0
        datum.keys = key;
14294
0
        key->integer = *local_group_id;
14295
0
    } else {
14296
0
        datum.n = 0;
14297
0
        datum.keys = NULL;
14298
0
    }
14299
0
    datum.values = NULL;
14300
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_flow_sample_collector_set_columns[ OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_LOCAL_GROUP_ID ], &datum, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET]);
14301
0
}
14302
14303
struct ovsdb_idl_column ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_N_COLUMNS];
14304
14305
unsigned int
14306
ovsrec_flow_sample_collector_set_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
14307
0
{
14308
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_flow_sample_collector_set, condition);
14309
0
}
14310
14311
struct ovsdb_idl_column ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_N_COLUMNS] = {
14312
    [OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_BRIDGE] = {
14313
         .name = "bridge",
14314
         .type = {
14315
            .key = {
14316
               .type = OVSDB_TYPE_UUID,
14317
               .uuid = { .refTableName = "Bridge", .refType = OVSDB_REF_STRONG },
14318
            },
14319
            .value = OVSDB_BASE_VOID_INIT,
14320
            .n_min = 1,
14321
            .n_max = 1,
14322
         },
14323
         .is_mutable = true,
14324
         .is_synthetic = false,
14325
         .parse = ovsrec_flow_sample_collector_set_parse_bridge,
14326
         .unparse = ovsrec_flow_sample_collector_set_unparse_bridge,
14327
    },
14328
14329
    [OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_EXTERNAL_IDS] = {
14330
         .name = "external_ids",
14331
         .type = {
14332
            .key = {
14333
               .type = OVSDB_TYPE_STRING,
14334
               .string = { .minLen = 0, .maxLen = UINT_MAX },
14335
            },
14336
            .value = {
14337
                .type = OVSDB_TYPE_STRING,
14338
                .string = { .minLen = 0, .maxLen = UINT_MAX },
14339
            },
14340
            .n_min = 0,
14341
            .n_max = UINT_MAX,
14342
         },
14343
         .is_mutable = true,
14344
         .is_synthetic = false,
14345
         .parse = ovsrec_flow_sample_collector_set_parse_external_ids,
14346
         .unparse = ovsrec_flow_sample_collector_set_unparse_external_ids,
14347
    },
14348
14349
    [OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_ID] = {
14350
         .name = "id",
14351
         .type = {
14352
            .key = {
14353
               .type = OVSDB_TYPE_INTEGER,
14354
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
14355
            },
14356
            .value = OVSDB_BASE_VOID_INIT,
14357
            .n_min = 1,
14358
            .n_max = 1,
14359
         },
14360
         .is_mutable = true,
14361
         .is_synthetic = false,
14362
         .parse = ovsrec_flow_sample_collector_set_parse_id,
14363
         .unparse = ovsrec_flow_sample_collector_set_unparse_id,
14364
    },
14365
14366
    [OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_IPFIX] = {
14367
         .name = "ipfix",
14368
         .type = {
14369
            .key = {
14370
               .type = OVSDB_TYPE_UUID,
14371
               .uuid = { .refTableName = "IPFIX", .refType = OVSDB_REF_STRONG },
14372
            },
14373
            .value = OVSDB_BASE_VOID_INIT,
14374
            .n_min = 0,
14375
            .n_max = 1,
14376
         },
14377
         .is_mutable = true,
14378
         .is_synthetic = false,
14379
         .parse = ovsrec_flow_sample_collector_set_parse_ipfix,
14380
         .unparse = ovsrec_flow_sample_collector_set_unparse_ipfix,
14381
    },
14382
14383
    [OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_LOCAL_GROUP_ID] = {
14384
         .name = "local_group_id",
14385
         .type = {
14386
            .key = {
14387
               .type = OVSDB_TYPE_INTEGER,
14388
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
14389
            },
14390
            .value = OVSDB_BASE_VOID_INIT,
14391
            .n_min = 0,
14392
            .n_max = 1,
14393
         },
14394
         .is_mutable = true,
14395
         .is_synthetic = false,
14396
         .parse = ovsrec_flow_sample_collector_set_parse_local_group_id,
14397
         .unparse = ovsrec_flow_sample_collector_set_unparse_local_group_id,
14398
    },
14399
14400
};
14401

14402
/* Flow_Table table. */
14403
14404
bool
14405
ovsrec_server_has_flow_table_table_col_external_ids(const struct ovsdb_idl *idl)
14406
0
{
14407
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_external_ids);
14408
0
}
14409
14410
const struct ovsdb_type *
14411
ovsrec_flow_table_external_ids_server_type(const struct ovsdb_idl *idl)
14412
0
{
14413
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_table_col_external_ids);
14414
0
}
14415
14416
14417
bool
14418
ovsrec_server_has_flow_table_table_col_flow_limit(const struct ovsdb_idl *idl)
14419
0
{
14420
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_flow_limit);
14421
0
}
14422
14423
const struct ovsdb_type *
14424
ovsrec_flow_table_flow_limit_server_type(const struct ovsdb_idl *idl)
14425
0
{
14426
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_table_col_flow_limit);
14427
0
}
14428
14429
14430
bool
14431
ovsrec_server_has_flow_table_table_col_groups(const struct ovsdb_idl *idl)
14432
0
{
14433
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_groups);
14434
0
}
14435
14436
const struct ovsdb_type *
14437
ovsrec_flow_table_groups_server_type(const struct ovsdb_idl *idl)
14438
0
{
14439
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_table_col_groups);
14440
0
}
14441
14442
14443
bool
14444
ovsrec_server_has_flow_table_table_col_name(const struct ovsdb_idl *idl)
14445
0
{
14446
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_name);
14447
0
}
14448
14449
const struct ovsdb_type *
14450
ovsrec_flow_table_name_server_type(const struct ovsdb_idl *idl)
14451
0
{
14452
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_table_col_name);
14453
0
}
14454
14455
14456
bool
14457
ovsrec_server_has_flow_table_table_col_overflow_policy(const struct ovsdb_idl *idl)
14458
0
{
14459
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_overflow_policy);
14460
0
}
14461
14462
const struct ovsdb_type *
14463
ovsrec_flow_table_overflow_policy_server_type(const struct ovsdb_idl *idl)
14464
0
{
14465
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_table_col_overflow_policy);
14466
0
}
14467
14468
14469
bool
14470
ovsrec_server_has_flow_table_table_col_prefixes(const struct ovsdb_idl *idl)
14471
0
{
14472
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_prefixes);
14473
0
}
14474
14475
const struct ovsdb_type *
14476
ovsrec_flow_table_prefixes_server_type(const struct ovsdb_idl *idl)
14477
0
{
14478
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_flow_table_col_prefixes);
14479
0
}
14480
14481
14482
bool
14483
ovsrec_server_has_flow_table_table(const struct ovsdb_idl *idl)
14484
0
{
14485
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]);
14486
0
}
14487
14488
14489
const struct ovsrec_flow_table_table *
14490
ovsrec_flow_table_table_get(const struct ovsdb_idl *idl)
14491
0
{
14492
0
    return (const struct ovsrec_flow_table_table *) idl;
14493
0
}
14494
14495
const struct ovsrec_flow_table *
14496
ovsrec_flow_table_table_first(const struct ovsrec_flow_table_table *table)
14497
0
{
14498
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
14499
0
    return ovsrec_flow_table_first(idl);
14500
0
}
14501
14502
14503
const struct ovsrec_flow_table *
14504
ovsrec_flow_table_table_track_get_first(const struct ovsrec_flow_table_table *table)
14505
0
{
14506
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
14507
0
    return ovsrec_flow_table_track_get_first(idl);
14508
0
}
14509
14510
14511
static void
14512
ovsrec_flow_table_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
14513
0
{
14514
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
14515
0
    smap_init(&row->external_ids);
14516
0
    for (size_t i = 0; i < datum->n; i++) {
14517
0
        smap_add(&row->external_ids,
14518
0
                 json_string(datum->keys[i].s),
14519
0
                 json_string(datum->values[i].s));
14520
0
    }
14521
0
}
14522
14523
static void
14524
ovsrec_flow_table_parse_flow_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
14525
0
{
14526
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
14527
0
    size_t n = MIN(1, datum->n);
14528
0
    row->flow_limit = NULL;
14529
0
    row->n_flow_limit = 0;
14530
0
    for (size_t i = 0; i < n; i++) {
14531
0
        if (!row->n_flow_limit) {
14532
0
            row->flow_limit = xmalloc(n * sizeof *row->flow_limit);
14533
0
        }
14534
0
        row->flow_limit[row->n_flow_limit] = datum->keys[i].integer;
14535
0
        row->n_flow_limit++;
14536
0
    }
14537
0
}
14538
14539
static void
14540
ovsrec_flow_table_parse_groups(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
14541
0
{
14542
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
14543
0
    row->groups = NULL;
14544
0
    row->n_groups = 0;
14545
0
    for (size_t i = 0; i < datum->n; i++) {
14546
0
        if (!row->n_groups) {
14547
0
            row->groups = xmalloc(datum->n * sizeof *row->groups);
14548
0
        }
14549
0
        row->groups[row->n_groups] = CONST_CAST(char *, json_string(datum->keys[i].s));
14550
0
        row->n_groups++;
14551
0
    }
14552
0
}
14553
14554
static void
14555
ovsrec_flow_table_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
14556
0
{
14557
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
14558
14559
0
    if (datum->n >= 1) {
14560
0
        row->name = CONST_CAST(char *, json_string(datum->keys[0].s));
14561
0
    } else {
14562
0
        row->name = NULL;
14563
0
    }
14564
0
}
14565
14566
static void
14567
ovsrec_flow_table_parse_overflow_policy(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
14568
0
{
14569
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
14570
14571
0
    if (datum->n >= 1) {
14572
0
        row->overflow_policy = CONST_CAST(char *, json_string(datum->keys[0].s));
14573
0
    } else {
14574
0
        row->overflow_policy = NULL;
14575
0
    }
14576
0
}
14577
14578
static void
14579
ovsrec_flow_table_parse_prefixes(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
14580
0
{
14581
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
14582
0
    size_t n = MIN(4, datum->n);
14583
0
    row->prefixes = NULL;
14584
0
    row->n_prefixes = 0;
14585
0
    for (size_t i = 0; i < n; i++) {
14586
0
        if (!row->n_prefixes) {
14587
0
            row->prefixes = xmalloc(n * sizeof *row->prefixes);
14588
0
        }
14589
0
        row->prefixes[row->n_prefixes] = CONST_CAST(char *, json_string(datum->keys[i].s));
14590
0
        row->n_prefixes++;
14591
0
    }
14592
0
}
14593
14594
static void
14595
ovsrec_flow_table_unparse_external_ids(struct ovsdb_idl_row *row_)
14596
0
{
14597
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
14598
0
    smap_destroy(&row->external_ids);
14599
0
}
14600
14601
static void
14602
ovsrec_flow_table_unparse_flow_limit(struct ovsdb_idl_row *row_)
14603
0
{
14604
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
14605
0
    free(row->flow_limit);
14606
0
}
14607
14608
static void
14609
ovsrec_flow_table_unparse_groups(struct ovsdb_idl_row *row_)
14610
0
{
14611
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
14612
0
    free(row->groups);
14613
0
}
14614
14615
static void
14616
ovsrec_flow_table_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
14617
0
{
14618
    /* Nothing to do. */
14619
0
}
14620
14621
static void
14622
ovsrec_flow_table_unparse_overflow_policy(struct ovsdb_idl_row *row OVS_UNUSED)
14623
0
{
14624
    /* Nothing to do. */
14625
0
}
14626
14627
static void
14628
ovsrec_flow_table_unparse_prefixes(struct ovsdb_idl_row *row_)
14629
0
{
14630
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
14631
0
    free(row->prefixes);
14632
0
}
14633
14634
static void
14635
ovsrec_flow_table_init__(struct ovsdb_idl_row *row)
14636
0
{
14637
0
    ovsrec_flow_table_init(ovsrec_flow_table_cast(row));
14638
0
}
14639
14640
/* Clears the contents of 'row' in table "Flow_Table". */
14641
void
14642
ovsrec_flow_table_init(struct ovsrec_flow_table *row)
14643
0
{
14644
0
    memset(row, 0, sizeof *row); 
14645
0
    smap_init(&row->external_ids);
14646
0
}
14647
14648
/* Searches table "Flow_Table" in 'idl' for a row with UUID 'uuid'.  Returns
14649
 * a pointer to the row if there is one, otherwise a null pointer.  */
14650
const struct ovsrec_flow_table *
14651
ovsrec_flow_table_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
14652
0
{
14653
0
    return ovsrec_flow_table_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_flow_table, uuid));
14654
0
}
14655
14656
/* Searches table "Flow_Table" for a row with UUID 'uuid'.  Returns
14657
 * a pointer to the row if there is one, otherwise a null pointer.  */
14658
const struct ovsrec_flow_table *
14659
ovsrec_flow_table_table_get_for_uuid(const struct ovsrec_flow_table_table *table, const struct uuid *uuid)
14660
0
{
14661
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
14662
0
    return ovsrec_flow_table_get_for_uuid(idl, uuid);
14663
0
}
14664
14665
/* Returns a row in table "Flow_Table" in 'idl', or a null pointer if that
14666
 * table is empty.
14667
 *
14668
 * Database tables are internally maintained as hash tables, so adding or
14669
 * removing rows while traversing the same table can cause some rows to be
14670
 * visited twice or not at apply. */
14671
const struct ovsrec_flow_table *
14672
ovsrec_flow_table_first(const struct ovsdb_idl *idl)
14673
0
{
14674
0
    return ovsrec_flow_table_cast(ovsdb_idl_first_row(idl, &ovsrec_table_flow_table));
14675
0
}
14676
14677
/* Returns a row following 'row' within its table, or a null pointer if 'row'
14678
 * is the last row in its table. */
14679
const struct ovsrec_flow_table *
14680
ovsrec_flow_table_next(const struct ovsrec_flow_table *row)
14681
0
{
14682
0
    return ovsrec_flow_table_cast(ovsdb_idl_next_row(&row->header_));
14683
0
}
14684
14685
unsigned int ovsrec_flow_table_get_seqno(const struct ovsdb_idl *idl)
14686
0
{
14687
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_flow_table);
14688
0
}
14689
14690
unsigned int ovsrec_flow_table_row_get_seqno(const struct ovsrec_flow_table *row, enum ovsdb_idl_change change)
14691
0
{
14692
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
14693
0
}
14694
14695
const struct ovsrec_flow_table *
14696
ovsrec_flow_table_track_get_first(const struct ovsdb_idl *idl)
14697
0
{
14698
0
    return ovsrec_flow_table_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_flow_table));
14699
0
}
14700
14701
const struct ovsrec_flow_table
14702
*ovsrec_flow_table_track_get_next(const struct ovsrec_flow_table *row)
14703
0
{
14704
0
    return ovsrec_flow_table_cast(ovsdb_idl_track_get_next(&row->header_));
14705
0
}
14706
14707
14708
/* Deletes 'row' from table "Flow_Table".  'row' may be freed, so it must not be
14709
 * accessed afterward.
14710
 *
14711
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
14712
void
14713
ovsrec_flow_table_delete(const struct ovsrec_flow_table *row)
14714
0
{
14715
0
    ovsdb_idl_txn_delete(&row->header_);
14716
0
}
14717
14718
/* Inserts and returns a new row in the table "Flow_Table" in the database
14719
 * with open transaction 'txn'.
14720
 *
14721
 * The new row is assigned a randomly generated provisional UUID.
14722
 * ovsdb-server will assign a different UUID when 'txn' is committed,
14723
 * but the IDL will replace any uses of the provisional UUID in the
14724
 * data to be to be committed by the UUID assigned by ovsdb-server. */
14725
struct ovsrec_flow_table *
14726
ovsrec_flow_table_insert(struct ovsdb_idl_txn *txn)
14727
0
{
14728
0
    return ovsrec_flow_table_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_flow_table, NULL));
14729
0
}
14730
14731
/* Inserts and returns a new row in the table "Flow_Table" in the database
14732
 * with open transaction 'txn'.
14733
 *
14734
 * The new row is assigned the UUID specified in the 'uuid' parameter
14735
 * (which cannot be null).  ovsdb-server will try to assign the same
14736
 * UUID when 'txn' is committed. */
14737
struct ovsrec_flow_table *
14738
ovsrec_flow_table_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
14739
0
{
14740
0
    return ovsrec_flow_table_cast(ovsdb_idl_txn_insert_persist_uuid(
14741
0
        txn, &ovsrec_table_flow_table, uuid));
14742
0
}
14743
14744
bool
14745
ovsrec_flow_table_is_updated(const struct ovsrec_flow_table *row, enum ovsrec_flow_table_column_id column)
14746
0
{
14747
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_flow_table_columns[column]);
14748
0
}
14749
14750
/* Causes the original contents of column "external_ids" in 'row' to be
14751
 * verified as a prerequisite to completing the transaction.  That is, if
14752
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
14753
 * time that the IDL originally read its contents and the time that the
14754
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
14755
 *
14756
 * The intention is that, to ensure that no transaction commits based on dirty
14757
 * reads, an application should call this function any time "external_ids" is
14758
 * read as part of a read-modify-write operation.
14759
 *
14760
 * In some cases this function reduces to a no-op, because the current value
14761
 * of "external_ids" is already known:
14762
 *
14763
 *   - If 'row' is a row created by the current transaction (returned by
14764
 *     ovsrec_flow_table_insert()).
14765
 *
14766
 *   - If "external_ids" has already been modified (with
14767
 *     ovsrec_flow_table_set_external_ids()) within the current transaction.
14768
 *
14769
 * Because of the latter property, always call this function *before*
14770
 * ovsrec_flow_table_set_external_ids() for a given read-modify-write.
14771
 *
14772
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
14773
void
14774
ovsrec_flow_table_verify_external_ids(const struct ovsrec_flow_table *row)
14775
0
{
14776
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_external_ids);
14777
0
}
14778
14779
/* Causes the original contents of column "flow_limit" in 'row' to be
14780
 * verified as a prerequisite to completing the transaction.  That is, if
14781
 * "flow_limit" in 'row' changed (or if 'row' was deleted) between the
14782
 * time that the IDL originally read its contents and the time that the
14783
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
14784
 *
14785
 * The intention is that, to ensure that no transaction commits based on dirty
14786
 * reads, an application should call this function any time "flow_limit" is
14787
 * read as part of a read-modify-write operation.
14788
 *
14789
 * In some cases this function reduces to a no-op, because the current value
14790
 * of "flow_limit" is already known:
14791
 *
14792
 *   - If 'row' is a row created by the current transaction (returned by
14793
 *     ovsrec_flow_table_insert()).
14794
 *
14795
 *   - If "flow_limit" has already been modified (with
14796
 *     ovsrec_flow_table_set_flow_limit()) within the current transaction.
14797
 *
14798
 * Because of the latter property, always call this function *before*
14799
 * ovsrec_flow_table_set_flow_limit() for a given read-modify-write.
14800
 *
14801
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
14802
void
14803
ovsrec_flow_table_verify_flow_limit(const struct ovsrec_flow_table *row)
14804
0
{
14805
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_flow_limit);
14806
0
}
14807
14808
/* Causes the original contents of column "groups" in 'row' to be
14809
 * verified as a prerequisite to completing the transaction.  That is, if
14810
 * "groups" in 'row' changed (or if 'row' was deleted) between the
14811
 * time that the IDL originally read its contents and the time that the
14812
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
14813
 *
14814
 * The intention is that, to ensure that no transaction commits based on dirty
14815
 * reads, an application should call this function any time "groups" is
14816
 * read as part of a read-modify-write operation.
14817
 *
14818
 * In some cases this function reduces to a no-op, because the current value
14819
 * of "groups" is already known:
14820
 *
14821
 *   - If 'row' is a row created by the current transaction (returned by
14822
 *     ovsrec_flow_table_insert()).
14823
 *
14824
 *   - If "groups" has already been modified (with
14825
 *     ovsrec_flow_table_set_groups()) within the current transaction.
14826
 *
14827
 * Because of the latter property, always call this function *before*
14828
 * ovsrec_flow_table_set_groups() for a given read-modify-write.
14829
 *
14830
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
14831
void
14832
ovsrec_flow_table_verify_groups(const struct ovsrec_flow_table *row)
14833
0
{
14834
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_groups);
14835
0
}
14836
14837
/* Causes the original contents of column "name" in 'row' to be
14838
 * verified as a prerequisite to completing the transaction.  That is, if
14839
 * "name" in 'row' changed (or if 'row' was deleted) between the
14840
 * time that the IDL originally read its contents and the time that the
14841
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
14842
 *
14843
 * The intention is that, to ensure that no transaction commits based on dirty
14844
 * reads, an application should call this function any time "name" is
14845
 * read as part of a read-modify-write operation.
14846
 *
14847
 * In some cases this function reduces to a no-op, because the current value
14848
 * of "name" is already known:
14849
 *
14850
 *   - If 'row' is a row created by the current transaction (returned by
14851
 *     ovsrec_flow_table_insert()).
14852
 *
14853
 *   - If "name" has already been modified (with
14854
 *     ovsrec_flow_table_set_name()) within the current transaction.
14855
 *
14856
 * Because of the latter property, always call this function *before*
14857
 * ovsrec_flow_table_set_name() for a given read-modify-write.
14858
 *
14859
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
14860
void
14861
ovsrec_flow_table_verify_name(const struct ovsrec_flow_table *row)
14862
0
{
14863
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_name);
14864
0
}
14865
14866
/* Causes the original contents of column "overflow_policy" in 'row' to be
14867
 * verified as a prerequisite to completing the transaction.  That is, if
14868
 * "overflow_policy" in 'row' changed (or if 'row' was deleted) between the
14869
 * time that the IDL originally read its contents and the time that the
14870
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
14871
 *
14872
 * The intention is that, to ensure that no transaction commits based on dirty
14873
 * reads, an application should call this function any time "overflow_policy" is
14874
 * read as part of a read-modify-write operation.
14875
 *
14876
 * In some cases this function reduces to a no-op, because the current value
14877
 * of "overflow_policy" is already known:
14878
 *
14879
 *   - If 'row' is a row created by the current transaction (returned by
14880
 *     ovsrec_flow_table_insert()).
14881
 *
14882
 *   - If "overflow_policy" has already been modified (with
14883
 *     ovsrec_flow_table_set_overflow_policy()) within the current transaction.
14884
 *
14885
 * Because of the latter property, always call this function *before*
14886
 * ovsrec_flow_table_set_overflow_policy() for a given read-modify-write.
14887
 *
14888
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
14889
void
14890
ovsrec_flow_table_verify_overflow_policy(const struct ovsrec_flow_table *row)
14891
0
{
14892
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_overflow_policy);
14893
0
}
14894
14895
/* Causes the original contents of column "prefixes" in 'row' to be
14896
 * verified as a prerequisite to completing the transaction.  That is, if
14897
 * "prefixes" in 'row' changed (or if 'row' was deleted) between the
14898
 * time that the IDL originally read its contents and the time that the
14899
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
14900
 *
14901
 * The intention is that, to ensure that no transaction commits based on dirty
14902
 * reads, an application should call this function any time "prefixes" is
14903
 * read as part of a read-modify-write operation.
14904
 *
14905
 * In some cases this function reduces to a no-op, because the current value
14906
 * of "prefixes" is already known:
14907
 *
14908
 *   - If 'row' is a row created by the current transaction (returned by
14909
 *     ovsrec_flow_table_insert()).
14910
 *
14911
 *   - If "prefixes" has already been modified (with
14912
 *     ovsrec_flow_table_set_prefixes()) within the current transaction.
14913
 *
14914
 * Because of the latter property, always call this function *before*
14915
 * ovsrec_flow_table_set_prefixes() for a given read-modify-write.
14916
 *
14917
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
14918
void
14919
ovsrec_flow_table_verify_prefixes(const struct ovsrec_flow_table *row)
14920
0
{
14921
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_prefixes);
14922
0
}
14923
14924
/* Returns the "external_ids" column's value from the "Flow_Table" table in 'row'
14925
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
14926
 * ovsdb_datum_find_key() is an easier and more efficient way to search
14927
 * for a given key than implementing the same operation on the "cooked"
14928
 * form in 'row'.
14929
 *
14930
 * 'key_type' must be OVSDB_TYPE_STRING.
14931
 * 'value_type' must be OVSDB_TYPE_STRING.
14932
 * (This helps to avoid silent bugs if someone changes external_ids's
14933
 * type without updating the caller.)
14934
 *
14935
 * The caller must not modify or free the returned value.
14936
 *
14937
 * Various kinds of changes can invalidate the returned value: modifying
14938
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
14939
 * If the returned value is needed for a long time, it is best to make a copy
14940
 * of it with ovsdb_datum_clone().
14941
 *
14942
 * This function is rarely useful, since it is easier to access the value
14943
 * directly through the "external_ids" member in ovsrec_flow_table. */
14944
const struct ovsdb_datum *
14945
ovsrec_flow_table_get_external_ids(const struct ovsrec_flow_table *row,
14946
  enum ovsdb_atomic_type key_type OVS_UNUSED,
14947
  enum ovsdb_atomic_type value_type OVS_UNUSED)
14948
0
{
14949
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
14950
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
14951
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_external_ids);
14952
0
}
14953
14954
/* Returns the "flow_limit" column's value from the "Flow_Table" table in 'row'
14955
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
14956
 * ovsdb_datum_find_key() is an easier and more efficient way to search
14957
 * for a given key than implementing the same operation on the "cooked"
14958
 * form in 'row'.
14959
 *
14960
 * 'key_type' must be OVSDB_TYPE_INTEGER.
14961
 * (This helps to avoid silent bugs if someone changes flow_limit's
14962
 * type without updating the caller.)
14963
 *
14964
 * The caller must not modify or free the returned value.
14965
 *
14966
 * Various kinds of changes can invalidate the returned value: modifying
14967
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
14968
 * If the returned value is needed for a long time, it is best to make a copy
14969
 * of it with ovsdb_datum_clone().
14970
 *
14971
 * This function is rarely useful, since it is easier to access the value
14972
 * directly through the "flow_limit" member in ovsrec_flow_table. */
14973
const struct ovsdb_datum *
14974
ovsrec_flow_table_get_flow_limit(const struct ovsrec_flow_table *row,
14975
  enum ovsdb_atomic_type key_type OVS_UNUSED)
14976
0
{
14977
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
14978
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_flow_limit);
14979
0
}
14980
14981
/* Returns the "groups" column's value from the "Flow_Table" table in 'row'
14982
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
14983
 * ovsdb_datum_find_key() is an easier and more efficient way to search
14984
 * for a given key than implementing the same operation on the "cooked"
14985
 * form in 'row'.
14986
 *
14987
 * 'key_type' must be OVSDB_TYPE_STRING.
14988
 * (This helps to avoid silent bugs if someone changes groups's
14989
 * type without updating the caller.)
14990
 *
14991
 * The caller must not modify or free the returned value.
14992
 *
14993
 * Various kinds of changes can invalidate the returned value: modifying
14994
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
14995
 * If the returned value is needed for a long time, it is best to make a copy
14996
 * of it with ovsdb_datum_clone().
14997
 *
14998
 * This function is rarely useful, since it is easier to access the value
14999
 * directly through the "groups" member in ovsrec_flow_table. */
15000
const struct ovsdb_datum *
15001
ovsrec_flow_table_get_groups(const struct ovsrec_flow_table *row,
15002
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15003
0
{
15004
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
15005
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_groups);
15006
0
}
15007
15008
/* Returns the "name" column's value from the "Flow_Table" table in 'row'
15009
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15010
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15011
 * for a given key than implementing the same operation on the "cooked"
15012
 * form in 'row'.
15013
 *
15014
 * 'key_type' must be OVSDB_TYPE_STRING.
15015
 * (This helps to avoid silent bugs if someone changes name's
15016
 * type without updating the caller.)
15017
 *
15018
 * The caller must not modify or free the returned value.
15019
 *
15020
 * Various kinds of changes can invalidate the returned value: modifying
15021
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15022
 * If the returned value is needed for a long time, it is best to make a copy
15023
 * of it with ovsdb_datum_clone().
15024
 *
15025
 * This function is rarely useful, since it is easier to access the value
15026
 * directly through the "name" member in ovsrec_flow_table. */
15027
const struct ovsdb_datum *
15028
ovsrec_flow_table_get_name(const struct ovsrec_flow_table *row,
15029
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15030
0
{
15031
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
15032
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_name);
15033
0
}
15034
15035
/* Returns the "overflow_policy" column's value from the "Flow_Table" table in 'row'
15036
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15037
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15038
 * for a given key than implementing the same operation on the "cooked"
15039
 * form in 'row'.
15040
 *
15041
 * 'key_type' must be OVSDB_TYPE_STRING.
15042
 * (This helps to avoid silent bugs if someone changes overflow_policy's
15043
 * type without updating the caller.)
15044
 *
15045
 * The caller must not modify or free the returned value.
15046
 *
15047
 * Various kinds of changes can invalidate the returned value: modifying
15048
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15049
 * If the returned value is needed for a long time, it is best to make a copy
15050
 * of it with ovsdb_datum_clone().
15051
 *
15052
 * This function is rarely useful, since it is easier to access the value
15053
 * directly through the "overflow_policy" member in ovsrec_flow_table. */
15054
const struct ovsdb_datum *
15055
ovsrec_flow_table_get_overflow_policy(const struct ovsrec_flow_table *row,
15056
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15057
0
{
15058
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
15059
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_overflow_policy);
15060
0
}
15061
15062
/* Returns the "prefixes" column's value from the "Flow_Table" table in 'row'
15063
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15064
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15065
 * for a given key than implementing the same operation on the "cooked"
15066
 * form in 'row'.
15067
 *
15068
 * 'key_type' must be OVSDB_TYPE_STRING.
15069
 * (This helps to avoid silent bugs if someone changes prefixes's
15070
 * type without updating the caller.)
15071
 *
15072
 * The caller must not modify or free the returned value.
15073
 *
15074
 * Various kinds of changes can invalidate the returned value: modifying
15075
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15076
 * If the returned value is needed for a long time, it is best to make a copy
15077
 * of it with ovsdb_datum_clone().
15078
 *
15079
 * This function is rarely useful, since it is easier to access the value
15080
 * directly through the "prefixes" member in ovsrec_flow_table. */
15081
const struct ovsdb_datum *
15082
ovsrec_flow_table_get_prefixes(const struct ovsrec_flow_table *row,
15083
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15084
0
{
15085
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
15086
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_prefixes);
15087
0
}
15088
15089
/* Sets the "external_ids" column's value from the "Flow_Table" table in 'row'
15090
 * to 'external_ids'.
15091
 *
15092
 * The caller retains ownership of 'external_ids' and everything in it. */
15093
void
15094
ovsrec_flow_table_set_external_ids(const struct ovsrec_flow_table *row, const struct smap *external_ids)
15095
0
{
15096
0
    struct ovsdb_datum datum;
15097
15098
0
    if (external_ids) {
15099
0
        ovsdb_datum_from_smap(&datum, external_ids);
15100
0
    } else {
15101
0
        ovsdb_datum_init_empty(&datum);
15102
0
    }
15103
0
    ovsdb_idl_txn_write(&row->header_,
15104
0
                        &ovsrec_flow_table_col_external_ids,
15105
0
                        &datum);
15106
0
}
15107
15108
15109
/* Sets the "flow_limit" column from the "Flow_Table" table in 'row' to
15110
 * the 'flow_limit' set with 'n_flow_limit' entries.
15111
 *
15112
 * 'n_flow_limit' may be 0 or 1; if it is 0, then 'flow_limit'
15113
 * may be NULL.
15114
 *
15115
 * Argument constraints: at least 0
15116
 *
15117
 * The caller retains ownership of the arguments. */
15118
void
15119
ovsrec_flow_table_set_flow_limit(const struct ovsrec_flow_table *row, const int64_t *flow_limit, size_t n_flow_limit)
15120
0
{
15121
0
    struct ovsdb_datum datum;
15122
15123
0
    datum.refcnt = NULL;
15124
15125
0
    if (n_flow_limit) {
15126
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
15127
0
        datum.n = 1;
15128
0
        datum.keys = key;
15129
0
        key->integer = *flow_limit;
15130
0
    } else {
15131
0
        datum.n = 0;
15132
0
        datum.keys = NULL;
15133
0
    }
15134
0
    datum.values = NULL;
15135
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_col_flow_limit, &datum);
15136
0
}
15137
15138
/* Sets the "groups" column from the "Flow_Table" table in 'row' to
15139
 * the 'groups' set with 'n_groups' entries.
15140
 *
15141
 * The caller retains ownership of the arguments. */
15142
void
15143
ovsrec_flow_table_set_groups(const struct ovsrec_flow_table *row, const char **groups, size_t n_groups)
15144
0
{
15145
0
    struct ovsdb_datum datum;
15146
15147
0
    datum.refcnt = NULL;
15148
15149
0
    datum.n = n_groups;
15150
0
    datum.keys = n_groups ? xmalloc(n_groups * sizeof *datum.keys) : NULL;
15151
0
    datum.values = NULL;
15152
0
    for (size_t i = 0; i < n_groups; i++) {
15153
0
        datum.keys[i].s = ovsdb_atom_string_create(groups[i]);
15154
0
    }
15155
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_col_groups, &datum);
15156
0
}
15157
15158
/* Sets the "name" column from the "Flow_Table" table in 'row' to
15159
 * the 'name' set.
15160
 *
15161
 * If "name" is null, the column will be the empty set,
15162
 * otherwise it will contain the specified value.
15163
 *
15164
 * The caller retains ownership of the arguments. */
15165
void
15166
ovsrec_flow_table_set_name(const struct ovsrec_flow_table *row, const char *name)
15167
0
{
15168
0
    struct ovsdb_datum datum;
15169
15170
0
    datum.refcnt = NULL;
15171
15172
0
    if (name) {
15173
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
15174
0
        datum.n = 1;
15175
0
        datum.keys = key;
15176
0
        key->s = ovsdb_atom_string_create(name);
15177
0
    } else {
15178
0
        datum.n = 0;
15179
0
        datum.keys = NULL;
15180
0
    }
15181
0
    datum.values = NULL;
15182
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_col_name, &datum);
15183
0
}
15184
15185
/* Sets the "overflow_policy" column from the "Flow_Table" table in 'row' to
15186
 * the 'overflow_policy' set.
15187
 *
15188
 * If "overflow_policy" is null, the column will be the empty set,
15189
 * otherwise it will contain the specified value.
15190
 *
15191
 * Argument constraints: either "evict" or "refuse"
15192
 *
15193
 * The caller retains ownership of the arguments. */
15194
void
15195
ovsrec_flow_table_set_overflow_policy(const struct ovsrec_flow_table *row, const char *overflow_policy)
15196
0
{
15197
0
    struct ovsdb_datum datum;
15198
15199
0
    datum.refcnt = NULL;
15200
15201
0
    if (overflow_policy) {
15202
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
15203
0
        datum.n = 1;
15204
0
        datum.keys = key;
15205
0
        key->s = ovsdb_atom_string_create(overflow_policy);
15206
0
    } else {
15207
0
        datum.n = 0;
15208
0
        datum.keys = NULL;
15209
0
    }
15210
0
    datum.values = NULL;
15211
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_col_overflow_policy, &datum);
15212
0
}
15213
15214
/* Sets the "prefixes" column from the "Flow_Table" table in 'row' to
15215
 * the 'prefixes' set with 'n_prefixes' entries.
15216
 *
15217
 * The caller retains ownership of the arguments. */
15218
void
15219
ovsrec_flow_table_set_prefixes(const struct ovsrec_flow_table *row, const char **prefixes, size_t n_prefixes)
15220
0
{
15221
0
    struct ovsdb_datum datum;
15222
15223
0
    datum.refcnt = NULL;
15224
15225
0
    datum.n = n_prefixes;
15226
0
    datum.keys = n_prefixes ? xmalloc(n_prefixes * sizeof *datum.keys) : NULL;
15227
0
    datum.values = NULL;
15228
0
    for (size_t i = 0; i < n_prefixes; i++) {
15229
0
        datum.keys[i].s = ovsdb_atom_string_create(prefixes[i]);
15230
0
    }
15231
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_col_prefixes, &datum);
15232
0
}
15233
15234
/* Sets an element of the "external_ids" map column from the "Flow_Table" table in 'row'
15235
 * to 'new_value' given the key value 'new_key'.
15236
 *
15237
 */
15238
void
15239
ovsrec_flow_table_update_external_ids_setkey(const struct ovsrec_flow_table *row, const char *new_key, const char *new_value)
15240
0
{
15241
0
    struct ovsdb_datum *datum;
15242
15243
0
    datum = xmalloc(sizeof *datum);
15244
0
    datum->n = 1;
15245
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
15246
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
15247
0
    datum->refcnt = NULL;
15248
15249
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
15250
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
15251
15252
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
15253
0
                                    &ovsrec_flow_table_col_external_ids,
15254
0
                                    datum);
15255
0
}
15256
15257
/* Deletes an element of the "external_ids" map column from the "Flow_Table" table in 'row'
15258
 * given the key value 'delete_key'.
15259
 *
15260
 */
15261
void
15262
ovsrec_flow_table_update_external_ids_delkey(const struct ovsrec_flow_table *row, const char *delete_key)
15263
0
{
15264
0
    struct ovsdb_datum *datum;
15265
15266
0
    datum = xmalloc(sizeof *datum);
15267
0
    datum->n = 1;
15268
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
15269
0
    datum->values = NULL;
15270
0
    datum->refcnt = NULL;
15271
15272
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
15273
15274
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
15275
0
                                    &ovsrec_flow_table_col_external_ids,
15276
0
                                    datum);
15277
0
}
15278
15279
/* Adds the value 'new_value' to the "flow_limit" set column from the "Flow_Table" table
15280
 * in 'row'.
15281
 *
15282
 */
15283
void
15284
ovsrec_flow_table_update_flow_limit_addvalue(const struct ovsrec_flow_table *row, int64_t new_value)
15285
0
{
15286
0
    struct ovsdb_datum *datum;
15287
15288
0
    datum = xmalloc(sizeof *datum);
15289
0
    datum->n = 1;
15290
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
15291
0
    datum->values = NULL;
15292
0
    datum->refcnt = NULL;
15293
15294
0
    datum->keys[0].integer = new_value;
15295
15296
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
15297
0
                                    &ovsrec_flow_table_col_flow_limit,
15298
0
                                    datum);
15299
0
}
15300
15301
/* Deletes the value 'delete_value' from the "flow_limit" set column from the
15302
 * "Flow_Table" table in 'row'.
15303
 *
15304
 */
15305
void
15306
ovsrec_flow_table_update_flow_limit_delvalue(const struct ovsrec_flow_table *row, int64_t delete_value)
15307
0
{
15308
0
    struct ovsdb_datum *datum;
15309
15310
0
    datum = xmalloc(sizeof *datum);
15311
0
    datum->n = 1;
15312
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
15313
0
    datum->values = NULL;
15314
0
    datum->refcnt = NULL;
15315
15316
0
    datum->keys[0].integer = delete_value;
15317
15318
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
15319
0
                                    &ovsrec_flow_table_col_flow_limit,
15320
0
                                    datum);
15321
0
}
15322
15323
/* Adds the value 'new_value' to the "groups" set column from the "Flow_Table" table
15324
 * in 'row'.
15325
 *
15326
 */
15327
void
15328
ovsrec_flow_table_update_groups_addvalue(const struct ovsrec_flow_table *row, const char *new_value)
15329
0
{
15330
0
    struct ovsdb_datum *datum;
15331
15332
0
    datum = xmalloc(sizeof *datum);
15333
0
    datum->n = 1;
15334
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
15335
0
    datum->values = NULL;
15336
0
    datum->refcnt = NULL;
15337
15338
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
15339
15340
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
15341
0
                                    &ovsrec_flow_table_col_groups,
15342
0
                                    datum);
15343
0
}
15344
15345
/* Deletes the value 'delete_value' from the "groups" set column from the
15346
 * "Flow_Table" table in 'row'.
15347
 *
15348
 */
15349
void
15350
ovsrec_flow_table_update_groups_delvalue(const struct ovsrec_flow_table *row, const char *delete_value)
15351
0
{
15352
0
    struct ovsdb_datum *datum;
15353
15354
0
    datum = xmalloc(sizeof *datum);
15355
0
    datum->n = 1;
15356
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
15357
0
    datum->values = NULL;
15358
0
    datum->refcnt = NULL;
15359
15360
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
15361
15362
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
15363
0
                                    &ovsrec_flow_table_col_groups,
15364
0
                                    datum);
15365
0
}
15366
15367
/* Adds the value 'new_value' to the "name" set column from the "Flow_Table" table
15368
 * in 'row'.
15369
 *
15370
 */
15371
void
15372
ovsrec_flow_table_update_name_addvalue(const struct ovsrec_flow_table *row, const char *new_value)
15373
0
{
15374
0
    struct ovsdb_datum *datum;
15375
15376
0
    datum = xmalloc(sizeof *datum);
15377
0
    datum->n = 1;
15378
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
15379
0
    datum->values = NULL;
15380
0
    datum->refcnt = NULL;
15381
15382
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
15383
15384
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
15385
0
                                    &ovsrec_flow_table_col_name,
15386
0
                                    datum);
15387
0
}
15388
15389
/* Deletes the value 'delete_value' from the "name" set column from the
15390
 * "Flow_Table" table in 'row'.
15391
 *
15392
 */
15393
void
15394
ovsrec_flow_table_update_name_delvalue(const struct ovsrec_flow_table *row, const char *delete_value)
15395
0
{
15396
0
    struct ovsdb_datum *datum;
15397
15398
0
    datum = xmalloc(sizeof *datum);
15399
0
    datum->n = 1;
15400
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
15401
0
    datum->values = NULL;
15402
0
    datum->refcnt = NULL;
15403
15404
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
15405
15406
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
15407
0
                                    &ovsrec_flow_table_col_name,
15408
0
                                    datum);
15409
0
}
15410
15411
/* Adds the value 'new_value' to the "overflow_policy" set column from the "Flow_Table" table
15412
 * in 'row'.
15413
 *
15414
 */
15415
void
15416
ovsrec_flow_table_update_overflow_policy_addvalue(const struct ovsrec_flow_table *row, const char *new_value)
15417
0
{
15418
0
    struct ovsdb_datum *datum;
15419
15420
0
    datum = xmalloc(sizeof *datum);
15421
0
    datum->n = 1;
15422
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
15423
0
    datum->values = NULL;
15424
0
    datum->refcnt = NULL;
15425
15426
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
15427
15428
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
15429
0
                                    &ovsrec_flow_table_col_overflow_policy,
15430
0
                                    datum);
15431
0
}
15432
15433
/* Deletes the value 'delete_value' from the "overflow_policy" set column from the
15434
 * "Flow_Table" table in 'row'.
15435
 *
15436
 */
15437
void
15438
ovsrec_flow_table_update_overflow_policy_delvalue(const struct ovsrec_flow_table *row, const char *delete_value)
15439
0
{
15440
0
    struct ovsdb_datum *datum;
15441
15442
0
    datum = xmalloc(sizeof *datum);
15443
0
    datum->n = 1;
15444
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
15445
0
    datum->values = NULL;
15446
0
    datum->refcnt = NULL;
15447
15448
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
15449
15450
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
15451
0
                                    &ovsrec_flow_table_col_overflow_policy,
15452
0
                                    datum);
15453
0
}
15454
15455
/* Adds the value 'new_value' to the "prefixes" set column from the "Flow_Table" table
15456
 * in 'row'.
15457
 *
15458
 */
15459
void
15460
ovsrec_flow_table_update_prefixes_addvalue(const struct ovsrec_flow_table *row, const char *new_value)
15461
0
{
15462
0
    struct ovsdb_datum *datum;
15463
15464
0
    datum = xmalloc(sizeof *datum);
15465
0
    datum->n = 1;
15466
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
15467
0
    datum->values = NULL;
15468
0
    datum->refcnt = NULL;
15469
15470
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
15471
15472
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
15473
0
                                    &ovsrec_flow_table_col_prefixes,
15474
0
                                    datum);
15475
0
}
15476
15477
/* Deletes the value 'delete_value' from the "prefixes" set column from the
15478
 * "Flow_Table" table in 'row'.
15479
 *
15480
 */
15481
void
15482
ovsrec_flow_table_update_prefixes_delvalue(const struct ovsrec_flow_table *row, const char *delete_value)
15483
0
{
15484
0
    struct ovsdb_datum *datum;
15485
15486
0
    datum = xmalloc(sizeof *datum);
15487
0
    datum->n = 1;
15488
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
15489
0
    datum->values = NULL;
15490
0
    datum->refcnt = NULL;
15491
15492
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
15493
15494
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
15495
0
                                    &ovsrec_flow_table_col_prefixes,
15496
0
                                    datum);
15497
0
}
15498
15499
/* Sets the "external_ids" column's value from the "Flow_Table" table in 'row'
15500
 * to 'external_ids'.
15501
 *
15502
 * The caller retains ownership of 'external_ids' and everything in it. */
15503
void
15504
ovsrec_flow_table_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
15505
0
{
15506
0
    struct ovsdb_datum datum;
15507
15508
0
    if (external_ids) {
15509
0
        ovsdb_datum_from_smap(&datum, external_ids);
15510
0
    } else {
15511
0
        ovsdb_datum_init_empty(&datum);
15512
0
    }
15513
15514
0
    ovsdb_idl_condition_add_clause(cond,
15515
0
                                   function,
15516
0
                                   &ovsrec_flow_table_col_external_ids,
15517
0
                                   &datum);
15518
15519
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_external_ids.type);
15520
0
}
15521
15522
15523
/* Sets the "flow_limit" column from the "Flow_Table" table in 'row' to
15524
 * the 'flow_limit' set with 'n_flow_limit' entries.
15525
 *
15526
 * 'n_flow_limit' may be 0 or 1; if it is 0, then 'flow_limit'
15527
 * may be NULL.
15528
 *
15529
 * Argument constraints: at least 0
15530
 *
15531
 * The caller retains ownership of the arguments. */
15532
void
15533
ovsrec_flow_table_add_clause_flow_limit(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *flow_limit, size_t n_flow_limit)
15534
0
{
15535
0
    struct ovsdb_datum datum;
15536
15537
0
    datum.refcnt = NULL;
15538
15539
0
    if (n_flow_limit) {
15540
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
15541
0
        datum.n = 1;
15542
0
        datum.keys = key;
15543
0
        key->integer = *flow_limit;
15544
0
    } else {
15545
0
        datum.n = 0;
15546
0
        datum.keys = NULL;
15547
0
    }
15548
0
    datum.values = NULL;
15549
0
    ovsdb_idl_condition_add_clause(cond,
15550
0
                          function,
15551
0
                          &ovsrec_flow_table_col_flow_limit,
15552
0
                          &datum);
15553
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_flow_limit.type);
15554
0
}
15555
15556
/* Sets the "groups" column from the "Flow_Table" table in 'row' to
15557
 * the 'groups' set with 'n_groups' entries.
15558
 *
15559
 * The caller retains ownership of the arguments. */
15560
void
15561
ovsrec_flow_table_add_clause_groups(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **groups, size_t n_groups)
15562
0
{
15563
0
    struct ovsdb_datum datum;
15564
15565
0
    datum.refcnt = NULL;
15566
0
    datum.n = n_groups;
15567
0
    datum.keys = n_groups ? xmalloc(n_groups * sizeof *datum.keys) : NULL;
15568
0
    datum.values = NULL;
15569
0
    for (size_t i = 0; i < n_groups; i++) {
15570
0
        datum.keys[i].s = ovsdb_atom_string_create(groups[i]);
15571
0
    }
15572
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_flow_table_col_groups.type);
15573
0
    ovsdb_idl_condition_add_clause(cond,
15574
0
                          function,
15575
0
                          &ovsrec_flow_table_col_groups,
15576
0
                          &datum);
15577
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_groups.type);
15578
0
}
15579
15580
/* Sets the "name" column from the "Flow_Table" table in 'row' to
15581
 * the 'name' set.
15582
 *
15583
 * If "name" is null, the column will be the empty set,
15584
 * otherwise it will contain the specified value.
15585
 *
15586
 * The caller retains ownership of the arguments. */
15587
void
15588
ovsrec_flow_table_add_clause_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *name)
15589
0
{
15590
0
    struct ovsdb_datum datum;
15591
15592
0
    datum.refcnt = NULL;
15593
15594
0
    if (name) {
15595
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
15596
0
        datum.n = 1;
15597
0
        datum.keys = key;
15598
0
        key->s = ovsdb_atom_string_create(name);
15599
0
    } else {
15600
0
        datum.n = 0;
15601
0
        datum.keys = NULL;
15602
0
    }
15603
0
    datum.values = NULL;
15604
0
    ovsdb_idl_condition_add_clause(cond,
15605
0
                          function,
15606
0
                          &ovsrec_flow_table_col_name,
15607
0
                          &datum);
15608
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_name.type);
15609
0
}
15610
15611
/* Sets the "overflow_policy" column from the "Flow_Table" table in 'row' to
15612
 * the 'overflow_policy' set.
15613
 *
15614
 * If "overflow_policy" is null, the column will be the empty set,
15615
 * otherwise it will contain the specified value.
15616
 *
15617
 * Argument constraints: either "evict" or "refuse"
15618
 *
15619
 * The caller retains ownership of the arguments. */
15620
void
15621
ovsrec_flow_table_add_clause_overflow_policy(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *overflow_policy)
15622
0
{
15623
0
    struct ovsdb_datum datum;
15624
15625
0
    datum.refcnt = NULL;
15626
15627
0
    if (overflow_policy) {
15628
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
15629
0
        datum.n = 1;
15630
0
        datum.keys = key;
15631
0
        key->s = ovsdb_atom_string_create(overflow_policy);
15632
0
    } else {
15633
0
        datum.n = 0;
15634
0
        datum.keys = NULL;
15635
0
    }
15636
0
    datum.values = NULL;
15637
0
    ovsdb_idl_condition_add_clause(cond,
15638
0
                          function,
15639
0
                          &ovsrec_flow_table_col_overflow_policy,
15640
0
                          &datum);
15641
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_overflow_policy.type);
15642
0
}
15643
15644
/* Sets the "prefixes" column from the "Flow_Table" table in 'row' to
15645
 * the 'prefixes' set with 'n_prefixes' entries.
15646
 *
15647
 * The caller retains ownership of the arguments. */
15648
void
15649
ovsrec_flow_table_add_clause_prefixes(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **prefixes, size_t n_prefixes)
15650
0
{
15651
0
    struct ovsdb_datum datum;
15652
15653
0
    datum.refcnt = NULL;
15654
0
    datum.n = n_prefixes;
15655
0
    datum.keys = n_prefixes ? xmalloc(n_prefixes * sizeof *datum.keys) : NULL;
15656
0
    datum.values = NULL;
15657
0
    for (size_t i = 0; i < n_prefixes; i++) {
15658
0
        datum.keys[i].s = ovsdb_atom_string_create(prefixes[i]);
15659
0
    }
15660
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_flow_table_col_prefixes.type);
15661
0
    ovsdb_idl_condition_add_clause(cond,
15662
0
                          function,
15663
0
                          &ovsrec_flow_table_col_prefixes,
15664
0
                          &datum);
15665
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_prefixes.type);
15666
0
}
15667
15668
/* Destroy 'row' of kind "Flow_Table". The row must have been
15669
 * created with ovsdb_idl_index_init_row.
15670
 */
15671
void
15672
ovsrec_flow_table_index_destroy_row(const struct ovsrec_flow_table *row)
15673
0
{
15674
0
    ovsdb_idl_index_destroy_row(&row->header_);
15675
0
}
15676
        
15677
15678
/* Creates a new row of kind "Flow_Table". */
15679
struct ovsrec_flow_table *
15680
ovsrec_flow_table_index_init_row(struct ovsdb_idl_index *index)
15681
0
{
15682
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_table);
15683
0
    return ALIGNED_CAST(struct ovsrec_flow_table *, ovsdb_idl_index_init_row(index));
15684
0
}
15685
15686
struct ovsrec_flow_table *
15687
ovsrec_flow_table_index_find(struct ovsdb_idl_index *index, const struct ovsrec_flow_table *target)
15688
0
{
15689
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_table);
15690
0
    return ovsrec_flow_table_cast(ovsdb_idl_index_find(index, &target->header_));
15691
0
}
15692
15693
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
15694
int
15695
ovsrec_flow_table_index_compare(
15696
    struct ovsdb_idl_index *index, 
15697
    const struct ovsrec_flow_table *a, 
15698
    const struct ovsrec_flow_table *b)
15699
0
{
15700
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
15701
0
}
15702
15703
struct ovsdb_idl_cursor
15704
ovsrec_flow_table_cursor_first(struct ovsdb_idl_index *index)
15705
0
{
15706
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_table);
15707
0
    return ovsdb_idl_cursor_first(index);
15708
0
}
15709
15710
struct ovsdb_idl_cursor
15711
ovsrec_flow_table_cursor_first_eq(
15712
    struct ovsdb_idl_index *index, const struct ovsrec_flow_table *target)
15713
0
{
15714
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_table);
15715
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
15716
0
}
15717
15718
struct ovsdb_idl_cursor
15719
ovsrec_flow_table_cursor_first_ge(
15720
    struct ovsdb_idl_index *index, const struct ovsrec_flow_table *target)
15721
0
{
15722
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_table);
15723
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
15724
0
}
15725
15726
struct ovsrec_flow_table *
15727
ovsrec_flow_table_cursor_data(struct ovsdb_idl_cursor *cursor)
15728
0
{
15729
0
    return ovsrec_flow_table_cast(ovsdb_idl_cursor_data(cursor));
15730
0
}
15731
15732
15733
/* Sets the "external_ids" column's value from the "Flow_Table" table in 'row'
15734
 * to 'external_ids'.
15735
 *
15736
 * The caller retains ownership of 'external_ids' and everything in it. */
15737
void
15738
ovsrec_flow_table_index_set_external_ids(const struct ovsrec_flow_table *row, const struct smap *external_ids)
15739
0
{
15740
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
15741
15742
0
    if (external_ids) {
15743
0
        struct smap_node *node;
15744
0
        size_t i;
15745
15746
0
        datum->n = smap_count(external_ids);
15747
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
15748
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
15749
0
        datum->refcnt = NULL;
15750
15751
0
        i = 0;
15752
0
        SMAP_FOR_EACH (node, external_ids) {
15753
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
15754
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
15755
0
            i++;
15756
0
        }
15757
0
        ovsdb_datum_sort_unique(datum, &ovsrec_flow_table_col_external_ids.type);
15758
0
    } else {
15759
0
        ovsdb_datum_init_empty(datum);
15760
0
    }
15761
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
15762
0
                          &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_EXTERNAL_IDS],
15763
0
                          datum,
15764
0
                          &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]);
15765
0
    free(datum);
15766
0
}
15767
15768
15769
/* Sets the "flow_limit" column from the "Flow_Table" table in 'row' to
15770
 * the 'flow_limit' set with 'n_flow_limit' entries.
15771
 *
15772
 * 'n_flow_limit' may be 0 or 1; if it is 0, then 'flow_limit'
15773
 * may be NULL.
15774
 *
15775
 * Argument constraints: at least 0
15776
 *
15777
 * The caller retains ownership of the arguments. */
15778
void
15779
ovsrec_flow_table_index_set_flow_limit(const struct ovsrec_flow_table *row, const int64_t *flow_limit, size_t n_flow_limit)
15780
0
{
15781
0
    struct ovsdb_datum datum;
15782
15783
0
    datum.refcnt = NULL;
15784
0
    union ovsdb_atom *key;
15785
15786
0
    if (n_flow_limit) {
15787
0
        key = xmalloc(sizeof(union ovsdb_atom));
15788
0
        datum.n = 1;
15789
0
        datum.keys = key;
15790
0
        key->integer = *flow_limit;
15791
0
    } else {
15792
0
        datum.n = 0;
15793
0
        datum.keys = NULL;
15794
0
    }
15795
0
    datum.values = NULL;
15796
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_flow_table_columns[ OVSREC_FLOW_TABLE_COL_FLOW_LIMIT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]);
15797
0
}
15798
15799
/* Sets the "groups" column from the "Flow_Table" table in 'row' to
15800
 * the 'groups' set with 'n_groups' entries.
15801
 *
15802
 * The caller retains ownership of the arguments. */
15803
void
15804
ovsrec_flow_table_index_set_groups(const struct ovsrec_flow_table *row, const char **groups, size_t n_groups)
15805
0
{
15806
0
    struct ovsdb_datum datum;
15807
15808
0
    datum.refcnt = NULL;
15809
0
    size_t i;
15810
15811
0
    datum.n = n_groups;
15812
0
    datum.keys = n_groups ? xmalloc(n_groups * sizeof *datum.keys) : NULL;
15813
0
    datum.values = NULL;
15814
0
    for (i = 0; i < n_groups; i++) {
15815
0
        datum.keys[i].s = ovsdb_atom_string_create(groups[i]);
15816
0
    }
15817
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_flow_table_col_groups.type);
15818
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_flow_table_columns[ OVSREC_FLOW_TABLE_COL_GROUPS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]);
15819
0
}
15820
15821
/* Sets the "name" column from the "Flow_Table" table in 'row' to
15822
 * the 'name' set.
15823
 *
15824
 * If "name" is null, the column will be the empty set,
15825
 * otherwise it will contain the specified value.
15826
 *
15827
 * The caller retains ownership of the arguments. */
15828
void
15829
ovsrec_flow_table_index_set_name(const struct ovsrec_flow_table *row, const char *name)
15830
0
{
15831
0
    struct ovsdb_datum datum;
15832
15833
0
    datum.refcnt = NULL;
15834
0
    union ovsdb_atom *key;
15835
15836
0
    if (name) {
15837
0
        key = xmalloc(sizeof (union ovsdb_atom));
15838
0
        datum.n = 1;
15839
0
        datum.keys = key;
15840
0
        key->s = ovsdb_atom_string_create(name);
15841
0
    } else {
15842
0
        datum.n = 0;
15843
0
        datum.keys = NULL;
15844
0
    }
15845
0
    datum.values = NULL;
15846
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_flow_table_columns[ OVSREC_FLOW_TABLE_COL_NAME ], &datum, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]);
15847
0
}
15848
15849
/* Sets the "overflow_policy" column from the "Flow_Table" table in 'row' to
15850
 * the 'overflow_policy' set.
15851
 *
15852
 * If "overflow_policy" is null, the column will be the empty set,
15853
 * otherwise it will contain the specified value.
15854
 *
15855
 * Argument constraints: either "evict" or "refuse"
15856
 *
15857
 * The caller retains ownership of the arguments. */
15858
void
15859
ovsrec_flow_table_index_set_overflow_policy(const struct ovsrec_flow_table *row, const char *overflow_policy)
15860
0
{
15861
0
    struct ovsdb_datum datum;
15862
15863
0
    datum.refcnt = NULL;
15864
0
    union ovsdb_atom *key;
15865
15866
0
    if (overflow_policy) {
15867
0
        key = xmalloc(sizeof (union ovsdb_atom));
15868
0
        datum.n = 1;
15869
0
        datum.keys = key;
15870
0
        key->s = ovsdb_atom_string_create(overflow_policy);
15871
0
    } else {
15872
0
        datum.n = 0;
15873
0
        datum.keys = NULL;
15874
0
    }
15875
0
    datum.values = NULL;
15876
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_flow_table_columns[ OVSREC_FLOW_TABLE_COL_OVERFLOW_POLICY ], &datum, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]);
15877
0
}
15878
15879
/* Sets the "prefixes" column from the "Flow_Table" table in 'row' to
15880
 * the 'prefixes' set with 'n_prefixes' entries.
15881
 *
15882
 * The caller retains ownership of the arguments. */
15883
void
15884
ovsrec_flow_table_index_set_prefixes(const struct ovsrec_flow_table *row, const char **prefixes, size_t n_prefixes)
15885
0
{
15886
0
    struct ovsdb_datum datum;
15887
15888
0
    datum.refcnt = NULL;
15889
0
    size_t i;
15890
15891
0
    datum.n = n_prefixes;
15892
0
    datum.keys = n_prefixes ? xmalloc(n_prefixes * sizeof *datum.keys) : NULL;
15893
0
    datum.values = NULL;
15894
0
    for (i = 0; i < n_prefixes; i++) {
15895
0
        datum.keys[i].s = ovsdb_atom_string_create(prefixes[i]);
15896
0
    }
15897
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_flow_table_col_prefixes.type);
15898
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_flow_table_columns[ OVSREC_FLOW_TABLE_COL_PREFIXES ], &datum, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]);
15899
0
}
15900
15901
struct ovsdb_idl_column ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_N_COLUMNS];
15902
15903
unsigned int
15904
ovsrec_flow_table_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
15905
0
{
15906
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_flow_table, condition);
15907
0
}
15908
static struct json Flow_Table_col_overflow_policy_key_enum_key_strings[2] = {
15909
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "evict", .count = 2 },
15910
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "refuse", .count = 2 },
15911
};
15912
static union ovsdb_atom Flow_Table_col_overflow_policy_key_enum_keys[2] = {
15913
    { .s = &Flow_Table_col_overflow_policy_key_enum_key_strings[0] },
15914
    { .s = &Flow_Table_col_overflow_policy_key_enum_key_strings[1] },
15915
};
15916
static struct ovsdb_datum Flow_Table_col_overflow_policy_key_enum = {
15917
    .n = 2,
15918
    .keys = Flow_Table_col_overflow_policy_key_enum_keys,
15919
};
15920
15921
struct ovsdb_idl_column ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_N_COLUMNS] = {
15922
    [OVSREC_FLOW_TABLE_COL_EXTERNAL_IDS] = {
15923
         .name = "external_ids",
15924
         .type = {
15925
            .key = {
15926
               .type = OVSDB_TYPE_STRING,
15927
               .string = { .minLen = 0, .maxLen = UINT_MAX },
15928
            },
15929
            .value = {
15930
                .type = OVSDB_TYPE_STRING,
15931
                .string = { .minLen = 0, .maxLen = UINT_MAX },
15932
            },
15933
            .n_min = 0,
15934
            .n_max = UINT_MAX,
15935
         },
15936
         .is_mutable = true,
15937
         .is_synthetic = false,
15938
         .parse = ovsrec_flow_table_parse_external_ids,
15939
         .unparse = ovsrec_flow_table_unparse_external_ids,
15940
    },
15941
15942
    [OVSREC_FLOW_TABLE_COL_FLOW_LIMIT] = {
15943
         .name = "flow_limit",
15944
         .type = {
15945
            .key = {
15946
               .type = OVSDB_TYPE_INTEGER,
15947
               .integer = { .min = INT64_C(0), .max = INT64_MAX },
15948
            },
15949
            .value = OVSDB_BASE_VOID_INIT,
15950
            .n_min = 0,
15951
            .n_max = 1,
15952
         },
15953
         .is_mutable = true,
15954
         .is_synthetic = false,
15955
         .parse = ovsrec_flow_table_parse_flow_limit,
15956
         .unparse = ovsrec_flow_table_unparse_flow_limit,
15957
    },
15958
15959
    [OVSREC_FLOW_TABLE_COL_GROUPS] = {
15960
         .name = "groups",
15961
         .type = {
15962
            .key = {
15963
               .type = OVSDB_TYPE_STRING,
15964
               .string = { .minLen = 0, .maxLen = UINT_MAX },
15965
            },
15966
            .value = OVSDB_BASE_VOID_INIT,
15967
            .n_min = 0,
15968
            .n_max = UINT_MAX,
15969
         },
15970
         .is_mutable = true,
15971
         .is_synthetic = false,
15972
         .parse = ovsrec_flow_table_parse_groups,
15973
         .unparse = ovsrec_flow_table_unparse_groups,
15974
    },
15975
15976
    [OVSREC_FLOW_TABLE_COL_NAME] = {
15977
         .name = "name",
15978
         .type = {
15979
            .key = {
15980
               .type = OVSDB_TYPE_STRING,
15981
               .string = { .minLen = 0, .maxLen = UINT_MAX },
15982
            },
15983
            .value = OVSDB_BASE_VOID_INIT,
15984
            .n_min = 0,
15985
            .n_max = 1,
15986
         },
15987
         .is_mutable = true,
15988
         .is_synthetic = false,
15989
         .parse = ovsrec_flow_table_parse_name,
15990
         .unparse = ovsrec_flow_table_unparse_name,
15991
    },
15992
15993
    [OVSREC_FLOW_TABLE_COL_OVERFLOW_POLICY] = {
15994
         .name = "overflow_policy",
15995
         .type = {
15996
            .key = {
15997
               .type = OVSDB_TYPE_STRING,
15998
               .enum_ = &Flow_Table_col_overflow_policy_key_enum,
15999
               .string = { .minLen = 0, .maxLen = UINT_MAX },
16000
            },
16001
            .value = OVSDB_BASE_VOID_INIT,
16002
            .n_min = 0,
16003
            .n_max = 1,
16004
         },
16005
         .is_mutable = true,
16006
         .is_synthetic = false,
16007
         .parse = ovsrec_flow_table_parse_overflow_policy,
16008
         .unparse = ovsrec_flow_table_unparse_overflow_policy,
16009
    },
16010
16011
    [OVSREC_FLOW_TABLE_COL_PREFIXES] = {
16012
         .name = "prefixes",
16013
         .type = {
16014
            .key = {
16015
               .type = OVSDB_TYPE_STRING,
16016
               .string = { .minLen = 0, .maxLen = UINT_MAX },
16017
            },
16018
            .value = OVSDB_BASE_VOID_INIT,
16019
            .n_min = 0,
16020
            .n_max = 4,
16021
         },
16022
         .is_mutable = true,
16023
         .is_synthetic = false,
16024
         .parse = ovsrec_flow_table_parse_prefixes,
16025
         .unparse = ovsrec_flow_table_unparse_prefixes,
16026
    },
16027
16028
};
16029

16030
/* IPFIX table. */
16031
16032
bool
16033
ovsrec_server_has_ipfix_table_col_cache_active_timeout(const struct ovsdb_idl *idl)
16034
0
{
16035
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_cache_active_timeout);
16036
0
}
16037
16038
const struct ovsdb_type *
16039
ovsrec_ipfix_cache_active_timeout_server_type(const struct ovsdb_idl *idl)
16040
0
{
16041
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ipfix_col_cache_active_timeout);
16042
0
}
16043
16044
16045
bool
16046
ovsrec_server_has_ipfix_table_col_cache_max_flows(const struct ovsdb_idl *idl)
16047
0
{
16048
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_cache_max_flows);
16049
0
}
16050
16051
const struct ovsdb_type *
16052
ovsrec_ipfix_cache_max_flows_server_type(const struct ovsdb_idl *idl)
16053
0
{
16054
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ipfix_col_cache_max_flows);
16055
0
}
16056
16057
16058
bool
16059
ovsrec_server_has_ipfix_table_col_external_ids(const struct ovsdb_idl *idl)
16060
0
{
16061
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_external_ids);
16062
0
}
16063
16064
const struct ovsdb_type *
16065
ovsrec_ipfix_external_ids_server_type(const struct ovsdb_idl *idl)
16066
0
{
16067
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ipfix_col_external_ids);
16068
0
}
16069
16070
16071
bool
16072
ovsrec_server_has_ipfix_table_col_obs_domain_id(const struct ovsdb_idl *idl)
16073
0
{
16074
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_obs_domain_id);
16075
0
}
16076
16077
const struct ovsdb_type *
16078
ovsrec_ipfix_obs_domain_id_server_type(const struct ovsdb_idl *idl)
16079
0
{
16080
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ipfix_col_obs_domain_id);
16081
0
}
16082
16083
16084
bool
16085
ovsrec_server_has_ipfix_table_col_obs_point_id(const struct ovsdb_idl *idl)
16086
0
{
16087
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_obs_point_id);
16088
0
}
16089
16090
const struct ovsdb_type *
16091
ovsrec_ipfix_obs_point_id_server_type(const struct ovsdb_idl *idl)
16092
0
{
16093
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ipfix_col_obs_point_id);
16094
0
}
16095
16096
16097
bool
16098
ovsrec_server_has_ipfix_table_col_other_config(const struct ovsdb_idl *idl)
16099
0
{
16100
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_other_config);
16101
0
}
16102
16103
const struct ovsdb_type *
16104
ovsrec_ipfix_other_config_server_type(const struct ovsdb_idl *idl)
16105
0
{
16106
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ipfix_col_other_config);
16107
0
}
16108
16109
16110
bool
16111
ovsrec_server_has_ipfix_table_col_sampling(const struct ovsdb_idl *idl)
16112
0
{
16113
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_sampling);
16114
0
}
16115
16116
const struct ovsdb_type *
16117
ovsrec_ipfix_sampling_server_type(const struct ovsdb_idl *idl)
16118
0
{
16119
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ipfix_col_sampling);
16120
0
}
16121
16122
16123
bool
16124
ovsrec_server_has_ipfix_table_col_stats_interval(const struct ovsdb_idl *idl)
16125
0
{
16126
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_stats_interval);
16127
0
}
16128
16129
const struct ovsdb_type *
16130
ovsrec_ipfix_stats_interval_server_type(const struct ovsdb_idl *idl)
16131
0
{
16132
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ipfix_col_stats_interval);
16133
0
}
16134
16135
16136
bool
16137
ovsrec_server_has_ipfix_table_col_targets(const struct ovsdb_idl *idl)
16138
0
{
16139
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_targets);
16140
0
}
16141
16142
const struct ovsdb_type *
16143
ovsrec_ipfix_targets_server_type(const struct ovsdb_idl *idl)
16144
0
{
16145
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ipfix_col_targets);
16146
0
}
16147
16148
16149
bool
16150
ovsrec_server_has_ipfix_table_col_template_interval(const struct ovsdb_idl *idl)
16151
0
{
16152
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_template_interval);
16153
0
}
16154
16155
const struct ovsdb_type *
16156
ovsrec_ipfix_template_interval_server_type(const struct ovsdb_idl *idl)
16157
0
{
16158
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ipfix_col_template_interval);
16159
0
}
16160
16161
16162
bool
16163
ovsrec_server_has_ipfix_table(const struct ovsdb_idl *idl)
16164
0
{
16165
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
16166
0
}
16167
16168
16169
const struct ovsrec_ipfix_table *
16170
ovsrec_ipfix_table_get(const struct ovsdb_idl *idl)
16171
0
{
16172
0
    return (const struct ovsrec_ipfix_table *) idl;
16173
0
}
16174
16175
const struct ovsrec_ipfix *
16176
ovsrec_ipfix_table_first(const struct ovsrec_ipfix_table *table)
16177
0
{
16178
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
16179
0
    return ovsrec_ipfix_first(idl);
16180
0
}
16181
16182
16183
const struct ovsrec_ipfix *
16184
ovsrec_ipfix_table_track_get_first(const struct ovsrec_ipfix_table *table)
16185
0
{
16186
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
16187
0
    return ovsrec_ipfix_track_get_first(idl);
16188
0
}
16189
16190
16191
static void
16192
ovsrec_ipfix_parse_cache_active_timeout(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
16193
0
{
16194
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16195
0
    size_t n = MIN(1, datum->n);
16196
0
    row->cache_active_timeout = NULL;
16197
0
    row->n_cache_active_timeout = 0;
16198
0
    for (size_t i = 0; i < n; i++) {
16199
0
        if (!row->n_cache_active_timeout) {
16200
0
            row->cache_active_timeout = xmalloc(n * sizeof *row->cache_active_timeout);
16201
0
        }
16202
0
        row->cache_active_timeout[row->n_cache_active_timeout] = datum->keys[i].integer;
16203
0
        row->n_cache_active_timeout++;
16204
0
    }
16205
0
}
16206
16207
static void
16208
ovsrec_ipfix_parse_cache_max_flows(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
16209
0
{
16210
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16211
0
    size_t n = MIN(1, datum->n);
16212
0
    row->cache_max_flows = NULL;
16213
0
    row->n_cache_max_flows = 0;
16214
0
    for (size_t i = 0; i < n; i++) {
16215
0
        if (!row->n_cache_max_flows) {
16216
0
            row->cache_max_flows = xmalloc(n * sizeof *row->cache_max_flows);
16217
0
        }
16218
0
        row->cache_max_flows[row->n_cache_max_flows] = datum->keys[i].integer;
16219
0
        row->n_cache_max_flows++;
16220
0
    }
16221
0
}
16222
16223
static void
16224
ovsrec_ipfix_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
16225
0
{
16226
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16227
0
    smap_init(&row->external_ids);
16228
0
    for (size_t i = 0; i < datum->n; i++) {
16229
0
        smap_add(&row->external_ids,
16230
0
                 json_string(datum->keys[i].s),
16231
0
                 json_string(datum->values[i].s));
16232
0
    }
16233
0
}
16234
16235
static void
16236
ovsrec_ipfix_parse_obs_domain_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
16237
0
{
16238
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16239
0
    size_t n = MIN(1, datum->n);
16240
0
    row->obs_domain_id = NULL;
16241
0
    row->n_obs_domain_id = 0;
16242
0
    for (size_t i = 0; i < n; i++) {
16243
0
        if (!row->n_obs_domain_id) {
16244
0
            row->obs_domain_id = xmalloc(n * sizeof *row->obs_domain_id);
16245
0
        }
16246
0
        row->obs_domain_id[row->n_obs_domain_id] = datum->keys[i].integer;
16247
0
        row->n_obs_domain_id++;
16248
0
    }
16249
0
}
16250
16251
static void
16252
ovsrec_ipfix_parse_obs_point_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
16253
0
{
16254
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16255
0
    size_t n = MIN(1, datum->n);
16256
0
    row->obs_point_id = NULL;
16257
0
    row->n_obs_point_id = 0;
16258
0
    for (size_t i = 0; i < n; i++) {
16259
0
        if (!row->n_obs_point_id) {
16260
0
            row->obs_point_id = xmalloc(n * sizeof *row->obs_point_id);
16261
0
        }
16262
0
        row->obs_point_id[row->n_obs_point_id] = datum->keys[i].integer;
16263
0
        row->n_obs_point_id++;
16264
0
    }
16265
0
}
16266
16267
static void
16268
ovsrec_ipfix_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
16269
0
{
16270
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16271
0
    smap_init(&row->other_config);
16272
0
    for (size_t i = 0; i < datum->n; i++) {
16273
0
        smap_add(&row->other_config,
16274
0
                 json_string(datum->keys[i].s),
16275
0
                 json_string(datum->values[i].s));
16276
0
    }
16277
0
}
16278
16279
static void
16280
ovsrec_ipfix_parse_sampling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
16281
0
{
16282
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16283
0
    size_t n = MIN(1, datum->n);
16284
0
    row->sampling = NULL;
16285
0
    row->n_sampling = 0;
16286
0
    for (size_t i = 0; i < n; i++) {
16287
0
        if (!row->n_sampling) {
16288
0
            row->sampling = xmalloc(n * sizeof *row->sampling);
16289
0
        }
16290
0
        row->sampling[row->n_sampling] = datum->keys[i].integer;
16291
0
        row->n_sampling++;
16292
0
    }
16293
0
}
16294
16295
static void
16296
ovsrec_ipfix_parse_stats_interval(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
16297
0
{
16298
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16299
0
    size_t n = MIN(1, datum->n);
16300
0
    row->stats_interval = NULL;
16301
0
    row->n_stats_interval = 0;
16302
0
    for (size_t i = 0; i < n; i++) {
16303
0
        if (!row->n_stats_interval) {
16304
0
            row->stats_interval = xmalloc(n * sizeof *row->stats_interval);
16305
0
        }
16306
0
        row->stats_interval[row->n_stats_interval] = datum->keys[i].integer;
16307
0
        row->n_stats_interval++;
16308
0
    }
16309
0
}
16310
16311
static void
16312
ovsrec_ipfix_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
16313
0
{
16314
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16315
0
    row->targets = NULL;
16316
0
    row->n_targets = 0;
16317
0
    for (size_t i = 0; i < datum->n; i++) {
16318
0
        if (!row->n_targets) {
16319
0
            row->targets = xmalloc(datum->n * sizeof *row->targets);
16320
0
        }
16321
0
        row->targets[row->n_targets] = CONST_CAST(char *, json_string(datum->keys[i].s));
16322
0
        row->n_targets++;
16323
0
    }
16324
0
}
16325
16326
static void
16327
ovsrec_ipfix_parse_template_interval(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
16328
0
{
16329
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16330
0
    size_t n = MIN(1, datum->n);
16331
0
    row->template_interval = NULL;
16332
0
    row->n_template_interval = 0;
16333
0
    for (size_t i = 0; i < n; i++) {
16334
0
        if (!row->n_template_interval) {
16335
0
            row->template_interval = xmalloc(n * sizeof *row->template_interval);
16336
0
        }
16337
0
        row->template_interval[row->n_template_interval] = datum->keys[i].integer;
16338
0
        row->n_template_interval++;
16339
0
    }
16340
0
}
16341
16342
static void
16343
ovsrec_ipfix_unparse_cache_active_timeout(struct ovsdb_idl_row *row_)
16344
0
{
16345
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16346
0
    free(row->cache_active_timeout);
16347
0
}
16348
16349
static void
16350
ovsrec_ipfix_unparse_cache_max_flows(struct ovsdb_idl_row *row_)
16351
0
{
16352
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16353
0
    free(row->cache_max_flows);
16354
0
}
16355
16356
static void
16357
ovsrec_ipfix_unparse_external_ids(struct ovsdb_idl_row *row_)
16358
0
{
16359
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16360
0
    smap_destroy(&row->external_ids);
16361
0
}
16362
16363
static void
16364
ovsrec_ipfix_unparse_obs_domain_id(struct ovsdb_idl_row *row_)
16365
0
{
16366
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16367
0
    free(row->obs_domain_id);
16368
0
}
16369
16370
static void
16371
ovsrec_ipfix_unparse_obs_point_id(struct ovsdb_idl_row *row_)
16372
0
{
16373
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16374
0
    free(row->obs_point_id);
16375
0
}
16376
16377
static void
16378
ovsrec_ipfix_unparse_other_config(struct ovsdb_idl_row *row_)
16379
0
{
16380
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16381
0
    smap_destroy(&row->other_config);
16382
0
}
16383
16384
static void
16385
ovsrec_ipfix_unparse_sampling(struct ovsdb_idl_row *row_)
16386
0
{
16387
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16388
0
    free(row->sampling);
16389
0
}
16390
16391
static void
16392
ovsrec_ipfix_unparse_stats_interval(struct ovsdb_idl_row *row_)
16393
0
{
16394
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16395
0
    free(row->stats_interval);
16396
0
}
16397
16398
static void
16399
ovsrec_ipfix_unparse_targets(struct ovsdb_idl_row *row_)
16400
0
{
16401
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16402
0
    free(row->targets);
16403
0
}
16404
16405
static void
16406
ovsrec_ipfix_unparse_template_interval(struct ovsdb_idl_row *row_)
16407
0
{
16408
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
16409
0
    free(row->template_interval);
16410
0
}
16411
16412
static void
16413
ovsrec_ipfix_init__(struct ovsdb_idl_row *row)
16414
0
{
16415
0
    ovsrec_ipfix_init(ovsrec_ipfix_cast(row));
16416
0
}
16417
16418
/* Clears the contents of 'row' in table "IPFIX". */
16419
void
16420
ovsrec_ipfix_init(struct ovsrec_ipfix *row)
16421
0
{
16422
0
    memset(row, 0, sizeof *row); 
16423
0
    smap_init(&row->external_ids);
16424
0
    smap_init(&row->other_config);
16425
0
}
16426
16427
/* Searches table "IPFIX" in 'idl' for a row with UUID 'uuid'.  Returns
16428
 * a pointer to the row if there is one, otherwise a null pointer.  */
16429
const struct ovsrec_ipfix *
16430
ovsrec_ipfix_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
16431
0
{
16432
0
    return ovsrec_ipfix_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_ipfix, uuid));
16433
0
}
16434
16435
/* Searches table "IPFIX" for a row with UUID 'uuid'.  Returns
16436
 * a pointer to the row if there is one, otherwise a null pointer.  */
16437
const struct ovsrec_ipfix *
16438
ovsrec_ipfix_table_get_for_uuid(const struct ovsrec_ipfix_table *table, const struct uuid *uuid)
16439
0
{
16440
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
16441
0
    return ovsrec_ipfix_get_for_uuid(idl, uuid);
16442
0
}
16443
16444
/* Returns a row in table "IPFIX" in 'idl', or a null pointer if that
16445
 * table is empty.
16446
 *
16447
 * Database tables are internally maintained as hash tables, so adding or
16448
 * removing rows while traversing the same table can cause some rows to be
16449
 * visited twice or not at apply. */
16450
const struct ovsrec_ipfix *
16451
ovsrec_ipfix_first(const struct ovsdb_idl *idl)
16452
0
{
16453
0
    return ovsrec_ipfix_cast(ovsdb_idl_first_row(idl, &ovsrec_table_ipfix));
16454
0
}
16455
16456
/* Returns a row following 'row' within its table, or a null pointer if 'row'
16457
 * is the last row in its table. */
16458
const struct ovsrec_ipfix *
16459
ovsrec_ipfix_next(const struct ovsrec_ipfix *row)
16460
0
{
16461
0
    return ovsrec_ipfix_cast(ovsdb_idl_next_row(&row->header_));
16462
0
}
16463
16464
unsigned int ovsrec_ipfix_get_seqno(const struct ovsdb_idl *idl)
16465
0
{
16466
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_ipfix);
16467
0
}
16468
16469
unsigned int ovsrec_ipfix_row_get_seqno(const struct ovsrec_ipfix *row, enum ovsdb_idl_change change)
16470
0
{
16471
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
16472
0
}
16473
16474
const struct ovsrec_ipfix *
16475
ovsrec_ipfix_track_get_first(const struct ovsdb_idl *idl)
16476
0
{
16477
0
    return ovsrec_ipfix_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_ipfix));
16478
0
}
16479
16480
const struct ovsrec_ipfix
16481
*ovsrec_ipfix_track_get_next(const struct ovsrec_ipfix *row)
16482
0
{
16483
0
    return ovsrec_ipfix_cast(ovsdb_idl_track_get_next(&row->header_));
16484
0
}
16485
16486
16487
/* Deletes 'row' from table "IPFIX".  'row' may be freed, so it must not be
16488
 * accessed afterward.
16489
 *
16490
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16491
void
16492
ovsrec_ipfix_delete(const struct ovsrec_ipfix *row)
16493
0
{
16494
0
    ovsdb_idl_txn_delete(&row->header_);
16495
0
}
16496
16497
/* Inserts and returns a new row in the table "IPFIX" in the database
16498
 * with open transaction 'txn'.
16499
 *
16500
 * The new row is assigned a randomly generated provisional UUID.
16501
 * ovsdb-server will assign a different UUID when 'txn' is committed,
16502
 * but the IDL will replace any uses of the provisional UUID in the
16503
 * data to be to be committed by the UUID assigned by ovsdb-server. */
16504
struct ovsrec_ipfix *
16505
ovsrec_ipfix_insert(struct ovsdb_idl_txn *txn)
16506
0
{
16507
0
    return ovsrec_ipfix_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_ipfix, NULL));
16508
0
}
16509
16510
/* Inserts and returns a new row in the table "IPFIX" in the database
16511
 * with open transaction 'txn'.
16512
 *
16513
 * The new row is assigned the UUID specified in the 'uuid' parameter
16514
 * (which cannot be null).  ovsdb-server will try to assign the same
16515
 * UUID when 'txn' is committed. */
16516
struct ovsrec_ipfix *
16517
ovsrec_ipfix_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
16518
0
{
16519
0
    return ovsrec_ipfix_cast(ovsdb_idl_txn_insert_persist_uuid(
16520
0
        txn, &ovsrec_table_ipfix, uuid));
16521
0
}
16522
16523
bool
16524
ovsrec_ipfix_is_updated(const struct ovsrec_ipfix *row, enum ovsrec_ipfix_column_id column)
16525
0
{
16526
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_ipfix_columns[column]);
16527
0
}
16528
16529
/* Causes the original contents of column "cache_active_timeout" in 'row' to be
16530
 * verified as a prerequisite to completing the transaction.  That is, if
16531
 * "cache_active_timeout" in 'row' changed (or if 'row' was deleted) between the
16532
 * time that the IDL originally read its contents and the time that the
16533
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
16534
 *
16535
 * The intention is that, to ensure that no transaction commits based on dirty
16536
 * reads, an application should call this function any time "cache_active_timeout" is
16537
 * read as part of a read-modify-write operation.
16538
 *
16539
 * In some cases this function reduces to a no-op, because the current value
16540
 * of "cache_active_timeout" is already known:
16541
 *
16542
 *   - If 'row' is a row created by the current transaction (returned by
16543
 *     ovsrec_ipfix_insert()).
16544
 *
16545
 *   - If "cache_active_timeout" has already been modified (with
16546
 *     ovsrec_ipfix_set_cache_active_timeout()) within the current transaction.
16547
 *
16548
 * Because of the latter property, always call this function *before*
16549
 * ovsrec_ipfix_set_cache_active_timeout() for a given read-modify-write.
16550
 *
16551
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16552
void
16553
ovsrec_ipfix_verify_cache_active_timeout(const struct ovsrec_ipfix *row)
16554
0
{
16555
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_cache_active_timeout);
16556
0
}
16557
16558
/* Causes the original contents of column "cache_max_flows" in 'row' to be
16559
 * verified as a prerequisite to completing the transaction.  That is, if
16560
 * "cache_max_flows" in 'row' changed (or if 'row' was deleted) between the
16561
 * time that the IDL originally read its contents and the time that the
16562
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
16563
 *
16564
 * The intention is that, to ensure that no transaction commits based on dirty
16565
 * reads, an application should call this function any time "cache_max_flows" is
16566
 * read as part of a read-modify-write operation.
16567
 *
16568
 * In some cases this function reduces to a no-op, because the current value
16569
 * of "cache_max_flows" is already known:
16570
 *
16571
 *   - If 'row' is a row created by the current transaction (returned by
16572
 *     ovsrec_ipfix_insert()).
16573
 *
16574
 *   - If "cache_max_flows" has already been modified (with
16575
 *     ovsrec_ipfix_set_cache_max_flows()) within the current transaction.
16576
 *
16577
 * Because of the latter property, always call this function *before*
16578
 * ovsrec_ipfix_set_cache_max_flows() for a given read-modify-write.
16579
 *
16580
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16581
void
16582
ovsrec_ipfix_verify_cache_max_flows(const struct ovsrec_ipfix *row)
16583
0
{
16584
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_cache_max_flows);
16585
0
}
16586
16587
/* Causes the original contents of column "external_ids" in 'row' to be
16588
 * verified as a prerequisite to completing the transaction.  That is, if
16589
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
16590
 * time that the IDL originally read its contents and the time that the
16591
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
16592
 *
16593
 * The intention is that, to ensure that no transaction commits based on dirty
16594
 * reads, an application should call this function any time "external_ids" is
16595
 * read as part of a read-modify-write operation.
16596
 *
16597
 * In some cases this function reduces to a no-op, because the current value
16598
 * of "external_ids" is already known:
16599
 *
16600
 *   - If 'row' is a row created by the current transaction (returned by
16601
 *     ovsrec_ipfix_insert()).
16602
 *
16603
 *   - If "external_ids" has already been modified (with
16604
 *     ovsrec_ipfix_set_external_ids()) within the current transaction.
16605
 *
16606
 * Because of the latter property, always call this function *before*
16607
 * ovsrec_ipfix_set_external_ids() for a given read-modify-write.
16608
 *
16609
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16610
void
16611
ovsrec_ipfix_verify_external_ids(const struct ovsrec_ipfix *row)
16612
0
{
16613
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_external_ids);
16614
0
}
16615
16616
/* Causes the original contents of column "obs_domain_id" in 'row' to be
16617
 * verified as a prerequisite to completing the transaction.  That is, if
16618
 * "obs_domain_id" in 'row' changed (or if 'row' was deleted) between the
16619
 * time that the IDL originally read its contents and the time that the
16620
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
16621
 *
16622
 * The intention is that, to ensure that no transaction commits based on dirty
16623
 * reads, an application should call this function any time "obs_domain_id" is
16624
 * read as part of a read-modify-write operation.
16625
 *
16626
 * In some cases this function reduces to a no-op, because the current value
16627
 * of "obs_domain_id" is already known:
16628
 *
16629
 *   - If 'row' is a row created by the current transaction (returned by
16630
 *     ovsrec_ipfix_insert()).
16631
 *
16632
 *   - If "obs_domain_id" has already been modified (with
16633
 *     ovsrec_ipfix_set_obs_domain_id()) within the current transaction.
16634
 *
16635
 * Because of the latter property, always call this function *before*
16636
 * ovsrec_ipfix_set_obs_domain_id() for a given read-modify-write.
16637
 *
16638
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16639
void
16640
ovsrec_ipfix_verify_obs_domain_id(const struct ovsrec_ipfix *row)
16641
0
{
16642
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_obs_domain_id);
16643
0
}
16644
16645
/* Causes the original contents of column "obs_point_id" in 'row' to be
16646
 * verified as a prerequisite to completing the transaction.  That is, if
16647
 * "obs_point_id" in 'row' changed (or if 'row' was deleted) between the
16648
 * time that the IDL originally read its contents and the time that the
16649
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
16650
 *
16651
 * The intention is that, to ensure that no transaction commits based on dirty
16652
 * reads, an application should call this function any time "obs_point_id" is
16653
 * read as part of a read-modify-write operation.
16654
 *
16655
 * In some cases this function reduces to a no-op, because the current value
16656
 * of "obs_point_id" is already known:
16657
 *
16658
 *   - If 'row' is a row created by the current transaction (returned by
16659
 *     ovsrec_ipfix_insert()).
16660
 *
16661
 *   - If "obs_point_id" has already been modified (with
16662
 *     ovsrec_ipfix_set_obs_point_id()) within the current transaction.
16663
 *
16664
 * Because of the latter property, always call this function *before*
16665
 * ovsrec_ipfix_set_obs_point_id() for a given read-modify-write.
16666
 *
16667
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16668
void
16669
ovsrec_ipfix_verify_obs_point_id(const struct ovsrec_ipfix *row)
16670
0
{
16671
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_obs_point_id);
16672
0
}
16673
16674
/* Causes the original contents of column "other_config" in 'row' to be
16675
 * verified as a prerequisite to completing the transaction.  That is, if
16676
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
16677
 * time that the IDL originally read its contents and the time that the
16678
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
16679
 *
16680
 * The intention is that, to ensure that no transaction commits based on dirty
16681
 * reads, an application should call this function any time "other_config" is
16682
 * read as part of a read-modify-write operation.
16683
 *
16684
 * In some cases this function reduces to a no-op, because the current value
16685
 * of "other_config" is already known:
16686
 *
16687
 *   - If 'row' is a row created by the current transaction (returned by
16688
 *     ovsrec_ipfix_insert()).
16689
 *
16690
 *   - If "other_config" has already been modified (with
16691
 *     ovsrec_ipfix_set_other_config()) within the current transaction.
16692
 *
16693
 * Because of the latter property, always call this function *before*
16694
 * ovsrec_ipfix_set_other_config() for a given read-modify-write.
16695
 *
16696
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16697
void
16698
ovsrec_ipfix_verify_other_config(const struct ovsrec_ipfix *row)
16699
0
{
16700
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_other_config);
16701
0
}
16702
16703
/* Causes the original contents of column "sampling" in 'row' to be
16704
 * verified as a prerequisite to completing the transaction.  That is, if
16705
 * "sampling" in 'row' changed (or if 'row' was deleted) between the
16706
 * time that the IDL originally read its contents and the time that the
16707
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
16708
 *
16709
 * The intention is that, to ensure that no transaction commits based on dirty
16710
 * reads, an application should call this function any time "sampling" is
16711
 * read as part of a read-modify-write operation.
16712
 *
16713
 * In some cases this function reduces to a no-op, because the current value
16714
 * of "sampling" is already known:
16715
 *
16716
 *   - If 'row' is a row created by the current transaction (returned by
16717
 *     ovsrec_ipfix_insert()).
16718
 *
16719
 *   - If "sampling" has already been modified (with
16720
 *     ovsrec_ipfix_set_sampling()) within the current transaction.
16721
 *
16722
 * Because of the latter property, always call this function *before*
16723
 * ovsrec_ipfix_set_sampling() for a given read-modify-write.
16724
 *
16725
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16726
void
16727
ovsrec_ipfix_verify_sampling(const struct ovsrec_ipfix *row)
16728
0
{
16729
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_sampling);
16730
0
}
16731
16732
/* Causes the original contents of column "stats_interval" in 'row' to be
16733
 * verified as a prerequisite to completing the transaction.  That is, if
16734
 * "stats_interval" in 'row' changed (or if 'row' was deleted) between the
16735
 * time that the IDL originally read its contents and the time that the
16736
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
16737
 *
16738
 * The intention is that, to ensure that no transaction commits based on dirty
16739
 * reads, an application should call this function any time "stats_interval" is
16740
 * read as part of a read-modify-write operation.
16741
 *
16742
 * In some cases this function reduces to a no-op, because the current value
16743
 * of "stats_interval" is already known:
16744
 *
16745
 *   - If 'row' is a row created by the current transaction (returned by
16746
 *     ovsrec_ipfix_insert()).
16747
 *
16748
 *   - If "stats_interval" has already been modified (with
16749
 *     ovsrec_ipfix_set_stats_interval()) within the current transaction.
16750
 *
16751
 * Because of the latter property, always call this function *before*
16752
 * ovsrec_ipfix_set_stats_interval() for a given read-modify-write.
16753
 *
16754
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16755
void
16756
ovsrec_ipfix_verify_stats_interval(const struct ovsrec_ipfix *row)
16757
0
{
16758
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_stats_interval);
16759
0
}
16760
16761
/* Causes the original contents of column "targets" in 'row' to be
16762
 * verified as a prerequisite to completing the transaction.  That is, if
16763
 * "targets" in 'row' changed (or if 'row' was deleted) between the
16764
 * time that the IDL originally read its contents and the time that the
16765
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
16766
 *
16767
 * The intention is that, to ensure that no transaction commits based on dirty
16768
 * reads, an application should call this function any time "targets" is
16769
 * read as part of a read-modify-write operation.
16770
 *
16771
 * In some cases this function reduces to a no-op, because the current value
16772
 * of "targets" is already known:
16773
 *
16774
 *   - If 'row' is a row created by the current transaction (returned by
16775
 *     ovsrec_ipfix_insert()).
16776
 *
16777
 *   - If "targets" has already been modified (with
16778
 *     ovsrec_ipfix_set_targets()) within the current transaction.
16779
 *
16780
 * Because of the latter property, always call this function *before*
16781
 * ovsrec_ipfix_set_targets() for a given read-modify-write.
16782
 *
16783
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16784
void
16785
ovsrec_ipfix_verify_targets(const struct ovsrec_ipfix *row)
16786
0
{
16787
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_targets);
16788
0
}
16789
16790
/* Causes the original contents of column "template_interval" in 'row' to be
16791
 * verified as a prerequisite to completing the transaction.  That is, if
16792
 * "template_interval" in 'row' changed (or if 'row' was deleted) between the
16793
 * time that the IDL originally read its contents and the time that the
16794
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
16795
 *
16796
 * The intention is that, to ensure that no transaction commits based on dirty
16797
 * reads, an application should call this function any time "template_interval" is
16798
 * read as part of a read-modify-write operation.
16799
 *
16800
 * In some cases this function reduces to a no-op, because the current value
16801
 * of "template_interval" is already known:
16802
 *
16803
 *   - If 'row' is a row created by the current transaction (returned by
16804
 *     ovsrec_ipfix_insert()).
16805
 *
16806
 *   - If "template_interval" has already been modified (with
16807
 *     ovsrec_ipfix_set_template_interval()) within the current transaction.
16808
 *
16809
 * Because of the latter property, always call this function *before*
16810
 * ovsrec_ipfix_set_template_interval() for a given read-modify-write.
16811
 *
16812
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
16813
void
16814
ovsrec_ipfix_verify_template_interval(const struct ovsrec_ipfix *row)
16815
0
{
16816
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_template_interval);
16817
0
}
16818
16819
/* Returns the "cache_active_timeout" column's value from the "IPFIX" table in 'row'
16820
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
16821
 * ovsdb_datum_find_key() is an easier and more efficient way to search
16822
 * for a given key than implementing the same operation on the "cooked"
16823
 * form in 'row'.
16824
 *
16825
 * 'key_type' must be OVSDB_TYPE_INTEGER.
16826
 * (This helps to avoid silent bugs if someone changes cache_active_timeout's
16827
 * type without updating the caller.)
16828
 *
16829
 * The caller must not modify or free the returned value.
16830
 *
16831
 * Various kinds of changes can invalidate the returned value: modifying
16832
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
16833
 * If the returned value is needed for a long time, it is best to make a copy
16834
 * of it with ovsdb_datum_clone().
16835
 *
16836
 * This function is rarely useful, since it is easier to access the value
16837
 * directly through the "cache_active_timeout" member in ovsrec_ipfix. */
16838
const struct ovsdb_datum *
16839
ovsrec_ipfix_get_cache_active_timeout(const struct ovsrec_ipfix *row,
16840
  enum ovsdb_atomic_type key_type OVS_UNUSED)
16841
0
{
16842
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
16843
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_cache_active_timeout);
16844
0
}
16845
16846
/* Returns the "cache_max_flows" column's value from the "IPFIX" table in 'row'
16847
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
16848
 * ovsdb_datum_find_key() is an easier and more efficient way to search
16849
 * for a given key than implementing the same operation on the "cooked"
16850
 * form in 'row'.
16851
 *
16852
 * 'key_type' must be OVSDB_TYPE_INTEGER.
16853
 * (This helps to avoid silent bugs if someone changes cache_max_flows's
16854
 * type without updating the caller.)
16855
 *
16856
 * The caller must not modify or free the returned value.
16857
 *
16858
 * Various kinds of changes can invalidate the returned value: modifying
16859
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
16860
 * If the returned value is needed for a long time, it is best to make a copy
16861
 * of it with ovsdb_datum_clone().
16862
 *
16863
 * This function is rarely useful, since it is easier to access the value
16864
 * directly through the "cache_max_flows" member in ovsrec_ipfix. */
16865
const struct ovsdb_datum *
16866
ovsrec_ipfix_get_cache_max_flows(const struct ovsrec_ipfix *row,
16867
  enum ovsdb_atomic_type key_type OVS_UNUSED)
16868
0
{
16869
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
16870
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_cache_max_flows);
16871
0
}
16872
16873
/* Returns the "external_ids" column's value from the "IPFIX" table in 'row'
16874
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
16875
 * ovsdb_datum_find_key() is an easier and more efficient way to search
16876
 * for a given key than implementing the same operation on the "cooked"
16877
 * form in 'row'.
16878
 *
16879
 * 'key_type' must be OVSDB_TYPE_STRING.
16880
 * 'value_type' must be OVSDB_TYPE_STRING.
16881
 * (This helps to avoid silent bugs if someone changes external_ids's
16882
 * type without updating the caller.)
16883
 *
16884
 * The caller must not modify or free the returned value.
16885
 *
16886
 * Various kinds of changes can invalidate the returned value: modifying
16887
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
16888
 * If the returned value is needed for a long time, it is best to make a copy
16889
 * of it with ovsdb_datum_clone().
16890
 *
16891
 * This function is rarely useful, since it is easier to access the value
16892
 * directly through the "external_ids" member in ovsrec_ipfix. */
16893
const struct ovsdb_datum *
16894
ovsrec_ipfix_get_external_ids(const struct ovsrec_ipfix *row,
16895
  enum ovsdb_atomic_type key_type OVS_UNUSED,
16896
  enum ovsdb_atomic_type value_type OVS_UNUSED)
16897
0
{
16898
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
16899
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
16900
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_external_ids);
16901
0
}
16902
16903
/* Returns the "obs_domain_id" column's value from the "IPFIX" table in 'row'
16904
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
16905
 * ovsdb_datum_find_key() is an easier and more efficient way to search
16906
 * for a given key than implementing the same operation on the "cooked"
16907
 * form in 'row'.
16908
 *
16909
 * 'key_type' must be OVSDB_TYPE_INTEGER.
16910
 * (This helps to avoid silent bugs if someone changes obs_domain_id's
16911
 * type without updating the caller.)
16912
 *
16913
 * The caller must not modify or free the returned value.
16914
 *
16915
 * Various kinds of changes can invalidate the returned value: modifying
16916
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
16917
 * If the returned value is needed for a long time, it is best to make a copy
16918
 * of it with ovsdb_datum_clone().
16919
 *
16920
 * This function is rarely useful, since it is easier to access the value
16921
 * directly through the "obs_domain_id" member in ovsrec_ipfix. */
16922
const struct ovsdb_datum *
16923
ovsrec_ipfix_get_obs_domain_id(const struct ovsrec_ipfix *row,
16924
  enum ovsdb_atomic_type key_type OVS_UNUSED)
16925
0
{
16926
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
16927
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_obs_domain_id);
16928
0
}
16929
16930
/* Returns the "obs_point_id" column's value from the "IPFIX" table in 'row'
16931
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
16932
 * ovsdb_datum_find_key() is an easier and more efficient way to search
16933
 * for a given key than implementing the same operation on the "cooked"
16934
 * form in 'row'.
16935
 *
16936
 * 'key_type' must be OVSDB_TYPE_INTEGER.
16937
 * (This helps to avoid silent bugs if someone changes obs_point_id's
16938
 * type without updating the caller.)
16939
 *
16940
 * The caller must not modify or free the returned value.
16941
 *
16942
 * Various kinds of changes can invalidate the returned value: modifying
16943
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
16944
 * If the returned value is needed for a long time, it is best to make a copy
16945
 * of it with ovsdb_datum_clone().
16946
 *
16947
 * This function is rarely useful, since it is easier to access the value
16948
 * directly through the "obs_point_id" member in ovsrec_ipfix. */
16949
const struct ovsdb_datum *
16950
ovsrec_ipfix_get_obs_point_id(const struct ovsrec_ipfix *row,
16951
  enum ovsdb_atomic_type key_type OVS_UNUSED)
16952
0
{
16953
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
16954
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_obs_point_id);
16955
0
}
16956
16957
/* Returns the "other_config" column's value from the "IPFIX" table in 'row'
16958
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
16959
 * ovsdb_datum_find_key() is an easier and more efficient way to search
16960
 * for a given key than implementing the same operation on the "cooked"
16961
 * form in 'row'.
16962
 *
16963
 * 'key_type' must be OVSDB_TYPE_STRING.
16964
 * 'value_type' must be OVSDB_TYPE_STRING.
16965
 * (This helps to avoid silent bugs if someone changes other_config's
16966
 * type without updating the caller.)
16967
 *
16968
 * The caller must not modify or free the returned value.
16969
 *
16970
 * Various kinds of changes can invalidate the returned value: modifying
16971
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
16972
 * If the returned value is needed for a long time, it is best to make a copy
16973
 * of it with ovsdb_datum_clone().
16974
 *
16975
 * This function is rarely useful, since it is easier to access the value
16976
 * directly through the "other_config" member in ovsrec_ipfix. */
16977
const struct ovsdb_datum *
16978
ovsrec_ipfix_get_other_config(const struct ovsrec_ipfix *row,
16979
  enum ovsdb_atomic_type key_type OVS_UNUSED,
16980
  enum ovsdb_atomic_type value_type OVS_UNUSED)
16981
0
{
16982
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
16983
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
16984
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_other_config);
16985
0
}
16986
16987
/* Returns the "sampling" column's value from the "IPFIX" table in 'row'
16988
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
16989
 * ovsdb_datum_find_key() is an easier and more efficient way to search
16990
 * for a given key than implementing the same operation on the "cooked"
16991
 * form in 'row'.
16992
 *
16993
 * 'key_type' must be OVSDB_TYPE_INTEGER.
16994
 * (This helps to avoid silent bugs if someone changes sampling's
16995
 * type without updating the caller.)
16996
 *
16997
 * The caller must not modify or free the returned value.
16998
 *
16999
 * Various kinds of changes can invalidate the returned value: modifying
17000
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
17001
 * If the returned value is needed for a long time, it is best to make a copy
17002
 * of it with ovsdb_datum_clone().
17003
 *
17004
 * This function is rarely useful, since it is easier to access the value
17005
 * directly through the "sampling" member in ovsrec_ipfix. */
17006
const struct ovsdb_datum *
17007
ovsrec_ipfix_get_sampling(const struct ovsrec_ipfix *row,
17008
  enum ovsdb_atomic_type key_type OVS_UNUSED)
17009
0
{
17010
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
17011
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_sampling);
17012
0
}
17013
17014
/* Returns the "stats_interval" column's value from the "IPFIX" table in 'row'
17015
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
17016
 * ovsdb_datum_find_key() is an easier and more efficient way to search
17017
 * for a given key than implementing the same operation on the "cooked"
17018
 * form in 'row'.
17019
 *
17020
 * 'key_type' must be OVSDB_TYPE_INTEGER.
17021
 * (This helps to avoid silent bugs if someone changes stats_interval's
17022
 * type without updating the caller.)
17023
 *
17024
 * The caller must not modify or free the returned value.
17025
 *
17026
 * Various kinds of changes can invalidate the returned value: modifying
17027
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
17028
 * If the returned value is needed for a long time, it is best to make a copy
17029
 * of it with ovsdb_datum_clone().
17030
 *
17031
 * This function is rarely useful, since it is easier to access the value
17032
 * directly through the "stats_interval" member in ovsrec_ipfix. */
17033
const struct ovsdb_datum *
17034
ovsrec_ipfix_get_stats_interval(const struct ovsrec_ipfix *row,
17035
  enum ovsdb_atomic_type key_type OVS_UNUSED)
17036
0
{
17037
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
17038
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_stats_interval);
17039
0
}
17040
17041
/* Returns the "targets" column's value from the "IPFIX" table in 'row'
17042
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
17043
 * ovsdb_datum_find_key() is an easier and more efficient way to search
17044
 * for a given key than implementing the same operation on the "cooked"
17045
 * form in 'row'.
17046
 *
17047
 * 'key_type' must be OVSDB_TYPE_STRING.
17048
 * (This helps to avoid silent bugs if someone changes targets's
17049
 * type without updating the caller.)
17050
 *
17051
 * The caller must not modify or free the returned value.
17052
 *
17053
 * Various kinds of changes can invalidate the returned value: modifying
17054
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
17055
 * If the returned value is needed for a long time, it is best to make a copy
17056
 * of it with ovsdb_datum_clone().
17057
 *
17058
 * This function is rarely useful, since it is easier to access the value
17059
 * directly through the "targets" member in ovsrec_ipfix. */
17060
const struct ovsdb_datum *
17061
ovsrec_ipfix_get_targets(const struct ovsrec_ipfix *row,
17062
  enum ovsdb_atomic_type key_type OVS_UNUSED)
17063
0
{
17064
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
17065
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_targets);
17066
0
}
17067
17068
/* Returns the "template_interval" column's value from the "IPFIX" table in 'row'
17069
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
17070
 * ovsdb_datum_find_key() is an easier and more efficient way to search
17071
 * for a given key than implementing the same operation on the "cooked"
17072
 * form in 'row'.
17073
 *
17074
 * 'key_type' must be OVSDB_TYPE_INTEGER.
17075
 * (This helps to avoid silent bugs if someone changes template_interval's
17076
 * type without updating the caller.)
17077
 *
17078
 * The caller must not modify or free the returned value.
17079
 *
17080
 * Various kinds of changes can invalidate the returned value: modifying
17081
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
17082
 * If the returned value is needed for a long time, it is best to make a copy
17083
 * of it with ovsdb_datum_clone().
17084
 *
17085
 * This function is rarely useful, since it is easier to access the value
17086
 * directly through the "template_interval" member in ovsrec_ipfix. */
17087
const struct ovsdb_datum *
17088
ovsrec_ipfix_get_template_interval(const struct ovsrec_ipfix *row,
17089
  enum ovsdb_atomic_type key_type OVS_UNUSED)
17090
0
{
17091
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
17092
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_template_interval);
17093
0
}
17094
17095
/* Sets the "cache_active_timeout" column from the "IPFIX" table in 'row' to
17096
 * the 'cache_active_timeout' set with 'n_cache_active_timeout' entries.
17097
 *
17098
 * 'n_cache_active_timeout' may be 0 or 1; if it is 0, then 'cache_active_timeout'
17099
 * may be NULL.
17100
 *
17101
 * Argument constraints: in range 0 to 4,200
17102
 *
17103
 * The caller retains ownership of the arguments. */
17104
void
17105
ovsrec_ipfix_set_cache_active_timeout(const struct ovsrec_ipfix *row, const int64_t *cache_active_timeout, size_t n_cache_active_timeout)
17106
0
{
17107
0
    struct ovsdb_datum datum;
17108
17109
0
    datum.refcnt = NULL;
17110
17111
0
    if (n_cache_active_timeout) {
17112
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17113
0
        datum.n = 1;
17114
0
        datum.keys = key;
17115
0
        key->integer = *cache_active_timeout;
17116
0
    } else {
17117
0
        datum.n = 0;
17118
0
        datum.keys = NULL;
17119
0
    }
17120
0
    datum.values = NULL;
17121
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_cache_active_timeout, &datum);
17122
0
}
17123
17124
/* Sets the "cache_max_flows" column from the "IPFIX" table in 'row' to
17125
 * the 'cache_max_flows' set with 'n_cache_max_flows' entries.
17126
 *
17127
 * 'n_cache_max_flows' may be 0 or 1; if it is 0, then 'cache_max_flows'
17128
 * may be NULL.
17129
 *
17130
 * Argument constraints: in range 0 to 4,294,967,295
17131
 *
17132
 * The caller retains ownership of the arguments. */
17133
void
17134
ovsrec_ipfix_set_cache_max_flows(const struct ovsrec_ipfix *row, const int64_t *cache_max_flows, size_t n_cache_max_flows)
17135
0
{
17136
0
    struct ovsdb_datum datum;
17137
17138
0
    datum.refcnt = NULL;
17139
17140
0
    if (n_cache_max_flows) {
17141
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17142
0
        datum.n = 1;
17143
0
        datum.keys = key;
17144
0
        key->integer = *cache_max_flows;
17145
0
    } else {
17146
0
        datum.n = 0;
17147
0
        datum.keys = NULL;
17148
0
    }
17149
0
    datum.values = NULL;
17150
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_cache_max_flows, &datum);
17151
0
}
17152
17153
/* Sets the "external_ids" column's value from the "IPFIX" table in 'row'
17154
 * to 'external_ids'.
17155
 *
17156
 * The caller retains ownership of 'external_ids' and everything in it. */
17157
void
17158
ovsrec_ipfix_set_external_ids(const struct ovsrec_ipfix *row, const struct smap *external_ids)
17159
0
{
17160
0
    struct ovsdb_datum datum;
17161
17162
0
    if (external_ids) {
17163
0
        ovsdb_datum_from_smap(&datum, external_ids);
17164
0
    } else {
17165
0
        ovsdb_datum_init_empty(&datum);
17166
0
    }
17167
0
    ovsdb_idl_txn_write(&row->header_,
17168
0
                        &ovsrec_ipfix_col_external_ids,
17169
0
                        &datum);
17170
0
}
17171
17172
17173
/* Sets the "obs_domain_id" column from the "IPFIX" table in 'row' to
17174
 * the 'obs_domain_id' set with 'n_obs_domain_id' entries.
17175
 *
17176
 * 'n_obs_domain_id' may be 0 or 1; if it is 0, then 'obs_domain_id'
17177
 * may be NULL.
17178
 *
17179
 * Argument constraints: in range 0 to 4,294,967,295
17180
 *
17181
 * The caller retains ownership of the arguments. */
17182
void
17183
ovsrec_ipfix_set_obs_domain_id(const struct ovsrec_ipfix *row, const int64_t *obs_domain_id, size_t n_obs_domain_id)
17184
0
{
17185
0
    struct ovsdb_datum datum;
17186
17187
0
    datum.refcnt = NULL;
17188
17189
0
    if (n_obs_domain_id) {
17190
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17191
0
        datum.n = 1;
17192
0
        datum.keys = key;
17193
0
        key->integer = *obs_domain_id;
17194
0
    } else {
17195
0
        datum.n = 0;
17196
0
        datum.keys = NULL;
17197
0
    }
17198
0
    datum.values = NULL;
17199
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_obs_domain_id, &datum);
17200
0
}
17201
17202
/* Sets the "obs_point_id" column from the "IPFIX" table in 'row' to
17203
 * the 'obs_point_id' set with 'n_obs_point_id' entries.
17204
 *
17205
 * 'n_obs_point_id' may be 0 or 1; if it is 0, then 'obs_point_id'
17206
 * may be NULL.
17207
 *
17208
 * Argument constraints: in range 0 to 4,294,967,295
17209
 *
17210
 * The caller retains ownership of the arguments. */
17211
void
17212
ovsrec_ipfix_set_obs_point_id(const struct ovsrec_ipfix *row, const int64_t *obs_point_id, size_t n_obs_point_id)
17213
0
{
17214
0
    struct ovsdb_datum datum;
17215
17216
0
    datum.refcnt = NULL;
17217
17218
0
    if (n_obs_point_id) {
17219
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17220
0
        datum.n = 1;
17221
0
        datum.keys = key;
17222
0
        key->integer = *obs_point_id;
17223
0
    } else {
17224
0
        datum.n = 0;
17225
0
        datum.keys = NULL;
17226
0
    }
17227
0
    datum.values = NULL;
17228
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_obs_point_id, &datum);
17229
0
}
17230
17231
/* Sets the "other_config" column's value from the "IPFIX" table in 'row'
17232
 * to 'other_config'.
17233
 *
17234
 * The caller retains ownership of 'other_config' and everything in it. */
17235
void
17236
ovsrec_ipfix_set_other_config(const struct ovsrec_ipfix *row, const struct smap *other_config)
17237
0
{
17238
0
    struct ovsdb_datum datum;
17239
17240
0
    if (other_config) {
17241
0
        ovsdb_datum_from_smap(&datum, other_config);
17242
0
    } else {
17243
0
        ovsdb_datum_init_empty(&datum);
17244
0
    }
17245
0
    ovsdb_idl_txn_write(&row->header_,
17246
0
                        &ovsrec_ipfix_col_other_config,
17247
0
                        &datum);
17248
0
}
17249
17250
17251
/* Sets the "sampling" column from the "IPFIX" table in 'row' to
17252
 * the 'sampling' set with 'n_sampling' entries.
17253
 *
17254
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
17255
 * may be NULL.
17256
 *
17257
 * Argument constraints: in range 1 to 4,294,967,295
17258
 *
17259
 * The caller retains ownership of the arguments. */
17260
void
17261
ovsrec_ipfix_set_sampling(const struct ovsrec_ipfix *row, const int64_t *sampling, size_t n_sampling)
17262
0
{
17263
0
    struct ovsdb_datum datum;
17264
17265
0
    datum.refcnt = NULL;
17266
17267
0
    if (n_sampling) {
17268
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17269
0
        datum.n = 1;
17270
0
        datum.keys = key;
17271
0
        key->integer = *sampling;
17272
0
    } else {
17273
0
        datum.n = 0;
17274
0
        datum.keys = NULL;
17275
0
    }
17276
0
    datum.values = NULL;
17277
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_sampling, &datum);
17278
0
}
17279
17280
/* Sets the "stats_interval" column from the "IPFIX" table in 'row' to
17281
 * the 'stats_interval' set with 'n_stats_interval' entries.
17282
 *
17283
 * 'n_stats_interval' may be 0 or 1; if it is 0, then 'stats_interval'
17284
 * may be NULL.
17285
 *
17286
 * Argument constraints: in range 1 to 3,600
17287
 *
17288
 * The caller retains ownership of the arguments. */
17289
void
17290
ovsrec_ipfix_set_stats_interval(const struct ovsrec_ipfix *row, const int64_t *stats_interval, size_t n_stats_interval)
17291
0
{
17292
0
    struct ovsdb_datum datum;
17293
17294
0
    datum.refcnt = NULL;
17295
17296
0
    if (n_stats_interval) {
17297
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17298
0
        datum.n = 1;
17299
0
        datum.keys = key;
17300
0
        key->integer = *stats_interval;
17301
0
    } else {
17302
0
        datum.n = 0;
17303
0
        datum.keys = NULL;
17304
0
    }
17305
0
    datum.values = NULL;
17306
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_stats_interval, &datum);
17307
0
}
17308
17309
/* Sets the "targets" column from the "IPFIX" table in 'row' to
17310
 * the 'targets' set with 'n_targets' entries.
17311
 *
17312
 * The caller retains ownership of the arguments. */
17313
void
17314
ovsrec_ipfix_set_targets(const struct ovsrec_ipfix *row, const char **targets, size_t n_targets)
17315
0
{
17316
0
    struct ovsdb_datum datum;
17317
17318
0
    datum.refcnt = NULL;
17319
17320
0
    datum.n = n_targets;
17321
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
17322
0
    datum.values = NULL;
17323
0
    for (size_t i = 0; i < n_targets; i++) {
17324
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
17325
0
    }
17326
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_targets, &datum);
17327
0
}
17328
17329
/* Sets the "template_interval" column from the "IPFIX" table in 'row' to
17330
 * the 'template_interval' set with 'n_template_interval' entries.
17331
 *
17332
 * 'n_template_interval' may be 0 or 1; if it is 0, then 'template_interval'
17333
 * may be NULL.
17334
 *
17335
 * Argument constraints: in range 1 to 3,600
17336
 *
17337
 * The caller retains ownership of the arguments. */
17338
void
17339
ovsrec_ipfix_set_template_interval(const struct ovsrec_ipfix *row, const int64_t *template_interval, size_t n_template_interval)
17340
0
{
17341
0
    struct ovsdb_datum datum;
17342
17343
0
    datum.refcnt = NULL;
17344
17345
0
    if (n_template_interval) {
17346
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17347
0
        datum.n = 1;
17348
0
        datum.keys = key;
17349
0
        key->integer = *template_interval;
17350
0
    } else {
17351
0
        datum.n = 0;
17352
0
        datum.keys = NULL;
17353
0
    }
17354
0
    datum.values = NULL;
17355
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_template_interval, &datum);
17356
0
}
17357
17358
/* Adds the value 'new_value' to the "cache_active_timeout" set column from the "IPFIX" table
17359
 * in 'row'.
17360
 *
17361
 */
17362
void
17363
ovsrec_ipfix_update_cache_active_timeout_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
17364
0
{
17365
0
    struct ovsdb_datum *datum;
17366
17367
0
    datum = xmalloc(sizeof *datum);
17368
0
    datum->n = 1;
17369
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17370
0
    datum->values = NULL;
17371
0
    datum->refcnt = NULL;
17372
17373
0
    datum->keys[0].integer = new_value;
17374
17375
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
17376
0
                                    &ovsrec_ipfix_col_cache_active_timeout,
17377
0
                                    datum);
17378
0
}
17379
17380
/* Deletes the value 'delete_value' from the "cache_active_timeout" set column from the
17381
 * "IPFIX" table in 'row'.
17382
 *
17383
 */
17384
void
17385
ovsrec_ipfix_update_cache_active_timeout_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
17386
0
{
17387
0
    struct ovsdb_datum *datum;
17388
17389
0
    datum = xmalloc(sizeof *datum);
17390
0
    datum->n = 1;
17391
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17392
0
    datum->values = NULL;
17393
0
    datum->refcnt = NULL;
17394
17395
0
    datum->keys[0].integer = delete_value;
17396
17397
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
17398
0
                                    &ovsrec_ipfix_col_cache_active_timeout,
17399
0
                                    datum);
17400
0
}
17401
17402
/* Adds the value 'new_value' to the "cache_max_flows" set column from the "IPFIX" table
17403
 * in 'row'.
17404
 *
17405
 */
17406
void
17407
ovsrec_ipfix_update_cache_max_flows_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
17408
0
{
17409
0
    struct ovsdb_datum *datum;
17410
17411
0
    datum = xmalloc(sizeof *datum);
17412
0
    datum->n = 1;
17413
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17414
0
    datum->values = NULL;
17415
0
    datum->refcnt = NULL;
17416
17417
0
    datum->keys[0].integer = new_value;
17418
17419
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
17420
0
                                    &ovsrec_ipfix_col_cache_max_flows,
17421
0
                                    datum);
17422
0
}
17423
17424
/* Deletes the value 'delete_value' from the "cache_max_flows" set column from the
17425
 * "IPFIX" table in 'row'.
17426
 *
17427
 */
17428
void
17429
ovsrec_ipfix_update_cache_max_flows_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
17430
0
{
17431
0
    struct ovsdb_datum *datum;
17432
17433
0
    datum = xmalloc(sizeof *datum);
17434
0
    datum->n = 1;
17435
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17436
0
    datum->values = NULL;
17437
0
    datum->refcnt = NULL;
17438
17439
0
    datum->keys[0].integer = delete_value;
17440
17441
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
17442
0
                                    &ovsrec_ipfix_col_cache_max_flows,
17443
0
                                    datum);
17444
0
}
17445
17446
/* Sets an element of the "external_ids" map column from the "IPFIX" table in 'row'
17447
 * to 'new_value' given the key value 'new_key'.
17448
 *
17449
 */
17450
void
17451
ovsrec_ipfix_update_external_ids_setkey(const struct ovsrec_ipfix *row, const char *new_key, const char *new_value)
17452
0
{
17453
0
    struct ovsdb_datum *datum;
17454
17455
0
    datum = xmalloc(sizeof *datum);
17456
0
    datum->n = 1;
17457
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
17458
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
17459
0
    datum->refcnt = NULL;
17460
17461
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
17462
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
17463
17464
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
17465
0
                                    &ovsrec_ipfix_col_external_ids,
17466
0
                                    datum);
17467
0
}
17468
17469
/* Deletes an element of the "external_ids" map column from the "IPFIX" table in 'row'
17470
 * given the key value 'delete_key'.
17471
 *
17472
 */
17473
void
17474
ovsrec_ipfix_update_external_ids_delkey(const struct ovsrec_ipfix *row, const char *delete_key)
17475
0
{
17476
0
    struct ovsdb_datum *datum;
17477
17478
0
    datum = xmalloc(sizeof *datum);
17479
0
    datum->n = 1;
17480
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
17481
0
    datum->values = NULL;
17482
0
    datum->refcnt = NULL;
17483
17484
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
17485
17486
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
17487
0
                                    &ovsrec_ipfix_col_external_ids,
17488
0
                                    datum);
17489
0
}
17490
17491
/* Adds the value 'new_value' to the "obs_domain_id" set column from the "IPFIX" table
17492
 * in 'row'.
17493
 *
17494
 */
17495
void
17496
ovsrec_ipfix_update_obs_domain_id_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
17497
0
{
17498
0
    struct ovsdb_datum *datum;
17499
17500
0
    datum = xmalloc(sizeof *datum);
17501
0
    datum->n = 1;
17502
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17503
0
    datum->values = NULL;
17504
0
    datum->refcnt = NULL;
17505
17506
0
    datum->keys[0].integer = new_value;
17507
17508
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
17509
0
                                    &ovsrec_ipfix_col_obs_domain_id,
17510
0
                                    datum);
17511
0
}
17512
17513
/* Deletes the value 'delete_value' from the "obs_domain_id" set column from the
17514
 * "IPFIX" table in 'row'.
17515
 *
17516
 */
17517
void
17518
ovsrec_ipfix_update_obs_domain_id_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
17519
0
{
17520
0
    struct ovsdb_datum *datum;
17521
17522
0
    datum = xmalloc(sizeof *datum);
17523
0
    datum->n = 1;
17524
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17525
0
    datum->values = NULL;
17526
0
    datum->refcnt = NULL;
17527
17528
0
    datum->keys[0].integer = delete_value;
17529
17530
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
17531
0
                                    &ovsrec_ipfix_col_obs_domain_id,
17532
0
                                    datum);
17533
0
}
17534
17535
/* Adds the value 'new_value' to the "obs_point_id" set column from the "IPFIX" table
17536
 * in 'row'.
17537
 *
17538
 */
17539
void
17540
ovsrec_ipfix_update_obs_point_id_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
17541
0
{
17542
0
    struct ovsdb_datum *datum;
17543
17544
0
    datum = xmalloc(sizeof *datum);
17545
0
    datum->n = 1;
17546
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17547
0
    datum->values = NULL;
17548
0
    datum->refcnt = NULL;
17549
17550
0
    datum->keys[0].integer = new_value;
17551
17552
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
17553
0
                                    &ovsrec_ipfix_col_obs_point_id,
17554
0
                                    datum);
17555
0
}
17556
17557
/* Deletes the value 'delete_value' from the "obs_point_id" set column from the
17558
 * "IPFIX" table in 'row'.
17559
 *
17560
 */
17561
void
17562
ovsrec_ipfix_update_obs_point_id_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
17563
0
{
17564
0
    struct ovsdb_datum *datum;
17565
17566
0
    datum = xmalloc(sizeof *datum);
17567
0
    datum->n = 1;
17568
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17569
0
    datum->values = NULL;
17570
0
    datum->refcnt = NULL;
17571
17572
0
    datum->keys[0].integer = delete_value;
17573
17574
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
17575
0
                                    &ovsrec_ipfix_col_obs_point_id,
17576
0
                                    datum);
17577
0
}
17578
17579
/* Sets an element of the "other_config" map column from the "IPFIX" table in 'row'
17580
 * to 'new_value' given the key value 'new_key'.
17581
 *
17582
 */
17583
void
17584
ovsrec_ipfix_update_other_config_setkey(const struct ovsrec_ipfix *row, const char *new_key, const char *new_value)
17585
0
{
17586
0
    struct ovsdb_datum *datum;
17587
17588
0
    datum = xmalloc(sizeof *datum);
17589
0
    datum->n = 1;
17590
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
17591
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
17592
0
    datum->refcnt = NULL;
17593
17594
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
17595
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
17596
17597
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
17598
0
                                    &ovsrec_ipfix_col_other_config,
17599
0
                                    datum);
17600
0
}
17601
17602
/* Deletes an element of the "other_config" map column from the "IPFIX" table in 'row'
17603
 * given the key value 'delete_key'.
17604
 *
17605
 */
17606
void
17607
ovsrec_ipfix_update_other_config_delkey(const struct ovsrec_ipfix *row, const char *delete_key)
17608
0
{
17609
0
    struct ovsdb_datum *datum;
17610
17611
0
    datum = xmalloc(sizeof *datum);
17612
0
    datum->n = 1;
17613
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
17614
0
    datum->values = NULL;
17615
0
    datum->refcnt = NULL;
17616
17617
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
17618
17619
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
17620
0
                                    &ovsrec_ipfix_col_other_config,
17621
0
                                    datum);
17622
0
}
17623
17624
/* Adds the value 'new_value' to the "sampling" set column from the "IPFIX" table
17625
 * in 'row'.
17626
 *
17627
 */
17628
void
17629
ovsrec_ipfix_update_sampling_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
17630
0
{
17631
0
    struct ovsdb_datum *datum;
17632
17633
0
    datum = xmalloc(sizeof *datum);
17634
0
    datum->n = 1;
17635
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17636
0
    datum->values = NULL;
17637
0
    datum->refcnt = NULL;
17638
17639
0
    datum->keys[0].integer = new_value;
17640
17641
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
17642
0
                                    &ovsrec_ipfix_col_sampling,
17643
0
                                    datum);
17644
0
}
17645
17646
/* Deletes the value 'delete_value' from the "sampling" set column from the
17647
 * "IPFIX" table in 'row'.
17648
 *
17649
 */
17650
void
17651
ovsrec_ipfix_update_sampling_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
17652
0
{
17653
0
    struct ovsdb_datum *datum;
17654
17655
0
    datum = xmalloc(sizeof *datum);
17656
0
    datum->n = 1;
17657
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17658
0
    datum->values = NULL;
17659
0
    datum->refcnt = NULL;
17660
17661
0
    datum->keys[0].integer = delete_value;
17662
17663
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
17664
0
                                    &ovsrec_ipfix_col_sampling,
17665
0
                                    datum);
17666
0
}
17667
17668
/* Adds the value 'new_value' to the "stats_interval" set column from the "IPFIX" table
17669
 * in 'row'.
17670
 *
17671
 */
17672
void
17673
ovsrec_ipfix_update_stats_interval_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
17674
0
{
17675
0
    struct ovsdb_datum *datum;
17676
17677
0
    datum = xmalloc(sizeof *datum);
17678
0
    datum->n = 1;
17679
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17680
0
    datum->values = NULL;
17681
0
    datum->refcnt = NULL;
17682
17683
0
    datum->keys[0].integer = new_value;
17684
17685
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
17686
0
                                    &ovsrec_ipfix_col_stats_interval,
17687
0
                                    datum);
17688
0
}
17689
17690
/* Deletes the value 'delete_value' from the "stats_interval" set column from the
17691
 * "IPFIX" table in 'row'.
17692
 *
17693
 */
17694
void
17695
ovsrec_ipfix_update_stats_interval_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
17696
0
{
17697
0
    struct ovsdb_datum *datum;
17698
17699
0
    datum = xmalloc(sizeof *datum);
17700
0
    datum->n = 1;
17701
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17702
0
    datum->values = NULL;
17703
0
    datum->refcnt = NULL;
17704
17705
0
    datum->keys[0].integer = delete_value;
17706
17707
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
17708
0
                                    &ovsrec_ipfix_col_stats_interval,
17709
0
                                    datum);
17710
0
}
17711
17712
/* Adds the value 'new_value' to the "targets" set column from the "IPFIX" table
17713
 * in 'row'.
17714
 *
17715
 */
17716
void
17717
ovsrec_ipfix_update_targets_addvalue(const struct ovsrec_ipfix *row, const char *new_value)
17718
0
{
17719
0
    struct ovsdb_datum *datum;
17720
17721
0
    datum = xmalloc(sizeof *datum);
17722
0
    datum->n = 1;
17723
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17724
0
    datum->values = NULL;
17725
0
    datum->refcnt = NULL;
17726
17727
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
17728
17729
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
17730
0
                                    &ovsrec_ipfix_col_targets,
17731
0
                                    datum);
17732
0
}
17733
17734
/* Deletes the value 'delete_value' from the "targets" set column from the
17735
 * "IPFIX" table in 'row'.
17736
 *
17737
 */
17738
void
17739
ovsrec_ipfix_update_targets_delvalue(const struct ovsrec_ipfix *row, const char *delete_value)
17740
0
{
17741
0
    struct ovsdb_datum *datum;
17742
17743
0
    datum = xmalloc(sizeof *datum);
17744
0
    datum->n = 1;
17745
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17746
0
    datum->values = NULL;
17747
0
    datum->refcnt = NULL;
17748
17749
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
17750
17751
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
17752
0
                                    &ovsrec_ipfix_col_targets,
17753
0
                                    datum);
17754
0
}
17755
17756
/* Adds the value 'new_value' to the "template_interval" set column from the "IPFIX" table
17757
 * in 'row'.
17758
 *
17759
 */
17760
void
17761
ovsrec_ipfix_update_template_interval_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
17762
0
{
17763
0
    struct ovsdb_datum *datum;
17764
17765
0
    datum = xmalloc(sizeof *datum);
17766
0
    datum->n = 1;
17767
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17768
0
    datum->values = NULL;
17769
0
    datum->refcnt = NULL;
17770
17771
0
    datum->keys[0].integer = new_value;
17772
17773
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
17774
0
                                    &ovsrec_ipfix_col_template_interval,
17775
0
                                    datum);
17776
0
}
17777
17778
/* Deletes the value 'delete_value' from the "template_interval" set column from the
17779
 * "IPFIX" table in 'row'.
17780
 *
17781
 */
17782
void
17783
ovsrec_ipfix_update_template_interval_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
17784
0
{
17785
0
    struct ovsdb_datum *datum;
17786
17787
0
    datum = xmalloc(sizeof *datum);
17788
0
    datum->n = 1;
17789
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
17790
0
    datum->values = NULL;
17791
0
    datum->refcnt = NULL;
17792
17793
0
    datum->keys[0].integer = delete_value;
17794
17795
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
17796
0
                                    &ovsrec_ipfix_col_template_interval,
17797
0
                                    datum);
17798
0
}
17799
17800
/* Sets the "cache_active_timeout" column from the "IPFIX" table in 'row' to
17801
 * the 'cache_active_timeout' set with 'n_cache_active_timeout' entries.
17802
 *
17803
 * 'n_cache_active_timeout' may be 0 or 1; if it is 0, then 'cache_active_timeout'
17804
 * may be NULL.
17805
 *
17806
 * Argument constraints: in range 0 to 4,200
17807
 *
17808
 * The caller retains ownership of the arguments. */
17809
void
17810
ovsrec_ipfix_add_clause_cache_active_timeout(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *cache_active_timeout, size_t n_cache_active_timeout)
17811
0
{
17812
0
    struct ovsdb_datum datum;
17813
17814
0
    datum.refcnt = NULL;
17815
17816
0
    if (n_cache_active_timeout) {
17817
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17818
0
        datum.n = 1;
17819
0
        datum.keys = key;
17820
0
        key->integer = *cache_active_timeout;
17821
0
    } else {
17822
0
        datum.n = 0;
17823
0
        datum.keys = NULL;
17824
0
    }
17825
0
    datum.values = NULL;
17826
0
    ovsdb_idl_condition_add_clause(cond,
17827
0
                          function,
17828
0
                          &ovsrec_ipfix_col_cache_active_timeout,
17829
0
                          &datum);
17830
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_cache_active_timeout.type);
17831
0
}
17832
17833
/* Sets the "cache_max_flows" column from the "IPFIX" table in 'row' to
17834
 * the 'cache_max_flows' set with 'n_cache_max_flows' entries.
17835
 *
17836
 * 'n_cache_max_flows' may be 0 or 1; if it is 0, then 'cache_max_flows'
17837
 * may be NULL.
17838
 *
17839
 * Argument constraints: in range 0 to 4,294,967,295
17840
 *
17841
 * The caller retains ownership of the arguments. */
17842
void
17843
ovsrec_ipfix_add_clause_cache_max_flows(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *cache_max_flows, size_t n_cache_max_flows)
17844
0
{
17845
0
    struct ovsdb_datum datum;
17846
17847
0
    datum.refcnt = NULL;
17848
17849
0
    if (n_cache_max_flows) {
17850
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17851
0
        datum.n = 1;
17852
0
        datum.keys = key;
17853
0
        key->integer = *cache_max_flows;
17854
0
    } else {
17855
0
        datum.n = 0;
17856
0
        datum.keys = NULL;
17857
0
    }
17858
0
    datum.values = NULL;
17859
0
    ovsdb_idl_condition_add_clause(cond,
17860
0
                          function,
17861
0
                          &ovsrec_ipfix_col_cache_max_flows,
17862
0
                          &datum);
17863
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_cache_max_flows.type);
17864
0
}
17865
17866
/* Sets the "external_ids" column's value from the "IPFIX" table in 'row'
17867
 * to 'external_ids'.
17868
 *
17869
 * The caller retains ownership of 'external_ids' and everything in it. */
17870
void
17871
ovsrec_ipfix_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
17872
0
{
17873
0
    struct ovsdb_datum datum;
17874
17875
0
    if (external_ids) {
17876
0
        ovsdb_datum_from_smap(&datum, external_ids);
17877
0
    } else {
17878
0
        ovsdb_datum_init_empty(&datum);
17879
0
    }
17880
17881
0
    ovsdb_idl_condition_add_clause(cond,
17882
0
                                   function,
17883
0
                                   &ovsrec_ipfix_col_external_ids,
17884
0
                                   &datum);
17885
17886
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_external_ids.type);
17887
0
}
17888
17889
17890
/* Sets the "obs_domain_id" column from the "IPFIX" table in 'row' to
17891
 * the 'obs_domain_id' set with 'n_obs_domain_id' entries.
17892
 *
17893
 * 'n_obs_domain_id' may be 0 or 1; if it is 0, then 'obs_domain_id'
17894
 * may be NULL.
17895
 *
17896
 * Argument constraints: in range 0 to 4,294,967,295
17897
 *
17898
 * The caller retains ownership of the arguments. */
17899
void
17900
ovsrec_ipfix_add_clause_obs_domain_id(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *obs_domain_id, size_t n_obs_domain_id)
17901
0
{
17902
0
    struct ovsdb_datum datum;
17903
17904
0
    datum.refcnt = NULL;
17905
17906
0
    if (n_obs_domain_id) {
17907
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17908
0
        datum.n = 1;
17909
0
        datum.keys = key;
17910
0
        key->integer = *obs_domain_id;
17911
0
    } else {
17912
0
        datum.n = 0;
17913
0
        datum.keys = NULL;
17914
0
    }
17915
0
    datum.values = NULL;
17916
0
    ovsdb_idl_condition_add_clause(cond,
17917
0
                          function,
17918
0
                          &ovsrec_ipfix_col_obs_domain_id,
17919
0
                          &datum);
17920
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_obs_domain_id.type);
17921
0
}
17922
17923
/* Sets the "obs_point_id" column from the "IPFIX" table in 'row' to
17924
 * the 'obs_point_id' set with 'n_obs_point_id' entries.
17925
 *
17926
 * 'n_obs_point_id' may be 0 or 1; if it is 0, then 'obs_point_id'
17927
 * may be NULL.
17928
 *
17929
 * Argument constraints: in range 0 to 4,294,967,295
17930
 *
17931
 * The caller retains ownership of the arguments. */
17932
void
17933
ovsrec_ipfix_add_clause_obs_point_id(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *obs_point_id, size_t n_obs_point_id)
17934
0
{
17935
0
    struct ovsdb_datum datum;
17936
17937
0
    datum.refcnt = NULL;
17938
17939
0
    if (n_obs_point_id) {
17940
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17941
0
        datum.n = 1;
17942
0
        datum.keys = key;
17943
0
        key->integer = *obs_point_id;
17944
0
    } else {
17945
0
        datum.n = 0;
17946
0
        datum.keys = NULL;
17947
0
    }
17948
0
    datum.values = NULL;
17949
0
    ovsdb_idl_condition_add_clause(cond,
17950
0
                          function,
17951
0
                          &ovsrec_ipfix_col_obs_point_id,
17952
0
                          &datum);
17953
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_obs_point_id.type);
17954
0
}
17955
17956
/* Sets the "other_config" column's value from the "IPFIX" table in 'row'
17957
 * to 'other_config'.
17958
 *
17959
 * The caller retains ownership of 'other_config' and everything in it. */
17960
void
17961
ovsrec_ipfix_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
17962
0
{
17963
0
    struct ovsdb_datum datum;
17964
17965
0
    if (other_config) {
17966
0
        ovsdb_datum_from_smap(&datum, other_config);
17967
0
    } else {
17968
0
        ovsdb_datum_init_empty(&datum);
17969
0
    }
17970
17971
0
    ovsdb_idl_condition_add_clause(cond,
17972
0
                                   function,
17973
0
                                   &ovsrec_ipfix_col_other_config,
17974
0
                                   &datum);
17975
17976
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_other_config.type);
17977
0
}
17978
17979
17980
/* Sets the "sampling" column from the "IPFIX" table in 'row' to
17981
 * the 'sampling' set with 'n_sampling' entries.
17982
 *
17983
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
17984
 * may be NULL.
17985
 *
17986
 * Argument constraints: in range 1 to 4,294,967,295
17987
 *
17988
 * The caller retains ownership of the arguments. */
17989
void
17990
ovsrec_ipfix_add_clause_sampling(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *sampling, size_t n_sampling)
17991
0
{
17992
0
    struct ovsdb_datum datum;
17993
17994
0
    datum.refcnt = NULL;
17995
17996
0
    if (n_sampling) {
17997
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
17998
0
        datum.n = 1;
17999
0
        datum.keys = key;
18000
0
        key->integer = *sampling;
18001
0
    } else {
18002
0
        datum.n = 0;
18003
0
        datum.keys = NULL;
18004
0
    }
18005
0
    datum.values = NULL;
18006
0
    ovsdb_idl_condition_add_clause(cond,
18007
0
                          function,
18008
0
                          &ovsrec_ipfix_col_sampling,
18009
0
                          &datum);
18010
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_sampling.type);
18011
0
}
18012
18013
/* Sets the "stats_interval" column from the "IPFIX" table in 'row' to
18014
 * the 'stats_interval' set with 'n_stats_interval' entries.
18015
 *
18016
 * 'n_stats_interval' may be 0 or 1; if it is 0, then 'stats_interval'
18017
 * may be NULL.
18018
 *
18019
 * Argument constraints: in range 1 to 3,600
18020
 *
18021
 * The caller retains ownership of the arguments. */
18022
void
18023
ovsrec_ipfix_add_clause_stats_interval(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *stats_interval, size_t n_stats_interval)
18024
0
{
18025
0
    struct ovsdb_datum datum;
18026
18027
0
    datum.refcnt = NULL;
18028
18029
0
    if (n_stats_interval) {
18030
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
18031
0
        datum.n = 1;
18032
0
        datum.keys = key;
18033
0
        key->integer = *stats_interval;
18034
0
    } else {
18035
0
        datum.n = 0;
18036
0
        datum.keys = NULL;
18037
0
    }
18038
0
    datum.values = NULL;
18039
0
    ovsdb_idl_condition_add_clause(cond,
18040
0
                          function,
18041
0
                          &ovsrec_ipfix_col_stats_interval,
18042
0
                          &datum);
18043
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_stats_interval.type);
18044
0
}
18045
18046
/* Sets the "targets" column from the "IPFIX" table in 'row' to
18047
 * the 'targets' set with 'n_targets' entries.
18048
 *
18049
 * The caller retains ownership of the arguments. */
18050
void
18051
ovsrec_ipfix_add_clause_targets(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **targets, size_t n_targets)
18052
0
{
18053
0
    struct ovsdb_datum datum;
18054
18055
0
    datum.refcnt = NULL;
18056
0
    datum.n = n_targets;
18057
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
18058
0
    datum.values = NULL;
18059
0
    for (size_t i = 0; i < n_targets; i++) {
18060
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
18061
0
    }
18062
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_ipfix_col_targets.type);
18063
0
    ovsdb_idl_condition_add_clause(cond,
18064
0
                          function,
18065
0
                          &ovsrec_ipfix_col_targets,
18066
0
                          &datum);
18067
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_targets.type);
18068
0
}
18069
18070
/* Sets the "template_interval" column from the "IPFIX" table in 'row' to
18071
 * the 'template_interval' set with 'n_template_interval' entries.
18072
 *
18073
 * 'n_template_interval' may be 0 or 1; if it is 0, then 'template_interval'
18074
 * may be NULL.
18075
 *
18076
 * Argument constraints: in range 1 to 3,600
18077
 *
18078
 * The caller retains ownership of the arguments. */
18079
void
18080
ovsrec_ipfix_add_clause_template_interval(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *template_interval, size_t n_template_interval)
18081
0
{
18082
0
    struct ovsdb_datum datum;
18083
18084
0
    datum.refcnt = NULL;
18085
18086
0
    if (n_template_interval) {
18087
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
18088
0
        datum.n = 1;
18089
0
        datum.keys = key;
18090
0
        key->integer = *template_interval;
18091
0
    } else {
18092
0
        datum.n = 0;
18093
0
        datum.keys = NULL;
18094
0
    }
18095
0
    datum.values = NULL;
18096
0
    ovsdb_idl_condition_add_clause(cond,
18097
0
                          function,
18098
0
                          &ovsrec_ipfix_col_template_interval,
18099
0
                          &datum);
18100
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_template_interval.type);
18101
0
}
18102
18103
/* Destroy 'row' of kind "IPFIX". The row must have been
18104
 * created with ovsdb_idl_index_init_row.
18105
 */
18106
void
18107
ovsrec_ipfix_index_destroy_row(const struct ovsrec_ipfix *row)
18108
0
{
18109
0
    ovsdb_idl_index_destroy_row(&row->header_);
18110
0
}
18111
        
18112
18113
/* Creates a new row of kind "IPFIX". */
18114
struct ovsrec_ipfix *
18115
ovsrec_ipfix_index_init_row(struct ovsdb_idl_index *index)
18116
0
{
18117
0
    ovs_assert(index->table->class_ == &ovsrec_table_ipfix);
18118
0
    return ALIGNED_CAST(struct ovsrec_ipfix *, ovsdb_idl_index_init_row(index));
18119
0
}
18120
18121
struct ovsrec_ipfix *
18122
ovsrec_ipfix_index_find(struct ovsdb_idl_index *index, const struct ovsrec_ipfix *target)
18123
0
{
18124
0
    ovs_assert(index->table->class_ == &ovsrec_table_ipfix);
18125
0
    return ovsrec_ipfix_cast(ovsdb_idl_index_find(index, &target->header_));
18126
0
}
18127
18128
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
18129
int
18130
ovsrec_ipfix_index_compare(
18131
    struct ovsdb_idl_index *index, 
18132
    const struct ovsrec_ipfix *a, 
18133
    const struct ovsrec_ipfix *b)
18134
0
{
18135
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
18136
0
}
18137
18138
struct ovsdb_idl_cursor
18139
ovsrec_ipfix_cursor_first(struct ovsdb_idl_index *index)
18140
0
{
18141
0
    ovs_assert(index->table->class_ == &ovsrec_table_ipfix);
18142
0
    return ovsdb_idl_cursor_first(index);
18143
0
}
18144
18145
struct ovsdb_idl_cursor
18146
ovsrec_ipfix_cursor_first_eq(
18147
    struct ovsdb_idl_index *index, const struct ovsrec_ipfix *target)
18148
0
{
18149
0
    ovs_assert(index->table->class_ == &ovsrec_table_ipfix);
18150
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
18151
0
}
18152
18153
struct ovsdb_idl_cursor
18154
ovsrec_ipfix_cursor_first_ge(
18155
    struct ovsdb_idl_index *index, const struct ovsrec_ipfix *target)
18156
0
{
18157
0
    ovs_assert(index->table->class_ == &ovsrec_table_ipfix);
18158
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
18159
0
}
18160
18161
struct ovsrec_ipfix *
18162
ovsrec_ipfix_cursor_data(struct ovsdb_idl_cursor *cursor)
18163
0
{
18164
0
    return ovsrec_ipfix_cast(ovsdb_idl_cursor_data(cursor));
18165
0
}
18166
18167
18168
/* Sets the "cache_active_timeout" column from the "IPFIX" table in 'row' to
18169
 * the 'cache_active_timeout' set with 'n_cache_active_timeout' entries.
18170
 *
18171
 * 'n_cache_active_timeout' may be 0 or 1; if it is 0, then 'cache_active_timeout'
18172
 * may be NULL.
18173
 *
18174
 * Argument constraints: in range 0 to 4,200
18175
 *
18176
 * The caller retains ownership of the arguments. */
18177
void
18178
ovsrec_ipfix_index_set_cache_active_timeout(const struct ovsrec_ipfix *row, const int64_t *cache_active_timeout, size_t n_cache_active_timeout)
18179
0
{
18180
0
    struct ovsdb_datum datum;
18181
18182
0
    datum.refcnt = NULL;
18183
0
    union ovsdb_atom *key;
18184
18185
0
    if (n_cache_active_timeout) {
18186
0
        key = xmalloc(sizeof(union ovsdb_atom));
18187
0
        datum.n = 1;
18188
0
        datum.keys = key;
18189
0
        key->integer = *cache_active_timeout;
18190
0
    } else {
18191
0
        datum.n = 0;
18192
0
        datum.keys = NULL;
18193
0
    }
18194
0
    datum.values = NULL;
18195
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ipfix_columns[ OVSREC_IPFIX_COL_CACHE_ACTIVE_TIMEOUT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
18196
0
}
18197
18198
/* Sets the "cache_max_flows" column from the "IPFIX" table in 'row' to
18199
 * the 'cache_max_flows' set with 'n_cache_max_flows' entries.
18200
 *
18201
 * 'n_cache_max_flows' may be 0 or 1; if it is 0, then 'cache_max_flows'
18202
 * may be NULL.
18203
 *
18204
 * Argument constraints: in range 0 to 4,294,967,295
18205
 *
18206
 * The caller retains ownership of the arguments. */
18207
void
18208
ovsrec_ipfix_index_set_cache_max_flows(const struct ovsrec_ipfix *row, const int64_t *cache_max_flows, size_t n_cache_max_flows)
18209
0
{
18210
0
    struct ovsdb_datum datum;
18211
18212
0
    datum.refcnt = NULL;
18213
0
    union ovsdb_atom *key;
18214
18215
0
    if (n_cache_max_flows) {
18216
0
        key = xmalloc(sizeof(union ovsdb_atom));
18217
0
        datum.n = 1;
18218
0
        datum.keys = key;
18219
0
        key->integer = *cache_max_flows;
18220
0
    } else {
18221
0
        datum.n = 0;
18222
0
        datum.keys = NULL;
18223
0
    }
18224
0
    datum.values = NULL;
18225
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ipfix_columns[ OVSREC_IPFIX_COL_CACHE_MAX_FLOWS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
18226
0
}
18227
18228
/* Sets the "external_ids" column's value from the "IPFIX" table in 'row'
18229
 * to 'external_ids'.
18230
 *
18231
 * The caller retains ownership of 'external_ids' and everything in it. */
18232
void
18233
ovsrec_ipfix_index_set_external_ids(const struct ovsrec_ipfix *row, const struct smap *external_ids)
18234
0
{
18235
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
18236
18237
0
    if (external_ids) {
18238
0
        struct smap_node *node;
18239
0
        size_t i;
18240
18241
0
        datum->n = smap_count(external_ids);
18242
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
18243
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
18244
0
        datum->refcnt = NULL;
18245
18246
0
        i = 0;
18247
0
        SMAP_FOR_EACH (node, external_ids) {
18248
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
18249
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
18250
0
            i++;
18251
0
        }
18252
0
        ovsdb_datum_sort_unique(datum, &ovsrec_ipfix_col_external_ids.type);
18253
0
    } else {
18254
0
        ovsdb_datum_init_empty(datum);
18255
0
    }
18256
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
18257
0
                          &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_EXTERNAL_IDS],
18258
0
                          datum,
18259
0
                          &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
18260
0
    free(datum);
18261
0
}
18262
18263
18264
/* Sets the "obs_domain_id" column from the "IPFIX" table in 'row' to
18265
 * the 'obs_domain_id' set with 'n_obs_domain_id' entries.
18266
 *
18267
 * 'n_obs_domain_id' may be 0 or 1; if it is 0, then 'obs_domain_id'
18268
 * may be NULL.
18269
 *
18270
 * Argument constraints: in range 0 to 4,294,967,295
18271
 *
18272
 * The caller retains ownership of the arguments. */
18273
void
18274
ovsrec_ipfix_index_set_obs_domain_id(const struct ovsrec_ipfix *row, const int64_t *obs_domain_id, size_t n_obs_domain_id)
18275
0
{
18276
0
    struct ovsdb_datum datum;
18277
18278
0
    datum.refcnt = NULL;
18279
0
    union ovsdb_atom *key;
18280
18281
0
    if (n_obs_domain_id) {
18282
0
        key = xmalloc(sizeof(union ovsdb_atom));
18283
0
        datum.n = 1;
18284
0
        datum.keys = key;
18285
0
        key->integer = *obs_domain_id;
18286
0
    } else {
18287
0
        datum.n = 0;
18288
0
        datum.keys = NULL;
18289
0
    }
18290
0
    datum.values = NULL;
18291
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ipfix_columns[ OVSREC_IPFIX_COL_OBS_DOMAIN_ID ], &datum, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
18292
0
}
18293
18294
/* Sets the "obs_point_id" column from the "IPFIX" table in 'row' to
18295
 * the 'obs_point_id' set with 'n_obs_point_id' entries.
18296
 *
18297
 * 'n_obs_point_id' may be 0 or 1; if it is 0, then 'obs_point_id'
18298
 * may be NULL.
18299
 *
18300
 * Argument constraints: in range 0 to 4,294,967,295
18301
 *
18302
 * The caller retains ownership of the arguments. */
18303
void
18304
ovsrec_ipfix_index_set_obs_point_id(const struct ovsrec_ipfix *row, const int64_t *obs_point_id, size_t n_obs_point_id)
18305
0
{
18306
0
    struct ovsdb_datum datum;
18307
18308
0
    datum.refcnt = NULL;
18309
0
    union ovsdb_atom *key;
18310
18311
0
    if (n_obs_point_id) {
18312
0
        key = xmalloc(sizeof(union ovsdb_atom));
18313
0
        datum.n = 1;
18314
0
        datum.keys = key;
18315
0
        key->integer = *obs_point_id;
18316
0
    } else {
18317
0
        datum.n = 0;
18318
0
        datum.keys = NULL;
18319
0
    }
18320
0
    datum.values = NULL;
18321
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ipfix_columns[ OVSREC_IPFIX_COL_OBS_POINT_ID ], &datum, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
18322
0
}
18323
18324
/* Sets the "other_config" column's value from the "IPFIX" table in 'row'
18325
 * to 'other_config'.
18326
 *
18327
 * The caller retains ownership of 'other_config' and everything in it. */
18328
void
18329
ovsrec_ipfix_index_set_other_config(const struct ovsrec_ipfix *row, const struct smap *other_config)
18330
0
{
18331
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
18332
18333
0
    if (other_config) {
18334
0
        struct smap_node *node;
18335
0
        size_t i;
18336
18337
0
        datum->n = smap_count(other_config);
18338
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
18339
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
18340
0
        datum->refcnt = NULL;
18341
18342
0
        i = 0;
18343
0
        SMAP_FOR_EACH (node, other_config) {
18344
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
18345
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
18346
0
            i++;
18347
0
        }
18348
0
        ovsdb_datum_sort_unique(datum, &ovsrec_ipfix_col_other_config.type);
18349
0
    } else {
18350
0
        ovsdb_datum_init_empty(datum);
18351
0
    }
18352
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
18353
0
                          &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_OTHER_CONFIG],
18354
0
                          datum,
18355
0
                          &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
18356
0
    free(datum);
18357
0
}
18358
18359
18360
/* Sets the "sampling" column from the "IPFIX" table in 'row' to
18361
 * the 'sampling' set with 'n_sampling' entries.
18362
 *
18363
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
18364
 * may be NULL.
18365
 *
18366
 * Argument constraints: in range 1 to 4,294,967,295
18367
 *
18368
 * The caller retains ownership of the arguments. */
18369
void
18370
ovsrec_ipfix_index_set_sampling(const struct ovsrec_ipfix *row, const int64_t *sampling, size_t n_sampling)
18371
0
{
18372
0
    struct ovsdb_datum datum;
18373
18374
0
    datum.refcnt = NULL;
18375
0
    union ovsdb_atom *key;
18376
18377
0
    if (n_sampling) {
18378
0
        key = xmalloc(sizeof(union ovsdb_atom));
18379
0
        datum.n = 1;
18380
0
        datum.keys = key;
18381
0
        key->integer = *sampling;
18382
0
    } else {
18383
0
        datum.n = 0;
18384
0
        datum.keys = NULL;
18385
0
    }
18386
0
    datum.values = NULL;
18387
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ipfix_columns[ OVSREC_IPFIX_COL_SAMPLING ], &datum, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
18388
0
}
18389
18390
/* Sets the "stats_interval" column from the "IPFIX" table in 'row' to
18391
 * the 'stats_interval' set with 'n_stats_interval' entries.
18392
 *
18393
 * 'n_stats_interval' may be 0 or 1; if it is 0, then 'stats_interval'
18394
 * may be NULL.
18395
 *
18396
 * Argument constraints: in range 1 to 3,600
18397
 *
18398
 * The caller retains ownership of the arguments. */
18399
void
18400
ovsrec_ipfix_index_set_stats_interval(const struct ovsrec_ipfix *row, const int64_t *stats_interval, size_t n_stats_interval)
18401
0
{
18402
0
    struct ovsdb_datum datum;
18403
18404
0
    datum.refcnt = NULL;
18405
0
    union ovsdb_atom *key;
18406
18407
0
    if (n_stats_interval) {
18408
0
        key = xmalloc(sizeof(union ovsdb_atom));
18409
0
        datum.n = 1;
18410
0
        datum.keys = key;
18411
0
        key->integer = *stats_interval;
18412
0
    } else {
18413
0
        datum.n = 0;
18414
0
        datum.keys = NULL;
18415
0
    }
18416
0
    datum.values = NULL;
18417
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ipfix_columns[ OVSREC_IPFIX_COL_STATS_INTERVAL ], &datum, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
18418
0
}
18419
18420
/* Sets the "targets" column from the "IPFIX" table in 'row' to
18421
 * the 'targets' set with 'n_targets' entries.
18422
 *
18423
 * The caller retains ownership of the arguments. */
18424
void
18425
ovsrec_ipfix_index_set_targets(const struct ovsrec_ipfix *row, const char **targets, size_t n_targets)
18426
0
{
18427
0
    struct ovsdb_datum datum;
18428
18429
0
    datum.refcnt = NULL;
18430
0
    size_t i;
18431
18432
0
    datum.n = n_targets;
18433
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
18434
0
    datum.values = NULL;
18435
0
    for (i = 0; i < n_targets; i++) {
18436
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
18437
0
    }
18438
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_ipfix_col_targets.type);
18439
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ipfix_columns[ OVSREC_IPFIX_COL_TARGETS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
18440
0
}
18441
18442
/* Sets the "template_interval" column from the "IPFIX" table in 'row' to
18443
 * the 'template_interval' set with 'n_template_interval' entries.
18444
 *
18445
 * 'n_template_interval' may be 0 or 1; if it is 0, then 'template_interval'
18446
 * may be NULL.
18447
 *
18448
 * Argument constraints: in range 1 to 3,600
18449
 *
18450
 * The caller retains ownership of the arguments. */
18451
void
18452
ovsrec_ipfix_index_set_template_interval(const struct ovsrec_ipfix *row, const int64_t *template_interval, size_t n_template_interval)
18453
0
{
18454
0
    struct ovsdb_datum datum;
18455
18456
0
    datum.refcnt = NULL;
18457
0
    union ovsdb_atom *key;
18458
18459
0
    if (n_template_interval) {
18460
0
        key = xmalloc(sizeof(union ovsdb_atom));
18461
0
        datum.n = 1;
18462
0
        datum.keys = key;
18463
0
        key->integer = *template_interval;
18464
0
    } else {
18465
0
        datum.n = 0;
18466
0
        datum.keys = NULL;
18467
0
    }
18468
0
    datum.values = NULL;
18469
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ipfix_columns[ OVSREC_IPFIX_COL_TEMPLATE_INTERVAL ], &datum, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
18470
0
}
18471
18472
struct ovsdb_idl_column ovsrec_ipfix_columns[OVSREC_IPFIX_N_COLUMNS];
18473
18474
unsigned int
18475
ovsrec_ipfix_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
18476
0
{
18477
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_ipfix, condition);
18478
0
}
18479
18480
struct ovsdb_idl_column ovsrec_ipfix_columns[OVSREC_IPFIX_N_COLUMNS] = {
18481
    [OVSREC_IPFIX_COL_CACHE_ACTIVE_TIMEOUT] = {
18482
         .name = "cache_active_timeout",
18483
         .type = {
18484
            .key = {
18485
               .type = OVSDB_TYPE_INTEGER,
18486
               .integer = { .min = INT64_C(0), .max = INT64_C(4200) },
18487
            },
18488
            .value = OVSDB_BASE_VOID_INIT,
18489
            .n_min = 0,
18490
            .n_max = 1,
18491
         },
18492
         .is_mutable = true,
18493
         .is_synthetic = false,
18494
         .parse = ovsrec_ipfix_parse_cache_active_timeout,
18495
         .unparse = ovsrec_ipfix_unparse_cache_active_timeout,
18496
    },
18497
18498
    [OVSREC_IPFIX_COL_CACHE_MAX_FLOWS] = {
18499
         .name = "cache_max_flows",
18500
         .type = {
18501
            .key = {
18502
               .type = OVSDB_TYPE_INTEGER,
18503
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
18504
            },
18505
            .value = OVSDB_BASE_VOID_INIT,
18506
            .n_min = 0,
18507
            .n_max = 1,
18508
         },
18509
         .is_mutable = true,
18510
         .is_synthetic = false,
18511
         .parse = ovsrec_ipfix_parse_cache_max_flows,
18512
         .unparse = ovsrec_ipfix_unparse_cache_max_flows,
18513
    },
18514
18515
    [OVSREC_IPFIX_COL_EXTERNAL_IDS] = {
18516
         .name = "external_ids",
18517
         .type = {
18518
            .key = {
18519
               .type = OVSDB_TYPE_STRING,
18520
               .string = { .minLen = 0, .maxLen = UINT_MAX },
18521
            },
18522
            .value = {
18523
                .type = OVSDB_TYPE_STRING,
18524
                .string = { .minLen = 0, .maxLen = UINT_MAX },
18525
            },
18526
            .n_min = 0,
18527
            .n_max = UINT_MAX,
18528
         },
18529
         .is_mutable = true,
18530
         .is_synthetic = false,
18531
         .parse = ovsrec_ipfix_parse_external_ids,
18532
         .unparse = ovsrec_ipfix_unparse_external_ids,
18533
    },
18534
18535
    [OVSREC_IPFIX_COL_OBS_DOMAIN_ID] = {
18536
         .name = "obs_domain_id",
18537
         .type = {
18538
            .key = {
18539
               .type = OVSDB_TYPE_INTEGER,
18540
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
18541
            },
18542
            .value = OVSDB_BASE_VOID_INIT,
18543
            .n_min = 0,
18544
            .n_max = 1,
18545
         },
18546
         .is_mutable = true,
18547
         .is_synthetic = false,
18548
         .parse = ovsrec_ipfix_parse_obs_domain_id,
18549
         .unparse = ovsrec_ipfix_unparse_obs_domain_id,
18550
    },
18551
18552
    [OVSREC_IPFIX_COL_OBS_POINT_ID] = {
18553
         .name = "obs_point_id",
18554
         .type = {
18555
            .key = {
18556
               .type = OVSDB_TYPE_INTEGER,
18557
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
18558
            },
18559
            .value = OVSDB_BASE_VOID_INIT,
18560
            .n_min = 0,
18561
            .n_max = 1,
18562
         },
18563
         .is_mutable = true,
18564
         .is_synthetic = false,
18565
         .parse = ovsrec_ipfix_parse_obs_point_id,
18566
         .unparse = ovsrec_ipfix_unparse_obs_point_id,
18567
    },
18568
18569
    [OVSREC_IPFIX_COL_OTHER_CONFIG] = {
18570
         .name = "other_config",
18571
         .type = {
18572
            .key = {
18573
               .type = OVSDB_TYPE_STRING,
18574
               .string = { .minLen = 0, .maxLen = UINT_MAX },
18575
            },
18576
            .value = {
18577
                .type = OVSDB_TYPE_STRING,
18578
                .string = { .minLen = 0, .maxLen = UINT_MAX },
18579
            },
18580
            .n_min = 0,
18581
            .n_max = UINT_MAX,
18582
         },
18583
         .is_mutable = true,
18584
         .is_synthetic = false,
18585
         .parse = ovsrec_ipfix_parse_other_config,
18586
         .unparse = ovsrec_ipfix_unparse_other_config,
18587
    },
18588
18589
    [OVSREC_IPFIX_COL_SAMPLING] = {
18590
         .name = "sampling",
18591
         .type = {
18592
            .key = {
18593
               .type = OVSDB_TYPE_INTEGER,
18594
               .integer = { .min = INT64_C(1), .max = INT64_C(4294967295) },
18595
            },
18596
            .value = OVSDB_BASE_VOID_INIT,
18597
            .n_min = 0,
18598
            .n_max = 1,
18599
         },
18600
         .is_mutable = true,
18601
         .is_synthetic = false,
18602
         .parse = ovsrec_ipfix_parse_sampling,
18603
         .unparse = ovsrec_ipfix_unparse_sampling,
18604
    },
18605
18606
    [OVSREC_IPFIX_COL_STATS_INTERVAL] = {
18607
         .name = "stats_interval",
18608
         .type = {
18609
            .key = {
18610
               .type = OVSDB_TYPE_INTEGER,
18611
               .integer = { .min = INT64_C(1), .max = INT64_C(3600) },
18612
            },
18613
            .value = OVSDB_BASE_VOID_INIT,
18614
            .n_min = 0,
18615
            .n_max = 1,
18616
         },
18617
         .is_mutable = true,
18618
         .is_synthetic = false,
18619
         .parse = ovsrec_ipfix_parse_stats_interval,
18620
         .unparse = ovsrec_ipfix_unparse_stats_interval,
18621
    },
18622
18623
    [OVSREC_IPFIX_COL_TARGETS] = {
18624
         .name = "targets",
18625
         .type = {
18626
            .key = {
18627
               .type = OVSDB_TYPE_STRING,
18628
               .string = { .minLen = 0, .maxLen = UINT_MAX },
18629
            },
18630
            .value = OVSDB_BASE_VOID_INIT,
18631
            .n_min = 0,
18632
            .n_max = UINT_MAX,
18633
         },
18634
         .is_mutable = true,
18635
         .is_synthetic = false,
18636
         .parse = ovsrec_ipfix_parse_targets,
18637
         .unparse = ovsrec_ipfix_unparse_targets,
18638
    },
18639
18640
    [OVSREC_IPFIX_COL_TEMPLATE_INTERVAL] = {
18641
         .name = "template_interval",
18642
         .type = {
18643
            .key = {
18644
               .type = OVSDB_TYPE_INTEGER,
18645
               .integer = { .min = INT64_C(1), .max = INT64_C(3600) },
18646
            },
18647
            .value = OVSDB_BASE_VOID_INIT,
18648
            .n_min = 0,
18649
            .n_max = 1,
18650
         },
18651
         .is_mutable = true,
18652
         .is_synthetic = false,
18653
         .parse = ovsrec_ipfix_parse_template_interval,
18654
         .unparse = ovsrec_ipfix_unparse_template_interval,
18655
    },
18656
18657
};
18658

18659
/* Interface table. */
18660
18661
bool
18662
ovsrec_server_has_interface_table_col_admin_state(const struct ovsdb_idl *idl)
18663
0
{
18664
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_admin_state);
18665
0
}
18666
18667
const struct ovsdb_type *
18668
ovsrec_interface_admin_state_server_type(const struct ovsdb_idl *idl)
18669
0
{
18670
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_admin_state);
18671
0
}
18672
18673
18674
bool
18675
ovsrec_server_has_interface_table_col_bfd(const struct ovsdb_idl *idl)
18676
0
{
18677
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_bfd);
18678
0
}
18679
18680
const struct ovsdb_type *
18681
ovsrec_interface_bfd_server_type(const struct ovsdb_idl *idl)
18682
0
{
18683
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_bfd);
18684
0
}
18685
18686
18687
bool
18688
ovsrec_server_has_interface_table_col_bfd_status(const struct ovsdb_idl *idl)
18689
0
{
18690
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_bfd_status);
18691
0
}
18692
18693
const struct ovsdb_type *
18694
ovsrec_interface_bfd_status_server_type(const struct ovsdb_idl *idl)
18695
0
{
18696
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_bfd_status);
18697
0
}
18698
18699
18700
bool
18701
ovsrec_server_has_interface_table_col_cfm_fault(const struct ovsdb_idl *idl)
18702
0
{
18703
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_fault);
18704
0
}
18705
18706
const struct ovsdb_type *
18707
ovsrec_interface_cfm_fault_server_type(const struct ovsdb_idl *idl)
18708
0
{
18709
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_cfm_fault);
18710
0
}
18711
18712
18713
bool
18714
ovsrec_server_has_interface_table_col_cfm_fault_status(const struct ovsdb_idl *idl)
18715
0
{
18716
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_fault_status);
18717
0
}
18718
18719
const struct ovsdb_type *
18720
ovsrec_interface_cfm_fault_status_server_type(const struct ovsdb_idl *idl)
18721
0
{
18722
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_cfm_fault_status);
18723
0
}
18724
18725
18726
bool
18727
ovsrec_server_has_interface_table_col_cfm_flap_count(const struct ovsdb_idl *idl)
18728
0
{
18729
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_flap_count);
18730
0
}
18731
18732
const struct ovsdb_type *
18733
ovsrec_interface_cfm_flap_count_server_type(const struct ovsdb_idl *idl)
18734
0
{
18735
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_cfm_flap_count);
18736
0
}
18737
18738
18739
bool
18740
ovsrec_server_has_interface_table_col_cfm_health(const struct ovsdb_idl *idl)
18741
0
{
18742
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_health);
18743
0
}
18744
18745
const struct ovsdb_type *
18746
ovsrec_interface_cfm_health_server_type(const struct ovsdb_idl *idl)
18747
0
{
18748
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_cfm_health);
18749
0
}
18750
18751
18752
bool
18753
ovsrec_server_has_interface_table_col_cfm_mpid(const struct ovsdb_idl *idl)
18754
0
{
18755
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_mpid);
18756
0
}
18757
18758
const struct ovsdb_type *
18759
ovsrec_interface_cfm_mpid_server_type(const struct ovsdb_idl *idl)
18760
0
{
18761
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_cfm_mpid);
18762
0
}
18763
18764
18765
bool
18766
ovsrec_server_has_interface_table_col_cfm_remote_mpids(const struct ovsdb_idl *idl)
18767
0
{
18768
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_remote_mpids);
18769
0
}
18770
18771
const struct ovsdb_type *
18772
ovsrec_interface_cfm_remote_mpids_server_type(const struct ovsdb_idl *idl)
18773
0
{
18774
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_cfm_remote_mpids);
18775
0
}
18776
18777
18778
bool
18779
ovsrec_server_has_interface_table_col_cfm_remote_opstate(const struct ovsdb_idl *idl)
18780
0
{
18781
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_remote_opstate);
18782
0
}
18783
18784
const struct ovsdb_type *
18785
ovsrec_interface_cfm_remote_opstate_server_type(const struct ovsdb_idl *idl)
18786
0
{
18787
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_cfm_remote_opstate);
18788
0
}
18789
18790
18791
bool
18792
ovsrec_server_has_interface_table_col_duplex(const struct ovsdb_idl *idl)
18793
0
{
18794
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_duplex);
18795
0
}
18796
18797
const struct ovsdb_type *
18798
ovsrec_interface_duplex_server_type(const struct ovsdb_idl *idl)
18799
0
{
18800
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_duplex);
18801
0
}
18802
18803
18804
bool
18805
ovsrec_server_has_interface_table_col_error(const struct ovsdb_idl *idl)
18806
0
{
18807
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_error);
18808
0
}
18809
18810
const struct ovsdb_type *
18811
ovsrec_interface_error_server_type(const struct ovsdb_idl *idl)
18812
0
{
18813
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_error);
18814
0
}
18815
18816
18817
bool
18818
ovsrec_server_has_interface_table_col_external_ids(const struct ovsdb_idl *idl)
18819
0
{
18820
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_external_ids);
18821
0
}
18822
18823
const struct ovsdb_type *
18824
ovsrec_interface_external_ids_server_type(const struct ovsdb_idl *idl)
18825
0
{
18826
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_external_ids);
18827
0
}
18828
18829
18830
bool
18831
ovsrec_server_has_interface_table_col_ifindex(const struct ovsdb_idl *idl)
18832
0
{
18833
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ifindex);
18834
0
}
18835
18836
const struct ovsdb_type *
18837
ovsrec_interface_ifindex_server_type(const struct ovsdb_idl *idl)
18838
0
{
18839
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_ifindex);
18840
0
}
18841
18842
18843
bool
18844
ovsrec_server_has_interface_table_col_ingress_policing_burst(const struct ovsdb_idl *idl)
18845
0
{
18846
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ingress_policing_burst);
18847
0
}
18848
18849
const struct ovsdb_type *
18850
ovsrec_interface_ingress_policing_burst_server_type(const struct ovsdb_idl *idl)
18851
0
{
18852
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_ingress_policing_burst);
18853
0
}
18854
18855
18856
bool
18857
ovsrec_server_has_interface_table_col_ingress_policing_kpkts_burst(const struct ovsdb_idl *idl)
18858
0
{
18859
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ingress_policing_kpkts_burst);
18860
0
}
18861
18862
const struct ovsdb_type *
18863
ovsrec_interface_ingress_policing_kpkts_burst_server_type(const struct ovsdb_idl *idl)
18864
0
{
18865
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_ingress_policing_kpkts_burst);
18866
0
}
18867
18868
18869
bool
18870
ovsrec_server_has_interface_table_col_ingress_policing_kpkts_rate(const struct ovsdb_idl *idl)
18871
0
{
18872
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ingress_policing_kpkts_rate);
18873
0
}
18874
18875
const struct ovsdb_type *
18876
ovsrec_interface_ingress_policing_kpkts_rate_server_type(const struct ovsdb_idl *idl)
18877
0
{
18878
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_ingress_policing_kpkts_rate);
18879
0
}
18880
18881
18882
bool
18883
ovsrec_server_has_interface_table_col_ingress_policing_rate(const struct ovsdb_idl *idl)
18884
0
{
18885
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ingress_policing_rate);
18886
0
}
18887
18888
const struct ovsdb_type *
18889
ovsrec_interface_ingress_policing_rate_server_type(const struct ovsdb_idl *idl)
18890
0
{
18891
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_ingress_policing_rate);
18892
0
}
18893
18894
18895
bool
18896
ovsrec_server_has_interface_table_col_lacp_current(const struct ovsdb_idl *idl)
18897
0
{
18898
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_lacp_current);
18899
0
}
18900
18901
const struct ovsdb_type *
18902
ovsrec_interface_lacp_current_server_type(const struct ovsdb_idl *idl)
18903
0
{
18904
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_lacp_current);
18905
0
}
18906
18907
18908
bool
18909
ovsrec_server_has_interface_table_col_link_resets(const struct ovsdb_idl *idl)
18910
0
{
18911
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_link_resets);
18912
0
}
18913
18914
const struct ovsdb_type *
18915
ovsrec_interface_link_resets_server_type(const struct ovsdb_idl *idl)
18916
0
{
18917
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_link_resets);
18918
0
}
18919
18920
18921
bool
18922
ovsrec_server_has_interface_table_col_link_speed(const struct ovsdb_idl *idl)
18923
0
{
18924
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_link_speed);
18925
0
}
18926
18927
const struct ovsdb_type *
18928
ovsrec_interface_link_speed_server_type(const struct ovsdb_idl *idl)
18929
0
{
18930
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_link_speed);
18931
0
}
18932
18933
18934
bool
18935
ovsrec_server_has_interface_table_col_link_state(const struct ovsdb_idl *idl)
18936
0
{
18937
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_link_state);
18938
0
}
18939
18940
const struct ovsdb_type *
18941
ovsrec_interface_link_state_server_type(const struct ovsdb_idl *idl)
18942
0
{
18943
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_link_state);
18944
0
}
18945
18946
18947
bool
18948
ovsrec_server_has_interface_table_col_lldp(const struct ovsdb_idl *idl)
18949
0
{
18950
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_lldp);
18951
0
}
18952
18953
const struct ovsdb_type *
18954
ovsrec_interface_lldp_server_type(const struct ovsdb_idl *idl)
18955
0
{
18956
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_lldp);
18957
0
}
18958
18959
18960
bool
18961
ovsrec_server_has_interface_table_col_mac(const struct ovsdb_idl *idl)
18962
0
{
18963
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_mac);
18964
0
}
18965
18966
const struct ovsdb_type *
18967
ovsrec_interface_mac_server_type(const struct ovsdb_idl *idl)
18968
0
{
18969
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_mac);
18970
0
}
18971
18972
18973
bool
18974
ovsrec_server_has_interface_table_col_mac_in_use(const struct ovsdb_idl *idl)
18975
0
{
18976
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_mac_in_use);
18977
0
}
18978
18979
const struct ovsdb_type *
18980
ovsrec_interface_mac_in_use_server_type(const struct ovsdb_idl *idl)
18981
0
{
18982
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_mac_in_use);
18983
0
}
18984
18985
18986
bool
18987
ovsrec_server_has_interface_table_col_mtu(const struct ovsdb_idl *idl)
18988
0
{
18989
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_mtu);
18990
0
}
18991
18992
const struct ovsdb_type *
18993
ovsrec_interface_mtu_server_type(const struct ovsdb_idl *idl)
18994
0
{
18995
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_mtu);
18996
0
}
18997
18998
18999
bool
19000
ovsrec_server_has_interface_table_col_mtu_request(const struct ovsdb_idl *idl)
19001
0
{
19002
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_mtu_request);
19003
0
}
19004
19005
const struct ovsdb_type *
19006
ovsrec_interface_mtu_request_server_type(const struct ovsdb_idl *idl)
19007
0
{
19008
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_mtu_request);
19009
0
}
19010
19011
19012
bool
19013
ovsrec_server_has_interface_table_col_name(const struct ovsdb_idl *idl)
19014
0
{
19015
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_name);
19016
0
}
19017
19018
const struct ovsdb_type *
19019
ovsrec_interface_name_server_type(const struct ovsdb_idl *idl)
19020
0
{
19021
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_name);
19022
0
}
19023
19024
19025
bool
19026
ovsrec_server_has_interface_table_col_ofport(const struct ovsdb_idl *idl)
19027
0
{
19028
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ofport);
19029
0
}
19030
19031
const struct ovsdb_type *
19032
ovsrec_interface_ofport_server_type(const struct ovsdb_idl *idl)
19033
0
{
19034
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_ofport);
19035
0
}
19036
19037
19038
bool
19039
ovsrec_server_has_interface_table_col_ofport_request(const struct ovsdb_idl *idl)
19040
0
{
19041
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ofport_request);
19042
0
}
19043
19044
const struct ovsdb_type *
19045
ovsrec_interface_ofport_request_server_type(const struct ovsdb_idl *idl)
19046
0
{
19047
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_ofport_request);
19048
0
}
19049
19050
19051
bool
19052
ovsrec_server_has_interface_table_col_options(const struct ovsdb_idl *idl)
19053
0
{
19054
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_options);
19055
0
}
19056
19057
const struct ovsdb_type *
19058
ovsrec_interface_options_server_type(const struct ovsdb_idl *idl)
19059
0
{
19060
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_options);
19061
0
}
19062
19063
19064
bool
19065
ovsrec_server_has_interface_table_col_other_config(const struct ovsdb_idl *idl)
19066
0
{
19067
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_other_config);
19068
0
}
19069
19070
const struct ovsdb_type *
19071
ovsrec_interface_other_config_server_type(const struct ovsdb_idl *idl)
19072
0
{
19073
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_other_config);
19074
0
}
19075
19076
19077
bool
19078
ovsrec_server_has_interface_table_col_statistics(const struct ovsdb_idl *idl)
19079
0
{
19080
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_statistics);
19081
0
}
19082
19083
const struct ovsdb_type *
19084
ovsrec_interface_statistics_server_type(const struct ovsdb_idl *idl)
19085
0
{
19086
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_statistics);
19087
0
}
19088
19089
19090
bool
19091
ovsrec_server_has_interface_table_col_status(const struct ovsdb_idl *idl)
19092
0
{
19093
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_status);
19094
0
}
19095
19096
const struct ovsdb_type *
19097
ovsrec_interface_status_server_type(const struct ovsdb_idl *idl)
19098
0
{
19099
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_status);
19100
0
}
19101
19102
19103
bool
19104
ovsrec_server_has_interface_table_col_type(const struct ovsdb_idl *idl)
19105
0
{
19106
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_type);
19107
0
}
19108
19109
const struct ovsdb_type *
19110
ovsrec_interface_type_server_type(const struct ovsdb_idl *idl)
19111
0
{
19112
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_interface_col_type);
19113
0
}
19114
19115
19116
bool
19117
ovsrec_server_has_interface_table(const struct ovsdb_idl *idl)
19118
0
{
19119
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
19120
0
}
19121
19122
19123
const struct ovsrec_interface_table *
19124
ovsrec_interface_table_get(const struct ovsdb_idl *idl)
19125
0
{
19126
0
    return (const struct ovsrec_interface_table *) idl;
19127
0
}
19128
19129
const struct ovsrec_interface *
19130
ovsrec_interface_table_first(const struct ovsrec_interface_table *table)
19131
0
{
19132
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
19133
0
    return ovsrec_interface_first(idl);
19134
0
}
19135
19136
19137
const struct ovsrec_interface *
19138
ovsrec_interface_table_track_get_first(const struct ovsrec_interface_table *table)
19139
0
{
19140
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
19141
0
    return ovsrec_interface_track_get_first(idl);
19142
0
}
19143
19144
19145
static void
19146
ovsrec_interface_parse_admin_state(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19147
0
{
19148
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19149
19150
0
    if (datum->n >= 1) {
19151
0
        row->admin_state = CONST_CAST(char *, json_string(datum->keys[0].s));
19152
0
    } else {
19153
0
        row->admin_state = NULL;
19154
0
    }
19155
0
}
19156
19157
static void
19158
ovsrec_interface_parse_bfd(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19159
0
{
19160
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19161
0
    smap_init(&row->bfd);
19162
0
    for (size_t i = 0; i < datum->n; i++) {
19163
0
        smap_add(&row->bfd,
19164
0
                 json_string(datum->keys[i].s),
19165
0
                 json_string(datum->values[i].s));
19166
0
    }
19167
0
}
19168
19169
static void
19170
ovsrec_interface_parse_bfd_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19171
0
{
19172
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19173
0
    smap_init(&row->bfd_status);
19174
0
    for (size_t i = 0; i < datum->n; i++) {
19175
0
        smap_add(&row->bfd_status,
19176
0
                 json_string(datum->keys[i].s),
19177
0
                 json_string(datum->values[i].s));
19178
0
    }
19179
0
}
19180
19181
static void
19182
ovsrec_interface_parse_cfm_fault(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19183
0
{
19184
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19185
0
    size_t n = MIN(1, datum->n);
19186
0
    row->cfm_fault = NULL;
19187
0
    row->n_cfm_fault = 0;
19188
0
    for (size_t i = 0; i < n; i++) {
19189
0
        if (!row->n_cfm_fault) {
19190
0
            row->cfm_fault = xmalloc(n * sizeof *row->cfm_fault);
19191
0
        }
19192
0
        row->cfm_fault[row->n_cfm_fault] = datum->keys[i].boolean;
19193
0
        row->n_cfm_fault++;
19194
0
    }
19195
0
}
19196
19197
static void
19198
ovsrec_interface_parse_cfm_fault_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19199
0
{
19200
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19201
0
    row->cfm_fault_status = NULL;
19202
0
    row->n_cfm_fault_status = 0;
19203
0
    for (size_t i = 0; i < datum->n; i++) {
19204
0
        if (!row->n_cfm_fault_status) {
19205
0
            row->cfm_fault_status = xmalloc(datum->n * sizeof *row->cfm_fault_status);
19206
0
        }
19207
0
        row->cfm_fault_status[row->n_cfm_fault_status] = CONST_CAST(char *, json_string(datum->keys[i].s));
19208
0
        row->n_cfm_fault_status++;
19209
0
    }
19210
0
}
19211
19212
static void
19213
ovsrec_interface_parse_cfm_flap_count(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19214
0
{
19215
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19216
0
    size_t n = MIN(1, datum->n);
19217
0
    row->cfm_flap_count = NULL;
19218
0
    row->n_cfm_flap_count = 0;
19219
0
    for (size_t i = 0; i < n; i++) {
19220
0
        if (!row->n_cfm_flap_count) {
19221
0
            row->cfm_flap_count = xmalloc(n * sizeof *row->cfm_flap_count);
19222
0
        }
19223
0
        row->cfm_flap_count[row->n_cfm_flap_count] = datum->keys[i].integer;
19224
0
        row->n_cfm_flap_count++;
19225
0
    }
19226
0
}
19227
19228
static void
19229
ovsrec_interface_parse_cfm_health(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19230
0
{
19231
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19232
0
    size_t n = MIN(1, datum->n);
19233
0
    row->cfm_health = NULL;
19234
0
    row->n_cfm_health = 0;
19235
0
    for (size_t i = 0; i < n; i++) {
19236
0
        if (!row->n_cfm_health) {
19237
0
            row->cfm_health = xmalloc(n * sizeof *row->cfm_health);
19238
0
        }
19239
0
        row->cfm_health[row->n_cfm_health] = datum->keys[i].integer;
19240
0
        row->n_cfm_health++;
19241
0
    }
19242
0
}
19243
19244
static void
19245
ovsrec_interface_parse_cfm_mpid(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19246
0
{
19247
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19248
0
    size_t n = MIN(1, datum->n);
19249
0
    row->cfm_mpid = NULL;
19250
0
    row->n_cfm_mpid = 0;
19251
0
    for (size_t i = 0; i < n; i++) {
19252
0
        if (!row->n_cfm_mpid) {
19253
0
            row->cfm_mpid = xmalloc(n * sizeof *row->cfm_mpid);
19254
0
        }
19255
0
        row->cfm_mpid[row->n_cfm_mpid] = datum->keys[i].integer;
19256
0
        row->n_cfm_mpid++;
19257
0
    }
19258
0
}
19259
19260
static void
19261
ovsrec_interface_parse_cfm_remote_mpids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19262
0
{
19263
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19264
0
    row->cfm_remote_mpids = NULL;
19265
0
    row->n_cfm_remote_mpids = 0;
19266
0
    for (size_t i = 0; i < datum->n; i++) {
19267
0
        if (!row->n_cfm_remote_mpids) {
19268
0
            row->cfm_remote_mpids = xmalloc(datum->n * sizeof *row->cfm_remote_mpids);
19269
0
        }
19270
0
        row->cfm_remote_mpids[row->n_cfm_remote_mpids] = datum->keys[i].integer;
19271
0
        row->n_cfm_remote_mpids++;
19272
0
    }
19273
0
}
19274
19275
static void
19276
ovsrec_interface_parse_cfm_remote_opstate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19277
0
{
19278
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19279
19280
0
    if (datum->n >= 1) {
19281
0
        row->cfm_remote_opstate = CONST_CAST(char *, json_string(datum->keys[0].s));
19282
0
    } else {
19283
0
        row->cfm_remote_opstate = NULL;
19284
0
    }
19285
0
}
19286
19287
static void
19288
ovsrec_interface_parse_duplex(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19289
0
{
19290
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19291
19292
0
    if (datum->n >= 1) {
19293
0
        row->duplex = CONST_CAST(char *, json_string(datum->keys[0].s));
19294
0
    } else {
19295
0
        row->duplex = NULL;
19296
0
    }
19297
0
}
19298
19299
static void
19300
ovsrec_interface_parse_error(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19301
0
{
19302
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19303
19304
0
    if (datum->n >= 1) {
19305
0
        row->error = CONST_CAST(char *, json_string(datum->keys[0].s));
19306
0
    } else {
19307
0
        row->error = NULL;
19308
0
    }
19309
0
}
19310
19311
static void
19312
ovsrec_interface_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19313
0
{
19314
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19315
0
    smap_init(&row->external_ids);
19316
0
    for (size_t i = 0; i < datum->n; i++) {
19317
0
        smap_add(&row->external_ids,
19318
0
                 json_string(datum->keys[i].s),
19319
0
                 json_string(datum->values[i].s));
19320
0
    }
19321
0
}
19322
19323
static void
19324
ovsrec_interface_parse_ifindex(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19325
0
{
19326
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19327
0
    size_t n = MIN(1, datum->n);
19328
0
    row->ifindex = NULL;
19329
0
    row->n_ifindex = 0;
19330
0
    for (size_t i = 0; i < n; i++) {
19331
0
        if (!row->n_ifindex) {
19332
0
            row->ifindex = xmalloc(n * sizeof *row->ifindex);
19333
0
        }
19334
0
        row->ifindex[row->n_ifindex] = datum->keys[i].integer;
19335
0
        row->n_ifindex++;
19336
0
    }
19337
0
}
19338
19339
static void
19340
ovsrec_interface_parse_ingress_policing_burst(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19341
0
{
19342
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19343
19344
0
    if (datum->n >= 1) {
19345
0
        row->ingress_policing_burst = datum->keys[0].integer;
19346
0
    } else {
19347
0
        row->ingress_policing_burst = 0;
19348
0
    }
19349
0
}
19350
19351
static void
19352
ovsrec_interface_parse_ingress_policing_kpkts_burst(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19353
0
{
19354
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19355
19356
0
    if (datum->n >= 1) {
19357
0
        row->ingress_policing_kpkts_burst = datum->keys[0].integer;
19358
0
    } else {
19359
0
        row->ingress_policing_kpkts_burst = 0;
19360
0
    }
19361
0
}
19362
19363
static void
19364
ovsrec_interface_parse_ingress_policing_kpkts_rate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19365
0
{
19366
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19367
19368
0
    if (datum->n >= 1) {
19369
0
        row->ingress_policing_kpkts_rate = datum->keys[0].integer;
19370
0
    } else {
19371
0
        row->ingress_policing_kpkts_rate = 0;
19372
0
    }
19373
0
}
19374
19375
static void
19376
ovsrec_interface_parse_ingress_policing_rate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19377
0
{
19378
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19379
19380
0
    if (datum->n >= 1) {
19381
0
        row->ingress_policing_rate = datum->keys[0].integer;
19382
0
    } else {
19383
0
        row->ingress_policing_rate = 0;
19384
0
    }
19385
0
}
19386
19387
static void
19388
ovsrec_interface_parse_lacp_current(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19389
0
{
19390
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19391
0
    size_t n = MIN(1, datum->n);
19392
0
    row->lacp_current = NULL;
19393
0
    row->n_lacp_current = 0;
19394
0
    for (size_t i = 0; i < n; i++) {
19395
0
        if (!row->n_lacp_current) {
19396
0
            row->lacp_current = xmalloc(n * sizeof *row->lacp_current);
19397
0
        }
19398
0
        row->lacp_current[row->n_lacp_current] = datum->keys[i].boolean;
19399
0
        row->n_lacp_current++;
19400
0
    }
19401
0
}
19402
19403
static void
19404
ovsrec_interface_parse_link_resets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19405
0
{
19406
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19407
0
    size_t n = MIN(1, datum->n);
19408
0
    row->link_resets = NULL;
19409
0
    row->n_link_resets = 0;
19410
0
    for (size_t i = 0; i < n; i++) {
19411
0
        if (!row->n_link_resets) {
19412
0
            row->link_resets = xmalloc(n * sizeof *row->link_resets);
19413
0
        }
19414
0
        row->link_resets[row->n_link_resets] = datum->keys[i].integer;
19415
0
        row->n_link_resets++;
19416
0
    }
19417
0
}
19418
19419
static void
19420
ovsrec_interface_parse_link_speed(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19421
0
{
19422
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19423
0
    size_t n = MIN(1, datum->n);
19424
0
    row->link_speed = NULL;
19425
0
    row->n_link_speed = 0;
19426
0
    for (size_t i = 0; i < n; i++) {
19427
0
        if (!row->n_link_speed) {
19428
0
            row->link_speed = xmalloc(n * sizeof *row->link_speed);
19429
0
        }
19430
0
        row->link_speed[row->n_link_speed] = datum->keys[i].integer;
19431
0
        row->n_link_speed++;
19432
0
    }
19433
0
}
19434
19435
static void
19436
ovsrec_interface_parse_link_state(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19437
0
{
19438
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19439
19440
0
    if (datum->n >= 1) {
19441
0
        row->link_state = CONST_CAST(char *, json_string(datum->keys[0].s));
19442
0
    } else {
19443
0
        row->link_state = NULL;
19444
0
    }
19445
0
}
19446
19447
static void
19448
ovsrec_interface_parse_lldp(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19449
0
{
19450
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19451
0
    smap_init(&row->lldp);
19452
0
    for (size_t i = 0; i < datum->n; i++) {
19453
0
        smap_add(&row->lldp,
19454
0
                 json_string(datum->keys[i].s),
19455
0
                 json_string(datum->values[i].s));
19456
0
    }
19457
0
}
19458
19459
static void
19460
ovsrec_interface_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19461
0
{
19462
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19463
19464
0
    if (datum->n >= 1) {
19465
0
        row->mac = CONST_CAST(char *, json_string(datum->keys[0].s));
19466
0
    } else {
19467
0
        row->mac = NULL;
19468
0
    }
19469
0
}
19470
19471
static void
19472
ovsrec_interface_parse_mac_in_use(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19473
0
{
19474
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19475
19476
0
    if (datum->n >= 1) {
19477
0
        row->mac_in_use = CONST_CAST(char *, json_string(datum->keys[0].s));
19478
0
    } else {
19479
0
        row->mac_in_use = NULL;
19480
0
    }
19481
0
}
19482
19483
static void
19484
ovsrec_interface_parse_mtu(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19485
0
{
19486
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19487
0
    size_t n = MIN(1, datum->n);
19488
0
    row->mtu = NULL;
19489
0
    row->n_mtu = 0;
19490
0
    for (size_t i = 0; i < n; i++) {
19491
0
        if (!row->n_mtu) {
19492
0
            row->mtu = xmalloc(n * sizeof *row->mtu);
19493
0
        }
19494
0
        row->mtu[row->n_mtu] = datum->keys[i].integer;
19495
0
        row->n_mtu++;
19496
0
    }
19497
0
}
19498
19499
static void
19500
ovsrec_interface_parse_mtu_request(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19501
0
{
19502
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19503
0
    size_t n = MIN(1, datum->n);
19504
0
    row->mtu_request = NULL;
19505
0
    row->n_mtu_request = 0;
19506
0
    for (size_t i = 0; i < n; i++) {
19507
0
        if (!row->n_mtu_request) {
19508
0
            row->mtu_request = xmalloc(n * sizeof *row->mtu_request);
19509
0
        }
19510
0
        row->mtu_request[row->n_mtu_request] = datum->keys[i].integer;
19511
0
        row->n_mtu_request++;
19512
0
    }
19513
0
}
19514
19515
static void
19516
ovsrec_interface_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19517
0
{
19518
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19519
19520
0
    if (datum->n >= 1) {
19521
0
        row->name = CONST_CAST(char *, json_string(datum->keys[0].s));
19522
0
    } else {
19523
0
        row->name = "";
19524
0
    }
19525
0
}
19526
19527
static void
19528
ovsrec_interface_parse_ofport(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19529
0
{
19530
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19531
0
    size_t n = MIN(1, datum->n);
19532
0
    row->ofport = NULL;
19533
0
    row->n_ofport = 0;
19534
0
    for (size_t i = 0; i < n; i++) {
19535
0
        if (!row->n_ofport) {
19536
0
            row->ofport = xmalloc(n * sizeof *row->ofport);
19537
0
        }
19538
0
        row->ofport[row->n_ofport] = datum->keys[i].integer;
19539
0
        row->n_ofport++;
19540
0
    }
19541
0
}
19542
19543
static void
19544
ovsrec_interface_parse_ofport_request(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19545
0
{
19546
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19547
0
    size_t n = MIN(1, datum->n);
19548
0
    row->ofport_request = NULL;
19549
0
    row->n_ofport_request = 0;
19550
0
    for (size_t i = 0; i < n; i++) {
19551
0
        if (!row->n_ofport_request) {
19552
0
            row->ofport_request = xmalloc(n * sizeof *row->ofport_request);
19553
0
        }
19554
0
        row->ofport_request[row->n_ofport_request] = datum->keys[i].integer;
19555
0
        row->n_ofport_request++;
19556
0
    }
19557
0
}
19558
19559
static void
19560
ovsrec_interface_parse_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19561
0
{
19562
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19563
0
    smap_init(&row->options);
19564
0
    for (size_t i = 0; i < datum->n; i++) {
19565
0
        smap_add(&row->options,
19566
0
                 json_string(datum->keys[i].s),
19567
0
                 json_string(datum->values[i].s));
19568
0
    }
19569
0
}
19570
19571
static void
19572
ovsrec_interface_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19573
0
{
19574
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19575
0
    smap_init(&row->other_config);
19576
0
    for (size_t i = 0; i < datum->n; i++) {
19577
0
        smap_add(&row->other_config,
19578
0
                 json_string(datum->keys[i].s),
19579
0
                 json_string(datum->values[i].s));
19580
0
    }
19581
0
}
19582
19583
static void
19584
ovsrec_interface_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19585
0
{
19586
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19587
0
    row->key_statistics = NULL;
19588
0
    row->value_statistics = NULL;
19589
0
    row->n_statistics = 0;
19590
0
    for (size_t i = 0; i < datum->n; i++) {
19591
0
        if (!row->n_statistics) {
19592
0
            row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
19593
0
            row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
19594
0
        }
19595
0
        row->key_statistics[row->n_statistics] = CONST_CAST(char *, json_string(datum->keys[i].s));
19596
0
        row->value_statistics[row->n_statistics] = datum->values[i].integer;
19597
0
        row->n_statistics++;
19598
0
    }
19599
0
}
19600
19601
static void
19602
ovsrec_interface_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19603
0
{
19604
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19605
0
    smap_init(&row->status);
19606
0
    for (size_t i = 0; i < datum->n; i++) {
19607
0
        smap_add(&row->status,
19608
0
                 json_string(datum->keys[i].s),
19609
0
                 json_string(datum->values[i].s));
19610
0
    }
19611
0
}
19612
19613
static void
19614
ovsrec_interface_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
19615
0
{
19616
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19617
19618
0
    if (datum->n >= 1) {
19619
0
        row->type = CONST_CAST(char *, json_string(datum->keys[0].s));
19620
0
    } else {
19621
0
        row->type = "";
19622
0
    }
19623
0
}
19624
19625
static void
19626
ovsrec_interface_unparse_admin_state(struct ovsdb_idl_row *row OVS_UNUSED)
19627
0
{
19628
    /* Nothing to do. */
19629
0
}
19630
19631
static void
19632
ovsrec_interface_unparse_bfd(struct ovsdb_idl_row *row_)
19633
0
{
19634
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19635
0
    smap_destroy(&row->bfd);
19636
0
}
19637
19638
static void
19639
ovsrec_interface_unparse_bfd_status(struct ovsdb_idl_row *row_)
19640
0
{
19641
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19642
0
    smap_destroy(&row->bfd_status);
19643
0
}
19644
19645
static void
19646
ovsrec_interface_unparse_cfm_fault(struct ovsdb_idl_row *row_)
19647
0
{
19648
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19649
0
    free(row->cfm_fault);
19650
0
}
19651
19652
static void
19653
ovsrec_interface_unparse_cfm_fault_status(struct ovsdb_idl_row *row_)
19654
0
{
19655
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19656
0
    free(row->cfm_fault_status);
19657
0
}
19658
19659
static void
19660
ovsrec_interface_unparse_cfm_flap_count(struct ovsdb_idl_row *row_)
19661
0
{
19662
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19663
0
    free(row->cfm_flap_count);
19664
0
}
19665
19666
static void
19667
ovsrec_interface_unparse_cfm_health(struct ovsdb_idl_row *row_)
19668
0
{
19669
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19670
0
    free(row->cfm_health);
19671
0
}
19672
19673
static void
19674
ovsrec_interface_unparse_cfm_mpid(struct ovsdb_idl_row *row_)
19675
0
{
19676
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19677
0
    free(row->cfm_mpid);
19678
0
}
19679
19680
static void
19681
ovsrec_interface_unparse_cfm_remote_mpids(struct ovsdb_idl_row *row_)
19682
0
{
19683
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19684
0
    free(row->cfm_remote_mpids);
19685
0
}
19686
19687
static void
19688
ovsrec_interface_unparse_cfm_remote_opstate(struct ovsdb_idl_row *row OVS_UNUSED)
19689
0
{
19690
    /* Nothing to do. */
19691
0
}
19692
19693
static void
19694
ovsrec_interface_unparse_duplex(struct ovsdb_idl_row *row OVS_UNUSED)
19695
0
{
19696
    /* Nothing to do. */
19697
0
}
19698
19699
static void
19700
ovsrec_interface_unparse_error(struct ovsdb_idl_row *row OVS_UNUSED)
19701
0
{
19702
    /* Nothing to do. */
19703
0
}
19704
19705
static void
19706
ovsrec_interface_unparse_external_ids(struct ovsdb_idl_row *row_)
19707
0
{
19708
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19709
0
    smap_destroy(&row->external_ids);
19710
0
}
19711
19712
static void
19713
ovsrec_interface_unparse_ifindex(struct ovsdb_idl_row *row_)
19714
0
{
19715
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19716
0
    free(row->ifindex);
19717
0
}
19718
19719
static void
19720
ovsrec_interface_unparse_ingress_policing_burst(struct ovsdb_idl_row *row OVS_UNUSED)
19721
0
{
19722
    /* Nothing to do. */
19723
0
}
19724
19725
static void
19726
ovsrec_interface_unparse_ingress_policing_kpkts_burst(struct ovsdb_idl_row *row OVS_UNUSED)
19727
0
{
19728
    /* Nothing to do. */
19729
0
}
19730
19731
static void
19732
ovsrec_interface_unparse_ingress_policing_kpkts_rate(struct ovsdb_idl_row *row OVS_UNUSED)
19733
0
{
19734
    /* Nothing to do. */
19735
0
}
19736
19737
static void
19738
ovsrec_interface_unparse_ingress_policing_rate(struct ovsdb_idl_row *row OVS_UNUSED)
19739
0
{
19740
    /* Nothing to do. */
19741
0
}
19742
19743
static void
19744
ovsrec_interface_unparse_lacp_current(struct ovsdb_idl_row *row_)
19745
0
{
19746
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19747
0
    free(row->lacp_current);
19748
0
}
19749
19750
static void
19751
ovsrec_interface_unparse_link_resets(struct ovsdb_idl_row *row_)
19752
0
{
19753
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19754
0
    free(row->link_resets);
19755
0
}
19756
19757
static void
19758
ovsrec_interface_unparse_link_speed(struct ovsdb_idl_row *row_)
19759
0
{
19760
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19761
0
    free(row->link_speed);
19762
0
}
19763
19764
static void
19765
ovsrec_interface_unparse_link_state(struct ovsdb_idl_row *row OVS_UNUSED)
19766
0
{
19767
    /* Nothing to do. */
19768
0
}
19769
19770
static void
19771
ovsrec_interface_unparse_lldp(struct ovsdb_idl_row *row_)
19772
0
{
19773
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19774
0
    smap_destroy(&row->lldp);
19775
0
}
19776
19777
static void
19778
ovsrec_interface_unparse_mac(struct ovsdb_idl_row *row OVS_UNUSED)
19779
0
{
19780
    /* Nothing to do. */
19781
0
}
19782
19783
static void
19784
ovsrec_interface_unparse_mac_in_use(struct ovsdb_idl_row *row OVS_UNUSED)
19785
0
{
19786
    /* Nothing to do. */
19787
0
}
19788
19789
static void
19790
ovsrec_interface_unparse_mtu(struct ovsdb_idl_row *row_)
19791
0
{
19792
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19793
0
    free(row->mtu);
19794
0
}
19795
19796
static void
19797
ovsrec_interface_unparse_mtu_request(struct ovsdb_idl_row *row_)
19798
0
{
19799
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19800
0
    free(row->mtu_request);
19801
0
}
19802
19803
static void
19804
ovsrec_interface_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
19805
0
{
19806
    /* Nothing to do. */
19807
0
}
19808
19809
static void
19810
ovsrec_interface_unparse_ofport(struct ovsdb_idl_row *row_)
19811
0
{
19812
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19813
0
    free(row->ofport);
19814
0
}
19815
19816
static void
19817
ovsrec_interface_unparse_ofport_request(struct ovsdb_idl_row *row_)
19818
0
{
19819
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19820
0
    free(row->ofport_request);
19821
0
}
19822
19823
static void
19824
ovsrec_interface_unparse_options(struct ovsdb_idl_row *row_)
19825
0
{
19826
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19827
0
    smap_destroy(&row->options);
19828
0
}
19829
19830
static void
19831
ovsrec_interface_unparse_other_config(struct ovsdb_idl_row *row_)
19832
0
{
19833
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19834
0
    smap_destroy(&row->other_config);
19835
0
}
19836
19837
static void
19838
ovsrec_interface_unparse_statistics(struct ovsdb_idl_row *row_)
19839
0
{
19840
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19841
0
    free(row->key_statistics);
19842
0
    free(row->value_statistics);
19843
0
}
19844
19845
static void
19846
ovsrec_interface_unparse_status(struct ovsdb_idl_row *row_)
19847
0
{
19848
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
19849
0
    smap_destroy(&row->status);
19850
0
}
19851
19852
static void
19853
ovsrec_interface_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
19854
0
{
19855
    /* Nothing to do. */
19856
0
}
19857
19858
static void
19859
ovsrec_interface_init__(struct ovsdb_idl_row *row)
19860
0
{
19861
0
    ovsrec_interface_init(ovsrec_interface_cast(row));
19862
0
}
19863
19864
/* Clears the contents of 'row' in table "Interface". */
19865
void
19866
ovsrec_interface_init(struct ovsrec_interface *row)
19867
0
{
19868
0
    memset(row, 0, sizeof *row); 
19869
0
    smap_init(&row->bfd);
19870
0
    smap_init(&row->bfd_status);
19871
0
    smap_init(&row->external_ids);
19872
0
    smap_init(&row->lldp);
19873
0
    row->name = "";
19874
0
    smap_init(&row->options);
19875
0
    smap_init(&row->other_config);
19876
0
    smap_init(&row->status);
19877
0
    row->type = "";
19878
0
}
19879
19880
/* Searches table "Interface" in 'idl' for a row with UUID 'uuid'.  Returns
19881
 * a pointer to the row if there is one, otherwise a null pointer.  */
19882
const struct ovsrec_interface *
19883
ovsrec_interface_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
19884
0
{
19885
0
    return ovsrec_interface_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_interface, uuid));
19886
0
}
19887
19888
/* Searches table "Interface" for a row with UUID 'uuid'.  Returns
19889
 * a pointer to the row if there is one, otherwise a null pointer.  */
19890
const struct ovsrec_interface *
19891
ovsrec_interface_table_get_for_uuid(const struct ovsrec_interface_table *table, const struct uuid *uuid)
19892
0
{
19893
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
19894
0
    return ovsrec_interface_get_for_uuid(idl, uuid);
19895
0
}
19896
19897
/* Returns a row in table "Interface" in 'idl', or a null pointer if that
19898
 * table is empty.
19899
 *
19900
 * Database tables are internally maintained as hash tables, so adding or
19901
 * removing rows while traversing the same table can cause some rows to be
19902
 * visited twice or not at apply. */
19903
const struct ovsrec_interface *
19904
ovsrec_interface_first(const struct ovsdb_idl *idl)
19905
0
{
19906
0
    return ovsrec_interface_cast(ovsdb_idl_first_row(idl, &ovsrec_table_interface));
19907
0
}
19908
19909
/* Returns a row following 'row' within its table, or a null pointer if 'row'
19910
 * is the last row in its table. */
19911
const struct ovsrec_interface *
19912
ovsrec_interface_next(const struct ovsrec_interface *row)
19913
0
{
19914
0
    return ovsrec_interface_cast(ovsdb_idl_next_row(&row->header_));
19915
0
}
19916
19917
unsigned int ovsrec_interface_get_seqno(const struct ovsdb_idl *idl)
19918
0
{
19919
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_interface);
19920
0
}
19921
19922
unsigned int ovsrec_interface_row_get_seqno(const struct ovsrec_interface *row, enum ovsdb_idl_change change)
19923
0
{
19924
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
19925
0
}
19926
19927
const struct ovsrec_interface *
19928
ovsrec_interface_track_get_first(const struct ovsdb_idl *idl)
19929
0
{
19930
0
    return ovsrec_interface_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_interface));
19931
0
}
19932
19933
const struct ovsrec_interface
19934
*ovsrec_interface_track_get_next(const struct ovsrec_interface *row)
19935
0
{
19936
0
    return ovsrec_interface_cast(ovsdb_idl_track_get_next(&row->header_));
19937
0
}
19938
19939
19940
/* Deletes 'row' from table "Interface".  'row' may be freed, so it must not be
19941
 * accessed afterward.
19942
 *
19943
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19944
void
19945
ovsrec_interface_delete(const struct ovsrec_interface *row)
19946
0
{
19947
0
    ovsdb_idl_txn_delete(&row->header_);
19948
0
}
19949
19950
/* Inserts and returns a new row in the table "Interface" in the database
19951
 * with open transaction 'txn'.
19952
 *
19953
 * The new row is assigned a randomly generated provisional UUID.
19954
 * ovsdb-server will assign a different UUID when 'txn' is committed,
19955
 * but the IDL will replace any uses of the provisional UUID in the
19956
 * data to be to be committed by the UUID assigned by ovsdb-server. */
19957
struct ovsrec_interface *
19958
ovsrec_interface_insert(struct ovsdb_idl_txn *txn)
19959
0
{
19960
0
    return ovsrec_interface_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_interface, NULL));
19961
0
}
19962
19963
/* Inserts and returns a new row in the table "Interface" in the database
19964
 * with open transaction 'txn'.
19965
 *
19966
 * The new row is assigned the UUID specified in the 'uuid' parameter
19967
 * (which cannot be null).  ovsdb-server will try to assign the same
19968
 * UUID when 'txn' is committed. */
19969
struct ovsrec_interface *
19970
ovsrec_interface_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
19971
0
{
19972
0
    return ovsrec_interface_cast(ovsdb_idl_txn_insert_persist_uuid(
19973
0
        txn, &ovsrec_table_interface, uuid));
19974
0
}
19975
19976
bool
19977
ovsrec_interface_is_updated(const struct ovsrec_interface *row, enum ovsrec_interface_column_id column)
19978
0
{
19979
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_interface_columns[column]);
19980
0
}
19981
19982
/* Causes the original contents of column "admin_state" in 'row' to be
19983
 * verified as a prerequisite to completing the transaction.  That is, if
19984
 * "admin_state" in 'row' changed (or if 'row' was deleted) between the
19985
 * time that the IDL originally read its contents and the time that the
19986
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19987
 *
19988
 * The intention is that, to ensure that no transaction commits based on dirty
19989
 * reads, an application should call this function any time "admin_state" is
19990
 * read as part of a read-modify-write operation.
19991
 *
19992
 * In some cases this function reduces to a no-op, because the current value
19993
 * of "admin_state" is already known:
19994
 *
19995
 *   - If 'row' is a row created by the current transaction (returned by
19996
 *     ovsrec_interface_insert()).
19997
 *
19998
 *   - If "admin_state" has already been modified (with
19999
 *     ovsrec_interface_set_admin_state()) within the current transaction.
20000
 *
20001
 * Because of the latter property, always call this function *before*
20002
 * ovsrec_interface_set_admin_state() for a given read-modify-write.
20003
 *
20004
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20005
void
20006
ovsrec_interface_verify_admin_state(const struct ovsrec_interface *row)
20007
0
{
20008
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_admin_state);
20009
0
}
20010
20011
/* Causes the original contents of column "bfd" in 'row' to be
20012
 * verified as a prerequisite to completing the transaction.  That is, if
20013
 * "bfd" in 'row' changed (or if 'row' was deleted) between the
20014
 * time that the IDL originally read its contents and the time that the
20015
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20016
 *
20017
 * The intention is that, to ensure that no transaction commits based on dirty
20018
 * reads, an application should call this function any time "bfd" is
20019
 * read as part of a read-modify-write operation.
20020
 *
20021
 * In some cases this function reduces to a no-op, because the current value
20022
 * of "bfd" is already known:
20023
 *
20024
 *   - If 'row' is a row created by the current transaction (returned by
20025
 *     ovsrec_interface_insert()).
20026
 *
20027
 *   - If "bfd" has already been modified (with
20028
 *     ovsrec_interface_set_bfd()) within the current transaction.
20029
 *
20030
 * Because of the latter property, always call this function *before*
20031
 * ovsrec_interface_set_bfd() for a given read-modify-write.
20032
 *
20033
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20034
void
20035
ovsrec_interface_verify_bfd(const struct ovsrec_interface *row)
20036
0
{
20037
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_bfd);
20038
0
}
20039
20040
/* Causes the original contents of column "bfd_status" in 'row' to be
20041
 * verified as a prerequisite to completing the transaction.  That is, if
20042
 * "bfd_status" in 'row' changed (or if 'row' was deleted) between the
20043
 * time that the IDL originally read its contents and the time that the
20044
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20045
 *
20046
 * The intention is that, to ensure that no transaction commits based on dirty
20047
 * reads, an application should call this function any time "bfd_status" is
20048
 * read as part of a read-modify-write operation.
20049
 *
20050
 * In some cases this function reduces to a no-op, because the current value
20051
 * of "bfd_status" is already known:
20052
 *
20053
 *   - If 'row' is a row created by the current transaction (returned by
20054
 *     ovsrec_interface_insert()).
20055
 *
20056
 *   - If "bfd_status" has already been modified (with
20057
 *     ovsrec_interface_set_bfd_status()) within the current transaction.
20058
 *
20059
 * Because of the latter property, always call this function *before*
20060
 * ovsrec_interface_set_bfd_status() for a given read-modify-write.
20061
 *
20062
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20063
void
20064
ovsrec_interface_verify_bfd_status(const struct ovsrec_interface *row)
20065
0
{
20066
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_bfd_status);
20067
0
}
20068
20069
/* Causes the original contents of column "cfm_fault" in 'row' to be
20070
 * verified as a prerequisite to completing the transaction.  That is, if
20071
 * "cfm_fault" in 'row' changed (or if 'row' was deleted) between the
20072
 * time that the IDL originally read its contents and the time that the
20073
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20074
 *
20075
 * The intention is that, to ensure that no transaction commits based on dirty
20076
 * reads, an application should call this function any time "cfm_fault" is
20077
 * read as part of a read-modify-write operation.
20078
 *
20079
 * In some cases this function reduces to a no-op, because the current value
20080
 * of "cfm_fault" is already known:
20081
 *
20082
 *   - If 'row' is a row created by the current transaction (returned by
20083
 *     ovsrec_interface_insert()).
20084
 *
20085
 *   - If "cfm_fault" has already been modified (with
20086
 *     ovsrec_interface_set_cfm_fault()) within the current transaction.
20087
 *
20088
 * Because of the latter property, always call this function *before*
20089
 * ovsrec_interface_set_cfm_fault() for a given read-modify-write.
20090
 *
20091
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20092
void
20093
ovsrec_interface_verify_cfm_fault(const struct ovsrec_interface *row)
20094
0
{
20095
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_fault);
20096
0
}
20097
20098
/* Causes the original contents of column "cfm_fault_status" in 'row' to be
20099
 * verified as a prerequisite to completing the transaction.  That is, if
20100
 * "cfm_fault_status" in 'row' changed (or if 'row' was deleted) between the
20101
 * time that the IDL originally read its contents and the time that the
20102
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20103
 *
20104
 * The intention is that, to ensure that no transaction commits based on dirty
20105
 * reads, an application should call this function any time "cfm_fault_status" is
20106
 * read as part of a read-modify-write operation.
20107
 *
20108
 * In some cases this function reduces to a no-op, because the current value
20109
 * of "cfm_fault_status" is already known:
20110
 *
20111
 *   - If 'row' is a row created by the current transaction (returned by
20112
 *     ovsrec_interface_insert()).
20113
 *
20114
 *   - If "cfm_fault_status" has already been modified (with
20115
 *     ovsrec_interface_set_cfm_fault_status()) within the current transaction.
20116
 *
20117
 * Because of the latter property, always call this function *before*
20118
 * ovsrec_interface_set_cfm_fault_status() for a given read-modify-write.
20119
 *
20120
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20121
void
20122
ovsrec_interface_verify_cfm_fault_status(const struct ovsrec_interface *row)
20123
0
{
20124
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_fault_status);
20125
0
}
20126
20127
/* Causes the original contents of column "cfm_flap_count" in 'row' to be
20128
 * verified as a prerequisite to completing the transaction.  That is, if
20129
 * "cfm_flap_count" in 'row' changed (or if 'row' was deleted) between the
20130
 * time that the IDL originally read its contents and the time that the
20131
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20132
 *
20133
 * The intention is that, to ensure that no transaction commits based on dirty
20134
 * reads, an application should call this function any time "cfm_flap_count" is
20135
 * read as part of a read-modify-write operation.
20136
 *
20137
 * In some cases this function reduces to a no-op, because the current value
20138
 * of "cfm_flap_count" is already known:
20139
 *
20140
 *   - If 'row' is a row created by the current transaction (returned by
20141
 *     ovsrec_interface_insert()).
20142
 *
20143
 *   - If "cfm_flap_count" has already been modified (with
20144
 *     ovsrec_interface_set_cfm_flap_count()) within the current transaction.
20145
 *
20146
 * Because of the latter property, always call this function *before*
20147
 * ovsrec_interface_set_cfm_flap_count() for a given read-modify-write.
20148
 *
20149
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20150
void
20151
ovsrec_interface_verify_cfm_flap_count(const struct ovsrec_interface *row)
20152
0
{
20153
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_flap_count);
20154
0
}
20155
20156
/* Causes the original contents of column "cfm_health" in 'row' to be
20157
 * verified as a prerequisite to completing the transaction.  That is, if
20158
 * "cfm_health" in 'row' changed (or if 'row' was deleted) between the
20159
 * time that the IDL originally read its contents and the time that the
20160
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20161
 *
20162
 * The intention is that, to ensure that no transaction commits based on dirty
20163
 * reads, an application should call this function any time "cfm_health" is
20164
 * read as part of a read-modify-write operation.
20165
 *
20166
 * In some cases this function reduces to a no-op, because the current value
20167
 * of "cfm_health" is already known:
20168
 *
20169
 *   - If 'row' is a row created by the current transaction (returned by
20170
 *     ovsrec_interface_insert()).
20171
 *
20172
 *   - If "cfm_health" has already been modified (with
20173
 *     ovsrec_interface_set_cfm_health()) within the current transaction.
20174
 *
20175
 * Because of the latter property, always call this function *before*
20176
 * ovsrec_interface_set_cfm_health() for a given read-modify-write.
20177
 *
20178
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20179
void
20180
ovsrec_interface_verify_cfm_health(const struct ovsrec_interface *row)
20181
0
{
20182
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_health);
20183
0
}
20184
20185
/* Causes the original contents of column "cfm_mpid" in 'row' to be
20186
 * verified as a prerequisite to completing the transaction.  That is, if
20187
 * "cfm_mpid" in 'row' changed (or if 'row' was deleted) between the
20188
 * time that the IDL originally read its contents and the time that the
20189
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20190
 *
20191
 * The intention is that, to ensure that no transaction commits based on dirty
20192
 * reads, an application should call this function any time "cfm_mpid" is
20193
 * read as part of a read-modify-write operation.
20194
 *
20195
 * In some cases this function reduces to a no-op, because the current value
20196
 * of "cfm_mpid" is already known:
20197
 *
20198
 *   - If 'row' is a row created by the current transaction (returned by
20199
 *     ovsrec_interface_insert()).
20200
 *
20201
 *   - If "cfm_mpid" has already been modified (with
20202
 *     ovsrec_interface_set_cfm_mpid()) within the current transaction.
20203
 *
20204
 * Because of the latter property, always call this function *before*
20205
 * ovsrec_interface_set_cfm_mpid() for a given read-modify-write.
20206
 *
20207
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20208
void
20209
ovsrec_interface_verify_cfm_mpid(const struct ovsrec_interface *row)
20210
0
{
20211
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_mpid);
20212
0
}
20213
20214
/* Causes the original contents of column "cfm_remote_mpids" in 'row' to be
20215
 * verified as a prerequisite to completing the transaction.  That is, if
20216
 * "cfm_remote_mpids" in 'row' changed (or if 'row' was deleted) between the
20217
 * time that the IDL originally read its contents and the time that the
20218
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20219
 *
20220
 * The intention is that, to ensure that no transaction commits based on dirty
20221
 * reads, an application should call this function any time "cfm_remote_mpids" is
20222
 * read as part of a read-modify-write operation.
20223
 *
20224
 * In some cases this function reduces to a no-op, because the current value
20225
 * of "cfm_remote_mpids" is already known:
20226
 *
20227
 *   - If 'row' is a row created by the current transaction (returned by
20228
 *     ovsrec_interface_insert()).
20229
 *
20230
 *   - If "cfm_remote_mpids" has already been modified (with
20231
 *     ovsrec_interface_set_cfm_remote_mpids()) within the current transaction.
20232
 *
20233
 * Because of the latter property, always call this function *before*
20234
 * ovsrec_interface_set_cfm_remote_mpids() for a given read-modify-write.
20235
 *
20236
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20237
void
20238
ovsrec_interface_verify_cfm_remote_mpids(const struct ovsrec_interface *row)
20239
0
{
20240
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_remote_mpids);
20241
0
}
20242
20243
/* Causes the original contents of column "cfm_remote_opstate" in 'row' to be
20244
 * verified as a prerequisite to completing the transaction.  That is, if
20245
 * "cfm_remote_opstate" in 'row' changed (or if 'row' was deleted) between the
20246
 * time that the IDL originally read its contents and the time that the
20247
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20248
 *
20249
 * The intention is that, to ensure that no transaction commits based on dirty
20250
 * reads, an application should call this function any time "cfm_remote_opstate" is
20251
 * read as part of a read-modify-write operation.
20252
 *
20253
 * In some cases this function reduces to a no-op, because the current value
20254
 * of "cfm_remote_opstate" is already known:
20255
 *
20256
 *   - If 'row' is a row created by the current transaction (returned by
20257
 *     ovsrec_interface_insert()).
20258
 *
20259
 *   - If "cfm_remote_opstate" has already been modified (with
20260
 *     ovsrec_interface_set_cfm_remote_opstate()) within the current transaction.
20261
 *
20262
 * Because of the latter property, always call this function *before*
20263
 * ovsrec_interface_set_cfm_remote_opstate() for a given read-modify-write.
20264
 *
20265
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20266
void
20267
ovsrec_interface_verify_cfm_remote_opstate(const struct ovsrec_interface *row)
20268
0
{
20269
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_remote_opstate);
20270
0
}
20271
20272
/* Causes the original contents of column "duplex" in 'row' to be
20273
 * verified as a prerequisite to completing the transaction.  That is, if
20274
 * "duplex" in 'row' changed (or if 'row' was deleted) between the
20275
 * time that the IDL originally read its contents and the time that the
20276
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20277
 *
20278
 * The intention is that, to ensure that no transaction commits based on dirty
20279
 * reads, an application should call this function any time "duplex" is
20280
 * read as part of a read-modify-write operation.
20281
 *
20282
 * In some cases this function reduces to a no-op, because the current value
20283
 * of "duplex" is already known:
20284
 *
20285
 *   - If 'row' is a row created by the current transaction (returned by
20286
 *     ovsrec_interface_insert()).
20287
 *
20288
 *   - If "duplex" has already been modified (with
20289
 *     ovsrec_interface_set_duplex()) within the current transaction.
20290
 *
20291
 * Because of the latter property, always call this function *before*
20292
 * ovsrec_interface_set_duplex() for a given read-modify-write.
20293
 *
20294
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20295
void
20296
ovsrec_interface_verify_duplex(const struct ovsrec_interface *row)
20297
0
{
20298
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_duplex);
20299
0
}
20300
20301
/* Causes the original contents of column "error" in 'row' to be
20302
 * verified as a prerequisite to completing the transaction.  That is, if
20303
 * "error" in 'row' changed (or if 'row' was deleted) between the
20304
 * time that the IDL originally read its contents and the time that the
20305
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20306
 *
20307
 * The intention is that, to ensure that no transaction commits based on dirty
20308
 * reads, an application should call this function any time "error" is
20309
 * read as part of a read-modify-write operation.
20310
 *
20311
 * In some cases this function reduces to a no-op, because the current value
20312
 * of "error" is already known:
20313
 *
20314
 *   - If 'row' is a row created by the current transaction (returned by
20315
 *     ovsrec_interface_insert()).
20316
 *
20317
 *   - If "error" has already been modified (with
20318
 *     ovsrec_interface_set_error()) within the current transaction.
20319
 *
20320
 * Because of the latter property, always call this function *before*
20321
 * ovsrec_interface_set_error() for a given read-modify-write.
20322
 *
20323
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20324
void
20325
ovsrec_interface_verify_error(const struct ovsrec_interface *row)
20326
0
{
20327
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_error);
20328
0
}
20329
20330
/* Causes the original contents of column "external_ids" in 'row' to be
20331
 * verified as a prerequisite to completing the transaction.  That is, if
20332
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
20333
 * time that the IDL originally read its contents and the time that the
20334
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20335
 *
20336
 * The intention is that, to ensure that no transaction commits based on dirty
20337
 * reads, an application should call this function any time "external_ids" is
20338
 * read as part of a read-modify-write operation.
20339
 *
20340
 * In some cases this function reduces to a no-op, because the current value
20341
 * of "external_ids" is already known:
20342
 *
20343
 *   - If 'row' is a row created by the current transaction (returned by
20344
 *     ovsrec_interface_insert()).
20345
 *
20346
 *   - If "external_ids" has already been modified (with
20347
 *     ovsrec_interface_set_external_ids()) within the current transaction.
20348
 *
20349
 * Because of the latter property, always call this function *before*
20350
 * ovsrec_interface_set_external_ids() for a given read-modify-write.
20351
 *
20352
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20353
void
20354
ovsrec_interface_verify_external_ids(const struct ovsrec_interface *row)
20355
0
{
20356
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_external_ids);
20357
0
}
20358
20359
/* Causes the original contents of column "ifindex" in 'row' to be
20360
 * verified as a prerequisite to completing the transaction.  That is, if
20361
 * "ifindex" in 'row' changed (or if 'row' was deleted) between the
20362
 * time that the IDL originally read its contents and the time that the
20363
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20364
 *
20365
 * The intention is that, to ensure that no transaction commits based on dirty
20366
 * reads, an application should call this function any time "ifindex" is
20367
 * read as part of a read-modify-write operation.
20368
 *
20369
 * In some cases this function reduces to a no-op, because the current value
20370
 * of "ifindex" is already known:
20371
 *
20372
 *   - If 'row' is a row created by the current transaction (returned by
20373
 *     ovsrec_interface_insert()).
20374
 *
20375
 *   - If "ifindex" has already been modified (with
20376
 *     ovsrec_interface_set_ifindex()) within the current transaction.
20377
 *
20378
 * Because of the latter property, always call this function *before*
20379
 * ovsrec_interface_set_ifindex() for a given read-modify-write.
20380
 *
20381
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20382
void
20383
ovsrec_interface_verify_ifindex(const struct ovsrec_interface *row)
20384
0
{
20385
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ifindex);
20386
0
}
20387
20388
/* Causes the original contents of column "ingress_policing_burst" in 'row' to be
20389
 * verified as a prerequisite to completing the transaction.  That is, if
20390
 * "ingress_policing_burst" in 'row' changed (or if 'row' was deleted) between the
20391
 * time that the IDL originally read its contents and the time that the
20392
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20393
 *
20394
 * The intention is that, to ensure that no transaction commits based on dirty
20395
 * reads, an application should call this function any time "ingress_policing_burst" is
20396
 * read as part of a read-modify-write operation.
20397
 *
20398
 * In some cases this function reduces to a no-op, because the current value
20399
 * of "ingress_policing_burst" is already known:
20400
 *
20401
 *   - If 'row' is a row created by the current transaction (returned by
20402
 *     ovsrec_interface_insert()).
20403
 *
20404
 *   - If "ingress_policing_burst" has already been modified (with
20405
 *     ovsrec_interface_set_ingress_policing_burst()) within the current transaction.
20406
 *
20407
 * Because of the latter property, always call this function *before*
20408
 * ovsrec_interface_set_ingress_policing_burst() for a given read-modify-write.
20409
 *
20410
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20411
void
20412
ovsrec_interface_verify_ingress_policing_burst(const struct ovsrec_interface *row)
20413
0
{
20414
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ingress_policing_burst);
20415
0
}
20416
20417
/* Causes the original contents of column "ingress_policing_kpkts_burst" in 'row' to be
20418
 * verified as a prerequisite to completing the transaction.  That is, if
20419
 * "ingress_policing_kpkts_burst" in 'row' changed (or if 'row' was deleted) between the
20420
 * time that the IDL originally read its contents and the time that the
20421
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20422
 *
20423
 * The intention is that, to ensure that no transaction commits based on dirty
20424
 * reads, an application should call this function any time "ingress_policing_kpkts_burst" is
20425
 * read as part of a read-modify-write operation.
20426
 *
20427
 * In some cases this function reduces to a no-op, because the current value
20428
 * of "ingress_policing_kpkts_burst" is already known:
20429
 *
20430
 *   - If 'row' is a row created by the current transaction (returned by
20431
 *     ovsrec_interface_insert()).
20432
 *
20433
 *   - If "ingress_policing_kpkts_burst" has already been modified (with
20434
 *     ovsrec_interface_set_ingress_policing_kpkts_burst()) within the current transaction.
20435
 *
20436
 * Because of the latter property, always call this function *before*
20437
 * ovsrec_interface_set_ingress_policing_kpkts_burst() for a given read-modify-write.
20438
 *
20439
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20440
void
20441
ovsrec_interface_verify_ingress_policing_kpkts_burst(const struct ovsrec_interface *row)
20442
0
{
20443
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_burst);
20444
0
}
20445
20446
/* Causes the original contents of column "ingress_policing_kpkts_rate" in 'row' to be
20447
 * verified as a prerequisite to completing the transaction.  That is, if
20448
 * "ingress_policing_kpkts_rate" in 'row' changed (or if 'row' was deleted) between the
20449
 * time that the IDL originally read its contents and the time that the
20450
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20451
 *
20452
 * The intention is that, to ensure that no transaction commits based on dirty
20453
 * reads, an application should call this function any time "ingress_policing_kpkts_rate" is
20454
 * read as part of a read-modify-write operation.
20455
 *
20456
 * In some cases this function reduces to a no-op, because the current value
20457
 * of "ingress_policing_kpkts_rate" is already known:
20458
 *
20459
 *   - If 'row' is a row created by the current transaction (returned by
20460
 *     ovsrec_interface_insert()).
20461
 *
20462
 *   - If "ingress_policing_kpkts_rate" has already been modified (with
20463
 *     ovsrec_interface_set_ingress_policing_kpkts_rate()) within the current transaction.
20464
 *
20465
 * Because of the latter property, always call this function *before*
20466
 * ovsrec_interface_set_ingress_policing_kpkts_rate() for a given read-modify-write.
20467
 *
20468
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20469
void
20470
ovsrec_interface_verify_ingress_policing_kpkts_rate(const struct ovsrec_interface *row)
20471
0
{
20472
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_rate);
20473
0
}
20474
20475
/* Causes the original contents of column "ingress_policing_rate" in 'row' to be
20476
 * verified as a prerequisite to completing the transaction.  That is, if
20477
 * "ingress_policing_rate" in 'row' changed (or if 'row' was deleted) between the
20478
 * time that the IDL originally read its contents and the time that the
20479
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20480
 *
20481
 * The intention is that, to ensure that no transaction commits based on dirty
20482
 * reads, an application should call this function any time "ingress_policing_rate" is
20483
 * read as part of a read-modify-write operation.
20484
 *
20485
 * In some cases this function reduces to a no-op, because the current value
20486
 * of "ingress_policing_rate" is already known:
20487
 *
20488
 *   - If 'row' is a row created by the current transaction (returned by
20489
 *     ovsrec_interface_insert()).
20490
 *
20491
 *   - If "ingress_policing_rate" has already been modified (with
20492
 *     ovsrec_interface_set_ingress_policing_rate()) within the current transaction.
20493
 *
20494
 * Because of the latter property, always call this function *before*
20495
 * ovsrec_interface_set_ingress_policing_rate() for a given read-modify-write.
20496
 *
20497
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20498
void
20499
ovsrec_interface_verify_ingress_policing_rate(const struct ovsrec_interface *row)
20500
0
{
20501
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ingress_policing_rate);
20502
0
}
20503
20504
/* Causes the original contents of column "lacp_current" in 'row' to be
20505
 * verified as a prerequisite to completing the transaction.  That is, if
20506
 * "lacp_current" in 'row' changed (or if 'row' was deleted) between the
20507
 * time that the IDL originally read its contents and the time that the
20508
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20509
 *
20510
 * The intention is that, to ensure that no transaction commits based on dirty
20511
 * reads, an application should call this function any time "lacp_current" is
20512
 * read as part of a read-modify-write operation.
20513
 *
20514
 * In some cases this function reduces to a no-op, because the current value
20515
 * of "lacp_current" is already known:
20516
 *
20517
 *   - If 'row' is a row created by the current transaction (returned by
20518
 *     ovsrec_interface_insert()).
20519
 *
20520
 *   - If "lacp_current" has already been modified (with
20521
 *     ovsrec_interface_set_lacp_current()) within the current transaction.
20522
 *
20523
 * Because of the latter property, always call this function *before*
20524
 * ovsrec_interface_set_lacp_current() for a given read-modify-write.
20525
 *
20526
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20527
void
20528
ovsrec_interface_verify_lacp_current(const struct ovsrec_interface *row)
20529
0
{
20530
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_lacp_current);
20531
0
}
20532
20533
/* Causes the original contents of column "link_resets" in 'row' to be
20534
 * verified as a prerequisite to completing the transaction.  That is, if
20535
 * "link_resets" in 'row' changed (or if 'row' was deleted) between the
20536
 * time that the IDL originally read its contents and the time that the
20537
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20538
 *
20539
 * The intention is that, to ensure that no transaction commits based on dirty
20540
 * reads, an application should call this function any time "link_resets" is
20541
 * read as part of a read-modify-write operation.
20542
 *
20543
 * In some cases this function reduces to a no-op, because the current value
20544
 * of "link_resets" is already known:
20545
 *
20546
 *   - If 'row' is a row created by the current transaction (returned by
20547
 *     ovsrec_interface_insert()).
20548
 *
20549
 *   - If "link_resets" has already been modified (with
20550
 *     ovsrec_interface_set_link_resets()) within the current transaction.
20551
 *
20552
 * Because of the latter property, always call this function *before*
20553
 * ovsrec_interface_set_link_resets() for a given read-modify-write.
20554
 *
20555
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20556
void
20557
ovsrec_interface_verify_link_resets(const struct ovsrec_interface *row)
20558
0
{
20559
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_link_resets);
20560
0
}
20561
20562
/* Causes the original contents of column "link_speed" in 'row' to be
20563
 * verified as a prerequisite to completing the transaction.  That is, if
20564
 * "link_speed" in 'row' changed (or if 'row' was deleted) between the
20565
 * time that the IDL originally read its contents and the time that the
20566
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20567
 *
20568
 * The intention is that, to ensure that no transaction commits based on dirty
20569
 * reads, an application should call this function any time "link_speed" is
20570
 * read as part of a read-modify-write operation.
20571
 *
20572
 * In some cases this function reduces to a no-op, because the current value
20573
 * of "link_speed" is already known:
20574
 *
20575
 *   - If 'row' is a row created by the current transaction (returned by
20576
 *     ovsrec_interface_insert()).
20577
 *
20578
 *   - If "link_speed" has already been modified (with
20579
 *     ovsrec_interface_set_link_speed()) within the current transaction.
20580
 *
20581
 * Because of the latter property, always call this function *before*
20582
 * ovsrec_interface_set_link_speed() for a given read-modify-write.
20583
 *
20584
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20585
void
20586
ovsrec_interface_verify_link_speed(const struct ovsrec_interface *row)
20587
0
{
20588
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_link_speed);
20589
0
}
20590
20591
/* Causes the original contents of column "link_state" in 'row' to be
20592
 * verified as a prerequisite to completing the transaction.  That is, if
20593
 * "link_state" in 'row' changed (or if 'row' was deleted) between the
20594
 * time that the IDL originally read its contents and the time that the
20595
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20596
 *
20597
 * The intention is that, to ensure that no transaction commits based on dirty
20598
 * reads, an application should call this function any time "link_state" is
20599
 * read as part of a read-modify-write operation.
20600
 *
20601
 * In some cases this function reduces to a no-op, because the current value
20602
 * of "link_state" is already known:
20603
 *
20604
 *   - If 'row' is a row created by the current transaction (returned by
20605
 *     ovsrec_interface_insert()).
20606
 *
20607
 *   - If "link_state" has already been modified (with
20608
 *     ovsrec_interface_set_link_state()) within the current transaction.
20609
 *
20610
 * Because of the latter property, always call this function *before*
20611
 * ovsrec_interface_set_link_state() for a given read-modify-write.
20612
 *
20613
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20614
void
20615
ovsrec_interface_verify_link_state(const struct ovsrec_interface *row)
20616
0
{
20617
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_link_state);
20618
0
}
20619
20620
/* Causes the original contents of column "lldp" in 'row' to be
20621
 * verified as a prerequisite to completing the transaction.  That is, if
20622
 * "lldp" in 'row' changed (or if 'row' was deleted) between the
20623
 * time that the IDL originally read its contents and the time that the
20624
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20625
 *
20626
 * The intention is that, to ensure that no transaction commits based on dirty
20627
 * reads, an application should call this function any time "lldp" is
20628
 * read as part of a read-modify-write operation.
20629
 *
20630
 * In some cases this function reduces to a no-op, because the current value
20631
 * of "lldp" is already known:
20632
 *
20633
 *   - If 'row' is a row created by the current transaction (returned by
20634
 *     ovsrec_interface_insert()).
20635
 *
20636
 *   - If "lldp" has already been modified (with
20637
 *     ovsrec_interface_set_lldp()) within the current transaction.
20638
 *
20639
 * Because of the latter property, always call this function *before*
20640
 * ovsrec_interface_set_lldp() for a given read-modify-write.
20641
 *
20642
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20643
void
20644
ovsrec_interface_verify_lldp(const struct ovsrec_interface *row)
20645
0
{
20646
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_lldp);
20647
0
}
20648
20649
/* Causes the original contents of column "mac" in 'row' to be
20650
 * verified as a prerequisite to completing the transaction.  That is, if
20651
 * "mac" in 'row' changed (or if 'row' was deleted) between the
20652
 * time that the IDL originally read its contents and the time that the
20653
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20654
 *
20655
 * The intention is that, to ensure that no transaction commits based on dirty
20656
 * reads, an application should call this function any time "mac" is
20657
 * read as part of a read-modify-write operation.
20658
 *
20659
 * In some cases this function reduces to a no-op, because the current value
20660
 * of "mac" is already known:
20661
 *
20662
 *   - If 'row' is a row created by the current transaction (returned by
20663
 *     ovsrec_interface_insert()).
20664
 *
20665
 *   - If "mac" has already been modified (with
20666
 *     ovsrec_interface_set_mac()) within the current transaction.
20667
 *
20668
 * Because of the latter property, always call this function *before*
20669
 * ovsrec_interface_set_mac() for a given read-modify-write.
20670
 *
20671
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20672
void
20673
ovsrec_interface_verify_mac(const struct ovsrec_interface *row)
20674
0
{
20675
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_mac);
20676
0
}
20677
20678
/* Causes the original contents of column "mac_in_use" in 'row' to be
20679
 * verified as a prerequisite to completing the transaction.  That is, if
20680
 * "mac_in_use" in 'row' changed (or if 'row' was deleted) between the
20681
 * time that the IDL originally read its contents and the time that the
20682
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20683
 *
20684
 * The intention is that, to ensure that no transaction commits based on dirty
20685
 * reads, an application should call this function any time "mac_in_use" is
20686
 * read as part of a read-modify-write operation.
20687
 *
20688
 * In some cases this function reduces to a no-op, because the current value
20689
 * of "mac_in_use" is already known:
20690
 *
20691
 *   - If 'row' is a row created by the current transaction (returned by
20692
 *     ovsrec_interface_insert()).
20693
 *
20694
 *   - If "mac_in_use" has already been modified (with
20695
 *     ovsrec_interface_set_mac_in_use()) within the current transaction.
20696
 *
20697
 * Because of the latter property, always call this function *before*
20698
 * ovsrec_interface_set_mac_in_use() for a given read-modify-write.
20699
 *
20700
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20701
void
20702
ovsrec_interface_verify_mac_in_use(const struct ovsrec_interface *row)
20703
0
{
20704
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_mac_in_use);
20705
0
}
20706
20707
/* Causes the original contents of column "mtu" in 'row' to be
20708
 * verified as a prerequisite to completing the transaction.  That is, if
20709
 * "mtu" in 'row' changed (or if 'row' was deleted) between the
20710
 * time that the IDL originally read its contents and the time that the
20711
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20712
 *
20713
 * The intention is that, to ensure that no transaction commits based on dirty
20714
 * reads, an application should call this function any time "mtu" is
20715
 * read as part of a read-modify-write operation.
20716
 *
20717
 * In some cases this function reduces to a no-op, because the current value
20718
 * of "mtu" is already known:
20719
 *
20720
 *   - If 'row' is a row created by the current transaction (returned by
20721
 *     ovsrec_interface_insert()).
20722
 *
20723
 *   - If "mtu" has already been modified (with
20724
 *     ovsrec_interface_set_mtu()) within the current transaction.
20725
 *
20726
 * Because of the latter property, always call this function *before*
20727
 * ovsrec_interface_set_mtu() for a given read-modify-write.
20728
 *
20729
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20730
void
20731
ovsrec_interface_verify_mtu(const struct ovsrec_interface *row)
20732
0
{
20733
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_mtu);
20734
0
}
20735
20736
/* Causes the original contents of column "mtu_request" in 'row' to be
20737
 * verified as a prerequisite to completing the transaction.  That is, if
20738
 * "mtu_request" in 'row' changed (or if 'row' was deleted) between the
20739
 * time that the IDL originally read its contents and the time that the
20740
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20741
 *
20742
 * The intention is that, to ensure that no transaction commits based on dirty
20743
 * reads, an application should call this function any time "mtu_request" is
20744
 * read as part of a read-modify-write operation.
20745
 *
20746
 * In some cases this function reduces to a no-op, because the current value
20747
 * of "mtu_request" is already known:
20748
 *
20749
 *   - If 'row' is a row created by the current transaction (returned by
20750
 *     ovsrec_interface_insert()).
20751
 *
20752
 *   - If "mtu_request" has already been modified (with
20753
 *     ovsrec_interface_set_mtu_request()) within the current transaction.
20754
 *
20755
 * Because of the latter property, always call this function *before*
20756
 * ovsrec_interface_set_mtu_request() for a given read-modify-write.
20757
 *
20758
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20759
void
20760
ovsrec_interface_verify_mtu_request(const struct ovsrec_interface *row)
20761
0
{
20762
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_mtu_request);
20763
0
}
20764
20765
/* Causes the original contents of column "name" in 'row' to be
20766
 * verified as a prerequisite to completing the transaction.  That is, if
20767
 * "name" in 'row' changed (or if 'row' was deleted) between the
20768
 * time that the IDL originally read its contents and the time that the
20769
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20770
 *
20771
 * The intention is that, to ensure that no transaction commits based on dirty
20772
 * reads, an application should call this function any time "name" is
20773
 * read as part of a read-modify-write operation.
20774
 *
20775
 * In some cases this function reduces to a no-op, because the current value
20776
 * of "name" is already known:
20777
 *
20778
 *   - If 'row' is a row created by the current transaction (returned by
20779
 *     ovsrec_interface_insert()).
20780
 *
20781
 *   - If "name" has already been modified (with
20782
 *     ovsrec_interface_set_name()) within the current transaction.
20783
 *
20784
 * Because of the latter property, always call this function *before*
20785
 * ovsrec_interface_set_name() for a given read-modify-write.
20786
 *
20787
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20788
void
20789
ovsrec_interface_verify_name(const struct ovsrec_interface *row)
20790
0
{
20791
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_name);
20792
0
}
20793
20794
/* Causes the original contents of column "ofport" in 'row' to be
20795
 * verified as a prerequisite to completing the transaction.  That is, if
20796
 * "ofport" in 'row' changed (or if 'row' was deleted) between the
20797
 * time that the IDL originally read its contents and the time that the
20798
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20799
 *
20800
 * The intention is that, to ensure that no transaction commits based on dirty
20801
 * reads, an application should call this function any time "ofport" is
20802
 * read as part of a read-modify-write operation.
20803
 *
20804
 * In some cases this function reduces to a no-op, because the current value
20805
 * of "ofport" is already known:
20806
 *
20807
 *   - If 'row' is a row created by the current transaction (returned by
20808
 *     ovsrec_interface_insert()).
20809
 *
20810
 *   - If "ofport" has already been modified (with
20811
 *     ovsrec_interface_set_ofport()) within the current transaction.
20812
 *
20813
 * Because of the latter property, always call this function *before*
20814
 * ovsrec_interface_set_ofport() for a given read-modify-write.
20815
 *
20816
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20817
void
20818
ovsrec_interface_verify_ofport(const struct ovsrec_interface *row)
20819
0
{
20820
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ofport);
20821
0
}
20822
20823
/* Causes the original contents of column "ofport_request" in 'row' to be
20824
 * verified as a prerequisite to completing the transaction.  That is, if
20825
 * "ofport_request" in 'row' changed (or if 'row' was deleted) between the
20826
 * time that the IDL originally read its contents and the time that the
20827
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20828
 *
20829
 * The intention is that, to ensure that no transaction commits based on dirty
20830
 * reads, an application should call this function any time "ofport_request" is
20831
 * read as part of a read-modify-write operation.
20832
 *
20833
 * In some cases this function reduces to a no-op, because the current value
20834
 * of "ofport_request" is already known:
20835
 *
20836
 *   - If 'row' is a row created by the current transaction (returned by
20837
 *     ovsrec_interface_insert()).
20838
 *
20839
 *   - If "ofport_request" has already been modified (with
20840
 *     ovsrec_interface_set_ofport_request()) within the current transaction.
20841
 *
20842
 * Because of the latter property, always call this function *before*
20843
 * ovsrec_interface_set_ofport_request() for a given read-modify-write.
20844
 *
20845
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20846
void
20847
ovsrec_interface_verify_ofport_request(const struct ovsrec_interface *row)
20848
0
{
20849
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ofport_request);
20850
0
}
20851
20852
/* Causes the original contents of column "options" in 'row' to be
20853
 * verified as a prerequisite to completing the transaction.  That is, if
20854
 * "options" in 'row' changed (or if 'row' was deleted) between the
20855
 * time that the IDL originally read its contents and the time that the
20856
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20857
 *
20858
 * The intention is that, to ensure that no transaction commits based on dirty
20859
 * reads, an application should call this function any time "options" is
20860
 * read as part of a read-modify-write operation.
20861
 *
20862
 * In some cases this function reduces to a no-op, because the current value
20863
 * of "options" is already known:
20864
 *
20865
 *   - If 'row' is a row created by the current transaction (returned by
20866
 *     ovsrec_interface_insert()).
20867
 *
20868
 *   - If "options" has already been modified (with
20869
 *     ovsrec_interface_set_options()) within the current transaction.
20870
 *
20871
 * Because of the latter property, always call this function *before*
20872
 * ovsrec_interface_set_options() for a given read-modify-write.
20873
 *
20874
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20875
void
20876
ovsrec_interface_verify_options(const struct ovsrec_interface *row)
20877
0
{
20878
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_options);
20879
0
}
20880
20881
/* Causes the original contents of column "other_config" in 'row' to be
20882
 * verified as a prerequisite to completing the transaction.  That is, if
20883
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
20884
 * time that the IDL originally read its contents and the time that the
20885
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20886
 *
20887
 * The intention is that, to ensure that no transaction commits based on dirty
20888
 * reads, an application should call this function any time "other_config" is
20889
 * read as part of a read-modify-write operation.
20890
 *
20891
 * In some cases this function reduces to a no-op, because the current value
20892
 * of "other_config" is already known:
20893
 *
20894
 *   - If 'row' is a row created by the current transaction (returned by
20895
 *     ovsrec_interface_insert()).
20896
 *
20897
 *   - If "other_config" has already been modified (with
20898
 *     ovsrec_interface_set_other_config()) within the current transaction.
20899
 *
20900
 * Because of the latter property, always call this function *before*
20901
 * ovsrec_interface_set_other_config() for a given read-modify-write.
20902
 *
20903
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20904
void
20905
ovsrec_interface_verify_other_config(const struct ovsrec_interface *row)
20906
0
{
20907
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_other_config);
20908
0
}
20909
20910
/* Causes the original contents of column "statistics" in 'row' to be
20911
 * verified as a prerequisite to completing the transaction.  That is, if
20912
 * "statistics" in 'row' changed (or if 'row' was deleted) between the
20913
 * time that the IDL originally read its contents and the time that the
20914
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20915
 *
20916
 * The intention is that, to ensure that no transaction commits based on dirty
20917
 * reads, an application should call this function any time "statistics" is
20918
 * read as part of a read-modify-write operation.
20919
 *
20920
 * In some cases this function reduces to a no-op, because the current value
20921
 * of "statistics" is already known:
20922
 *
20923
 *   - If 'row' is a row created by the current transaction (returned by
20924
 *     ovsrec_interface_insert()).
20925
 *
20926
 *   - If "statistics" has already been modified (with
20927
 *     ovsrec_interface_set_statistics()) within the current transaction.
20928
 *
20929
 * Because of the latter property, always call this function *before*
20930
 * ovsrec_interface_set_statistics() for a given read-modify-write.
20931
 *
20932
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20933
void
20934
ovsrec_interface_verify_statistics(const struct ovsrec_interface *row)
20935
0
{
20936
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_statistics);
20937
0
}
20938
20939
/* Causes the original contents of column "status" in 'row' to be
20940
 * verified as a prerequisite to completing the transaction.  That is, if
20941
 * "status" in 'row' changed (or if 'row' was deleted) between the
20942
 * time that the IDL originally read its contents and the time that the
20943
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20944
 *
20945
 * The intention is that, to ensure that no transaction commits based on dirty
20946
 * reads, an application should call this function any time "status" is
20947
 * read as part of a read-modify-write operation.
20948
 *
20949
 * In some cases this function reduces to a no-op, because the current value
20950
 * of "status" is already known:
20951
 *
20952
 *   - If 'row' is a row created by the current transaction (returned by
20953
 *     ovsrec_interface_insert()).
20954
 *
20955
 *   - If "status" has already been modified (with
20956
 *     ovsrec_interface_set_status()) within the current transaction.
20957
 *
20958
 * Because of the latter property, always call this function *before*
20959
 * ovsrec_interface_set_status() for a given read-modify-write.
20960
 *
20961
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20962
void
20963
ovsrec_interface_verify_status(const struct ovsrec_interface *row)
20964
0
{
20965
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_status);
20966
0
}
20967
20968
/* Causes the original contents of column "type" in 'row' to be
20969
 * verified as a prerequisite to completing the transaction.  That is, if
20970
 * "type" in 'row' changed (or if 'row' was deleted) between the
20971
 * time that the IDL originally read its contents and the time that the
20972
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
20973
 *
20974
 * The intention is that, to ensure that no transaction commits based on dirty
20975
 * reads, an application should call this function any time "type" is
20976
 * read as part of a read-modify-write operation.
20977
 *
20978
 * In some cases this function reduces to a no-op, because the current value
20979
 * of "type" is already known:
20980
 *
20981
 *   - If 'row' is a row created by the current transaction (returned by
20982
 *     ovsrec_interface_insert()).
20983
 *
20984
 *   - If "type" has already been modified (with
20985
 *     ovsrec_interface_set_type()) within the current transaction.
20986
 *
20987
 * Because of the latter property, always call this function *before*
20988
 * ovsrec_interface_set_type() for a given read-modify-write.
20989
 *
20990
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
20991
void
20992
ovsrec_interface_verify_type(const struct ovsrec_interface *row)
20993
0
{
20994
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_type);
20995
0
}
20996
20997
/* Returns the "admin_state" column's value from the "Interface" table in 'row'
20998
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20999
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21000
 * for a given key than implementing the same operation on the "cooked"
21001
 * form in 'row'.
21002
 *
21003
 * 'key_type' must be OVSDB_TYPE_STRING.
21004
 * (This helps to avoid silent bugs if someone changes admin_state's
21005
 * type without updating the caller.)
21006
 *
21007
 * The caller must not modify or free the returned value.
21008
 *
21009
 * Various kinds of changes can invalidate the returned value: modifying
21010
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21011
 * If the returned value is needed for a long time, it is best to make a copy
21012
 * of it with ovsdb_datum_clone().
21013
 *
21014
 * This function is rarely useful, since it is easier to access the value
21015
 * directly through the "admin_state" member in ovsrec_interface. */
21016
const struct ovsdb_datum *
21017
ovsrec_interface_get_admin_state(const struct ovsrec_interface *row,
21018
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21019
0
{
21020
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21021
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_admin_state);
21022
0
}
21023
21024
/* Returns the "bfd" column's value from the "Interface" table in 'row'
21025
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21026
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21027
 * for a given key than implementing the same operation on the "cooked"
21028
 * form in 'row'.
21029
 *
21030
 * 'key_type' must be OVSDB_TYPE_STRING.
21031
 * 'value_type' must be OVSDB_TYPE_STRING.
21032
 * (This helps to avoid silent bugs if someone changes bfd's
21033
 * type without updating the caller.)
21034
 *
21035
 * The caller must not modify or free the returned value.
21036
 *
21037
 * Various kinds of changes can invalidate the returned value: modifying
21038
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21039
 * If the returned value is needed for a long time, it is best to make a copy
21040
 * of it with ovsdb_datum_clone().
21041
 *
21042
 * This function is rarely useful, since it is easier to access the value
21043
 * directly through the "bfd" member in ovsrec_interface. */
21044
const struct ovsdb_datum *
21045
ovsrec_interface_get_bfd(const struct ovsrec_interface *row,
21046
  enum ovsdb_atomic_type key_type OVS_UNUSED,
21047
  enum ovsdb_atomic_type value_type OVS_UNUSED)
21048
0
{
21049
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21050
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
21051
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_bfd);
21052
0
}
21053
21054
/* Returns the "bfd_status" column's value from the "Interface" table in 'row'
21055
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21056
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21057
 * for a given key than implementing the same operation on the "cooked"
21058
 * form in 'row'.
21059
 *
21060
 * 'key_type' must be OVSDB_TYPE_STRING.
21061
 * 'value_type' must be OVSDB_TYPE_STRING.
21062
 * (This helps to avoid silent bugs if someone changes bfd_status's
21063
 * type without updating the caller.)
21064
 *
21065
 * The caller must not modify or free the returned value.
21066
 *
21067
 * Various kinds of changes can invalidate the returned value: modifying
21068
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21069
 * If the returned value is needed for a long time, it is best to make a copy
21070
 * of it with ovsdb_datum_clone().
21071
 *
21072
 * This function is rarely useful, since it is easier to access the value
21073
 * directly through the "bfd_status" member in ovsrec_interface. */
21074
const struct ovsdb_datum *
21075
ovsrec_interface_get_bfd_status(const struct ovsrec_interface *row,
21076
  enum ovsdb_atomic_type key_type OVS_UNUSED,
21077
  enum ovsdb_atomic_type value_type OVS_UNUSED)
21078
0
{
21079
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21080
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
21081
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_bfd_status);
21082
0
}
21083
21084
/* Returns the "cfm_fault" column's value from the "Interface" table in 'row'
21085
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21086
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21087
 * for a given key than implementing the same operation on the "cooked"
21088
 * form in 'row'.
21089
 *
21090
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
21091
 * (This helps to avoid silent bugs if someone changes cfm_fault's
21092
 * type without updating the caller.)
21093
 *
21094
 * The caller must not modify or free the returned value.
21095
 *
21096
 * Various kinds of changes can invalidate the returned value: modifying
21097
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21098
 * If the returned value is needed for a long time, it is best to make a copy
21099
 * of it with ovsdb_datum_clone().
21100
 *
21101
 * This function is rarely useful, since it is easier to access the value
21102
 * directly through the "cfm_fault" member in ovsrec_interface. */
21103
const struct ovsdb_datum *
21104
ovsrec_interface_get_cfm_fault(const struct ovsrec_interface *row,
21105
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21106
0
{
21107
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
21108
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_fault);
21109
0
}
21110
21111
/* Returns the "cfm_fault_status" column's value from the "Interface" table in 'row'
21112
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21113
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21114
 * for a given key than implementing the same operation on the "cooked"
21115
 * form in 'row'.
21116
 *
21117
 * 'key_type' must be OVSDB_TYPE_STRING.
21118
 * (This helps to avoid silent bugs if someone changes cfm_fault_status's
21119
 * type without updating the caller.)
21120
 *
21121
 * The caller must not modify or free the returned value.
21122
 *
21123
 * Various kinds of changes can invalidate the returned value: modifying
21124
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21125
 * If the returned value is needed for a long time, it is best to make a copy
21126
 * of it with ovsdb_datum_clone().
21127
 *
21128
 * This function is rarely useful, since it is easier to access the value
21129
 * directly through the "cfm_fault_status" member in ovsrec_interface. */
21130
const struct ovsdb_datum *
21131
ovsrec_interface_get_cfm_fault_status(const struct ovsrec_interface *row,
21132
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21133
0
{
21134
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21135
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_fault_status);
21136
0
}
21137
21138
/* Returns the "cfm_flap_count" column's value from the "Interface" table in 'row'
21139
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21140
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21141
 * for a given key than implementing the same operation on the "cooked"
21142
 * form in 'row'.
21143
 *
21144
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21145
 * (This helps to avoid silent bugs if someone changes cfm_flap_count's
21146
 * type without updating the caller.)
21147
 *
21148
 * The caller must not modify or free the returned value.
21149
 *
21150
 * Various kinds of changes can invalidate the returned value: modifying
21151
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21152
 * If the returned value is needed for a long time, it is best to make a copy
21153
 * of it with ovsdb_datum_clone().
21154
 *
21155
 * This function is rarely useful, since it is easier to access the value
21156
 * directly through the "cfm_flap_count" member in ovsrec_interface. */
21157
const struct ovsdb_datum *
21158
ovsrec_interface_get_cfm_flap_count(const struct ovsrec_interface *row,
21159
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21160
0
{
21161
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21162
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_flap_count);
21163
0
}
21164
21165
/* Returns the "cfm_health" column's value from the "Interface" table in 'row'
21166
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21167
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21168
 * for a given key than implementing the same operation on the "cooked"
21169
 * form in 'row'.
21170
 *
21171
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21172
 * (This helps to avoid silent bugs if someone changes cfm_health's
21173
 * type without updating the caller.)
21174
 *
21175
 * The caller must not modify or free the returned value.
21176
 *
21177
 * Various kinds of changes can invalidate the returned value: modifying
21178
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21179
 * If the returned value is needed for a long time, it is best to make a copy
21180
 * of it with ovsdb_datum_clone().
21181
 *
21182
 * This function is rarely useful, since it is easier to access the value
21183
 * directly through the "cfm_health" member in ovsrec_interface. */
21184
const struct ovsdb_datum *
21185
ovsrec_interface_get_cfm_health(const struct ovsrec_interface *row,
21186
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21187
0
{
21188
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21189
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_health);
21190
0
}
21191
21192
/* Returns the "cfm_mpid" column's value from the "Interface" table in 'row'
21193
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21194
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21195
 * for a given key than implementing the same operation on the "cooked"
21196
 * form in 'row'.
21197
 *
21198
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21199
 * (This helps to avoid silent bugs if someone changes cfm_mpid's
21200
 * type without updating the caller.)
21201
 *
21202
 * The caller must not modify or free the returned value.
21203
 *
21204
 * Various kinds of changes can invalidate the returned value: modifying
21205
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21206
 * If the returned value is needed for a long time, it is best to make a copy
21207
 * of it with ovsdb_datum_clone().
21208
 *
21209
 * This function is rarely useful, since it is easier to access the value
21210
 * directly through the "cfm_mpid" member in ovsrec_interface. */
21211
const struct ovsdb_datum *
21212
ovsrec_interface_get_cfm_mpid(const struct ovsrec_interface *row,
21213
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21214
0
{
21215
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21216
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_mpid);
21217
0
}
21218
21219
/* Returns the "cfm_remote_mpids" column's value from the "Interface" table in 'row'
21220
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21221
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21222
 * for a given key than implementing the same operation on the "cooked"
21223
 * form in 'row'.
21224
 *
21225
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21226
 * (This helps to avoid silent bugs if someone changes cfm_remote_mpids's
21227
 * type without updating the caller.)
21228
 *
21229
 * The caller must not modify or free the returned value.
21230
 *
21231
 * Various kinds of changes can invalidate the returned value: modifying
21232
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21233
 * If the returned value is needed for a long time, it is best to make a copy
21234
 * of it with ovsdb_datum_clone().
21235
 *
21236
 * This function is rarely useful, since it is easier to access the value
21237
 * directly through the "cfm_remote_mpids" member in ovsrec_interface. */
21238
const struct ovsdb_datum *
21239
ovsrec_interface_get_cfm_remote_mpids(const struct ovsrec_interface *row,
21240
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21241
0
{
21242
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21243
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_remote_mpids);
21244
0
}
21245
21246
/* Returns the "cfm_remote_opstate" column's value from the "Interface" table in 'row'
21247
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21248
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21249
 * for a given key than implementing the same operation on the "cooked"
21250
 * form in 'row'.
21251
 *
21252
 * 'key_type' must be OVSDB_TYPE_STRING.
21253
 * (This helps to avoid silent bugs if someone changes cfm_remote_opstate's
21254
 * type without updating the caller.)
21255
 *
21256
 * The caller must not modify or free the returned value.
21257
 *
21258
 * Various kinds of changes can invalidate the returned value: modifying
21259
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21260
 * If the returned value is needed for a long time, it is best to make a copy
21261
 * of it with ovsdb_datum_clone().
21262
 *
21263
 * This function is rarely useful, since it is easier to access the value
21264
 * directly through the "cfm_remote_opstate" member in ovsrec_interface. */
21265
const struct ovsdb_datum *
21266
ovsrec_interface_get_cfm_remote_opstate(const struct ovsrec_interface *row,
21267
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21268
0
{
21269
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21270
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_remote_opstate);
21271
0
}
21272
21273
/* Returns the "duplex" column's value from the "Interface" table in 'row'
21274
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21275
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21276
 * for a given key than implementing the same operation on the "cooked"
21277
 * form in 'row'.
21278
 *
21279
 * 'key_type' must be OVSDB_TYPE_STRING.
21280
 * (This helps to avoid silent bugs if someone changes duplex's
21281
 * type without updating the caller.)
21282
 *
21283
 * The caller must not modify or free the returned value.
21284
 *
21285
 * Various kinds of changes can invalidate the returned value: modifying
21286
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21287
 * If the returned value is needed for a long time, it is best to make a copy
21288
 * of it with ovsdb_datum_clone().
21289
 *
21290
 * This function is rarely useful, since it is easier to access the value
21291
 * directly through the "duplex" member in ovsrec_interface. */
21292
const struct ovsdb_datum *
21293
ovsrec_interface_get_duplex(const struct ovsrec_interface *row,
21294
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21295
0
{
21296
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21297
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_duplex);
21298
0
}
21299
21300
/* Returns the "error" column's value from the "Interface" table in 'row'
21301
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21302
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21303
 * for a given key than implementing the same operation on the "cooked"
21304
 * form in 'row'.
21305
 *
21306
 * 'key_type' must be OVSDB_TYPE_STRING.
21307
 * (This helps to avoid silent bugs if someone changes error's
21308
 * type without updating the caller.)
21309
 *
21310
 * The caller must not modify or free the returned value.
21311
 *
21312
 * Various kinds of changes can invalidate the returned value: modifying
21313
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21314
 * If the returned value is needed for a long time, it is best to make a copy
21315
 * of it with ovsdb_datum_clone().
21316
 *
21317
 * This function is rarely useful, since it is easier to access the value
21318
 * directly through the "error" member in ovsrec_interface. */
21319
const struct ovsdb_datum *
21320
ovsrec_interface_get_error(const struct ovsrec_interface *row,
21321
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21322
0
{
21323
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21324
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_error);
21325
0
}
21326
21327
/* Returns the "external_ids" column's value from the "Interface" table in 'row'
21328
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21329
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21330
 * for a given key than implementing the same operation on the "cooked"
21331
 * form in 'row'.
21332
 *
21333
 * 'key_type' must be OVSDB_TYPE_STRING.
21334
 * 'value_type' must be OVSDB_TYPE_STRING.
21335
 * (This helps to avoid silent bugs if someone changes external_ids's
21336
 * type without updating the caller.)
21337
 *
21338
 * The caller must not modify or free the returned value.
21339
 *
21340
 * Various kinds of changes can invalidate the returned value: modifying
21341
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21342
 * If the returned value is needed for a long time, it is best to make a copy
21343
 * of it with ovsdb_datum_clone().
21344
 *
21345
 * This function is rarely useful, since it is easier to access the value
21346
 * directly through the "external_ids" member in ovsrec_interface. */
21347
const struct ovsdb_datum *
21348
ovsrec_interface_get_external_ids(const struct ovsrec_interface *row,
21349
  enum ovsdb_atomic_type key_type OVS_UNUSED,
21350
  enum ovsdb_atomic_type value_type OVS_UNUSED)
21351
0
{
21352
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21353
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
21354
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_external_ids);
21355
0
}
21356
21357
/* Returns the "ifindex" column's value from the "Interface" table in 'row'
21358
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21359
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21360
 * for a given key than implementing the same operation on the "cooked"
21361
 * form in 'row'.
21362
 *
21363
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21364
 * (This helps to avoid silent bugs if someone changes ifindex's
21365
 * type without updating the caller.)
21366
 *
21367
 * The caller must not modify or free the returned value.
21368
 *
21369
 * Various kinds of changes can invalidate the returned value: modifying
21370
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21371
 * If the returned value is needed for a long time, it is best to make a copy
21372
 * of it with ovsdb_datum_clone().
21373
 *
21374
 * This function is rarely useful, since it is easier to access the value
21375
 * directly through the "ifindex" member in ovsrec_interface. */
21376
const struct ovsdb_datum *
21377
ovsrec_interface_get_ifindex(const struct ovsrec_interface *row,
21378
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21379
0
{
21380
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21381
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ifindex);
21382
0
}
21383
21384
/* Returns the "ingress_policing_burst" column's value from the "Interface" table in 'row'
21385
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21386
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21387
 * for a given key than implementing the same operation on the "cooked"
21388
 * form in 'row'.
21389
 *
21390
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21391
 * (This helps to avoid silent bugs if someone changes ingress_policing_burst's
21392
 * type without updating the caller.)
21393
 *
21394
 * The caller must not modify or free the returned value.
21395
 *
21396
 * Various kinds of changes can invalidate the returned value: modifying
21397
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21398
 * If the returned value is needed for a long time, it is best to make a copy
21399
 * of it with ovsdb_datum_clone().
21400
 *
21401
 * This function is rarely useful, since it is easier to access the value
21402
 * directly through the "ingress_policing_burst" member in ovsrec_interface. */
21403
const struct ovsdb_datum *
21404
ovsrec_interface_get_ingress_policing_burst(const struct ovsrec_interface *row,
21405
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21406
0
{
21407
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21408
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_burst);
21409
0
}
21410
21411
/* Returns the "ingress_policing_kpkts_burst" column's value from the "Interface" table in 'row'
21412
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21413
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21414
 * for a given key than implementing the same operation on the "cooked"
21415
 * form in 'row'.
21416
 *
21417
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21418
 * (This helps to avoid silent bugs if someone changes ingress_policing_kpkts_burst's
21419
 * type without updating the caller.)
21420
 *
21421
 * The caller must not modify or free the returned value.
21422
 *
21423
 * Various kinds of changes can invalidate the returned value: modifying
21424
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21425
 * If the returned value is needed for a long time, it is best to make a copy
21426
 * of it with ovsdb_datum_clone().
21427
 *
21428
 * This function is rarely useful, since it is easier to access the value
21429
 * directly through the "ingress_policing_kpkts_burst" member in ovsrec_interface. */
21430
const struct ovsdb_datum *
21431
ovsrec_interface_get_ingress_policing_kpkts_burst(const struct ovsrec_interface *row,
21432
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21433
0
{
21434
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21435
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_burst);
21436
0
}
21437
21438
/* Returns the "ingress_policing_kpkts_rate" column's value from the "Interface" table in 'row'
21439
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21440
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21441
 * for a given key than implementing the same operation on the "cooked"
21442
 * form in 'row'.
21443
 *
21444
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21445
 * (This helps to avoid silent bugs if someone changes ingress_policing_kpkts_rate's
21446
 * type without updating the caller.)
21447
 *
21448
 * The caller must not modify or free the returned value.
21449
 *
21450
 * Various kinds of changes can invalidate the returned value: modifying
21451
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21452
 * If the returned value is needed for a long time, it is best to make a copy
21453
 * of it with ovsdb_datum_clone().
21454
 *
21455
 * This function is rarely useful, since it is easier to access the value
21456
 * directly through the "ingress_policing_kpkts_rate" member in ovsrec_interface. */
21457
const struct ovsdb_datum *
21458
ovsrec_interface_get_ingress_policing_kpkts_rate(const struct ovsrec_interface *row,
21459
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21460
0
{
21461
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21462
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_rate);
21463
0
}
21464
21465
/* Returns the "ingress_policing_rate" column's value from the "Interface" table in 'row'
21466
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21467
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21468
 * for a given key than implementing the same operation on the "cooked"
21469
 * form in 'row'.
21470
 *
21471
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21472
 * (This helps to avoid silent bugs if someone changes ingress_policing_rate's
21473
 * type without updating the caller.)
21474
 *
21475
 * The caller must not modify or free the returned value.
21476
 *
21477
 * Various kinds of changes can invalidate the returned value: modifying
21478
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21479
 * If the returned value is needed for a long time, it is best to make a copy
21480
 * of it with ovsdb_datum_clone().
21481
 *
21482
 * This function is rarely useful, since it is easier to access the value
21483
 * directly through the "ingress_policing_rate" member in ovsrec_interface. */
21484
const struct ovsdb_datum *
21485
ovsrec_interface_get_ingress_policing_rate(const struct ovsrec_interface *row,
21486
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21487
0
{
21488
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21489
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_rate);
21490
0
}
21491
21492
/* Returns the "lacp_current" column's value from the "Interface" table in 'row'
21493
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21494
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21495
 * for a given key than implementing the same operation on the "cooked"
21496
 * form in 'row'.
21497
 *
21498
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
21499
 * (This helps to avoid silent bugs if someone changes lacp_current's
21500
 * type without updating the caller.)
21501
 *
21502
 * The caller must not modify or free the returned value.
21503
 *
21504
 * Various kinds of changes can invalidate the returned value: modifying
21505
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21506
 * If the returned value is needed for a long time, it is best to make a copy
21507
 * of it with ovsdb_datum_clone().
21508
 *
21509
 * This function is rarely useful, since it is easier to access the value
21510
 * directly through the "lacp_current" member in ovsrec_interface. */
21511
const struct ovsdb_datum *
21512
ovsrec_interface_get_lacp_current(const struct ovsrec_interface *row,
21513
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21514
0
{
21515
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
21516
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_lacp_current);
21517
0
}
21518
21519
/* Returns the "link_resets" column's value from the "Interface" table in 'row'
21520
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21521
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21522
 * for a given key than implementing the same operation on the "cooked"
21523
 * form in 'row'.
21524
 *
21525
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21526
 * (This helps to avoid silent bugs if someone changes link_resets's
21527
 * type without updating the caller.)
21528
 *
21529
 * The caller must not modify or free the returned value.
21530
 *
21531
 * Various kinds of changes can invalidate the returned value: modifying
21532
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21533
 * If the returned value is needed for a long time, it is best to make a copy
21534
 * of it with ovsdb_datum_clone().
21535
 *
21536
 * This function is rarely useful, since it is easier to access the value
21537
 * directly through the "link_resets" member in ovsrec_interface. */
21538
const struct ovsdb_datum *
21539
ovsrec_interface_get_link_resets(const struct ovsrec_interface *row,
21540
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21541
0
{
21542
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21543
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_resets);
21544
0
}
21545
21546
/* Returns the "link_speed" column's value from the "Interface" table in 'row'
21547
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21548
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21549
 * for a given key than implementing the same operation on the "cooked"
21550
 * form in 'row'.
21551
 *
21552
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21553
 * (This helps to avoid silent bugs if someone changes link_speed's
21554
 * type without updating the caller.)
21555
 *
21556
 * The caller must not modify or free the returned value.
21557
 *
21558
 * Various kinds of changes can invalidate the returned value: modifying
21559
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21560
 * If the returned value is needed for a long time, it is best to make a copy
21561
 * of it with ovsdb_datum_clone().
21562
 *
21563
 * This function is rarely useful, since it is easier to access the value
21564
 * directly through the "link_speed" member in ovsrec_interface. */
21565
const struct ovsdb_datum *
21566
ovsrec_interface_get_link_speed(const struct ovsrec_interface *row,
21567
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21568
0
{
21569
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21570
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_speed);
21571
0
}
21572
21573
/* Returns the "link_state" column's value from the "Interface" table in 'row'
21574
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21575
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21576
 * for a given key than implementing the same operation on the "cooked"
21577
 * form in 'row'.
21578
 *
21579
 * 'key_type' must be OVSDB_TYPE_STRING.
21580
 * (This helps to avoid silent bugs if someone changes link_state's
21581
 * type without updating the caller.)
21582
 *
21583
 * The caller must not modify or free the returned value.
21584
 *
21585
 * Various kinds of changes can invalidate the returned value: modifying
21586
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21587
 * If the returned value is needed for a long time, it is best to make a copy
21588
 * of it with ovsdb_datum_clone().
21589
 *
21590
 * This function is rarely useful, since it is easier to access the value
21591
 * directly through the "link_state" member in ovsrec_interface. */
21592
const struct ovsdb_datum *
21593
ovsrec_interface_get_link_state(const struct ovsrec_interface *row,
21594
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21595
0
{
21596
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21597
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_state);
21598
0
}
21599
21600
/* Returns the "lldp" column's value from the "Interface" table in 'row'
21601
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21602
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21603
 * for a given key than implementing the same operation on the "cooked"
21604
 * form in 'row'.
21605
 *
21606
 * 'key_type' must be OVSDB_TYPE_STRING.
21607
 * 'value_type' must be OVSDB_TYPE_STRING.
21608
 * (This helps to avoid silent bugs if someone changes lldp's
21609
 * type without updating the caller.)
21610
 *
21611
 * The caller must not modify or free the returned value.
21612
 *
21613
 * Various kinds of changes can invalidate the returned value: modifying
21614
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21615
 * If the returned value is needed for a long time, it is best to make a copy
21616
 * of it with ovsdb_datum_clone().
21617
 *
21618
 * This function is rarely useful, since it is easier to access the value
21619
 * directly through the "lldp" member in ovsrec_interface. */
21620
const struct ovsdb_datum *
21621
ovsrec_interface_get_lldp(const struct ovsrec_interface *row,
21622
  enum ovsdb_atomic_type key_type OVS_UNUSED,
21623
  enum ovsdb_atomic_type value_type OVS_UNUSED)
21624
0
{
21625
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21626
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
21627
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_lldp);
21628
0
}
21629
21630
/* Returns the "mac" column's value from the "Interface" table in 'row'
21631
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21632
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21633
 * for a given key than implementing the same operation on the "cooked"
21634
 * form in 'row'.
21635
 *
21636
 * 'key_type' must be OVSDB_TYPE_STRING.
21637
 * (This helps to avoid silent bugs if someone changes mac's
21638
 * type without updating the caller.)
21639
 *
21640
 * The caller must not modify or free the returned value.
21641
 *
21642
 * Various kinds of changes can invalidate the returned value: modifying
21643
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21644
 * If the returned value is needed for a long time, it is best to make a copy
21645
 * of it with ovsdb_datum_clone().
21646
 *
21647
 * This function is rarely useful, since it is easier to access the value
21648
 * directly through the "mac" member in ovsrec_interface. */
21649
const struct ovsdb_datum *
21650
ovsrec_interface_get_mac(const struct ovsrec_interface *row,
21651
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21652
0
{
21653
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21654
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mac);
21655
0
}
21656
21657
/* Returns the "mac_in_use" column's value from the "Interface" table in 'row'
21658
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21659
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21660
 * for a given key than implementing the same operation on the "cooked"
21661
 * form in 'row'.
21662
 *
21663
 * 'key_type' must be OVSDB_TYPE_STRING.
21664
 * (This helps to avoid silent bugs if someone changes mac_in_use's
21665
 * type without updating the caller.)
21666
 *
21667
 * The caller must not modify or free the returned value.
21668
 *
21669
 * Various kinds of changes can invalidate the returned value: modifying
21670
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21671
 * If the returned value is needed for a long time, it is best to make a copy
21672
 * of it with ovsdb_datum_clone().
21673
 *
21674
 * This function is rarely useful, since it is easier to access the value
21675
 * directly through the "mac_in_use" member in ovsrec_interface. */
21676
const struct ovsdb_datum *
21677
ovsrec_interface_get_mac_in_use(const struct ovsrec_interface *row,
21678
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21679
0
{
21680
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21681
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mac_in_use);
21682
0
}
21683
21684
/* Returns the "mtu" column's value from the "Interface" table in 'row'
21685
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21686
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21687
 * for a given key than implementing the same operation on the "cooked"
21688
 * form in 'row'.
21689
 *
21690
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21691
 * (This helps to avoid silent bugs if someone changes mtu's
21692
 * type without updating the caller.)
21693
 *
21694
 * The caller must not modify or free the returned value.
21695
 *
21696
 * Various kinds of changes can invalidate the returned value: modifying
21697
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21698
 * If the returned value is needed for a long time, it is best to make a copy
21699
 * of it with ovsdb_datum_clone().
21700
 *
21701
 * This function is rarely useful, since it is easier to access the value
21702
 * directly through the "mtu" member in ovsrec_interface. */
21703
const struct ovsdb_datum *
21704
ovsrec_interface_get_mtu(const struct ovsrec_interface *row,
21705
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21706
0
{
21707
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21708
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mtu);
21709
0
}
21710
21711
/* Returns the "mtu_request" column's value from the "Interface" table in 'row'
21712
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21713
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21714
 * for a given key than implementing the same operation on the "cooked"
21715
 * form in 'row'.
21716
 *
21717
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21718
 * (This helps to avoid silent bugs if someone changes mtu_request's
21719
 * type without updating the caller.)
21720
 *
21721
 * The caller must not modify or free the returned value.
21722
 *
21723
 * Various kinds of changes can invalidate the returned value: modifying
21724
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21725
 * If the returned value is needed for a long time, it is best to make a copy
21726
 * of it with ovsdb_datum_clone().
21727
 *
21728
 * This function is rarely useful, since it is easier to access the value
21729
 * directly through the "mtu_request" member in ovsrec_interface. */
21730
const struct ovsdb_datum *
21731
ovsrec_interface_get_mtu_request(const struct ovsrec_interface *row,
21732
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21733
0
{
21734
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21735
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mtu_request);
21736
0
}
21737
21738
/* Returns the "name" column's value from the "Interface" table in 'row'
21739
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21740
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21741
 * for a given key than implementing the same operation on the "cooked"
21742
 * form in 'row'.
21743
 *
21744
 * 'key_type' must be OVSDB_TYPE_STRING.
21745
 * (This helps to avoid silent bugs if someone changes name's
21746
 * type without updating the caller.)
21747
 *
21748
 * The caller must not modify or free the returned value.
21749
 *
21750
 * Various kinds of changes can invalidate the returned value: modifying
21751
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21752
 * If the returned value is needed for a long time, it is best to make a copy
21753
 * of it with ovsdb_datum_clone().
21754
 *
21755
 * This function is rarely useful, since it is easier to access the value
21756
 * directly through the "name" member in ovsrec_interface. */
21757
const struct ovsdb_datum *
21758
ovsrec_interface_get_name(const struct ovsrec_interface *row,
21759
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21760
0
{
21761
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21762
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_name);
21763
0
}
21764
21765
/* Returns the "ofport" column's value from the "Interface" table in 'row'
21766
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21767
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21768
 * for a given key than implementing the same operation on the "cooked"
21769
 * form in 'row'.
21770
 *
21771
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21772
 * (This helps to avoid silent bugs if someone changes ofport's
21773
 * type without updating the caller.)
21774
 *
21775
 * The caller must not modify or free the returned value.
21776
 *
21777
 * Various kinds of changes can invalidate the returned value: modifying
21778
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21779
 * If the returned value is needed for a long time, it is best to make a copy
21780
 * of it with ovsdb_datum_clone().
21781
 *
21782
 * This function is rarely useful, since it is easier to access the value
21783
 * directly through the "ofport" member in ovsrec_interface. */
21784
const struct ovsdb_datum *
21785
ovsrec_interface_get_ofport(const struct ovsrec_interface *row,
21786
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21787
0
{
21788
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21789
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ofport);
21790
0
}
21791
21792
/* Returns the "ofport_request" column's value from the "Interface" table in 'row'
21793
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21794
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21795
 * for a given key than implementing the same operation on the "cooked"
21796
 * form in 'row'.
21797
 *
21798
 * 'key_type' must be OVSDB_TYPE_INTEGER.
21799
 * (This helps to avoid silent bugs if someone changes ofport_request's
21800
 * type without updating the caller.)
21801
 *
21802
 * The caller must not modify or free the returned value.
21803
 *
21804
 * Various kinds of changes can invalidate the returned value: modifying
21805
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21806
 * If the returned value is needed for a long time, it is best to make a copy
21807
 * of it with ovsdb_datum_clone().
21808
 *
21809
 * This function is rarely useful, since it is easier to access the value
21810
 * directly through the "ofport_request" member in ovsrec_interface. */
21811
const struct ovsdb_datum *
21812
ovsrec_interface_get_ofport_request(const struct ovsrec_interface *row,
21813
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21814
0
{
21815
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
21816
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ofport_request);
21817
0
}
21818
21819
/* Returns the "options" column's value from the "Interface" table in 'row'
21820
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21821
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21822
 * for a given key than implementing the same operation on the "cooked"
21823
 * form in 'row'.
21824
 *
21825
 * 'key_type' must be OVSDB_TYPE_STRING.
21826
 * 'value_type' must be OVSDB_TYPE_STRING.
21827
 * (This helps to avoid silent bugs if someone changes options's
21828
 * type without updating the caller.)
21829
 *
21830
 * The caller must not modify or free the returned value.
21831
 *
21832
 * Various kinds of changes can invalidate the returned value: modifying
21833
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21834
 * If the returned value is needed for a long time, it is best to make a copy
21835
 * of it with ovsdb_datum_clone().
21836
 *
21837
 * This function is rarely useful, since it is easier to access the value
21838
 * directly through the "options" member in ovsrec_interface. */
21839
const struct ovsdb_datum *
21840
ovsrec_interface_get_options(const struct ovsrec_interface *row,
21841
  enum ovsdb_atomic_type key_type OVS_UNUSED,
21842
  enum ovsdb_atomic_type value_type OVS_UNUSED)
21843
0
{
21844
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21845
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
21846
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_options);
21847
0
}
21848
21849
/* Returns the "other_config" column's value from the "Interface" table in 'row'
21850
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21851
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21852
 * for a given key than implementing the same operation on the "cooked"
21853
 * form in 'row'.
21854
 *
21855
 * 'key_type' must be OVSDB_TYPE_STRING.
21856
 * 'value_type' must be OVSDB_TYPE_STRING.
21857
 * (This helps to avoid silent bugs if someone changes other_config's
21858
 * type without updating the caller.)
21859
 *
21860
 * The caller must not modify or free the returned value.
21861
 *
21862
 * Various kinds of changes can invalidate the returned value: modifying
21863
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21864
 * If the returned value is needed for a long time, it is best to make a copy
21865
 * of it with ovsdb_datum_clone().
21866
 *
21867
 * This function is rarely useful, since it is easier to access the value
21868
 * directly through the "other_config" member in ovsrec_interface. */
21869
const struct ovsdb_datum *
21870
ovsrec_interface_get_other_config(const struct ovsrec_interface *row,
21871
  enum ovsdb_atomic_type key_type OVS_UNUSED,
21872
  enum ovsdb_atomic_type value_type OVS_UNUSED)
21873
0
{
21874
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21875
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
21876
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_other_config);
21877
0
}
21878
21879
/* Returns the "statistics" column's value from the "Interface" table in 'row'
21880
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21881
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21882
 * for a given key than implementing the same operation on the "cooked"
21883
 * form in 'row'.
21884
 *
21885
 * 'key_type' must be OVSDB_TYPE_STRING.
21886
 * 'value_type' must be OVSDB_TYPE_INTEGER.
21887
 * (This helps to avoid silent bugs if someone changes statistics's
21888
 * type without updating the caller.)
21889
 *
21890
 * The caller must not modify or free the returned value.
21891
 *
21892
 * Various kinds of changes can invalidate the returned value: modifying
21893
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21894
 * If the returned value is needed for a long time, it is best to make a copy
21895
 * of it with ovsdb_datum_clone().
21896
 *
21897
 * This function is rarely useful, since it is easier to access the value
21898
 * directly through the "statistics" member in ovsrec_interface. */
21899
const struct ovsdb_datum *
21900
ovsrec_interface_get_statistics(const struct ovsrec_interface *row,
21901
  enum ovsdb_atomic_type key_type OVS_UNUSED,
21902
  enum ovsdb_atomic_type value_type OVS_UNUSED)
21903
0
{
21904
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21905
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
21906
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_statistics);
21907
0
}
21908
21909
/* Returns the "status" column's value from the "Interface" table in 'row'
21910
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21911
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21912
 * for a given key than implementing the same operation on the "cooked"
21913
 * form in 'row'.
21914
 *
21915
 * 'key_type' must be OVSDB_TYPE_STRING.
21916
 * 'value_type' must be OVSDB_TYPE_STRING.
21917
 * (This helps to avoid silent bugs if someone changes status's
21918
 * type without updating the caller.)
21919
 *
21920
 * The caller must not modify or free the returned value.
21921
 *
21922
 * Various kinds of changes can invalidate the returned value: modifying
21923
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21924
 * If the returned value is needed for a long time, it is best to make a copy
21925
 * of it with ovsdb_datum_clone().
21926
 *
21927
 * This function is rarely useful, since it is easier to access the value
21928
 * directly through the "status" member in ovsrec_interface. */
21929
const struct ovsdb_datum *
21930
ovsrec_interface_get_status(const struct ovsrec_interface *row,
21931
  enum ovsdb_atomic_type key_type OVS_UNUSED,
21932
  enum ovsdb_atomic_type value_type OVS_UNUSED)
21933
0
{
21934
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21935
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
21936
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_status);
21937
0
}
21938
21939
/* Returns the "type" column's value from the "Interface" table in 'row'
21940
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
21941
 * ovsdb_datum_find_key() is an easier and more efficient way to search
21942
 * for a given key than implementing the same operation on the "cooked"
21943
 * form in 'row'.
21944
 *
21945
 * 'key_type' must be OVSDB_TYPE_STRING.
21946
 * (This helps to avoid silent bugs if someone changes type's
21947
 * type without updating the caller.)
21948
 *
21949
 * The caller must not modify or free the returned value.
21950
 *
21951
 * Various kinds of changes can invalidate the returned value: modifying
21952
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
21953
 * If the returned value is needed for a long time, it is best to make a copy
21954
 * of it with ovsdb_datum_clone().
21955
 *
21956
 * This function is rarely useful, since it is easier to access the value
21957
 * directly through the "type" member in ovsrec_interface. */
21958
const struct ovsdb_datum *
21959
ovsrec_interface_get_type(const struct ovsrec_interface *row,
21960
  enum ovsdb_atomic_type key_type OVS_UNUSED)
21961
0
{
21962
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
21963
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_type);
21964
0
}
21965
21966
/* Sets the "admin_state" column from the "Interface" table in 'row' to
21967
 * the 'admin_state' set.
21968
 *
21969
 * If "admin_state" is null, the column will be the empty set,
21970
 * otherwise it will contain the specified value.
21971
 *
21972
 * Argument constraints: either "down" or "up"
21973
 *
21974
 * The caller retains ownership of the arguments. */
21975
void
21976
ovsrec_interface_set_admin_state(const struct ovsrec_interface *row, const char *admin_state)
21977
0
{
21978
0
    struct ovsdb_datum datum;
21979
21980
0
    datum.refcnt = NULL;
21981
21982
0
    if (admin_state) {
21983
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21984
0
        datum.n = 1;
21985
0
        datum.keys = key;
21986
0
        key->s = ovsdb_atom_string_create(admin_state);
21987
0
    } else {
21988
0
        datum.n = 0;
21989
0
        datum.keys = NULL;
21990
0
    }
21991
0
    datum.values = NULL;
21992
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_admin_state, &datum);
21993
0
}
21994
21995
/* Sets the "bfd" column's value from the "Interface" table in 'row'
21996
 * to 'bfd'.
21997
 *
21998
 * The caller retains ownership of 'bfd' and everything in it. */
21999
void
22000
ovsrec_interface_set_bfd(const struct ovsrec_interface *row, const struct smap *bfd)
22001
0
{
22002
0
    struct ovsdb_datum datum;
22003
22004
0
    if (bfd) {
22005
0
        ovsdb_datum_from_smap(&datum, bfd);
22006
0
    } else {
22007
0
        ovsdb_datum_init_empty(&datum);
22008
0
    }
22009
0
    ovsdb_idl_txn_write(&row->header_,
22010
0
                        &ovsrec_interface_col_bfd,
22011
0
                        &datum);
22012
0
}
22013
22014
22015
/* Sets the "bfd_status" column's value from the "Interface" table in 'row'
22016
 * to 'bfd_status'.
22017
 *
22018
 * The caller retains ownership of 'bfd_status' and everything in it. */
22019
void
22020
ovsrec_interface_set_bfd_status(const struct ovsrec_interface *row, const struct smap *bfd_status)
22021
0
{
22022
0
    struct ovsdb_datum datum;
22023
22024
0
    if (bfd_status) {
22025
0
        ovsdb_datum_from_smap(&datum, bfd_status);
22026
0
    } else {
22027
0
        ovsdb_datum_init_empty(&datum);
22028
0
    }
22029
0
    ovsdb_idl_txn_write(&row->header_,
22030
0
                        &ovsrec_interface_col_bfd_status,
22031
0
                        &datum);
22032
0
}
22033
22034
22035
/* Sets the "cfm_fault" column from the "Interface" table in 'row' to
22036
 * the 'cfm_fault' set with 'n_cfm_fault' entries.
22037
 *
22038
 * 'n_cfm_fault' may be 0 or 1; if it is 0, then 'cfm_fault'
22039
 * may be NULL.
22040
 *
22041
 * The caller retains ownership of the arguments. */
22042
void
22043
ovsrec_interface_set_cfm_fault(const struct ovsrec_interface *row, const bool *cfm_fault, size_t n_cfm_fault)
22044
0
{
22045
0
    struct ovsdb_datum datum;
22046
22047
0
    datum.refcnt = NULL;
22048
22049
0
    if (n_cfm_fault) {
22050
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22051
0
        datum.n = 1;
22052
0
        datum.keys = key;
22053
0
        key->boolean = *cfm_fault;
22054
0
    } else {
22055
0
        datum.n = 0;
22056
0
        datum.keys = NULL;
22057
0
    }
22058
0
    datum.values = NULL;
22059
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_fault, &datum);
22060
0
}
22061
22062
/* Sets the "cfm_fault_status" column from the "Interface" table in 'row' to
22063
 * the 'cfm_fault_status' set with 'n_cfm_fault_status' entries.
22064
 *
22065
 * The caller retains ownership of the arguments. */
22066
void
22067
ovsrec_interface_set_cfm_fault_status(const struct ovsrec_interface *row, const char **cfm_fault_status, size_t n_cfm_fault_status)
22068
0
{
22069
0
    struct ovsdb_datum datum;
22070
22071
0
    datum.refcnt = NULL;
22072
22073
0
    datum.n = n_cfm_fault_status;
22074
0
    datum.keys = n_cfm_fault_status ? xmalloc(n_cfm_fault_status * sizeof *datum.keys) : NULL;
22075
0
    datum.values = NULL;
22076
0
    for (size_t i = 0; i < n_cfm_fault_status; i++) {
22077
0
        datum.keys[i].s = ovsdb_atom_string_create(cfm_fault_status[i]);
22078
0
    }
22079
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_fault_status, &datum);
22080
0
}
22081
22082
/* Sets the "cfm_flap_count" column from the "Interface" table in 'row' to
22083
 * the 'cfm_flap_count' set with 'n_cfm_flap_count' entries.
22084
 *
22085
 * 'n_cfm_flap_count' may be 0 or 1; if it is 0, then 'cfm_flap_count'
22086
 * may be NULL.
22087
 *
22088
 * The caller retains ownership of the arguments. */
22089
void
22090
ovsrec_interface_set_cfm_flap_count(const struct ovsrec_interface *row, const int64_t *cfm_flap_count, size_t n_cfm_flap_count)
22091
0
{
22092
0
    struct ovsdb_datum datum;
22093
22094
0
    datum.refcnt = NULL;
22095
22096
0
    if (n_cfm_flap_count) {
22097
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22098
0
        datum.n = 1;
22099
0
        datum.keys = key;
22100
0
        key->integer = *cfm_flap_count;
22101
0
    } else {
22102
0
        datum.n = 0;
22103
0
        datum.keys = NULL;
22104
0
    }
22105
0
    datum.values = NULL;
22106
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_flap_count, &datum);
22107
0
}
22108
22109
/* Sets the "cfm_health" column from the "Interface" table in 'row' to
22110
 * the 'cfm_health' set with 'n_cfm_health' entries.
22111
 *
22112
 * 'n_cfm_health' may be 0 or 1; if it is 0, then 'cfm_health'
22113
 * may be NULL.
22114
 *
22115
 * Argument constraints: in range 0 to 100
22116
 *
22117
 * The caller retains ownership of the arguments. */
22118
void
22119
ovsrec_interface_set_cfm_health(const struct ovsrec_interface *row, const int64_t *cfm_health, size_t n_cfm_health)
22120
0
{
22121
0
    struct ovsdb_datum datum;
22122
22123
0
    datum.refcnt = NULL;
22124
22125
0
    if (n_cfm_health) {
22126
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22127
0
        datum.n = 1;
22128
0
        datum.keys = key;
22129
0
        key->integer = *cfm_health;
22130
0
    } else {
22131
0
        datum.n = 0;
22132
0
        datum.keys = NULL;
22133
0
    }
22134
0
    datum.values = NULL;
22135
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_health, &datum);
22136
0
}
22137
22138
/* Sets the "cfm_mpid" column from the "Interface" table in 'row' to
22139
 * the 'cfm_mpid' set with 'n_cfm_mpid' entries.
22140
 *
22141
 * 'n_cfm_mpid' may be 0 or 1; if it is 0, then 'cfm_mpid'
22142
 * may be NULL.
22143
 *
22144
 * The caller retains ownership of the arguments. */
22145
void
22146
ovsrec_interface_set_cfm_mpid(const struct ovsrec_interface *row, const int64_t *cfm_mpid, size_t n_cfm_mpid)
22147
0
{
22148
0
    struct ovsdb_datum datum;
22149
22150
0
    datum.refcnt = NULL;
22151
22152
0
    if (n_cfm_mpid) {
22153
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22154
0
        datum.n = 1;
22155
0
        datum.keys = key;
22156
0
        key->integer = *cfm_mpid;
22157
0
    } else {
22158
0
        datum.n = 0;
22159
0
        datum.keys = NULL;
22160
0
    }
22161
0
    datum.values = NULL;
22162
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_mpid, &datum);
22163
0
}
22164
22165
/* Sets the "cfm_remote_mpids" column from the "Interface" table in 'row' to
22166
 * the 'cfm_remote_mpids' set with 'n_cfm_remote_mpids' entries.
22167
 *
22168
 * The caller retains ownership of the arguments. */
22169
void
22170
ovsrec_interface_set_cfm_remote_mpids(const struct ovsrec_interface *row, const int64_t *cfm_remote_mpids, size_t n_cfm_remote_mpids)
22171
0
{
22172
0
    struct ovsdb_datum datum;
22173
22174
0
    datum.refcnt = NULL;
22175
22176
0
    datum.n = n_cfm_remote_mpids;
22177
0
    datum.keys = n_cfm_remote_mpids ? xmalloc(n_cfm_remote_mpids * sizeof *datum.keys) : NULL;
22178
0
    datum.values = NULL;
22179
0
    for (size_t i = 0; i < n_cfm_remote_mpids; i++) {
22180
0
        datum.keys[i].integer = cfm_remote_mpids[i];
22181
0
    }
22182
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_remote_mpids, &datum);
22183
0
}
22184
22185
/* Sets the "cfm_remote_opstate" column from the "Interface" table in 'row' to
22186
 * the 'cfm_remote_opstate' set.
22187
 *
22188
 * If "cfm_remote_opstate" is null, the column will be the empty set,
22189
 * otherwise it will contain the specified value.
22190
 *
22191
 * Argument constraints: either "down" or "up"
22192
 *
22193
 * The caller retains ownership of the arguments. */
22194
void
22195
ovsrec_interface_set_cfm_remote_opstate(const struct ovsrec_interface *row, const char *cfm_remote_opstate)
22196
0
{
22197
0
    struct ovsdb_datum datum;
22198
22199
0
    datum.refcnt = NULL;
22200
22201
0
    if (cfm_remote_opstate) {
22202
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22203
0
        datum.n = 1;
22204
0
        datum.keys = key;
22205
0
        key->s = ovsdb_atom_string_create(cfm_remote_opstate);
22206
0
    } else {
22207
0
        datum.n = 0;
22208
0
        datum.keys = NULL;
22209
0
    }
22210
0
    datum.values = NULL;
22211
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_remote_opstate, &datum);
22212
0
}
22213
22214
/* Sets the "duplex" column from the "Interface" table in 'row' to
22215
 * the 'duplex' set.
22216
 *
22217
 * If "duplex" is null, the column will be the empty set,
22218
 * otherwise it will contain the specified value.
22219
 *
22220
 * Argument constraints: either "full" or "half"
22221
 *
22222
 * The caller retains ownership of the arguments. */
22223
void
22224
ovsrec_interface_set_duplex(const struct ovsrec_interface *row, const char *duplex)
22225
0
{
22226
0
    struct ovsdb_datum datum;
22227
22228
0
    datum.refcnt = NULL;
22229
22230
0
    if (duplex) {
22231
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22232
0
        datum.n = 1;
22233
0
        datum.keys = key;
22234
0
        key->s = ovsdb_atom_string_create(duplex);
22235
0
    } else {
22236
0
        datum.n = 0;
22237
0
        datum.keys = NULL;
22238
0
    }
22239
0
    datum.values = NULL;
22240
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_duplex, &datum);
22241
0
}
22242
22243
/* Sets the "error" column from the "Interface" table in 'row' to
22244
 * the 'error' set.
22245
 *
22246
 * If "error" is null, the column will be the empty set,
22247
 * otherwise it will contain the specified value.
22248
 *
22249
 * The caller retains ownership of the arguments. */
22250
void
22251
ovsrec_interface_set_error(const struct ovsrec_interface *row, const char *error)
22252
0
{
22253
0
    struct ovsdb_datum datum;
22254
22255
0
    datum.refcnt = NULL;
22256
22257
0
    if (error) {
22258
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22259
0
        datum.n = 1;
22260
0
        datum.keys = key;
22261
0
        key->s = ovsdb_atom_string_create(error);
22262
0
    } else {
22263
0
        datum.n = 0;
22264
0
        datum.keys = NULL;
22265
0
    }
22266
0
    datum.values = NULL;
22267
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_error, &datum);
22268
0
}
22269
22270
/* Sets the "external_ids" column's value from the "Interface" table in 'row'
22271
 * to 'external_ids'.
22272
 *
22273
 * The caller retains ownership of 'external_ids' and everything in it. */
22274
void
22275
ovsrec_interface_set_external_ids(const struct ovsrec_interface *row, const struct smap *external_ids)
22276
0
{
22277
0
    struct ovsdb_datum datum;
22278
22279
0
    if (external_ids) {
22280
0
        ovsdb_datum_from_smap(&datum, external_ids);
22281
0
    } else {
22282
0
        ovsdb_datum_init_empty(&datum);
22283
0
    }
22284
0
    ovsdb_idl_txn_write(&row->header_,
22285
0
                        &ovsrec_interface_col_external_ids,
22286
0
                        &datum);
22287
0
}
22288
22289
22290
/* Sets the "ifindex" column from the "Interface" table in 'row' to
22291
 * the 'ifindex' set with 'n_ifindex' entries.
22292
 *
22293
 * 'n_ifindex' may be 0 or 1; if it is 0, then 'ifindex'
22294
 * may be NULL.
22295
 *
22296
 * Argument constraints: in range 0 to 4,294,967,295
22297
 *
22298
 * The caller retains ownership of the arguments. */
22299
void
22300
ovsrec_interface_set_ifindex(const struct ovsrec_interface *row, const int64_t *ifindex, size_t n_ifindex)
22301
0
{
22302
0
    struct ovsdb_datum datum;
22303
22304
0
    datum.refcnt = NULL;
22305
22306
0
    if (n_ifindex) {
22307
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22308
0
        datum.n = 1;
22309
0
        datum.keys = key;
22310
0
        key->integer = *ifindex;
22311
0
    } else {
22312
0
        datum.n = 0;
22313
0
        datum.keys = NULL;
22314
0
    }
22315
0
    datum.values = NULL;
22316
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ifindex, &datum);
22317
0
}
22318
22319
/* Sets the "ingress_policing_burst" column from the "Interface" table in 'row' to
22320
 * 'ingress_policing_burst'.
22321
 *
22322
 * Argument constraints: at least 0
22323
 *
22324
 * The caller retains ownership of the arguments. */
22325
void
22326
ovsrec_interface_set_ingress_policing_burst(const struct ovsrec_interface *row, int64_t ingress_policing_burst)
22327
0
{
22328
0
    struct ovsdb_datum datum;
22329
22330
0
    datum.refcnt = NULL;
22331
22332
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
22333
22334
0
    datum.n = 1;
22335
0
    datum.keys = key;
22336
0
    key->integer = ingress_policing_burst;
22337
0
    datum.values = NULL;
22338
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ingress_policing_burst, &datum);
22339
0
}
22340
22341
/* Sets the "ingress_policing_kpkts_burst" column from the "Interface" table in 'row' to
22342
 * 'ingress_policing_kpkts_burst'.
22343
 *
22344
 * Argument constraints: at least 0
22345
 *
22346
 * The caller retains ownership of the arguments. */
22347
void
22348
ovsrec_interface_set_ingress_policing_kpkts_burst(const struct ovsrec_interface *row, int64_t ingress_policing_kpkts_burst)
22349
0
{
22350
0
    struct ovsdb_datum datum;
22351
22352
0
    datum.refcnt = NULL;
22353
22354
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
22355
22356
0
    datum.n = 1;
22357
0
    datum.keys = key;
22358
0
    key->integer = ingress_policing_kpkts_burst;
22359
0
    datum.values = NULL;
22360
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_burst, &datum);
22361
0
}
22362
22363
/* Sets the "ingress_policing_kpkts_rate" column from the "Interface" table in 'row' to
22364
 * 'ingress_policing_kpkts_rate'.
22365
 *
22366
 * Argument constraints: at least 0
22367
 *
22368
 * The caller retains ownership of the arguments. */
22369
void
22370
ovsrec_interface_set_ingress_policing_kpkts_rate(const struct ovsrec_interface *row, int64_t ingress_policing_kpkts_rate)
22371
0
{
22372
0
    struct ovsdb_datum datum;
22373
22374
0
    datum.refcnt = NULL;
22375
22376
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
22377
22378
0
    datum.n = 1;
22379
0
    datum.keys = key;
22380
0
    key->integer = ingress_policing_kpkts_rate;
22381
0
    datum.values = NULL;
22382
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_rate, &datum);
22383
0
}
22384
22385
/* Sets the "ingress_policing_rate" column from the "Interface" table in 'row' to
22386
 * 'ingress_policing_rate'.
22387
 *
22388
 * Argument constraints: at least 0
22389
 *
22390
 * The caller retains ownership of the arguments. */
22391
void
22392
ovsrec_interface_set_ingress_policing_rate(const struct ovsrec_interface *row, int64_t ingress_policing_rate)
22393
0
{
22394
0
    struct ovsdb_datum datum;
22395
22396
0
    datum.refcnt = NULL;
22397
22398
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
22399
22400
0
    datum.n = 1;
22401
0
    datum.keys = key;
22402
0
    key->integer = ingress_policing_rate;
22403
0
    datum.values = NULL;
22404
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ingress_policing_rate, &datum);
22405
0
}
22406
22407
/* Sets the "lacp_current" column from the "Interface" table in 'row' to
22408
 * the 'lacp_current' set with 'n_lacp_current' entries.
22409
 *
22410
 * 'n_lacp_current' may be 0 or 1; if it is 0, then 'lacp_current'
22411
 * may be NULL.
22412
 *
22413
 * The caller retains ownership of the arguments. */
22414
void
22415
ovsrec_interface_set_lacp_current(const struct ovsrec_interface *row, const bool *lacp_current, size_t n_lacp_current)
22416
0
{
22417
0
    struct ovsdb_datum datum;
22418
22419
0
    datum.refcnt = NULL;
22420
22421
0
    if (n_lacp_current) {
22422
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22423
0
        datum.n = 1;
22424
0
        datum.keys = key;
22425
0
        key->boolean = *lacp_current;
22426
0
    } else {
22427
0
        datum.n = 0;
22428
0
        datum.keys = NULL;
22429
0
    }
22430
0
    datum.values = NULL;
22431
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_lacp_current, &datum);
22432
0
}
22433
22434
/* Sets the "link_resets" column from the "Interface" table in 'row' to
22435
 * the 'link_resets' set with 'n_link_resets' entries.
22436
 *
22437
 * 'n_link_resets' may be 0 or 1; if it is 0, then 'link_resets'
22438
 * may be NULL.
22439
 *
22440
 * The caller retains ownership of the arguments. */
22441
void
22442
ovsrec_interface_set_link_resets(const struct ovsrec_interface *row, const int64_t *link_resets, size_t n_link_resets)
22443
0
{
22444
0
    struct ovsdb_datum datum;
22445
22446
0
    datum.refcnt = NULL;
22447
22448
0
    if (n_link_resets) {
22449
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22450
0
        datum.n = 1;
22451
0
        datum.keys = key;
22452
0
        key->integer = *link_resets;
22453
0
    } else {
22454
0
        datum.n = 0;
22455
0
        datum.keys = NULL;
22456
0
    }
22457
0
    datum.values = NULL;
22458
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_link_resets, &datum);
22459
0
}
22460
22461
/* Sets the "link_speed" column from the "Interface" table in 'row' to
22462
 * the 'link_speed' set with 'n_link_speed' entries.
22463
 *
22464
 * 'n_link_speed' may be 0 or 1; if it is 0, then 'link_speed'
22465
 * may be NULL.
22466
 *
22467
 * The caller retains ownership of the arguments. */
22468
void
22469
ovsrec_interface_set_link_speed(const struct ovsrec_interface *row, const int64_t *link_speed, size_t n_link_speed)
22470
0
{
22471
0
    struct ovsdb_datum datum;
22472
22473
0
    datum.refcnt = NULL;
22474
22475
0
    if (n_link_speed) {
22476
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22477
0
        datum.n = 1;
22478
0
        datum.keys = key;
22479
0
        key->integer = *link_speed;
22480
0
    } else {
22481
0
        datum.n = 0;
22482
0
        datum.keys = NULL;
22483
0
    }
22484
0
    datum.values = NULL;
22485
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_link_speed, &datum);
22486
0
}
22487
22488
/* Sets the "link_state" column from the "Interface" table in 'row' to
22489
 * the 'link_state' set.
22490
 *
22491
 * If "link_state" is null, the column will be the empty set,
22492
 * otherwise it will contain the specified value.
22493
 *
22494
 * Argument constraints: either "down" or "up"
22495
 *
22496
 * The caller retains ownership of the arguments. */
22497
void
22498
ovsrec_interface_set_link_state(const struct ovsrec_interface *row, const char *link_state)
22499
0
{
22500
0
    struct ovsdb_datum datum;
22501
22502
0
    datum.refcnt = NULL;
22503
22504
0
    if (link_state) {
22505
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22506
0
        datum.n = 1;
22507
0
        datum.keys = key;
22508
0
        key->s = ovsdb_atom_string_create(link_state);
22509
0
    } else {
22510
0
        datum.n = 0;
22511
0
        datum.keys = NULL;
22512
0
    }
22513
0
    datum.values = NULL;
22514
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_link_state, &datum);
22515
0
}
22516
22517
/* Sets the "lldp" column's value from the "Interface" table in 'row'
22518
 * to 'lldp'.
22519
 *
22520
 * The caller retains ownership of 'lldp' and everything in it. */
22521
void
22522
ovsrec_interface_set_lldp(const struct ovsrec_interface *row, const struct smap *lldp)
22523
0
{
22524
0
    struct ovsdb_datum datum;
22525
22526
0
    if (lldp) {
22527
0
        ovsdb_datum_from_smap(&datum, lldp);
22528
0
    } else {
22529
0
        ovsdb_datum_init_empty(&datum);
22530
0
    }
22531
0
    ovsdb_idl_txn_write(&row->header_,
22532
0
                        &ovsrec_interface_col_lldp,
22533
0
                        &datum);
22534
0
}
22535
22536
22537
/* Sets the "mac" column from the "Interface" table in 'row' to
22538
 * the 'mac' set.
22539
 *
22540
 * If "mac" is null, the column will be the empty set,
22541
 * otherwise it will contain the specified value.
22542
 *
22543
 * The caller retains ownership of the arguments. */
22544
void
22545
ovsrec_interface_set_mac(const struct ovsrec_interface *row, const char *mac)
22546
0
{
22547
0
    struct ovsdb_datum datum;
22548
22549
0
    datum.refcnt = NULL;
22550
22551
0
    if (mac) {
22552
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22553
0
        datum.n = 1;
22554
0
        datum.keys = key;
22555
0
        key->s = ovsdb_atom_string_create(mac);
22556
0
    } else {
22557
0
        datum.n = 0;
22558
0
        datum.keys = NULL;
22559
0
    }
22560
0
    datum.values = NULL;
22561
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_mac, &datum);
22562
0
}
22563
22564
/* Sets the "mac_in_use" column from the "Interface" table in 'row' to
22565
 * the 'mac_in_use' set.
22566
 *
22567
 * If "mac_in_use" is null, the column will be the empty set,
22568
 * otherwise it will contain the specified value.
22569
 *
22570
 * The caller retains ownership of the arguments. */
22571
void
22572
ovsrec_interface_set_mac_in_use(const struct ovsrec_interface *row, const char *mac_in_use)
22573
0
{
22574
0
    struct ovsdb_datum datum;
22575
22576
0
    datum.refcnt = NULL;
22577
22578
0
    if (mac_in_use) {
22579
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22580
0
        datum.n = 1;
22581
0
        datum.keys = key;
22582
0
        key->s = ovsdb_atom_string_create(mac_in_use);
22583
0
    } else {
22584
0
        datum.n = 0;
22585
0
        datum.keys = NULL;
22586
0
    }
22587
0
    datum.values = NULL;
22588
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_mac_in_use, &datum);
22589
0
}
22590
22591
/* Sets the "mtu" column from the "Interface" table in 'row' to
22592
 * the 'mtu' set with 'n_mtu' entries.
22593
 *
22594
 * 'n_mtu' may be 0 or 1; if it is 0, then 'mtu'
22595
 * may be NULL.
22596
 *
22597
 * The caller retains ownership of the arguments. */
22598
void
22599
ovsrec_interface_set_mtu(const struct ovsrec_interface *row, const int64_t *mtu, size_t n_mtu)
22600
0
{
22601
0
    struct ovsdb_datum datum;
22602
22603
0
    datum.refcnt = NULL;
22604
22605
0
    if (n_mtu) {
22606
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22607
0
        datum.n = 1;
22608
0
        datum.keys = key;
22609
0
        key->integer = *mtu;
22610
0
    } else {
22611
0
        datum.n = 0;
22612
0
        datum.keys = NULL;
22613
0
    }
22614
0
    datum.values = NULL;
22615
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_mtu, &datum);
22616
0
}
22617
22618
/* Sets the "mtu_request" column from the "Interface" table in 'row' to
22619
 * the 'mtu_request' set with 'n_mtu_request' entries.
22620
 *
22621
 * 'n_mtu_request' may be 0 or 1; if it is 0, then 'mtu_request'
22622
 * may be NULL.
22623
 *
22624
 * Argument constraints: at least 1
22625
 *
22626
 * The caller retains ownership of the arguments. */
22627
void
22628
ovsrec_interface_set_mtu_request(const struct ovsrec_interface *row, const int64_t *mtu_request, size_t n_mtu_request)
22629
0
{
22630
0
    struct ovsdb_datum datum;
22631
22632
0
    datum.refcnt = NULL;
22633
22634
0
    if (n_mtu_request) {
22635
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22636
0
        datum.n = 1;
22637
0
        datum.keys = key;
22638
0
        key->integer = *mtu_request;
22639
0
    } else {
22640
0
        datum.n = 0;
22641
0
        datum.keys = NULL;
22642
0
    }
22643
0
    datum.values = NULL;
22644
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_mtu_request, &datum);
22645
0
}
22646
22647
/* Sets the "name" column from the "Interface" table in 'row' to
22648
 * 'name'.
22649
 *
22650
 * The caller retains ownership of the arguments. */
22651
void
22652
ovsrec_interface_set_name(const struct ovsrec_interface *row, const char *name)
22653
0
{
22654
0
    struct ovsdb_datum datum;
22655
22656
0
    datum.refcnt = NULL;
22657
22658
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
22659
22660
0
    datum.n = 1;
22661
0
    datum.keys = key;
22662
0
    key->s = ovsdb_atom_string_create(name);
22663
0
    datum.values = NULL;
22664
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_name, &datum);
22665
0
}
22666
22667
/* Sets the "ofport" column from the "Interface" table in 'row' to
22668
 * the 'ofport' set with 'n_ofport' entries.
22669
 *
22670
 * 'n_ofport' may be 0 or 1; if it is 0, then 'ofport'
22671
 * may be NULL.
22672
 *
22673
 * The caller retains ownership of the arguments. */
22674
void
22675
ovsrec_interface_set_ofport(const struct ovsrec_interface *row, const int64_t *ofport, size_t n_ofport)
22676
0
{
22677
0
    struct ovsdb_datum datum;
22678
22679
0
    datum.refcnt = NULL;
22680
22681
0
    if (n_ofport) {
22682
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22683
0
        datum.n = 1;
22684
0
        datum.keys = key;
22685
0
        key->integer = *ofport;
22686
0
    } else {
22687
0
        datum.n = 0;
22688
0
        datum.keys = NULL;
22689
0
    }
22690
0
    datum.values = NULL;
22691
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ofport, &datum);
22692
0
}
22693
22694
/* Sets the "ofport_request" column from the "Interface" table in 'row' to
22695
 * the 'ofport_request' set with 'n_ofport_request' entries.
22696
 *
22697
 * 'n_ofport_request' may be 0 or 1; if it is 0, then 'ofport_request'
22698
 * may be NULL.
22699
 *
22700
 * Argument constraints: in range 1 to 65,279
22701
 *
22702
 * The caller retains ownership of the arguments. */
22703
void
22704
ovsrec_interface_set_ofport_request(const struct ovsrec_interface *row, const int64_t *ofport_request, size_t n_ofport_request)
22705
0
{
22706
0
    struct ovsdb_datum datum;
22707
22708
0
    datum.refcnt = NULL;
22709
22710
0
    if (n_ofport_request) {
22711
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22712
0
        datum.n = 1;
22713
0
        datum.keys = key;
22714
0
        key->integer = *ofport_request;
22715
0
    } else {
22716
0
        datum.n = 0;
22717
0
        datum.keys = NULL;
22718
0
    }
22719
0
    datum.values = NULL;
22720
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ofport_request, &datum);
22721
0
}
22722
22723
/* Sets the "options" column's value from the "Interface" table in 'row'
22724
 * to 'options'.
22725
 *
22726
 * The caller retains ownership of 'options' and everything in it. */
22727
void
22728
ovsrec_interface_set_options(const struct ovsrec_interface *row, const struct smap *options)
22729
0
{
22730
0
    struct ovsdb_datum datum;
22731
22732
0
    if (options) {
22733
0
        ovsdb_datum_from_smap(&datum, options);
22734
0
    } else {
22735
0
        ovsdb_datum_init_empty(&datum);
22736
0
    }
22737
0
    ovsdb_idl_txn_write(&row->header_,
22738
0
                        &ovsrec_interface_col_options,
22739
0
                        &datum);
22740
0
}
22741
22742
22743
/* Sets the "other_config" column's value from the "Interface" table in 'row'
22744
 * to 'other_config'.
22745
 *
22746
 * The caller retains ownership of 'other_config' and everything in it. */
22747
void
22748
ovsrec_interface_set_other_config(const struct ovsrec_interface *row, const struct smap *other_config)
22749
0
{
22750
0
    struct ovsdb_datum datum;
22751
22752
0
    if (other_config) {
22753
0
        ovsdb_datum_from_smap(&datum, other_config);
22754
0
    } else {
22755
0
        ovsdb_datum_init_empty(&datum);
22756
0
    }
22757
0
    ovsdb_idl_txn_write(&row->header_,
22758
0
                        &ovsrec_interface_col_other_config,
22759
0
                        &datum);
22760
0
}
22761
22762
22763
/* Sets the "statistics" column from the "Interface" table in 'row' to
22764
 * the map with keys 'key_statistics' and values 'value_statistics'
22765
 * with 'n_statistics' entries.
22766
 *
22767
 * The caller retains ownership of the arguments. */
22768
void
22769
ovsrec_interface_set_statistics(const struct ovsrec_interface *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
22770
0
{
22771
0
    struct ovsdb_datum datum;
22772
22773
0
    datum.refcnt = NULL;
22774
22775
0
    datum.n = n_statistics;
22776
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
22777
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
22778
0
    for (size_t i = 0; i < n_statistics; i++) {
22779
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
22780
0
        datum.values[i].integer = value_statistics[i];
22781
0
    }
22782
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_statistics, &datum);
22783
0
}
22784
22785
/* Sets the "status" column's value from the "Interface" table in 'row'
22786
 * to 'status'.
22787
 *
22788
 * The caller retains ownership of 'status' and everything in it. */
22789
void
22790
ovsrec_interface_set_status(const struct ovsrec_interface *row, const struct smap *status)
22791
0
{
22792
0
    struct ovsdb_datum datum;
22793
22794
0
    if (status) {
22795
0
        ovsdb_datum_from_smap(&datum, status);
22796
0
    } else {
22797
0
        ovsdb_datum_init_empty(&datum);
22798
0
    }
22799
0
    ovsdb_idl_txn_write(&row->header_,
22800
0
                        &ovsrec_interface_col_status,
22801
0
                        &datum);
22802
0
}
22803
22804
22805
/* Sets the "type" column from the "Interface" table in 'row' to
22806
 * 'type'.
22807
 *
22808
 * The caller retains ownership of the arguments. */
22809
void
22810
ovsrec_interface_set_type(const struct ovsrec_interface *row, const char *type)
22811
0
{
22812
0
    struct ovsdb_datum datum;
22813
22814
0
    datum.refcnt = NULL;
22815
22816
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
22817
22818
0
    datum.n = 1;
22819
0
    datum.keys = key;
22820
0
    key->s = ovsdb_atom_string_create(type);
22821
0
    datum.values = NULL;
22822
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_type, &datum);
22823
0
}
22824
22825
/* Adds the value 'new_value' to the "admin_state" set column from the "Interface" table
22826
 * in 'row'.
22827
 *
22828
 */
22829
void
22830
ovsrec_interface_update_admin_state_addvalue(const struct ovsrec_interface *row, const char *new_value)
22831
0
{
22832
0
    struct ovsdb_datum *datum;
22833
22834
0
    datum = xmalloc(sizeof *datum);
22835
0
    datum->n = 1;
22836
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22837
0
    datum->values = NULL;
22838
0
    datum->refcnt = NULL;
22839
22840
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
22841
22842
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22843
0
                                    &ovsrec_interface_col_admin_state,
22844
0
                                    datum);
22845
0
}
22846
22847
/* Deletes the value 'delete_value' from the "admin_state" set column from the
22848
 * "Interface" table in 'row'.
22849
 *
22850
 */
22851
void
22852
ovsrec_interface_update_admin_state_delvalue(const struct ovsrec_interface *row, const char *delete_value)
22853
0
{
22854
0
    struct ovsdb_datum *datum;
22855
22856
0
    datum = xmalloc(sizeof *datum);
22857
0
    datum->n = 1;
22858
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22859
0
    datum->values = NULL;
22860
0
    datum->refcnt = NULL;
22861
22862
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
22863
22864
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22865
0
                                    &ovsrec_interface_col_admin_state,
22866
0
                                    datum);
22867
0
}
22868
22869
/* Sets an element of the "bfd" map column from the "Interface" table in 'row'
22870
 * to 'new_value' given the key value 'new_key'.
22871
 *
22872
 */
22873
void
22874
ovsrec_interface_update_bfd_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
22875
0
{
22876
0
    struct ovsdb_datum *datum;
22877
22878
0
    datum = xmalloc(sizeof *datum);
22879
0
    datum->n = 1;
22880
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22881
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
22882
0
    datum->refcnt = NULL;
22883
22884
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
22885
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
22886
22887
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
22888
0
                                    &ovsrec_interface_col_bfd,
22889
0
                                    datum);
22890
0
}
22891
22892
/* Deletes an element of the "bfd" map column from the "Interface" table in 'row'
22893
 * given the key value 'delete_key'.
22894
 *
22895
 */
22896
void
22897
ovsrec_interface_update_bfd_delkey(const struct ovsrec_interface *row, const char *delete_key)
22898
0
{
22899
0
    struct ovsdb_datum *datum;
22900
22901
0
    datum = xmalloc(sizeof *datum);
22902
0
    datum->n = 1;
22903
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22904
0
    datum->values = NULL;
22905
0
    datum->refcnt = NULL;
22906
22907
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
22908
22909
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
22910
0
                                    &ovsrec_interface_col_bfd,
22911
0
                                    datum);
22912
0
}
22913
22914
/* Sets an element of the "bfd_status" map column from the "Interface" table in 'row'
22915
 * to 'new_value' given the key value 'new_key'.
22916
 *
22917
 */
22918
void
22919
ovsrec_interface_update_bfd_status_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
22920
0
{
22921
0
    struct ovsdb_datum *datum;
22922
22923
0
    datum = xmalloc(sizeof *datum);
22924
0
    datum->n = 1;
22925
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22926
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
22927
0
    datum->refcnt = NULL;
22928
22929
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
22930
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
22931
22932
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
22933
0
                                    &ovsrec_interface_col_bfd_status,
22934
0
                                    datum);
22935
0
}
22936
22937
/* Deletes an element of the "bfd_status" map column from the "Interface" table in 'row'
22938
 * given the key value 'delete_key'.
22939
 *
22940
 */
22941
void
22942
ovsrec_interface_update_bfd_status_delkey(const struct ovsrec_interface *row, const char *delete_key)
22943
0
{
22944
0
    struct ovsdb_datum *datum;
22945
22946
0
    datum = xmalloc(sizeof *datum);
22947
0
    datum->n = 1;
22948
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22949
0
    datum->values = NULL;
22950
0
    datum->refcnt = NULL;
22951
22952
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
22953
22954
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
22955
0
                                    &ovsrec_interface_col_bfd_status,
22956
0
                                    datum);
22957
0
}
22958
22959
/* Adds the value 'new_value' to the "cfm_fault" set column from the "Interface" table
22960
 * in 'row'.
22961
 *
22962
 */
22963
void
22964
ovsrec_interface_update_cfm_fault_addvalue(const struct ovsrec_interface *row, bool new_value)
22965
0
{
22966
0
    struct ovsdb_datum *datum;
22967
22968
0
    datum = xmalloc(sizeof *datum);
22969
0
    datum->n = 1;
22970
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22971
0
    datum->values = NULL;
22972
0
    datum->refcnt = NULL;
22973
22974
0
    datum->keys[0].boolean = new_value;
22975
22976
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22977
0
                                    &ovsrec_interface_col_cfm_fault,
22978
0
                                    datum);
22979
0
}
22980
22981
/* Deletes the value 'delete_value' from the "cfm_fault" set column from the
22982
 * "Interface" table in 'row'.
22983
 *
22984
 */
22985
void
22986
ovsrec_interface_update_cfm_fault_delvalue(const struct ovsrec_interface *row, bool delete_value)
22987
0
{
22988
0
    struct ovsdb_datum *datum;
22989
22990
0
    datum = xmalloc(sizeof *datum);
22991
0
    datum->n = 1;
22992
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22993
0
    datum->values = NULL;
22994
0
    datum->refcnt = NULL;
22995
22996
0
    datum->keys[0].boolean = delete_value;
22997
22998
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22999
0
                                    &ovsrec_interface_col_cfm_fault,
23000
0
                                    datum);
23001
0
}
23002
23003
/* Adds the value 'new_value' to the "cfm_fault_status" set column from the "Interface" table
23004
 * in 'row'.
23005
 *
23006
 */
23007
void
23008
ovsrec_interface_update_cfm_fault_status_addvalue(const struct ovsrec_interface *row, const char *new_value)
23009
0
{
23010
0
    struct ovsdb_datum *datum;
23011
23012
0
    datum = xmalloc(sizeof *datum);
23013
0
    datum->n = 1;
23014
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23015
0
    datum->values = NULL;
23016
0
    datum->refcnt = NULL;
23017
23018
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
23019
23020
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23021
0
                                    &ovsrec_interface_col_cfm_fault_status,
23022
0
                                    datum);
23023
0
}
23024
23025
/* Deletes the value 'delete_value' from the "cfm_fault_status" set column from the
23026
 * "Interface" table in 'row'.
23027
 *
23028
 */
23029
void
23030
ovsrec_interface_update_cfm_fault_status_delvalue(const struct ovsrec_interface *row, const char *delete_value)
23031
0
{
23032
0
    struct ovsdb_datum *datum;
23033
23034
0
    datum = xmalloc(sizeof *datum);
23035
0
    datum->n = 1;
23036
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23037
0
    datum->values = NULL;
23038
0
    datum->refcnt = NULL;
23039
23040
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
23041
23042
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23043
0
                                    &ovsrec_interface_col_cfm_fault_status,
23044
0
                                    datum);
23045
0
}
23046
23047
/* Adds the value 'new_value' to the "cfm_flap_count" set column from the "Interface" table
23048
 * in 'row'.
23049
 *
23050
 */
23051
void
23052
ovsrec_interface_update_cfm_flap_count_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23053
0
{
23054
0
    struct ovsdb_datum *datum;
23055
23056
0
    datum = xmalloc(sizeof *datum);
23057
0
    datum->n = 1;
23058
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23059
0
    datum->values = NULL;
23060
0
    datum->refcnt = NULL;
23061
23062
0
    datum->keys[0].integer = new_value;
23063
23064
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23065
0
                                    &ovsrec_interface_col_cfm_flap_count,
23066
0
                                    datum);
23067
0
}
23068
23069
/* Deletes the value 'delete_value' from the "cfm_flap_count" set column from the
23070
 * "Interface" table in 'row'.
23071
 *
23072
 */
23073
void
23074
ovsrec_interface_update_cfm_flap_count_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23075
0
{
23076
0
    struct ovsdb_datum *datum;
23077
23078
0
    datum = xmalloc(sizeof *datum);
23079
0
    datum->n = 1;
23080
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23081
0
    datum->values = NULL;
23082
0
    datum->refcnt = NULL;
23083
23084
0
    datum->keys[0].integer = delete_value;
23085
23086
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23087
0
                                    &ovsrec_interface_col_cfm_flap_count,
23088
0
                                    datum);
23089
0
}
23090
23091
/* Adds the value 'new_value' to the "cfm_health" set column from the "Interface" table
23092
 * in 'row'.
23093
 *
23094
 */
23095
void
23096
ovsrec_interface_update_cfm_health_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23097
0
{
23098
0
    struct ovsdb_datum *datum;
23099
23100
0
    datum = xmalloc(sizeof *datum);
23101
0
    datum->n = 1;
23102
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23103
0
    datum->values = NULL;
23104
0
    datum->refcnt = NULL;
23105
23106
0
    datum->keys[0].integer = new_value;
23107
23108
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23109
0
                                    &ovsrec_interface_col_cfm_health,
23110
0
                                    datum);
23111
0
}
23112
23113
/* Deletes the value 'delete_value' from the "cfm_health" set column from the
23114
 * "Interface" table in 'row'.
23115
 *
23116
 */
23117
void
23118
ovsrec_interface_update_cfm_health_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23119
0
{
23120
0
    struct ovsdb_datum *datum;
23121
23122
0
    datum = xmalloc(sizeof *datum);
23123
0
    datum->n = 1;
23124
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23125
0
    datum->values = NULL;
23126
0
    datum->refcnt = NULL;
23127
23128
0
    datum->keys[0].integer = delete_value;
23129
23130
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23131
0
                                    &ovsrec_interface_col_cfm_health,
23132
0
                                    datum);
23133
0
}
23134
23135
/* Adds the value 'new_value' to the "cfm_mpid" set column from the "Interface" table
23136
 * in 'row'.
23137
 *
23138
 */
23139
void
23140
ovsrec_interface_update_cfm_mpid_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23141
0
{
23142
0
    struct ovsdb_datum *datum;
23143
23144
0
    datum = xmalloc(sizeof *datum);
23145
0
    datum->n = 1;
23146
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23147
0
    datum->values = NULL;
23148
0
    datum->refcnt = NULL;
23149
23150
0
    datum->keys[0].integer = new_value;
23151
23152
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23153
0
                                    &ovsrec_interface_col_cfm_mpid,
23154
0
                                    datum);
23155
0
}
23156
23157
/* Deletes the value 'delete_value' from the "cfm_mpid" set column from the
23158
 * "Interface" table in 'row'.
23159
 *
23160
 */
23161
void
23162
ovsrec_interface_update_cfm_mpid_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23163
0
{
23164
0
    struct ovsdb_datum *datum;
23165
23166
0
    datum = xmalloc(sizeof *datum);
23167
0
    datum->n = 1;
23168
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23169
0
    datum->values = NULL;
23170
0
    datum->refcnt = NULL;
23171
23172
0
    datum->keys[0].integer = delete_value;
23173
23174
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23175
0
                                    &ovsrec_interface_col_cfm_mpid,
23176
0
                                    datum);
23177
0
}
23178
23179
/* Adds the value 'new_value' to the "cfm_remote_mpids" set column from the "Interface" table
23180
 * in 'row'.
23181
 *
23182
 */
23183
void
23184
ovsrec_interface_update_cfm_remote_mpids_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23185
0
{
23186
0
    struct ovsdb_datum *datum;
23187
23188
0
    datum = xmalloc(sizeof *datum);
23189
0
    datum->n = 1;
23190
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23191
0
    datum->values = NULL;
23192
0
    datum->refcnt = NULL;
23193
23194
0
    datum->keys[0].integer = new_value;
23195
23196
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23197
0
                                    &ovsrec_interface_col_cfm_remote_mpids,
23198
0
                                    datum);
23199
0
}
23200
23201
/* Deletes the value 'delete_value' from the "cfm_remote_mpids" set column from the
23202
 * "Interface" table in 'row'.
23203
 *
23204
 */
23205
void
23206
ovsrec_interface_update_cfm_remote_mpids_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23207
0
{
23208
0
    struct ovsdb_datum *datum;
23209
23210
0
    datum = xmalloc(sizeof *datum);
23211
0
    datum->n = 1;
23212
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23213
0
    datum->values = NULL;
23214
0
    datum->refcnt = NULL;
23215
23216
0
    datum->keys[0].integer = delete_value;
23217
23218
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23219
0
                                    &ovsrec_interface_col_cfm_remote_mpids,
23220
0
                                    datum);
23221
0
}
23222
23223
/* Adds the value 'new_value' to the "cfm_remote_opstate" set column from the "Interface" table
23224
 * in 'row'.
23225
 *
23226
 */
23227
void
23228
ovsrec_interface_update_cfm_remote_opstate_addvalue(const struct ovsrec_interface *row, const char *new_value)
23229
0
{
23230
0
    struct ovsdb_datum *datum;
23231
23232
0
    datum = xmalloc(sizeof *datum);
23233
0
    datum->n = 1;
23234
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23235
0
    datum->values = NULL;
23236
0
    datum->refcnt = NULL;
23237
23238
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
23239
23240
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23241
0
                                    &ovsrec_interface_col_cfm_remote_opstate,
23242
0
                                    datum);
23243
0
}
23244
23245
/* Deletes the value 'delete_value' from the "cfm_remote_opstate" set column from the
23246
 * "Interface" table in 'row'.
23247
 *
23248
 */
23249
void
23250
ovsrec_interface_update_cfm_remote_opstate_delvalue(const struct ovsrec_interface *row, const char *delete_value)
23251
0
{
23252
0
    struct ovsdb_datum *datum;
23253
23254
0
    datum = xmalloc(sizeof *datum);
23255
0
    datum->n = 1;
23256
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23257
0
    datum->values = NULL;
23258
0
    datum->refcnt = NULL;
23259
23260
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
23261
23262
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23263
0
                                    &ovsrec_interface_col_cfm_remote_opstate,
23264
0
                                    datum);
23265
0
}
23266
23267
/* Adds the value 'new_value' to the "duplex" set column from the "Interface" table
23268
 * in 'row'.
23269
 *
23270
 */
23271
void
23272
ovsrec_interface_update_duplex_addvalue(const struct ovsrec_interface *row, const char *new_value)
23273
0
{
23274
0
    struct ovsdb_datum *datum;
23275
23276
0
    datum = xmalloc(sizeof *datum);
23277
0
    datum->n = 1;
23278
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23279
0
    datum->values = NULL;
23280
0
    datum->refcnt = NULL;
23281
23282
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
23283
23284
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23285
0
                                    &ovsrec_interface_col_duplex,
23286
0
                                    datum);
23287
0
}
23288
23289
/* Deletes the value 'delete_value' from the "duplex" set column from the
23290
 * "Interface" table in 'row'.
23291
 *
23292
 */
23293
void
23294
ovsrec_interface_update_duplex_delvalue(const struct ovsrec_interface *row, const char *delete_value)
23295
0
{
23296
0
    struct ovsdb_datum *datum;
23297
23298
0
    datum = xmalloc(sizeof *datum);
23299
0
    datum->n = 1;
23300
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23301
0
    datum->values = NULL;
23302
0
    datum->refcnt = NULL;
23303
23304
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
23305
23306
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23307
0
                                    &ovsrec_interface_col_duplex,
23308
0
                                    datum);
23309
0
}
23310
23311
/* Adds the value 'new_value' to the "error" set column from the "Interface" table
23312
 * in 'row'.
23313
 *
23314
 */
23315
void
23316
ovsrec_interface_update_error_addvalue(const struct ovsrec_interface *row, const char *new_value)
23317
0
{
23318
0
    struct ovsdb_datum *datum;
23319
23320
0
    datum = xmalloc(sizeof *datum);
23321
0
    datum->n = 1;
23322
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23323
0
    datum->values = NULL;
23324
0
    datum->refcnt = NULL;
23325
23326
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
23327
23328
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23329
0
                                    &ovsrec_interface_col_error,
23330
0
                                    datum);
23331
0
}
23332
23333
/* Deletes the value 'delete_value' from the "error" set column from the
23334
 * "Interface" table in 'row'.
23335
 *
23336
 */
23337
void
23338
ovsrec_interface_update_error_delvalue(const struct ovsrec_interface *row, const char *delete_value)
23339
0
{
23340
0
    struct ovsdb_datum *datum;
23341
23342
0
    datum = xmalloc(sizeof *datum);
23343
0
    datum->n = 1;
23344
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23345
0
    datum->values = NULL;
23346
0
    datum->refcnt = NULL;
23347
23348
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
23349
23350
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23351
0
                                    &ovsrec_interface_col_error,
23352
0
                                    datum);
23353
0
}
23354
23355
/* Sets an element of the "external_ids" map column from the "Interface" table in 'row'
23356
 * to 'new_value' given the key value 'new_key'.
23357
 *
23358
 */
23359
void
23360
ovsrec_interface_update_external_ids_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
23361
0
{
23362
0
    struct ovsdb_datum *datum;
23363
23364
0
    datum = xmalloc(sizeof *datum);
23365
0
    datum->n = 1;
23366
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
23367
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
23368
0
    datum->refcnt = NULL;
23369
23370
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
23371
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
23372
23373
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
23374
0
                                    &ovsrec_interface_col_external_ids,
23375
0
                                    datum);
23376
0
}
23377
23378
/* Deletes an element of the "external_ids" map column from the "Interface" table in 'row'
23379
 * given the key value 'delete_key'.
23380
 *
23381
 */
23382
void
23383
ovsrec_interface_update_external_ids_delkey(const struct ovsrec_interface *row, const char *delete_key)
23384
0
{
23385
0
    struct ovsdb_datum *datum;
23386
23387
0
    datum = xmalloc(sizeof *datum);
23388
0
    datum->n = 1;
23389
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
23390
0
    datum->values = NULL;
23391
0
    datum->refcnt = NULL;
23392
23393
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
23394
23395
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
23396
0
                                    &ovsrec_interface_col_external_ids,
23397
0
                                    datum);
23398
0
}
23399
23400
/* Adds the value 'new_value' to the "ifindex" set column from the "Interface" table
23401
 * in 'row'.
23402
 *
23403
 */
23404
void
23405
ovsrec_interface_update_ifindex_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23406
0
{
23407
0
    struct ovsdb_datum *datum;
23408
23409
0
    datum = xmalloc(sizeof *datum);
23410
0
    datum->n = 1;
23411
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23412
0
    datum->values = NULL;
23413
0
    datum->refcnt = NULL;
23414
23415
0
    datum->keys[0].integer = new_value;
23416
23417
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23418
0
                                    &ovsrec_interface_col_ifindex,
23419
0
                                    datum);
23420
0
}
23421
23422
/* Deletes the value 'delete_value' from the "ifindex" set column from the
23423
 * "Interface" table in 'row'.
23424
 *
23425
 */
23426
void
23427
ovsrec_interface_update_ifindex_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23428
0
{
23429
0
    struct ovsdb_datum *datum;
23430
23431
0
    datum = xmalloc(sizeof *datum);
23432
0
    datum->n = 1;
23433
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23434
0
    datum->values = NULL;
23435
0
    datum->refcnt = NULL;
23436
23437
0
    datum->keys[0].integer = delete_value;
23438
23439
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23440
0
                                    &ovsrec_interface_col_ifindex,
23441
0
                                    datum);
23442
0
}
23443
23444
/* Adds the value 'new_value' to the "lacp_current" set column from the "Interface" table
23445
 * in 'row'.
23446
 *
23447
 */
23448
void
23449
ovsrec_interface_update_lacp_current_addvalue(const struct ovsrec_interface *row, bool new_value)
23450
0
{
23451
0
    struct ovsdb_datum *datum;
23452
23453
0
    datum = xmalloc(sizeof *datum);
23454
0
    datum->n = 1;
23455
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23456
0
    datum->values = NULL;
23457
0
    datum->refcnt = NULL;
23458
23459
0
    datum->keys[0].boolean = new_value;
23460
23461
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23462
0
                                    &ovsrec_interface_col_lacp_current,
23463
0
                                    datum);
23464
0
}
23465
23466
/* Deletes the value 'delete_value' from the "lacp_current" set column from the
23467
 * "Interface" table in 'row'.
23468
 *
23469
 */
23470
void
23471
ovsrec_interface_update_lacp_current_delvalue(const struct ovsrec_interface *row, bool delete_value)
23472
0
{
23473
0
    struct ovsdb_datum *datum;
23474
23475
0
    datum = xmalloc(sizeof *datum);
23476
0
    datum->n = 1;
23477
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23478
0
    datum->values = NULL;
23479
0
    datum->refcnt = NULL;
23480
23481
0
    datum->keys[0].boolean = delete_value;
23482
23483
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23484
0
                                    &ovsrec_interface_col_lacp_current,
23485
0
                                    datum);
23486
0
}
23487
23488
/* Adds the value 'new_value' to the "link_resets" set column from the "Interface" table
23489
 * in 'row'.
23490
 *
23491
 */
23492
void
23493
ovsrec_interface_update_link_resets_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23494
0
{
23495
0
    struct ovsdb_datum *datum;
23496
23497
0
    datum = xmalloc(sizeof *datum);
23498
0
    datum->n = 1;
23499
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23500
0
    datum->values = NULL;
23501
0
    datum->refcnt = NULL;
23502
23503
0
    datum->keys[0].integer = new_value;
23504
23505
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23506
0
                                    &ovsrec_interface_col_link_resets,
23507
0
                                    datum);
23508
0
}
23509
23510
/* Deletes the value 'delete_value' from the "link_resets" set column from the
23511
 * "Interface" table in 'row'.
23512
 *
23513
 */
23514
void
23515
ovsrec_interface_update_link_resets_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23516
0
{
23517
0
    struct ovsdb_datum *datum;
23518
23519
0
    datum = xmalloc(sizeof *datum);
23520
0
    datum->n = 1;
23521
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23522
0
    datum->values = NULL;
23523
0
    datum->refcnt = NULL;
23524
23525
0
    datum->keys[0].integer = delete_value;
23526
23527
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23528
0
                                    &ovsrec_interface_col_link_resets,
23529
0
                                    datum);
23530
0
}
23531
23532
/* Adds the value 'new_value' to the "link_speed" set column from the "Interface" table
23533
 * in 'row'.
23534
 *
23535
 */
23536
void
23537
ovsrec_interface_update_link_speed_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23538
0
{
23539
0
    struct ovsdb_datum *datum;
23540
23541
0
    datum = xmalloc(sizeof *datum);
23542
0
    datum->n = 1;
23543
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23544
0
    datum->values = NULL;
23545
0
    datum->refcnt = NULL;
23546
23547
0
    datum->keys[0].integer = new_value;
23548
23549
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23550
0
                                    &ovsrec_interface_col_link_speed,
23551
0
                                    datum);
23552
0
}
23553
23554
/* Deletes the value 'delete_value' from the "link_speed" set column from the
23555
 * "Interface" table in 'row'.
23556
 *
23557
 */
23558
void
23559
ovsrec_interface_update_link_speed_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23560
0
{
23561
0
    struct ovsdb_datum *datum;
23562
23563
0
    datum = xmalloc(sizeof *datum);
23564
0
    datum->n = 1;
23565
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23566
0
    datum->values = NULL;
23567
0
    datum->refcnt = NULL;
23568
23569
0
    datum->keys[0].integer = delete_value;
23570
23571
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23572
0
                                    &ovsrec_interface_col_link_speed,
23573
0
                                    datum);
23574
0
}
23575
23576
/* Adds the value 'new_value' to the "link_state" set column from the "Interface" table
23577
 * in 'row'.
23578
 *
23579
 */
23580
void
23581
ovsrec_interface_update_link_state_addvalue(const struct ovsrec_interface *row, const char *new_value)
23582
0
{
23583
0
    struct ovsdb_datum *datum;
23584
23585
0
    datum = xmalloc(sizeof *datum);
23586
0
    datum->n = 1;
23587
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23588
0
    datum->values = NULL;
23589
0
    datum->refcnt = NULL;
23590
23591
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
23592
23593
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23594
0
                                    &ovsrec_interface_col_link_state,
23595
0
                                    datum);
23596
0
}
23597
23598
/* Deletes the value 'delete_value' from the "link_state" set column from the
23599
 * "Interface" table in 'row'.
23600
 *
23601
 */
23602
void
23603
ovsrec_interface_update_link_state_delvalue(const struct ovsrec_interface *row, const char *delete_value)
23604
0
{
23605
0
    struct ovsdb_datum *datum;
23606
23607
0
    datum = xmalloc(sizeof *datum);
23608
0
    datum->n = 1;
23609
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23610
0
    datum->values = NULL;
23611
0
    datum->refcnt = NULL;
23612
23613
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
23614
23615
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23616
0
                                    &ovsrec_interface_col_link_state,
23617
0
                                    datum);
23618
0
}
23619
23620
/* Sets an element of the "lldp" map column from the "Interface" table in 'row'
23621
 * to 'new_value' given the key value 'new_key'.
23622
 *
23623
 */
23624
void
23625
ovsrec_interface_update_lldp_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
23626
0
{
23627
0
    struct ovsdb_datum *datum;
23628
23629
0
    datum = xmalloc(sizeof *datum);
23630
0
    datum->n = 1;
23631
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
23632
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
23633
0
    datum->refcnt = NULL;
23634
23635
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
23636
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
23637
23638
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
23639
0
                                    &ovsrec_interface_col_lldp,
23640
0
                                    datum);
23641
0
}
23642
23643
/* Deletes an element of the "lldp" map column from the "Interface" table in 'row'
23644
 * given the key value 'delete_key'.
23645
 *
23646
 */
23647
void
23648
ovsrec_interface_update_lldp_delkey(const struct ovsrec_interface *row, const char *delete_key)
23649
0
{
23650
0
    struct ovsdb_datum *datum;
23651
23652
0
    datum = xmalloc(sizeof *datum);
23653
0
    datum->n = 1;
23654
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
23655
0
    datum->values = NULL;
23656
0
    datum->refcnt = NULL;
23657
23658
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
23659
23660
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
23661
0
                                    &ovsrec_interface_col_lldp,
23662
0
                                    datum);
23663
0
}
23664
23665
/* Adds the value 'new_value' to the "mac" set column from the "Interface" table
23666
 * in 'row'.
23667
 *
23668
 */
23669
void
23670
ovsrec_interface_update_mac_addvalue(const struct ovsrec_interface *row, const char *new_value)
23671
0
{
23672
0
    struct ovsdb_datum *datum;
23673
23674
0
    datum = xmalloc(sizeof *datum);
23675
0
    datum->n = 1;
23676
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23677
0
    datum->values = NULL;
23678
0
    datum->refcnt = NULL;
23679
23680
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
23681
23682
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23683
0
                                    &ovsrec_interface_col_mac,
23684
0
                                    datum);
23685
0
}
23686
23687
/* Deletes the value 'delete_value' from the "mac" set column from the
23688
 * "Interface" table in 'row'.
23689
 *
23690
 */
23691
void
23692
ovsrec_interface_update_mac_delvalue(const struct ovsrec_interface *row, const char *delete_value)
23693
0
{
23694
0
    struct ovsdb_datum *datum;
23695
23696
0
    datum = xmalloc(sizeof *datum);
23697
0
    datum->n = 1;
23698
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23699
0
    datum->values = NULL;
23700
0
    datum->refcnt = NULL;
23701
23702
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
23703
23704
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23705
0
                                    &ovsrec_interface_col_mac,
23706
0
                                    datum);
23707
0
}
23708
23709
/* Adds the value 'new_value' to the "mac_in_use" set column from the "Interface" table
23710
 * in 'row'.
23711
 *
23712
 */
23713
void
23714
ovsrec_interface_update_mac_in_use_addvalue(const struct ovsrec_interface *row, const char *new_value)
23715
0
{
23716
0
    struct ovsdb_datum *datum;
23717
23718
0
    datum = xmalloc(sizeof *datum);
23719
0
    datum->n = 1;
23720
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23721
0
    datum->values = NULL;
23722
0
    datum->refcnt = NULL;
23723
23724
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
23725
23726
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23727
0
                                    &ovsrec_interface_col_mac_in_use,
23728
0
                                    datum);
23729
0
}
23730
23731
/* Deletes the value 'delete_value' from the "mac_in_use" set column from the
23732
 * "Interface" table in 'row'.
23733
 *
23734
 */
23735
void
23736
ovsrec_interface_update_mac_in_use_delvalue(const struct ovsrec_interface *row, const char *delete_value)
23737
0
{
23738
0
    struct ovsdb_datum *datum;
23739
23740
0
    datum = xmalloc(sizeof *datum);
23741
0
    datum->n = 1;
23742
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23743
0
    datum->values = NULL;
23744
0
    datum->refcnt = NULL;
23745
23746
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
23747
23748
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23749
0
                                    &ovsrec_interface_col_mac_in_use,
23750
0
                                    datum);
23751
0
}
23752
23753
/* Adds the value 'new_value' to the "mtu" set column from the "Interface" table
23754
 * in 'row'.
23755
 *
23756
 */
23757
void
23758
ovsrec_interface_update_mtu_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23759
0
{
23760
0
    struct ovsdb_datum *datum;
23761
23762
0
    datum = xmalloc(sizeof *datum);
23763
0
    datum->n = 1;
23764
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23765
0
    datum->values = NULL;
23766
0
    datum->refcnt = NULL;
23767
23768
0
    datum->keys[0].integer = new_value;
23769
23770
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23771
0
                                    &ovsrec_interface_col_mtu,
23772
0
                                    datum);
23773
0
}
23774
23775
/* Deletes the value 'delete_value' from the "mtu" set column from the
23776
 * "Interface" table in 'row'.
23777
 *
23778
 */
23779
void
23780
ovsrec_interface_update_mtu_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23781
0
{
23782
0
    struct ovsdb_datum *datum;
23783
23784
0
    datum = xmalloc(sizeof *datum);
23785
0
    datum->n = 1;
23786
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23787
0
    datum->values = NULL;
23788
0
    datum->refcnt = NULL;
23789
23790
0
    datum->keys[0].integer = delete_value;
23791
23792
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23793
0
                                    &ovsrec_interface_col_mtu,
23794
0
                                    datum);
23795
0
}
23796
23797
/* Adds the value 'new_value' to the "mtu_request" set column from the "Interface" table
23798
 * in 'row'.
23799
 *
23800
 */
23801
void
23802
ovsrec_interface_update_mtu_request_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23803
0
{
23804
0
    struct ovsdb_datum *datum;
23805
23806
0
    datum = xmalloc(sizeof *datum);
23807
0
    datum->n = 1;
23808
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23809
0
    datum->values = NULL;
23810
0
    datum->refcnt = NULL;
23811
23812
0
    datum->keys[0].integer = new_value;
23813
23814
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23815
0
                                    &ovsrec_interface_col_mtu_request,
23816
0
                                    datum);
23817
0
}
23818
23819
/* Deletes the value 'delete_value' from the "mtu_request" set column from the
23820
 * "Interface" table in 'row'.
23821
 *
23822
 */
23823
void
23824
ovsrec_interface_update_mtu_request_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23825
0
{
23826
0
    struct ovsdb_datum *datum;
23827
23828
0
    datum = xmalloc(sizeof *datum);
23829
0
    datum->n = 1;
23830
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23831
0
    datum->values = NULL;
23832
0
    datum->refcnt = NULL;
23833
23834
0
    datum->keys[0].integer = delete_value;
23835
23836
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23837
0
                                    &ovsrec_interface_col_mtu_request,
23838
0
                                    datum);
23839
0
}
23840
23841
/* Adds the value 'new_value' to the "ofport" set column from the "Interface" table
23842
 * in 'row'.
23843
 *
23844
 */
23845
void
23846
ovsrec_interface_update_ofport_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23847
0
{
23848
0
    struct ovsdb_datum *datum;
23849
23850
0
    datum = xmalloc(sizeof *datum);
23851
0
    datum->n = 1;
23852
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23853
0
    datum->values = NULL;
23854
0
    datum->refcnt = NULL;
23855
23856
0
    datum->keys[0].integer = new_value;
23857
23858
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23859
0
                                    &ovsrec_interface_col_ofport,
23860
0
                                    datum);
23861
0
}
23862
23863
/* Deletes the value 'delete_value' from the "ofport" set column from the
23864
 * "Interface" table in 'row'.
23865
 *
23866
 */
23867
void
23868
ovsrec_interface_update_ofport_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23869
0
{
23870
0
    struct ovsdb_datum *datum;
23871
23872
0
    datum = xmalloc(sizeof *datum);
23873
0
    datum->n = 1;
23874
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23875
0
    datum->values = NULL;
23876
0
    datum->refcnt = NULL;
23877
23878
0
    datum->keys[0].integer = delete_value;
23879
23880
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23881
0
                                    &ovsrec_interface_col_ofport,
23882
0
                                    datum);
23883
0
}
23884
23885
/* Adds the value 'new_value' to the "ofport_request" set column from the "Interface" table
23886
 * in 'row'.
23887
 *
23888
 */
23889
void
23890
ovsrec_interface_update_ofport_request_addvalue(const struct ovsrec_interface *row, int64_t new_value)
23891
0
{
23892
0
    struct ovsdb_datum *datum;
23893
23894
0
    datum = xmalloc(sizeof *datum);
23895
0
    datum->n = 1;
23896
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23897
0
    datum->values = NULL;
23898
0
    datum->refcnt = NULL;
23899
23900
0
    datum->keys[0].integer = new_value;
23901
23902
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
23903
0
                                    &ovsrec_interface_col_ofport_request,
23904
0
                                    datum);
23905
0
}
23906
23907
/* Deletes the value 'delete_value' from the "ofport_request" set column from the
23908
 * "Interface" table in 'row'.
23909
 *
23910
 */
23911
void
23912
ovsrec_interface_update_ofport_request_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
23913
0
{
23914
0
    struct ovsdb_datum *datum;
23915
23916
0
    datum = xmalloc(sizeof *datum);
23917
0
    datum->n = 1;
23918
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
23919
0
    datum->values = NULL;
23920
0
    datum->refcnt = NULL;
23921
23922
0
    datum->keys[0].integer = delete_value;
23923
23924
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
23925
0
                                    &ovsrec_interface_col_ofport_request,
23926
0
                                    datum);
23927
0
}
23928
23929
/* Sets an element of the "options" map column from the "Interface" table in 'row'
23930
 * to 'new_value' given the key value 'new_key'.
23931
 *
23932
 */
23933
void
23934
ovsrec_interface_update_options_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
23935
0
{
23936
0
    struct ovsdb_datum *datum;
23937
23938
0
    datum = xmalloc(sizeof *datum);
23939
0
    datum->n = 1;
23940
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
23941
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
23942
0
    datum->refcnt = NULL;
23943
23944
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
23945
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
23946
23947
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
23948
0
                                    &ovsrec_interface_col_options,
23949
0
                                    datum);
23950
0
}
23951
23952
/* Deletes an element of the "options" map column from the "Interface" table in 'row'
23953
 * given the key value 'delete_key'.
23954
 *
23955
 */
23956
void
23957
ovsrec_interface_update_options_delkey(const struct ovsrec_interface *row, const char *delete_key)
23958
0
{
23959
0
    struct ovsdb_datum *datum;
23960
23961
0
    datum = xmalloc(sizeof *datum);
23962
0
    datum->n = 1;
23963
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
23964
0
    datum->values = NULL;
23965
0
    datum->refcnt = NULL;
23966
23967
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
23968
23969
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
23970
0
                                    &ovsrec_interface_col_options,
23971
0
                                    datum);
23972
0
}
23973
23974
/* Sets an element of the "other_config" map column from the "Interface" table in 'row'
23975
 * to 'new_value' given the key value 'new_key'.
23976
 *
23977
 */
23978
void
23979
ovsrec_interface_update_other_config_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
23980
0
{
23981
0
    struct ovsdb_datum *datum;
23982
23983
0
    datum = xmalloc(sizeof *datum);
23984
0
    datum->n = 1;
23985
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
23986
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
23987
0
    datum->refcnt = NULL;
23988
23989
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
23990
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
23991
23992
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
23993
0
                                    &ovsrec_interface_col_other_config,
23994
0
                                    datum);
23995
0
}
23996
23997
/* Deletes an element of the "other_config" map column from the "Interface" table in 'row'
23998
 * given the key value 'delete_key'.
23999
 *
24000
 */
24001
void
24002
ovsrec_interface_update_other_config_delkey(const struct ovsrec_interface *row, const char *delete_key)
24003
0
{
24004
0
    struct ovsdb_datum *datum;
24005
24006
0
    datum = xmalloc(sizeof *datum);
24007
0
    datum->n = 1;
24008
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
24009
0
    datum->values = NULL;
24010
0
    datum->refcnt = NULL;
24011
24012
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
24013
24014
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
24015
0
                                    &ovsrec_interface_col_other_config,
24016
0
                                    datum);
24017
0
}
24018
24019
/* Sets an element of the "statistics" map column from the "Interface" table in 'row'
24020
 * to 'new_value' given the key value 'new_key'.
24021
 *
24022
 */
24023
void
24024
ovsrec_interface_update_statistics_setkey(const struct ovsrec_interface *row, const char *new_key, int64_t new_value)
24025
0
{
24026
0
    struct ovsdb_datum *datum;
24027
24028
0
    datum = xmalloc(sizeof *datum);
24029
0
    datum->n = 1;
24030
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
24031
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
24032
0
    datum->refcnt = NULL;
24033
24034
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
24035
0
    datum->values[0].integer = new_value;
24036
24037
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
24038
0
                                    &ovsrec_interface_col_statistics,
24039
0
                                    datum);
24040
0
}
24041
24042
/* Deletes an element of the "statistics" map column from the "Interface" table in 'row'
24043
 * given the key value 'delete_key'.
24044
 *
24045
 */
24046
void
24047
ovsrec_interface_update_statistics_delkey(const struct ovsrec_interface *row, const char *delete_key)
24048
0
{
24049
0
    struct ovsdb_datum *datum;
24050
24051
0
    datum = xmalloc(sizeof *datum);
24052
0
    datum->n = 1;
24053
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
24054
0
    datum->values = NULL;
24055
0
    datum->refcnt = NULL;
24056
24057
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
24058
24059
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
24060
0
                                    &ovsrec_interface_col_statistics,
24061
0
                                    datum);
24062
0
}
24063
24064
/* Sets an element of the "status" map column from the "Interface" table in 'row'
24065
 * to 'new_value' given the key value 'new_key'.
24066
 *
24067
 */
24068
void
24069
ovsrec_interface_update_status_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
24070
0
{
24071
0
    struct ovsdb_datum *datum;
24072
24073
0
    datum = xmalloc(sizeof *datum);
24074
0
    datum->n = 1;
24075
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
24076
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
24077
0
    datum->refcnt = NULL;
24078
24079
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
24080
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
24081
24082
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
24083
0
                                    &ovsrec_interface_col_status,
24084
0
                                    datum);
24085
0
}
24086
24087
/* Deletes an element of the "status" map column from the "Interface" table in 'row'
24088
 * given the key value 'delete_key'.
24089
 *
24090
 */
24091
void
24092
ovsrec_interface_update_status_delkey(const struct ovsrec_interface *row, const char *delete_key)
24093
0
{
24094
0
    struct ovsdb_datum *datum;
24095
24096
0
    datum = xmalloc(sizeof *datum);
24097
0
    datum->n = 1;
24098
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
24099
0
    datum->values = NULL;
24100
0
    datum->refcnt = NULL;
24101
24102
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
24103
24104
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
24105
0
                                    &ovsrec_interface_col_status,
24106
0
                                    datum);
24107
0
}
24108
24109
/* Sets the "admin_state" column from the "Interface" table in 'row' to
24110
 * the 'admin_state' set.
24111
 *
24112
 * If "admin_state" is null, the column will be the empty set,
24113
 * otherwise it will contain the specified value.
24114
 *
24115
 * Argument constraints: either "down" or "up"
24116
 *
24117
 * The caller retains ownership of the arguments. */
24118
void
24119
ovsrec_interface_add_clause_admin_state(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *admin_state)
24120
0
{
24121
0
    struct ovsdb_datum datum;
24122
24123
0
    datum.refcnt = NULL;
24124
24125
0
    if (admin_state) {
24126
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24127
0
        datum.n = 1;
24128
0
        datum.keys = key;
24129
0
        key->s = ovsdb_atom_string_create(admin_state);
24130
0
    } else {
24131
0
        datum.n = 0;
24132
0
        datum.keys = NULL;
24133
0
    }
24134
0
    datum.values = NULL;
24135
0
    ovsdb_idl_condition_add_clause(cond,
24136
0
                          function,
24137
0
                          &ovsrec_interface_col_admin_state,
24138
0
                          &datum);
24139
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_admin_state.type);
24140
0
}
24141
24142
/* Sets the "bfd" column's value from the "Interface" table in 'row'
24143
 * to 'bfd'.
24144
 *
24145
 * The caller retains ownership of 'bfd' and everything in it. */
24146
void
24147
ovsrec_interface_add_clause_bfd(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *bfd)
24148
0
{
24149
0
    struct ovsdb_datum datum;
24150
24151
0
    if (bfd) {
24152
0
        ovsdb_datum_from_smap(&datum, bfd);
24153
0
    } else {
24154
0
        ovsdb_datum_init_empty(&datum);
24155
0
    }
24156
24157
0
    ovsdb_idl_condition_add_clause(cond,
24158
0
                                   function,
24159
0
                                   &ovsrec_interface_col_bfd,
24160
0
                                   &datum);
24161
24162
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_bfd.type);
24163
0
}
24164
24165
24166
/* Sets the "bfd_status" column's value from the "Interface" table in 'row'
24167
 * to 'bfd_status'.
24168
 *
24169
 * The caller retains ownership of 'bfd_status' and everything in it. */
24170
void
24171
ovsrec_interface_add_clause_bfd_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *bfd_status)
24172
0
{
24173
0
    struct ovsdb_datum datum;
24174
24175
0
    if (bfd_status) {
24176
0
        ovsdb_datum_from_smap(&datum, bfd_status);
24177
0
    } else {
24178
0
        ovsdb_datum_init_empty(&datum);
24179
0
    }
24180
24181
0
    ovsdb_idl_condition_add_clause(cond,
24182
0
                                   function,
24183
0
                                   &ovsrec_interface_col_bfd_status,
24184
0
                                   &datum);
24185
24186
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_bfd_status.type);
24187
0
}
24188
24189
24190
/* Sets the "cfm_fault" column from the "Interface" table in 'row' to
24191
 * the 'cfm_fault' set with 'n_cfm_fault' entries.
24192
 *
24193
 * 'n_cfm_fault' may be 0 or 1; if it is 0, then 'cfm_fault'
24194
 * may be NULL.
24195
 *
24196
 * The caller retains ownership of the arguments. */
24197
void
24198
ovsrec_interface_add_clause_cfm_fault(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const bool *cfm_fault, size_t n_cfm_fault)
24199
0
{
24200
0
    struct ovsdb_datum datum;
24201
24202
0
    datum.refcnt = NULL;
24203
24204
0
    if (n_cfm_fault) {
24205
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24206
0
        datum.n = 1;
24207
0
        datum.keys = key;
24208
0
        key->boolean = *cfm_fault;
24209
0
    } else {
24210
0
        datum.n = 0;
24211
0
        datum.keys = NULL;
24212
0
    }
24213
0
    datum.values = NULL;
24214
0
    ovsdb_idl_condition_add_clause(cond,
24215
0
                          function,
24216
0
                          &ovsrec_interface_col_cfm_fault,
24217
0
                          &datum);
24218
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_fault.type);
24219
0
}
24220
24221
/* Sets the "cfm_fault_status" column from the "Interface" table in 'row' to
24222
 * the 'cfm_fault_status' set with 'n_cfm_fault_status' entries.
24223
 *
24224
 * The caller retains ownership of the arguments. */
24225
void
24226
ovsrec_interface_add_clause_cfm_fault_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **cfm_fault_status, size_t n_cfm_fault_status)
24227
0
{
24228
0
    struct ovsdb_datum datum;
24229
24230
0
    datum.refcnt = NULL;
24231
0
    datum.n = n_cfm_fault_status;
24232
0
    datum.keys = n_cfm_fault_status ? xmalloc(n_cfm_fault_status * sizeof *datum.keys) : NULL;
24233
0
    datum.values = NULL;
24234
0
    for (size_t i = 0; i < n_cfm_fault_status; i++) {
24235
0
        datum.keys[i].s = ovsdb_atom_string_create(cfm_fault_status[i]);
24236
0
    }
24237
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_cfm_fault_status.type);
24238
0
    ovsdb_idl_condition_add_clause(cond,
24239
0
                          function,
24240
0
                          &ovsrec_interface_col_cfm_fault_status,
24241
0
                          &datum);
24242
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_fault_status.type);
24243
0
}
24244
24245
/* Sets the "cfm_flap_count" column from the "Interface" table in 'row' to
24246
 * the 'cfm_flap_count' set with 'n_cfm_flap_count' entries.
24247
 *
24248
 * 'n_cfm_flap_count' may be 0 or 1; if it is 0, then 'cfm_flap_count'
24249
 * may be NULL.
24250
 *
24251
 * The caller retains ownership of the arguments. */
24252
void
24253
ovsrec_interface_add_clause_cfm_flap_count(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *cfm_flap_count, size_t n_cfm_flap_count)
24254
0
{
24255
0
    struct ovsdb_datum datum;
24256
24257
0
    datum.refcnt = NULL;
24258
24259
0
    if (n_cfm_flap_count) {
24260
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24261
0
        datum.n = 1;
24262
0
        datum.keys = key;
24263
0
        key->integer = *cfm_flap_count;
24264
0
    } else {
24265
0
        datum.n = 0;
24266
0
        datum.keys = NULL;
24267
0
    }
24268
0
    datum.values = NULL;
24269
0
    ovsdb_idl_condition_add_clause(cond,
24270
0
                          function,
24271
0
                          &ovsrec_interface_col_cfm_flap_count,
24272
0
                          &datum);
24273
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_flap_count.type);
24274
0
}
24275
24276
/* Sets the "cfm_health" column from the "Interface" table in 'row' to
24277
 * the 'cfm_health' set with 'n_cfm_health' entries.
24278
 *
24279
 * 'n_cfm_health' may be 0 or 1; if it is 0, then 'cfm_health'
24280
 * may be NULL.
24281
 *
24282
 * Argument constraints: in range 0 to 100
24283
 *
24284
 * The caller retains ownership of the arguments. */
24285
void
24286
ovsrec_interface_add_clause_cfm_health(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *cfm_health, size_t n_cfm_health)
24287
0
{
24288
0
    struct ovsdb_datum datum;
24289
24290
0
    datum.refcnt = NULL;
24291
24292
0
    if (n_cfm_health) {
24293
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24294
0
        datum.n = 1;
24295
0
        datum.keys = key;
24296
0
        key->integer = *cfm_health;
24297
0
    } else {
24298
0
        datum.n = 0;
24299
0
        datum.keys = NULL;
24300
0
    }
24301
0
    datum.values = NULL;
24302
0
    ovsdb_idl_condition_add_clause(cond,
24303
0
                          function,
24304
0
                          &ovsrec_interface_col_cfm_health,
24305
0
                          &datum);
24306
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_health.type);
24307
0
}
24308
24309
/* Sets the "cfm_mpid" column from the "Interface" table in 'row' to
24310
 * the 'cfm_mpid' set with 'n_cfm_mpid' entries.
24311
 *
24312
 * 'n_cfm_mpid' may be 0 or 1; if it is 0, then 'cfm_mpid'
24313
 * may be NULL.
24314
 *
24315
 * The caller retains ownership of the arguments. */
24316
void
24317
ovsrec_interface_add_clause_cfm_mpid(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *cfm_mpid, size_t n_cfm_mpid)
24318
0
{
24319
0
    struct ovsdb_datum datum;
24320
24321
0
    datum.refcnt = NULL;
24322
24323
0
    if (n_cfm_mpid) {
24324
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24325
0
        datum.n = 1;
24326
0
        datum.keys = key;
24327
0
        key->integer = *cfm_mpid;
24328
0
    } else {
24329
0
        datum.n = 0;
24330
0
        datum.keys = NULL;
24331
0
    }
24332
0
    datum.values = NULL;
24333
0
    ovsdb_idl_condition_add_clause(cond,
24334
0
                          function,
24335
0
                          &ovsrec_interface_col_cfm_mpid,
24336
0
                          &datum);
24337
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_mpid.type);
24338
0
}
24339
24340
/* Sets the "cfm_remote_mpids" column from the "Interface" table in 'row' to
24341
 * the 'cfm_remote_mpids' set with 'n_cfm_remote_mpids' entries.
24342
 *
24343
 * The caller retains ownership of the arguments. */
24344
void
24345
ovsrec_interface_add_clause_cfm_remote_mpids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *cfm_remote_mpids, size_t n_cfm_remote_mpids)
24346
0
{
24347
0
    struct ovsdb_datum datum;
24348
24349
0
    datum.refcnt = NULL;
24350
0
    datum.n = n_cfm_remote_mpids;
24351
0
    datum.keys = n_cfm_remote_mpids ? xmalloc(n_cfm_remote_mpids * sizeof *datum.keys) : NULL;
24352
0
    datum.values = NULL;
24353
0
    for (size_t i = 0; i < n_cfm_remote_mpids; i++) {
24354
0
        datum.keys[i].integer = cfm_remote_mpids[i];
24355
0
    }
24356
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_cfm_remote_mpids.type);
24357
0
    ovsdb_idl_condition_add_clause(cond,
24358
0
                          function,
24359
0
                          &ovsrec_interface_col_cfm_remote_mpids,
24360
0
                          &datum);
24361
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_remote_mpids.type);
24362
0
}
24363
24364
/* Sets the "cfm_remote_opstate" column from the "Interface" table in 'row' to
24365
 * the 'cfm_remote_opstate' set.
24366
 *
24367
 * If "cfm_remote_opstate" is null, the column will be the empty set,
24368
 * otherwise it will contain the specified value.
24369
 *
24370
 * Argument constraints: either "down" or "up"
24371
 *
24372
 * The caller retains ownership of the arguments. */
24373
void
24374
ovsrec_interface_add_clause_cfm_remote_opstate(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *cfm_remote_opstate)
24375
0
{
24376
0
    struct ovsdb_datum datum;
24377
24378
0
    datum.refcnt = NULL;
24379
24380
0
    if (cfm_remote_opstate) {
24381
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24382
0
        datum.n = 1;
24383
0
        datum.keys = key;
24384
0
        key->s = ovsdb_atom_string_create(cfm_remote_opstate);
24385
0
    } else {
24386
0
        datum.n = 0;
24387
0
        datum.keys = NULL;
24388
0
    }
24389
0
    datum.values = NULL;
24390
0
    ovsdb_idl_condition_add_clause(cond,
24391
0
                          function,
24392
0
                          &ovsrec_interface_col_cfm_remote_opstate,
24393
0
                          &datum);
24394
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_remote_opstate.type);
24395
0
}
24396
24397
/* Sets the "duplex" column from the "Interface" table in 'row' to
24398
 * the 'duplex' set.
24399
 *
24400
 * If "duplex" is null, the column will be the empty set,
24401
 * otherwise it will contain the specified value.
24402
 *
24403
 * Argument constraints: either "full" or "half"
24404
 *
24405
 * The caller retains ownership of the arguments. */
24406
void
24407
ovsrec_interface_add_clause_duplex(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *duplex)
24408
0
{
24409
0
    struct ovsdb_datum datum;
24410
24411
0
    datum.refcnt = NULL;
24412
24413
0
    if (duplex) {
24414
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24415
0
        datum.n = 1;
24416
0
        datum.keys = key;
24417
0
        key->s = ovsdb_atom_string_create(duplex);
24418
0
    } else {
24419
0
        datum.n = 0;
24420
0
        datum.keys = NULL;
24421
0
    }
24422
0
    datum.values = NULL;
24423
0
    ovsdb_idl_condition_add_clause(cond,
24424
0
                          function,
24425
0
                          &ovsrec_interface_col_duplex,
24426
0
                          &datum);
24427
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_duplex.type);
24428
0
}
24429
24430
/* Sets the "error" column from the "Interface" table in 'row' to
24431
 * the 'error' set.
24432
 *
24433
 * If "error" is null, the column will be the empty set,
24434
 * otherwise it will contain the specified value.
24435
 *
24436
 * The caller retains ownership of the arguments. */
24437
void
24438
ovsrec_interface_add_clause_error(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *error)
24439
0
{
24440
0
    struct ovsdb_datum datum;
24441
24442
0
    datum.refcnt = NULL;
24443
24444
0
    if (error) {
24445
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24446
0
        datum.n = 1;
24447
0
        datum.keys = key;
24448
0
        key->s = ovsdb_atom_string_create(error);
24449
0
    } else {
24450
0
        datum.n = 0;
24451
0
        datum.keys = NULL;
24452
0
    }
24453
0
    datum.values = NULL;
24454
0
    ovsdb_idl_condition_add_clause(cond,
24455
0
                          function,
24456
0
                          &ovsrec_interface_col_error,
24457
0
                          &datum);
24458
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_error.type);
24459
0
}
24460
24461
/* Sets the "external_ids" column's value from the "Interface" table in 'row'
24462
 * to 'external_ids'.
24463
 *
24464
 * The caller retains ownership of 'external_ids' and everything in it. */
24465
void
24466
ovsrec_interface_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
24467
0
{
24468
0
    struct ovsdb_datum datum;
24469
24470
0
    if (external_ids) {
24471
0
        ovsdb_datum_from_smap(&datum, external_ids);
24472
0
    } else {
24473
0
        ovsdb_datum_init_empty(&datum);
24474
0
    }
24475
24476
0
    ovsdb_idl_condition_add_clause(cond,
24477
0
                                   function,
24478
0
                                   &ovsrec_interface_col_external_ids,
24479
0
                                   &datum);
24480
24481
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_external_ids.type);
24482
0
}
24483
24484
24485
/* Sets the "ifindex" column from the "Interface" table in 'row' to
24486
 * the 'ifindex' set with 'n_ifindex' entries.
24487
 *
24488
 * 'n_ifindex' may be 0 or 1; if it is 0, then 'ifindex'
24489
 * may be NULL.
24490
 *
24491
 * Argument constraints: in range 0 to 4,294,967,295
24492
 *
24493
 * The caller retains ownership of the arguments. */
24494
void
24495
ovsrec_interface_add_clause_ifindex(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *ifindex, size_t n_ifindex)
24496
0
{
24497
0
    struct ovsdb_datum datum;
24498
24499
0
    datum.refcnt = NULL;
24500
24501
0
    if (n_ifindex) {
24502
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24503
0
        datum.n = 1;
24504
0
        datum.keys = key;
24505
0
        key->integer = *ifindex;
24506
0
    } else {
24507
0
        datum.n = 0;
24508
0
        datum.keys = NULL;
24509
0
    }
24510
0
    datum.values = NULL;
24511
0
    ovsdb_idl_condition_add_clause(cond,
24512
0
                          function,
24513
0
                          &ovsrec_interface_col_ifindex,
24514
0
                          &datum);
24515
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ifindex.type);
24516
0
}
24517
24518
/* Sets the "ingress_policing_burst" column from the "Interface" table in 'row' to
24519
 * 'ingress_policing_burst'.
24520
 *
24521
 * Argument constraints: at least 0
24522
 *
24523
 * The caller retains ownership of the arguments. */
24524
void
24525
ovsrec_interface_add_clause_ingress_policing_burst(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t ingress_policing_burst)
24526
0
{
24527
0
    struct ovsdb_datum datum;
24528
24529
0
    datum.refcnt = NULL;
24530
24531
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
24532
24533
0
    datum.n = 1;
24534
0
    datum.keys = key;
24535
0
    key->integer = ingress_policing_burst;
24536
0
    datum.values = NULL;
24537
0
    ovsdb_idl_condition_add_clause(cond,
24538
0
                          function,
24539
0
                          &ovsrec_interface_col_ingress_policing_burst,
24540
0
                          &datum);
24541
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ingress_policing_burst.type);
24542
0
}
24543
24544
/* Sets the "ingress_policing_kpkts_burst" column from the "Interface" table in 'row' to
24545
 * 'ingress_policing_kpkts_burst'.
24546
 *
24547
 * Argument constraints: at least 0
24548
 *
24549
 * The caller retains ownership of the arguments. */
24550
void
24551
ovsrec_interface_add_clause_ingress_policing_kpkts_burst(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t ingress_policing_kpkts_burst)
24552
0
{
24553
0
    struct ovsdb_datum datum;
24554
24555
0
    datum.refcnt = NULL;
24556
24557
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
24558
24559
0
    datum.n = 1;
24560
0
    datum.keys = key;
24561
0
    key->integer = ingress_policing_kpkts_burst;
24562
0
    datum.values = NULL;
24563
0
    ovsdb_idl_condition_add_clause(cond,
24564
0
                          function,
24565
0
                          &ovsrec_interface_col_ingress_policing_kpkts_burst,
24566
0
                          &datum);
24567
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ingress_policing_kpkts_burst.type);
24568
0
}
24569
24570
/* Sets the "ingress_policing_kpkts_rate" column from the "Interface" table in 'row' to
24571
 * 'ingress_policing_kpkts_rate'.
24572
 *
24573
 * Argument constraints: at least 0
24574
 *
24575
 * The caller retains ownership of the arguments. */
24576
void
24577
ovsrec_interface_add_clause_ingress_policing_kpkts_rate(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t ingress_policing_kpkts_rate)
24578
0
{
24579
0
    struct ovsdb_datum datum;
24580
24581
0
    datum.refcnt = NULL;
24582
24583
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
24584
24585
0
    datum.n = 1;
24586
0
    datum.keys = key;
24587
0
    key->integer = ingress_policing_kpkts_rate;
24588
0
    datum.values = NULL;
24589
0
    ovsdb_idl_condition_add_clause(cond,
24590
0
                          function,
24591
0
                          &ovsrec_interface_col_ingress_policing_kpkts_rate,
24592
0
                          &datum);
24593
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ingress_policing_kpkts_rate.type);
24594
0
}
24595
24596
/* Sets the "ingress_policing_rate" column from the "Interface" table in 'row' to
24597
 * 'ingress_policing_rate'.
24598
 *
24599
 * Argument constraints: at least 0
24600
 *
24601
 * The caller retains ownership of the arguments. */
24602
void
24603
ovsrec_interface_add_clause_ingress_policing_rate(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t ingress_policing_rate)
24604
0
{
24605
0
    struct ovsdb_datum datum;
24606
24607
0
    datum.refcnt = NULL;
24608
24609
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
24610
24611
0
    datum.n = 1;
24612
0
    datum.keys = key;
24613
0
    key->integer = ingress_policing_rate;
24614
0
    datum.values = NULL;
24615
0
    ovsdb_idl_condition_add_clause(cond,
24616
0
                          function,
24617
0
                          &ovsrec_interface_col_ingress_policing_rate,
24618
0
                          &datum);
24619
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ingress_policing_rate.type);
24620
0
}
24621
24622
/* Sets the "lacp_current" column from the "Interface" table in 'row' to
24623
 * the 'lacp_current' set with 'n_lacp_current' entries.
24624
 *
24625
 * 'n_lacp_current' may be 0 or 1; if it is 0, then 'lacp_current'
24626
 * may be NULL.
24627
 *
24628
 * The caller retains ownership of the arguments. */
24629
void
24630
ovsrec_interface_add_clause_lacp_current(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const bool *lacp_current, size_t n_lacp_current)
24631
0
{
24632
0
    struct ovsdb_datum datum;
24633
24634
0
    datum.refcnt = NULL;
24635
24636
0
    if (n_lacp_current) {
24637
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24638
0
        datum.n = 1;
24639
0
        datum.keys = key;
24640
0
        key->boolean = *lacp_current;
24641
0
    } else {
24642
0
        datum.n = 0;
24643
0
        datum.keys = NULL;
24644
0
    }
24645
0
    datum.values = NULL;
24646
0
    ovsdb_idl_condition_add_clause(cond,
24647
0
                          function,
24648
0
                          &ovsrec_interface_col_lacp_current,
24649
0
                          &datum);
24650
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_lacp_current.type);
24651
0
}
24652
24653
/* Sets the "link_resets" column from the "Interface" table in 'row' to
24654
 * the 'link_resets' set with 'n_link_resets' entries.
24655
 *
24656
 * 'n_link_resets' may be 0 or 1; if it is 0, then 'link_resets'
24657
 * may be NULL.
24658
 *
24659
 * The caller retains ownership of the arguments. */
24660
void
24661
ovsrec_interface_add_clause_link_resets(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *link_resets, size_t n_link_resets)
24662
0
{
24663
0
    struct ovsdb_datum datum;
24664
24665
0
    datum.refcnt = NULL;
24666
24667
0
    if (n_link_resets) {
24668
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24669
0
        datum.n = 1;
24670
0
        datum.keys = key;
24671
0
        key->integer = *link_resets;
24672
0
    } else {
24673
0
        datum.n = 0;
24674
0
        datum.keys = NULL;
24675
0
    }
24676
0
    datum.values = NULL;
24677
0
    ovsdb_idl_condition_add_clause(cond,
24678
0
                          function,
24679
0
                          &ovsrec_interface_col_link_resets,
24680
0
                          &datum);
24681
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_link_resets.type);
24682
0
}
24683
24684
/* Sets the "link_speed" column from the "Interface" table in 'row' to
24685
 * the 'link_speed' set with 'n_link_speed' entries.
24686
 *
24687
 * 'n_link_speed' may be 0 or 1; if it is 0, then 'link_speed'
24688
 * may be NULL.
24689
 *
24690
 * The caller retains ownership of the arguments. */
24691
void
24692
ovsrec_interface_add_clause_link_speed(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *link_speed, size_t n_link_speed)
24693
0
{
24694
0
    struct ovsdb_datum datum;
24695
24696
0
    datum.refcnt = NULL;
24697
24698
0
    if (n_link_speed) {
24699
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24700
0
        datum.n = 1;
24701
0
        datum.keys = key;
24702
0
        key->integer = *link_speed;
24703
0
    } else {
24704
0
        datum.n = 0;
24705
0
        datum.keys = NULL;
24706
0
    }
24707
0
    datum.values = NULL;
24708
0
    ovsdb_idl_condition_add_clause(cond,
24709
0
                          function,
24710
0
                          &ovsrec_interface_col_link_speed,
24711
0
                          &datum);
24712
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_link_speed.type);
24713
0
}
24714
24715
/* Sets the "link_state" column from the "Interface" table in 'row' to
24716
 * the 'link_state' set.
24717
 *
24718
 * If "link_state" is null, the column will be the empty set,
24719
 * otherwise it will contain the specified value.
24720
 *
24721
 * Argument constraints: either "down" or "up"
24722
 *
24723
 * The caller retains ownership of the arguments. */
24724
void
24725
ovsrec_interface_add_clause_link_state(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *link_state)
24726
0
{
24727
0
    struct ovsdb_datum datum;
24728
24729
0
    datum.refcnt = NULL;
24730
24731
0
    if (link_state) {
24732
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24733
0
        datum.n = 1;
24734
0
        datum.keys = key;
24735
0
        key->s = ovsdb_atom_string_create(link_state);
24736
0
    } else {
24737
0
        datum.n = 0;
24738
0
        datum.keys = NULL;
24739
0
    }
24740
0
    datum.values = NULL;
24741
0
    ovsdb_idl_condition_add_clause(cond,
24742
0
                          function,
24743
0
                          &ovsrec_interface_col_link_state,
24744
0
                          &datum);
24745
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_link_state.type);
24746
0
}
24747
24748
/* Sets the "lldp" column's value from the "Interface" table in 'row'
24749
 * to 'lldp'.
24750
 *
24751
 * The caller retains ownership of 'lldp' and everything in it. */
24752
void
24753
ovsrec_interface_add_clause_lldp(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *lldp)
24754
0
{
24755
0
    struct ovsdb_datum datum;
24756
24757
0
    if (lldp) {
24758
0
        ovsdb_datum_from_smap(&datum, lldp);
24759
0
    } else {
24760
0
        ovsdb_datum_init_empty(&datum);
24761
0
    }
24762
24763
0
    ovsdb_idl_condition_add_clause(cond,
24764
0
                                   function,
24765
0
                                   &ovsrec_interface_col_lldp,
24766
0
                                   &datum);
24767
24768
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_lldp.type);
24769
0
}
24770
24771
24772
/* Sets the "mac" column from the "Interface" table in 'row' to
24773
 * the 'mac' set.
24774
 *
24775
 * If "mac" is null, the column will be the empty set,
24776
 * otherwise it will contain the specified value.
24777
 *
24778
 * The caller retains ownership of the arguments. */
24779
void
24780
ovsrec_interface_add_clause_mac(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *mac)
24781
0
{
24782
0
    struct ovsdb_datum datum;
24783
24784
0
    datum.refcnt = NULL;
24785
24786
0
    if (mac) {
24787
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24788
0
        datum.n = 1;
24789
0
        datum.keys = key;
24790
0
        key->s = ovsdb_atom_string_create(mac);
24791
0
    } else {
24792
0
        datum.n = 0;
24793
0
        datum.keys = NULL;
24794
0
    }
24795
0
    datum.values = NULL;
24796
0
    ovsdb_idl_condition_add_clause(cond,
24797
0
                          function,
24798
0
                          &ovsrec_interface_col_mac,
24799
0
                          &datum);
24800
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_mac.type);
24801
0
}
24802
24803
/* Sets the "mac_in_use" column from the "Interface" table in 'row' to
24804
 * the 'mac_in_use' set.
24805
 *
24806
 * If "mac_in_use" is null, the column will be the empty set,
24807
 * otherwise it will contain the specified value.
24808
 *
24809
 * The caller retains ownership of the arguments. */
24810
void
24811
ovsrec_interface_add_clause_mac_in_use(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *mac_in_use)
24812
0
{
24813
0
    struct ovsdb_datum datum;
24814
24815
0
    datum.refcnt = NULL;
24816
24817
0
    if (mac_in_use) {
24818
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24819
0
        datum.n = 1;
24820
0
        datum.keys = key;
24821
0
        key->s = ovsdb_atom_string_create(mac_in_use);
24822
0
    } else {
24823
0
        datum.n = 0;
24824
0
        datum.keys = NULL;
24825
0
    }
24826
0
    datum.values = NULL;
24827
0
    ovsdb_idl_condition_add_clause(cond,
24828
0
                          function,
24829
0
                          &ovsrec_interface_col_mac_in_use,
24830
0
                          &datum);
24831
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_mac_in_use.type);
24832
0
}
24833
24834
/* Sets the "mtu" column from the "Interface" table in 'row' to
24835
 * the 'mtu' set with 'n_mtu' entries.
24836
 *
24837
 * 'n_mtu' may be 0 or 1; if it is 0, then 'mtu'
24838
 * may be NULL.
24839
 *
24840
 * The caller retains ownership of the arguments. */
24841
void
24842
ovsrec_interface_add_clause_mtu(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *mtu, size_t n_mtu)
24843
0
{
24844
0
    struct ovsdb_datum datum;
24845
24846
0
    datum.refcnt = NULL;
24847
24848
0
    if (n_mtu) {
24849
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24850
0
        datum.n = 1;
24851
0
        datum.keys = key;
24852
0
        key->integer = *mtu;
24853
0
    } else {
24854
0
        datum.n = 0;
24855
0
        datum.keys = NULL;
24856
0
    }
24857
0
    datum.values = NULL;
24858
0
    ovsdb_idl_condition_add_clause(cond,
24859
0
                          function,
24860
0
                          &ovsrec_interface_col_mtu,
24861
0
                          &datum);
24862
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_mtu.type);
24863
0
}
24864
24865
/* Sets the "mtu_request" column from the "Interface" table in 'row' to
24866
 * the 'mtu_request' set with 'n_mtu_request' entries.
24867
 *
24868
 * 'n_mtu_request' may be 0 or 1; if it is 0, then 'mtu_request'
24869
 * may be NULL.
24870
 *
24871
 * Argument constraints: at least 1
24872
 *
24873
 * The caller retains ownership of the arguments. */
24874
void
24875
ovsrec_interface_add_clause_mtu_request(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *mtu_request, size_t n_mtu_request)
24876
0
{
24877
0
    struct ovsdb_datum datum;
24878
24879
0
    datum.refcnt = NULL;
24880
24881
0
    if (n_mtu_request) {
24882
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24883
0
        datum.n = 1;
24884
0
        datum.keys = key;
24885
0
        key->integer = *mtu_request;
24886
0
    } else {
24887
0
        datum.n = 0;
24888
0
        datum.keys = NULL;
24889
0
    }
24890
0
    datum.values = NULL;
24891
0
    ovsdb_idl_condition_add_clause(cond,
24892
0
                          function,
24893
0
                          &ovsrec_interface_col_mtu_request,
24894
0
                          &datum);
24895
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_mtu_request.type);
24896
0
}
24897
24898
/* Sets the "name" column from the "Interface" table in 'row' to
24899
 * 'name'.
24900
 *
24901
 * The caller retains ownership of the arguments. */
24902
void
24903
ovsrec_interface_add_clause_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *name)
24904
0
{
24905
0
    struct ovsdb_datum datum;
24906
24907
0
    datum.refcnt = NULL;
24908
24909
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
24910
24911
0
    datum.n = 1;
24912
0
    datum.keys = key;
24913
0
    key->s = ovsdb_atom_string_create(name);
24914
0
    datum.values = NULL;
24915
0
    ovsdb_idl_condition_add_clause(cond,
24916
0
                          function,
24917
0
                          &ovsrec_interface_col_name,
24918
0
                          &datum);
24919
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_name.type);
24920
0
}
24921
24922
/* Sets the "ofport" column from the "Interface" table in 'row' to
24923
 * the 'ofport' set with 'n_ofport' entries.
24924
 *
24925
 * 'n_ofport' may be 0 or 1; if it is 0, then 'ofport'
24926
 * may be NULL.
24927
 *
24928
 * The caller retains ownership of the arguments. */
24929
void
24930
ovsrec_interface_add_clause_ofport(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *ofport, size_t n_ofport)
24931
0
{
24932
0
    struct ovsdb_datum datum;
24933
24934
0
    datum.refcnt = NULL;
24935
24936
0
    if (n_ofport) {
24937
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24938
0
        datum.n = 1;
24939
0
        datum.keys = key;
24940
0
        key->integer = *ofport;
24941
0
    } else {
24942
0
        datum.n = 0;
24943
0
        datum.keys = NULL;
24944
0
    }
24945
0
    datum.values = NULL;
24946
0
    ovsdb_idl_condition_add_clause(cond,
24947
0
                          function,
24948
0
                          &ovsrec_interface_col_ofport,
24949
0
                          &datum);
24950
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ofport.type);
24951
0
}
24952
24953
/* Sets the "ofport_request" column from the "Interface" table in 'row' to
24954
 * the 'ofport_request' set with 'n_ofport_request' entries.
24955
 *
24956
 * 'n_ofport_request' may be 0 or 1; if it is 0, then 'ofport_request'
24957
 * may be NULL.
24958
 *
24959
 * Argument constraints: in range 1 to 65,279
24960
 *
24961
 * The caller retains ownership of the arguments. */
24962
void
24963
ovsrec_interface_add_clause_ofport_request(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *ofport_request, size_t n_ofport_request)
24964
0
{
24965
0
    struct ovsdb_datum datum;
24966
24967
0
    datum.refcnt = NULL;
24968
24969
0
    if (n_ofport_request) {
24970
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
24971
0
        datum.n = 1;
24972
0
        datum.keys = key;
24973
0
        key->integer = *ofport_request;
24974
0
    } else {
24975
0
        datum.n = 0;
24976
0
        datum.keys = NULL;
24977
0
    }
24978
0
    datum.values = NULL;
24979
0
    ovsdb_idl_condition_add_clause(cond,
24980
0
                          function,
24981
0
                          &ovsrec_interface_col_ofport_request,
24982
0
                          &datum);
24983
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ofport_request.type);
24984
0
}
24985
24986
/* Sets the "options" column's value from the "Interface" table in 'row'
24987
 * to 'options'.
24988
 *
24989
 * The caller retains ownership of 'options' and everything in it. */
24990
void
24991
ovsrec_interface_add_clause_options(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *options)
24992
0
{
24993
0
    struct ovsdb_datum datum;
24994
24995
0
    if (options) {
24996
0
        ovsdb_datum_from_smap(&datum, options);
24997
0
    } else {
24998
0
        ovsdb_datum_init_empty(&datum);
24999
0
    }
25000
25001
0
    ovsdb_idl_condition_add_clause(cond,
25002
0
                                   function,
25003
0
                                   &ovsrec_interface_col_options,
25004
0
                                   &datum);
25005
25006
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_options.type);
25007
0
}
25008
25009
25010
/* Sets the "other_config" column's value from the "Interface" table in 'row'
25011
 * to 'other_config'.
25012
 *
25013
 * The caller retains ownership of 'other_config' and everything in it. */
25014
void
25015
ovsrec_interface_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
25016
0
{
25017
0
    struct ovsdb_datum datum;
25018
25019
0
    if (other_config) {
25020
0
        ovsdb_datum_from_smap(&datum, other_config);
25021
0
    } else {
25022
0
        ovsdb_datum_init_empty(&datum);
25023
0
    }
25024
25025
0
    ovsdb_idl_condition_add_clause(cond,
25026
0
                                   function,
25027
0
                                   &ovsrec_interface_col_other_config,
25028
0
                                   &datum);
25029
25030
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_other_config.type);
25031
0
}
25032
25033
25034
/* Sets the "statistics" column from the "Interface" table in 'row' to
25035
 * the map with keys 'key_statistics' and values 'value_statistics'
25036
 * with 'n_statistics' entries.
25037
 *
25038
 * The caller retains ownership of the arguments. */
25039
void
25040
ovsrec_interface_add_clause_statistics(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
25041
0
{
25042
0
    struct ovsdb_datum datum;
25043
25044
0
    datum.refcnt = NULL;
25045
0
    datum.n = n_statistics;
25046
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
25047
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
25048
0
    for (size_t i = 0; i < n_statistics; i++) {
25049
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
25050
0
        datum.values[i].integer = value_statistics[i];
25051
0
    }
25052
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_statistics.type);
25053
0
    ovsdb_idl_condition_add_clause(cond,
25054
0
                          function,
25055
0
                          &ovsrec_interface_col_statistics,
25056
0
                          &datum);
25057
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_statistics.type);
25058
0
}
25059
25060
/* Sets the "status" column's value from the "Interface" table in 'row'
25061
 * to 'status'.
25062
 *
25063
 * The caller retains ownership of 'status' and everything in it. */
25064
void
25065
ovsrec_interface_add_clause_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *status)
25066
0
{
25067
0
    struct ovsdb_datum datum;
25068
25069
0
    if (status) {
25070
0
        ovsdb_datum_from_smap(&datum, status);
25071
0
    } else {
25072
0
        ovsdb_datum_init_empty(&datum);
25073
0
    }
25074
25075
0
    ovsdb_idl_condition_add_clause(cond,
25076
0
                                   function,
25077
0
                                   &ovsrec_interface_col_status,
25078
0
                                   &datum);
25079
25080
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_status.type);
25081
0
}
25082
25083
25084
/* Sets the "type" column from the "Interface" table in 'row' to
25085
 * 'type'.
25086
 *
25087
 * The caller retains ownership of the arguments. */
25088
void
25089
ovsrec_interface_add_clause_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *type)
25090
0
{
25091
0
    struct ovsdb_datum datum;
25092
25093
0
    datum.refcnt = NULL;
25094
25095
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
25096
25097
0
    datum.n = 1;
25098
0
    datum.keys = key;
25099
0
    key->s = ovsdb_atom_string_create(type);
25100
0
    datum.values = NULL;
25101
0
    ovsdb_idl_condition_add_clause(cond,
25102
0
                          function,
25103
0
                          &ovsrec_interface_col_type,
25104
0
                          &datum);
25105
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_type.type);
25106
0
}
25107
25108
/* Destroy 'row' of kind "Interface". The row must have been
25109
 * created with ovsdb_idl_index_init_row.
25110
 */
25111
void
25112
ovsrec_interface_index_destroy_row(const struct ovsrec_interface *row)
25113
0
{
25114
0
    ovsdb_idl_index_destroy_row(&row->header_);
25115
0
}
25116
        
25117
25118
/* Creates a new row of kind "Interface". */
25119
struct ovsrec_interface *
25120
ovsrec_interface_index_init_row(struct ovsdb_idl_index *index)
25121
0
{
25122
0
    ovs_assert(index->table->class_ == &ovsrec_table_interface);
25123
0
    return ALIGNED_CAST(struct ovsrec_interface *, ovsdb_idl_index_init_row(index));
25124
0
}
25125
25126
struct ovsrec_interface *
25127
ovsrec_interface_index_find(struct ovsdb_idl_index *index, const struct ovsrec_interface *target)
25128
0
{
25129
0
    ovs_assert(index->table->class_ == &ovsrec_table_interface);
25130
0
    return ovsrec_interface_cast(ovsdb_idl_index_find(index, &target->header_));
25131
0
}
25132
25133
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
25134
int
25135
ovsrec_interface_index_compare(
25136
    struct ovsdb_idl_index *index, 
25137
    const struct ovsrec_interface *a, 
25138
    const struct ovsrec_interface *b)
25139
0
{
25140
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
25141
0
}
25142
25143
struct ovsdb_idl_cursor
25144
ovsrec_interface_cursor_first(struct ovsdb_idl_index *index)
25145
0
{
25146
0
    ovs_assert(index->table->class_ == &ovsrec_table_interface);
25147
0
    return ovsdb_idl_cursor_first(index);
25148
0
}
25149
25150
struct ovsdb_idl_cursor
25151
ovsrec_interface_cursor_first_eq(
25152
    struct ovsdb_idl_index *index, const struct ovsrec_interface *target)
25153
0
{
25154
0
    ovs_assert(index->table->class_ == &ovsrec_table_interface);
25155
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
25156
0
}
25157
25158
struct ovsdb_idl_cursor
25159
ovsrec_interface_cursor_first_ge(
25160
    struct ovsdb_idl_index *index, const struct ovsrec_interface *target)
25161
0
{
25162
0
    ovs_assert(index->table->class_ == &ovsrec_table_interface);
25163
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
25164
0
}
25165
25166
struct ovsrec_interface *
25167
ovsrec_interface_cursor_data(struct ovsdb_idl_cursor *cursor)
25168
0
{
25169
0
    return ovsrec_interface_cast(ovsdb_idl_cursor_data(cursor));
25170
0
}
25171
25172
25173
/* Sets the "admin_state" column from the "Interface" table in 'row' to
25174
 * the 'admin_state' set.
25175
 *
25176
 * If "admin_state" is null, the column will be the empty set,
25177
 * otherwise it will contain the specified value.
25178
 *
25179
 * Argument constraints: either "down" or "up"
25180
 *
25181
 * The caller retains ownership of the arguments. */
25182
void
25183
ovsrec_interface_index_set_admin_state(const struct ovsrec_interface *row, const char *admin_state)
25184
0
{
25185
0
    struct ovsdb_datum datum;
25186
25187
0
    datum.refcnt = NULL;
25188
0
    union ovsdb_atom *key;
25189
25190
0
    if (admin_state) {
25191
0
        key = xmalloc(sizeof (union ovsdb_atom));
25192
0
        datum.n = 1;
25193
0
        datum.keys = key;
25194
0
        key->s = ovsdb_atom_string_create(admin_state);
25195
0
    } else {
25196
0
        datum.n = 0;
25197
0
        datum.keys = NULL;
25198
0
    }
25199
0
    datum.values = NULL;
25200
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_ADMIN_STATE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25201
0
}
25202
25203
/* Sets the "bfd" column's value from the "Interface" table in 'row'
25204
 * to 'bfd'.
25205
 *
25206
 * The caller retains ownership of 'bfd' and everything in it. */
25207
void
25208
ovsrec_interface_index_set_bfd(const struct ovsrec_interface *row, const struct smap *bfd)
25209
0
{
25210
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
25211
25212
0
    if (bfd) {
25213
0
        struct smap_node *node;
25214
0
        size_t i;
25215
25216
0
        datum->n = smap_count(bfd);
25217
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
25218
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
25219
0
        datum->refcnt = NULL;
25220
25221
0
        i = 0;
25222
0
        SMAP_FOR_EACH (node, bfd) {
25223
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
25224
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
25225
0
            i++;
25226
0
        }
25227
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_bfd.type);
25228
0
    } else {
25229
0
        ovsdb_datum_init_empty(datum);
25230
0
    }
25231
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
25232
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD],
25233
0
                          datum,
25234
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25235
0
    free(datum);
25236
0
}
25237
25238
25239
/* Sets the "bfd_status" column's value from the "Interface" table in 'row'
25240
 * to 'bfd_status'.
25241
 *
25242
 * The caller retains ownership of 'bfd_status' and everything in it. */
25243
void
25244
ovsrec_interface_index_set_bfd_status(const struct ovsrec_interface *row, const struct smap *bfd_status)
25245
0
{
25246
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
25247
25248
0
    if (bfd_status) {
25249
0
        struct smap_node *node;
25250
0
        size_t i;
25251
25252
0
        datum->n = smap_count(bfd_status);
25253
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
25254
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
25255
0
        datum->refcnt = NULL;
25256
25257
0
        i = 0;
25258
0
        SMAP_FOR_EACH (node, bfd_status) {
25259
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
25260
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
25261
0
            i++;
25262
0
        }
25263
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_bfd_status.type);
25264
0
    } else {
25265
0
        ovsdb_datum_init_empty(datum);
25266
0
    }
25267
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
25268
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD_STATUS],
25269
0
                          datum,
25270
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25271
0
    free(datum);
25272
0
}
25273
25274
25275
/* Sets the "cfm_fault" column from the "Interface" table in 'row' to
25276
 * the 'cfm_fault' set with 'n_cfm_fault' entries.
25277
 *
25278
 * 'n_cfm_fault' may be 0 or 1; if it is 0, then 'cfm_fault'
25279
 * may be NULL.
25280
 *
25281
 * The caller retains ownership of the arguments. */
25282
void
25283
ovsrec_interface_index_set_cfm_fault(const struct ovsrec_interface *row, const bool *cfm_fault, size_t n_cfm_fault)
25284
0
{
25285
0
    struct ovsdb_datum datum;
25286
25287
0
    datum.refcnt = NULL;
25288
0
    union ovsdb_atom *key;
25289
25290
0
    if (n_cfm_fault) {
25291
0
        key = xmalloc(sizeof(union ovsdb_atom));
25292
0
        datum.n = 1;
25293
0
        datum.keys = key;
25294
0
        key->boolean = *cfm_fault;
25295
0
    } else {
25296
0
        datum.n = 0;
25297
0
        datum.keys = NULL;
25298
0
    }
25299
0
    datum.values = NULL;
25300
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_CFM_FAULT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25301
0
}
25302
25303
/* Sets the "cfm_fault_status" column from the "Interface" table in 'row' to
25304
 * the 'cfm_fault_status' set with 'n_cfm_fault_status' entries.
25305
 *
25306
 * The caller retains ownership of the arguments. */
25307
void
25308
ovsrec_interface_index_set_cfm_fault_status(const struct ovsrec_interface *row, const char **cfm_fault_status, size_t n_cfm_fault_status)
25309
0
{
25310
0
    struct ovsdb_datum datum;
25311
25312
0
    datum.refcnt = NULL;
25313
0
    size_t i;
25314
25315
0
    datum.n = n_cfm_fault_status;
25316
0
    datum.keys = n_cfm_fault_status ? xmalloc(n_cfm_fault_status * sizeof *datum.keys) : NULL;
25317
0
    datum.values = NULL;
25318
0
    for (i = 0; i < n_cfm_fault_status; i++) {
25319
0
        datum.keys[i].s = ovsdb_atom_string_create(cfm_fault_status[i]);
25320
0
    }
25321
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_cfm_fault_status.type);
25322
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_CFM_FAULT_STATUS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25323
0
}
25324
25325
/* Sets the "cfm_flap_count" column from the "Interface" table in 'row' to
25326
 * the 'cfm_flap_count' set with 'n_cfm_flap_count' entries.
25327
 *
25328
 * 'n_cfm_flap_count' may be 0 or 1; if it is 0, then 'cfm_flap_count'
25329
 * may be NULL.
25330
 *
25331
 * The caller retains ownership of the arguments. */
25332
void
25333
ovsrec_interface_index_set_cfm_flap_count(const struct ovsrec_interface *row, const int64_t *cfm_flap_count, size_t n_cfm_flap_count)
25334
0
{
25335
0
    struct ovsdb_datum datum;
25336
25337
0
    datum.refcnt = NULL;
25338
0
    union ovsdb_atom *key;
25339
25340
0
    if (n_cfm_flap_count) {
25341
0
        key = xmalloc(sizeof(union ovsdb_atom));
25342
0
        datum.n = 1;
25343
0
        datum.keys = key;
25344
0
        key->integer = *cfm_flap_count;
25345
0
    } else {
25346
0
        datum.n = 0;
25347
0
        datum.keys = NULL;
25348
0
    }
25349
0
    datum.values = NULL;
25350
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_CFM_FLAP_COUNT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25351
0
}
25352
25353
/* Sets the "cfm_health" column from the "Interface" table in 'row' to
25354
 * the 'cfm_health' set with 'n_cfm_health' entries.
25355
 *
25356
 * 'n_cfm_health' may be 0 or 1; if it is 0, then 'cfm_health'
25357
 * may be NULL.
25358
 *
25359
 * Argument constraints: in range 0 to 100
25360
 *
25361
 * The caller retains ownership of the arguments. */
25362
void
25363
ovsrec_interface_index_set_cfm_health(const struct ovsrec_interface *row, const int64_t *cfm_health, size_t n_cfm_health)
25364
0
{
25365
0
    struct ovsdb_datum datum;
25366
25367
0
    datum.refcnt = NULL;
25368
0
    union ovsdb_atom *key;
25369
25370
0
    if (n_cfm_health) {
25371
0
        key = xmalloc(sizeof(union ovsdb_atom));
25372
0
        datum.n = 1;
25373
0
        datum.keys = key;
25374
0
        key->integer = *cfm_health;
25375
0
    } else {
25376
0
        datum.n = 0;
25377
0
        datum.keys = NULL;
25378
0
    }
25379
0
    datum.values = NULL;
25380
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_CFM_HEALTH ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25381
0
}
25382
25383
/* Sets the "cfm_mpid" column from the "Interface" table in 'row' to
25384
 * the 'cfm_mpid' set with 'n_cfm_mpid' entries.
25385
 *
25386
 * 'n_cfm_mpid' may be 0 or 1; if it is 0, then 'cfm_mpid'
25387
 * may be NULL.
25388
 *
25389
 * The caller retains ownership of the arguments. */
25390
void
25391
ovsrec_interface_index_set_cfm_mpid(const struct ovsrec_interface *row, const int64_t *cfm_mpid, size_t n_cfm_mpid)
25392
0
{
25393
0
    struct ovsdb_datum datum;
25394
25395
0
    datum.refcnt = NULL;
25396
0
    union ovsdb_atom *key;
25397
25398
0
    if (n_cfm_mpid) {
25399
0
        key = xmalloc(sizeof(union ovsdb_atom));
25400
0
        datum.n = 1;
25401
0
        datum.keys = key;
25402
0
        key->integer = *cfm_mpid;
25403
0
    } else {
25404
0
        datum.n = 0;
25405
0
        datum.keys = NULL;
25406
0
    }
25407
0
    datum.values = NULL;
25408
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_CFM_MPID ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25409
0
}
25410
25411
/* Sets the "cfm_remote_mpids" column from the "Interface" table in 'row' to
25412
 * the 'cfm_remote_mpids' set with 'n_cfm_remote_mpids' entries.
25413
 *
25414
 * The caller retains ownership of the arguments. */
25415
void
25416
ovsrec_interface_index_set_cfm_remote_mpids(const struct ovsrec_interface *row, const int64_t *cfm_remote_mpids, size_t n_cfm_remote_mpids)
25417
0
{
25418
0
    struct ovsdb_datum datum;
25419
25420
0
    datum.refcnt = NULL;
25421
0
    size_t i;
25422
25423
0
    datum.n = n_cfm_remote_mpids;
25424
0
    datum.keys = n_cfm_remote_mpids ? xmalloc(n_cfm_remote_mpids * sizeof *datum.keys) : NULL;
25425
0
    datum.values = NULL;
25426
0
    for (i = 0; i < n_cfm_remote_mpids; i++) {
25427
0
        datum.keys[i].integer = cfm_remote_mpids[i];
25428
0
    }
25429
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_cfm_remote_mpids.type);
25430
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_CFM_REMOTE_MPIDS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25431
0
}
25432
25433
/* Sets the "cfm_remote_opstate" column from the "Interface" table in 'row' to
25434
 * the 'cfm_remote_opstate' set.
25435
 *
25436
 * If "cfm_remote_opstate" is null, the column will be the empty set,
25437
 * otherwise it will contain the specified value.
25438
 *
25439
 * Argument constraints: either "down" or "up"
25440
 *
25441
 * The caller retains ownership of the arguments. */
25442
void
25443
ovsrec_interface_index_set_cfm_remote_opstate(const struct ovsrec_interface *row, const char *cfm_remote_opstate)
25444
0
{
25445
0
    struct ovsdb_datum datum;
25446
25447
0
    datum.refcnt = NULL;
25448
0
    union ovsdb_atom *key;
25449
25450
0
    if (cfm_remote_opstate) {
25451
0
        key = xmalloc(sizeof (union ovsdb_atom));
25452
0
        datum.n = 1;
25453
0
        datum.keys = key;
25454
0
        key->s = ovsdb_atom_string_create(cfm_remote_opstate);
25455
0
    } else {
25456
0
        datum.n = 0;
25457
0
        datum.keys = NULL;
25458
0
    }
25459
0
    datum.values = NULL;
25460
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_CFM_REMOTE_OPSTATE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25461
0
}
25462
25463
/* Sets the "duplex" column from the "Interface" table in 'row' to
25464
 * the 'duplex' set.
25465
 *
25466
 * If "duplex" is null, the column will be the empty set,
25467
 * otherwise it will contain the specified value.
25468
 *
25469
 * Argument constraints: either "full" or "half"
25470
 *
25471
 * The caller retains ownership of the arguments. */
25472
void
25473
ovsrec_interface_index_set_duplex(const struct ovsrec_interface *row, const char *duplex)
25474
0
{
25475
0
    struct ovsdb_datum datum;
25476
25477
0
    datum.refcnt = NULL;
25478
0
    union ovsdb_atom *key;
25479
25480
0
    if (duplex) {
25481
0
        key = xmalloc(sizeof (union ovsdb_atom));
25482
0
        datum.n = 1;
25483
0
        datum.keys = key;
25484
0
        key->s = ovsdb_atom_string_create(duplex);
25485
0
    } else {
25486
0
        datum.n = 0;
25487
0
        datum.keys = NULL;
25488
0
    }
25489
0
    datum.values = NULL;
25490
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_DUPLEX ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25491
0
}
25492
25493
/* Sets the "error" column from the "Interface" table in 'row' to
25494
 * the 'error' set.
25495
 *
25496
 * If "error" is null, the column will be the empty set,
25497
 * otherwise it will contain the specified value.
25498
 *
25499
 * The caller retains ownership of the arguments. */
25500
void
25501
ovsrec_interface_index_set_error(const struct ovsrec_interface *row, const char *error)
25502
0
{
25503
0
    struct ovsdb_datum datum;
25504
25505
0
    datum.refcnt = NULL;
25506
0
    union ovsdb_atom *key;
25507
25508
0
    if (error) {
25509
0
        key = xmalloc(sizeof (union ovsdb_atom));
25510
0
        datum.n = 1;
25511
0
        datum.keys = key;
25512
0
        key->s = ovsdb_atom_string_create(error);
25513
0
    } else {
25514
0
        datum.n = 0;
25515
0
        datum.keys = NULL;
25516
0
    }
25517
0
    datum.values = NULL;
25518
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_ERROR ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25519
0
}
25520
25521
/* Sets the "external_ids" column's value from the "Interface" table in 'row'
25522
 * to 'external_ids'.
25523
 *
25524
 * The caller retains ownership of 'external_ids' and everything in it. */
25525
void
25526
ovsrec_interface_index_set_external_ids(const struct ovsrec_interface *row, const struct smap *external_ids)
25527
0
{
25528
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
25529
25530
0
    if (external_ids) {
25531
0
        struct smap_node *node;
25532
0
        size_t i;
25533
25534
0
        datum->n = smap_count(external_ids);
25535
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
25536
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
25537
0
        datum->refcnt = NULL;
25538
25539
0
        i = 0;
25540
0
        SMAP_FOR_EACH (node, external_ids) {
25541
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
25542
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
25543
0
            i++;
25544
0
        }
25545
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_external_ids.type);
25546
0
    } else {
25547
0
        ovsdb_datum_init_empty(datum);
25548
0
    }
25549
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
25550
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_EXTERNAL_IDS],
25551
0
                          datum,
25552
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25553
0
    free(datum);
25554
0
}
25555
25556
25557
/* Sets the "ifindex" column from the "Interface" table in 'row' to
25558
 * the 'ifindex' set with 'n_ifindex' entries.
25559
 *
25560
 * 'n_ifindex' may be 0 or 1; if it is 0, then 'ifindex'
25561
 * may be NULL.
25562
 *
25563
 * Argument constraints: in range 0 to 4,294,967,295
25564
 *
25565
 * The caller retains ownership of the arguments. */
25566
void
25567
ovsrec_interface_index_set_ifindex(const struct ovsrec_interface *row, const int64_t *ifindex, size_t n_ifindex)
25568
0
{
25569
0
    struct ovsdb_datum datum;
25570
25571
0
    datum.refcnt = NULL;
25572
0
    union ovsdb_atom *key;
25573
25574
0
    if (n_ifindex) {
25575
0
        key = xmalloc(sizeof(union ovsdb_atom));
25576
0
        datum.n = 1;
25577
0
        datum.keys = key;
25578
0
        key->integer = *ifindex;
25579
0
    } else {
25580
0
        datum.n = 0;
25581
0
        datum.keys = NULL;
25582
0
    }
25583
0
    datum.values = NULL;
25584
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_IFINDEX ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25585
0
}
25586
25587
/* Sets the "ingress_policing_burst" column from the "Interface" table in 'row' to
25588
 * 'ingress_policing_burst'.
25589
 *
25590
 * Argument constraints: at least 0
25591
 *
25592
 * The caller retains ownership of the arguments. */
25593
void
25594
ovsrec_interface_index_set_ingress_policing_burst(const struct ovsrec_interface *row, int64_t ingress_policing_burst)
25595
0
{
25596
0
    struct ovsdb_datum datum;
25597
25598
0
    datum.refcnt = NULL;
25599
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
25600
25601
0
    datum.n = 1;
25602
0
    datum.keys = key;
25603
0
    key->integer = ingress_policing_burst;
25604
0
    datum.values = NULL;
25605
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_INGRESS_POLICING_BURST ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25606
0
}
25607
25608
/* Sets the "ingress_policing_kpkts_burst" column from the "Interface" table in 'row' to
25609
 * 'ingress_policing_kpkts_burst'.
25610
 *
25611
 * Argument constraints: at least 0
25612
 *
25613
 * The caller retains ownership of the arguments. */
25614
void
25615
ovsrec_interface_index_set_ingress_policing_kpkts_burst(const struct ovsrec_interface *row, int64_t ingress_policing_kpkts_burst)
25616
0
{
25617
0
    struct ovsdb_datum datum;
25618
25619
0
    datum.refcnt = NULL;
25620
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
25621
25622
0
    datum.n = 1;
25623
0
    datum.keys = key;
25624
0
    key->integer = ingress_policing_kpkts_burst;
25625
0
    datum.values = NULL;
25626
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_INGRESS_POLICING_KPKTS_BURST ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25627
0
}
25628
25629
/* Sets the "ingress_policing_kpkts_rate" column from the "Interface" table in 'row' to
25630
 * 'ingress_policing_kpkts_rate'.
25631
 *
25632
 * Argument constraints: at least 0
25633
 *
25634
 * The caller retains ownership of the arguments. */
25635
void
25636
ovsrec_interface_index_set_ingress_policing_kpkts_rate(const struct ovsrec_interface *row, int64_t ingress_policing_kpkts_rate)
25637
0
{
25638
0
    struct ovsdb_datum datum;
25639
25640
0
    datum.refcnt = NULL;
25641
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
25642
25643
0
    datum.n = 1;
25644
0
    datum.keys = key;
25645
0
    key->integer = ingress_policing_kpkts_rate;
25646
0
    datum.values = NULL;
25647
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_INGRESS_POLICING_KPKTS_RATE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25648
0
}
25649
25650
/* Sets the "ingress_policing_rate" column from the "Interface" table in 'row' to
25651
 * 'ingress_policing_rate'.
25652
 *
25653
 * Argument constraints: at least 0
25654
 *
25655
 * The caller retains ownership of the arguments. */
25656
void
25657
ovsrec_interface_index_set_ingress_policing_rate(const struct ovsrec_interface *row, int64_t ingress_policing_rate)
25658
0
{
25659
0
    struct ovsdb_datum datum;
25660
25661
0
    datum.refcnt = NULL;
25662
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
25663
25664
0
    datum.n = 1;
25665
0
    datum.keys = key;
25666
0
    key->integer = ingress_policing_rate;
25667
0
    datum.values = NULL;
25668
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_INGRESS_POLICING_RATE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25669
0
}
25670
25671
/* Sets the "lacp_current" column from the "Interface" table in 'row' to
25672
 * the 'lacp_current' set with 'n_lacp_current' entries.
25673
 *
25674
 * 'n_lacp_current' may be 0 or 1; if it is 0, then 'lacp_current'
25675
 * may be NULL.
25676
 *
25677
 * The caller retains ownership of the arguments. */
25678
void
25679
ovsrec_interface_index_set_lacp_current(const struct ovsrec_interface *row, const bool *lacp_current, size_t n_lacp_current)
25680
0
{
25681
0
    struct ovsdb_datum datum;
25682
25683
0
    datum.refcnt = NULL;
25684
0
    union ovsdb_atom *key;
25685
25686
0
    if (n_lacp_current) {
25687
0
        key = xmalloc(sizeof(union ovsdb_atom));
25688
0
        datum.n = 1;
25689
0
        datum.keys = key;
25690
0
        key->boolean = *lacp_current;
25691
0
    } else {
25692
0
        datum.n = 0;
25693
0
        datum.keys = NULL;
25694
0
    }
25695
0
    datum.values = NULL;
25696
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_LACP_CURRENT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25697
0
}
25698
25699
/* Sets the "link_resets" column from the "Interface" table in 'row' to
25700
 * the 'link_resets' set with 'n_link_resets' entries.
25701
 *
25702
 * 'n_link_resets' may be 0 or 1; if it is 0, then 'link_resets'
25703
 * may be NULL.
25704
 *
25705
 * The caller retains ownership of the arguments. */
25706
void
25707
ovsrec_interface_index_set_link_resets(const struct ovsrec_interface *row, const int64_t *link_resets, size_t n_link_resets)
25708
0
{
25709
0
    struct ovsdb_datum datum;
25710
25711
0
    datum.refcnt = NULL;
25712
0
    union ovsdb_atom *key;
25713
25714
0
    if (n_link_resets) {
25715
0
        key = xmalloc(sizeof(union ovsdb_atom));
25716
0
        datum.n = 1;
25717
0
        datum.keys = key;
25718
0
        key->integer = *link_resets;
25719
0
    } else {
25720
0
        datum.n = 0;
25721
0
        datum.keys = NULL;
25722
0
    }
25723
0
    datum.values = NULL;
25724
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_LINK_RESETS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25725
0
}
25726
25727
/* Sets the "link_speed" column from the "Interface" table in 'row' to
25728
 * the 'link_speed' set with 'n_link_speed' entries.
25729
 *
25730
 * 'n_link_speed' may be 0 or 1; if it is 0, then 'link_speed'
25731
 * may be NULL.
25732
 *
25733
 * The caller retains ownership of the arguments. */
25734
void
25735
ovsrec_interface_index_set_link_speed(const struct ovsrec_interface *row, const int64_t *link_speed, size_t n_link_speed)
25736
0
{
25737
0
    struct ovsdb_datum datum;
25738
25739
0
    datum.refcnt = NULL;
25740
0
    union ovsdb_atom *key;
25741
25742
0
    if (n_link_speed) {
25743
0
        key = xmalloc(sizeof(union ovsdb_atom));
25744
0
        datum.n = 1;
25745
0
        datum.keys = key;
25746
0
        key->integer = *link_speed;
25747
0
    } else {
25748
0
        datum.n = 0;
25749
0
        datum.keys = NULL;
25750
0
    }
25751
0
    datum.values = NULL;
25752
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_LINK_SPEED ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25753
0
}
25754
25755
/* Sets the "link_state" column from the "Interface" table in 'row' to
25756
 * the 'link_state' set.
25757
 *
25758
 * If "link_state" is null, the column will be the empty set,
25759
 * otherwise it will contain the specified value.
25760
 *
25761
 * Argument constraints: either "down" or "up"
25762
 *
25763
 * The caller retains ownership of the arguments. */
25764
void
25765
ovsrec_interface_index_set_link_state(const struct ovsrec_interface *row, const char *link_state)
25766
0
{
25767
0
    struct ovsdb_datum datum;
25768
25769
0
    datum.refcnt = NULL;
25770
0
    union ovsdb_atom *key;
25771
25772
0
    if (link_state) {
25773
0
        key = xmalloc(sizeof (union ovsdb_atom));
25774
0
        datum.n = 1;
25775
0
        datum.keys = key;
25776
0
        key->s = ovsdb_atom_string_create(link_state);
25777
0
    } else {
25778
0
        datum.n = 0;
25779
0
        datum.keys = NULL;
25780
0
    }
25781
0
    datum.values = NULL;
25782
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_LINK_STATE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25783
0
}
25784
25785
/* Sets the "lldp" column's value from the "Interface" table in 'row'
25786
 * to 'lldp'.
25787
 *
25788
 * The caller retains ownership of 'lldp' and everything in it. */
25789
void
25790
ovsrec_interface_index_set_lldp(const struct ovsrec_interface *row, const struct smap *lldp)
25791
0
{
25792
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
25793
25794
0
    if (lldp) {
25795
0
        struct smap_node *node;
25796
0
        size_t i;
25797
25798
0
        datum->n = smap_count(lldp);
25799
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
25800
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
25801
0
        datum->refcnt = NULL;
25802
25803
0
        i = 0;
25804
0
        SMAP_FOR_EACH (node, lldp) {
25805
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
25806
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
25807
0
            i++;
25808
0
        }
25809
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_lldp.type);
25810
0
    } else {
25811
0
        ovsdb_datum_init_empty(datum);
25812
0
    }
25813
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
25814
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LLDP],
25815
0
                          datum,
25816
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25817
0
    free(datum);
25818
0
}
25819
25820
25821
/* Sets the "mac" column from the "Interface" table in 'row' to
25822
 * the 'mac' set.
25823
 *
25824
 * If "mac" is null, the column will be the empty set,
25825
 * otherwise it will contain the specified value.
25826
 *
25827
 * The caller retains ownership of the arguments. */
25828
void
25829
ovsrec_interface_index_set_mac(const struct ovsrec_interface *row, const char *mac)
25830
0
{
25831
0
    struct ovsdb_datum datum;
25832
25833
0
    datum.refcnt = NULL;
25834
0
    union ovsdb_atom *key;
25835
25836
0
    if (mac) {
25837
0
        key = xmalloc(sizeof (union ovsdb_atom));
25838
0
        datum.n = 1;
25839
0
        datum.keys = key;
25840
0
        key->s = ovsdb_atom_string_create(mac);
25841
0
    } else {
25842
0
        datum.n = 0;
25843
0
        datum.keys = NULL;
25844
0
    }
25845
0
    datum.values = NULL;
25846
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_MAC ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25847
0
}
25848
25849
/* Sets the "mac_in_use" column from the "Interface" table in 'row' to
25850
 * the 'mac_in_use' set.
25851
 *
25852
 * If "mac_in_use" is null, the column will be the empty set,
25853
 * otherwise it will contain the specified value.
25854
 *
25855
 * The caller retains ownership of the arguments. */
25856
void
25857
ovsrec_interface_index_set_mac_in_use(const struct ovsrec_interface *row, const char *mac_in_use)
25858
0
{
25859
0
    struct ovsdb_datum datum;
25860
25861
0
    datum.refcnt = NULL;
25862
0
    union ovsdb_atom *key;
25863
25864
0
    if (mac_in_use) {
25865
0
        key = xmalloc(sizeof (union ovsdb_atom));
25866
0
        datum.n = 1;
25867
0
        datum.keys = key;
25868
0
        key->s = ovsdb_atom_string_create(mac_in_use);
25869
0
    } else {
25870
0
        datum.n = 0;
25871
0
        datum.keys = NULL;
25872
0
    }
25873
0
    datum.values = NULL;
25874
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_MAC_IN_USE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25875
0
}
25876
25877
/* Sets the "mtu" column from the "Interface" table in 'row' to
25878
 * the 'mtu' set with 'n_mtu' entries.
25879
 *
25880
 * 'n_mtu' may be 0 or 1; if it is 0, then 'mtu'
25881
 * may be NULL.
25882
 *
25883
 * The caller retains ownership of the arguments. */
25884
void
25885
ovsrec_interface_index_set_mtu(const struct ovsrec_interface *row, const int64_t *mtu, size_t n_mtu)
25886
0
{
25887
0
    struct ovsdb_datum datum;
25888
25889
0
    datum.refcnt = NULL;
25890
0
    union ovsdb_atom *key;
25891
25892
0
    if (n_mtu) {
25893
0
        key = xmalloc(sizeof(union ovsdb_atom));
25894
0
        datum.n = 1;
25895
0
        datum.keys = key;
25896
0
        key->integer = *mtu;
25897
0
    } else {
25898
0
        datum.n = 0;
25899
0
        datum.keys = NULL;
25900
0
    }
25901
0
    datum.values = NULL;
25902
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_MTU ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25903
0
}
25904
25905
/* Sets the "mtu_request" column from the "Interface" table in 'row' to
25906
 * the 'mtu_request' set with 'n_mtu_request' entries.
25907
 *
25908
 * 'n_mtu_request' may be 0 or 1; if it is 0, then 'mtu_request'
25909
 * may be NULL.
25910
 *
25911
 * Argument constraints: at least 1
25912
 *
25913
 * The caller retains ownership of the arguments. */
25914
void
25915
ovsrec_interface_index_set_mtu_request(const struct ovsrec_interface *row, const int64_t *mtu_request, size_t n_mtu_request)
25916
0
{
25917
0
    struct ovsdb_datum datum;
25918
25919
0
    datum.refcnt = NULL;
25920
0
    union ovsdb_atom *key;
25921
25922
0
    if (n_mtu_request) {
25923
0
        key = xmalloc(sizeof(union ovsdb_atom));
25924
0
        datum.n = 1;
25925
0
        datum.keys = key;
25926
0
        key->integer = *mtu_request;
25927
0
    } else {
25928
0
        datum.n = 0;
25929
0
        datum.keys = NULL;
25930
0
    }
25931
0
    datum.values = NULL;
25932
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_MTU_REQUEST ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25933
0
}
25934
25935
/* Sets the "name" column from the "Interface" table in 'row' to
25936
 * 'name'.
25937
 *
25938
 * The caller retains ownership of the arguments. */
25939
void
25940
ovsrec_interface_index_set_name(const struct ovsrec_interface *row, const char *name)
25941
0
{
25942
0
    struct ovsdb_datum datum;
25943
25944
0
    datum.refcnt = NULL;
25945
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
25946
25947
0
    datum.n = 1;
25948
0
    datum.keys = key;
25949
0
    key->s = ovsdb_atom_string_create(name);
25950
0
    datum.values = NULL;
25951
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_NAME ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25952
0
}
25953
25954
/* Sets the "ofport" column from the "Interface" table in 'row' to
25955
 * the 'ofport' set with 'n_ofport' entries.
25956
 *
25957
 * 'n_ofport' may be 0 or 1; if it is 0, then 'ofport'
25958
 * may be NULL.
25959
 *
25960
 * The caller retains ownership of the arguments. */
25961
void
25962
ovsrec_interface_index_set_ofport(const struct ovsrec_interface *row, const int64_t *ofport, size_t n_ofport)
25963
0
{
25964
0
    struct ovsdb_datum datum;
25965
25966
0
    datum.refcnt = NULL;
25967
0
    union ovsdb_atom *key;
25968
25969
0
    if (n_ofport) {
25970
0
        key = xmalloc(sizeof(union ovsdb_atom));
25971
0
        datum.n = 1;
25972
0
        datum.keys = key;
25973
0
        key->integer = *ofport;
25974
0
    } else {
25975
0
        datum.n = 0;
25976
0
        datum.keys = NULL;
25977
0
    }
25978
0
    datum.values = NULL;
25979
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_OFPORT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
25980
0
}
25981
25982
/* Sets the "ofport_request" column from the "Interface" table in 'row' to
25983
 * the 'ofport_request' set with 'n_ofport_request' entries.
25984
 *
25985
 * 'n_ofport_request' may be 0 or 1; if it is 0, then 'ofport_request'
25986
 * may be NULL.
25987
 *
25988
 * Argument constraints: in range 1 to 65,279
25989
 *
25990
 * The caller retains ownership of the arguments. */
25991
void
25992
ovsrec_interface_index_set_ofport_request(const struct ovsrec_interface *row, const int64_t *ofport_request, size_t n_ofport_request)
25993
0
{
25994
0
    struct ovsdb_datum datum;
25995
25996
0
    datum.refcnt = NULL;
25997
0
    union ovsdb_atom *key;
25998
25999
0
    if (n_ofport_request) {
26000
0
        key = xmalloc(sizeof(union ovsdb_atom));
26001
0
        datum.n = 1;
26002
0
        datum.keys = key;
26003
0
        key->integer = *ofport_request;
26004
0
    } else {
26005
0
        datum.n = 0;
26006
0
        datum.keys = NULL;
26007
0
    }
26008
0
    datum.values = NULL;
26009
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_OFPORT_REQUEST ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
26010
0
}
26011
26012
/* Sets the "options" column's value from the "Interface" table in 'row'
26013
 * to 'options'.
26014
 *
26015
 * The caller retains ownership of 'options' and everything in it. */
26016
void
26017
ovsrec_interface_index_set_options(const struct ovsrec_interface *row, const struct smap *options)
26018
0
{
26019
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
26020
26021
0
    if (options) {
26022
0
        struct smap_node *node;
26023
0
        size_t i;
26024
26025
0
        datum->n = smap_count(options);
26026
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
26027
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
26028
0
        datum->refcnt = NULL;
26029
26030
0
        i = 0;
26031
0
        SMAP_FOR_EACH (node, options) {
26032
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
26033
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
26034
0
            i++;
26035
0
        }
26036
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_options.type);
26037
0
    } else {
26038
0
        ovsdb_datum_init_empty(datum);
26039
0
    }
26040
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
26041
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OPTIONS],
26042
0
                          datum,
26043
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
26044
0
    free(datum);
26045
0
}
26046
26047
26048
/* Sets the "other_config" column's value from the "Interface" table in 'row'
26049
 * to 'other_config'.
26050
 *
26051
 * The caller retains ownership of 'other_config' and everything in it. */
26052
void
26053
ovsrec_interface_index_set_other_config(const struct ovsrec_interface *row, const struct smap *other_config)
26054
0
{
26055
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
26056
26057
0
    if (other_config) {
26058
0
        struct smap_node *node;
26059
0
        size_t i;
26060
26061
0
        datum->n = smap_count(other_config);
26062
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
26063
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
26064
0
        datum->refcnt = NULL;
26065
26066
0
        i = 0;
26067
0
        SMAP_FOR_EACH (node, other_config) {
26068
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
26069
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
26070
0
            i++;
26071
0
        }
26072
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_other_config.type);
26073
0
    } else {
26074
0
        ovsdb_datum_init_empty(datum);
26075
0
    }
26076
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
26077
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OTHER_CONFIG],
26078
0
                          datum,
26079
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
26080
0
    free(datum);
26081
0
}
26082
26083
26084
/* Sets the "statistics" column from the "Interface" table in 'row' to
26085
 * the map with keys 'key_statistics' and values 'value_statistics'
26086
 * with 'n_statistics' entries.
26087
 *
26088
 * The caller retains ownership of the arguments. */
26089
void
26090
ovsrec_interface_index_set_statistics(const struct ovsrec_interface *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
26091
0
{
26092
0
    struct ovsdb_datum datum;
26093
26094
0
    datum.refcnt = NULL;
26095
0
    size_t i;
26096
26097
0
    datum.n = n_statistics;
26098
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
26099
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
26100
0
    for (i = 0; i < n_statistics; i++) {
26101
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
26102
0
        datum.values[i].integer = value_statistics[i];
26103
0
    }
26104
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_statistics.type);
26105
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_STATISTICS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
26106
0
}
26107
26108
/* Sets the "status" column's value from the "Interface" table in 'row'
26109
 * to 'status'.
26110
 *
26111
 * The caller retains ownership of 'status' and everything in it. */
26112
void
26113
ovsrec_interface_index_set_status(const struct ovsrec_interface *row, const struct smap *status)
26114
0
{
26115
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
26116
26117
0
    if (status) {
26118
0
        struct smap_node *node;
26119
0
        size_t i;
26120
26121
0
        datum->n = smap_count(status);
26122
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
26123
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
26124
0
        datum->refcnt = NULL;
26125
26126
0
        i = 0;
26127
0
        SMAP_FOR_EACH (node, status) {
26128
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
26129
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
26130
0
            i++;
26131
0
        }
26132
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_status.type);
26133
0
    } else {
26134
0
        ovsdb_datum_init_empty(datum);
26135
0
    }
26136
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
26137
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_STATUS],
26138
0
                          datum,
26139
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
26140
0
    free(datum);
26141
0
}
26142
26143
26144
/* Sets the "type" column from the "Interface" table in 'row' to
26145
 * 'type'.
26146
 *
26147
 * The caller retains ownership of the arguments. */
26148
void
26149
ovsrec_interface_index_set_type(const struct ovsrec_interface *row, const char *type)
26150
0
{
26151
0
    struct ovsdb_datum datum;
26152
26153
0
    datum.refcnt = NULL;
26154
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
26155
26156
0
    datum.n = 1;
26157
0
    datum.keys = key;
26158
0
    key->s = ovsdb_atom_string_create(type);
26159
0
    datum.values = NULL;
26160
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_interface_columns[ OVSREC_INTERFACE_COL_TYPE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
26161
0
}
26162
26163
struct ovsdb_idl_column ovsrec_interface_columns[OVSREC_INTERFACE_N_COLUMNS];
26164
26165
unsigned int
26166
ovsrec_interface_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
26167
0
{
26168
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_interface, condition);
26169
0
}
26170
static struct json Interface_col_admin_state_key_enum_key_strings[2] = {
26171
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "down", .count = 2 },
26172
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "up", .count = 2 },
26173
};
26174
static union ovsdb_atom Interface_col_admin_state_key_enum_keys[2] = {
26175
    { .s = &Interface_col_admin_state_key_enum_key_strings[0] },
26176
    { .s = &Interface_col_admin_state_key_enum_key_strings[1] },
26177
};
26178
static struct ovsdb_datum Interface_col_admin_state_key_enum = {
26179
    .n = 2,
26180
    .keys = Interface_col_admin_state_key_enum_keys,
26181
};
26182
static struct json Interface_col_cfm_remote_opstate_key_enum_key_strings[2] = {
26183
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "down", .count = 2 },
26184
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "up", .count = 2 },
26185
};
26186
static union ovsdb_atom Interface_col_cfm_remote_opstate_key_enum_keys[2] = {
26187
    { .s = &Interface_col_cfm_remote_opstate_key_enum_key_strings[0] },
26188
    { .s = &Interface_col_cfm_remote_opstate_key_enum_key_strings[1] },
26189
};
26190
static struct ovsdb_datum Interface_col_cfm_remote_opstate_key_enum = {
26191
    .n = 2,
26192
    .keys = Interface_col_cfm_remote_opstate_key_enum_keys,
26193
};
26194
static struct json Interface_col_duplex_key_enum_key_strings[2] = {
26195
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "full", .count = 2 },
26196
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "half", .count = 2 },
26197
};
26198
static union ovsdb_atom Interface_col_duplex_key_enum_keys[2] = {
26199
    { .s = &Interface_col_duplex_key_enum_key_strings[0] },
26200
    { .s = &Interface_col_duplex_key_enum_key_strings[1] },
26201
};
26202
static struct ovsdb_datum Interface_col_duplex_key_enum = {
26203
    .n = 2,
26204
    .keys = Interface_col_duplex_key_enum_keys,
26205
};
26206
static struct json Interface_col_link_state_key_enum_key_strings[2] = {
26207
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "down", .count = 2 },
26208
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "up", .count = 2 },
26209
};
26210
static union ovsdb_atom Interface_col_link_state_key_enum_keys[2] = {
26211
    { .s = &Interface_col_link_state_key_enum_key_strings[0] },
26212
    { .s = &Interface_col_link_state_key_enum_key_strings[1] },
26213
};
26214
static struct ovsdb_datum Interface_col_link_state_key_enum = {
26215
    .n = 2,
26216
    .keys = Interface_col_link_state_key_enum_keys,
26217
};
26218
26219
struct ovsdb_idl_column ovsrec_interface_columns[OVSREC_INTERFACE_N_COLUMNS] = {
26220
    [OVSREC_INTERFACE_COL_ADMIN_STATE] = {
26221
         .name = "admin_state",
26222
         .type = {
26223
            .key = {
26224
               .type = OVSDB_TYPE_STRING,
26225
               .enum_ = &Interface_col_admin_state_key_enum,
26226
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26227
            },
26228
            .value = OVSDB_BASE_VOID_INIT,
26229
            .n_min = 0,
26230
            .n_max = 1,
26231
         },
26232
         .is_mutable = true,
26233
         .is_synthetic = false,
26234
         .parse = ovsrec_interface_parse_admin_state,
26235
         .unparse = ovsrec_interface_unparse_admin_state,
26236
    },
26237
26238
    [OVSREC_INTERFACE_COL_BFD] = {
26239
         .name = "bfd",
26240
         .type = {
26241
            .key = {
26242
               .type = OVSDB_TYPE_STRING,
26243
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26244
            },
26245
            .value = {
26246
                .type = OVSDB_TYPE_STRING,
26247
                .string = { .minLen = 0, .maxLen = UINT_MAX },
26248
            },
26249
            .n_min = 0,
26250
            .n_max = UINT_MAX,
26251
         },
26252
         .is_mutable = true,
26253
         .is_synthetic = false,
26254
         .parse = ovsrec_interface_parse_bfd,
26255
         .unparse = ovsrec_interface_unparse_bfd,
26256
    },
26257
26258
    [OVSREC_INTERFACE_COL_BFD_STATUS] = {
26259
         .name = "bfd_status",
26260
         .type = {
26261
            .key = {
26262
               .type = OVSDB_TYPE_STRING,
26263
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26264
            },
26265
            .value = {
26266
                .type = OVSDB_TYPE_STRING,
26267
                .string = { .minLen = 0, .maxLen = UINT_MAX },
26268
            },
26269
            .n_min = 0,
26270
            .n_max = UINT_MAX,
26271
         },
26272
         .is_mutable = true,
26273
         .is_synthetic = false,
26274
         .parse = ovsrec_interface_parse_bfd_status,
26275
         .unparse = ovsrec_interface_unparse_bfd_status,
26276
    },
26277
26278
    [OVSREC_INTERFACE_COL_CFM_FAULT] = {
26279
         .name = "cfm_fault",
26280
         .type = {
26281
            .key = {
26282
               .type = OVSDB_TYPE_BOOLEAN,
26283
            },
26284
            .value = OVSDB_BASE_VOID_INIT,
26285
            .n_min = 0,
26286
            .n_max = 1,
26287
         },
26288
         .is_mutable = true,
26289
         .is_synthetic = false,
26290
         .parse = ovsrec_interface_parse_cfm_fault,
26291
         .unparse = ovsrec_interface_unparse_cfm_fault,
26292
    },
26293
26294
    [OVSREC_INTERFACE_COL_CFM_FAULT_STATUS] = {
26295
         .name = "cfm_fault_status",
26296
         .type = {
26297
            .key = {
26298
               .type = OVSDB_TYPE_STRING,
26299
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26300
            },
26301
            .value = OVSDB_BASE_VOID_INIT,
26302
            .n_min = 0,
26303
            .n_max = UINT_MAX,
26304
         },
26305
         .is_mutable = true,
26306
         .is_synthetic = false,
26307
         .parse = ovsrec_interface_parse_cfm_fault_status,
26308
         .unparse = ovsrec_interface_unparse_cfm_fault_status,
26309
    },
26310
26311
    [OVSREC_INTERFACE_COL_CFM_FLAP_COUNT] = {
26312
         .name = "cfm_flap_count",
26313
         .type = {
26314
            .key = {
26315
               .type = OVSDB_TYPE_INTEGER,
26316
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
26317
            },
26318
            .value = OVSDB_BASE_VOID_INIT,
26319
            .n_min = 0,
26320
            .n_max = 1,
26321
         },
26322
         .is_mutable = true,
26323
         .is_synthetic = false,
26324
         .parse = ovsrec_interface_parse_cfm_flap_count,
26325
         .unparse = ovsrec_interface_unparse_cfm_flap_count,
26326
    },
26327
26328
    [OVSREC_INTERFACE_COL_CFM_HEALTH] = {
26329
         .name = "cfm_health",
26330
         .type = {
26331
            .key = {
26332
               .type = OVSDB_TYPE_INTEGER,
26333
               .integer = { .min = INT64_C(0), .max = INT64_C(100) },
26334
            },
26335
            .value = OVSDB_BASE_VOID_INIT,
26336
            .n_min = 0,
26337
            .n_max = 1,
26338
         },
26339
         .is_mutable = true,
26340
         .is_synthetic = false,
26341
         .parse = ovsrec_interface_parse_cfm_health,
26342
         .unparse = ovsrec_interface_unparse_cfm_health,
26343
    },
26344
26345
    [OVSREC_INTERFACE_COL_CFM_MPID] = {
26346
         .name = "cfm_mpid",
26347
         .type = {
26348
            .key = {
26349
               .type = OVSDB_TYPE_INTEGER,
26350
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
26351
            },
26352
            .value = OVSDB_BASE_VOID_INIT,
26353
            .n_min = 0,
26354
            .n_max = 1,
26355
         },
26356
         .is_mutable = true,
26357
         .is_synthetic = false,
26358
         .parse = ovsrec_interface_parse_cfm_mpid,
26359
         .unparse = ovsrec_interface_unparse_cfm_mpid,
26360
    },
26361
26362
    [OVSREC_INTERFACE_COL_CFM_REMOTE_MPIDS] = {
26363
         .name = "cfm_remote_mpids",
26364
         .type = {
26365
            .key = {
26366
               .type = OVSDB_TYPE_INTEGER,
26367
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
26368
            },
26369
            .value = OVSDB_BASE_VOID_INIT,
26370
            .n_min = 0,
26371
            .n_max = UINT_MAX,
26372
         },
26373
         .is_mutable = true,
26374
         .is_synthetic = false,
26375
         .parse = ovsrec_interface_parse_cfm_remote_mpids,
26376
         .unparse = ovsrec_interface_unparse_cfm_remote_mpids,
26377
    },
26378
26379
    [OVSREC_INTERFACE_COL_CFM_REMOTE_OPSTATE] = {
26380
         .name = "cfm_remote_opstate",
26381
         .type = {
26382
            .key = {
26383
               .type = OVSDB_TYPE_STRING,
26384
               .enum_ = &Interface_col_cfm_remote_opstate_key_enum,
26385
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26386
            },
26387
            .value = OVSDB_BASE_VOID_INIT,
26388
            .n_min = 0,
26389
            .n_max = 1,
26390
         },
26391
         .is_mutable = true,
26392
         .is_synthetic = false,
26393
         .parse = ovsrec_interface_parse_cfm_remote_opstate,
26394
         .unparse = ovsrec_interface_unparse_cfm_remote_opstate,
26395
    },
26396
26397
    [OVSREC_INTERFACE_COL_DUPLEX] = {
26398
         .name = "duplex",
26399
         .type = {
26400
            .key = {
26401
               .type = OVSDB_TYPE_STRING,
26402
               .enum_ = &Interface_col_duplex_key_enum,
26403
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26404
            },
26405
            .value = OVSDB_BASE_VOID_INIT,
26406
            .n_min = 0,
26407
            .n_max = 1,
26408
         },
26409
         .is_mutable = true,
26410
         .is_synthetic = false,
26411
         .parse = ovsrec_interface_parse_duplex,
26412
         .unparse = ovsrec_interface_unparse_duplex,
26413
    },
26414
26415
    [OVSREC_INTERFACE_COL_ERROR] = {
26416
         .name = "error",
26417
         .type = {
26418
            .key = {
26419
               .type = OVSDB_TYPE_STRING,
26420
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26421
            },
26422
            .value = OVSDB_BASE_VOID_INIT,
26423
            .n_min = 0,
26424
            .n_max = 1,
26425
         },
26426
         .is_mutable = true,
26427
         .is_synthetic = false,
26428
         .parse = ovsrec_interface_parse_error,
26429
         .unparse = ovsrec_interface_unparse_error,
26430
    },
26431
26432
    [OVSREC_INTERFACE_COL_EXTERNAL_IDS] = {
26433
         .name = "external_ids",
26434
         .type = {
26435
            .key = {
26436
               .type = OVSDB_TYPE_STRING,
26437
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26438
            },
26439
            .value = {
26440
                .type = OVSDB_TYPE_STRING,
26441
                .string = { .minLen = 0, .maxLen = UINT_MAX },
26442
            },
26443
            .n_min = 0,
26444
            .n_max = UINT_MAX,
26445
         },
26446
         .is_mutable = true,
26447
         .is_synthetic = false,
26448
         .parse = ovsrec_interface_parse_external_ids,
26449
         .unparse = ovsrec_interface_unparse_external_ids,
26450
    },
26451
26452
    [OVSREC_INTERFACE_COL_IFINDEX] = {
26453
         .name = "ifindex",
26454
         .type = {
26455
            .key = {
26456
               .type = OVSDB_TYPE_INTEGER,
26457
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
26458
            },
26459
            .value = OVSDB_BASE_VOID_INIT,
26460
            .n_min = 0,
26461
            .n_max = 1,
26462
         },
26463
         .is_mutable = true,
26464
         .is_synthetic = false,
26465
         .parse = ovsrec_interface_parse_ifindex,
26466
         .unparse = ovsrec_interface_unparse_ifindex,
26467
    },
26468
26469
    [OVSREC_INTERFACE_COL_INGRESS_POLICING_BURST] = {
26470
         .name = "ingress_policing_burst",
26471
         .type = {
26472
            .key = {
26473
               .type = OVSDB_TYPE_INTEGER,
26474
               .integer = { .min = INT64_C(0), .max = INT64_MAX },
26475
            },
26476
            .value = OVSDB_BASE_VOID_INIT,
26477
            .n_min = 1,
26478
            .n_max = 1,
26479
         },
26480
         .is_mutable = true,
26481
         .is_synthetic = false,
26482
         .parse = ovsrec_interface_parse_ingress_policing_burst,
26483
         .unparse = ovsrec_interface_unparse_ingress_policing_burst,
26484
    },
26485
26486
    [OVSREC_INTERFACE_COL_INGRESS_POLICING_KPKTS_BURST] = {
26487
         .name = "ingress_policing_kpkts_burst",
26488
         .type = {
26489
            .key = {
26490
               .type = OVSDB_TYPE_INTEGER,
26491
               .integer = { .min = INT64_C(0), .max = INT64_MAX },
26492
            },
26493
            .value = OVSDB_BASE_VOID_INIT,
26494
            .n_min = 1,
26495
            .n_max = 1,
26496
         },
26497
         .is_mutable = true,
26498
         .is_synthetic = false,
26499
         .parse = ovsrec_interface_parse_ingress_policing_kpkts_burst,
26500
         .unparse = ovsrec_interface_unparse_ingress_policing_kpkts_burst,
26501
    },
26502
26503
    [OVSREC_INTERFACE_COL_INGRESS_POLICING_KPKTS_RATE] = {
26504
         .name = "ingress_policing_kpkts_rate",
26505
         .type = {
26506
            .key = {
26507
               .type = OVSDB_TYPE_INTEGER,
26508
               .integer = { .min = INT64_C(0), .max = INT64_MAX },
26509
            },
26510
            .value = OVSDB_BASE_VOID_INIT,
26511
            .n_min = 1,
26512
            .n_max = 1,
26513
         },
26514
         .is_mutable = true,
26515
         .is_synthetic = false,
26516
         .parse = ovsrec_interface_parse_ingress_policing_kpkts_rate,
26517
         .unparse = ovsrec_interface_unparse_ingress_policing_kpkts_rate,
26518
    },
26519
26520
    [OVSREC_INTERFACE_COL_INGRESS_POLICING_RATE] = {
26521
         .name = "ingress_policing_rate",
26522
         .type = {
26523
            .key = {
26524
               .type = OVSDB_TYPE_INTEGER,
26525
               .integer = { .min = INT64_C(0), .max = INT64_MAX },
26526
            },
26527
            .value = OVSDB_BASE_VOID_INIT,
26528
            .n_min = 1,
26529
            .n_max = 1,
26530
         },
26531
         .is_mutable = true,
26532
         .is_synthetic = false,
26533
         .parse = ovsrec_interface_parse_ingress_policing_rate,
26534
         .unparse = ovsrec_interface_unparse_ingress_policing_rate,
26535
    },
26536
26537
    [OVSREC_INTERFACE_COL_LACP_CURRENT] = {
26538
         .name = "lacp_current",
26539
         .type = {
26540
            .key = {
26541
               .type = OVSDB_TYPE_BOOLEAN,
26542
            },
26543
            .value = OVSDB_BASE_VOID_INIT,
26544
            .n_min = 0,
26545
            .n_max = 1,
26546
         },
26547
         .is_mutable = true,
26548
         .is_synthetic = false,
26549
         .parse = ovsrec_interface_parse_lacp_current,
26550
         .unparse = ovsrec_interface_unparse_lacp_current,
26551
    },
26552
26553
    [OVSREC_INTERFACE_COL_LINK_RESETS] = {
26554
         .name = "link_resets",
26555
         .type = {
26556
            .key = {
26557
               .type = OVSDB_TYPE_INTEGER,
26558
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
26559
            },
26560
            .value = OVSDB_BASE_VOID_INIT,
26561
            .n_min = 0,
26562
            .n_max = 1,
26563
         },
26564
         .is_mutable = true,
26565
         .is_synthetic = false,
26566
         .parse = ovsrec_interface_parse_link_resets,
26567
         .unparse = ovsrec_interface_unparse_link_resets,
26568
    },
26569
26570
    [OVSREC_INTERFACE_COL_LINK_SPEED] = {
26571
         .name = "link_speed",
26572
         .type = {
26573
            .key = {
26574
               .type = OVSDB_TYPE_INTEGER,
26575
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
26576
            },
26577
            .value = OVSDB_BASE_VOID_INIT,
26578
            .n_min = 0,
26579
            .n_max = 1,
26580
         },
26581
         .is_mutable = true,
26582
         .is_synthetic = false,
26583
         .parse = ovsrec_interface_parse_link_speed,
26584
         .unparse = ovsrec_interface_unparse_link_speed,
26585
    },
26586
26587
    [OVSREC_INTERFACE_COL_LINK_STATE] = {
26588
         .name = "link_state",
26589
         .type = {
26590
            .key = {
26591
               .type = OVSDB_TYPE_STRING,
26592
               .enum_ = &Interface_col_link_state_key_enum,
26593
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26594
            },
26595
            .value = OVSDB_BASE_VOID_INIT,
26596
            .n_min = 0,
26597
            .n_max = 1,
26598
         },
26599
         .is_mutable = true,
26600
         .is_synthetic = false,
26601
         .parse = ovsrec_interface_parse_link_state,
26602
         .unparse = ovsrec_interface_unparse_link_state,
26603
    },
26604
26605
    [OVSREC_INTERFACE_COL_LLDP] = {
26606
         .name = "lldp",
26607
         .type = {
26608
            .key = {
26609
               .type = OVSDB_TYPE_STRING,
26610
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26611
            },
26612
            .value = {
26613
                .type = OVSDB_TYPE_STRING,
26614
                .string = { .minLen = 0, .maxLen = UINT_MAX },
26615
            },
26616
            .n_min = 0,
26617
            .n_max = UINT_MAX,
26618
         },
26619
         .is_mutable = true,
26620
         .is_synthetic = false,
26621
         .parse = ovsrec_interface_parse_lldp,
26622
         .unparse = ovsrec_interface_unparse_lldp,
26623
    },
26624
26625
    [OVSREC_INTERFACE_COL_MAC] = {
26626
         .name = "mac",
26627
         .type = {
26628
            .key = {
26629
               .type = OVSDB_TYPE_STRING,
26630
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26631
            },
26632
            .value = OVSDB_BASE_VOID_INIT,
26633
            .n_min = 0,
26634
            .n_max = 1,
26635
         },
26636
         .is_mutable = true,
26637
         .is_synthetic = false,
26638
         .parse = ovsrec_interface_parse_mac,
26639
         .unparse = ovsrec_interface_unparse_mac,
26640
    },
26641
26642
    [OVSREC_INTERFACE_COL_MAC_IN_USE] = {
26643
         .name = "mac_in_use",
26644
         .type = {
26645
            .key = {
26646
               .type = OVSDB_TYPE_STRING,
26647
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26648
            },
26649
            .value = OVSDB_BASE_VOID_INIT,
26650
            .n_min = 0,
26651
            .n_max = 1,
26652
         },
26653
         .is_mutable = true,
26654
         .is_synthetic = false,
26655
         .parse = ovsrec_interface_parse_mac_in_use,
26656
         .unparse = ovsrec_interface_unparse_mac_in_use,
26657
    },
26658
26659
    [OVSREC_INTERFACE_COL_MTU] = {
26660
         .name = "mtu",
26661
         .type = {
26662
            .key = {
26663
               .type = OVSDB_TYPE_INTEGER,
26664
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
26665
            },
26666
            .value = OVSDB_BASE_VOID_INIT,
26667
            .n_min = 0,
26668
            .n_max = 1,
26669
         },
26670
         .is_mutable = true,
26671
         .is_synthetic = false,
26672
         .parse = ovsrec_interface_parse_mtu,
26673
         .unparse = ovsrec_interface_unparse_mtu,
26674
    },
26675
26676
    [OVSREC_INTERFACE_COL_MTU_REQUEST] = {
26677
         .name = "mtu_request",
26678
         .type = {
26679
            .key = {
26680
               .type = OVSDB_TYPE_INTEGER,
26681
               .integer = { .min = INT64_C(1), .max = INT64_MAX },
26682
            },
26683
            .value = OVSDB_BASE_VOID_INIT,
26684
            .n_min = 0,
26685
            .n_max = 1,
26686
         },
26687
         .is_mutable = true,
26688
         .is_synthetic = false,
26689
         .parse = ovsrec_interface_parse_mtu_request,
26690
         .unparse = ovsrec_interface_unparse_mtu_request,
26691
    },
26692
26693
    [OVSREC_INTERFACE_COL_NAME] = {
26694
         .name = "name",
26695
         .type = {
26696
            .key = {
26697
               .type = OVSDB_TYPE_STRING,
26698
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26699
            },
26700
            .value = OVSDB_BASE_VOID_INIT,
26701
            .n_min = 1,
26702
            .n_max = 1,
26703
         },
26704
         .is_mutable = false,
26705
         .is_synthetic = false,
26706
         .parse = ovsrec_interface_parse_name,
26707
         .unparse = ovsrec_interface_unparse_name,
26708
    },
26709
26710
    [OVSREC_INTERFACE_COL_OFPORT] = {
26711
         .name = "ofport",
26712
         .type = {
26713
            .key = {
26714
               .type = OVSDB_TYPE_INTEGER,
26715
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
26716
            },
26717
            .value = OVSDB_BASE_VOID_INIT,
26718
            .n_min = 0,
26719
            .n_max = 1,
26720
         },
26721
         .is_mutable = true,
26722
         .is_synthetic = false,
26723
         .parse = ovsrec_interface_parse_ofport,
26724
         .unparse = ovsrec_interface_unparse_ofport,
26725
    },
26726
26727
    [OVSREC_INTERFACE_COL_OFPORT_REQUEST] = {
26728
         .name = "ofport_request",
26729
         .type = {
26730
            .key = {
26731
               .type = OVSDB_TYPE_INTEGER,
26732
               .integer = { .min = INT64_C(1), .max = INT64_C(65279) },
26733
            },
26734
            .value = OVSDB_BASE_VOID_INIT,
26735
            .n_min = 0,
26736
            .n_max = 1,
26737
         },
26738
         .is_mutable = true,
26739
         .is_synthetic = false,
26740
         .parse = ovsrec_interface_parse_ofport_request,
26741
         .unparse = ovsrec_interface_unparse_ofport_request,
26742
    },
26743
26744
    [OVSREC_INTERFACE_COL_OPTIONS] = {
26745
         .name = "options",
26746
         .type = {
26747
            .key = {
26748
               .type = OVSDB_TYPE_STRING,
26749
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26750
            },
26751
            .value = {
26752
                .type = OVSDB_TYPE_STRING,
26753
                .string = { .minLen = 0, .maxLen = UINT_MAX },
26754
            },
26755
            .n_min = 0,
26756
            .n_max = UINT_MAX,
26757
         },
26758
         .is_mutable = true,
26759
         .is_synthetic = false,
26760
         .parse = ovsrec_interface_parse_options,
26761
         .unparse = ovsrec_interface_unparse_options,
26762
    },
26763
26764
    [OVSREC_INTERFACE_COL_OTHER_CONFIG] = {
26765
         .name = "other_config",
26766
         .type = {
26767
            .key = {
26768
               .type = OVSDB_TYPE_STRING,
26769
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26770
            },
26771
            .value = {
26772
                .type = OVSDB_TYPE_STRING,
26773
                .string = { .minLen = 0, .maxLen = UINT_MAX },
26774
            },
26775
            .n_min = 0,
26776
            .n_max = UINT_MAX,
26777
         },
26778
         .is_mutable = true,
26779
         .is_synthetic = false,
26780
         .parse = ovsrec_interface_parse_other_config,
26781
         .unparse = ovsrec_interface_unparse_other_config,
26782
    },
26783
26784
    [OVSREC_INTERFACE_COL_STATISTICS] = {
26785
         .name = "statistics",
26786
         .type = {
26787
            .key = {
26788
               .type = OVSDB_TYPE_STRING,
26789
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26790
            },
26791
            .value = {
26792
                .type = OVSDB_TYPE_INTEGER,
26793
                .integer = { .min = INT64_MIN, .max = INT64_MAX },
26794
            },
26795
            .n_min = 0,
26796
            .n_max = UINT_MAX,
26797
         },
26798
         .is_mutable = true,
26799
         .is_synthetic = false,
26800
         .parse = ovsrec_interface_parse_statistics,
26801
         .unparse = ovsrec_interface_unparse_statistics,
26802
    },
26803
26804
    [OVSREC_INTERFACE_COL_STATUS] = {
26805
         .name = "status",
26806
         .type = {
26807
            .key = {
26808
               .type = OVSDB_TYPE_STRING,
26809
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26810
            },
26811
            .value = {
26812
                .type = OVSDB_TYPE_STRING,
26813
                .string = { .minLen = 0, .maxLen = UINT_MAX },
26814
            },
26815
            .n_min = 0,
26816
            .n_max = UINT_MAX,
26817
         },
26818
         .is_mutable = true,
26819
         .is_synthetic = false,
26820
         .parse = ovsrec_interface_parse_status,
26821
         .unparse = ovsrec_interface_unparse_status,
26822
    },
26823
26824
    [OVSREC_INTERFACE_COL_TYPE] = {
26825
         .name = "type",
26826
         .type = {
26827
            .key = {
26828
               .type = OVSDB_TYPE_STRING,
26829
               .string = { .minLen = 0, .maxLen = UINT_MAX },
26830
            },
26831
            .value = OVSDB_BASE_VOID_INIT,
26832
            .n_min = 1,
26833
            .n_max = 1,
26834
         },
26835
         .is_mutable = true,
26836
         .is_synthetic = false,
26837
         .parse = ovsrec_interface_parse_type,
26838
         .unparse = ovsrec_interface_unparse_type,
26839
    },
26840
26841
};
26842

26843
/* Manager table. */
26844
26845
bool
26846
ovsrec_server_has_manager_table_col_connection_mode(const struct ovsdb_idl *idl)
26847
0
{
26848
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_connection_mode);
26849
0
}
26850
26851
const struct ovsdb_type *
26852
ovsrec_manager_connection_mode_server_type(const struct ovsdb_idl *idl)
26853
0
{
26854
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_manager_col_connection_mode);
26855
0
}
26856
26857
26858
bool
26859
ovsrec_server_has_manager_table_col_external_ids(const struct ovsdb_idl *idl)
26860
0
{
26861
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_external_ids);
26862
0
}
26863
26864
const struct ovsdb_type *
26865
ovsrec_manager_external_ids_server_type(const struct ovsdb_idl *idl)
26866
0
{
26867
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_manager_col_external_ids);
26868
0
}
26869
26870
26871
bool
26872
ovsrec_server_has_manager_table_col_inactivity_probe(const struct ovsdb_idl *idl)
26873
0
{
26874
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_inactivity_probe);
26875
0
}
26876
26877
const struct ovsdb_type *
26878
ovsrec_manager_inactivity_probe_server_type(const struct ovsdb_idl *idl)
26879
0
{
26880
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_manager_col_inactivity_probe);
26881
0
}
26882
26883
26884
bool
26885
ovsrec_server_has_manager_table_col_is_connected(const struct ovsdb_idl *idl)
26886
0
{
26887
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_is_connected);
26888
0
}
26889
26890
const struct ovsdb_type *
26891
ovsrec_manager_is_connected_server_type(const struct ovsdb_idl *idl)
26892
0
{
26893
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_manager_col_is_connected);
26894
0
}
26895
26896
26897
bool
26898
ovsrec_server_has_manager_table_col_max_backoff(const struct ovsdb_idl *idl)
26899
0
{
26900
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_max_backoff);
26901
0
}
26902
26903
const struct ovsdb_type *
26904
ovsrec_manager_max_backoff_server_type(const struct ovsdb_idl *idl)
26905
0
{
26906
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_manager_col_max_backoff);
26907
0
}
26908
26909
26910
bool
26911
ovsrec_server_has_manager_table_col_other_config(const struct ovsdb_idl *idl)
26912
0
{
26913
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_other_config);
26914
0
}
26915
26916
const struct ovsdb_type *
26917
ovsrec_manager_other_config_server_type(const struct ovsdb_idl *idl)
26918
0
{
26919
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_manager_col_other_config);
26920
0
}
26921
26922
26923
bool
26924
ovsrec_server_has_manager_table_col_status(const struct ovsdb_idl *idl)
26925
0
{
26926
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_status);
26927
0
}
26928
26929
const struct ovsdb_type *
26930
ovsrec_manager_status_server_type(const struct ovsdb_idl *idl)
26931
0
{
26932
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_manager_col_status);
26933
0
}
26934
26935
26936
bool
26937
ovsrec_server_has_manager_table_col_target(const struct ovsdb_idl *idl)
26938
0
{
26939
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_target);
26940
0
}
26941
26942
const struct ovsdb_type *
26943
ovsrec_manager_target_server_type(const struct ovsdb_idl *idl)
26944
0
{
26945
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_manager_col_target);
26946
0
}
26947
26948
26949
bool
26950
ovsrec_server_has_manager_table(const struct ovsdb_idl *idl)
26951
0
{
26952
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
26953
0
}
26954
26955
26956
const struct ovsrec_manager_table *
26957
ovsrec_manager_table_get(const struct ovsdb_idl *idl)
26958
0
{
26959
0
    return (const struct ovsrec_manager_table *) idl;
26960
0
}
26961
26962
const struct ovsrec_manager *
26963
ovsrec_manager_table_first(const struct ovsrec_manager_table *table)
26964
0
{
26965
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
26966
0
    return ovsrec_manager_first(idl);
26967
0
}
26968
26969
26970
const struct ovsrec_manager *
26971
ovsrec_manager_table_track_get_first(const struct ovsrec_manager_table *table)
26972
0
{
26973
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
26974
0
    return ovsrec_manager_track_get_first(idl);
26975
0
}
26976
26977
26978
static void
26979
ovsrec_manager_parse_connection_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
26980
0
{
26981
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
26982
26983
0
    if (datum->n >= 1) {
26984
0
        row->connection_mode = CONST_CAST(char *, json_string(datum->keys[0].s));
26985
0
    } else {
26986
0
        row->connection_mode = NULL;
26987
0
    }
26988
0
}
26989
26990
static void
26991
ovsrec_manager_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
26992
0
{
26993
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
26994
0
    smap_init(&row->external_ids);
26995
0
    for (size_t i = 0; i < datum->n; i++) {
26996
0
        smap_add(&row->external_ids,
26997
0
                 json_string(datum->keys[i].s),
26998
0
                 json_string(datum->values[i].s));
26999
0
    }
27000
0
}
27001
27002
static void
27003
ovsrec_manager_parse_inactivity_probe(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27004
0
{
27005
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27006
0
    size_t n = MIN(1, datum->n);
27007
0
    row->inactivity_probe = NULL;
27008
0
    row->n_inactivity_probe = 0;
27009
0
    for (size_t i = 0; i < n; i++) {
27010
0
        if (!row->n_inactivity_probe) {
27011
0
            row->inactivity_probe = xmalloc(n * sizeof *row->inactivity_probe);
27012
0
        }
27013
0
        row->inactivity_probe[row->n_inactivity_probe] = datum->keys[i].integer;
27014
0
        row->n_inactivity_probe++;
27015
0
    }
27016
0
}
27017
27018
static void
27019
ovsrec_manager_parse_is_connected(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27020
0
{
27021
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27022
27023
0
    if (datum->n >= 1) {
27024
0
        row->is_connected = datum->keys[0].boolean;
27025
0
    } else {
27026
0
        row->is_connected = false;
27027
0
    }
27028
0
}
27029
27030
static void
27031
ovsrec_manager_parse_max_backoff(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27032
0
{
27033
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27034
0
    size_t n = MIN(1, datum->n);
27035
0
    row->max_backoff = NULL;
27036
0
    row->n_max_backoff = 0;
27037
0
    for (size_t i = 0; i < n; i++) {
27038
0
        if (!row->n_max_backoff) {
27039
0
            row->max_backoff = xmalloc(n * sizeof *row->max_backoff);
27040
0
        }
27041
0
        row->max_backoff[row->n_max_backoff] = datum->keys[i].integer;
27042
0
        row->n_max_backoff++;
27043
0
    }
27044
0
}
27045
27046
static void
27047
ovsrec_manager_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27048
0
{
27049
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27050
0
    smap_init(&row->other_config);
27051
0
    for (size_t i = 0; i < datum->n; i++) {
27052
0
        smap_add(&row->other_config,
27053
0
                 json_string(datum->keys[i].s),
27054
0
                 json_string(datum->values[i].s));
27055
0
    }
27056
0
}
27057
27058
static void
27059
ovsrec_manager_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27060
0
{
27061
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27062
0
    smap_init(&row->status);
27063
0
    for (size_t i = 0; i < datum->n; i++) {
27064
0
        smap_add(&row->status,
27065
0
                 json_string(datum->keys[i].s),
27066
0
                 json_string(datum->values[i].s));
27067
0
    }
27068
0
}
27069
27070
static void
27071
ovsrec_manager_parse_target(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27072
0
{
27073
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27074
27075
0
    if (datum->n >= 1) {
27076
0
        row->target = CONST_CAST(char *, json_string(datum->keys[0].s));
27077
0
    } else {
27078
0
        row->target = "";
27079
0
    }
27080
0
}
27081
27082
static void
27083
ovsrec_manager_unparse_connection_mode(struct ovsdb_idl_row *row OVS_UNUSED)
27084
0
{
27085
    /* Nothing to do. */
27086
0
}
27087
27088
static void
27089
ovsrec_manager_unparse_external_ids(struct ovsdb_idl_row *row_)
27090
0
{
27091
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27092
0
    smap_destroy(&row->external_ids);
27093
0
}
27094
27095
static void
27096
ovsrec_manager_unparse_inactivity_probe(struct ovsdb_idl_row *row_)
27097
0
{
27098
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27099
0
    free(row->inactivity_probe);
27100
0
}
27101
27102
static void
27103
ovsrec_manager_unparse_is_connected(struct ovsdb_idl_row *row OVS_UNUSED)
27104
0
{
27105
    /* Nothing to do. */
27106
0
}
27107
27108
static void
27109
ovsrec_manager_unparse_max_backoff(struct ovsdb_idl_row *row_)
27110
0
{
27111
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27112
0
    free(row->max_backoff);
27113
0
}
27114
27115
static void
27116
ovsrec_manager_unparse_other_config(struct ovsdb_idl_row *row_)
27117
0
{
27118
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27119
0
    smap_destroy(&row->other_config);
27120
0
}
27121
27122
static void
27123
ovsrec_manager_unparse_status(struct ovsdb_idl_row *row_)
27124
0
{
27125
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
27126
0
    smap_destroy(&row->status);
27127
0
}
27128
27129
static void
27130
ovsrec_manager_unparse_target(struct ovsdb_idl_row *row OVS_UNUSED)
27131
0
{
27132
    /* Nothing to do. */
27133
0
}
27134
27135
static void
27136
ovsrec_manager_init__(struct ovsdb_idl_row *row)
27137
0
{
27138
0
    ovsrec_manager_init(ovsrec_manager_cast(row));
27139
0
}
27140
27141
/* Clears the contents of 'row' in table "Manager". */
27142
void
27143
ovsrec_manager_init(struct ovsrec_manager *row)
27144
0
{
27145
0
    memset(row, 0, sizeof *row); 
27146
0
    smap_init(&row->external_ids);
27147
0
    smap_init(&row->other_config);
27148
0
    smap_init(&row->status);
27149
0
    row->target = "";
27150
0
}
27151
27152
/* Searches table "Manager" in 'idl' for a row with UUID 'uuid'.  Returns
27153
 * a pointer to the row if there is one, otherwise a null pointer.  */
27154
const struct ovsrec_manager *
27155
ovsrec_manager_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
27156
0
{
27157
0
    return ovsrec_manager_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_manager, uuid));
27158
0
}
27159
27160
/* Searches table "Manager" for a row with UUID 'uuid'.  Returns
27161
 * a pointer to the row if there is one, otherwise a null pointer.  */
27162
const struct ovsrec_manager *
27163
ovsrec_manager_table_get_for_uuid(const struct ovsrec_manager_table *table, const struct uuid *uuid)
27164
0
{
27165
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
27166
0
    return ovsrec_manager_get_for_uuid(idl, uuid);
27167
0
}
27168
27169
/* Returns a row in table "Manager" in 'idl', or a null pointer if that
27170
 * table is empty.
27171
 *
27172
 * Database tables are internally maintained as hash tables, so adding or
27173
 * removing rows while traversing the same table can cause some rows to be
27174
 * visited twice or not at apply. */
27175
const struct ovsrec_manager *
27176
ovsrec_manager_first(const struct ovsdb_idl *idl)
27177
0
{
27178
0
    return ovsrec_manager_cast(ovsdb_idl_first_row(idl, &ovsrec_table_manager));
27179
0
}
27180
27181
/* Returns a row following 'row' within its table, or a null pointer if 'row'
27182
 * is the last row in its table. */
27183
const struct ovsrec_manager *
27184
ovsrec_manager_next(const struct ovsrec_manager *row)
27185
0
{
27186
0
    return ovsrec_manager_cast(ovsdb_idl_next_row(&row->header_));
27187
0
}
27188
27189
unsigned int ovsrec_manager_get_seqno(const struct ovsdb_idl *idl)
27190
0
{
27191
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_manager);
27192
0
}
27193
27194
unsigned int ovsrec_manager_row_get_seqno(const struct ovsrec_manager *row, enum ovsdb_idl_change change)
27195
0
{
27196
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
27197
0
}
27198
27199
const struct ovsrec_manager *
27200
ovsrec_manager_track_get_first(const struct ovsdb_idl *idl)
27201
0
{
27202
0
    return ovsrec_manager_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_manager));
27203
0
}
27204
27205
const struct ovsrec_manager
27206
*ovsrec_manager_track_get_next(const struct ovsrec_manager *row)
27207
0
{
27208
0
    return ovsrec_manager_cast(ovsdb_idl_track_get_next(&row->header_));
27209
0
}
27210
27211
27212
/* Deletes 'row' from table "Manager".  'row' may be freed, so it must not be
27213
 * accessed afterward.
27214
 *
27215
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27216
void
27217
ovsrec_manager_delete(const struct ovsrec_manager *row)
27218
0
{
27219
0
    ovsdb_idl_txn_delete(&row->header_);
27220
0
}
27221
27222
/* Inserts and returns a new row in the table "Manager" in the database
27223
 * with open transaction 'txn'.
27224
 *
27225
 * The new row is assigned a randomly generated provisional UUID.
27226
 * ovsdb-server will assign a different UUID when 'txn' is committed,
27227
 * but the IDL will replace any uses of the provisional UUID in the
27228
 * data to be to be committed by the UUID assigned by ovsdb-server. */
27229
struct ovsrec_manager *
27230
ovsrec_manager_insert(struct ovsdb_idl_txn *txn)
27231
0
{
27232
0
    return ovsrec_manager_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_manager, NULL));
27233
0
}
27234
27235
/* Inserts and returns a new row in the table "Manager" in the database
27236
 * with open transaction 'txn'.
27237
 *
27238
 * The new row is assigned the UUID specified in the 'uuid' parameter
27239
 * (which cannot be null).  ovsdb-server will try to assign the same
27240
 * UUID when 'txn' is committed. */
27241
struct ovsrec_manager *
27242
ovsrec_manager_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
27243
0
{
27244
0
    return ovsrec_manager_cast(ovsdb_idl_txn_insert_persist_uuid(
27245
0
        txn, &ovsrec_table_manager, uuid));
27246
0
}
27247
27248
bool
27249
ovsrec_manager_is_updated(const struct ovsrec_manager *row, enum ovsrec_manager_column_id column)
27250
0
{
27251
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_manager_columns[column]);
27252
0
}
27253
27254
/* Causes the original contents of column "connection_mode" in 'row' to be
27255
 * verified as a prerequisite to completing the transaction.  That is, if
27256
 * "connection_mode" in 'row' changed (or if 'row' was deleted) between the
27257
 * time that the IDL originally read its contents and the time that the
27258
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27259
 *
27260
 * The intention is that, to ensure that no transaction commits based on dirty
27261
 * reads, an application should call this function any time "connection_mode" is
27262
 * read as part of a read-modify-write operation.
27263
 *
27264
 * In some cases this function reduces to a no-op, because the current value
27265
 * of "connection_mode" is already known:
27266
 *
27267
 *   - If 'row' is a row created by the current transaction (returned by
27268
 *     ovsrec_manager_insert()).
27269
 *
27270
 *   - If "connection_mode" has already been modified (with
27271
 *     ovsrec_manager_set_connection_mode()) within the current transaction.
27272
 *
27273
 * Because of the latter property, always call this function *before*
27274
 * ovsrec_manager_set_connection_mode() for a given read-modify-write.
27275
 *
27276
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27277
void
27278
ovsrec_manager_verify_connection_mode(const struct ovsrec_manager *row)
27279
0
{
27280
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_connection_mode);
27281
0
}
27282
27283
/* Causes the original contents of column "external_ids" in 'row' to be
27284
 * verified as a prerequisite to completing the transaction.  That is, if
27285
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
27286
 * time that the IDL originally read its contents and the time that the
27287
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27288
 *
27289
 * The intention is that, to ensure that no transaction commits based on dirty
27290
 * reads, an application should call this function any time "external_ids" is
27291
 * read as part of a read-modify-write operation.
27292
 *
27293
 * In some cases this function reduces to a no-op, because the current value
27294
 * of "external_ids" is already known:
27295
 *
27296
 *   - If 'row' is a row created by the current transaction (returned by
27297
 *     ovsrec_manager_insert()).
27298
 *
27299
 *   - If "external_ids" has already been modified (with
27300
 *     ovsrec_manager_set_external_ids()) within the current transaction.
27301
 *
27302
 * Because of the latter property, always call this function *before*
27303
 * ovsrec_manager_set_external_ids() for a given read-modify-write.
27304
 *
27305
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27306
void
27307
ovsrec_manager_verify_external_ids(const struct ovsrec_manager *row)
27308
0
{
27309
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_external_ids);
27310
0
}
27311
27312
/* Causes the original contents of column "inactivity_probe" in 'row' to be
27313
 * verified as a prerequisite to completing the transaction.  That is, if
27314
 * "inactivity_probe" in 'row' changed (or if 'row' was deleted) between the
27315
 * time that the IDL originally read its contents and the time that the
27316
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27317
 *
27318
 * The intention is that, to ensure that no transaction commits based on dirty
27319
 * reads, an application should call this function any time "inactivity_probe" is
27320
 * read as part of a read-modify-write operation.
27321
 *
27322
 * In some cases this function reduces to a no-op, because the current value
27323
 * of "inactivity_probe" is already known:
27324
 *
27325
 *   - If 'row' is a row created by the current transaction (returned by
27326
 *     ovsrec_manager_insert()).
27327
 *
27328
 *   - If "inactivity_probe" has already been modified (with
27329
 *     ovsrec_manager_set_inactivity_probe()) within the current transaction.
27330
 *
27331
 * Because of the latter property, always call this function *before*
27332
 * ovsrec_manager_set_inactivity_probe() for a given read-modify-write.
27333
 *
27334
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27335
void
27336
ovsrec_manager_verify_inactivity_probe(const struct ovsrec_manager *row)
27337
0
{
27338
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_inactivity_probe);
27339
0
}
27340
27341
/* Causes the original contents of column "is_connected" in 'row' to be
27342
 * verified as a prerequisite to completing the transaction.  That is, if
27343
 * "is_connected" in 'row' changed (or if 'row' was deleted) between the
27344
 * time that the IDL originally read its contents and the time that the
27345
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27346
 *
27347
 * The intention is that, to ensure that no transaction commits based on dirty
27348
 * reads, an application should call this function any time "is_connected" is
27349
 * read as part of a read-modify-write operation.
27350
 *
27351
 * In some cases this function reduces to a no-op, because the current value
27352
 * of "is_connected" is already known:
27353
 *
27354
 *   - If 'row' is a row created by the current transaction (returned by
27355
 *     ovsrec_manager_insert()).
27356
 *
27357
 *   - If "is_connected" has already been modified (with
27358
 *     ovsrec_manager_set_is_connected()) within the current transaction.
27359
 *
27360
 * Because of the latter property, always call this function *before*
27361
 * ovsrec_manager_set_is_connected() for a given read-modify-write.
27362
 *
27363
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27364
void
27365
ovsrec_manager_verify_is_connected(const struct ovsrec_manager *row)
27366
0
{
27367
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_is_connected);
27368
0
}
27369
27370
/* Causes the original contents of column "max_backoff" in 'row' to be
27371
 * verified as a prerequisite to completing the transaction.  That is, if
27372
 * "max_backoff" in 'row' changed (or if 'row' was deleted) between the
27373
 * time that the IDL originally read its contents and the time that the
27374
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27375
 *
27376
 * The intention is that, to ensure that no transaction commits based on dirty
27377
 * reads, an application should call this function any time "max_backoff" is
27378
 * read as part of a read-modify-write operation.
27379
 *
27380
 * In some cases this function reduces to a no-op, because the current value
27381
 * of "max_backoff" is already known:
27382
 *
27383
 *   - If 'row' is a row created by the current transaction (returned by
27384
 *     ovsrec_manager_insert()).
27385
 *
27386
 *   - If "max_backoff" has already been modified (with
27387
 *     ovsrec_manager_set_max_backoff()) within the current transaction.
27388
 *
27389
 * Because of the latter property, always call this function *before*
27390
 * ovsrec_manager_set_max_backoff() for a given read-modify-write.
27391
 *
27392
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27393
void
27394
ovsrec_manager_verify_max_backoff(const struct ovsrec_manager *row)
27395
0
{
27396
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_max_backoff);
27397
0
}
27398
27399
/* Causes the original contents of column "other_config" in 'row' to be
27400
 * verified as a prerequisite to completing the transaction.  That is, if
27401
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
27402
 * time that the IDL originally read its contents and the time that the
27403
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27404
 *
27405
 * The intention is that, to ensure that no transaction commits based on dirty
27406
 * reads, an application should call this function any time "other_config" is
27407
 * read as part of a read-modify-write operation.
27408
 *
27409
 * In some cases this function reduces to a no-op, because the current value
27410
 * of "other_config" is already known:
27411
 *
27412
 *   - If 'row' is a row created by the current transaction (returned by
27413
 *     ovsrec_manager_insert()).
27414
 *
27415
 *   - If "other_config" has already been modified (with
27416
 *     ovsrec_manager_set_other_config()) within the current transaction.
27417
 *
27418
 * Because of the latter property, always call this function *before*
27419
 * ovsrec_manager_set_other_config() for a given read-modify-write.
27420
 *
27421
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27422
void
27423
ovsrec_manager_verify_other_config(const struct ovsrec_manager *row)
27424
0
{
27425
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_other_config);
27426
0
}
27427
27428
/* Causes the original contents of column "status" in 'row' to be
27429
 * verified as a prerequisite to completing the transaction.  That is, if
27430
 * "status" in 'row' changed (or if 'row' was deleted) between the
27431
 * time that the IDL originally read its contents and the time that the
27432
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27433
 *
27434
 * The intention is that, to ensure that no transaction commits based on dirty
27435
 * reads, an application should call this function any time "status" is
27436
 * read as part of a read-modify-write operation.
27437
 *
27438
 * In some cases this function reduces to a no-op, because the current value
27439
 * of "status" is already known:
27440
 *
27441
 *   - If 'row' is a row created by the current transaction (returned by
27442
 *     ovsrec_manager_insert()).
27443
 *
27444
 *   - If "status" has already been modified (with
27445
 *     ovsrec_manager_set_status()) within the current transaction.
27446
 *
27447
 * Because of the latter property, always call this function *before*
27448
 * ovsrec_manager_set_status() for a given read-modify-write.
27449
 *
27450
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27451
void
27452
ovsrec_manager_verify_status(const struct ovsrec_manager *row)
27453
0
{
27454
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_status);
27455
0
}
27456
27457
/* Causes the original contents of column "target" in 'row' to be
27458
 * verified as a prerequisite to completing the transaction.  That is, if
27459
 * "target" in 'row' changed (or if 'row' was deleted) between the
27460
 * time that the IDL originally read its contents and the time that the
27461
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27462
 *
27463
 * The intention is that, to ensure that no transaction commits based on dirty
27464
 * reads, an application should call this function any time "target" is
27465
 * read as part of a read-modify-write operation.
27466
 *
27467
 * In some cases this function reduces to a no-op, because the current value
27468
 * of "target" is already known:
27469
 *
27470
 *   - If 'row' is a row created by the current transaction (returned by
27471
 *     ovsrec_manager_insert()).
27472
 *
27473
 *   - If "target" has already been modified (with
27474
 *     ovsrec_manager_set_target()) within the current transaction.
27475
 *
27476
 * Because of the latter property, always call this function *before*
27477
 * ovsrec_manager_set_target() for a given read-modify-write.
27478
 *
27479
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27480
void
27481
ovsrec_manager_verify_target(const struct ovsrec_manager *row)
27482
0
{
27483
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_target);
27484
0
}
27485
27486
/* Returns the "connection_mode" column's value from the "Manager" table in 'row'
27487
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
27488
 * ovsdb_datum_find_key() is an easier and more efficient way to search
27489
 * for a given key than implementing the same operation on the "cooked"
27490
 * form in 'row'.
27491
 *
27492
 * 'key_type' must be OVSDB_TYPE_STRING.
27493
 * (This helps to avoid silent bugs if someone changes connection_mode's
27494
 * type without updating the caller.)
27495
 *
27496
 * The caller must not modify or free the returned value.
27497
 *
27498
 * Various kinds of changes can invalidate the returned value: modifying
27499
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
27500
 * If the returned value is needed for a long time, it is best to make a copy
27501
 * of it with ovsdb_datum_clone().
27502
 *
27503
 * This function is rarely useful, since it is easier to access the value
27504
 * directly through the "connection_mode" member in ovsrec_manager. */
27505
const struct ovsdb_datum *
27506
ovsrec_manager_get_connection_mode(const struct ovsrec_manager *row,
27507
  enum ovsdb_atomic_type key_type OVS_UNUSED)
27508
0
{
27509
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
27510
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_connection_mode);
27511
0
}
27512
27513
/* Returns the "external_ids" column's value from the "Manager" table in 'row'
27514
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
27515
 * ovsdb_datum_find_key() is an easier and more efficient way to search
27516
 * for a given key than implementing the same operation on the "cooked"
27517
 * form in 'row'.
27518
 *
27519
 * 'key_type' must be OVSDB_TYPE_STRING.
27520
 * 'value_type' must be OVSDB_TYPE_STRING.
27521
 * (This helps to avoid silent bugs if someone changes external_ids's
27522
 * type without updating the caller.)
27523
 *
27524
 * The caller must not modify or free the returned value.
27525
 *
27526
 * Various kinds of changes can invalidate the returned value: modifying
27527
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
27528
 * If the returned value is needed for a long time, it is best to make a copy
27529
 * of it with ovsdb_datum_clone().
27530
 *
27531
 * This function is rarely useful, since it is easier to access the value
27532
 * directly through the "external_ids" member in ovsrec_manager. */
27533
const struct ovsdb_datum *
27534
ovsrec_manager_get_external_ids(const struct ovsrec_manager *row,
27535
  enum ovsdb_atomic_type key_type OVS_UNUSED,
27536
  enum ovsdb_atomic_type value_type OVS_UNUSED)
27537
0
{
27538
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
27539
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
27540
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_external_ids);
27541
0
}
27542
27543
/* Returns the "inactivity_probe" column's value from the "Manager" table in 'row'
27544
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
27545
 * ovsdb_datum_find_key() is an easier and more efficient way to search
27546
 * for a given key than implementing the same operation on the "cooked"
27547
 * form in 'row'.
27548
 *
27549
 * 'key_type' must be OVSDB_TYPE_INTEGER.
27550
 * (This helps to avoid silent bugs if someone changes inactivity_probe's
27551
 * type without updating the caller.)
27552
 *
27553
 * The caller must not modify or free the returned value.
27554
 *
27555
 * Various kinds of changes can invalidate the returned value: modifying
27556
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
27557
 * If the returned value is needed for a long time, it is best to make a copy
27558
 * of it with ovsdb_datum_clone().
27559
 *
27560
 * This function is rarely useful, since it is easier to access the value
27561
 * directly through the "inactivity_probe" member in ovsrec_manager. */
27562
const struct ovsdb_datum *
27563
ovsrec_manager_get_inactivity_probe(const struct ovsrec_manager *row,
27564
  enum ovsdb_atomic_type key_type OVS_UNUSED)
27565
0
{
27566
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
27567
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_inactivity_probe);
27568
0
}
27569
27570
/* Returns the "is_connected" column's value from the "Manager" table in 'row'
27571
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
27572
 * ovsdb_datum_find_key() is an easier and more efficient way to search
27573
 * for a given key than implementing the same operation on the "cooked"
27574
 * form in 'row'.
27575
 *
27576
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
27577
 * (This helps to avoid silent bugs if someone changes is_connected's
27578
 * type without updating the caller.)
27579
 *
27580
 * The caller must not modify or free the returned value.
27581
 *
27582
 * Various kinds of changes can invalidate the returned value: modifying
27583
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
27584
 * If the returned value is needed for a long time, it is best to make a copy
27585
 * of it with ovsdb_datum_clone().
27586
 *
27587
 * This function is rarely useful, since it is easier to access the value
27588
 * directly through the "is_connected" member in ovsrec_manager. */
27589
const struct ovsdb_datum *
27590
ovsrec_manager_get_is_connected(const struct ovsrec_manager *row,
27591
  enum ovsdb_atomic_type key_type OVS_UNUSED)
27592
0
{
27593
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
27594
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_is_connected);
27595
0
}
27596
27597
/* Returns the "max_backoff" column's value from the "Manager" table in 'row'
27598
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
27599
 * ovsdb_datum_find_key() is an easier and more efficient way to search
27600
 * for a given key than implementing the same operation on the "cooked"
27601
 * form in 'row'.
27602
 *
27603
 * 'key_type' must be OVSDB_TYPE_INTEGER.
27604
 * (This helps to avoid silent bugs if someone changes max_backoff's
27605
 * type without updating the caller.)
27606
 *
27607
 * The caller must not modify or free the returned value.
27608
 *
27609
 * Various kinds of changes can invalidate the returned value: modifying
27610
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
27611
 * If the returned value is needed for a long time, it is best to make a copy
27612
 * of it with ovsdb_datum_clone().
27613
 *
27614
 * This function is rarely useful, since it is easier to access the value
27615
 * directly through the "max_backoff" member in ovsrec_manager. */
27616
const struct ovsdb_datum *
27617
ovsrec_manager_get_max_backoff(const struct ovsrec_manager *row,
27618
  enum ovsdb_atomic_type key_type OVS_UNUSED)
27619
0
{
27620
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
27621
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_max_backoff);
27622
0
}
27623
27624
/* Returns the "other_config" column's value from the "Manager" table in 'row'
27625
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
27626
 * ovsdb_datum_find_key() is an easier and more efficient way to search
27627
 * for a given key than implementing the same operation on the "cooked"
27628
 * form in 'row'.
27629
 *
27630
 * 'key_type' must be OVSDB_TYPE_STRING.
27631
 * 'value_type' must be OVSDB_TYPE_STRING.
27632
 * (This helps to avoid silent bugs if someone changes other_config's
27633
 * type without updating the caller.)
27634
 *
27635
 * The caller must not modify or free the returned value.
27636
 *
27637
 * Various kinds of changes can invalidate the returned value: modifying
27638
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
27639
 * If the returned value is needed for a long time, it is best to make a copy
27640
 * of it with ovsdb_datum_clone().
27641
 *
27642
 * This function is rarely useful, since it is easier to access the value
27643
 * directly through the "other_config" member in ovsrec_manager. */
27644
const struct ovsdb_datum *
27645
ovsrec_manager_get_other_config(const struct ovsrec_manager *row,
27646
  enum ovsdb_atomic_type key_type OVS_UNUSED,
27647
  enum ovsdb_atomic_type value_type OVS_UNUSED)
27648
0
{
27649
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
27650
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
27651
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_other_config);
27652
0
}
27653
27654
/* Returns the "status" column's value from the "Manager" table in 'row'
27655
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
27656
 * ovsdb_datum_find_key() is an easier and more efficient way to search
27657
 * for a given key than implementing the same operation on the "cooked"
27658
 * form in 'row'.
27659
 *
27660
 * 'key_type' must be OVSDB_TYPE_STRING.
27661
 * 'value_type' must be OVSDB_TYPE_STRING.
27662
 * (This helps to avoid silent bugs if someone changes status's
27663
 * type without updating the caller.)
27664
 *
27665
 * The caller must not modify or free the returned value.
27666
 *
27667
 * Various kinds of changes can invalidate the returned value: modifying
27668
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
27669
 * If the returned value is needed for a long time, it is best to make a copy
27670
 * of it with ovsdb_datum_clone().
27671
 *
27672
 * This function is rarely useful, since it is easier to access the value
27673
 * directly through the "status" member in ovsrec_manager. */
27674
const struct ovsdb_datum *
27675
ovsrec_manager_get_status(const struct ovsrec_manager *row,
27676
  enum ovsdb_atomic_type key_type OVS_UNUSED,
27677
  enum ovsdb_atomic_type value_type OVS_UNUSED)
27678
0
{
27679
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
27680
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
27681
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_status);
27682
0
}
27683
27684
/* Returns the "target" column's value from the "Manager" table in 'row'
27685
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
27686
 * ovsdb_datum_find_key() is an easier and more efficient way to search
27687
 * for a given key than implementing the same operation on the "cooked"
27688
 * form in 'row'.
27689
 *
27690
 * 'key_type' must be OVSDB_TYPE_STRING.
27691
 * (This helps to avoid silent bugs if someone changes target's
27692
 * type without updating the caller.)
27693
 *
27694
 * The caller must not modify or free the returned value.
27695
 *
27696
 * Various kinds of changes can invalidate the returned value: modifying
27697
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
27698
 * If the returned value is needed for a long time, it is best to make a copy
27699
 * of it with ovsdb_datum_clone().
27700
 *
27701
 * This function is rarely useful, since it is easier to access the value
27702
 * directly through the "target" member in ovsrec_manager. */
27703
const struct ovsdb_datum *
27704
ovsrec_manager_get_target(const struct ovsrec_manager *row,
27705
  enum ovsdb_atomic_type key_type OVS_UNUSED)
27706
0
{
27707
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
27708
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_target);
27709
0
}
27710
27711
/* Sets the "connection_mode" column from the "Manager" table in 'row' to
27712
 * the 'connection_mode' set.
27713
 *
27714
 * If "connection_mode" is null, the column will be the empty set,
27715
 * otherwise it will contain the specified value.
27716
 *
27717
 * Argument constraints: either "in-band" or "out-of-band"
27718
 *
27719
 * The caller retains ownership of the arguments. */
27720
void
27721
ovsrec_manager_set_connection_mode(const struct ovsrec_manager *row, const char *connection_mode)
27722
0
{
27723
0
    struct ovsdb_datum datum;
27724
27725
0
    datum.refcnt = NULL;
27726
27727
0
    if (connection_mode) {
27728
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
27729
0
        datum.n = 1;
27730
0
        datum.keys = key;
27731
0
        key->s = ovsdb_atom_string_create(connection_mode);
27732
0
    } else {
27733
0
        datum.n = 0;
27734
0
        datum.keys = NULL;
27735
0
    }
27736
0
    datum.values = NULL;
27737
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_manager_col_connection_mode, &datum);
27738
0
}
27739
27740
/* Sets the "external_ids" column's value from the "Manager" table in 'row'
27741
 * to 'external_ids'.
27742
 *
27743
 * The caller retains ownership of 'external_ids' and everything in it. */
27744
void
27745
ovsrec_manager_set_external_ids(const struct ovsrec_manager *row, const struct smap *external_ids)
27746
0
{
27747
0
    struct ovsdb_datum datum;
27748
27749
0
    if (external_ids) {
27750
0
        ovsdb_datum_from_smap(&datum, external_ids);
27751
0
    } else {
27752
0
        ovsdb_datum_init_empty(&datum);
27753
0
    }
27754
0
    ovsdb_idl_txn_write(&row->header_,
27755
0
                        &ovsrec_manager_col_external_ids,
27756
0
                        &datum);
27757
0
}
27758
27759
27760
/* Sets the "inactivity_probe" column from the "Manager" table in 'row' to
27761
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
27762
 *
27763
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
27764
 * may be NULL.
27765
 *
27766
 * The caller retains ownership of the arguments. */
27767
void
27768
ovsrec_manager_set_inactivity_probe(const struct ovsrec_manager *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
27769
0
{
27770
0
    struct ovsdb_datum datum;
27771
27772
0
    datum.refcnt = NULL;
27773
27774
0
    if (n_inactivity_probe) {
27775
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
27776
0
        datum.n = 1;
27777
0
        datum.keys = key;
27778
0
        key->integer = *inactivity_probe;
27779
0
    } else {
27780
0
        datum.n = 0;
27781
0
        datum.keys = NULL;
27782
0
    }
27783
0
    datum.values = NULL;
27784
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_manager_col_inactivity_probe, &datum);
27785
0
}
27786
27787
/* Sets the "is_connected" column from the "Manager" table in 'row' to
27788
 * 'is_connected'.
27789
 *
27790
 * The caller retains ownership of the arguments. */
27791
void
27792
ovsrec_manager_set_is_connected(const struct ovsrec_manager *row, bool is_connected)
27793
0
{
27794
0
    struct ovsdb_datum datum;
27795
27796
0
    datum.refcnt = NULL;
27797
27798
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
27799
27800
0
    datum.n = 1;
27801
0
    datum.keys = key;
27802
0
    key->boolean = is_connected;
27803
0
    datum.values = NULL;
27804
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_manager_col_is_connected, &datum);
27805
0
}
27806
27807
/* Sets the "max_backoff" column from the "Manager" table in 'row' to
27808
 * the 'max_backoff' set with 'n_max_backoff' entries.
27809
 *
27810
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
27811
 * may be NULL.
27812
 *
27813
 * Argument constraints: at least 1,000
27814
 *
27815
 * The caller retains ownership of the arguments. */
27816
void
27817
ovsrec_manager_set_max_backoff(const struct ovsrec_manager *row, const int64_t *max_backoff, size_t n_max_backoff)
27818
0
{
27819
0
    struct ovsdb_datum datum;
27820
27821
0
    datum.refcnt = NULL;
27822
27823
0
    if (n_max_backoff) {
27824
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
27825
0
        datum.n = 1;
27826
0
        datum.keys = key;
27827
0
        key->integer = *max_backoff;
27828
0
    } else {
27829
0
        datum.n = 0;
27830
0
        datum.keys = NULL;
27831
0
    }
27832
0
    datum.values = NULL;
27833
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_manager_col_max_backoff, &datum);
27834
0
}
27835
27836
/* Sets the "other_config" column's value from the "Manager" table in 'row'
27837
 * to 'other_config'.
27838
 *
27839
 * The caller retains ownership of 'other_config' and everything in it. */
27840
void
27841
ovsrec_manager_set_other_config(const struct ovsrec_manager *row, const struct smap *other_config)
27842
0
{
27843
0
    struct ovsdb_datum datum;
27844
27845
0
    if (other_config) {
27846
0
        ovsdb_datum_from_smap(&datum, other_config);
27847
0
    } else {
27848
0
        ovsdb_datum_init_empty(&datum);
27849
0
    }
27850
0
    ovsdb_idl_txn_write(&row->header_,
27851
0
                        &ovsrec_manager_col_other_config,
27852
0
                        &datum);
27853
0
}
27854
27855
27856
/* Sets the "status" column's value from the "Manager" table in 'row'
27857
 * to 'status'.
27858
 *
27859
 * The caller retains ownership of 'status' and everything in it. */
27860
void
27861
ovsrec_manager_set_status(const struct ovsrec_manager *row, const struct smap *status)
27862
0
{
27863
0
    struct ovsdb_datum datum;
27864
27865
0
    if (status) {
27866
0
        ovsdb_datum_from_smap(&datum, status);
27867
0
    } else {
27868
0
        ovsdb_datum_init_empty(&datum);
27869
0
    }
27870
0
    ovsdb_idl_txn_write(&row->header_,
27871
0
                        &ovsrec_manager_col_status,
27872
0
                        &datum);
27873
0
}
27874
27875
27876
/* Sets the "target" column from the "Manager" table in 'row' to
27877
 * 'target'.
27878
 *
27879
 * The caller retains ownership of the arguments. */
27880
void
27881
ovsrec_manager_set_target(const struct ovsrec_manager *row, const char *target)
27882
0
{
27883
0
    struct ovsdb_datum datum;
27884
27885
0
    datum.refcnt = NULL;
27886
27887
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
27888
27889
0
    datum.n = 1;
27890
0
    datum.keys = key;
27891
0
    key->s = ovsdb_atom_string_create(target);
27892
0
    datum.values = NULL;
27893
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_manager_col_target, &datum);
27894
0
}
27895
27896
/* Adds the value 'new_value' to the "connection_mode" set column from the "Manager" table
27897
 * in 'row'.
27898
 *
27899
 */
27900
void
27901
ovsrec_manager_update_connection_mode_addvalue(const struct ovsrec_manager *row, const char *new_value)
27902
0
{
27903
0
    struct ovsdb_datum *datum;
27904
27905
0
    datum = xmalloc(sizeof *datum);
27906
0
    datum->n = 1;
27907
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
27908
0
    datum->values = NULL;
27909
0
    datum->refcnt = NULL;
27910
27911
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
27912
27913
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
27914
0
                                    &ovsrec_manager_col_connection_mode,
27915
0
                                    datum);
27916
0
}
27917
27918
/* Deletes the value 'delete_value' from the "connection_mode" set column from the
27919
 * "Manager" table in 'row'.
27920
 *
27921
 */
27922
void
27923
ovsrec_manager_update_connection_mode_delvalue(const struct ovsrec_manager *row, const char *delete_value)
27924
0
{
27925
0
    struct ovsdb_datum *datum;
27926
27927
0
    datum = xmalloc(sizeof *datum);
27928
0
    datum->n = 1;
27929
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
27930
0
    datum->values = NULL;
27931
0
    datum->refcnt = NULL;
27932
27933
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
27934
27935
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
27936
0
                                    &ovsrec_manager_col_connection_mode,
27937
0
                                    datum);
27938
0
}
27939
27940
/* Sets an element of the "external_ids" map column from the "Manager" table in 'row'
27941
 * to 'new_value' given the key value 'new_key'.
27942
 *
27943
 */
27944
void
27945
ovsrec_manager_update_external_ids_setkey(const struct ovsrec_manager *row, const char *new_key, const char *new_value)
27946
0
{
27947
0
    struct ovsdb_datum *datum;
27948
27949
0
    datum = xmalloc(sizeof *datum);
27950
0
    datum->n = 1;
27951
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
27952
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
27953
0
    datum->refcnt = NULL;
27954
27955
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
27956
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
27957
27958
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
27959
0
                                    &ovsrec_manager_col_external_ids,
27960
0
                                    datum);
27961
0
}
27962
27963
/* Deletes an element of the "external_ids" map column from the "Manager" table in 'row'
27964
 * given the key value 'delete_key'.
27965
 *
27966
 */
27967
void
27968
ovsrec_manager_update_external_ids_delkey(const struct ovsrec_manager *row, const char *delete_key)
27969
0
{
27970
0
    struct ovsdb_datum *datum;
27971
27972
0
    datum = xmalloc(sizeof *datum);
27973
0
    datum->n = 1;
27974
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
27975
0
    datum->values = NULL;
27976
0
    datum->refcnt = NULL;
27977
27978
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
27979
27980
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
27981
0
                                    &ovsrec_manager_col_external_ids,
27982
0
                                    datum);
27983
0
}
27984
27985
/* Adds the value 'new_value' to the "inactivity_probe" set column from the "Manager" table
27986
 * in 'row'.
27987
 *
27988
 */
27989
void
27990
ovsrec_manager_update_inactivity_probe_addvalue(const struct ovsrec_manager *row, int64_t new_value)
27991
0
{
27992
0
    struct ovsdb_datum *datum;
27993
27994
0
    datum = xmalloc(sizeof *datum);
27995
0
    datum->n = 1;
27996
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
27997
0
    datum->values = NULL;
27998
0
    datum->refcnt = NULL;
27999
28000
0
    datum->keys[0].integer = new_value;
28001
28002
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
28003
0
                                    &ovsrec_manager_col_inactivity_probe,
28004
0
                                    datum);
28005
0
}
28006
28007
/* Deletes the value 'delete_value' from the "inactivity_probe" set column from the
28008
 * "Manager" table in 'row'.
28009
 *
28010
 */
28011
void
28012
ovsrec_manager_update_inactivity_probe_delvalue(const struct ovsrec_manager *row, int64_t delete_value)
28013
0
{
28014
0
    struct ovsdb_datum *datum;
28015
28016
0
    datum = xmalloc(sizeof *datum);
28017
0
    datum->n = 1;
28018
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28019
0
    datum->values = NULL;
28020
0
    datum->refcnt = NULL;
28021
28022
0
    datum->keys[0].integer = delete_value;
28023
28024
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
28025
0
                                    &ovsrec_manager_col_inactivity_probe,
28026
0
                                    datum);
28027
0
}
28028
28029
/* Adds the value 'new_value' to the "max_backoff" set column from the "Manager" table
28030
 * in 'row'.
28031
 *
28032
 */
28033
void
28034
ovsrec_manager_update_max_backoff_addvalue(const struct ovsrec_manager *row, int64_t new_value)
28035
0
{
28036
0
    struct ovsdb_datum *datum;
28037
28038
0
    datum = xmalloc(sizeof *datum);
28039
0
    datum->n = 1;
28040
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28041
0
    datum->values = NULL;
28042
0
    datum->refcnt = NULL;
28043
28044
0
    datum->keys[0].integer = new_value;
28045
28046
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
28047
0
                                    &ovsrec_manager_col_max_backoff,
28048
0
                                    datum);
28049
0
}
28050
28051
/* Deletes the value 'delete_value' from the "max_backoff" set column from the
28052
 * "Manager" table in 'row'.
28053
 *
28054
 */
28055
void
28056
ovsrec_manager_update_max_backoff_delvalue(const struct ovsrec_manager *row, int64_t delete_value)
28057
0
{
28058
0
    struct ovsdb_datum *datum;
28059
28060
0
    datum = xmalloc(sizeof *datum);
28061
0
    datum->n = 1;
28062
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28063
0
    datum->values = NULL;
28064
0
    datum->refcnt = NULL;
28065
28066
0
    datum->keys[0].integer = delete_value;
28067
28068
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
28069
0
                                    &ovsrec_manager_col_max_backoff,
28070
0
                                    datum);
28071
0
}
28072
28073
/* Sets an element of the "other_config" map column from the "Manager" table in 'row'
28074
 * to 'new_value' given the key value 'new_key'.
28075
 *
28076
 */
28077
void
28078
ovsrec_manager_update_other_config_setkey(const struct ovsrec_manager *row, const char *new_key, const char *new_value)
28079
0
{
28080
0
    struct ovsdb_datum *datum;
28081
28082
0
    datum = xmalloc(sizeof *datum);
28083
0
    datum->n = 1;
28084
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
28085
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
28086
0
    datum->refcnt = NULL;
28087
28088
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
28089
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
28090
28091
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
28092
0
                                    &ovsrec_manager_col_other_config,
28093
0
                                    datum);
28094
0
}
28095
28096
/* Deletes an element of the "other_config" map column from the "Manager" table in 'row'
28097
 * given the key value 'delete_key'.
28098
 *
28099
 */
28100
void
28101
ovsrec_manager_update_other_config_delkey(const struct ovsrec_manager *row, const char *delete_key)
28102
0
{
28103
0
    struct ovsdb_datum *datum;
28104
28105
0
    datum = xmalloc(sizeof *datum);
28106
0
    datum->n = 1;
28107
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
28108
0
    datum->values = NULL;
28109
0
    datum->refcnt = NULL;
28110
28111
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
28112
28113
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
28114
0
                                    &ovsrec_manager_col_other_config,
28115
0
                                    datum);
28116
0
}
28117
28118
/* Sets an element of the "status" map column from the "Manager" table in 'row'
28119
 * to 'new_value' given the key value 'new_key'.
28120
 *
28121
 */
28122
void
28123
ovsrec_manager_update_status_setkey(const struct ovsrec_manager *row, const char *new_key, const char *new_value)
28124
0
{
28125
0
    struct ovsdb_datum *datum;
28126
28127
0
    datum = xmalloc(sizeof *datum);
28128
0
    datum->n = 1;
28129
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
28130
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
28131
0
    datum->refcnt = NULL;
28132
28133
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
28134
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
28135
28136
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
28137
0
                                    &ovsrec_manager_col_status,
28138
0
                                    datum);
28139
0
}
28140
28141
/* Deletes an element of the "status" map column from the "Manager" table in 'row'
28142
 * given the key value 'delete_key'.
28143
 *
28144
 */
28145
void
28146
ovsrec_manager_update_status_delkey(const struct ovsrec_manager *row, const char *delete_key)
28147
0
{
28148
0
    struct ovsdb_datum *datum;
28149
28150
0
    datum = xmalloc(sizeof *datum);
28151
0
    datum->n = 1;
28152
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
28153
0
    datum->values = NULL;
28154
0
    datum->refcnt = NULL;
28155
28156
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
28157
28158
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
28159
0
                                    &ovsrec_manager_col_status,
28160
0
                                    datum);
28161
0
}
28162
28163
/* Sets the "connection_mode" column from the "Manager" table in 'row' to
28164
 * the 'connection_mode' set.
28165
 *
28166
 * If "connection_mode" is null, the column will be the empty set,
28167
 * otherwise it will contain the specified value.
28168
 *
28169
 * Argument constraints: either "in-band" or "out-of-band"
28170
 *
28171
 * The caller retains ownership of the arguments. */
28172
void
28173
ovsrec_manager_add_clause_connection_mode(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *connection_mode)
28174
0
{
28175
0
    struct ovsdb_datum datum;
28176
28177
0
    datum.refcnt = NULL;
28178
28179
0
    if (connection_mode) {
28180
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
28181
0
        datum.n = 1;
28182
0
        datum.keys = key;
28183
0
        key->s = ovsdb_atom_string_create(connection_mode);
28184
0
    } else {
28185
0
        datum.n = 0;
28186
0
        datum.keys = NULL;
28187
0
    }
28188
0
    datum.values = NULL;
28189
0
    ovsdb_idl_condition_add_clause(cond,
28190
0
                          function,
28191
0
                          &ovsrec_manager_col_connection_mode,
28192
0
                          &datum);
28193
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_connection_mode.type);
28194
0
}
28195
28196
/* Sets the "external_ids" column's value from the "Manager" table in 'row'
28197
 * to 'external_ids'.
28198
 *
28199
 * The caller retains ownership of 'external_ids' and everything in it. */
28200
void
28201
ovsrec_manager_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
28202
0
{
28203
0
    struct ovsdb_datum datum;
28204
28205
0
    if (external_ids) {
28206
0
        ovsdb_datum_from_smap(&datum, external_ids);
28207
0
    } else {
28208
0
        ovsdb_datum_init_empty(&datum);
28209
0
    }
28210
28211
0
    ovsdb_idl_condition_add_clause(cond,
28212
0
                                   function,
28213
0
                                   &ovsrec_manager_col_external_ids,
28214
0
                                   &datum);
28215
28216
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_external_ids.type);
28217
0
}
28218
28219
28220
/* Sets the "inactivity_probe" column from the "Manager" table in 'row' to
28221
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
28222
 *
28223
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
28224
 * may be NULL.
28225
 *
28226
 * The caller retains ownership of the arguments. */
28227
void
28228
ovsrec_manager_add_clause_inactivity_probe(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *inactivity_probe, size_t n_inactivity_probe)
28229
0
{
28230
0
    struct ovsdb_datum datum;
28231
28232
0
    datum.refcnt = NULL;
28233
28234
0
    if (n_inactivity_probe) {
28235
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
28236
0
        datum.n = 1;
28237
0
        datum.keys = key;
28238
0
        key->integer = *inactivity_probe;
28239
0
    } else {
28240
0
        datum.n = 0;
28241
0
        datum.keys = NULL;
28242
0
    }
28243
0
    datum.values = NULL;
28244
0
    ovsdb_idl_condition_add_clause(cond,
28245
0
                          function,
28246
0
                          &ovsrec_manager_col_inactivity_probe,
28247
0
                          &datum);
28248
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_inactivity_probe.type);
28249
0
}
28250
28251
/* Sets the "is_connected" column from the "Manager" table in 'row' to
28252
 * 'is_connected'.
28253
 *
28254
 * The caller retains ownership of the arguments. */
28255
void
28256
ovsrec_manager_add_clause_is_connected(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool is_connected)
28257
0
{
28258
0
    struct ovsdb_datum datum;
28259
28260
0
    datum.refcnt = NULL;
28261
28262
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
28263
28264
0
    datum.n = 1;
28265
0
    datum.keys = key;
28266
0
    key->boolean = is_connected;
28267
0
    datum.values = NULL;
28268
0
    ovsdb_idl_condition_add_clause(cond,
28269
0
                          function,
28270
0
                          &ovsrec_manager_col_is_connected,
28271
0
                          &datum);
28272
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_is_connected.type);
28273
0
}
28274
28275
/* Sets the "max_backoff" column from the "Manager" table in 'row' to
28276
 * the 'max_backoff' set with 'n_max_backoff' entries.
28277
 *
28278
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
28279
 * may be NULL.
28280
 *
28281
 * Argument constraints: at least 1,000
28282
 *
28283
 * The caller retains ownership of the arguments. */
28284
void
28285
ovsrec_manager_add_clause_max_backoff(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *max_backoff, size_t n_max_backoff)
28286
0
{
28287
0
    struct ovsdb_datum datum;
28288
28289
0
    datum.refcnt = NULL;
28290
28291
0
    if (n_max_backoff) {
28292
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
28293
0
        datum.n = 1;
28294
0
        datum.keys = key;
28295
0
        key->integer = *max_backoff;
28296
0
    } else {
28297
0
        datum.n = 0;
28298
0
        datum.keys = NULL;
28299
0
    }
28300
0
    datum.values = NULL;
28301
0
    ovsdb_idl_condition_add_clause(cond,
28302
0
                          function,
28303
0
                          &ovsrec_manager_col_max_backoff,
28304
0
                          &datum);
28305
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_max_backoff.type);
28306
0
}
28307
28308
/* Sets the "other_config" column's value from the "Manager" table in 'row'
28309
 * to 'other_config'.
28310
 *
28311
 * The caller retains ownership of 'other_config' and everything in it. */
28312
void
28313
ovsrec_manager_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
28314
0
{
28315
0
    struct ovsdb_datum datum;
28316
28317
0
    if (other_config) {
28318
0
        ovsdb_datum_from_smap(&datum, other_config);
28319
0
    } else {
28320
0
        ovsdb_datum_init_empty(&datum);
28321
0
    }
28322
28323
0
    ovsdb_idl_condition_add_clause(cond,
28324
0
                                   function,
28325
0
                                   &ovsrec_manager_col_other_config,
28326
0
                                   &datum);
28327
28328
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_other_config.type);
28329
0
}
28330
28331
28332
/* Sets the "status" column's value from the "Manager" table in 'row'
28333
 * to 'status'.
28334
 *
28335
 * The caller retains ownership of 'status' and everything in it. */
28336
void
28337
ovsrec_manager_add_clause_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *status)
28338
0
{
28339
0
    struct ovsdb_datum datum;
28340
28341
0
    if (status) {
28342
0
        ovsdb_datum_from_smap(&datum, status);
28343
0
    } else {
28344
0
        ovsdb_datum_init_empty(&datum);
28345
0
    }
28346
28347
0
    ovsdb_idl_condition_add_clause(cond,
28348
0
                                   function,
28349
0
                                   &ovsrec_manager_col_status,
28350
0
                                   &datum);
28351
28352
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_status.type);
28353
0
}
28354
28355
28356
/* Sets the "target" column from the "Manager" table in 'row' to
28357
 * 'target'.
28358
 *
28359
 * The caller retains ownership of the arguments. */
28360
void
28361
ovsrec_manager_add_clause_target(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *target)
28362
0
{
28363
0
    struct ovsdb_datum datum;
28364
28365
0
    datum.refcnt = NULL;
28366
28367
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
28368
28369
0
    datum.n = 1;
28370
0
    datum.keys = key;
28371
0
    key->s = ovsdb_atom_string_create(target);
28372
0
    datum.values = NULL;
28373
0
    ovsdb_idl_condition_add_clause(cond,
28374
0
                          function,
28375
0
                          &ovsrec_manager_col_target,
28376
0
                          &datum);
28377
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_target.type);
28378
0
}
28379
28380
/* Destroy 'row' of kind "Manager". The row must have been
28381
 * created with ovsdb_idl_index_init_row.
28382
 */
28383
void
28384
ovsrec_manager_index_destroy_row(const struct ovsrec_manager *row)
28385
0
{
28386
0
    ovsdb_idl_index_destroy_row(&row->header_);
28387
0
}
28388
        
28389
28390
/* Creates a new row of kind "Manager". */
28391
struct ovsrec_manager *
28392
ovsrec_manager_index_init_row(struct ovsdb_idl_index *index)
28393
0
{
28394
0
    ovs_assert(index->table->class_ == &ovsrec_table_manager);
28395
0
    return ALIGNED_CAST(struct ovsrec_manager *, ovsdb_idl_index_init_row(index));
28396
0
}
28397
28398
struct ovsrec_manager *
28399
ovsrec_manager_index_find(struct ovsdb_idl_index *index, const struct ovsrec_manager *target)
28400
0
{
28401
0
    ovs_assert(index->table->class_ == &ovsrec_table_manager);
28402
0
    return ovsrec_manager_cast(ovsdb_idl_index_find(index, &target->header_));
28403
0
}
28404
28405
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
28406
int
28407
ovsrec_manager_index_compare(
28408
    struct ovsdb_idl_index *index, 
28409
    const struct ovsrec_manager *a, 
28410
    const struct ovsrec_manager *b)
28411
0
{
28412
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
28413
0
}
28414
28415
struct ovsdb_idl_cursor
28416
ovsrec_manager_cursor_first(struct ovsdb_idl_index *index)
28417
0
{
28418
0
    ovs_assert(index->table->class_ == &ovsrec_table_manager);
28419
0
    return ovsdb_idl_cursor_first(index);
28420
0
}
28421
28422
struct ovsdb_idl_cursor
28423
ovsrec_manager_cursor_first_eq(
28424
    struct ovsdb_idl_index *index, const struct ovsrec_manager *target)
28425
0
{
28426
0
    ovs_assert(index->table->class_ == &ovsrec_table_manager);
28427
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
28428
0
}
28429
28430
struct ovsdb_idl_cursor
28431
ovsrec_manager_cursor_first_ge(
28432
    struct ovsdb_idl_index *index, const struct ovsrec_manager *target)
28433
0
{
28434
0
    ovs_assert(index->table->class_ == &ovsrec_table_manager);
28435
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
28436
0
}
28437
28438
struct ovsrec_manager *
28439
ovsrec_manager_cursor_data(struct ovsdb_idl_cursor *cursor)
28440
0
{
28441
0
    return ovsrec_manager_cast(ovsdb_idl_cursor_data(cursor));
28442
0
}
28443
28444
28445
/* Sets the "connection_mode" column from the "Manager" table in 'row' to
28446
 * the 'connection_mode' set.
28447
 *
28448
 * If "connection_mode" is null, the column will be the empty set,
28449
 * otherwise it will contain the specified value.
28450
 *
28451
 * Argument constraints: either "in-band" or "out-of-band"
28452
 *
28453
 * The caller retains ownership of the arguments. */
28454
void
28455
ovsrec_manager_index_set_connection_mode(const struct ovsrec_manager *row, const char *connection_mode)
28456
0
{
28457
0
    struct ovsdb_datum datum;
28458
28459
0
    datum.refcnt = NULL;
28460
0
    union ovsdb_atom *key;
28461
28462
0
    if (connection_mode) {
28463
0
        key = xmalloc(sizeof (union ovsdb_atom));
28464
0
        datum.n = 1;
28465
0
        datum.keys = key;
28466
0
        key->s = ovsdb_atom_string_create(connection_mode);
28467
0
    } else {
28468
0
        datum.n = 0;
28469
0
        datum.keys = NULL;
28470
0
    }
28471
0
    datum.values = NULL;
28472
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_manager_columns[ OVSREC_MANAGER_COL_CONNECTION_MODE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
28473
0
}
28474
28475
/* Sets the "external_ids" column's value from the "Manager" table in 'row'
28476
 * to 'external_ids'.
28477
 *
28478
 * The caller retains ownership of 'external_ids' and everything in it. */
28479
void
28480
ovsrec_manager_index_set_external_ids(const struct ovsrec_manager *row, const struct smap *external_ids)
28481
0
{
28482
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
28483
28484
0
    if (external_ids) {
28485
0
        struct smap_node *node;
28486
0
        size_t i;
28487
28488
0
        datum->n = smap_count(external_ids);
28489
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
28490
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
28491
0
        datum->refcnt = NULL;
28492
28493
0
        i = 0;
28494
0
        SMAP_FOR_EACH (node, external_ids) {
28495
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
28496
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
28497
0
            i++;
28498
0
        }
28499
0
        ovsdb_datum_sort_unique(datum, &ovsrec_manager_col_external_ids.type);
28500
0
    } else {
28501
0
        ovsdb_datum_init_empty(datum);
28502
0
    }
28503
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
28504
0
                          &ovsrec_manager_columns[OVSREC_MANAGER_COL_EXTERNAL_IDS],
28505
0
                          datum,
28506
0
                          &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
28507
0
    free(datum);
28508
0
}
28509
28510
28511
/* Sets the "inactivity_probe" column from the "Manager" table in 'row' to
28512
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
28513
 *
28514
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
28515
 * may be NULL.
28516
 *
28517
 * The caller retains ownership of the arguments. */
28518
void
28519
ovsrec_manager_index_set_inactivity_probe(const struct ovsrec_manager *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
28520
0
{
28521
0
    struct ovsdb_datum datum;
28522
28523
0
    datum.refcnt = NULL;
28524
0
    union ovsdb_atom *key;
28525
28526
0
    if (n_inactivity_probe) {
28527
0
        key = xmalloc(sizeof(union ovsdb_atom));
28528
0
        datum.n = 1;
28529
0
        datum.keys = key;
28530
0
        key->integer = *inactivity_probe;
28531
0
    } else {
28532
0
        datum.n = 0;
28533
0
        datum.keys = NULL;
28534
0
    }
28535
0
    datum.values = NULL;
28536
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_manager_columns[ OVSREC_MANAGER_COL_INACTIVITY_PROBE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
28537
0
}
28538
28539
/* Sets the "is_connected" column from the "Manager" table in 'row' to
28540
 * 'is_connected'.
28541
 *
28542
 * The caller retains ownership of the arguments. */
28543
void
28544
ovsrec_manager_index_set_is_connected(const struct ovsrec_manager *row, bool is_connected)
28545
0
{
28546
0
    struct ovsdb_datum datum;
28547
28548
0
    datum.refcnt = NULL;
28549
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
28550
28551
0
    datum.n = 1;
28552
0
    datum.keys = key;
28553
0
    key->boolean = is_connected;
28554
0
    datum.values = NULL;
28555
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_manager_columns[ OVSREC_MANAGER_COL_IS_CONNECTED ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
28556
0
}
28557
28558
/* Sets the "max_backoff" column from the "Manager" table in 'row' to
28559
 * the 'max_backoff' set with 'n_max_backoff' entries.
28560
 *
28561
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
28562
 * may be NULL.
28563
 *
28564
 * Argument constraints: at least 1,000
28565
 *
28566
 * The caller retains ownership of the arguments. */
28567
void
28568
ovsrec_manager_index_set_max_backoff(const struct ovsrec_manager *row, const int64_t *max_backoff, size_t n_max_backoff)
28569
0
{
28570
0
    struct ovsdb_datum datum;
28571
28572
0
    datum.refcnt = NULL;
28573
0
    union ovsdb_atom *key;
28574
28575
0
    if (n_max_backoff) {
28576
0
        key = xmalloc(sizeof(union ovsdb_atom));
28577
0
        datum.n = 1;
28578
0
        datum.keys = key;
28579
0
        key->integer = *max_backoff;
28580
0
    } else {
28581
0
        datum.n = 0;
28582
0
        datum.keys = NULL;
28583
0
    }
28584
0
    datum.values = NULL;
28585
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_manager_columns[ OVSREC_MANAGER_COL_MAX_BACKOFF ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
28586
0
}
28587
28588
/* Sets the "other_config" column's value from the "Manager" table in 'row'
28589
 * to 'other_config'.
28590
 *
28591
 * The caller retains ownership of 'other_config' and everything in it. */
28592
void
28593
ovsrec_manager_index_set_other_config(const struct ovsrec_manager *row, const struct smap *other_config)
28594
0
{
28595
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
28596
28597
0
    if (other_config) {
28598
0
        struct smap_node *node;
28599
0
        size_t i;
28600
28601
0
        datum->n = smap_count(other_config);
28602
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
28603
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
28604
0
        datum->refcnt = NULL;
28605
28606
0
        i = 0;
28607
0
        SMAP_FOR_EACH (node, other_config) {
28608
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
28609
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
28610
0
            i++;
28611
0
        }
28612
0
        ovsdb_datum_sort_unique(datum, &ovsrec_manager_col_other_config.type);
28613
0
    } else {
28614
0
        ovsdb_datum_init_empty(datum);
28615
0
    }
28616
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
28617
0
                          &ovsrec_manager_columns[OVSREC_MANAGER_COL_OTHER_CONFIG],
28618
0
                          datum,
28619
0
                          &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
28620
0
    free(datum);
28621
0
}
28622
28623
28624
/* Sets the "status" column's value from the "Manager" table in 'row'
28625
 * to 'status'.
28626
 *
28627
 * The caller retains ownership of 'status' and everything in it. */
28628
void
28629
ovsrec_manager_index_set_status(const struct ovsrec_manager *row, const struct smap *status)
28630
0
{
28631
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
28632
28633
0
    if (status) {
28634
0
        struct smap_node *node;
28635
0
        size_t i;
28636
28637
0
        datum->n = smap_count(status);
28638
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
28639
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
28640
0
        datum->refcnt = NULL;
28641
28642
0
        i = 0;
28643
0
        SMAP_FOR_EACH (node, status) {
28644
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
28645
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
28646
0
            i++;
28647
0
        }
28648
0
        ovsdb_datum_sort_unique(datum, &ovsrec_manager_col_status.type);
28649
0
    } else {
28650
0
        ovsdb_datum_init_empty(datum);
28651
0
    }
28652
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
28653
0
                          &ovsrec_manager_columns[OVSREC_MANAGER_COL_STATUS],
28654
0
                          datum,
28655
0
                          &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
28656
0
    free(datum);
28657
0
}
28658
28659
28660
/* Sets the "target" column from the "Manager" table in 'row' to
28661
 * 'target'.
28662
 *
28663
 * The caller retains ownership of the arguments. */
28664
void
28665
ovsrec_manager_index_set_target(const struct ovsrec_manager *row, const char *target)
28666
0
{
28667
0
    struct ovsdb_datum datum;
28668
28669
0
    datum.refcnt = NULL;
28670
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
28671
28672
0
    datum.n = 1;
28673
0
    datum.keys = key;
28674
0
    key->s = ovsdb_atom_string_create(target);
28675
0
    datum.values = NULL;
28676
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_manager_columns[ OVSREC_MANAGER_COL_TARGET ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
28677
0
}
28678
28679
struct ovsdb_idl_column ovsrec_manager_columns[OVSREC_MANAGER_N_COLUMNS];
28680
28681
unsigned int
28682
ovsrec_manager_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
28683
0
{
28684
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_manager, condition);
28685
0
}
28686
static struct json Manager_col_connection_mode_key_enum_key_strings[2] = {
28687
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "in-band", .count = 2 },
28688
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "out-of-band", .count = 2 },
28689
};
28690
static union ovsdb_atom Manager_col_connection_mode_key_enum_keys[2] = {
28691
    { .s = &Manager_col_connection_mode_key_enum_key_strings[0] },
28692
    { .s = &Manager_col_connection_mode_key_enum_key_strings[1] },
28693
};
28694
static struct ovsdb_datum Manager_col_connection_mode_key_enum = {
28695
    .n = 2,
28696
    .keys = Manager_col_connection_mode_key_enum_keys,
28697
};
28698
28699
struct ovsdb_idl_column ovsrec_manager_columns[OVSREC_MANAGER_N_COLUMNS] = {
28700
    [OVSREC_MANAGER_COL_CONNECTION_MODE] = {
28701
         .name = "connection_mode",
28702
         .type = {
28703
            .key = {
28704
               .type = OVSDB_TYPE_STRING,
28705
               .enum_ = &Manager_col_connection_mode_key_enum,
28706
               .string = { .minLen = 0, .maxLen = UINT_MAX },
28707
            },
28708
            .value = OVSDB_BASE_VOID_INIT,
28709
            .n_min = 0,
28710
            .n_max = 1,
28711
         },
28712
         .is_mutable = true,
28713
         .is_synthetic = false,
28714
         .parse = ovsrec_manager_parse_connection_mode,
28715
         .unparse = ovsrec_manager_unparse_connection_mode,
28716
    },
28717
28718
    [OVSREC_MANAGER_COL_EXTERNAL_IDS] = {
28719
         .name = "external_ids",
28720
         .type = {
28721
            .key = {
28722
               .type = OVSDB_TYPE_STRING,
28723
               .string = { .minLen = 0, .maxLen = UINT_MAX },
28724
            },
28725
            .value = {
28726
                .type = OVSDB_TYPE_STRING,
28727
                .string = { .minLen = 0, .maxLen = UINT_MAX },
28728
            },
28729
            .n_min = 0,
28730
            .n_max = UINT_MAX,
28731
         },
28732
         .is_mutable = true,
28733
         .is_synthetic = false,
28734
         .parse = ovsrec_manager_parse_external_ids,
28735
         .unparse = ovsrec_manager_unparse_external_ids,
28736
    },
28737
28738
    [OVSREC_MANAGER_COL_INACTIVITY_PROBE] = {
28739
         .name = "inactivity_probe",
28740
         .type = {
28741
            .key = {
28742
               .type = OVSDB_TYPE_INTEGER,
28743
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
28744
            },
28745
            .value = OVSDB_BASE_VOID_INIT,
28746
            .n_min = 0,
28747
            .n_max = 1,
28748
         },
28749
         .is_mutable = true,
28750
         .is_synthetic = false,
28751
         .parse = ovsrec_manager_parse_inactivity_probe,
28752
         .unparse = ovsrec_manager_unparse_inactivity_probe,
28753
    },
28754
28755
    [OVSREC_MANAGER_COL_IS_CONNECTED] = {
28756
         .name = "is_connected",
28757
         .type = {
28758
            .key = {
28759
               .type = OVSDB_TYPE_BOOLEAN,
28760
            },
28761
            .value = OVSDB_BASE_VOID_INIT,
28762
            .n_min = 1,
28763
            .n_max = 1,
28764
         },
28765
         .is_mutable = true,
28766
         .is_synthetic = false,
28767
         .parse = ovsrec_manager_parse_is_connected,
28768
         .unparse = ovsrec_manager_unparse_is_connected,
28769
    },
28770
28771
    [OVSREC_MANAGER_COL_MAX_BACKOFF] = {
28772
         .name = "max_backoff",
28773
         .type = {
28774
            .key = {
28775
               .type = OVSDB_TYPE_INTEGER,
28776
               .integer = { .min = INT64_C(1000), .max = INT64_MAX },
28777
            },
28778
            .value = OVSDB_BASE_VOID_INIT,
28779
            .n_min = 0,
28780
            .n_max = 1,
28781
         },
28782
         .is_mutable = true,
28783
         .is_synthetic = false,
28784
         .parse = ovsrec_manager_parse_max_backoff,
28785
         .unparse = ovsrec_manager_unparse_max_backoff,
28786
    },
28787
28788
    [OVSREC_MANAGER_COL_OTHER_CONFIG] = {
28789
         .name = "other_config",
28790
         .type = {
28791
            .key = {
28792
               .type = OVSDB_TYPE_STRING,
28793
               .string = { .minLen = 0, .maxLen = UINT_MAX },
28794
            },
28795
            .value = {
28796
                .type = OVSDB_TYPE_STRING,
28797
                .string = { .minLen = 0, .maxLen = UINT_MAX },
28798
            },
28799
            .n_min = 0,
28800
            .n_max = UINT_MAX,
28801
         },
28802
         .is_mutable = true,
28803
         .is_synthetic = false,
28804
         .parse = ovsrec_manager_parse_other_config,
28805
         .unparse = ovsrec_manager_unparse_other_config,
28806
    },
28807
28808
    [OVSREC_MANAGER_COL_STATUS] = {
28809
         .name = "status",
28810
         .type = {
28811
            .key = {
28812
               .type = OVSDB_TYPE_STRING,
28813
               .string = { .minLen = 0, .maxLen = UINT_MAX },
28814
            },
28815
            .value = {
28816
                .type = OVSDB_TYPE_STRING,
28817
                .string = { .minLen = 0, .maxLen = UINT_MAX },
28818
            },
28819
            .n_min = 0,
28820
            .n_max = UINT_MAX,
28821
         },
28822
         .is_mutable = true,
28823
         .is_synthetic = false,
28824
         .parse = ovsrec_manager_parse_status,
28825
         .unparse = ovsrec_manager_unparse_status,
28826
    },
28827
28828
    [OVSREC_MANAGER_COL_TARGET] = {
28829
         .name = "target",
28830
         .type = {
28831
            .key = {
28832
               .type = OVSDB_TYPE_STRING,
28833
               .string = { .minLen = 0, .maxLen = UINT_MAX },
28834
            },
28835
            .value = OVSDB_BASE_VOID_INIT,
28836
            .n_min = 1,
28837
            .n_max = 1,
28838
         },
28839
         .is_mutable = true,
28840
         .is_synthetic = false,
28841
         .parse = ovsrec_manager_parse_target,
28842
         .unparse = ovsrec_manager_unparse_target,
28843
    },
28844
28845
};
28846

28847
/* Mirror table. */
28848
28849
bool
28850
ovsrec_server_has_mirror_table_col_external_ids(const struct ovsdb_idl *idl)
28851
0
{
28852
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_external_ids);
28853
0
}
28854
28855
const struct ovsdb_type *
28856
ovsrec_mirror_external_ids_server_type(const struct ovsdb_idl *idl)
28857
0
{
28858
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_external_ids);
28859
0
}
28860
28861
28862
bool
28863
ovsrec_server_has_mirror_table_col_filter(const struct ovsdb_idl *idl)
28864
0
{
28865
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_filter);
28866
0
}
28867
28868
const struct ovsdb_type *
28869
ovsrec_mirror_filter_server_type(const struct ovsdb_idl *idl)
28870
0
{
28871
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_filter);
28872
0
}
28873
28874
28875
bool
28876
ovsrec_server_has_mirror_table_col_name(const struct ovsdb_idl *idl)
28877
0
{
28878
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_name);
28879
0
}
28880
28881
const struct ovsdb_type *
28882
ovsrec_mirror_name_server_type(const struct ovsdb_idl *idl)
28883
0
{
28884
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_name);
28885
0
}
28886
28887
28888
bool
28889
ovsrec_server_has_mirror_table_col_output_port(const struct ovsdb_idl *idl)
28890
0
{
28891
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_output_port);
28892
0
}
28893
28894
const struct ovsdb_type *
28895
ovsrec_mirror_output_port_server_type(const struct ovsdb_idl *idl)
28896
0
{
28897
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_output_port);
28898
0
}
28899
28900
28901
bool
28902
ovsrec_server_has_mirror_table_col_output_vlan(const struct ovsdb_idl *idl)
28903
0
{
28904
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_output_vlan);
28905
0
}
28906
28907
const struct ovsdb_type *
28908
ovsrec_mirror_output_vlan_server_type(const struct ovsdb_idl *idl)
28909
0
{
28910
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_output_vlan);
28911
0
}
28912
28913
28914
bool
28915
ovsrec_server_has_mirror_table_col_select_all(const struct ovsdb_idl *idl)
28916
0
{
28917
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_select_all);
28918
0
}
28919
28920
const struct ovsdb_type *
28921
ovsrec_mirror_select_all_server_type(const struct ovsdb_idl *idl)
28922
0
{
28923
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_select_all);
28924
0
}
28925
28926
28927
bool
28928
ovsrec_server_has_mirror_table_col_select_dst_port(const struct ovsdb_idl *idl)
28929
0
{
28930
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_select_dst_port);
28931
0
}
28932
28933
const struct ovsdb_type *
28934
ovsrec_mirror_select_dst_port_server_type(const struct ovsdb_idl *idl)
28935
0
{
28936
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_select_dst_port);
28937
0
}
28938
28939
28940
bool
28941
ovsrec_server_has_mirror_table_col_select_src_port(const struct ovsdb_idl *idl)
28942
0
{
28943
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_select_src_port);
28944
0
}
28945
28946
const struct ovsdb_type *
28947
ovsrec_mirror_select_src_port_server_type(const struct ovsdb_idl *idl)
28948
0
{
28949
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_select_src_port);
28950
0
}
28951
28952
28953
bool
28954
ovsrec_server_has_mirror_table_col_select_vlan(const struct ovsdb_idl *idl)
28955
0
{
28956
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_select_vlan);
28957
0
}
28958
28959
const struct ovsdb_type *
28960
ovsrec_mirror_select_vlan_server_type(const struct ovsdb_idl *idl)
28961
0
{
28962
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_select_vlan);
28963
0
}
28964
28965
28966
bool
28967
ovsrec_server_has_mirror_table_col_snaplen(const struct ovsdb_idl *idl)
28968
0
{
28969
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_snaplen);
28970
0
}
28971
28972
const struct ovsdb_type *
28973
ovsrec_mirror_snaplen_server_type(const struct ovsdb_idl *idl)
28974
0
{
28975
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_snaplen);
28976
0
}
28977
28978
28979
bool
28980
ovsrec_server_has_mirror_table_col_statistics(const struct ovsdb_idl *idl)
28981
0
{
28982
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_statistics);
28983
0
}
28984
28985
const struct ovsdb_type *
28986
ovsrec_mirror_statistics_server_type(const struct ovsdb_idl *idl)
28987
0
{
28988
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_mirror_col_statistics);
28989
0
}
28990
28991
28992
bool
28993
ovsrec_server_has_mirror_table(const struct ovsdb_idl *idl)
28994
0
{
28995
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
28996
0
}
28997
28998
28999
const struct ovsrec_mirror_table *
29000
ovsrec_mirror_table_get(const struct ovsdb_idl *idl)
29001
0
{
29002
0
    return (const struct ovsrec_mirror_table *) idl;
29003
0
}
29004
29005
const struct ovsrec_mirror *
29006
ovsrec_mirror_table_first(const struct ovsrec_mirror_table *table)
29007
0
{
29008
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
29009
0
    return ovsrec_mirror_first(idl);
29010
0
}
29011
29012
29013
const struct ovsrec_mirror *
29014
ovsrec_mirror_table_track_get_first(const struct ovsrec_mirror_table *table)
29015
0
{
29016
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
29017
0
    return ovsrec_mirror_track_get_first(idl);
29018
0
}
29019
29020
29021
static void
29022
ovsrec_mirror_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29023
0
{
29024
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29025
0
    smap_init(&row->external_ids);
29026
0
    for (size_t i = 0; i < datum->n; i++) {
29027
0
        smap_add(&row->external_ids,
29028
0
                 json_string(datum->keys[i].s),
29029
0
                 json_string(datum->values[i].s));
29030
0
    }
29031
0
}
29032
29033
static void
29034
ovsrec_mirror_parse_filter(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29035
0
{
29036
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29037
29038
0
    if (datum->n >= 1) {
29039
0
        row->filter = CONST_CAST(char *, json_string(datum->keys[0].s));
29040
0
    } else {
29041
0
        row->filter = NULL;
29042
0
    }
29043
0
}
29044
29045
static void
29046
ovsrec_mirror_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29047
0
{
29048
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29049
29050
0
    if (datum->n >= 1) {
29051
0
        row->name = CONST_CAST(char *, json_string(datum->keys[0].s));
29052
0
    } else {
29053
0
        row->name = "";
29054
0
    }
29055
0
}
29056
29057
static void
29058
ovsrec_mirror_parse_output_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29059
0
{
29060
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29061
29062
0
    if (datum->n >= 1) {
29063
0
        row->output_port = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_port, &datum->keys[0].uuid));
29064
0
    } else {
29065
0
        row->output_port = NULL;
29066
0
    }
29067
0
}
29068
29069
static void
29070
ovsrec_mirror_parse_output_vlan(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29071
0
{
29072
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29073
0
    size_t n = MIN(1, datum->n);
29074
0
    row->output_vlan = NULL;
29075
0
    row->n_output_vlan = 0;
29076
0
    for (size_t i = 0; i < n; i++) {
29077
0
        if (!row->n_output_vlan) {
29078
0
            row->output_vlan = xmalloc(n * sizeof *row->output_vlan);
29079
0
        }
29080
0
        row->output_vlan[row->n_output_vlan] = datum->keys[i].integer;
29081
0
        row->n_output_vlan++;
29082
0
    }
29083
0
}
29084
29085
static void
29086
ovsrec_mirror_parse_select_all(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29087
0
{
29088
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29089
29090
0
    if (datum->n >= 1) {
29091
0
        row->select_all = datum->keys[0].boolean;
29092
0
    } else {
29093
0
        row->select_all = false;
29094
0
    }
29095
0
}
29096
29097
static void
29098
ovsrec_mirror_parse_select_dst_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29099
0
{
29100
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29101
0
    row->select_dst_port = NULL;
29102
0
    row->n_select_dst_port = 0;
29103
0
    for (size_t i = 0; i < datum->n; i++) {
29104
0
        struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_port, &datum->keys[i].uuid));
29105
0
        if (!keyRow) {
29106
0
            continue;
29107
0
        }
29108
0
        if (!row->n_select_dst_port) {
29109
0
            row->select_dst_port = xmalloc(datum->n * sizeof *row->select_dst_port);
29110
0
        }
29111
0
        row->select_dst_port[row->n_select_dst_port] = keyRow;
29112
0
        row->n_select_dst_port++;
29113
0
    }
29114
0
}
29115
29116
static void
29117
ovsrec_mirror_parse_select_src_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29118
0
{
29119
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29120
0
    row->select_src_port = NULL;
29121
0
    row->n_select_src_port = 0;
29122
0
    for (size_t i = 0; i < datum->n; i++) {
29123
0
        struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_port, &datum->keys[i].uuid));
29124
0
        if (!keyRow) {
29125
0
            continue;
29126
0
        }
29127
0
        if (!row->n_select_src_port) {
29128
0
            row->select_src_port = xmalloc(datum->n * sizeof *row->select_src_port);
29129
0
        }
29130
0
        row->select_src_port[row->n_select_src_port] = keyRow;
29131
0
        row->n_select_src_port++;
29132
0
    }
29133
0
}
29134
29135
static void
29136
ovsrec_mirror_parse_select_vlan(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29137
0
{
29138
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29139
0
    size_t n = MIN(4096, datum->n);
29140
0
    row->select_vlan = NULL;
29141
0
    row->n_select_vlan = 0;
29142
0
    for (size_t i = 0; i < n; i++) {
29143
0
        if (!row->n_select_vlan) {
29144
0
            row->select_vlan = xmalloc(n * sizeof *row->select_vlan);
29145
0
        }
29146
0
        row->select_vlan[row->n_select_vlan] = datum->keys[i].integer;
29147
0
        row->n_select_vlan++;
29148
0
    }
29149
0
}
29150
29151
static void
29152
ovsrec_mirror_parse_snaplen(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29153
0
{
29154
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29155
0
    size_t n = MIN(1, datum->n);
29156
0
    row->snaplen = NULL;
29157
0
    row->n_snaplen = 0;
29158
0
    for (size_t i = 0; i < n; i++) {
29159
0
        if (!row->n_snaplen) {
29160
0
            row->snaplen = xmalloc(n * sizeof *row->snaplen);
29161
0
        }
29162
0
        row->snaplen[row->n_snaplen] = datum->keys[i].integer;
29163
0
        row->n_snaplen++;
29164
0
    }
29165
0
}
29166
29167
static void
29168
ovsrec_mirror_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29169
0
{
29170
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29171
0
    row->key_statistics = NULL;
29172
0
    row->value_statistics = NULL;
29173
0
    row->n_statistics = 0;
29174
0
    for (size_t i = 0; i < datum->n; i++) {
29175
0
        if (!row->n_statistics) {
29176
0
            row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
29177
0
            row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
29178
0
        }
29179
0
        row->key_statistics[row->n_statistics] = CONST_CAST(char *, json_string(datum->keys[i].s));
29180
0
        row->value_statistics[row->n_statistics] = datum->values[i].integer;
29181
0
        row->n_statistics++;
29182
0
    }
29183
0
}
29184
29185
static void
29186
ovsrec_mirror_unparse_external_ids(struct ovsdb_idl_row *row_)
29187
0
{
29188
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29189
0
    smap_destroy(&row->external_ids);
29190
0
}
29191
29192
static void
29193
ovsrec_mirror_unparse_filter(struct ovsdb_idl_row *row OVS_UNUSED)
29194
0
{
29195
    /* Nothing to do. */
29196
0
}
29197
29198
static void
29199
ovsrec_mirror_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
29200
0
{
29201
    /* Nothing to do. */
29202
0
}
29203
29204
static void
29205
ovsrec_mirror_unparse_output_port(struct ovsdb_idl_row *row OVS_UNUSED)
29206
0
{
29207
    /* Nothing to do. */
29208
0
}
29209
29210
static void
29211
ovsrec_mirror_unparse_output_vlan(struct ovsdb_idl_row *row_)
29212
0
{
29213
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29214
0
    free(row->output_vlan);
29215
0
}
29216
29217
static void
29218
ovsrec_mirror_unparse_select_all(struct ovsdb_idl_row *row OVS_UNUSED)
29219
0
{
29220
    /* Nothing to do. */
29221
0
}
29222
29223
static void
29224
ovsrec_mirror_unparse_select_dst_port(struct ovsdb_idl_row *row_)
29225
0
{
29226
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29227
0
    free(row->select_dst_port);
29228
0
}
29229
29230
static void
29231
ovsrec_mirror_unparse_select_src_port(struct ovsdb_idl_row *row_)
29232
0
{
29233
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29234
0
    free(row->select_src_port);
29235
0
}
29236
29237
static void
29238
ovsrec_mirror_unparse_select_vlan(struct ovsdb_idl_row *row_)
29239
0
{
29240
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29241
0
    free(row->select_vlan);
29242
0
}
29243
29244
static void
29245
ovsrec_mirror_unparse_snaplen(struct ovsdb_idl_row *row_)
29246
0
{
29247
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29248
0
    free(row->snaplen);
29249
0
}
29250
29251
static void
29252
ovsrec_mirror_unparse_statistics(struct ovsdb_idl_row *row_)
29253
0
{
29254
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
29255
0
    free(row->key_statistics);
29256
0
    free(row->value_statistics);
29257
0
}
29258
29259
static void
29260
ovsrec_mirror_init__(struct ovsdb_idl_row *row)
29261
0
{
29262
0
    ovsrec_mirror_init(ovsrec_mirror_cast(row));
29263
0
}
29264
29265
/* Clears the contents of 'row' in table "Mirror". */
29266
void
29267
ovsrec_mirror_init(struct ovsrec_mirror *row)
29268
0
{
29269
0
    memset(row, 0, sizeof *row); 
29270
0
    smap_init(&row->external_ids);
29271
0
    row->name = "";
29272
0
}
29273
29274
/* Searches table "Mirror" in 'idl' for a row with UUID 'uuid'.  Returns
29275
 * a pointer to the row if there is one, otherwise a null pointer.  */
29276
const struct ovsrec_mirror *
29277
ovsrec_mirror_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
29278
0
{
29279
0
    return ovsrec_mirror_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_mirror, uuid));
29280
0
}
29281
29282
/* Searches table "Mirror" for a row with UUID 'uuid'.  Returns
29283
 * a pointer to the row if there is one, otherwise a null pointer.  */
29284
const struct ovsrec_mirror *
29285
ovsrec_mirror_table_get_for_uuid(const struct ovsrec_mirror_table *table, const struct uuid *uuid)
29286
0
{
29287
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
29288
0
    return ovsrec_mirror_get_for_uuid(idl, uuid);
29289
0
}
29290
29291
/* Returns a row in table "Mirror" in 'idl', or a null pointer if that
29292
 * table is empty.
29293
 *
29294
 * Database tables are internally maintained as hash tables, so adding or
29295
 * removing rows while traversing the same table can cause some rows to be
29296
 * visited twice or not at apply. */
29297
const struct ovsrec_mirror *
29298
ovsrec_mirror_first(const struct ovsdb_idl *idl)
29299
0
{
29300
0
    return ovsrec_mirror_cast(ovsdb_idl_first_row(idl, &ovsrec_table_mirror));
29301
0
}
29302
29303
/* Returns a row following 'row' within its table, or a null pointer if 'row'
29304
 * is the last row in its table. */
29305
const struct ovsrec_mirror *
29306
ovsrec_mirror_next(const struct ovsrec_mirror *row)
29307
0
{
29308
0
    return ovsrec_mirror_cast(ovsdb_idl_next_row(&row->header_));
29309
0
}
29310
29311
unsigned int ovsrec_mirror_get_seqno(const struct ovsdb_idl *idl)
29312
0
{
29313
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_mirror);
29314
0
}
29315
29316
unsigned int ovsrec_mirror_row_get_seqno(const struct ovsrec_mirror *row, enum ovsdb_idl_change change)
29317
0
{
29318
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
29319
0
}
29320
29321
const struct ovsrec_mirror *
29322
ovsrec_mirror_track_get_first(const struct ovsdb_idl *idl)
29323
0
{
29324
0
    return ovsrec_mirror_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_mirror));
29325
0
}
29326
29327
const struct ovsrec_mirror
29328
*ovsrec_mirror_track_get_next(const struct ovsrec_mirror *row)
29329
0
{
29330
0
    return ovsrec_mirror_cast(ovsdb_idl_track_get_next(&row->header_));
29331
0
}
29332
29333
29334
/* Deletes 'row' from table "Mirror".  'row' may be freed, so it must not be
29335
 * accessed afterward.
29336
 *
29337
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29338
void
29339
ovsrec_mirror_delete(const struct ovsrec_mirror *row)
29340
0
{
29341
0
    ovsdb_idl_txn_delete(&row->header_);
29342
0
}
29343
29344
/* Inserts and returns a new row in the table "Mirror" in the database
29345
 * with open transaction 'txn'.
29346
 *
29347
 * The new row is assigned a randomly generated provisional UUID.
29348
 * ovsdb-server will assign a different UUID when 'txn' is committed,
29349
 * but the IDL will replace any uses of the provisional UUID in the
29350
 * data to be to be committed by the UUID assigned by ovsdb-server. */
29351
struct ovsrec_mirror *
29352
ovsrec_mirror_insert(struct ovsdb_idl_txn *txn)
29353
0
{
29354
0
    return ovsrec_mirror_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_mirror, NULL));
29355
0
}
29356
29357
/* Inserts and returns a new row in the table "Mirror" in the database
29358
 * with open transaction 'txn'.
29359
 *
29360
 * The new row is assigned the UUID specified in the 'uuid' parameter
29361
 * (which cannot be null).  ovsdb-server will try to assign the same
29362
 * UUID when 'txn' is committed. */
29363
struct ovsrec_mirror *
29364
ovsrec_mirror_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
29365
0
{
29366
0
    return ovsrec_mirror_cast(ovsdb_idl_txn_insert_persist_uuid(
29367
0
        txn, &ovsrec_table_mirror, uuid));
29368
0
}
29369
29370
bool
29371
ovsrec_mirror_is_updated(const struct ovsrec_mirror *row, enum ovsrec_mirror_column_id column)
29372
0
{
29373
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_mirror_columns[column]);
29374
0
}
29375
29376
/* Causes the original contents of column "external_ids" in 'row' to be
29377
 * verified as a prerequisite to completing the transaction.  That is, if
29378
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
29379
 * time that the IDL originally read its contents and the time that the
29380
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29381
 *
29382
 * The intention is that, to ensure that no transaction commits based on dirty
29383
 * reads, an application should call this function any time "external_ids" is
29384
 * read as part of a read-modify-write operation.
29385
 *
29386
 * In some cases this function reduces to a no-op, because the current value
29387
 * of "external_ids" is already known:
29388
 *
29389
 *   - If 'row' is a row created by the current transaction (returned by
29390
 *     ovsrec_mirror_insert()).
29391
 *
29392
 *   - If "external_ids" has already been modified (with
29393
 *     ovsrec_mirror_set_external_ids()) within the current transaction.
29394
 *
29395
 * Because of the latter property, always call this function *before*
29396
 * ovsrec_mirror_set_external_ids() for a given read-modify-write.
29397
 *
29398
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29399
void
29400
ovsrec_mirror_verify_external_ids(const struct ovsrec_mirror *row)
29401
0
{
29402
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_external_ids);
29403
0
}
29404
29405
/* Causes the original contents of column "filter" in 'row' to be
29406
 * verified as a prerequisite to completing the transaction.  That is, if
29407
 * "filter" in 'row' changed (or if 'row' was deleted) between the
29408
 * time that the IDL originally read its contents and the time that the
29409
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29410
 *
29411
 * The intention is that, to ensure that no transaction commits based on dirty
29412
 * reads, an application should call this function any time "filter" is
29413
 * read as part of a read-modify-write operation.
29414
 *
29415
 * In some cases this function reduces to a no-op, because the current value
29416
 * of "filter" is already known:
29417
 *
29418
 *   - If 'row' is a row created by the current transaction (returned by
29419
 *     ovsrec_mirror_insert()).
29420
 *
29421
 *   - If "filter" has already been modified (with
29422
 *     ovsrec_mirror_set_filter()) within the current transaction.
29423
 *
29424
 * Because of the latter property, always call this function *before*
29425
 * ovsrec_mirror_set_filter() for a given read-modify-write.
29426
 *
29427
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29428
void
29429
ovsrec_mirror_verify_filter(const struct ovsrec_mirror *row)
29430
0
{
29431
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_filter);
29432
0
}
29433
29434
/* Causes the original contents of column "name" in 'row' to be
29435
 * verified as a prerequisite to completing the transaction.  That is, if
29436
 * "name" in 'row' changed (or if 'row' was deleted) between the
29437
 * time that the IDL originally read its contents and the time that the
29438
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29439
 *
29440
 * The intention is that, to ensure that no transaction commits based on dirty
29441
 * reads, an application should call this function any time "name" is
29442
 * read as part of a read-modify-write operation.
29443
 *
29444
 * In some cases this function reduces to a no-op, because the current value
29445
 * of "name" is already known:
29446
 *
29447
 *   - If 'row' is a row created by the current transaction (returned by
29448
 *     ovsrec_mirror_insert()).
29449
 *
29450
 *   - If "name" has already been modified (with
29451
 *     ovsrec_mirror_set_name()) within the current transaction.
29452
 *
29453
 * Because of the latter property, always call this function *before*
29454
 * ovsrec_mirror_set_name() for a given read-modify-write.
29455
 *
29456
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29457
void
29458
ovsrec_mirror_verify_name(const struct ovsrec_mirror *row)
29459
0
{
29460
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_name);
29461
0
}
29462
29463
/* Causes the original contents of column "output_port" in 'row' to be
29464
 * verified as a prerequisite to completing the transaction.  That is, if
29465
 * "output_port" in 'row' changed (or if 'row' was deleted) between the
29466
 * time that the IDL originally read its contents and the time that the
29467
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29468
 *
29469
 * The intention is that, to ensure that no transaction commits based on dirty
29470
 * reads, an application should call this function any time "output_port" is
29471
 * read as part of a read-modify-write operation.
29472
 *
29473
 * In some cases this function reduces to a no-op, because the current value
29474
 * of "output_port" is already known:
29475
 *
29476
 *   - If 'row' is a row created by the current transaction (returned by
29477
 *     ovsrec_mirror_insert()).
29478
 *
29479
 *   - If "output_port" has already been modified (with
29480
 *     ovsrec_mirror_set_output_port()) within the current transaction.
29481
 *
29482
 * Because of the latter property, always call this function *before*
29483
 * ovsrec_mirror_set_output_port() for a given read-modify-write.
29484
 *
29485
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29486
void
29487
ovsrec_mirror_verify_output_port(const struct ovsrec_mirror *row)
29488
0
{
29489
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_output_port);
29490
0
}
29491
29492
/* Causes the original contents of column "output_vlan" in 'row' to be
29493
 * verified as a prerequisite to completing the transaction.  That is, if
29494
 * "output_vlan" in 'row' changed (or if 'row' was deleted) between the
29495
 * time that the IDL originally read its contents and the time that the
29496
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29497
 *
29498
 * The intention is that, to ensure that no transaction commits based on dirty
29499
 * reads, an application should call this function any time "output_vlan" is
29500
 * read as part of a read-modify-write operation.
29501
 *
29502
 * In some cases this function reduces to a no-op, because the current value
29503
 * of "output_vlan" is already known:
29504
 *
29505
 *   - If 'row' is a row created by the current transaction (returned by
29506
 *     ovsrec_mirror_insert()).
29507
 *
29508
 *   - If "output_vlan" has already been modified (with
29509
 *     ovsrec_mirror_set_output_vlan()) within the current transaction.
29510
 *
29511
 * Because of the latter property, always call this function *before*
29512
 * ovsrec_mirror_set_output_vlan() for a given read-modify-write.
29513
 *
29514
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29515
void
29516
ovsrec_mirror_verify_output_vlan(const struct ovsrec_mirror *row)
29517
0
{
29518
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_output_vlan);
29519
0
}
29520
29521
/* Causes the original contents of column "select_all" in 'row' to be
29522
 * verified as a prerequisite to completing the transaction.  That is, if
29523
 * "select_all" in 'row' changed (or if 'row' was deleted) between the
29524
 * time that the IDL originally read its contents and the time that the
29525
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29526
 *
29527
 * The intention is that, to ensure that no transaction commits based on dirty
29528
 * reads, an application should call this function any time "select_all" is
29529
 * read as part of a read-modify-write operation.
29530
 *
29531
 * In some cases this function reduces to a no-op, because the current value
29532
 * of "select_all" is already known:
29533
 *
29534
 *   - If 'row' is a row created by the current transaction (returned by
29535
 *     ovsrec_mirror_insert()).
29536
 *
29537
 *   - If "select_all" has already been modified (with
29538
 *     ovsrec_mirror_set_select_all()) within the current transaction.
29539
 *
29540
 * Because of the latter property, always call this function *before*
29541
 * ovsrec_mirror_set_select_all() for a given read-modify-write.
29542
 *
29543
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29544
void
29545
ovsrec_mirror_verify_select_all(const struct ovsrec_mirror *row)
29546
0
{
29547
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_select_all);
29548
0
}
29549
29550
/* Causes the original contents of column "select_dst_port" in 'row' to be
29551
 * verified as a prerequisite to completing the transaction.  That is, if
29552
 * "select_dst_port" in 'row' changed (or if 'row' was deleted) between the
29553
 * time that the IDL originally read its contents and the time that the
29554
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29555
 *
29556
 * The intention is that, to ensure that no transaction commits based on dirty
29557
 * reads, an application should call this function any time "select_dst_port" is
29558
 * read as part of a read-modify-write operation.
29559
 *
29560
 * In some cases this function reduces to a no-op, because the current value
29561
 * of "select_dst_port" is already known:
29562
 *
29563
 *   - If 'row' is a row created by the current transaction (returned by
29564
 *     ovsrec_mirror_insert()).
29565
 *
29566
 *   - If "select_dst_port" has already been modified (with
29567
 *     ovsrec_mirror_set_select_dst_port()) within the current transaction.
29568
 *
29569
 * Because of the latter property, always call this function *before*
29570
 * ovsrec_mirror_set_select_dst_port() for a given read-modify-write.
29571
 *
29572
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29573
void
29574
ovsrec_mirror_verify_select_dst_port(const struct ovsrec_mirror *row)
29575
0
{
29576
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_select_dst_port);
29577
0
}
29578
29579
/* Causes the original contents of column "select_src_port" in 'row' to be
29580
 * verified as a prerequisite to completing the transaction.  That is, if
29581
 * "select_src_port" in 'row' changed (or if 'row' was deleted) between the
29582
 * time that the IDL originally read its contents and the time that the
29583
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29584
 *
29585
 * The intention is that, to ensure that no transaction commits based on dirty
29586
 * reads, an application should call this function any time "select_src_port" is
29587
 * read as part of a read-modify-write operation.
29588
 *
29589
 * In some cases this function reduces to a no-op, because the current value
29590
 * of "select_src_port" is already known:
29591
 *
29592
 *   - If 'row' is a row created by the current transaction (returned by
29593
 *     ovsrec_mirror_insert()).
29594
 *
29595
 *   - If "select_src_port" has already been modified (with
29596
 *     ovsrec_mirror_set_select_src_port()) within the current transaction.
29597
 *
29598
 * Because of the latter property, always call this function *before*
29599
 * ovsrec_mirror_set_select_src_port() for a given read-modify-write.
29600
 *
29601
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29602
void
29603
ovsrec_mirror_verify_select_src_port(const struct ovsrec_mirror *row)
29604
0
{
29605
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_select_src_port);
29606
0
}
29607
29608
/* Causes the original contents of column "select_vlan" in 'row' to be
29609
 * verified as a prerequisite to completing the transaction.  That is, if
29610
 * "select_vlan" in 'row' changed (or if 'row' was deleted) between the
29611
 * time that the IDL originally read its contents and the time that the
29612
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29613
 *
29614
 * The intention is that, to ensure that no transaction commits based on dirty
29615
 * reads, an application should call this function any time "select_vlan" is
29616
 * read as part of a read-modify-write operation.
29617
 *
29618
 * In some cases this function reduces to a no-op, because the current value
29619
 * of "select_vlan" is already known:
29620
 *
29621
 *   - If 'row' is a row created by the current transaction (returned by
29622
 *     ovsrec_mirror_insert()).
29623
 *
29624
 *   - If "select_vlan" has already been modified (with
29625
 *     ovsrec_mirror_set_select_vlan()) within the current transaction.
29626
 *
29627
 * Because of the latter property, always call this function *before*
29628
 * ovsrec_mirror_set_select_vlan() for a given read-modify-write.
29629
 *
29630
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29631
void
29632
ovsrec_mirror_verify_select_vlan(const struct ovsrec_mirror *row)
29633
0
{
29634
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_select_vlan);
29635
0
}
29636
29637
/* Causes the original contents of column "snaplen" in 'row' to be
29638
 * verified as a prerequisite to completing the transaction.  That is, if
29639
 * "snaplen" in 'row' changed (or if 'row' was deleted) between the
29640
 * time that the IDL originally read its contents and the time that the
29641
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29642
 *
29643
 * The intention is that, to ensure that no transaction commits based on dirty
29644
 * reads, an application should call this function any time "snaplen" is
29645
 * read as part of a read-modify-write operation.
29646
 *
29647
 * In some cases this function reduces to a no-op, because the current value
29648
 * of "snaplen" is already known:
29649
 *
29650
 *   - If 'row' is a row created by the current transaction (returned by
29651
 *     ovsrec_mirror_insert()).
29652
 *
29653
 *   - If "snaplen" has already been modified (with
29654
 *     ovsrec_mirror_set_snaplen()) within the current transaction.
29655
 *
29656
 * Because of the latter property, always call this function *before*
29657
 * ovsrec_mirror_set_snaplen() for a given read-modify-write.
29658
 *
29659
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29660
void
29661
ovsrec_mirror_verify_snaplen(const struct ovsrec_mirror *row)
29662
0
{
29663
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_snaplen);
29664
0
}
29665
29666
/* Causes the original contents of column "statistics" in 'row' to be
29667
 * verified as a prerequisite to completing the transaction.  That is, if
29668
 * "statistics" in 'row' changed (or if 'row' was deleted) between the
29669
 * time that the IDL originally read its contents and the time that the
29670
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
29671
 *
29672
 * The intention is that, to ensure that no transaction commits based on dirty
29673
 * reads, an application should call this function any time "statistics" is
29674
 * read as part of a read-modify-write operation.
29675
 *
29676
 * In some cases this function reduces to a no-op, because the current value
29677
 * of "statistics" is already known:
29678
 *
29679
 *   - If 'row' is a row created by the current transaction (returned by
29680
 *     ovsrec_mirror_insert()).
29681
 *
29682
 *   - If "statistics" has already been modified (with
29683
 *     ovsrec_mirror_set_statistics()) within the current transaction.
29684
 *
29685
 * Because of the latter property, always call this function *before*
29686
 * ovsrec_mirror_set_statistics() for a given read-modify-write.
29687
 *
29688
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
29689
void
29690
ovsrec_mirror_verify_statistics(const struct ovsrec_mirror *row)
29691
0
{
29692
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_statistics);
29693
0
}
29694
29695
/* Returns the "external_ids" column's value from the "Mirror" table in 'row'
29696
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29697
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29698
 * for a given key than implementing the same operation on the "cooked"
29699
 * form in 'row'.
29700
 *
29701
 * 'key_type' must be OVSDB_TYPE_STRING.
29702
 * 'value_type' must be OVSDB_TYPE_STRING.
29703
 * (This helps to avoid silent bugs if someone changes external_ids's
29704
 * type without updating the caller.)
29705
 *
29706
 * The caller must not modify or free the returned value.
29707
 *
29708
 * Various kinds of changes can invalidate the returned value: modifying
29709
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29710
 * If the returned value is needed for a long time, it is best to make a copy
29711
 * of it with ovsdb_datum_clone().
29712
 *
29713
 * This function is rarely useful, since it is easier to access the value
29714
 * directly through the "external_ids" member in ovsrec_mirror. */
29715
const struct ovsdb_datum *
29716
ovsrec_mirror_get_external_ids(const struct ovsrec_mirror *row,
29717
  enum ovsdb_atomic_type key_type OVS_UNUSED,
29718
  enum ovsdb_atomic_type value_type OVS_UNUSED)
29719
0
{
29720
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
29721
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
29722
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_external_ids);
29723
0
}
29724
29725
/* Returns the "filter" column's value from the "Mirror" table in 'row'
29726
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29727
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29728
 * for a given key than implementing the same operation on the "cooked"
29729
 * form in 'row'.
29730
 *
29731
 * 'key_type' must be OVSDB_TYPE_STRING.
29732
 * (This helps to avoid silent bugs if someone changes filter's
29733
 * type without updating the caller.)
29734
 *
29735
 * The caller must not modify or free the returned value.
29736
 *
29737
 * Various kinds of changes can invalidate the returned value: modifying
29738
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29739
 * If the returned value is needed for a long time, it is best to make a copy
29740
 * of it with ovsdb_datum_clone().
29741
 *
29742
 * This function is rarely useful, since it is easier to access the value
29743
 * directly through the "filter" member in ovsrec_mirror. */
29744
const struct ovsdb_datum *
29745
ovsrec_mirror_get_filter(const struct ovsrec_mirror *row,
29746
  enum ovsdb_atomic_type key_type OVS_UNUSED)
29747
0
{
29748
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
29749
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_filter);
29750
0
}
29751
29752
/* Returns the "name" column's value from the "Mirror" table in 'row'
29753
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29754
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29755
 * for a given key than implementing the same operation on the "cooked"
29756
 * form in 'row'.
29757
 *
29758
 * 'key_type' must be OVSDB_TYPE_STRING.
29759
 * (This helps to avoid silent bugs if someone changes name's
29760
 * type without updating the caller.)
29761
 *
29762
 * The caller must not modify or free the returned value.
29763
 *
29764
 * Various kinds of changes can invalidate the returned value: modifying
29765
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29766
 * If the returned value is needed for a long time, it is best to make a copy
29767
 * of it with ovsdb_datum_clone().
29768
 *
29769
 * This function is rarely useful, since it is easier to access the value
29770
 * directly through the "name" member in ovsrec_mirror. */
29771
const struct ovsdb_datum *
29772
ovsrec_mirror_get_name(const struct ovsrec_mirror *row,
29773
  enum ovsdb_atomic_type key_type OVS_UNUSED)
29774
0
{
29775
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
29776
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_name);
29777
0
}
29778
29779
/* Returns the "output_port" column's value from the "Mirror" table in 'row'
29780
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29781
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29782
 * for a given key than implementing the same operation on the "cooked"
29783
 * form in 'row'.
29784
 *
29785
 * 'key_type' must be OVSDB_TYPE_UUID.
29786
 * (This helps to avoid silent bugs if someone changes output_port's
29787
 * type without updating the caller.)
29788
 *
29789
 * The caller must not modify or free the returned value.
29790
 *
29791
 * Various kinds of changes can invalidate the returned value: modifying
29792
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29793
 * If the returned value is needed for a long time, it is best to make a copy
29794
 * of it with ovsdb_datum_clone().
29795
 *
29796
 * This function is rarely useful, since it is easier to access the value
29797
 * directly through the "output_port" member in ovsrec_mirror. */
29798
const struct ovsdb_datum *
29799
ovsrec_mirror_get_output_port(const struct ovsrec_mirror *row,
29800
  enum ovsdb_atomic_type key_type OVS_UNUSED)
29801
0
{
29802
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
29803
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_output_port);
29804
0
}
29805
29806
/* Returns the "output_vlan" column's value from the "Mirror" table in 'row'
29807
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29808
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29809
 * for a given key than implementing the same operation on the "cooked"
29810
 * form in 'row'.
29811
 *
29812
 * 'key_type' must be OVSDB_TYPE_INTEGER.
29813
 * (This helps to avoid silent bugs if someone changes output_vlan's
29814
 * type without updating the caller.)
29815
 *
29816
 * The caller must not modify or free the returned value.
29817
 *
29818
 * Various kinds of changes can invalidate the returned value: modifying
29819
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29820
 * If the returned value is needed for a long time, it is best to make a copy
29821
 * of it with ovsdb_datum_clone().
29822
 *
29823
 * This function is rarely useful, since it is easier to access the value
29824
 * directly through the "output_vlan" member in ovsrec_mirror. */
29825
const struct ovsdb_datum *
29826
ovsrec_mirror_get_output_vlan(const struct ovsrec_mirror *row,
29827
  enum ovsdb_atomic_type key_type OVS_UNUSED)
29828
0
{
29829
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
29830
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_output_vlan);
29831
0
}
29832
29833
/* Returns the "select_all" column's value from the "Mirror" table in 'row'
29834
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29835
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29836
 * for a given key than implementing the same operation on the "cooked"
29837
 * form in 'row'.
29838
 *
29839
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
29840
 * (This helps to avoid silent bugs if someone changes select_all's
29841
 * type without updating the caller.)
29842
 *
29843
 * The caller must not modify or free the returned value.
29844
 *
29845
 * Various kinds of changes can invalidate the returned value: modifying
29846
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29847
 * If the returned value is needed for a long time, it is best to make a copy
29848
 * of it with ovsdb_datum_clone().
29849
 *
29850
 * This function is rarely useful, since it is easier to access the value
29851
 * directly through the "select_all" member in ovsrec_mirror. */
29852
const struct ovsdb_datum *
29853
ovsrec_mirror_get_select_all(const struct ovsrec_mirror *row,
29854
  enum ovsdb_atomic_type key_type OVS_UNUSED)
29855
0
{
29856
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
29857
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_all);
29858
0
}
29859
29860
/* Returns the "select_dst_port" column's value from the "Mirror" table in 'row'
29861
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29862
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29863
 * for a given key than implementing the same operation on the "cooked"
29864
 * form in 'row'.
29865
 *
29866
 * 'key_type' must be OVSDB_TYPE_UUID.
29867
 * (This helps to avoid silent bugs if someone changes select_dst_port's
29868
 * type without updating the caller.)
29869
 *
29870
 * The caller must not modify or free the returned value.
29871
 *
29872
 * Various kinds of changes can invalidate the returned value: modifying
29873
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29874
 * If the returned value is needed for a long time, it is best to make a copy
29875
 * of it with ovsdb_datum_clone().
29876
 *
29877
 * This function is rarely useful, since it is easier to access the value
29878
 * directly through the "select_dst_port" member in ovsrec_mirror. */
29879
const struct ovsdb_datum *
29880
ovsrec_mirror_get_select_dst_port(const struct ovsrec_mirror *row,
29881
  enum ovsdb_atomic_type key_type OVS_UNUSED)
29882
0
{
29883
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
29884
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_dst_port);
29885
0
}
29886
29887
/* Returns the "select_src_port" column's value from the "Mirror" table in 'row'
29888
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29889
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29890
 * for a given key than implementing the same operation on the "cooked"
29891
 * form in 'row'.
29892
 *
29893
 * 'key_type' must be OVSDB_TYPE_UUID.
29894
 * (This helps to avoid silent bugs if someone changes select_src_port's
29895
 * type without updating the caller.)
29896
 *
29897
 * The caller must not modify or free the returned value.
29898
 *
29899
 * Various kinds of changes can invalidate the returned value: modifying
29900
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29901
 * If the returned value is needed for a long time, it is best to make a copy
29902
 * of it with ovsdb_datum_clone().
29903
 *
29904
 * This function is rarely useful, since it is easier to access the value
29905
 * directly through the "select_src_port" member in ovsrec_mirror. */
29906
const struct ovsdb_datum *
29907
ovsrec_mirror_get_select_src_port(const struct ovsrec_mirror *row,
29908
  enum ovsdb_atomic_type key_type OVS_UNUSED)
29909
0
{
29910
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
29911
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_src_port);
29912
0
}
29913
29914
/* Returns the "select_vlan" column's value from the "Mirror" table in 'row'
29915
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29916
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29917
 * for a given key than implementing the same operation on the "cooked"
29918
 * form in 'row'.
29919
 *
29920
 * 'key_type' must be OVSDB_TYPE_INTEGER.
29921
 * (This helps to avoid silent bugs if someone changes select_vlan's
29922
 * type without updating the caller.)
29923
 *
29924
 * The caller must not modify or free the returned value.
29925
 *
29926
 * Various kinds of changes can invalidate the returned value: modifying
29927
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29928
 * If the returned value is needed for a long time, it is best to make a copy
29929
 * of it with ovsdb_datum_clone().
29930
 *
29931
 * This function is rarely useful, since it is easier to access the value
29932
 * directly through the "select_vlan" member in ovsrec_mirror. */
29933
const struct ovsdb_datum *
29934
ovsrec_mirror_get_select_vlan(const struct ovsrec_mirror *row,
29935
  enum ovsdb_atomic_type key_type OVS_UNUSED)
29936
0
{
29937
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
29938
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_vlan);
29939
0
}
29940
29941
/* Returns the "snaplen" column's value from the "Mirror" table in 'row'
29942
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29943
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29944
 * for a given key than implementing the same operation on the "cooked"
29945
 * form in 'row'.
29946
 *
29947
 * 'key_type' must be OVSDB_TYPE_INTEGER.
29948
 * (This helps to avoid silent bugs if someone changes snaplen's
29949
 * type without updating the caller.)
29950
 *
29951
 * The caller must not modify or free the returned value.
29952
 *
29953
 * Various kinds of changes can invalidate the returned value: modifying
29954
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29955
 * If the returned value is needed for a long time, it is best to make a copy
29956
 * of it with ovsdb_datum_clone().
29957
 *
29958
 * This function is rarely useful, since it is easier to access the value
29959
 * directly through the "snaplen" member in ovsrec_mirror. */
29960
const struct ovsdb_datum *
29961
ovsrec_mirror_get_snaplen(const struct ovsrec_mirror *row,
29962
  enum ovsdb_atomic_type key_type OVS_UNUSED)
29963
0
{
29964
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
29965
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_snaplen);
29966
0
}
29967
29968
/* Returns the "statistics" column's value from the "Mirror" table in 'row'
29969
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
29970
 * ovsdb_datum_find_key() is an easier and more efficient way to search
29971
 * for a given key than implementing the same operation on the "cooked"
29972
 * form in 'row'.
29973
 *
29974
 * 'key_type' must be OVSDB_TYPE_STRING.
29975
 * 'value_type' must be OVSDB_TYPE_INTEGER.
29976
 * (This helps to avoid silent bugs if someone changes statistics's
29977
 * type without updating the caller.)
29978
 *
29979
 * The caller must not modify or free the returned value.
29980
 *
29981
 * Various kinds of changes can invalidate the returned value: modifying
29982
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
29983
 * If the returned value is needed for a long time, it is best to make a copy
29984
 * of it with ovsdb_datum_clone().
29985
 *
29986
 * This function is rarely useful, since it is easier to access the value
29987
 * directly through the "statistics" member in ovsrec_mirror. */
29988
const struct ovsdb_datum *
29989
ovsrec_mirror_get_statistics(const struct ovsrec_mirror *row,
29990
  enum ovsdb_atomic_type key_type OVS_UNUSED,
29991
  enum ovsdb_atomic_type value_type OVS_UNUSED)
29992
0
{
29993
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
29994
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
29995
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_statistics);
29996
0
}
29997
29998
/* Sets the "external_ids" column's value from the "Mirror" table in 'row'
29999
 * to 'external_ids'.
30000
 *
30001
 * The caller retains ownership of 'external_ids' and everything in it. */
30002
void
30003
ovsrec_mirror_set_external_ids(const struct ovsrec_mirror *row, const struct smap *external_ids)
30004
0
{
30005
0
    struct ovsdb_datum datum;
30006
30007
0
    if (external_ids) {
30008
0
        ovsdb_datum_from_smap(&datum, external_ids);
30009
0
    } else {
30010
0
        ovsdb_datum_init_empty(&datum);
30011
0
    }
30012
0
    ovsdb_idl_txn_write(&row->header_,
30013
0
                        &ovsrec_mirror_col_external_ids,
30014
0
                        &datum);
30015
0
}
30016
30017
30018
/* Sets the "filter" column from the "Mirror" table in 'row' to
30019
 * the 'filter' set.
30020
 *
30021
 * If "filter" is null, the column will be the empty set,
30022
 * otherwise it will contain the specified value.
30023
 *
30024
 * The caller retains ownership of the arguments. */
30025
void
30026
ovsrec_mirror_set_filter(const struct ovsrec_mirror *row, const char *filter)
30027
0
{
30028
0
    struct ovsdb_datum datum;
30029
30030
0
    datum.refcnt = NULL;
30031
30032
0
    if (filter) {
30033
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30034
0
        datum.n = 1;
30035
0
        datum.keys = key;
30036
0
        key->s = ovsdb_atom_string_create(filter);
30037
0
    } else {
30038
0
        datum.n = 0;
30039
0
        datum.keys = NULL;
30040
0
    }
30041
0
    datum.values = NULL;
30042
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_filter, &datum);
30043
0
}
30044
30045
/* Sets the "name" column from the "Mirror" table in 'row' to
30046
 * 'name'.
30047
 *
30048
 * The caller retains ownership of the arguments. */
30049
void
30050
ovsrec_mirror_set_name(const struct ovsrec_mirror *row, const char *name)
30051
0
{
30052
0
    struct ovsdb_datum datum;
30053
30054
0
    datum.refcnt = NULL;
30055
30056
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
30057
30058
0
    datum.n = 1;
30059
0
    datum.keys = key;
30060
0
    key->s = ovsdb_atom_string_create(name);
30061
0
    datum.values = NULL;
30062
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_name, &datum);
30063
0
}
30064
30065
/* Sets the "output_port" column from the "Mirror" table in 'row' to
30066
 * the 'output_port' set.
30067
 *
30068
 * If "output_port" is null, the column will be the empty set,
30069
 * otherwise it will contain the specified value.
30070
 *
30071
 * The caller retains ownership of the arguments. */
30072
void
30073
ovsrec_mirror_set_output_port(const struct ovsrec_mirror *row, const struct ovsrec_port *output_port)
30074
0
{
30075
0
    struct ovsdb_datum datum;
30076
30077
0
    datum.refcnt = NULL;
30078
30079
0
    if (output_port) {
30080
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30081
0
        datum.n = 1;
30082
0
        datum.keys = key;
30083
0
        key->uuid = output_port->header_.uuid;
30084
0
    } else {
30085
0
        datum.n = 0;
30086
0
        datum.keys = NULL;
30087
0
    }
30088
0
    datum.values = NULL;
30089
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_output_port, &datum);
30090
0
}
30091
30092
/* Sets the "output_vlan" column from the "Mirror" table in 'row' to
30093
 * the 'output_vlan' set with 'n_output_vlan' entries.
30094
 *
30095
 * 'n_output_vlan' may be 0 or 1; if it is 0, then 'output_vlan'
30096
 * may be NULL.
30097
 *
30098
 * Argument constraints: in range 1 to 4,095
30099
 *
30100
 * The caller retains ownership of the arguments. */
30101
void
30102
ovsrec_mirror_set_output_vlan(const struct ovsrec_mirror *row, const int64_t *output_vlan, size_t n_output_vlan)
30103
0
{
30104
0
    struct ovsdb_datum datum;
30105
30106
0
    datum.refcnt = NULL;
30107
30108
0
    if (n_output_vlan) {
30109
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30110
0
        datum.n = 1;
30111
0
        datum.keys = key;
30112
0
        key->integer = *output_vlan;
30113
0
    } else {
30114
0
        datum.n = 0;
30115
0
        datum.keys = NULL;
30116
0
    }
30117
0
    datum.values = NULL;
30118
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_output_vlan, &datum);
30119
0
}
30120
30121
/* Sets the "select_all" column from the "Mirror" table in 'row' to
30122
 * 'select_all'.
30123
 *
30124
 * The caller retains ownership of the arguments. */
30125
void
30126
ovsrec_mirror_set_select_all(const struct ovsrec_mirror *row, bool select_all)
30127
0
{
30128
0
    struct ovsdb_datum datum;
30129
30130
0
    datum.refcnt = NULL;
30131
30132
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
30133
30134
0
    datum.n = 1;
30135
0
    datum.keys = key;
30136
0
    key->boolean = select_all;
30137
0
    datum.values = NULL;
30138
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_select_all, &datum);
30139
0
}
30140
30141
/* Sets the "select_dst_port" column from the "Mirror" table in 'row' to
30142
 * the 'select_dst_port' set with 'n_select_dst_port' entries.
30143
 *
30144
 * The caller retains ownership of the arguments. */
30145
void
30146
ovsrec_mirror_set_select_dst_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_dst_port, size_t n_select_dst_port)
30147
0
{
30148
0
    struct ovsdb_datum datum;
30149
30150
0
    datum.refcnt = NULL;
30151
30152
0
    datum.n = n_select_dst_port;
30153
0
    datum.keys = n_select_dst_port ? xmalloc(n_select_dst_port * sizeof *datum.keys) : NULL;
30154
0
    datum.values = NULL;
30155
0
    for (size_t i = 0; i < n_select_dst_port; i++) {
30156
0
        datum.keys[i].uuid = select_dst_port[i]->header_.uuid;
30157
0
    }
30158
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_select_dst_port, &datum);
30159
0
}
30160
30161
/* Sets the "select_src_port" column from the "Mirror" table in 'row' to
30162
 * the 'select_src_port' set with 'n_select_src_port' entries.
30163
 *
30164
 * The caller retains ownership of the arguments. */
30165
void
30166
ovsrec_mirror_set_select_src_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_src_port, size_t n_select_src_port)
30167
0
{
30168
0
    struct ovsdb_datum datum;
30169
30170
0
    datum.refcnt = NULL;
30171
30172
0
    datum.n = n_select_src_port;
30173
0
    datum.keys = n_select_src_port ? xmalloc(n_select_src_port * sizeof *datum.keys) : NULL;
30174
0
    datum.values = NULL;
30175
0
    for (size_t i = 0; i < n_select_src_port; i++) {
30176
0
        datum.keys[i].uuid = select_src_port[i]->header_.uuid;
30177
0
    }
30178
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_select_src_port, &datum);
30179
0
}
30180
30181
/* Sets the "select_vlan" column from the "Mirror" table in 'row' to
30182
 * the 'select_vlan' set with 'n_select_vlan' entries.
30183
 *
30184
 * Argument constraints: in range 0 to 4,095
30185
 *
30186
 * The caller retains ownership of the arguments. */
30187
void
30188
ovsrec_mirror_set_select_vlan(const struct ovsrec_mirror *row, const int64_t *select_vlan, size_t n_select_vlan)
30189
0
{
30190
0
    struct ovsdb_datum datum;
30191
30192
0
    datum.refcnt = NULL;
30193
30194
0
    datum.n = n_select_vlan;
30195
0
    datum.keys = n_select_vlan ? xmalloc(n_select_vlan * sizeof *datum.keys) : NULL;
30196
0
    datum.values = NULL;
30197
0
    for (size_t i = 0; i < n_select_vlan; i++) {
30198
0
        datum.keys[i].integer = select_vlan[i];
30199
0
    }
30200
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_select_vlan, &datum);
30201
0
}
30202
30203
/* Sets the "snaplen" column from the "Mirror" table in 'row' to
30204
 * the 'snaplen' set with 'n_snaplen' entries.
30205
 *
30206
 * 'n_snaplen' may be 0 or 1; if it is 0, then 'snaplen'
30207
 * may be NULL.
30208
 *
30209
 * Argument constraints: in range 14 to 65,535
30210
 *
30211
 * The caller retains ownership of the arguments. */
30212
void
30213
ovsrec_mirror_set_snaplen(const struct ovsrec_mirror *row, const int64_t *snaplen, size_t n_snaplen)
30214
0
{
30215
0
    struct ovsdb_datum datum;
30216
30217
0
    datum.refcnt = NULL;
30218
30219
0
    if (n_snaplen) {
30220
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30221
0
        datum.n = 1;
30222
0
        datum.keys = key;
30223
0
        key->integer = *snaplen;
30224
0
    } else {
30225
0
        datum.n = 0;
30226
0
        datum.keys = NULL;
30227
0
    }
30228
0
    datum.values = NULL;
30229
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_snaplen, &datum);
30230
0
}
30231
30232
/* Sets the "statistics" column from the "Mirror" table in 'row' to
30233
 * the map with keys 'key_statistics' and values 'value_statistics'
30234
 * with 'n_statistics' entries.
30235
 *
30236
 * The caller retains ownership of the arguments. */
30237
void
30238
ovsrec_mirror_set_statistics(const struct ovsrec_mirror *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
30239
0
{
30240
0
    struct ovsdb_datum datum;
30241
30242
0
    datum.refcnt = NULL;
30243
30244
0
    datum.n = n_statistics;
30245
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
30246
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
30247
0
    for (size_t i = 0; i < n_statistics; i++) {
30248
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
30249
0
        datum.values[i].integer = value_statistics[i];
30250
0
    }
30251
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_statistics, &datum);
30252
0
}
30253
30254
/* Sets an element of the "external_ids" map column from the "Mirror" table in 'row'
30255
 * to 'new_value' given the key value 'new_key'.
30256
 *
30257
 */
30258
void
30259
ovsrec_mirror_update_external_ids_setkey(const struct ovsrec_mirror *row, const char *new_key, const char *new_value)
30260
0
{
30261
0
    struct ovsdb_datum *datum;
30262
30263
0
    datum = xmalloc(sizeof *datum);
30264
0
    datum->n = 1;
30265
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
30266
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
30267
0
    datum->refcnt = NULL;
30268
30269
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
30270
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
30271
30272
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
30273
0
                                    &ovsrec_mirror_col_external_ids,
30274
0
                                    datum);
30275
0
}
30276
30277
/* Deletes an element of the "external_ids" map column from the "Mirror" table in 'row'
30278
 * given the key value 'delete_key'.
30279
 *
30280
 */
30281
void
30282
ovsrec_mirror_update_external_ids_delkey(const struct ovsrec_mirror *row, const char *delete_key)
30283
0
{
30284
0
    struct ovsdb_datum *datum;
30285
30286
0
    datum = xmalloc(sizeof *datum);
30287
0
    datum->n = 1;
30288
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
30289
0
    datum->values = NULL;
30290
0
    datum->refcnt = NULL;
30291
30292
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
30293
30294
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
30295
0
                                    &ovsrec_mirror_col_external_ids,
30296
0
                                    datum);
30297
0
}
30298
30299
/* Adds the value 'new_value' to the "filter" set column from the "Mirror" table
30300
 * in 'row'.
30301
 *
30302
 */
30303
void
30304
ovsrec_mirror_update_filter_addvalue(const struct ovsrec_mirror *row, const char *new_value)
30305
0
{
30306
0
    struct ovsdb_datum *datum;
30307
30308
0
    datum = xmalloc(sizeof *datum);
30309
0
    datum->n = 1;
30310
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30311
0
    datum->values = NULL;
30312
0
    datum->refcnt = NULL;
30313
30314
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
30315
30316
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
30317
0
                                    &ovsrec_mirror_col_filter,
30318
0
                                    datum);
30319
0
}
30320
30321
/* Deletes the value 'delete_value' from the "filter" set column from the
30322
 * "Mirror" table in 'row'.
30323
 *
30324
 */
30325
void
30326
ovsrec_mirror_update_filter_delvalue(const struct ovsrec_mirror *row, const char *delete_value)
30327
0
{
30328
0
    struct ovsdb_datum *datum;
30329
30330
0
    datum = xmalloc(sizeof *datum);
30331
0
    datum->n = 1;
30332
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30333
0
    datum->values = NULL;
30334
0
    datum->refcnt = NULL;
30335
30336
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
30337
30338
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
30339
0
                                    &ovsrec_mirror_col_filter,
30340
0
                                    datum);
30341
0
}
30342
30343
/* Adds the value 'new_value' to the "output_port" set column from the "Mirror" table
30344
 * in 'row'.
30345
 *
30346
 */
30347
void
30348
ovsrec_mirror_update_output_port_addvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *new_value)
30349
0
{
30350
0
    struct ovsdb_datum *datum;
30351
30352
0
    datum = xmalloc(sizeof *datum);
30353
0
    datum->n = 1;
30354
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30355
0
    datum->values = NULL;
30356
0
    datum->refcnt = NULL;
30357
30358
0
    datum->keys[0].uuid = new_value->header_.uuid;
30359
30360
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
30361
0
                                    &ovsrec_mirror_col_output_port,
30362
0
                                    datum);
30363
0
}
30364
30365
/* Deletes the value 'delete_value' from the "output_port" set column from the
30366
 * "Mirror" table in 'row'.
30367
 *
30368
 */
30369
void
30370
ovsrec_mirror_update_output_port_delvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *delete_value)
30371
0
{
30372
0
    struct ovsdb_datum *datum;
30373
30374
0
    datum = xmalloc(sizeof *datum);
30375
0
    datum->n = 1;
30376
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30377
0
    datum->values = NULL;
30378
0
    datum->refcnt = NULL;
30379
30380
0
    datum->keys[0].uuid = delete_value->header_.uuid;
30381
30382
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
30383
0
                                    &ovsrec_mirror_col_output_port,
30384
0
                                    datum);
30385
0
}
30386
30387
/* Adds the value 'new_value' to the "output_vlan" set column from the "Mirror" table
30388
 * in 'row'.
30389
 *
30390
 */
30391
void
30392
ovsrec_mirror_update_output_vlan_addvalue(const struct ovsrec_mirror *row, int64_t new_value)
30393
0
{
30394
0
    struct ovsdb_datum *datum;
30395
30396
0
    datum = xmalloc(sizeof *datum);
30397
0
    datum->n = 1;
30398
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30399
0
    datum->values = NULL;
30400
0
    datum->refcnt = NULL;
30401
30402
0
    datum->keys[0].integer = new_value;
30403
30404
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
30405
0
                                    &ovsrec_mirror_col_output_vlan,
30406
0
                                    datum);
30407
0
}
30408
30409
/* Deletes the value 'delete_value' from the "output_vlan" set column from the
30410
 * "Mirror" table in 'row'.
30411
 *
30412
 */
30413
void
30414
ovsrec_mirror_update_output_vlan_delvalue(const struct ovsrec_mirror *row, int64_t delete_value)
30415
0
{
30416
0
    struct ovsdb_datum *datum;
30417
30418
0
    datum = xmalloc(sizeof *datum);
30419
0
    datum->n = 1;
30420
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30421
0
    datum->values = NULL;
30422
0
    datum->refcnt = NULL;
30423
30424
0
    datum->keys[0].integer = delete_value;
30425
30426
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
30427
0
                                    &ovsrec_mirror_col_output_vlan,
30428
0
                                    datum);
30429
0
}
30430
30431
/* Adds the value 'new_value' to the "select_dst_port" set column from the "Mirror" table
30432
 * in 'row'.
30433
 *
30434
 */
30435
void
30436
ovsrec_mirror_update_select_dst_port_addvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *new_value)
30437
0
{
30438
0
    struct ovsdb_datum *datum;
30439
30440
0
    datum = xmalloc(sizeof *datum);
30441
0
    datum->n = 1;
30442
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30443
0
    datum->values = NULL;
30444
0
    datum->refcnt = NULL;
30445
30446
0
    datum->keys[0].uuid = new_value->header_.uuid;
30447
30448
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
30449
0
                                    &ovsrec_mirror_col_select_dst_port,
30450
0
                                    datum);
30451
0
}
30452
30453
/* Deletes the value 'delete_value' from the "select_dst_port" set column from the
30454
 * "Mirror" table in 'row'.
30455
 *
30456
 */
30457
void
30458
ovsrec_mirror_update_select_dst_port_delvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *delete_value)
30459
0
{
30460
0
    struct ovsdb_datum *datum;
30461
30462
0
    datum = xmalloc(sizeof *datum);
30463
0
    datum->n = 1;
30464
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30465
0
    datum->values = NULL;
30466
0
    datum->refcnt = NULL;
30467
30468
0
    datum->keys[0].uuid = delete_value->header_.uuid;
30469
30470
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
30471
0
                                    &ovsrec_mirror_col_select_dst_port,
30472
0
                                    datum);
30473
0
}
30474
30475
/* Adds the value 'new_value' to the "select_src_port" set column from the "Mirror" table
30476
 * in 'row'.
30477
 *
30478
 */
30479
void
30480
ovsrec_mirror_update_select_src_port_addvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *new_value)
30481
0
{
30482
0
    struct ovsdb_datum *datum;
30483
30484
0
    datum = xmalloc(sizeof *datum);
30485
0
    datum->n = 1;
30486
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30487
0
    datum->values = NULL;
30488
0
    datum->refcnt = NULL;
30489
30490
0
    datum->keys[0].uuid = new_value->header_.uuid;
30491
30492
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
30493
0
                                    &ovsrec_mirror_col_select_src_port,
30494
0
                                    datum);
30495
0
}
30496
30497
/* Deletes the value 'delete_value' from the "select_src_port" set column from the
30498
 * "Mirror" table in 'row'.
30499
 *
30500
 */
30501
void
30502
ovsrec_mirror_update_select_src_port_delvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *delete_value)
30503
0
{
30504
0
    struct ovsdb_datum *datum;
30505
30506
0
    datum = xmalloc(sizeof *datum);
30507
0
    datum->n = 1;
30508
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30509
0
    datum->values = NULL;
30510
0
    datum->refcnt = NULL;
30511
30512
0
    datum->keys[0].uuid = delete_value->header_.uuid;
30513
30514
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
30515
0
                                    &ovsrec_mirror_col_select_src_port,
30516
0
                                    datum);
30517
0
}
30518
30519
/* Adds the value 'new_value' to the "select_vlan" set column from the "Mirror" table
30520
 * in 'row'.
30521
 *
30522
 */
30523
void
30524
ovsrec_mirror_update_select_vlan_addvalue(const struct ovsrec_mirror *row, int64_t new_value)
30525
0
{
30526
0
    struct ovsdb_datum *datum;
30527
30528
0
    datum = xmalloc(sizeof *datum);
30529
0
    datum->n = 1;
30530
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30531
0
    datum->values = NULL;
30532
0
    datum->refcnt = NULL;
30533
30534
0
    datum->keys[0].integer = new_value;
30535
30536
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
30537
0
                                    &ovsrec_mirror_col_select_vlan,
30538
0
                                    datum);
30539
0
}
30540
30541
/* Deletes the value 'delete_value' from the "select_vlan" set column from the
30542
 * "Mirror" table in 'row'.
30543
 *
30544
 */
30545
void
30546
ovsrec_mirror_update_select_vlan_delvalue(const struct ovsrec_mirror *row, int64_t delete_value)
30547
0
{
30548
0
    struct ovsdb_datum *datum;
30549
30550
0
    datum = xmalloc(sizeof *datum);
30551
0
    datum->n = 1;
30552
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30553
0
    datum->values = NULL;
30554
0
    datum->refcnt = NULL;
30555
30556
0
    datum->keys[0].integer = delete_value;
30557
30558
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
30559
0
                                    &ovsrec_mirror_col_select_vlan,
30560
0
                                    datum);
30561
0
}
30562
30563
/* Adds the value 'new_value' to the "snaplen" set column from the "Mirror" table
30564
 * in 'row'.
30565
 *
30566
 */
30567
void
30568
ovsrec_mirror_update_snaplen_addvalue(const struct ovsrec_mirror *row, int64_t new_value)
30569
0
{
30570
0
    struct ovsdb_datum *datum;
30571
30572
0
    datum = xmalloc(sizeof *datum);
30573
0
    datum->n = 1;
30574
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30575
0
    datum->values = NULL;
30576
0
    datum->refcnt = NULL;
30577
30578
0
    datum->keys[0].integer = new_value;
30579
30580
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
30581
0
                                    &ovsrec_mirror_col_snaplen,
30582
0
                                    datum);
30583
0
}
30584
30585
/* Deletes the value 'delete_value' from the "snaplen" set column from the
30586
 * "Mirror" table in 'row'.
30587
 *
30588
 */
30589
void
30590
ovsrec_mirror_update_snaplen_delvalue(const struct ovsrec_mirror *row, int64_t delete_value)
30591
0
{
30592
0
    struct ovsdb_datum *datum;
30593
30594
0
    datum = xmalloc(sizeof *datum);
30595
0
    datum->n = 1;
30596
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30597
0
    datum->values = NULL;
30598
0
    datum->refcnt = NULL;
30599
30600
0
    datum->keys[0].integer = delete_value;
30601
30602
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
30603
0
                                    &ovsrec_mirror_col_snaplen,
30604
0
                                    datum);
30605
0
}
30606
30607
/* Sets an element of the "statistics" map column from the "Mirror" table in 'row'
30608
 * to 'new_value' given the key value 'new_key'.
30609
 *
30610
 */
30611
void
30612
ovsrec_mirror_update_statistics_setkey(const struct ovsrec_mirror *row, const char *new_key, int64_t new_value)
30613
0
{
30614
0
    struct ovsdb_datum *datum;
30615
30616
0
    datum = xmalloc(sizeof *datum);
30617
0
    datum->n = 1;
30618
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
30619
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
30620
0
    datum->refcnt = NULL;
30621
30622
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
30623
0
    datum->values[0].integer = new_value;
30624
30625
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
30626
0
                                    &ovsrec_mirror_col_statistics,
30627
0
                                    datum);
30628
0
}
30629
30630
/* Deletes an element of the "statistics" map column from the "Mirror" table in 'row'
30631
 * given the key value 'delete_key'.
30632
 *
30633
 */
30634
void
30635
ovsrec_mirror_update_statistics_delkey(const struct ovsrec_mirror *row, const char *delete_key)
30636
0
{
30637
0
    struct ovsdb_datum *datum;
30638
30639
0
    datum = xmalloc(sizeof *datum);
30640
0
    datum->n = 1;
30641
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
30642
0
    datum->values = NULL;
30643
0
    datum->refcnt = NULL;
30644
30645
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
30646
30647
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
30648
0
                                    &ovsrec_mirror_col_statistics,
30649
0
                                    datum);
30650
0
}
30651
30652
/* Sets the "external_ids" column's value from the "Mirror" table in 'row'
30653
 * to 'external_ids'.
30654
 *
30655
 * The caller retains ownership of 'external_ids' and everything in it. */
30656
void
30657
ovsrec_mirror_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
30658
0
{
30659
0
    struct ovsdb_datum datum;
30660
30661
0
    if (external_ids) {
30662
0
        ovsdb_datum_from_smap(&datum, external_ids);
30663
0
    } else {
30664
0
        ovsdb_datum_init_empty(&datum);
30665
0
    }
30666
30667
0
    ovsdb_idl_condition_add_clause(cond,
30668
0
                                   function,
30669
0
                                   &ovsrec_mirror_col_external_ids,
30670
0
                                   &datum);
30671
30672
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_external_ids.type);
30673
0
}
30674
30675
30676
/* Sets the "filter" column from the "Mirror" table in 'row' to
30677
 * the 'filter' set.
30678
 *
30679
 * If "filter" is null, the column will be the empty set,
30680
 * otherwise it will contain the specified value.
30681
 *
30682
 * The caller retains ownership of the arguments. */
30683
void
30684
ovsrec_mirror_add_clause_filter(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *filter)
30685
0
{
30686
0
    struct ovsdb_datum datum;
30687
30688
0
    datum.refcnt = NULL;
30689
30690
0
    if (filter) {
30691
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30692
0
        datum.n = 1;
30693
0
        datum.keys = key;
30694
0
        key->s = ovsdb_atom_string_create(filter);
30695
0
    } else {
30696
0
        datum.n = 0;
30697
0
        datum.keys = NULL;
30698
0
    }
30699
0
    datum.values = NULL;
30700
0
    ovsdb_idl_condition_add_clause(cond,
30701
0
                          function,
30702
0
                          &ovsrec_mirror_col_filter,
30703
0
                          &datum);
30704
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_filter.type);
30705
0
}
30706
30707
/* Sets the "name" column from the "Mirror" table in 'row' to
30708
 * 'name'.
30709
 *
30710
 * The caller retains ownership of the arguments. */
30711
void
30712
ovsrec_mirror_add_clause_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *name)
30713
0
{
30714
0
    struct ovsdb_datum datum;
30715
30716
0
    datum.refcnt = NULL;
30717
30718
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
30719
30720
0
    datum.n = 1;
30721
0
    datum.keys = key;
30722
0
    key->s = ovsdb_atom_string_create(name);
30723
0
    datum.values = NULL;
30724
0
    ovsdb_idl_condition_add_clause(cond,
30725
0
                          function,
30726
0
                          &ovsrec_mirror_col_name,
30727
0
                          &datum);
30728
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_name.type);
30729
0
}
30730
30731
/* Sets the "output_port" column from the "Mirror" table in 'row' to
30732
 * the 'output_port' set.
30733
 *
30734
 * If "output_port" is null, the column will be the empty set,
30735
 * otherwise it will contain the specified value.
30736
 *
30737
 * The caller retains ownership of the arguments. */
30738
void
30739
ovsrec_mirror_add_clause_output_port(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *output_port)
30740
0
{
30741
0
    struct ovsdb_datum datum;
30742
30743
0
    datum.refcnt = NULL;
30744
30745
0
    if (output_port) {
30746
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30747
0
        datum.n = 1;
30748
0
        datum.keys = key;
30749
0
        key->uuid = *output_port;
30750
0
    } else {
30751
0
        datum.n = 0;
30752
0
        datum.keys = NULL;
30753
0
    }
30754
0
    datum.values = NULL;
30755
0
    ovsdb_idl_condition_add_clause(cond,
30756
0
                          function,
30757
0
                          &ovsrec_mirror_col_output_port,
30758
0
                          &datum);
30759
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_output_port.type);
30760
0
}
30761
30762
/* Sets the "output_vlan" column from the "Mirror" table in 'row' to
30763
 * the 'output_vlan' set with 'n_output_vlan' entries.
30764
 *
30765
 * 'n_output_vlan' may be 0 or 1; if it is 0, then 'output_vlan'
30766
 * may be NULL.
30767
 *
30768
 * Argument constraints: in range 1 to 4,095
30769
 *
30770
 * The caller retains ownership of the arguments. */
30771
void
30772
ovsrec_mirror_add_clause_output_vlan(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *output_vlan, size_t n_output_vlan)
30773
0
{
30774
0
    struct ovsdb_datum datum;
30775
30776
0
    datum.refcnt = NULL;
30777
30778
0
    if (n_output_vlan) {
30779
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30780
0
        datum.n = 1;
30781
0
        datum.keys = key;
30782
0
        key->integer = *output_vlan;
30783
0
    } else {
30784
0
        datum.n = 0;
30785
0
        datum.keys = NULL;
30786
0
    }
30787
0
    datum.values = NULL;
30788
0
    ovsdb_idl_condition_add_clause(cond,
30789
0
                          function,
30790
0
                          &ovsrec_mirror_col_output_vlan,
30791
0
                          &datum);
30792
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_output_vlan.type);
30793
0
}
30794
30795
/* Sets the "select_all" column from the "Mirror" table in 'row' to
30796
 * 'select_all'.
30797
 *
30798
 * The caller retains ownership of the arguments. */
30799
void
30800
ovsrec_mirror_add_clause_select_all(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool select_all)
30801
0
{
30802
0
    struct ovsdb_datum datum;
30803
30804
0
    datum.refcnt = NULL;
30805
30806
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
30807
30808
0
    datum.n = 1;
30809
0
    datum.keys = key;
30810
0
    key->boolean = select_all;
30811
0
    datum.values = NULL;
30812
0
    ovsdb_idl_condition_add_clause(cond,
30813
0
                          function,
30814
0
                          &ovsrec_mirror_col_select_all,
30815
0
                          &datum);
30816
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_select_all.type);
30817
0
}
30818
30819
/* Sets the "select_dst_port" column from the "Mirror" table in 'row' to
30820
 * the 'select_dst_port' set with 'n_select_dst_port' entries.
30821
 *
30822
 * The caller retains ownership of the arguments. */
30823
void
30824
ovsrec_mirror_add_clause_select_dst_port(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **select_dst_port, size_t n_select_dst_port)
30825
0
{
30826
0
    struct ovsdb_datum datum;
30827
30828
0
    datum.refcnt = NULL;
30829
0
    datum.n = n_select_dst_port;
30830
0
    datum.keys = n_select_dst_port ? xmalloc(n_select_dst_port * sizeof *datum.keys) : NULL;
30831
0
    datum.values = NULL;
30832
0
    for (size_t i = 0; i < n_select_dst_port; i++) {
30833
0
        datum.keys[i].uuid = *select_dst_port[i];
30834
0
    }
30835
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_dst_port.type);
30836
0
    ovsdb_idl_condition_add_clause(cond,
30837
0
                          function,
30838
0
                          &ovsrec_mirror_col_select_dst_port,
30839
0
                          &datum);
30840
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_select_dst_port.type);
30841
0
}
30842
30843
/* Sets the "select_src_port" column from the "Mirror" table in 'row' to
30844
 * the 'select_src_port' set with 'n_select_src_port' entries.
30845
 *
30846
 * The caller retains ownership of the arguments. */
30847
void
30848
ovsrec_mirror_add_clause_select_src_port(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **select_src_port, size_t n_select_src_port)
30849
0
{
30850
0
    struct ovsdb_datum datum;
30851
30852
0
    datum.refcnt = NULL;
30853
0
    datum.n = n_select_src_port;
30854
0
    datum.keys = n_select_src_port ? xmalloc(n_select_src_port * sizeof *datum.keys) : NULL;
30855
0
    datum.values = NULL;
30856
0
    for (size_t i = 0; i < n_select_src_port; i++) {
30857
0
        datum.keys[i].uuid = *select_src_port[i];
30858
0
    }
30859
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_src_port.type);
30860
0
    ovsdb_idl_condition_add_clause(cond,
30861
0
                          function,
30862
0
                          &ovsrec_mirror_col_select_src_port,
30863
0
                          &datum);
30864
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_select_src_port.type);
30865
0
}
30866
30867
/* Sets the "select_vlan" column from the "Mirror" table in 'row' to
30868
 * the 'select_vlan' set with 'n_select_vlan' entries.
30869
 *
30870
 * Argument constraints: in range 0 to 4,095
30871
 *
30872
 * The caller retains ownership of the arguments. */
30873
void
30874
ovsrec_mirror_add_clause_select_vlan(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *select_vlan, size_t n_select_vlan)
30875
0
{
30876
0
    struct ovsdb_datum datum;
30877
30878
0
    datum.refcnt = NULL;
30879
0
    datum.n = n_select_vlan;
30880
0
    datum.keys = n_select_vlan ? xmalloc(n_select_vlan * sizeof *datum.keys) : NULL;
30881
0
    datum.values = NULL;
30882
0
    for (size_t i = 0; i < n_select_vlan; i++) {
30883
0
        datum.keys[i].integer = select_vlan[i];
30884
0
    }
30885
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_vlan.type);
30886
0
    ovsdb_idl_condition_add_clause(cond,
30887
0
                          function,
30888
0
                          &ovsrec_mirror_col_select_vlan,
30889
0
                          &datum);
30890
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_select_vlan.type);
30891
0
}
30892
30893
/* Sets the "snaplen" column from the "Mirror" table in 'row' to
30894
 * the 'snaplen' set with 'n_snaplen' entries.
30895
 *
30896
 * 'n_snaplen' may be 0 or 1; if it is 0, then 'snaplen'
30897
 * may be NULL.
30898
 *
30899
 * Argument constraints: in range 14 to 65,535
30900
 *
30901
 * The caller retains ownership of the arguments. */
30902
void
30903
ovsrec_mirror_add_clause_snaplen(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *snaplen, size_t n_snaplen)
30904
0
{
30905
0
    struct ovsdb_datum datum;
30906
30907
0
    datum.refcnt = NULL;
30908
30909
0
    if (n_snaplen) {
30910
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30911
0
        datum.n = 1;
30912
0
        datum.keys = key;
30913
0
        key->integer = *snaplen;
30914
0
    } else {
30915
0
        datum.n = 0;
30916
0
        datum.keys = NULL;
30917
0
    }
30918
0
    datum.values = NULL;
30919
0
    ovsdb_idl_condition_add_clause(cond,
30920
0
                          function,
30921
0
                          &ovsrec_mirror_col_snaplen,
30922
0
                          &datum);
30923
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_snaplen.type);
30924
0
}
30925
30926
/* Sets the "statistics" column from the "Mirror" table in 'row' to
30927
 * the map with keys 'key_statistics' and values 'value_statistics'
30928
 * with 'n_statistics' entries.
30929
 *
30930
 * The caller retains ownership of the arguments. */
30931
void
30932
ovsrec_mirror_add_clause_statistics(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
30933
0
{
30934
0
    struct ovsdb_datum datum;
30935
30936
0
    datum.refcnt = NULL;
30937
0
    datum.n = n_statistics;
30938
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
30939
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
30940
0
    for (size_t i = 0; i < n_statistics; i++) {
30941
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
30942
0
        datum.values[i].integer = value_statistics[i];
30943
0
    }
30944
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_statistics.type);
30945
0
    ovsdb_idl_condition_add_clause(cond,
30946
0
                          function,
30947
0
                          &ovsrec_mirror_col_statistics,
30948
0
                          &datum);
30949
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_statistics.type);
30950
0
}
30951
30952
/* Destroy 'row' of kind "Mirror". The row must have been
30953
 * created with ovsdb_idl_index_init_row.
30954
 */
30955
void
30956
ovsrec_mirror_index_destroy_row(const struct ovsrec_mirror *row)
30957
0
{
30958
0
    ovsdb_idl_index_destroy_row(&row->header_);
30959
0
}
30960
        
30961
30962
/* Creates a new row of kind "Mirror". */
30963
struct ovsrec_mirror *
30964
ovsrec_mirror_index_init_row(struct ovsdb_idl_index *index)
30965
0
{
30966
0
    ovs_assert(index->table->class_ == &ovsrec_table_mirror);
30967
0
    return ALIGNED_CAST(struct ovsrec_mirror *, ovsdb_idl_index_init_row(index));
30968
0
}
30969
30970
struct ovsrec_mirror *
30971
ovsrec_mirror_index_find(struct ovsdb_idl_index *index, const struct ovsrec_mirror *target)
30972
0
{
30973
0
    ovs_assert(index->table->class_ == &ovsrec_table_mirror);
30974
0
    return ovsrec_mirror_cast(ovsdb_idl_index_find(index, &target->header_));
30975
0
}
30976
30977
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
30978
int
30979
ovsrec_mirror_index_compare(
30980
    struct ovsdb_idl_index *index, 
30981
    const struct ovsrec_mirror *a, 
30982
    const struct ovsrec_mirror *b)
30983
0
{
30984
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
30985
0
}
30986
30987
struct ovsdb_idl_cursor
30988
ovsrec_mirror_cursor_first(struct ovsdb_idl_index *index)
30989
0
{
30990
0
    ovs_assert(index->table->class_ == &ovsrec_table_mirror);
30991
0
    return ovsdb_idl_cursor_first(index);
30992
0
}
30993
30994
struct ovsdb_idl_cursor
30995
ovsrec_mirror_cursor_first_eq(
30996
    struct ovsdb_idl_index *index, const struct ovsrec_mirror *target)
30997
0
{
30998
0
    ovs_assert(index->table->class_ == &ovsrec_table_mirror);
30999
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
31000
0
}
31001
31002
struct ovsdb_idl_cursor
31003
ovsrec_mirror_cursor_first_ge(
31004
    struct ovsdb_idl_index *index, const struct ovsrec_mirror *target)
31005
0
{
31006
0
    ovs_assert(index->table->class_ == &ovsrec_table_mirror);
31007
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
31008
0
}
31009
31010
struct ovsrec_mirror *
31011
ovsrec_mirror_cursor_data(struct ovsdb_idl_cursor *cursor)
31012
0
{
31013
0
    return ovsrec_mirror_cast(ovsdb_idl_cursor_data(cursor));
31014
0
}
31015
31016
31017
/* Sets the "external_ids" column's value from the "Mirror" table in 'row'
31018
 * to 'external_ids'.
31019
 *
31020
 * The caller retains ownership of 'external_ids' and everything in it. */
31021
void
31022
ovsrec_mirror_index_set_external_ids(const struct ovsrec_mirror *row, const struct smap *external_ids)
31023
0
{
31024
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
31025
31026
0
    if (external_ids) {
31027
0
        struct smap_node *node;
31028
0
        size_t i;
31029
31030
0
        datum->n = smap_count(external_ids);
31031
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
31032
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
31033
0
        datum->refcnt = NULL;
31034
31035
0
        i = 0;
31036
0
        SMAP_FOR_EACH (node, external_ids) {
31037
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
31038
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
31039
0
            i++;
31040
0
        }
31041
0
        ovsdb_datum_sort_unique(datum, &ovsrec_mirror_col_external_ids.type);
31042
0
    } else {
31043
0
        ovsdb_datum_init_empty(datum);
31044
0
    }
31045
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
31046
0
                          &ovsrec_mirror_columns[OVSREC_MIRROR_COL_EXTERNAL_IDS],
31047
0
                          datum,
31048
0
                          &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31049
0
    free(datum);
31050
0
}
31051
31052
31053
/* Sets the "filter" column from the "Mirror" table in 'row' to
31054
 * the 'filter' set.
31055
 *
31056
 * If "filter" is null, the column will be the empty set,
31057
 * otherwise it will contain the specified value.
31058
 *
31059
 * The caller retains ownership of the arguments. */
31060
void
31061
ovsrec_mirror_index_set_filter(const struct ovsrec_mirror *row, const char *filter)
31062
0
{
31063
0
    struct ovsdb_datum datum;
31064
31065
0
    datum.refcnt = NULL;
31066
0
    union ovsdb_atom *key;
31067
31068
0
    if (filter) {
31069
0
        key = xmalloc(sizeof (union ovsdb_atom));
31070
0
        datum.n = 1;
31071
0
        datum.keys = key;
31072
0
        key->s = ovsdb_atom_string_create(filter);
31073
0
    } else {
31074
0
        datum.n = 0;
31075
0
        datum.keys = NULL;
31076
0
    }
31077
0
    datum.values = NULL;
31078
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_mirror_columns[ OVSREC_MIRROR_COL_FILTER ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31079
0
}
31080
31081
/* Sets the "name" column from the "Mirror" table in 'row' to
31082
 * 'name'.
31083
 *
31084
 * The caller retains ownership of the arguments. */
31085
void
31086
ovsrec_mirror_index_set_name(const struct ovsrec_mirror *row, const char *name)
31087
0
{
31088
0
    struct ovsdb_datum datum;
31089
31090
0
    datum.refcnt = NULL;
31091
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
31092
31093
0
    datum.n = 1;
31094
0
    datum.keys = key;
31095
0
    key->s = ovsdb_atom_string_create(name);
31096
0
    datum.values = NULL;
31097
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_mirror_columns[ OVSREC_MIRROR_COL_NAME ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31098
0
}
31099
31100
/* Sets the "output_port" column from the "Mirror" table in 'row' to
31101
 * the 'output_port' set.
31102
 *
31103
 * If "output_port" is null, the column will be the empty set,
31104
 * otherwise it will contain the specified value.
31105
 *
31106
 * The caller retains ownership of the arguments. */
31107
void
31108
ovsrec_mirror_index_set_output_port(const struct ovsrec_mirror *row, const struct ovsrec_port *output_port)
31109
0
{
31110
0
    struct ovsdb_datum datum;
31111
31112
0
    datum.refcnt = NULL;
31113
0
    union ovsdb_atom *key;
31114
31115
0
    if (output_port) {
31116
0
        key = xmalloc(sizeof (union ovsdb_atom));
31117
0
        datum.n = 1;
31118
0
        datum.keys = key;
31119
0
        key->uuid = output_port->header_.uuid;
31120
0
    } else {
31121
0
        datum.n = 0;
31122
0
        datum.keys = NULL;
31123
0
    }
31124
0
    datum.values = NULL;
31125
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_mirror_columns[ OVSREC_MIRROR_COL_OUTPUT_PORT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31126
0
}
31127
31128
/* Sets the "output_vlan" column from the "Mirror" table in 'row' to
31129
 * the 'output_vlan' set with 'n_output_vlan' entries.
31130
 *
31131
 * 'n_output_vlan' may be 0 or 1; if it is 0, then 'output_vlan'
31132
 * may be NULL.
31133
 *
31134
 * Argument constraints: in range 1 to 4,095
31135
 *
31136
 * The caller retains ownership of the arguments. */
31137
void
31138
ovsrec_mirror_index_set_output_vlan(const struct ovsrec_mirror *row, const int64_t *output_vlan, size_t n_output_vlan)
31139
0
{
31140
0
    struct ovsdb_datum datum;
31141
31142
0
    datum.refcnt = NULL;
31143
0
    union ovsdb_atom *key;
31144
31145
0
    if (n_output_vlan) {
31146
0
        key = xmalloc(sizeof(union ovsdb_atom));
31147
0
        datum.n = 1;
31148
0
        datum.keys = key;
31149
0
        key->integer = *output_vlan;
31150
0
    } else {
31151
0
        datum.n = 0;
31152
0
        datum.keys = NULL;
31153
0
    }
31154
0
    datum.values = NULL;
31155
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_mirror_columns[ OVSREC_MIRROR_COL_OUTPUT_VLAN ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31156
0
}
31157
31158
/* Sets the "select_all" column from the "Mirror" table in 'row' to
31159
 * 'select_all'.
31160
 *
31161
 * The caller retains ownership of the arguments. */
31162
void
31163
ovsrec_mirror_index_set_select_all(const struct ovsrec_mirror *row, bool select_all)
31164
0
{
31165
0
    struct ovsdb_datum datum;
31166
31167
0
    datum.refcnt = NULL;
31168
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
31169
31170
0
    datum.n = 1;
31171
0
    datum.keys = key;
31172
0
    key->boolean = select_all;
31173
0
    datum.values = NULL;
31174
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_mirror_columns[ OVSREC_MIRROR_COL_SELECT_ALL ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31175
0
}
31176
31177
/* Sets the "select_dst_port" column from the "Mirror" table in 'row' to
31178
 * the 'select_dst_port' set with 'n_select_dst_port' entries.
31179
 *
31180
 * The caller retains ownership of the arguments. */
31181
void
31182
ovsrec_mirror_index_set_select_dst_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_dst_port, size_t n_select_dst_port)
31183
0
{
31184
0
    struct ovsdb_datum datum;
31185
31186
0
    datum.refcnt = NULL;
31187
0
    size_t i;
31188
31189
0
    datum.n = n_select_dst_port;
31190
0
    datum.keys = n_select_dst_port ? xmalloc(n_select_dst_port * sizeof *datum.keys) : NULL;
31191
0
    datum.values = NULL;
31192
0
    for (i = 0; i < n_select_dst_port; i++) {
31193
0
        datum.keys[i].uuid = select_dst_port[i]->header_.uuid;
31194
0
    }
31195
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_dst_port.type);
31196
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_mirror_columns[ OVSREC_MIRROR_COL_SELECT_DST_PORT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31197
0
}
31198
31199
/* Sets the "select_src_port" column from the "Mirror" table in 'row' to
31200
 * the 'select_src_port' set with 'n_select_src_port' entries.
31201
 *
31202
 * The caller retains ownership of the arguments. */
31203
void
31204
ovsrec_mirror_index_set_select_src_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_src_port, size_t n_select_src_port)
31205
0
{
31206
0
    struct ovsdb_datum datum;
31207
31208
0
    datum.refcnt = NULL;
31209
0
    size_t i;
31210
31211
0
    datum.n = n_select_src_port;
31212
0
    datum.keys = n_select_src_port ? xmalloc(n_select_src_port * sizeof *datum.keys) : NULL;
31213
0
    datum.values = NULL;
31214
0
    for (i = 0; i < n_select_src_port; i++) {
31215
0
        datum.keys[i].uuid = select_src_port[i]->header_.uuid;
31216
0
    }
31217
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_src_port.type);
31218
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_mirror_columns[ OVSREC_MIRROR_COL_SELECT_SRC_PORT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31219
0
}
31220
31221
/* Sets the "select_vlan" column from the "Mirror" table in 'row' to
31222
 * the 'select_vlan' set with 'n_select_vlan' entries.
31223
 *
31224
 * Argument constraints: in range 0 to 4,095
31225
 *
31226
 * The caller retains ownership of the arguments. */
31227
void
31228
ovsrec_mirror_index_set_select_vlan(const struct ovsrec_mirror *row, const int64_t *select_vlan, size_t n_select_vlan)
31229
0
{
31230
0
    struct ovsdb_datum datum;
31231
31232
0
    datum.refcnt = NULL;
31233
0
    size_t i;
31234
31235
0
    datum.n = n_select_vlan;
31236
0
    datum.keys = n_select_vlan ? xmalloc(n_select_vlan * sizeof *datum.keys) : NULL;
31237
0
    datum.values = NULL;
31238
0
    for (i = 0; i < n_select_vlan; i++) {
31239
0
        datum.keys[i].integer = select_vlan[i];
31240
0
    }
31241
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_vlan.type);
31242
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_mirror_columns[ OVSREC_MIRROR_COL_SELECT_VLAN ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31243
0
}
31244
31245
/* Sets the "snaplen" column from the "Mirror" table in 'row' to
31246
 * the 'snaplen' set with 'n_snaplen' entries.
31247
 *
31248
 * 'n_snaplen' may be 0 or 1; if it is 0, then 'snaplen'
31249
 * may be NULL.
31250
 *
31251
 * Argument constraints: in range 14 to 65,535
31252
 *
31253
 * The caller retains ownership of the arguments. */
31254
void
31255
ovsrec_mirror_index_set_snaplen(const struct ovsrec_mirror *row, const int64_t *snaplen, size_t n_snaplen)
31256
0
{
31257
0
    struct ovsdb_datum datum;
31258
31259
0
    datum.refcnt = NULL;
31260
0
    union ovsdb_atom *key;
31261
31262
0
    if (n_snaplen) {
31263
0
        key = xmalloc(sizeof(union ovsdb_atom));
31264
0
        datum.n = 1;
31265
0
        datum.keys = key;
31266
0
        key->integer = *snaplen;
31267
0
    } else {
31268
0
        datum.n = 0;
31269
0
        datum.keys = NULL;
31270
0
    }
31271
0
    datum.values = NULL;
31272
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_mirror_columns[ OVSREC_MIRROR_COL_SNAPLEN ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31273
0
}
31274
31275
/* Sets the "statistics" column from the "Mirror" table in 'row' to
31276
 * the map with keys 'key_statistics' and values 'value_statistics'
31277
 * with 'n_statistics' entries.
31278
 *
31279
 * The caller retains ownership of the arguments. */
31280
void
31281
ovsrec_mirror_index_set_statistics(const struct ovsrec_mirror *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
31282
0
{
31283
0
    struct ovsdb_datum datum;
31284
31285
0
    datum.refcnt = NULL;
31286
0
    size_t i;
31287
31288
0
    datum.n = n_statistics;
31289
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
31290
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
31291
0
    for (i = 0; i < n_statistics; i++) {
31292
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
31293
0
        datum.values[i].integer = value_statistics[i];
31294
0
    }
31295
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_statistics.type);
31296
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_mirror_columns[ OVSREC_MIRROR_COL_STATISTICS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
31297
0
}
31298
31299
struct ovsdb_idl_column ovsrec_mirror_columns[OVSREC_MIRROR_N_COLUMNS];
31300
31301
unsigned int
31302
ovsrec_mirror_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
31303
0
{
31304
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_mirror, condition);
31305
0
}
31306
31307
struct ovsdb_idl_column ovsrec_mirror_columns[OVSREC_MIRROR_N_COLUMNS] = {
31308
    [OVSREC_MIRROR_COL_EXTERNAL_IDS] = {
31309
         .name = "external_ids",
31310
         .type = {
31311
            .key = {
31312
               .type = OVSDB_TYPE_STRING,
31313
               .string = { .minLen = 0, .maxLen = UINT_MAX },
31314
            },
31315
            .value = {
31316
                .type = OVSDB_TYPE_STRING,
31317
                .string = { .minLen = 0, .maxLen = UINT_MAX },
31318
            },
31319
            .n_min = 0,
31320
            .n_max = UINT_MAX,
31321
         },
31322
         .is_mutable = true,
31323
         .is_synthetic = false,
31324
         .parse = ovsrec_mirror_parse_external_ids,
31325
         .unparse = ovsrec_mirror_unparse_external_ids,
31326
    },
31327
31328
    [OVSREC_MIRROR_COL_FILTER] = {
31329
         .name = "filter",
31330
         .type = {
31331
            .key = {
31332
               .type = OVSDB_TYPE_STRING,
31333
               .string = { .minLen = 0, .maxLen = UINT_MAX },
31334
            },
31335
            .value = OVSDB_BASE_VOID_INIT,
31336
            .n_min = 0,
31337
            .n_max = 1,
31338
         },
31339
         .is_mutable = true,
31340
         .is_synthetic = false,
31341
         .parse = ovsrec_mirror_parse_filter,
31342
         .unparse = ovsrec_mirror_unparse_filter,
31343
    },
31344
31345
    [OVSREC_MIRROR_COL_NAME] = {
31346
         .name = "name",
31347
         .type = {
31348
            .key = {
31349
               .type = OVSDB_TYPE_STRING,
31350
               .string = { .minLen = 0, .maxLen = UINT_MAX },
31351
            },
31352
            .value = OVSDB_BASE_VOID_INIT,
31353
            .n_min = 1,
31354
            .n_max = 1,
31355
         },
31356
         .is_mutable = true,
31357
         .is_synthetic = false,
31358
         .parse = ovsrec_mirror_parse_name,
31359
         .unparse = ovsrec_mirror_unparse_name,
31360
    },
31361
31362
    [OVSREC_MIRROR_COL_OUTPUT_PORT] = {
31363
         .name = "output_port",
31364
         .type = {
31365
            .key = {
31366
               .type = OVSDB_TYPE_UUID,
31367
               .uuid = { .refTableName = "Port", .refType = OVSDB_REF_WEAK },
31368
            },
31369
            .value = OVSDB_BASE_VOID_INIT,
31370
            .n_min = 0,
31371
            .n_max = 1,
31372
         },
31373
         .is_mutable = true,
31374
         .is_synthetic = false,
31375
         .parse = ovsrec_mirror_parse_output_port,
31376
         .unparse = ovsrec_mirror_unparse_output_port,
31377
    },
31378
31379
    [OVSREC_MIRROR_COL_OUTPUT_VLAN] = {
31380
         .name = "output_vlan",
31381
         .type = {
31382
            .key = {
31383
               .type = OVSDB_TYPE_INTEGER,
31384
               .integer = { .min = INT64_C(1), .max = INT64_C(4095) },
31385
            },
31386
            .value = OVSDB_BASE_VOID_INIT,
31387
            .n_min = 0,
31388
            .n_max = 1,
31389
         },
31390
         .is_mutable = true,
31391
         .is_synthetic = false,
31392
         .parse = ovsrec_mirror_parse_output_vlan,
31393
         .unparse = ovsrec_mirror_unparse_output_vlan,
31394
    },
31395
31396
    [OVSREC_MIRROR_COL_SELECT_ALL] = {
31397
         .name = "select_all",
31398
         .type = {
31399
            .key = {
31400
               .type = OVSDB_TYPE_BOOLEAN,
31401
            },
31402
            .value = OVSDB_BASE_VOID_INIT,
31403
            .n_min = 1,
31404
            .n_max = 1,
31405
         },
31406
         .is_mutable = true,
31407
         .is_synthetic = false,
31408
         .parse = ovsrec_mirror_parse_select_all,
31409
         .unparse = ovsrec_mirror_unparse_select_all,
31410
    },
31411
31412
    [OVSREC_MIRROR_COL_SELECT_DST_PORT] = {
31413
         .name = "select_dst_port",
31414
         .type = {
31415
            .key = {
31416
               .type = OVSDB_TYPE_UUID,
31417
               .uuid = { .refTableName = "Port", .refType = OVSDB_REF_WEAK },
31418
            },
31419
            .value = OVSDB_BASE_VOID_INIT,
31420
            .n_min = 0,
31421
            .n_max = UINT_MAX,
31422
         },
31423
         .is_mutable = true,
31424
         .is_synthetic = false,
31425
         .parse = ovsrec_mirror_parse_select_dst_port,
31426
         .unparse = ovsrec_mirror_unparse_select_dst_port,
31427
    },
31428
31429
    [OVSREC_MIRROR_COL_SELECT_SRC_PORT] = {
31430
         .name = "select_src_port",
31431
         .type = {
31432
            .key = {
31433
               .type = OVSDB_TYPE_UUID,
31434
               .uuid = { .refTableName = "Port", .refType = OVSDB_REF_WEAK },
31435
            },
31436
            .value = OVSDB_BASE_VOID_INIT,
31437
            .n_min = 0,
31438
            .n_max = UINT_MAX,
31439
         },
31440
         .is_mutable = true,
31441
         .is_synthetic = false,
31442
         .parse = ovsrec_mirror_parse_select_src_port,
31443
         .unparse = ovsrec_mirror_unparse_select_src_port,
31444
    },
31445
31446
    [OVSREC_MIRROR_COL_SELECT_VLAN] = {
31447
         .name = "select_vlan",
31448
         .type = {
31449
            .key = {
31450
               .type = OVSDB_TYPE_INTEGER,
31451
               .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
31452
            },
31453
            .value = OVSDB_BASE_VOID_INIT,
31454
            .n_min = 0,
31455
            .n_max = 4096,
31456
         },
31457
         .is_mutable = true,
31458
         .is_synthetic = false,
31459
         .parse = ovsrec_mirror_parse_select_vlan,
31460
         .unparse = ovsrec_mirror_unparse_select_vlan,
31461
    },
31462
31463
    [OVSREC_MIRROR_COL_SNAPLEN] = {
31464
         .name = "snaplen",
31465
         .type = {
31466
            .key = {
31467
               .type = OVSDB_TYPE_INTEGER,
31468
               .integer = { .min = INT64_C(14), .max = INT64_C(65535) },
31469
            },
31470
            .value = OVSDB_BASE_VOID_INIT,
31471
            .n_min = 0,
31472
            .n_max = 1,
31473
         },
31474
         .is_mutable = true,
31475
         .is_synthetic = false,
31476
         .parse = ovsrec_mirror_parse_snaplen,
31477
         .unparse = ovsrec_mirror_unparse_snaplen,
31478
    },
31479
31480
    [OVSREC_MIRROR_COL_STATISTICS] = {
31481
         .name = "statistics",
31482
         .type = {
31483
            .key = {
31484
               .type = OVSDB_TYPE_STRING,
31485
               .string = { .minLen = 0, .maxLen = UINT_MAX },
31486
            },
31487
            .value = {
31488
                .type = OVSDB_TYPE_INTEGER,
31489
                .integer = { .min = INT64_MIN, .max = INT64_MAX },
31490
            },
31491
            .n_min = 0,
31492
            .n_max = UINT_MAX,
31493
         },
31494
         .is_mutable = true,
31495
         .is_synthetic = false,
31496
         .parse = ovsrec_mirror_parse_statistics,
31497
         .unparse = ovsrec_mirror_unparse_statistics,
31498
    },
31499
31500
};
31501

31502
/* NetFlow table. */
31503
31504
bool
31505
ovsrec_server_has_netflow_table_col_active_timeout(const struct ovsdb_idl *idl)
31506
0
{
31507
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_active_timeout);
31508
0
}
31509
31510
const struct ovsdb_type *
31511
ovsrec_netflow_active_timeout_server_type(const struct ovsdb_idl *idl)
31512
0
{
31513
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_netflow_col_active_timeout);
31514
0
}
31515
31516
31517
bool
31518
ovsrec_server_has_netflow_table_col_add_id_to_interface(const struct ovsdb_idl *idl)
31519
0
{
31520
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_add_id_to_interface);
31521
0
}
31522
31523
const struct ovsdb_type *
31524
ovsrec_netflow_add_id_to_interface_server_type(const struct ovsdb_idl *idl)
31525
0
{
31526
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_netflow_col_add_id_to_interface);
31527
0
}
31528
31529
31530
bool
31531
ovsrec_server_has_netflow_table_col_engine_id(const struct ovsdb_idl *idl)
31532
0
{
31533
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_engine_id);
31534
0
}
31535
31536
const struct ovsdb_type *
31537
ovsrec_netflow_engine_id_server_type(const struct ovsdb_idl *idl)
31538
0
{
31539
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_netflow_col_engine_id);
31540
0
}
31541
31542
31543
bool
31544
ovsrec_server_has_netflow_table_col_engine_type(const struct ovsdb_idl *idl)
31545
0
{
31546
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_engine_type);
31547
0
}
31548
31549
const struct ovsdb_type *
31550
ovsrec_netflow_engine_type_server_type(const struct ovsdb_idl *idl)
31551
0
{
31552
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_netflow_col_engine_type);
31553
0
}
31554
31555
31556
bool
31557
ovsrec_server_has_netflow_table_col_external_ids(const struct ovsdb_idl *idl)
31558
0
{
31559
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_external_ids);
31560
0
}
31561
31562
const struct ovsdb_type *
31563
ovsrec_netflow_external_ids_server_type(const struct ovsdb_idl *idl)
31564
0
{
31565
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_netflow_col_external_ids);
31566
0
}
31567
31568
31569
bool
31570
ovsrec_server_has_netflow_table_col_targets(const struct ovsdb_idl *idl)
31571
0
{
31572
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_targets);
31573
0
}
31574
31575
const struct ovsdb_type *
31576
ovsrec_netflow_targets_server_type(const struct ovsdb_idl *idl)
31577
0
{
31578
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_netflow_col_targets);
31579
0
}
31580
31581
31582
bool
31583
ovsrec_server_has_netflow_table(const struct ovsdb_idl *idl)
31584
0
{
31585
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]);
31586
0
}
31587
31588
31589
const struct ovsrec_netflow_table *
31590
ovsrec_netflow_table_get(const struct ovsdb_idl *idl)
31591
0
{
31592
0
    return (const struct ovsrec_netflow_table *) idl;
31593
0
}
31594
31595
const struct ovsrec_netflow *
31596
ovsrec_netflow_table_first(const struct ovsrec_netflow_table *table)
31597
0
{
31598
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
31599
0
    return ovsrec_netflow_first(idl);
31600
0
}
31601
31602
31603
const struct ovsrec_netflow *
31604
ovsrec_netflow_table_track_get_first(const struct ovsrec_netflow_table *table)
31605
0
{
31606
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
31607
0
    return ovsrec_netflow_track_get_first(idl);
31608
0
}
31609
31610
31611
static void
31612
ovsrec_netflow_parse_active_timeout(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31613
0
{
31614
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
31615
31616
0
    if (datum->n >= 1) {
31617
0
        row->active_timeout = datum->keys[0].integer;
31618
0
    } else {
31619
0
        row->active_timeout = 0;
31620
0
    }
31621
0
}
31622
31623
static void
31624
ovsrec_netflow_parse_add_id_to_interface(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31625
0
{
31626
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
31627
31628
0
    if (datum->n >= 1) {
31629
0
        row->add_id_to_interface = datum->keys[0].boolean;
31630
0
    } else {
31631
0
        row->add_id_to_interface = false;
31632
0
    }
31633
0
}
31634
31635
static void
31636
ovsrec_netflow_parse_engine_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31637
0
{
31638
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
31639
0
    size_t n = MIN(1, datum->n);
31640
0
    row->engine_id = NULL;
31641
0
    row->n_engine_id = 0;
31642
0
    for (size_t i = 0; i < n; i++) {
31643
0
        if (!row->n_engine_id) {
31644
0
            row->engine_id = xmalloc(n * sizeof *row->engine_id);
31645
0
        }
31646
0
        row->engine_id[row->n_engine_id] = datum->keys[i].integer;
31647
0
        row->n_engine_id++;
31648
0
    }
31649
0
}
31650
31651
static void
31652
ovsrec_netflow_parse_engine_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31653
0
{
31654
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
31655
0
    size_t n = MIN(1, datum->n);
31656
0
    row->engine_type = NULL;
31657
0
    row->n_engine_type = 0;
31658
0
    for (size_t i = 0; i < n; i++) {
31659
0
        if (!row->n_engine_type) {
31660
0
            row->engine_type = xmalloc(n * sizeof *row->engine_type);
31661
0
        }
31662
0
        row->engine_type[row->n_engine_type] = datum->keys[i].integer;
31663
0
        row->n_engine_type++;
31664
0
    }
31665
0
}
31666
31667
static void
31668
ovsrec_netflow_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31669
0
{
31670
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
31671
0
    smap_init(&row->external_ids);
31672
0
    for (size_t i = 0; i < datum->n; i++) {
31673
0
        smap_add(&row->external_ids,
31674
0
                 json_string(datum->keys[i].s),
31675
0
                 json_string(datum->values[i].s));
31676
0
    }
31677
0
}
31678
31679
static void
31680
ovsrec_netflow_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31681
0
{
31682
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
31683
0
    row->targets = NULL;
31684
0
    row->n_targets = 0;
31685
0
    for (size_t i = 0; i < datum->n; i++) {
31686
0
        if (!row->n_targets) {
31687
0
            row->targets = xmalloc(datum->n * sizeof *row->targets);
31688
0
        }
31689
0
        row->targets[row->n_targets] = CONST_CAST(char *, json_string(datum->keys[i].s));
31690
0
        row->n_targets++;
31691
0
    }
31692
0
}
31693
31694
static void
31695
ovsrec_netflow_unparse_active_timeout(struct ovsdb_idl_row *row OVS_UNUSED)
31696
0
{
31697
    /* Nothing to do. */
31698
0
}
31699
31700
static void
31701
ovsrec_netflow_unparse_add_id_to_interface(struct ovsdb_idl_row *row OVS_UNUSED)
31702
0
{
31703
    /* Nothing to do. */
31704
0
}
31705
31706
static void
31707
ovsrec_netflow_unparse_engine_id(struct ovsdb_idl_row *row_)
31708
0
{
31709
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
31710
0
    free(row->engine_id);
31711
0
}
31712
31713
static void
31714
ovsrec_netflow_unparse_engine_type(struct ovsdb_idl_row *row_)
31715
0
{
31716
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
31717
0
    free(row->engine_type);
31718
0
}
31719
31720
static void
31721
ovsrec_netflow_unparse_external_ids(struct ovsdb_idl_row *row_)
31722
0
{
31723
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
31724
0
    smap_destroy(&row->external_ids);
31725
0
}
31726
31727
static void
31728
ovsrec_netflow_unparse_targets(struct ovsdb_idl_row *row_)
31729
0
{
31730
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
31731
0
    free(row->targets);
31732
0
}
31733
31734
static void
31735
ovsrec_netflow_init__(struct ovsdb_idl_row *row)
31736
0
{
31737
0
    ovsrec_netflow_init(ovsrec_netflow_cast(row));
31738
0
}
31739
31740
/* Clears the contents of 'row' in table "NetFlow". */
31741
void
31742
ovsrec_netflow_init(struct ovsrec_netflow *row)
31743
0
{
31744
0
    memset(row, 0, sizeof *row); 
31745
0
    smap_init(&row->external_ids);
31746
0
}
31747
31748
/* Searches table "NetFlow" in 'idl' for a row with UUID 'uuid'.  Returns
31749
 * a pointer to the row if there is one, otherwise a null pointer.  */
31750
const struct ovsrec_netflow *
31751
ovsrec_netflow_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
31752
0
{
31753
0
    return ovsrec_netflow_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_netflow, uuid));
31754
0
}
31755
31756
/* Searches table "NetFlow" for a row with UUID 'uuid'.  Returns
31757
 * a pointer to the row if there is one, otherwise a null pointer.  */
31758
const struct ovsrec_netflow *
31759
ovsrec_netflow_table_get_for_uuid(const struct ovsrec_netflow_table *table, const struct uuid *uuid)
31760
0
{
31761
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
31762
0
    return ovsrec_netflow_get_for_uuid(idl, uuid);
31763
0
}
31764
31765
/* Returns a row in table "NetFlow" in 'idl', or a null pointer if that
31766
 * table is empty.
31767
 *
31768
 * Database tables are internally maintained as hash tables, so adding or
31769
 * removing rows while traversing the same table can cause some rows to be
31770
 * visited twice or not at apply. */
31771
const struct ovsrec_netflow *
31772
ovsrec_netflow_first(const struct ovsdb_idl *idl)
31773
0
{
31774
0
    return ovsrec_netflow_cast(ovsdb_idl_first_row(idl, &ovsrec_table_netflow));
31775
0
}
31776
31777
/* Returns a row following 'row' within its table, or a null pointer if 'row'
31778
 * is the last row in its table. */
31779
const struct ovsrec_netflow *
31780
ovsrec_netflow_next(const struct ovsrec_netflow *row)
31781
0
{
31782
0
    return ovsrec_netflow_cast(ovsdb_idl_next_row(&row->header_));
31783
0
}
31784
31785
unsigned int ovsrec_netflow_get_seqno(const struct ovsdb_idl *idl)
31786
0
{
31787
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_netflow);
31788
0
}
31789
31790
unsigned int ovsrec_netflow_row_get_seqno(const struct ovsrec_netflow *row, enum ovsdb_idl_change change)
31791
0
{
31792
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
31793
0
}
31794
31795
const struct ovsrec_netflow *
31796
ovsrec_netflow_track_get_first(const struct ovsdb_idl *idl)
31797
0
{
31798
0
    return ovsrec_netflow_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_netflow));
31799
0
}
31800
31801
const struct ovsrec_netflow
31802
*ovsrec_netflow_track_get_next(const struct ovsrec_netflow *row)
31803
0
{
31804
0
    return ovsrec_netflow_cast(ovsdb_idl_track_get_next(&row->header_));
31805
0
}
31806
31807
31808
/* Deletes 'row' from table "NetFlow".  'row' may be freed, so it must not be
31809
 * accessed afterward.
31810
 *
31811
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31812
void
31813
ovsrec_netflow_delete(const struct ovsrec_netflow *row)
31814
0
{
31815
0
    ovsdb_idl_txn_delete(&row->header_);
31816
0
}
31817
31818
/* Inserts and returns a new row in the table "NetFlow" in the database
31819
 * with open transaction 'txn'.
31820
 *
31821
 * The new row is assigned a randomly generated provisional UUID.
31822
 * ovsdb-server will assign a different UUID when 'txn' is committed,
31823
 * but the IDL will replace any uses of the provisional UUID in the
31824
 * data to be to be committed by the UUID assigned by ovsdb-server. */
31825
struct ovsrec_netflow *
31826
ovsrec_netflow_insert(struct ovsdb_idl_txn *txn)
31827
0
{
31828
0
    return ovsrec_netflow_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_netflow, NULL));
31829
0
}
31830
31831
/* Inserts and returns a new row in the table "NetFlow" in the database
31832
 * with open transaction 'txn'.
31833
 *
31834
 * The new row is assigned the UUID specified in the 'uuid' parameter
31835
 * (which cannot be null).  ovsdb-server will try to assign the same
31836
 * UUID when 'txn' is committed. */
31837
struct ovsrec_netflow *
31838
ovsrec_netflow_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
31839
0
{
31840
0
    return ovsrec_netflow_cast(ovsdb_idl_txn_insert_persist_uuid(
31841
0
        txn, &ovsrec_table_netflow, uuid));
31842
0
}
31843
31844
bool
31845
ovsrec_netflow_is_updated(const struct ovsrec_netflow *row, enum ovsrec_netflow_column_id column)
31846
0
{
31847
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_netflow_columns[column]);
31848
0
}
31849
31850
/* Causes the original contents of column "active_timeout" in 'row' to be
31851
 * verified as a prerequisite to completing the transaction.  That is, if
31852
 * "active_timeout" in 'row' changed (or if 'row' was deleted) between the
31853
 * time that the IDL originally read its contents and the time that the
31854
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
31855
 *
31856
 * The intention is that, to ensure that no transaction commits based on dirty
31857
 * reads, an application should call this function any time "active_timeout" is
31858
 * read as part of a read-modify-write operation.
31859
 *
31860
 * In some cases this function reduces to a no-op, because the current value
31861
 * of "active_timeout" is already known:
31862
 *
31863
 *   - If 'row' is a row created by the current transaction (returned by
31864
 *     ovsrec_netflow_insert()).
31865
 *
31866
 *   - If "active_timeout" has already been modified (with
31867
 *     ovsrec_netflow_set_active_timeout()) within the current transaction.
31868
 *
31869
 * Because of the latter property, always call this function *before*
31870
 * ovsrec_netflow_set_active_timeout() for a given read-modify-write.
31871
 *
31872
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31873
void
31874
ovsrec_netflow_verify_active_timeout(const struct ovsrec_netflow *row)
31875
0
{
31876
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_active_timeout);
31877
0
}
31878
31879
/* Causes the original contents of column "add_id_to_interface" in 'row' to be
31880
 * verified as a prerequisite to completing the transaction.  That is, if
31881
 * "add_id_to_interface" in 'row' changed (or if 'row' was deleted) between the
31882
 * time that the IDL originally read its contents and the time that the
31883
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
31884
 *
31885
 * The intention is that, to ensure that no transaction commits based on dirty
31886
 * reads, an application should call this function any time "add_id_to_interface" is
31887
 * read as part of a read-modify-write operation.
31888
 *
31889
 * In some cases this function reduces to a no-op, because the current value
31890
 * of "add_id_to_interface" is already known:
31891
 *
31892
 *   - If 'row' is a row created by the current transaction (returned by
31893
 *     ovsrec_netflow_insert()).
31894
 *
31895
 *   - If "add_id_to_interface" has already been modified (with
31896
 *     ovsrec_netflow_set_add_id_to_interface()) within the current transaction.
31897
 *
31898
 * Because of the latter property, always call this function *before*
31899
 * ovsrec_netflow_set_add_id_to_interface() for a given read-modify-write.
31900
 *
31901
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31902
void
31903
ovsrec_netflow_verify_add_id_to_interface(const struct ovsrec_netflow *row)
31904
0
{
31905
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_add_id_to_interface);
31906
0
}
31907
31908
/* Causes the original contents of column "engine_id" in 'row' to be
31909
 * verified as a prerequisite to completing the transaction.  That is, if
31910
 * "engine_id" in 'row' changed (or if 'row' was deleted) between the
31911
 * time that the IDL originally read its contents and the time that the
31912
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
31913
 *
31914
 * The intention is that, to ensure that no transaction commits based on dirty
31915
 * reads, an application should call this function any time "engine_id" is
31916
 * read as part of a read-modify-write operation.
31917
 *
31918
 * In some cases this function reduces to a no-op, because the current value
31919
 * of "engine_id" is already known:
31920
 *
31921
 *   - If 'row' is a row created by the current transaction (returned by
31922
 *     ovsrec_netflow_insert()).
31923
 *
31924
 *   - If "engine_id" has already been modified (with
31925
 *     ovsrec_netflow_set_engine_id()) within the current transaction.
31926
 *
31927
 * Because of the latter property, always call this function *before*
31928
 * ovsrec_netflow_set_engine_id() for a given read-modify-write.
31929
 *
31930
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31931
void
31932
ovsrec_netflow_verify_engine_id(const struct ovsrec_netflow *row)
31933
0
{
31934
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_engine_id);
31935
0
}
31936
31937
/* Causes the original contents of column "engine_type" in 'row' to be
31938
 * verified as a prerequisite to completing the transaction.  That is, if
31939
 * "engine_type" in 'row' changed (or if 'row' was deleted) between the
31940
 * time that the IDL originally read its contents and the time that the
31941
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
31942
 *
31943
 * The intention is that, to ensure that no transaction commits based on dirty
31944
 * reads, an application should call this function any time "engine_type" is
31945
 * read as part of a read-modify-write operation.
31946
 *
31947
 * In some cases this function reduces to a no-op, because the current value
31948
 * of "engine_type" is already known:
31949
 *
31950
 *   - If 'row' is a row created by the current transaction (returned by
31951
 *     ovsrec_netflow_insert()).
31952
 *
31953
 *   - If "engine_type" has already been modified (with
31954
 *     ovsrec_netflow_set_engine_type()) within the current transaction.
31955
 *
31956
 * Because of the latter property, always call this function *before*
31957
 * ovsrec_netflow_set_engine_type() for a given read-modify-write.
31958
 *
31959
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31960
void
31961
ovsrec_netflow_verify_engine_type(const struct ovsrec_netflow *row)
31962
0
{
31963
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_engine_type);
31964
0
}
31965
31966
/* Causes the original contents of column "external_ids" in 'row' to be
31967
 * verified as a prerequisite to completing the transaction.  That is, if
31968
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
31969
 * time that the IDL originally read its contents and the time that the
31970
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
31971
 *
31972
 * The intention is that, to ensure that no transaction commits based on dirty
31973
 * reads, an application should call this function any time "external_ids" is
31974
 * read as part of a read-modify-write operation.
31975
 *
31976
 * In some cases this function reduces to a no-op, because the current value
31977
 * of "external_ids" is already known:
31978
 *
31979
 *   - If 'row' is a row created by the current transaction (returned by
31980
 *     ovsrec_netflow_insert()).
31981
 *
31982
 *   - If "external_ids" has already been modified (with
31983
 *     ovsrec_netflow_set_external_ids()) within the current transaction.
31984
 *
31985
 * Because of the latter property, always call this function *before*
31986
 * ovsrec_netflow_set_external_ids() for a given read-modify-write.
31987
 *
31988
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31989
void
31990
ovsrec_netflow_verify_external_ids(const struct ovsrec_netflow *row)
31991
0
{
31992
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_external_ids);
31993
0
}
31994
31995
/* Causes the original contents of column "targets" in 'row' to be
31996
 * verified as a prerequisite to completing the transaction.  That is, if
31997
 * "targets" in 'row' changed (or if 'row' was deleted) between the
31998
 * time that the IDL originally read its contents and the time that the
31999
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32000
 *
32001
 * The intention is that, to ensure that no transaction commits based on dirty
32002
 * reads, an application should call this function any time "targets" is
32003
 * read as part of a read-modify-write operation.
32004
 *
32005
 * In some cases this function reduces to a no-op, because the current value
32006
 * of "targets" is already known:
32007
 *
32008
 *   - If 'row' is a row created by the current transaction (returned by
32009
 *     ovsrec_netflow_insert()).
32010
 *
32011
 *   - If "targets" has already been modified (with
32012
 *     ovsrec_netflow_set_targets()) within the current transaction.
32013
 *
32014
 * Because of the latter property, always call this function *before*
32015
 * ovsrec_netflow_set_targets() for a given read-modify-write.
32016
 *
32017
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32018
void
32019
ovsrec_netflow_verify_targets(const struct ovsrec_netflow *row)
32020
0
{
32021
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_targets);
32022
0
}
32023
32024
/* Returns the "active_timeout" column's value from the "NetFlow" table in 'row'
32025
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32026
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32027
 * for a given key than implementing the same operation on the "cooked"
32028
 * form in 'row'.
32029
 *
32030
 * 'key_type' must be OVSDB_TYPE_INTEGER.
32031
 * (This helps to avoid silent bugs if someone changes active_timeout's
32032
 * type without updating the caller.)
32033
 *
32034
 * The caller must not modify or free the returned value.
32035
 *
32036
 * Various kinds of changes can invalidate the returned value: modifying
32037
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32038
 * If the returned value is needed for a long time, it is best to make a copy
32039
 * of it with ovsdb_datum_clone().
32040
 *
32041
 * This function is rarely useful, since it is easier to access the value
32042
 * directly through the "active_timeout" member in ovsrec_netflow. */
32043
const struct ovsdb_datum *
32044
ovsrec_netflow_get_active_timeout(const struct ovsrec_netflow *row,
32045
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32046
0
{
32047
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
32048
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_active_timeout);
32049
0
}
32050
32051
/* Returns the "add_id_to_interface" column's value from the "NetFlow" table in 'row'
32052
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32053
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32054
 * for a given key than implementing the same operation on the "cooked"
32055
 * form in 'row'.
32056
 *
32057
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
32058
 * (This helps to avoid silent bugs if someone changes add_id_to_interface's
32059
 * type without updating the caller.)
32060
 *
32061
 * The caller must not modify or free the returned value.
32062
 *
32063
 * Various kinds of changes can invalidate the returned value: modifying
32064
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32065
 * If the returned value is needed for a long time, it is best to make a copy
32066
 * of it with ovsdb_datum_clone().
32067
 *
32068
 * This function is rarely useful, since it is easier to access the value
32069
 * directly through the "add_id_to_interface" member in ovsrec_netflow. */
32070
const struct ovsdb_datum *
32071
ovsrec_netflow_get_add_id_to_interface(const struct ovsrec_netflow *row,
32072
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32073
0
{
32074
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
32075
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_add_id_to_interface);
32076
0
}
32077
32078
/* Returns the "engine_id" column's value from the "NetFlow" table in 'row'
32079
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32080
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32081
 * for a given key than implementing the same operation on the "cooked"
32082
 * form in 'row'.
32083
 *
32084
 * 'key_type' must be OVSDB_TYPE_INTEGER.
32085
 * (This helps to avoid silent bugs if someone changes engine_id's
32086
 * type without updating the caller.)
32087
 *
32088
 * The caller must not modify or free the returned value.
32089
 *
32090
 * Various kinds of changes can invalidate the returned value: modifying
32091
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32092
 * If the returned value is needed for a long time, it is best to make a copy
32093
 * of it with ovsdb_datum_clone().
32094
 *
32095
 * This function is rarely useful, since it is easier to access the value
32096
 * directly through the "engine_id" member in ovsrec_netflow. */
32097
const struct ovsdb_datum *
32098
ovsrec_netflow_get_engine_id(const struct ovsrec_netflow *row,
32099
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32100
0
{
32101
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
32102
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_engine_id);
32103
0
}
32104
32105
/* Returns the "engine_type" column's value from the "NetFlow" table in 'row'
32106
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32107
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32108
 * for a given key than implementing the same operation on the "cooked"
32109
 * form in 'row'.
32110
 *
32111
 * 'key_type' must be OVSDB_TYPE_INTEGER.
32112
 * (This helps to avoid silent bugs if someone changes engine_type's
32113
 * type without updating the caller.)
32114
 *
32115
 * The caller must not modify or free the returned value.
32116
 *
32117
 * Various kinds of changes can invalidate the returned value: modifying
32118
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32119
 * If the returned value is needed for a long time, it is best to make a copy
32120
 * of it with ovsdb_datum_clone().
32121
 *
32122
 * This function is rarely useful, since it is easier to access the value
32123
 * directly through the "engine_type" member in ovsrec_netflow. */
32124
const struct ovsdb_datum *
32125
ovsrec_netflow_get_engine_type(const struct ovsrec_netflow *row,
32126
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32127
0
{
32128
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
32129
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_engine_type);
32130
0
}
32131
32132
/* Returns the "external_ids" column's value from the "NetFlow" table in 'row'
32133
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32134
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32135
 * for a given key than implementing the same operation on the "cooked"
32136
 * form in 'row'.
32137
 *
32138
 * 'key_type' must be OVSDB_TYPE_STRING.
32139
 * 'value_type' must be OVSDB_TYPE_STRING.
32140
 * (This helps to avoid silent bugs if someone changes external_ids's
32141
 * type without updating the caller.)
32142
 *
32143
 * The caller must not modify or free the returned value.
32144
 *
32145
 * Various kinds of changes can invalidate the returned value: modifying
32146
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32147
 * If the returned value is needed for a long time, it is best to make a copy
32148
 * of it with ovsdb_datum_clone().
32149
 *
32150
 * This function is rarely useful, since it is easier to access the value
32151
 * directly through the "external_ids" member in ovsrec_netflow. */
32152
const struct ovsdb_datum *
32153
ovsrec_netflow_get_external_ids(const struct ovsrec_netflow *row,
32154
  enum ovsdb_atomic_type key_type OVS_UNUSED,
32155
  enum ovsdb_atomic_type value_type OVS_UNUSED)
32156
0
{
32157
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32158
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
32159
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_external_ids);
32160
0
}
32161
32162
/* Returns the "targets" column's value from the "NetFlow" table in 'row'
32163
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32164
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32165
 * for a given key than implementing the same operation on the "cooked"
32166
 * form in 'row'.
32167
 *
32168
 * 'key_type' must be OVSDB_TYPE_STRING.
32169
 * (This helps to avoid silent bugs if someone changes targets's
32170
 * type without updating the caller.)
32171
 *
32172
 * The caller must not modify or free the returned value.
32173
 *
32174
 * Various kinds of changes can invalidate the returned value: modifying
32175
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32176
 * If the returned value is needed for a long time, it is best to make a copy
32177
 * of it with ovsdb_datum_clone().
32178
 *
32179
 * This function is rarely useful, since it is easier to access the value
32180
 * directly through the "targets" member in ovsrec_netflow. */
32181
const struct ovsdb_datum *
32182
ovsrec_netflow_get_targets(const struct ovsrec_netflow *row,
32183
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32184
0
{
32185
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32186
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_targets);
32187
0
}
32188
32189
/* Sets the "active_timeout" column from the "NetFlow" table in 'row' to
32190
 * 'active_timeout'.
32191
 *
32192
 * Argument constraints: at least -1
32193
 *
32194
 * The caller retains ownership of the arguments. */
32195
void
32196
ovsrec_netflow_set_active_timeout(const struct ovsrec_netflow *row, int64_t active_timeout)
32197
0
{
32198
0
    struct ovsdb_datum datum;
32199
32200
0
    datum.refcnt = NULL;
32201
32202
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
32203
32204
0
    datum.n = 1;
32205
0
    datum.keys = key;
32206
0
    key->integer = active_timeout;
32207
0
    datum.values = NULL;
32208
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_col_active_timeout, &datum);
32209
0
}
32210
32211
/* Sets the "add_id_to_interface" column from the "NetFlow" table in 'row' to
32212
 * 'add_id_to_interface'.
32213
 *
32214
 * The caller retains ownership of the arguments. */
32215
void
32216
ovsrec_netflow_set_add_id_to_interface(const struct ovsrec_netflow *row, bool add_id_to_interface)
32217
0
{
32218
0
    struct ovsdb_datum datum;
32219
32220
0
    datum.refcnt = NULL;
32221
32222
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
32223
32224
0
    datum.n = 1;
32225
0
    datum.keys = key;
32226
0
    key->boolean = add_id_to_interface;
32227
0
    datum.values = NULL;
32228
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_col_add_id_to_interface, &datum);
32229
0
}
32230
32231
/* Sets the "engine_id" column from the "NetFlow" table in 'row' to
32232
 * the 'engine_id' set with 'n_engine_id' entries.
32233
 *
32234
 * 'n_engine_id' may be 0 or 1; if it is 0, then 'engine_id'
32235
 * may be NULL.
32236
 *
32237
 * Argument constraints: in range 0 to 255
32238
 *
32239
 * The caller retains ownership of the arguments. */
32240
void
32241
ovsrec_netflow_set_engine_id(const struct ovsrec_netflow *row, const int64_t *engine_id, size_t n_engine_id)
32242
0
{
32243
0
    struct ovsdb_datum datum;
32244
32245
0
    datum.refcnt = NULL;
32246
32247
0
    if (n_engine_id) {
32248
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
32249
0
        datum.n = 1;
32250
0
        datum.keys = key;
32251
0
        key->integer = *engine_id;
32252
0
    } else {
32253
0
        datum.n = 0;
32254
0
        datum.keys = NULL;
32255
0
    }
32256
0
    datum.values = NULL;
32257
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_col_engine_id, &datum);
32258
0
}
32259
32260
/* Sets the "engine_type" column from the "NetFlow" table in 'row' to
32261
 * the 'engine_type' set with 'n_engine_type' entries.
32262
 *
32263
 * 'n_engine_type' may be 0 or 1; if it is 0, then 'engine_type'
32264
 * may be NULL.
32265
 *
32266
 * Argument constraints: in range 0 to 255
32267
 *
32268
 * The caller retains ownership of the arguments. */
32269
void
32270
ovsrec_netflow_set_engine_type(const struct ovsrec_netflow *row, const int64_t *engine_type, size_t n_engine_type)
32271
0
{
32272
0
    struct ovsdb_datum datum;
32273
32274
0
    datum.refcnt = NULL;
32275
32276
0
    if (n_engine_type) {
32277
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
32278
0
        datum.n = 1;
32279
0
        datum.keys = key;
32280
0
        key->integer = *engine_type;
32281
0
    } else {
32282
0
        datum.n = 0;
32283
0
        datum.keys = NULL;
32284
0
    }
32285
0
    datum.values = NULL;
32286
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_col_engine_type, &datum);
32287
0
}
32288
32289
/* Sets the "external_ids" column's value from the "NetFlow" table in 'row'
32290
 * to 'external_ids'.
32291
 *
32292
 * The caller retains ownership of 'external_ids' and everything in it. */
32293
void
32294
ovsrec_netflow_set_external_ids(const struct ovsrec_netflow *row, const struct smap *external_ids)
32295
0
{
32296
0
    struct ovsdb_datum datum;
32297
32298
0
    if (external_ids) {
32299
0
        ovsdb_datum_from_smap(&datum, external_ids);
32300
0
    } else {
32301
0
        ovsdb_datum_init_empty(&datum);
32302
0
    }
32303
0
    ovsdb_idl_txn_write(&row->header_,
32304
0
                        &ovsrec_netflow_col_external_ids,
32305
0
                        &datum);
32306
0
}
32307
32308
32309
/* Sets the "targets" column from the "NetFlow" table in 'row' to
32310
 * the 'targets' set with 'n_targets' entries.
32311
 *
32312
 * The caller retains ownership of the arguments. */
32313
void
32314
ovsrec_netflow_set_targets(const struct ovsrec_netflow *row, const char **targets, size_t n_targets)
32315
0
{
32316
0
    struct ovsdb_datum datum;
32317
32318
0
    datum.refcnt = NULL;
32319
32320
0
    datum.n = n_targets;
32321
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
32322
0
    datum.values = NULL;
32323
0
    for (size_t i = 0; i < n_targets; i++) {
32324
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
32325
0
    }
32326
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_col_targets, &datum);
32327
0
}
32328
32329
/* Adds the value 'new_value' to the "engine_id" set column from the "NetFlow" table
32330
 * in 'row'.
32331
 *
32332
 */
32333
void
32334
ovsrec_netflow_update_engine_id_addvalue(const struct ovsrec_netflow *row, int64_t new_value)
32335
0
{
32336
0
    struct ovsdb_datum *datum;
32337
32338
0
    datum = xmalloc(sizeof *datum);
32339
0
    datum->n = 1;
32340
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
32341
0
    datum->values = NULL;
32342
0
    datum->refcnt = NULL;
32343
32344
0
    datum->keys[0].integer = new_value;
32345
32346
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
32347
0
                                    &ovsrec_netflow_col_engine_id,
32348
0
                                    datum);
32349
0
}
32350
32351
/* Deletes the value 'delete_value' from the "engine_id" set column from the
32352
 * "NetFlow" table in 'row'.
32353
 *
32354
 */
32355
void
32356
ovsrec_netflow_update_engine_id_delvalue(const struct ovsrec_netflow *row, int64_t delete_value)
32357
0
{
32358
0
    struct ovsdb_datum *datum;
32359
32360
0
    datum = xmalloc(sizeof *datum);
32361
0
    datum->n = 1;
32362
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
32363
0
    datum->values = NULL;
32364
0
    datum->refcnt = NULL;
32365
32366
0
    datum->keys[0].integer = delete_value;
32367
32368
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
32369
0
                                    &ovsrec_netflow_col_engine_id,
32370
0
                                    datum);
32371
0
}
32372
32373
/* Adds the value 'new_value' to the "engine_type" set column from the "NetFlow" table
32374
 * in 'row'.
32375
 *
32376
 */
32377
void
32378
ovsrec_netflow_update_engine_type_addvalue(const struct ovsrec_netflow *row, int64_t new_value)
32379
0
{
32380
0
    struct ovsdb_datum *datum;
32381
32382
0
    datum = xmalloc(sizeof *datum);
32383
0
    datum->n = 1;
32384
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
32385
0
    datum->values = NULL;
32386
0
    datum->refcnt = NULL;
32387
32388
0
    datum->keys[0].integer = new_value;
32389
32390
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
32391
0
                                    &ovsrec_netflow_col_engine_type,
32392
0
                                    datum);
32393
0
}
32394
32395
/* Deletes the value 'delete_value' from the "engine_type" set column from the
32396
 * "NetFlow" table in 'row'.
32397
 *
32398
 */
32399
void
32400
ovsrec_netflow_update_engine_type_delvalue(const struct ovsrec_netflow *row, int64_t delete_value)
32401
0
{
32402
0
    struct ovsdb_datum *datum;
32403
32404
0
    datum = xmalloc(sizeof *datum);
32405
0
    datum->n = 1;
32406
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
32407
0
    datum->values = NULL;
32408
0
    datum->refcnt = NULL;
32409
32410
0
    datum->keys[0].integer = delete_value;
32411
32412
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
32413
0
                                    &ovsrec_netflow_col_engine_type,
32414
0
                                    datum);
32415
0
}
32416
32417
/* Sets an element of the "external_ids" map column from the "NetFlow" table in 'row'
32418
 * to 'new_value' given the key value 'new_key'.
32419
 *
32420
 */
32421
void
32422
ovsrec_netflow_update_external_ids_setkey(const struct ovsrec_netflow *row, const char *new_key, const char *new_value)
32423
0
{
32424
0
    struct ovsdb_datum *datum;
32425
32426
0
    datum = xmalloc(sizeof *datum);
32427
0
    datum->n = 1;
32428
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
32429
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
32430
0
    datum->refcnt = NULL;
32431
32432
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
32433
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
32434
32435
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
32436
0
                                    &ovsrec_netflow_col_external_ids,
32437
0
                                    datum);
32438
0
}
32439
32440
/* Deletes an element of the "external_ids" map column from the "NetFlow" table in 'row'
32441
 * given the key value 'delete_key'.
32442
 *
32443
 */
32444
void
32445
ovsrec_netflow_update_external_ids_delkey(const struct ovsrec_netflow *row, const char *delete_key)
32446
0
{
32447
0
    struct ovsdb_datum *datum;
32448
32449
0
    datum = xmalloc(sizeof *datum);
32450
0
    datum->n = 1;
32451
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
32452
0
    datum->values = NULL;
32453
0
    datum->refcnt = NULL;
32454
32455
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
32456
32457
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
32458
0
                                    &ovsrec_netflow_col_external_ids,
32459
0
                                    datum);
32460
0
}
32461
32462
/* Adds the value 'new_value' to the "targets" set column from the "NetFlow" table
32463
 * in 'row'.
32464
 *
32465
 */
32466
void
32467
ovsrec_netflow_update_targets_addvalue(const struct ovsrec_netflow *row, const char *new_value)
32468
0
{
32469
0
    struct ovsdb_datum *datum;
32470
32471
0
    datum = xmalloc(sizeof *datum);
32472
0
    datum->n = 1;
32473
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
32474
0
    datum->values = NULL;
32475
0
    datum->refcnt = NULL;
32476
32477
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
32478
32479
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
32480
0
                                    &ovsrec_netflow_col_targets,
32481
0
                                    datum);
32482
0
}
32483
32484
/* Deletes the value 'delete_value' from the "targets" set column from the
32485
 * "NetFlow" table in 'row'.
32486
 *
32487
 */
32488
void
32489
ovsrec_netflow_update_targets_delvalue(const struct ovsrec_netflow *row, const char *delete_value)
32490
0
{
32491
0
    struct ovsdb_datum *datum;
32492
32493
0
    datum = xmalloc(sizeof *datum);
32494
0
    datum->n = 1;
32495
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
32496
0
    datum->values = NULL;
32497
0
    datum->refcnt = NULL;
32498
32499
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
32500
32501
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
32502
0
                                    &ovsrec_netflow_col_targets,
32503
0
                                    datum);
32504
0
}
32505
32506
/* Sets the "active_timeout" column from the "NetFlow" table in 'row' to
32507
 * 'active_timeout'.
32508
 *
32509
 * Argument constraints: at least -1
32510
 *
32511
 * The caller retains ownership of the arguments. */
32512
void
32513
ovsrec_netflow_add_clause_active_timeout(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t active_timeout)
32514
0
{
32515
0
    struct ovsdb_datum datum;
32516
32517
0
    datum.refcnt = NULL;
32518
32519
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
32520
32521
0
    datum.n = 1;
32522
0
    datum.keys = key;
32523
0
    key->integer = active_timeout;
32524
0
    datum.values = NULL;
32525
0
    ovsdb_idl_condition_add_clause(cond,
32526
0
                          function,
32527
0
                          &ovsrec_netflow_col_active_timeout,
32528
0
                          &datum);
32529
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_active_timeout.type);
32530
0
}
32531
32532
/* Sets the "add_id_to_interface" column from the "NetFlow" table in 'row' to
32533
 * 'add_id_to_interface'.
32534
 *
32535
 * The caller retains ownership of the arguments. */
32536
void
32537
ovsrec_netflow_add_clause_add_id_to_interface(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool add_id_to_interface)
32538
0
{
32539
0
    struct ovsdb_datum datum;
32540
32541
0
    datum.refcnt = NULL;
32542
32543
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
32544
32545
0
    datum.n = 1;
32546
0
    datum.keys = key;
32547
0
    key->boolean = add_id_to_interface;
32548
0
    datum.values = NULL;
32549
0
    ovsdb_idl_condition_add_clause(cond,
32550
0
                          function,
32551
0
                          &ovsrec_netflow_col_add_id_to_interface,
32552
0
                          &datum);
32553
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_add_id_to_interface.type);
32554
0
}
32555
32556
/* Sets the "engine_id" column from the "NetFlow" table in 'row' to
32557
 * the 'engine_id' set with 'n_engine_id' entries.
32558
 *
32559
 * 'n_engine_id' may be 0 or 1; if it is 0, then 'engine_id'
32560
 * may be NULL.
32561
 *
32562
 * Argument constraints: in range 0 to 255
32563
 *
32564
 * The caller retains ownership of the arguments. */
32565
void
32566
ovsrec_netflow_add_clause_engine_id(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *engine_id, size_t n_engine_id)
32567
0
{
32568
0
    struct ovsdb_datum datum;
32569
32570
0
    datum.refcnt = NULL;
32571
32572
0
    if (n_engine_id) {
32573
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
32574
0
        datum.n = 1;
32575
0
        datum.keys = key;
32576
0
        key->integer = *engine_id;
32577
0
    } else {
32578
0
        datum.n = 0;
32579
0
        datum.keys = NULL;
32580
0
    }
32581
0
    datum.values = NULL;
32582
0
    ovsdb_idl_condition_add_clause(cond,
32583
0
                          function,
32584
0
                          &ovsrec_netflow_col_engine_id,
32585
0
                          &datum);
32586
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_engine_id.type);
32587
0
}
32588
32589
/* Sets the "engine_type" column from the "NetFlow" table in 'row' to
32590
 * the 'engine_type' set with 'n_engine_type' entries.
32591
 *
32592
 * 'n_engine_type' may be 0 or 1; if it is 0, then 'engine_type'
32593
 * may be NULL.
32594
 *
32595
 * Argument constraints: in range 0 to 255
32596
 *
32597
 * The caller retains ownership of the arguments. */
32598
void
32599
ovsrec_netflow_add_clause_engine_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *engine_type, size_t n_engine_type)
32600
0
{
32601
0
    struct ovsdb_datum datum;
32602
32603
0
    datum.refcnt = NULL;
32604
32605
0
    if (n_engine_type) {
32606
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
32607
0
        datum.n = 1;
32608
0
        datum.keys = key;
32609
0
        key->integer = *engine_type;
32610
0
    } else {
32611
0
        datum.n = 0;
32612
0
        datum.keys = NULL;
32613
0
    }
32614
0
    datum.values = NULL;
32615
0
    ovsdb_idl_condition_add_clause(cond,
32616
0
                          function,
32617
0
                          &ovsrec_netflow_col_engine_type,
32618
0
                          &datum);
32619
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_engine_type.type);
32620
0
}
32621
32622
/* Sets the "external_ids" column's value from the "NetFlow" table in 'row'
32623
 * to 'external_ids'.
32624
 *
32625
 * The caller retains ownership of 'external_ids' and everything in it. */
32626
void
32627
ovsrec_netflow_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
32628
0
{
32629
0
    struct ovsdb_datum datum;
32630
32631
0
    if (external_ids) {
32632
0
        ovsdb_datum_from_smap(&datum, external_ids);
32633
0
    } else {
32634
0
        ovsdb_datum_init_empty(&datum);
32635
0
    }
32636
32637
0
    ovsdb_idl_condition_add_clause(cond,
32638
0
                                   function,
32639
0
                                   &ovsrec_netflow_col_external_ids,
32640
0
                                   &datum);
32641
32642
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_external_ids.type);
32643
0
}
32644
32645
32646
/* Sets the "targets" column from the "NetFlow" table in 'row' to
32647
 * the 'targets' set with 'n_targets' entries.
32648
 *
32649
 * The caller retains ownership of the arguments. */
32650
void
32651
ovsrec_netflow_add_clause_targets(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **targets, size_t n_targets)
32652
0
{
32653
0
    struct ovsdb_datum datum;
32654
32655
0
    datum.refcnt = NULL;
32656
0
    datum.n = n_targets;
32657
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
32658
0
    datum.values = NULL;
32659
0
    for (size_t i = 0; i < n_targets; i++) {
32660
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
32661
0
    }
32662
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_netflow_col_targets.type);
32663
0
    ovsdb_idl_condition_add_clause(cond,
32664
0
                          function,
32665
0
                          &ovsrec_netflow_col_targets,
32666
0
                          &datum);
32667
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_targets.type);
32668
0
}
32669
32670
/* Destroy 'row' of kind "NetFlow". The row must have been
32671
 * created with ovsdb_idl_index_init_row.
32672
 */
32673
void
32674
ovsrec_netflow_index_destroy_row(const struct ovsrec_netflow *row)
32675
0
{
32676
0
    ovsdb_idl_index_destroy_row(&row->header_);
32677
0
}
32678
        
32679
32680
/* Creates a new row of kind "NetFlow". */
32681
struct ovsrec_netflow *
32682
ovsrec_netflow_index_init_row(struct ovsdb_idl_index *index)
32683
0
{
32684
0
    ovs_assert(index->table->class_ == &ovsrec_table_netflow);
32685
0
    return ALIGNED_CAST(struct ovsrec_netflow *, ovsdb_idl_index_init_row(index));
32686
0
}
32687
32688
struct ovsrec_netflow *
32689
ovsrec_netflow_index_find(struct ovsdb_idl_index *index, const struct ovsrec_netflow *target)
32690
0
{
32691
0
    ovs_assert(index->table->class_ == &ovsrec_table_netflow);
32692
0
    return ovsrec_netflow_cast(ovsdb_idl_index_find(index, &target->header_));
32693
0
}
32694
32695
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
32696
int
32697
ovsrec_netflow_index_compare(
32698
    struct ovsdb_idl_index *index, 
32699
    const struct ovsrec_netflow *a, 
32700
    const struct ovsrec_netflow *b)
32701
0
{
32702
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
32703
0
}
32704
32705
struct ovsdb_idl_cursor
32706
ovsrec_netflow_cursor_first(struct ovsdb_idl_index *index)
32707
0
{
32708
0
    ovs_assert(index->table->class_ == &ovsrec_table_netflow);
32709
0
    return ovsdb_idl_cursor_first(index);
32710
0
}
32711
32712
struct ovsdb_idl_cursor
32713
ovsrec_netflow_cursor_first_eq(
32714
    struct ovsdb_idl_index *index, const struct ovsrec_netflow *target)
32715
0
{
32716
0
    ovs_assert(index->table->class_ == &ovsrec_table_netflow);
32717
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
32718
0
}
32719
32720
struct ovsdb_idl_cursor
32721
ovsrec_netflow_cursor_first_ge(
32722
    struct ovsdb_idl_index *index, const struct ovsrec_netflow *target)
32723
0
{
32724
0
    ovs_assert(index->table->class_ == &ovsrec_table_netflow);
32725
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
32726
0
}
32727
32728
struct ovsrec_netflow *
32729
ovsrec_netflow_cursor_data(struct ovsdb_idl_cursor *cursor)
32730
0
{
32731
0
    return ovsrec_netflow_cast(ovsdb_idl_cursor_data(cursor));
32732
0
}
32733
32734
32735
/* Sets the "active_timeout" column from the "NetFlow" table in 'row' to
32736
 * 'active_timeout'.
32737
 *
32738
 * Argument constraints: at least -1
32739
 *
32740
 * The caller retains ownership of the arguments. */
32741
void
32742
ovsrec_netflow_index_set_active_timeout(const struct ovsrec_netflow *row, int64_t active_timeout)
32743
0
{
32744
0
    struct ovsdb_datum datum;
32745
32746
0
    datum.refcnt = NULL;
32747
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
32748
32749
0
    datum.n = 1;
32750
0
    datum.keys = key;
32751
0
    key->integer = active_timeout;
32752
0
    datum.values = NULL;
32753
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_netflow_columns[ OVSREC_NETFLOW_COL_ACTIVE_TIMEOUT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]);
32754
0
}
32755
32756
/* Sets the "add_id_to_interface" column from the "NetFlow" table in 'row' to
32757
 * 'add_id_to_interface'.
32758
 *
32759
 * The caller retains ownership of the arguments. */
32760
void
32761
ovsrec_netflow_index_set_add_id_to_interface(const struct ovsrec_netflow *row, bool add_id_to_interface)
32762
0
{
32763
0
    struct ovsdb_datum datum;
32764
32765
0
    datum.refcnt = NULL;
32766
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
32767
32768
0
    datum.n = 1;
32769
0
    datum.keys = key;
32770
0
    key->boolean = add_id_to_interface;
32771
0
    datum.values = NULL;
32772
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_netflow_columns[ OVSREC_NETFLOW_COL_ADD_ID_TO_INTERFACE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]);
32773
0
}
32774
32775
/* Sets the "engine_id" column from the "NetFlow" table in 'row' to
32776
 * the 'engine_id' set with 'n_engine_id' entries.
32777
 *
32778
 * 'n_engine_id' may be 0 or 1; if it is 0, then 'engine_id'
32779
 * may be NULL.
32780
 *
32781
 * Argument constraints: in range 0 to 255
32782
 *
32783
 * The caller retains ownership of the arguments. */
32784
void
32785
ovsrec_netflow_index_set_engine_id(const struct ovsrec_netflow *row, const int64_t *engine_id, size_t n_engine_id)
32786
0
{
32787
0
    struct ovsdb_datum datum;
32788
32789
0
    datum.refcnt = NULL;
32790
0
    union ovsdb_atom *key;
32791
32792
0
    if (n_engine_id) {
32793
0
        key = xmalloc(sizeof(union ovsdb_atom));
32794
0
        datum.n = 1;
32795
0
        datum.keys = key;
32796
0
        key->integer = *engine_id;
32797
0
    } else {
32798
0
        datum.n = 0;
32799
0
        datum.keys = NULL;
32800
0
    }
32801
0
    datum.values = NULL;
32802
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_netflow_columns[ OVSREC_NETFLOW_COL_ENGINE_ID ], &datum, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]);
32803
0
}
32804
32805
/* Sets the "engine_type" column from the "NetFlow" table in 'row' to
32806
 * the 'engine_type' set with 'n_engine_type' entries.
32807
 *
32808
 * 'n_engine_type' may be 0 or 1; if it is 0, then 'engine_type'
32809
 * may be NULL.
32810
 *
32811
 * Argument constraints: in range 0 to 255
32812
 *
32813
 * The caller retains ownership of the arguments. */
32814
void
32815
ovsrec_netflow_index_set_engine_type(const struct ovsrec_netflow *row, const int64_t *engine_type, size_t n_engine_type)
32816
0
{
32817
0
    struct ovsdb_datum datum;
32818
32819
0
    datum.refcnt = NULL;
32820
0
    union ovsdb_atom *key;
32821
32822
0
    if (n_engine_type) {
32823
0
        key = xmalloc(sizeof(union ovsdb_atom));
32824
0
        datum.n = 1;
32825
0
        datum.keys = key;
32826
0
        key->integer = *engine_type;
32827
0
    } else {
32828
0
        datum.n = 0;
32829
0
        datum.keys = NULL;
32830
0
    }
32831
0
    datum.values = NULL;
32832
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_netflow_columns[ OVSREC_NETFLOW_COL_ENGINE_TYPE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]);
32833
0
}
32834
32835
/* Sets the "external_ids" column's value from the "NetFlow" table in 'row'
32836
 * to 'external_ids'.
32837
 *
32838
 * The caller retains ownership of 'external_ids' and everything in it. */
32839
void
32840
ovsrec_netflow_index_set_external_ids(const struct ovsrec_netflow *row, const struct smap *external_ids)
32841
0
{
32842
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
32843
32844
0
    if (external_ids) {
32845
0
        struct smap_node *node;
32846
0
        size_t i;
32847
32848
0
        datum->n = smap_count(external_ids);
32849
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
32850
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
32851
0
        datum->refcnt = NULL;
32852
32853
0
        i = 0;
32854
0
        SMAP_FOR_EACH (node, external_ids) {
32855
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
32856
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
32857
0
            i++;
32858
0
        }
32859
0
        ovsdb_datum_sort_unique(datum, &ovsrec_netflow_col_external_ids.type);
32860
0
    } else {
32861
0
        ovsdb_datum_init_empty(datum);
32862
0
    }
32863
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
32864
0
                          &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_EXTERNAL_IDS],
32865
0
                          datum,
32866
0
                          &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]);
32867
0
    free(datum);
32868
0
}
32869
32870
32871
/* Sets the "targets" column from the "NetFlow" table in 'row' to
32872
 * the 'targets' set with 'n_targets' entries.
32873
 *
32874
 * The caller retains ownership of the arguments. */
32875
void
32876
ovsrec_netflow_index_set_targets(const struct ovsrec_netflow *row, const char **targets, size_t n_targets)
32877
0
{
32878
0
    struct ovsdb_datum datum;
32879
32880
0
    datum.refcnt = NULL;
32881
0
    size_t i;
32882
32883
0
    datum.n = n_targets;
32884
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
32885
0
    datum.values = NULL;
32886
0
    for (i = 0; i < n_targets; i++) {
32887
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
32888
0
    }
32889
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_netflow_col_targets.type);
32890
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_netflow_columns[ OVSREC_NETFLOW_COL_TARGETS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]);
32891
0
}
32892
32893
struct ovsdb_idl_column ovsrec_netflow_columns[OVSREC_NETFLOW_N_COLUMNS];
32894
32895
unsigned int
32896
ovsrec_netflow_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
32897
0
{
32898
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_netflow, condition);
32899
0
}
32900
32901
struct ovsdb_idl_column ovsrec_netflow_columns[OVSREC_NETFLOW_N_COLUMNS] = {
32902
    [OVSREC_NETFLOW_COL_ACTIVE_TIMEOUT] = {
32903
         .name = "active_timeout",
32904
         .type = {
32905
            .key = {
32906
               .type = OVSDB_TYPE_INTEGER,
32907
               .integer = { .min = INT64_C(-1), .max = INT64_MAX },
32908
            },
32909
            .value = OVSDB_BASE_VOID_INIT,
32910
            .n_min = 1,
32911
            .n_max = 1,
32912
         },
32913
         .is_mutable = true,
32914
         .is_synthetic = false,
32915
         .parse = ovsrec_netflow_parse_active_timeout,
32916
         .unparse = ovsrec_netflow_unparse_active_timeout,
32917
    },
32918
32919
    [OVSREC_NETFLOW_COL_ADD_ID_TO_INTERFACE] = {
32920
         .name = "add_id_to_interface",
32921
         .type = {
32922
            .key = {
32923
               .type = OVSDB_TYPE_BOOLEAN,
32924
            },
32925
            .value = OVSDB_BASE_VOID_INIT,
32926
            .n_min = 1,
32927
            .n_max = 1,
32928
         },
32929
         .is_mutable = true,
32930
         .is_synthetic = false,
32931
         .parse = ovsrec_netflow_parse_add_id_to_interface,
32932
         .unparse = ovsrec_netflow_unparse_add_id_to_interface,
32933
    },
32934
32935
    [OVSREC_NETFLOW_COL_ENGINE_ID] = {
32936
         .name = "engine_id",
32937
         .type = {
32938
            .key = {
32939
               .type = OVSDB_TYPE_INTEGER,
32940
               .integer = { .min = INT64_C(0), .max = INT64_C(255) },
32941
            },
32942
            .value = OVSDB_BASE_VOID_INIT,
32943
            .n_min = 0,
32944
            .n_max = 1,
32945
         },
32946
         .is_mutable = true,
32947
         .is_synthetic = false,
32948
         .parse = ovsrec_netflow_parse_engine_id,
32949
         .unparse = ovsrec_netflow_unparse_engine_id,
32950
    },
32951
32952
    [OVSREC_NETFLOW_COL_ENGINE_TYPE] = {
32953
         .name = "engine_type",
32954
         .type = {
32955
            .key = {
32956
               .type = OVSDB_TYPE_INTEGER,
32957
               .integer = { .min = INT64_C(0), .max = INT64_C(255) },
32958
            },
32959
            .value = OVSDB_BASE_VOID_INIT,
32960
            .n_min = 0,
32961
            .n_max = 1,
32962
         },
32963
         .is_mutable = true,
32964
         .is_synthetic = false,
32965
         .parse = ovsrec_netflow_parse_engine_type,
32966
         .unparse = ovsrec_netflow_unparse_engine_type,
32967
    },
32968
32969
    [OVSREC_NETFLOW_COL_EXTERNAL_IDS] = {
32970
         .name = "external_ids",
32971
         .type = {
32972
            .key = {
32973
               .type = OVSDB_TYPE_STRING,
32974
               .string = { .minLen = 0, .maxLen = UINT_MAX },
32975
            },
32976
            .value = {
32977
                .type = OVSDB_TYPE_STRING,
32978
                .string = { .minLen = 0, .maxLen = UINT_MAX },
32979
            },
32980
            .n_min = 0,
32981
            .n_max = UINT_MAX,
32982
         },
32983
         .is_mutable = true,
32984
         .is_synthetic = false,
32985
         .parse = ovsrec_netflow_parse_external_ids,
32986
         .unparse = ovsrec_netflow_unparse_external_ids,
32987
    },
32988
32989
    [OVSREC_NETFLOW_COL_TARGETS] = {
32990
         .name = "targets",
32991
         .type = {
32992
            .key = {
32993
               .type = OVSDB_TYPE_STRING,
32994
               .string = { .minLen = 0, .maxLen = UINT_MAX },
32995
            },
32996
            .value = OVSDB_BASE_VOID_INIT,
32997
            .n_min = 1,
32998
            .n_max = UINT_MAX,
32999
         },
33000
         .is_mutable = true,
33001
         .is_synthetic = false,
33002
         .parse = ovsrec_netflow_parse_targets,
33003
         .unparse = ovsrec_netflow_unparse_targets,
33004
    },
33005
33006
};
33007

33008
/* Open_vSwitch table. */
33009
33010
bool
33011
ovsrec_server_has_open_vswitch_table_col_bridges(const struct ovsdb_idl *idl)
33012
0
{
33013
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_bridges);
33014
0
}
33015
33016
const struct ovsdb_type *
33017
ovsrec_open_vswitch_bridges_server_type(const struct ovsdb_idl *idl)
33018
0
{
33019
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_bridges);
33020
0
}
33021
33022
33023
bool
33024
ovsrec_server_has_open_vswitch_table_col_cur_cfg(const struct ovsdb_idl *idl)
33025
0
{
33026
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_cur_cfg);
33027
0
}
33028
33029
const struct ovsdb_type *
33030
ovsrec_open_vswitch_cur_cfg_server_type(const struct ovsdb_idl *idl)
33031
0
{
33032
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_cur_cfg);
33033
0
}
33034
33035
33036
bool
33037
ovsrec_server_has_open_vswitch_table_col_datapath_types(const struct ovsdb_idl *idl)
33038
0
{
33039
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_datapath_types);
33040
0
}
33041
33042
const struct ovsdb_type *
33043
ovsrec_open_vswitch_datapath_types_server_type(const struct ovsdb_idl *idl)
33044
0
{
33045
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_datapath_types);
33046
0
}
33047
33048
33049
bool
33050
ovsrec_server_has_open_vswitch_table_col_datapaths(const struct ovsdb_idl *idl)
33051
0
{
33052
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_datapaths);
33053
0
}
33054
33055
const struct ovsdb_type *
33056
ovsrec_open_vswitch_datapaths_server_type(const struct ovsdb_idl *idl)
33057
0
{
33058
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_datapaths);
33059
0
}
33060
33061
33062
bool
33063
ovsrec_server_has_open_vswitch_table_col_db_version(const struct ovsdb_idl *idl)
33064
0
{
33065
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_db_version);
33066
0
}
33067
33068
const struct ovsdb_type *
33069
ovsrec_open_vswitch_db_version_server_type(const struct ovsdb_idl *idl)
33070
0
{
33071
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_db_version);
33072
0
}
33073
33074
33075
bool
33076
ovsrec_server_has_open_vswitch_table_col_dpdk_initialized(const struct ovsdb_idl *idl)
33077
0
{
33078
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_dpdk_initialized);
33079
0
}
33080
33081
const struct ovsdb_type *
33082
ovsrec_open_vswitch_dpdk_initialized_server_type(const struct ovsdb_idl *idl)
33083
0
{
33084
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_dpdk_initialized);
33085
0
}
33086
33087
33088
bool
33089
ovsrec_server_has_open_vswitch_table_col_dpdk_version(const struct ovsdb_idl *idl)
33090
0
{
33091
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_dpdk_version);
33092
0
}
33093
33094
const struct ovsdb_type *
33095
ovsrec_open_vswitch_dpdk_version_server_type(const struct ovsdb_idl *idl)
33096
0
{
33097
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_dpdk_version);
33098
0
}
33099
33100
33101
bool
33102
ovsrec_server_has_open_vswitch_table_col_external_ids(const struct ovsdb_idl *idl)
33103
0
{
33104
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_external_ids);
33105
0
}
33106
33107
const struct ovsdb_type *
33108
ovsrec_open_vswitch_external_ids_server_type(const struct ovsdb_idl *idl)
33109
0
{
33110
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_external_ids);
33111
0
}
33112
33113
33114
bool
33115
ovsrec_server_has_open_vswitch_table_col_iface_types(const struct ovsdb_idl *idl)
33116
0
{
33117
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_iface_types);
33118
0
}
33119
33120
const struct ovsdb_type *
33121
ovsrec_open_vswitch_iface_types_server_type(const struct ovsdb_idl *idl)
33122
0
{
33123
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_iface_types);
33124
0
}
33125
33126
33127
bool
33128
ovsrec_server_has_open_vswitch_table_col_manager_options(const struct ovsdb_idl *idl)
33129
0
{
33130
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_manager_options);
33131
0
}
33132
33133
const struct ovsdb_type *
33134
ovsrec_open_vswitch_manager_options_server_type(const struct ovsdb_idl *idl)
33135
0
{
33136
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_manager_options);
33137
0
}
33138
33139
33140
bool
33141
ovsrec_server_has_open_vswitch_table_col_next_cfg(const struct ovsdb_idl *idl)
33142
0
{
33143
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_next_cfg);
33144
0
}
33145
33146
const struct ovsdb_type *
33147
ovsrec_open_vswitch_next_cfg_server_type(const struct ovsdb_idl *idl)
33148
0
{
33149
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_next_cfg);
33150
0
}
33151
33152
33153
bool
33154
ovsrec_server_has_open_vswitch_table_col_other_config(const struct ovsdb_idl *idl)
33155
0
{
33156
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_other_config);
33157
0
}
33158
33159
const struct ovsdb_type *
33160
ovsrec_open_vswitch_other_config_server_type(const struct ovsdb_idl *idl)
33161
0
{
33162
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_other_config);
33163
0
}
33164
33165
33166
bool
33167
ovsrec_server_has_open_vswitch_table_col_ovs_version(const struct ovsdb_idl *idl)
33168
0
{
33169
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_ovs_version);
33170
0
}
33171
33172
const struct ovsdb_type *
33173
ovsrec_open_vswitch_ovs_version_server_type(const struct ovsdb_idl *idl)
33174
0
{
33175
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_ovs_version);
33176
0
}
33177
33178
33179
bool
33180
ovsrec_server_has_open_vswitch_table_col_ssl(const struct ovsdb_idl *idl)
33181
0
{
33182
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_ssl);
33183
0
}
33184
33185
const struct ovsdb_type *
33186
ovsrec_open_vswitch_ssl_server_type(const struct ovsdb_idl *idl)
33187
0
{
33188
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_ssl);
33189
0
}
33190
33191
33192
bool
33193
ovsrec_server_has_open_vswitch_table_col_statistics(const struct ovsdb_idl *idl)
33194
0
{
33195
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_statistics);
33196
0
}
33197
33198
const struct ovsdb_type *
33199
ovsrec_open_vswitch_statistics_server_type(const struct ovsdb_idl *idl)
33200
0
{
33201
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_statistics);
33202
0
}
33203
33204
33205
bool
33206
ovsrec_server_has_open_vswitch_table_col_system_type(const struct ovsdb_idl *idl)
33207
0
{
33208
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_system_type);
33209
0
}
33210
33211
const struct ovsdb_type *
33212
ovsrec_open_vswitch_system_type_server_type(const struct ovsdb_idl *idl)
33213
0
{
33214
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_system_type);
33215
0
}
33216
33217
33218
bool
33219
ovsrec_server_has_open_vswitch_table_col_system_version(const struct ovsdb_idl *idl)
33220
0
{
33221
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_system_version);
33222
0
}
33223
33224
const struct ovsdb_type *
33225
ovsrec_open_vswitch_system_version_server_type(const struct ovsdb_idl *idl)
33226
0
{
33227
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_open_vswitch_col_system_version);
33228
0
}
33229
33230
33231
bool
33232
ovsrec_server_has_open_vswitch_table(const struct ovsdb_idl *idl)
33233
0
{
33234
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
33235
0
}
33236
33237
33238
const struct ovsrec_open_vswitch_table *
33239
ovsrec_open_vswitch_table_get(const struct ovsdb_idl *idl)
33240
0
{
33241
0
    return (const struct ovsrec_open_vswitch_table *) idl;
33242
0
}
33243
33244
const struct ovsrec_open_vswitch *
33245
ovsrec_open_vswitch_table_first(const struct ovsrec_open_vswitch_table *table)
33246
0
{
33247
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
33248
0
    return ovsrec_open_vswitch_first(idl);
33249
0
}
33250
33251
33252
const struct ovsrec_open_vswitch *
33253
ovsrec_open_vswitch_table_track_get_first(const struct ovsrec_open_vswitch_table *table)
33254
0
{
33255
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
33256
0
    return ovsrec_open_vswitch_track_get_first(idl);
33257
0
}
33258
33259
33260
static void
33261
ovsrec_open_vswitch_parse_bridges(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33262
0
{
33263
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33264
0
    row->bridges = NULL;
33265
0
    row->n_bridges = 0;
33266
0
    for (size_t i = 0; i < datum->n; i++) {
33267
0
        struct ovsrec_bridge *keyRow = ovsrec_bridge_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_bridge, &datum->keys[i].uuid));
33268
0
        if (!keyRow) {
33269
0
            continue;
33270
0
        }
33271
0
        if (!row->n_bridges) {
33272
0
            row->bridges = xmalloc(datum->n * sizeof *row->bridges);
33273
0
        }
33274
0
        row->bridges[row->n_bridges] = keyRow;
33275
0
        row->n_bridges++;
33276
0
    }
33277
0
}
33278
33279
static void
33280
ovsrec_open_vswitch_parse_cur_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33281
0
{
33282
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33283
33284
0
    if (datum->n >= 1) {
33285
0
        row->cur_cfg = datum->keys[0].integer;
33286
0
    } else {
33287
0
        row->cur_cfg = 0;
33288
0
    }
33289
0
}
33290
33291
static void
33292
ovsrec_open_vswitch_parse_datapath_types(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33293
0
{
33294
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33295
0
    row->datapath_types = NULL;
33296
0
    row->n_datapath_types = 0;
33297
0
    for (size_t i = 0; i < datum->n; i++) {
33298
0
        if (!row->n_datapath_types) {
33299
0
            row->datapath_types = xmalloc(datum->n * sizeof *row->datapath_types);
33300
0
        }
33301
0
        row->datapath_types[row->n_datapath_types] = CONST_CAST(char *, json_string(datum->keys[i].s));
33302
0
        row->n_datapath_types++;
33303
0
    }
33304
0
}
33305
33306
static void
33307
ovsrec_open_vswitch_parse_datapaths(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33308
0
{
33309
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33310
0
    row->key_datapaths = NULL;
33311
0
    row->value_datapaths = NULL;
33312
0
    row->n_datapaths = 0;
33313
0
    for (size_t i = 0; i < datum->n; i++) {
33314
0
        struct ovsrec_datapath *valueRow = ovsrec_datapath_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_datapath, &datum->values[i].uuid));
33315
0
        if (!valueRow) {
33316
0
            continue;
33317
0
        }
33318
0
        if (!row->n_datapaths) {
33319
0
            row->key_datapaths = xmalloc(datum->n * sizeof *row->key_datapaths);
33320
0
            row->value_datapaths = xmalloc(datum->n * sizeof *row->value_datapaths);
33321
0
        }
33322
0
        row->key_datapaths[row->n_datapaths] = CONST_CAST(char *, json_string(datum->keys[i].s));
33323
0
        row->value_datapaths[row->n_datapaths] = valueRow;
33324
0
        row->n_datapaths++;
33325
0
    }
33326
0
}
33327
33328
static void
33329
ovsrec_open_vswitch_parse_db_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33330
0
{
33331
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33332
33333
0
    if (datum->n >= 1) {
33334
0
        row->db_version = CONST_CAST(char *, json_string(datum->keys[0].s));
33335
0
    } else {
33336
0
        row->db_version = NULL;
33337
0
    }
33338
0
}
33339
33340
static void
33341
ovsrec_open_vswitch_parse_dpdk_initialized(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33342
0
{
33343
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33344
33345
0
    if (datum->n >= 1) {
33346
0
        row->dpdk_initialized = datum->keys[0].boolean;
33347
0
    } else {
33348
0
        row->dpdk_initialized = false;
33349
0
    }
33350
0
}
33351
33352
static void
33353
ovsrec_open_vswitch_parse_dpdk_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33354
0
{
33355
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33356
33357
0
    if (datum->n >= 1) {
33358
0
        row->dpdk_version = CONST_CAST(char *, json_string(datum->keys[0].s));
33359
0
    } else {
33360
0
        row->dpdk_version = NULL;
33361
0
    }
33362
0
}
33363
33364
static void
33365
ovsrec_open_vswitch_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33366
0
{
33367
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33368
0
    smap_init(&row->external_ids);
33369
0
    for (size_t i = 0; i < datum->n; i++) {
33370
0
        smap_add(&row->external_ids,
33371
0
                 json_string(datum->keys[i].s),
33372
0
                 json_string(datum->values[i].s));
33373
0
    }
33374
0
}
33375
33376
static void
33377
ovsrec_open_vswitch_parse_iface_types(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33378
0
{
33379
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33380
0
    row->iface_types = NULL;
33381
0
    row->n_iface_types = 0;
33382
0
    for (size_t i = 0; i < datum->n; i++) {
33383
0
        if (!row->n_iface_types) {
33384
0
            row->iface_types = xmalloc(datum->n * sizeof *row->iface_types);
33385
0
        }
33386
0
        row->iface_types[row->n_iface_types] = CONST_CAST(char *, json_string(datum->keys[i].s));
33387
0
        row->n_iface_types++;
33388
0
    }
33389
0
}
33390
33391
static void
33392
ovsrec_open_vswitch_parse_manager_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33393
0
{
33394
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33395
0
    row->manager_options = NULL;
33396
0
    row->n_manager_options = 0;
33397
0
    for (size_t i = 0; i < datum->n; i++) {
33398
0
        struct ovsrec_manager *keyRow = ovsrec_manager_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_manager, &datum->keys[i].uuid));
33399
0
        if (!keyRow) {
33400
0
            continue;
33401
0
        }
33402
0
        if (!row->n_manager_options) {
33403
0
            row->manager_options = xmalloc(datum->n * sizeof *row->manager_options);
33404
0
        }
33405
0
        row->manager_options[row->n_manager_options] = keyRow;
33406
0
        row->n_manager_options++;
33407
0
    }
33408
0
}
33409
33410
static void
33411
ovsrec_open_vswitch_parse_next_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33412
0
{
33413
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33414
33415
0
    if (datum->n >= 1) {
33416
0
        row->next_cfg = datum->keys[0].integer;
33417
0
    } else {
33418
0
        row->next_cfg = 0;
33419
0
    }
33420
0
}
33421
33422
static void
33423
ovsrec_open_vswitch_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33424
0
{
33425
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33426
0
    smap_init(&row->other_config);
33427
0
    for (size_t i = 0; i < datum->n; i++) {
33428
0
        smap_add(&row->other_config,
33429
0
                 json_string(datum->keys[i].s),
33430
0
                 json_string(datum->values[i].s));
33431
0
    }
33432
0
}
33433
33434
static void
33435
ovsrec_open_vswitch_parse_ovs_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33436
0
{
33437
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33438
33439
0
    if (datum->n >= 1) {
33440
0
        row->ovs_version = CONST_CAST(char *, json_string(datum->keys[0].s));
33441
0
    } else {
33442
0
        row->ovs_version = NULL;
33443
0
    }
33444
0
}
33445
33446
static void
33447
ovsrec_open_vswitch_parse_ssl(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33448
0
{
33449
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33450
33451
0
    if (datum->n >= 1) {
33452
0
        row->ssl = ovsrec_ssl_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_ssl, &datum->keys[0].uuid));
33453
0
    } else {
33454
0
        row->ssl = NULL;
33455
0
    }
33456
0
}
33457
33458
static void
33459
ovsrec_open_vswitch_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33460
0
{
33461
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33462
0
    smap_init(&row->statistics);
33463
0
    for (size_t i = 0; i < datum->n; i++) {
33464
0
        smap_add(&row->statistics,
33465
0
                 json_string(datum->keys[i].s),
33466
0
                 json_string(datum->values[i].s));
33467
0
    }
33468
0
}
33469
33470
static void
33471
ovsrec_open_vswitch_parse_system_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33472
0
{
33473
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33474
33475
0
    if (datum->n >= 1) {
33476
0
        row->system_type = CONST_CAST(char *, json_string(datum->keys[0].s));
33477
0
    } else {
33478
0
        row->system_type = NULL;
33479
0
    }
33480
0
}
33481
33482
static void
33483
ovsrec_open_vswitch_parse_system_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
33484
0
{
33485
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33486
33487
0
    if (datum->n >= 1) {
33488
0
        row->system_version = CONST_CAST(char *, json_string(datum->keys[0].s));
33489
0
    } else {
33490
0
        row->system_version = NULL;
33491
0
    }
33492
0
}
33493
33494
static void
33495
ovsrec_open_vswitch_unparse_bridges(struct ovsdb_idl_row *row_)
33496
0
{
33497
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33498
0
    free(row->bridges);
33499
0
}
33500
33501
static void
33502
ovsrec_open_vswitch_unparse_cur_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
33503
0
{
33504
    /* Nothing to do. */
33505
0
}
33506
33507
static void
33508
ovsrec_open_vswitch_unparse_datapath_types(struct ovsdb_idl_row *row_)
33509
0
{
33510
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33511
0
    free(row->datapath_types);
33512
0
}
33513
33514
static void
33515
ovsrec_open_vswitch_unparse_datapaths(struct ovsdb_idl_row *row_)
33516
0
{
33517
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33518
0
    free(row->key_datapaths);
33519
0
    free(row->value_datapaths);
33520
0
}
33521
33522
static void
33523
ovsrec_open_vswitch_unparse_db_version(struct ovsdb_idl_row *row OVS_UNUSED)
33524
0
{
33525
    /* Nothing to do. */
33526
0
}
33527
33528
static void
33529
ovsrec_open_vswitch_unparse_dpdk_initialized(struct ovsdb_idl_row *row OVS_UNUSED)
33530
0
{
33531
    /* Nothing to do. */
33532
0
}
33533
33534
static void
33535
ovsrec_open_vswitch_unparse_dpdk_version(struct ovsdb_idl_row *row OVS_UNUSED)
33536
0
{
33537
    /* Nothing to do. */
33538
0
}
33539
33540
static void
33541
ovsrec_open_vswitch_unparse_external_ids(struct ovsdb_idl_row *row_)
33542
0
{
33543
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33544
0
    smap_destroy(&row->external_ids);
33545
0
}
33546
33547
static void
33548
ovsrec_open_vswitch_unparse_iface_types(struct ovsdb_idl_row *row_)
33549
0
{
33550
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33551
0
    free(row->iface_types);
33552
0
}
33553
33554
static void
33555
ovsrec_open_vswitch_unparse_manager_options(struct ovsdb_idl_row *row_)
33556
0
{
33557
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33558
0
    free(row->manager_options);
33559
0
}
33560
33561
static void
33562
ovsrec_open_vswitch_unparse_next_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
33563
0
{
33564
    /* Nothing to do. */
33565
0
}
33566
33567
static void
33568
ovsrec_open_vswitch_unparse_other_config(struct ovsdb_idl_row *row_)
33569
0
{
33570
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33571
0
    smap_destroy(&row->other_config);
33572
0
}
33573
33574
static void
33575
ovsrec_open_vswitch_unparse_ovs_version(struct ovsdb_idl_row *row OVS_UNUSED)
33576
0
{
33577
    /* Nothing to do. */
33578
0
}
33579
33580
static void
33581
ovsrec_open_vswitch_unparse_ssl(struct ovsdb_idl_row *row OVS_UNUSED)
33582
0
{
33583
    /* Nothing to do. */
33584
0
}
33585
33586
static void
33587
ovsrec_open_vswitch_unparse_statistics(struct ovsdb_idl_row *row_)
33588
0
{
33589
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
33590
0
    smap_destroy(&row->statistics);
33591
0
}
33592
33593
static void
33594
ovsrec_open_vswitch_unparse_system_type(struct ovsdb_idl_row *row OVS_UNUSED)
33595
0
{
33596
    /* Nothing to do. */
33597
0
}
33598
33599
static void
33600
ovsrec_open_vswitch_unparse_system_version(struct ovsdb_idl_row *row OVS_UNUSED)
33601
0
{
33602
    /* Nothing to do. */
33603
0
}
33604
33605
static void
33606
ovsrec_open_vswitch_init__(struct ovsdb_idl_row *row)
33607
0
{
33608
0
    ovsrec_open_vswitch_init(ovsrec_open_vswitch_cast(row));
33609
0
}
33610
33611
/* Clears the contents of 'row' in table "Open_vSwitch". */
33612
void
33613
ovsrec_open_vswitch_init(struct ovsrec_open_vswitch *row)
33614
0
{
33615
0
    memset(row, 0, sizeof *row); 
33616
0
    smap_init(&row->external_ids);
33617
0
    smap_init(&row->other_config);
33618
0
    smap_init(&row->statistics);
33619
0
}
33620
33621
/* Searches table "Open_vSwitch" in 'idl' for a row with UUID 'uuid'.  Returns
33622
 * a pointer to the row if there is one, otherwise a null pointer.  */
33623
const struct ovsrec_open_vswitch *
33624
ovsrec_open_vswitch_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
33625
0
{
33626
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_open_vswitch, uuid));
33627
0
}
33628
33629
/* Searches table "Open_vSwitch" for a row with UUID 'uuid'.  Returns
33630
 * a pointer to the row if there is one, otherwise a null pointer.  */
33631
const struct ovsrec_open_vswitch *
33632
ovsrec_open_vswitch_table_get_for_uuid(const struct ovsrec_open_vswitch_table *table, const struct uuid *uuid)
33633
0
{
33634
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
33635
0
    return ovsrec_open_vswitch_get_for_uuid(idl, uuid);
33636
0
}
33637
33638
/* Returns a row in table "Open_vSwitch" in 'idl', or a null pointer if that
33639
 * table is empty.
33640
 *
33641
 * Database tables are internally maintained as hash tables, so adding or
33642
 * removing rows while traversing the same table can cause some rows to be
33643
 * visited twice or not at apply. */
33644
const struct ovsrec_open_vswitch *
33645
ovsrec_open_vswitch_first(const struct ovsdb_idl *idl)
33646
0
{
33647
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_first_row(idl, &ovsrec_table_open_vswitch));
33648
0
}
33649
33650
/* Returns a row following 'row' within its table, or a null pointer if 'row'
33651
 * is the last row in its table. */
33652
const struct ovsrec_open_vswitch *
33653
ovsrec_open_vswitch_next(const struct ovsrec_open_vswitch *row)
33654
0
{
33655
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_next_row(&row->header_));
33656
0
}
33657
33658
unsigned int ovsrec_open_vswitch_get_seqno(const struct ovsdb_idl *idl)
33659
0
{
33660
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_open_vswitch);
33661
0
}
33662
33663
unsigned int ovsrec_open_vswitch_row_get_seqno(const struct ovsrec_open_vswitch *row, enum ovsdb_idl_change change)
33664
0
{
33665
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
33666
0
}
33667
33668
const struct ovsrec_open_vswitch *
33669
ovsrec_open_vswitch_track_get_first(const struct ovsdb_idl *idl)
33670
0
{
33671
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_open_vswitch));
33672
0
}
33673
33674
const struct ovsrec_open_vswitch
33675
*ovsrec_open_vswitch_track_get_next(const struct ovsrec_open_vswitch *row)
33676
0
{
33677
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_track_get_next(&row->header_));
33678
0
}
33679
33680
33681
/* Deletes 'row' from table "Open_vSwitch".  'row' may be freed, so it must not be
33682
 * accessed afterward.
33683
 *
33684
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
33685
void
33686
ovsrec_open_vswitch_delete(const struct ovsrec_open_vswitch *row)
33687
0
{
33688
0
    ovsdb_idl_txn_delete(&row->header_);
33689
0
}
33690
33691
/* Inserts and returns a new row in the table "Open_vSwitch" in the database
33692
 * with open transaction 'txn'.
33693
 *
33694
 * The new row is assigned a randomly generated provisional UUID.
33695
 * ovsdb-server will assign a different UUID when 'txn' is committed,
33696
 * but the IDL will replace any uses of the provisional UUID in the
33697
 * data to be to be committed by the UUID assigned by ovsdb-server. */
33698
struct ovsrec_open_vswitch *
33699
ovsrec_open_vswitch_insert(struct ovsdb_idl_txn *txn)
33700
0
{
33701
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_open_vswitch, NULL));
33702
0
}
33703
33704
/* Inserts and returns a new row in the table "Open_vSwitch" in the database
33705
 * with open transaction 'txn'.
33706
 *
33707
 * The new row is assigned the UUID specified in the 'uuid' parameter
33708
 * (which cannot be null).  ovsdb-server will try to assign the same
33709
 * UUID when 'txn' is committed. */
33710
struct ovsrec_open_vswitch *
33711
ovsrec_open_vswitch_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
33712
0
{
33713
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_txn_insert_persist_uuid(
33714
0
        txn, &ovsrec_table_open_vswitch, uuid));
33715
0
}
33716
33717
bool
33718
ovsrec_open_vswitch_is_updated(const struct ovsrec_open_vswitch *row, enum ovsrec_open_vswitch_column_id column)
33719
0
{
33720
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_open_vswitch_columns[column]);
33721
0
}
33722
33723
/* Causes the original contents of column "bridges" in 'row' to be
33724
 * verified as a prerequisite to completing the transaction.  That is, if
33725
 * "bridges" in 'row' changed (or if 'row' was deleted) between the
33726
 * time that the IDL originally read its contents and the time that the
33727
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
33728
 *
33729
 * The intention is that, to ensure that no transaction commits based on dirty
33730
 * reads, an application should call this function any time "bridges" is
33731
 * read as part of a read-modify-write operation.
33732
 *
33733
 * In some cases this function reduces to a no-op, because the current value
33734
 * of "bridges" is already known:
33735
 *
33736
 *   - If 'row' is a row created by the current transaction (returned by
33737
 *     ovsrec_open_vswitch_insert()).
33738
 *
33739
 *   - If "bridges" has already been modified (with
33740
 *     ovsrec_open_vswitch_set_bridges()) within the current transaction.
33741
 *
33742
 * Because of the latter property, always call this function *before*
33743
 * ovsrec_open_vswitch_set_bridges() for a given read-modify-write.
33744
 *
33745
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
33746
void
33747
ovsrec_open_vswitch_verify_bridges(const struct ovsrec_open_vswitch *row)
33748
0
{
33749
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_bridges);
33750
0
}
33751
33752
/* Causes the original contents of column "cur_cfg" in 'row' to be
33753
 * verified as a prerequisite to completing the transaction.  That is, if
33754
 * "cur_cfg" in 'row' changed (or if 'row' was deleted) between the
33755
 * time that the IDL originally read its contents and the time that the
33756
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
33757
 *
33758
 * The intention is that, to ensure that no transaction commits based on dirty
33759
 * reads, an application should call this function any time "cur_cfg" is
33760
 * read as part of a read-modify-write operation.
33761
 *
33762
 * In some cases this function reduces to a no-op, because the current value
33763
 * of "cur_cfg" is already known:
33764
 *
33765
 *   - If 'row' is a row created by the current transaction (returned by
33766
 *     ovsrec_open_vswitch_insert()).
33767
 *
33768
 *   - If "cur_cfg" has already been modified (with
33769
 *     ovsrec_open_vswitch_set_cur_cfg()) within the current transaction.
33770
 *
33771
 * Because of the latter property, always call this function *before*
33772
 * ovsrec_open_vswitch_set_cur_cfg() for a given read-modify-write.
33773
 *
33774
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
33775
void
33776
ovsrec_open_vswitch_verify_cur_cfg(const struct ovsrec_open_vswitch *row)
33777
0
{
33778
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_cur_cfg);
33779
0
}
33780
33781
/* Causes the original contents of column "datapath_types" in 'row' to be
33782
 * verified as a prerequisite to completing the transaction.  That is, if
33783
 * "datapath_types" in 'row' changed (or if 'row' was deleted) between the
33784
 * time that the IDL originally read its contents and the time that the
33785
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
33786
 *
33787
 * The intention is that, to ensure that no transaction commits based on dirty
33788
 * reads, an application should call this function any time "datapath_types" is
33789
 * read as part of a read-modify-write operation.
33790
 *
33791
 * In some cases this function reduces to a no-op, because the current value
33792
 * of "datapath_types" is already known:
33793
 *
33794
 *   - If 'row' is a row created by the current transaction (returned by
33795
 *     ovsrec_open_vswitch_insert()).
33796
 *
33797
 *   - If "datapath_types" has already been modified (with
33798
 *     ovsrec_open_vswitch_set_datapath_types()) within the current transaction.
33799
 *
33800
 * Because of the latter property, always call this function *before*
33801
 * ovsrec_open_vswitch_set_datapath_types() for a given read-modify-write.
33802
 *
33803
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
33804
void
33805
ovsrec_open_vswitch_verify_datapath_types(const struct ovsrec_open_vswitch *row)
33806
0
{
33807
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_datapath_types);
33808
0
}
33809
33810
/* Causes the original contents of column "datapaths" in 'row' to be
33811
 * verified as a prerequisite to completing the transaction.  That is, if
33812
 * "datapaths" in 'row' changed (or if 'row' was deleted) between the
33813
 * time that the IDL originally read its contents and the time that the
33814
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
33815
 *
33816
 * The intention is that, to ensure that no transaction commits based on dirty
33817
 * reads, an application should call this function any time "datapaths" is
33818
 * read as part of a read-modify-write operation.
33819
 *
33820
 * In some cases this function reduces to a no-op, because the current value
33821
 * of "datapaths" is already known:
33822
 *
33823
 *   - If 'row' is a row created by the current transaction (returned by
33824
 *     ovsrec_open_vswitch_insert()).
33825
 *
33826
 *   - If "datapaths" has already been modified (with
33827
 *     ovsrec_open_vswitch_set_datapaths()) within the current transaction.
33828
 *
33829
 * Because of the latter property, always call this function *before*
33830
 * ovsrec_open_vswitch_set_datapaths() for a given read-modify-write.
33831
 *
33832
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
33833
void
33834
ovsrec_open_vswitch_verify_datapaths(const struct ovsrec_open_vswitch *row)
33835
0
{
33836
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_datapaths);
33837
0
}
33838
33839
/* Causes the original contents of column "db_version" in 'row' to be
33840
 * verified as a prerequisite to completing the transaction.  That is, if
33841
 * "db_version" in 'row' changed (or if 'row' was deleted) between the
33842
 * time that the IDL originally read its contents and the time that the
33843
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
33844
 *
33845
 * The intention is that, to ensure that no transaction commits based on dirty
33846
 * reads, an application should call this function any time "db_version" is
33847
 * read as part of a read-modify-write operation.
33848
 *
33849
 * In some cases this function reduces to a no-op, because the current value
33850
 * of "db_version" is already known:
33851
 *
33852
 *   - If 'row' is a row created by the current transaction (returned by
33853
 *     ovsrec_open_vswitch_insert()).
33854
 *
33855
 *   - If "db_version" has already been modified (with
33856
 *     ovsrec_open_vswitch_set_db_version()) within the current transaction.
33857
 *
33858
 * Because of the latter property, always call this function *before*
33859
 * ovsrec_open_vswitch_set_db_version() for a given read-modify-write.
33860
 *
33861
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
33862
void
33863
ovsrec_open_vswitch_verify_db_version(const struct ovsrec_open_vswitch *row)
33864
0
{
33865
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_db_version);
33866
0
}
33867
33868
/* Causes the original contents of column "dpdk_initialized" in 'row' to be
33869
 * verified as a prerequisite to completing the transaction.  That is, if
33870
 * "dpdk_initialized" in 'row' changed (or if 'row' was deleted) between the
33871
 * time that the IDL originally read its contents and the time that the
33872
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
33873
 *
33874
 * The intention is that, to ensure that no transaction commits based on dirty
33875
 * reads, an application should call this function any time "dpdk_initialized" is
33876
 * read as part of a read-modify-write operation.
33877
 *
33878
 * In some cases this function reduces to a no-op, because the current value
33879
 * of "dpdk_initialized" is already known:
33880
 *
33881
 *   - If 'row' is a row created by the current transaction (returned by
33882
 *     ovsrec_open_vswitch_insert()).
33883
 *
33884
 *   - If "dpdk_initialized" has already been modified (with
33885
 *     ovsrec_open_vswitch_set_dpdk_initialized()) within the current transaction.
33886
 *
33887
 * Because of the latter property, always call this function *before*
33888
 * ovsrec_open_vswitch_set_dpdk_initialized() for a given read-modify-write.
33889
 *
33890
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
33891
void
33892
ovsrec_open_vswitch_verify_dpdk_initialized(const struct ovsrec_open_vswitch *row)
33893
0
{
33894
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_dpdk_initialized);
33895
0
}
33896
33897
/* Causes the original contents of column "dpdk_version" in 'row' to be
33898
 * verified as a prerequisite to completing the transaction.  That is, if
33899
 * "dpdk_version" in 'row' changed (or if 'row' was deleted) between the
33900
 * time that the IDL originally read its contents and the time that the
33901
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
33902
 *
33903
 * The intention is that, to ensure that no transaction commits based on dirty
33904
 * reads, an application should call this function any time "dpdk_version" is
33905
 * read as part of a read-modify-write operation.
33906
 *
33907
 * In some cases this function reduces to a no-op, because the current value
33908
 * of "dpdk_version" is already known:
33909
 *
33910
 *   - If 'row' is a row created by the current transaction (returned by
33911
 *     ovsrec_open_vswitch_insert()).
33912
 *
33913
 *   - If "dpdk_version" has already been modified (with
33914
 *     ovsrec_open_vswitch_set_dpdk_version()) within the current transaction.
33915
 *
33916
 * Because of the latter property, always call this function *before*
33917
 * ovsrec_open_vswitch_set_dpdk_version() for a given read-modify-write.
33918
 *
33919
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
33920
void
33921
ovsrec_open_vswitch_verify_dpdk_version(const struct ovsrec_open_vswitch *row)
33922
0
{
33923
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_dpdk_version);
33924
0
}
33925
33926
/* Causes the original contents of column "external_ids" in 'row' to be
33927
 * verified as a prerequisite to completing the transaction.  That is, if
33928
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
33929
 * time that the IDL originally read its contents and the time that the
33930
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
33931
 *
33932
 * The intention is that, to ensure that no transaction commits based on dirty
33933
 * reads, an application should call this function any time "external_ids" is
33934
 * read as part of a read-modify-write operation.
33935
 *
33936
 * In some cases this function reduces to a no-op, because the current value
33937
 * of "external_ids" is already known:
33938
 *
33939
 *   - If 'row' is a row created by the current transaction (returned by
33940
 *     ovsrec_open_vswitch_insert()).
33941
 *
33942
 *   - If "external_ids" has already been modified (with
33943
 *     ovsrec_open_vswitch_set_external_ids()) within the current transaction.
33944
 *
33945
 * Because of the latter property, always call this function *before*
33946
 * ovsrec_open_vswitch_set_external_ids() for a given read-modify-write.
33947
 *
33948
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
33949
void
33950
ovsrec_open_vswitch_verify_external_ids(const struct ovsrec_open_vswitch *row)
33951
0
{
33952
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_external_ids);
33953
0
}
33954
33955
/* Causes the original contents of column "iface_types" in 'row' to be
33956
 * verified as a prerequisite to completing the transaction.  That is, if
33957
 * "iface_types" in 'row' changed (or if 'row' was deleted) between the
33958
 * time that the IDL originally read its contents and the time that the
33959
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
33960
 *
33961
 * The intention is that, to ensure that no transaction commits based on dirty
33962
 * reads, an application should call this function any time "iface_types" is
33963
 * read as part of a read-modify-write operation.
33964
 *
33965
 * In some cases this function reduces to a no-op, because the current value
33966
 * of "iface_types" is already known:
33967
 *
33968
 *   - If 'row' is a row created by the current transaction (returned by
33969
 *     ovsrec_open_vswitch_insert()).
33970
 *
33971
 *   - If "iface_types" has already been modified (with
33972
 *     ovsrec_open_vswitch_set_iface_types()) within the current transaction.
33973
 *
33974
 * Because of the latter property, always call this function *before*
33975
 * ovsrec_open_vswitch_set_iface_types() for a given read-modify-write.
33976
 *
33977
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
33978
void
33979
ovsrec_open_vswitch_verify_iface_types(const struct ovsrec_open_vswitch *row)
33980
0
{
33981
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_iface_types);
33982
0
}
33983
33984
/* Causes the original contents of column "manager_options" in 'row' to be
33985
 * verified as a prerequisite to completing the transaction.  That is, if
33986
 * "manager_options" in 'row' changed (or if 'row' was deleted) between the
33987
 * time that the IDL originally read its contents and the time that the
33988
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
33989
 *
33990
 * The intention is that, to ensure that no transaction commits based on dirty
33991
 * reads, an application should call this function any time "manager_options" is
33992
 * read as part of a read-modify-write operation.
33993
 *
33994
 * In some cases this function reduces to a no-op, because the current value
33995
 * of "manager_options" is already known:
33996
 *
33997
 *   - If 'row' is a row created by the current transaction (returned by
33998
 *     ovsrec_open_vswitch_insert()).
33999
 *
34000
 *   - If "manager_options" has already been modified (with
34001
 *     ovsrec_open_vswitch_set_manager_options()) within the current transaction.
34002
 *
34003
 * Because of the latter property, always call this function *before*
34004
 * ovsrec_open_vswitch_set_manager_options() for a given read-modify-write.
34005
 *
34006
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
34007
void
34008
ovsrec_open_vswitch_verify_manager_options(const struct ovsrec_open_vswitch *row)
34009
0
{
34010
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_manager_options);
34011
0
}
34012
34013
/* Causes the original contents of column "next_cfg" in 'row' to be
34014
 * verified as a prerequisite to completing the transaction.  That is, if
34015
 * "next_cfg" in 'row' changed (or if 'row' was deleted) between the
34016
 * time that the IDL originally read its contents and the time that the
34017
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
34018
 *
34019
 * The intention is that, to ensure that no transaction commits based on dirty
34020
 * reads, an application should call this function any time "next_cfg" is
34021
 * read as part of a read-modify-write operation.
34022
 *
34023
 * In some cases this function reduces to a no-op, because the current value
34024
 * of "next_cfg" is already known:
34025
 *
34026
 *   - If 'row' is a row created by the current transaction (returned by
34027
 *     ovsrec_open_vswitch_insert()).
34028
 *
34029
 *   - If "next_cfg" has already been modified (with
34030
 *     ovsrec_open_vswitch_set_next_cfg()) within the current transaction.
34031
 *
34032
 * Because of the latter property, always call this function *before*
34033
 * ovsrec_open_vswitch_set_next_cfg() for a given read-modify-write.
34034
 *
34035
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
34036
void
34037
ovsrec_open_vswitch_verify_next_cfg(const struct ovsrec_open_vswitch *row)
34038
0
{
34039
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_next_cfg);
34040
0
}
34041
34042
/* Causes the original contents of column "other_config" in 'row' to be
34043
 * verified as a prerequisite to completing the transaction.  That is, if
34044
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
34045
 * time that the IDL originally read its contents and the time that the
34046
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
34047
 *
34048
 * The intention is that, to ensure that no transaction commits based on dirty
34049
 * reads, an application should call this function any time "other_config" is
34050
 * read as part of a read-modify-write operation.
34051
 *
34052
 * In some cases this function reduces to a no-op, because the current value
34053
 * of "other_config" is already known:
34054
 *
34055
 *   - If 'row' is a row created by the current transaction (returned by
34056
 *     ovsrec_open_vswitch_insert()).
34057
 *
34058
 *   - If "other_config" has already been modified (with
34059
 *     ovsrec_open_vswitch_set_other_config()) within the current transaction.
34060
 *
34061
 * Because of the latter property, always call this function *before*
34062
 * ovsrec_open_vswitch_set_other_config() for a given read-modify-write.
34063
 *
34064
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
34065
void
34066
ovsrec_open_vswitch_verify_other_config(const struct ovsrec_open_vswitch *row)
34067
0
{
34068
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_other_config);
34069
0
}
34070
34071
/* Causes the original contents of column "ovs_version" in 'row' to be
34072
 * verified as a prerequisite to completing the transaction.  That is, if
34073
 * "ovs_version" in 'row' changed (or if 'row' was deleted) between the
34074
 * time that the IDL originally read its contents and the time that the
34075
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
34076
 *
34077
 * The intention is that, to ensure that no transaction commits based on dirty
34078
 * reads, an application should call this function any time "ovs_version" is
34079
 * read as part of a read-modify-write operation.
34080
 *
34081
 * In some cases this function reduces to a no-op, because the current value
34082
 * of "ovs_version" is already known:
34083
 *
34084
 *   - If 'row' is a row created by the current transaction (returned by
34085
 *     ovsrec_open_vswitch_insert()).
34086
 *
34087
 *   - If "ovs_version" has already been modified (with
34088
 *     ovsrec_open_vswitch_set_ovs_version()) within the current transaction.
34089
 *
34090
 * Because of the latter property, always call this function *before*
34091
 * ovsrec_open_vswitch_set_ovs_version() for a given read-modify-write.
34092
 *
34093
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
34094
void
34095
ovsrec_open_vswitch_verify_ovs_version(const struct ovsrec_open_vswitch *row)
34096
0
{
34097
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_ovs_version);
34098
0
}
34099
34100
/* Causes the original contents of column "ssl" in 'row' to be
34101
 * verified as a prerequisite to completing the transaction.  That is, if
34102
 * "ssl" in 'row' changed (or if 'row' was deleted) between the
34103
 * time that the IDL originally read its contents and the time that the
34104
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
34105
 *
34106
 * The intention is that, to ensure that no transaction commits based on dirty
34107
 * reads, an application should call this function any time "ssl" is
34108
 * read as part of a read-modify-write operation.
34109
 *
34110
 * In some cases this function reduces to a no-op, because the current value
34111
 * of "ssl" is already known:
34112
 *
34113
 *   - If 'row' is a row created by the current transaction (returned by
34114
 *     ovsrec_open_vswitch_insert()).
34115
 *
34116
 *   - If "ssl" has already been modified (with
34117
 *     ovsrec_open_vswitch_set_ssl()) within the current transaction.
34118
 *
34119
 * Because of the latter property, always call this function *before*
34120
 * ovsrec_open_vswitch_set_ssl() for a given read-modify-write.
34121
 *
34122
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
34123
void
34124
ovsrec_open_vswitch_verify_ssl(const struct ovsrec_open_vswitch *row)
34125
0
{
34126
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_ssl);
34127
0
}
34128
34129
/* Causes the original contents of column "statistics" in 'row' to be
34130
 * verified as a prerequisite to completing the transaction.  That is, if
34131
 * "statistics" in 'row' changed (or if 'row' was deleted) between the
34132
 * time that the IDL originally read its contents and the time that the
34133
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
34134
 *
34135
 * The intention is that, to ensure that no transaction commits based on dirty
34136
 * reads, an application should call this function any time "statistics" is
34137
 * read as part of a read-modify-write operation.
34138
 *
34139
 * In some cases this function reduces to a no-op, because the current value
34140
 * of "statistics" is already known:
34141
 *
34142
 *   - If 'row' is a row created by the current transaction (returned by
34143
 *     ovsrec_open_vswitch_insert()).
34144
 *
34145
 *   - If "statistics" has already been modified (with
34146
 *     ovsrec_open_vswitch_set_statistics()) within the current transaction.
34147
 *
34148
 * Because of the latter property, always call this function *before*
34149
 * ovsrec_open_vswitch_set_statistics() for a given read-modify-write.
34150
 *
34151
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
34152
void
34153
ovsrec_open_vswitch_verify_statistics(const struct ovsrec_open_vswitch *row)
34154
0
{
34155
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_statistics);
34156
0
}
34157
34158
/* Causes the original contents of column "system_type" in 'row' to be
34159
 * verified as a prerequisite to completing the transaction.  That is, if
34160
 * "system_type" in 'row' changed (or if 'row' was deleted) between the
34161
 * time that the IDL originally read its contents and the time that the
34162
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
34163
 *
34164
 * The intention is that, to ensure that no transaction commits based on dirty
34165
 * reads, an application should call this function any time "system_type" is
34166
 * read as part of a read-modify-write operation.
34167
 *
34168
 * In some cases this function reduces to a no-op, because the current value
34169
 * of "system_type" is already known:
34170
 *
34171
 *   - If 'row' is a row created by the current transaction (returned by
34172
 *     ovsrec_open_vswitch_insert()).
34173
 *
34174
 *   - If "system_type" has already been modified (with
34175
 *     ovsrec_open_vswitch_set_system_type()) within the current transaction.
34176
 *
34177
 * Because of the latter property, always call this function *before*
34178
 * ovsrec_open_vswitch_set_system_type() for a given read-modify-write.
34179
 *
34180
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
34181
void
34182
ovsrec_open_vswitch_verify_system_type(const struct ovsrec_open_vswitch *row)
34183
0
{
34184
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_system_type);
34185
0
}
34186
34187
/* Causes the original contents of column "system_version" in 'row' to be
34188
 * verified as a prerequisite to completing the transaction.  That is, if
34189
 * "system_version" in 'row' changed (or if 'row' was deleted) between the
34190
 * time that the IDL originally read its contents and the time that the
34191
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
34192
 *
34193
 * The intention is that, to ensure that no transaction commits based on dirty
34194
 * reads, an application should call this function any time "system_version" is
34195
 * read as part of a read-modify-write operation.
34196
 *
34197
 * In some cases this function reduces to a no-op, because the current value
34198
 * of "system_version" is already known:
34199
 *
34200
 *   - If 'row' is a row created by the current transaction (returned by
34201
 *     ovsrec_open_vswitch_insert()).
34202
 *
34203
 *   - If "system_version" has already been modified (with
34204
 *     ovsrec_open_vswitch_set_system_version()) within the current transaction.
34205
 *
34206
 * Because of the latter property, always call this function *before*
34207
 * ovsrec_open_vswitch_set_system_version() for a given read-modify-write.
34208
 *
34209
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
34210
void
34211
ovsrec_open_vswitch_verify_system_version(const struct ovsrec_open_vswitch *row)
34212
0
{
34213
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_system_version);
34214
0
}
34215
34216
/* Returns the "bridges" column's value from the "Open_vSwitch" table in 'row'
34217
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34218
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34219
 * for a given key than implementing the same operation on the "cooked"
34220
 * form in 'row'.
34221
 *
34222
 * 'key_type' must be OVSDB_TYPE_UUID.
34223
 * (This helps to avoid silent bugs if someone changes bridges's
34224
 * type without updating the caller.)
34225
 *
34226
 * The caller must not modify or free the returned value.
34227
 *
34228
 * Various kinds of changes can invalidate the returned value: modifying
34229
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34230
 * If the returned value is needed for a long time, it is best to make a copy
34231
 * of it with ovsdb_datum_clone().
34232
 *
34233
 * This function is rarely useful, since it is easier to access the value
34234
 * directly through the "bridges" member in ovsrec_open_vswitch. */
34235
const struct ovsdb_datum *
34236
ovsrec_open_vswitch_get_bridges(const struct ovsrec_open_vswitch *row,
34237
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34238
0
{
34239
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
34240
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_bridges);
34241
0
}
34242
34243
/* Returns the "cur_cfg" column's value from the "Open_vSwitch" table in 'row'
34244
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34245
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34246
 * for a given key than implementing the same operation on the "cooked"
34247
 * form in 'row'.
34248
 *
34249
 * 'key_type' must be OVSDB_TYPE_INTEGER.
34250
 * (This helps to avoid silent bugs if someone changes cur_cfg's
34251
 * type without updating the caller.)
34252
 *
34253
 * The caller must not modify or free the returned value.
34254
 *
34255
 * Various kinds of changes can invalidate the returned value: modifying
34256
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34257
 * If the returned value is needed for a long time, it is best to make a copy
34258
 * of it with ovsdb_datum_clone().
34259
 *
34260
 * This function is rarely useful, since it is easier to access the value
34261
 * directly through the "cur_cfg" member in ovsrec_open_vswitch. */
34262
const struct ovsdb_datum *
34263
ovsrec_open_vswitch_get_cur_cfg(const struct ovsrec_open_vswitch *row,
34264
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34265
0
{
34266
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
34267
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_cur_cfg);
34268
0
}
34269
34270
/* Returns the "datapath_types" column's value from the "Open_vSwitch" table in 'row'
34271
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34272
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34273
 * for a given key than implementing the same operation on the "cooked"
34274
 * form in 'row'.
34275
 *
34276
 * 'key_type' must be OVSDB_TYPE_STRING.
34277
 * (This helps to avoid silent bugs if someone changes datapath_types's
34278
 * type without updating the caller.)
34279
 *
34280
 * The caller must not modify or free the returned value.
34281
 *
34282
 * Various kinds of changes can invalidate the returned value: modifying
34283
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34284
 * If the returned value is needed for a long time, it is best to make a copy
34285
 * of it with ovsdb_datum_clone().
34286
 *
34287
 * This function is rarely useful, since it is easier to access the value
34288
 * directly through the "datapath_types" member in ovsrec_open_vswitch. */
34289
const struct ovsdb_datum *
34290
ovsrec_open_vswitch_get_datapath_types(const struct ovsrec_open_vswitch *row,
34291
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34292
0
{
34293
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34294
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_datapath_types);
34295
0
}
34296
34297
/* Returns the "datapaths" column's value from the "Open_vSwitch" table in 'row'
34298
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34299
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34300
 * for a given key than implementing the same operation on the "cooked"
34301
 * form in 'row'.
34302
 *
34303
 * 'key_type' must be OVSDB_TYPE_STRING.
34304
 * 'value_type' must be OVSDB_TYPE_UUID.
34305
 * (This helps to avoid silent bugs if someone changes datapaths's
34306
 * type without updating the caller.)
34307
 *
34308
 * The caller must not modify or free the returned value.
34309
 *
34310
 * Various kinds of changes can invalidate the returned value: modifying
34311
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34312
 * If the returned value is needed for a long time, it is best to make a copy
34313
 * of it with ovsdb_datum_clone().
34314
 *
34315
 * This function is rarely useful, since it is easier to access the value
34316
 * directly through the "datapaths" member in ovsrec_open_vswitch. */
34317
const struct ovsdb_datum *
34318
ovsrec_open_vswitch_get_datapaths(const struct ovsrec_open_vswitch *row,
34319
  enum ovsdb_atomic_type key_type OVS_UNUSED,
34320
  enum ovsdb_atomic_type value_type OVS_UNUSED)
34321
0
{
34322
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34323
0
    ovs_assert(value_type == OVSDB_TYPE_UUID);
34324
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_datapaths);
34325
0
}
34326
34327
/* Returns the "db_version" column's value from the "Open_vSwitch" table in 'row'
34328
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34329
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34330
 * for a given key than implementing the same operation on the "cooked"
34331
 * form in 'row'.
34332
 *
34333
 * 'key_type' must be OVSDB_TYPE_STRING.
34334
 * (This helps to avoid silent bugs if someone changes db_version's
34335
 * type without updating the caller.)
34336
 *
34337
 * The caller must not modify or free the returned value.
34338
 *
34339
 * Various kinds of changes can invalidate the returned value: modifying
34340
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34341
 * If the returned value is needed for a long time, it is best to make a copy
34342
 * of it with ovsdb_datum_clone().
34343
 *
34344
 * This function is rarely useful, since it is easier to access the value
34345
 * directly through the "db_version" member in ovsrec_open_vswitch. */
34346
const struct ovsdb_datum *
34347
ovsrec_open_vswitch_get_db_version(const struct ovsrec_open_vswitch *row,
34348
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34349
0
{
34350
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34351
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_db_version);
34352
0
}
34353
34354
/* Returns the "dpdk_initialized" column's value from the "Open_vSwitch" table in 'row'
34355
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34356
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34357
 * for a given key than implementing the same operation on the "cooked"
34358
 * form in 'row'.
34359
 *
34360
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
34361
 * (This helps to avoid silent bugs if someone changes dpdk_initialized's
34362
 * type without updating the caller.)
34363
 *
34364
 * The caller must not modify or free the returned value.
34365
 *
34366
 * Various kinds of changes can invalidate the returned value: modifying
34367
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34368
 * If the returned value is needed for a long time, it is best to make a copy
34369
 * of it with ovsdb_datum_clone().
34370
 *
34371
 * This function is rarely useful, since it is easier to access the value
34372
 * directly through the "dpdk_initialized" member in ovsrec_open_vswitch. */
34373
const struct ovsdb_datum *
34374
ovsrec_open_vswitch_get_dpdk_initialized(const struct ovsrec_open_vswitch *row,
34375
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34376
0
{
34377
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
34378
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_dpdk_initialized);
34379
0
}
34380
34381
/* Returns the "dpdk_version" column's value from the "Open_vSwitch" table in 'row'
34382
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34383
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34384
 * for a given key than implementing the same operation on the "cooked"
34385
 * form in 'row'.
34386
 *
34387
 * 'key_type' must be OVSDB_TYPE_STRING.
34388
 * (This helps to avoid silent bugs if someone changes dpdk_version's
34389
 * type without updating the caller.)
34390
 *
34391
 * The caller must not modify or free the returned value.
34392
 *
34393
 * Various kinds of changes can invalidate the returned value: modifying
34394
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34395
 * If the returned value is needed for a long time, it is best to make a copy
34396
 * of it with ovsdb_datum_clone().
34397
 *
34398
 * This function is rarely useful, since it is easier to access the value
34399
 * directly through the "dpdk_version" member in ovsrec_open_vswitch. */
34400
const struct ovsdb_datum *
34401
ovsrec_open_vswitch_get_dpdk_version(const struct ovsrec_open_vswitch *row,
34402
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34403
0
{
34404
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34405
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_dpdk_version);
34406
0
}
34407
34408
/* Returns the "external_ids" column's value from the "Open_vSwitch" table in 'row'
34409
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34410
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34411
 * for a given key than implementing the same operation on the "cooked"
34412
 * form in 'row'.
34413
 *
34414
 * 'key_type' must be OVSDB_TYPE_STRING.
34415
 * 'value_type' must be OVSDB_TYPE_STRING.
34416
 * (This helps to avoid silent bugs if someone changes external_ids's
34417
 * type without updating the caller.)
34418
 *
34419
 * The caller must not modify or free the returned value.
34420
 *
34421
 * Various kinds of changes can invalidate the returned value: modifying
34422
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34423
 * If the returned value is needed for a long time, it is best to make a copy
34424
 * of it with ovsdb_datum_clone().
34425
 *
34426
 * This function is rarely useful, since it is easier to access the value
34427
 * directly through the "external_ids" member in ovsrec_open_vswitch. */
34428
const struct ovsdb_datum *
34429
ovsrec_open_vswitch_get_external_ids(const struct ovsrec_open_vswitch *row,
34430
  enum ovsdb_atomic_type key_type OVS_UNUSED,
34431
  enum ovsdb_atomic_type value_type OVS_UNUSED)
34432
0
{
34433
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34434
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
34435
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_external_ids);
34436
0
}
34437
34438
/* Returns the "iface_types" column's value from the "Open_vSwitch" table in 'row'
34439
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34440
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34441
 * for a given key than implementing the same operation on the "cooked"
34442
 * form in 'row'.
34443
 *
34444
 * 'key_type' must be OVSDB_TYPE_STRING.
34445
 * (This helps to avoid silent bugs if someone changes iface_types's
34446
 * type without updating the caller.)
34447
 *
34448
 * The caller must not modify or free the returned value.
34449
 *
34450
 * Various kinds of changes can invalidate the returned value: modifying
34451
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34452
 * If the returned value is needed for a long time, it is best to make a copy
34453
 * of it with ovsdb_datum_clone().
34454
 *
34455
 * This function is rarely useful, since it is easier to access the value
34456
 * directly through the "iface_types" member in ovsrec_open_vswitch. */
34457
const struct ovsdb_datum *
34458
ovsrec_open_vswitch_get_iface_types(const struct ovsrec_open_vswitch *row,
34459
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34460
0
{
34461
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34462
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_iface_types);
34463
0
}
34464
34465
/* Returns the "manager_options" column's value from the "Open_vSwitch" table in 'row'
34466
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34467
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34468
 * for a given key than implementing the same operation on the "cooked"
34469
 * form in 'row'.
34470
 *
34471
 * 'key_type' must be OVSDB_TYPE_UUID.
34472
 * (This helps to avoid silent bugs if someone changes manager_options's
34473
 * type without updating the caller.)
34474
 *
34475
 * The caller must not modify or free the returned value.
34476
 *
34477
 * Various kinds of changes can invalidate the returned value: modifying
34478
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34479
 * If the returned value is needed for a long time, it is best to make a copy
34480
 * of it with ovsdb_datum_clone().
34481
 *
34482
 * This function is rarely useful, since it is easier to access the value
34483
 * directly through the "manager_options" member in ovsrec_open_vswitch. */
34484
const struct ovsdb_datum *
34485
ovsrec_open_vswitch_get_manager_options(const struct ovsrec_open_vswitch *row,
34486
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34487
0
{
34488
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
34489
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_manager_options);
34490
0
}
34491
34492
/* Returns the "next_cfg" column's value from the "Open_vSwitch" table in 'row'
34493
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34494
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34495
 * for a given key than implementing the same operation on the "cooked"
34496
 * form in 'row'.
34497
 *
34498
 * 'key_type' must be OVSDB_TYPE_INTEGER.
34499
 * (This helps to avoid silent bugs if someone changes next_cfg's
34500
 * type without updating the caller.)
34501
 *
34502
 * The caller must not modify or free the returned value.
34503
 *
34504
 * Various kinds of changes can invalidate the returned value: modifying
34505
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34506
 * If the returned value is needed for a long time, it is best to make a copy
34507
 * of it with ovsdb_datum_clone().
34508
 *
34509
 * This function is rarely useful, since it is easier to access the value
34510
 * directly through the "next_cfg" member in ovsrec_open_vswitch. */
34511
const struct ovsdb_datum *
34512
ovsrec_open_vswitch_get_next_cfg(const struct ovsrec_open_vswitch *row,
34513
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34514
0
{
34515
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
34516
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_next_cfg);
34517
0
}
34518
34519
/* Returns the "other_config" column's value from the "Open_vSwitch" table in 'row'
34520
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34521
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34522
 * for a given key than implementing the same operation on the "cooked"
34523
 * form in 'row'.
34524
 *
34525
 * 'key_type' must be OVSDB_TYPE_STRING.
34526
 * 'value_type' must be OVSDB_TYPE_STRING.
34527
 * (This helps to avoid silent bugs if someone changes other_config's
34528
 * type without updating the caller.)
34529
 *
34530
 * The caller must not modify or free the returned value.
34531
 *
34532
 * Various kinds of changes can invalidate the returned value: modifying
34533
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34534
 * If the returned value is needed for a long time, it is best to make a copy
34535
 * of it with ovsdb_datum_clone().
34536
 *
34537
 * This function is rarely useful, since it is easier to access the value
34538
 * directly through the "other_config" member in ovsrec_open_vswitch. */
34539
const struct ovsdb_datum *
34540
ovsrec_open_vswitch_get_other_config(const struct ovsrec_open_vswitch *row,
34541
  enum ovsdb_atomic_type key_type OVS_UNUSED,
34542
  enum ovsdb_atomic_type value_type OVS_UNUSED)
34543
0
{
34544
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34545
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
34546
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_other_config);
34547
0
}
34548
34549
/* Returns the "ovs_version" column's value from the "Open_vSwitch" table in 'row'
34550
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34551
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34552
 * for a given key than implementing the same operation on the "cooked"
34553
 * form in 'row'.
34554
 *
34555
 * 'key_type' must be OVSDB_TYPE_STRING.
34556
 * (This helps to avoid silent bugs if someone changes ovs_version's
34557
 * type without updating the caller.)
34558
 *
34559
 * The caller must not modify or free the returned value.
34560
 *
34561
 * Various kinds of changes can invalidate the returned value: modifying
34562
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34563
 * If the returned value is needed for a long time, it is best to make a copy
34564
 * of it with ovsdb_datum_clone().
34565
 *
34566
 * This function is rarely useful, since it is easier to access the value
34567
 * directly through the "ovs_version" member in ovsrec_open_vswitch. */
34568
const struct ovsdb_datum *
34569
ovsrec_open_vswitch_get_ovs_version(const struct ovsrec_open_vswitch *row,
34570
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34571
0
{
34572
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34573
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_ovs_version);
34574
0
}
34575
34576
/* Returns the "ssl" column's value from the "Open_vSwitch" table in 'row'
34577
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34578
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34579
 * for a given key than implementing the same operation on the "cooked"
34580
 * form in 'row'.
34581
 *
34582
 * 'key_type' must be OVSDB_TYPE_UUID.
34583
 * (This helps to avoid silent bugs if someone changes ssl's
34584
 * type without updating the caller.)
34585
 *
34586
 * The caller must not modify or free the returned value.
34587
 *
34588
 * Various kinds of changes can invalidate the returned value: modifying
34589
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34590
 * If the returned value is needed for a long time, it is best to make a copy
34591
 * of it with ovsdb_datum_clone().
34592
 *
34593
 * This function is rarely useful, since it is easier to access the value
34594
 * directly through the "ssl" member in ovsrec_open_vswitch. */
34595
const struct ovsdb_datum *
34596
ovsrec_open_vswitch_get_ssl(const struct ovsrec_open_vswitch *row,
34597
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34598
0
{
34599
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
34600
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_ssl);
34601
0
}
34602
34603
/* Returns the "statistics" column's value from the "Open_vSwitch" table in 'row'
34604
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34605
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34606
 * for a given key than implementing the same operation on the "cooked"
34607
 * form in 'row'.
34608
 *
34609
 * 'key_type' must be OVSDB_TYPE_STRING.
34610
 * 'value_type' must be OVSDB_TYPE_STRING.
34611
 * (This helps to avoid silent bugs if someone changes statistics's
34612
 * type without updating the caller.)
34613
 *
34614
 * The caller must not modify or free the returned value.
34615
 *
34616
 * Various kinds of changes can invalidate the returned value: modifying
34617
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34618
 * If the returned value is needed for a long time, it is best to make a copy
34619
 * of it with ovsdb_datum_clone().
34620
 *
34621
 * This function is rarely useful, since it is easier to access the value
34622
 * directly through the "statistics" member in ovsrec_open_vswitch. */
34623
const struct ovsdb_datum *
34624
ovsrec_open_vswitch_get_statistics(const struct ovsrec_open_vswitch *row,
34625
  enum ovsdb_atomic_type key_type OVS_UNUSED,
34626
  enum ovsdb_atomic_type value_type OVS_UNUSED)
34627
0
{
34628
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34629
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
34630
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_statistics);
34631
0
}
34632
34633
/* Returns the "system_type" column's value from the "Open_vSwitch" table in 'row'
34634
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34635
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34636
 * for a given key than implementing the same operation on the "cooked"
34637
 * form in 'row'.
34638
 *
34639
 * 'key_type' must be OVSDB_TYPE_STRING.
34640
 * (This helps to avoid silent bugs if someone changes system_type's
34641
 * type without updating the caller.)
34642
 *
34643
 * The caller must not modify or free the returned value.
34644
 *
34645
 * Various kinds of changes can invalidate the returned value: modifying
34646
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34647
 * If the returned value is needed for a long time, it is best to make a copy
34648
 * of it with ovsdb_datum_clone().
34649
 *
34650
 * This function is rarely useful, since it is easier to access the value
34651
 * directly through the "system_type" member in ovsrec_open_vswitch. */
34652
const struct ovsdb_datum *
34653
ovsrec_open_vswitch_get_system_type(const struct ovsrec_open_vswitch *row,
34654
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34655
0
{
34656
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34657
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_system_type);
34658
0
}
34659
34660
/* Returns the "system_version" column's value from the "Open_vSwitch" table in 'row'
34661
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
34662
 * ovsdb_datum_find_key() is an easier and more efficient way to search
34663
 * for a given key than implementing the same operation on the "cooked"
34664
 * form in 'row'.
34665
 *
34666
 * 'key_type' must be OVSDB_TYPE_STRING.
34667
 * (This helps to avoid silent bugs if someone changes system_version's
34668
 * type without updating the caller.)
34669
 *
34670
 * The caller must not modify or free the returned value.
34671
 *
34672
 * Various kinds of changes can invalidate the returned value: modifying
34673
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
34674
 * If the returned value is needed for a long time, it is best to make a copy
34675
 * of it with ovsdb_datum_clone().
34676
 *
34677
 * This function is rarely useful, since it is easier to access the value
34678
 * directly through the "system_version" member in ovsrec_open_vswitch. */
34679
const struct ovsdb_datum *
34680
ovsrec_open_vswitch_get_system_version(const struct ovsrec_open_vswitch *row,
34681
  enum ovsdb_atomic_type key_type OVS_UNUSED)
34682
0
{
34683
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
34684
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_system_version);
34685
0
}
34686
34687
/* Sets the "bridges" column from the "Open_vSwitch" table in 'row' to
34688
 * the 'bridges' set with 'n_bridges' entries.
34689
 *
34690
 * The caller retains ownership of the arguments. */
34691
void
34692
ovsrec_open_vswitch_set_bridges(const struct ovsrec_open_vswitch *row, struct ovsrec_bridge **bridges, size_t n_bridges)
34693
0
{
34694
0
    struct ovsdb_datum datum;
34695
34696
0
    datum.refcnt = NULL;
34697
34698
0
    datum.n = n_bridges;
34699
0
    datum.keys = n_bridges ? xmalloc(n_bridges * sizeof *datum.keys) : NULL;
34700
0
    datum.values = NULL;
34701
0
    for (size_t i = 0; i < n_bridges; i++) {
34702
0
        datum.keys[i].uuid = bridges[i]->header_.uuid;
34703
0
    }
34704
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_bridges, &datum);
34705
0
}
34706
34707
/* Sets the "cur_cfg" column from the "Open_vSwitch" table in 'row' to
34708
 * 'cur_cfg'.
34709
 *
34710
 * The caller retains ownership of the arguments. */
34711
void
34712
ovsrec_open_vswitch_set_cur_cfg(const struct ovsrec_open_vswitch *row, int64_t cur_cfg)
34713
0
{
34714
0
    struct ovsdb_datum datum;
34715
34716
0
    datum.refcnt = NULL;
34717
34718
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
34719
34720
0
    datum.n = 1;
34721
0
    datum.keys = key;
34722
0
    key->integer = cur_cfg;
34723
0
    datum.values = NULL;
34724
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_cur_cfg, &datum);
34725
0
}
34726
34727
/* Sets the "datapath_types" column from the "Open_vSwitch" table in 'row' to
34728
 * the 'datapath_types' set with 'n_datapath_types' entries.
34729
 *
34730
 * The caller retains ownership of the arguments. */
34731
void
34732
ovsrec_open_vswitch_set_datapath_types(const struct ovsrec_open_vswitch *row, const char **datapath_types, size_t n_datapath_types)
34733
0
{
34734
0
    struct ovsdb_datum datum;
34735
34736
0
    datum.refcnt = NULL;
34737
34738
0
    datum.n = n_datapath_types;
34739
0
    datum.keys = n_datapath_types ? xmalloc(n_datapath_types * sizeof *datum.keys) : NULL;
34740
0
    datum.values = NULL;
34741
0
    for (size_t i = 0; i < n_datapath_types; i++) {
34742
0
        datum.keys[i].s = ovsdb_atom_string_create(datapath_types[i]);
34743
0
    }
34744
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_datapath_types, &datum);
34745
0
}
34746
34747
/* Sets the "datapaths" column from the "Open_vSwitch" table in 'row' to
34748
 * the map with keys 'key_datapaths' and values 'value_datapaths'
34749
 * with 'n_datapaths' entries.
34750
 *
34751
 * The caller retains ownership of the arguments. */
34752
void
34753
ovsrec_open_vswitch_set_datapaths(const struct ovsrec_open_vswitch *row, const char **key_datapaths, struct ovsrec_datapath **value_datapaths, size_t n_datapaths)
34754
0
{
34755
0
    struct ovsdb_datum datum;
34756
34757
0
    datum.refcnt = NULL;
34758
34759
0
    datum.n = n_datapaths;
34760
0
    datum.keys = n_datapaths ? xmalloc(n_datapaths * sizeof *datum.keys) : NULL;
34761
0
    datum.values = xmalloc(n_datapaths * sizeof *datum.values);
34762
0
    for (size_t i = 0; i < n_datapaths; i++) {
34763
0
        datum.keys[i].s = ovsdb_atom_string_create(key_datapaths[i]);
34764
0
        datum.values[i].uuid = value_datapaths[i]->header_.uuid;
34765
0
    }
34766
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_datapaths, &datum);
34767
0
}
34768
34769
/* Sets the "db_version" column from the "Open_vSwitch" table in 'row' to
34770
 * the 'db_version' set.
34771
 *
34772
 * If "db_version" is null, the column will be the empty set,
34773
 * otherwise it will contain the specified value.
34774
 *
34775
 * The caller retains ownership of the arguments. */
34776
void
34777
ovsrec_open_vswitch_set_db_version(const struct ovsrec_open_vswitch *row, const char *db_version)
34778
0
{
34779
0
    struct ovsdb_datum datum;
34780
34781
0
    datum.refcnt = NULL;
34782
34783
0
    if (db_version) {
34784
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
34785
0
        datum.n = 1;
34786
0
        datum.keys = key;
34787
0
        key->s = ovsdb_atom_string_create(db_version);
34788
0
    } else {
34789
0
        datum.n = 0;
34790
0
        datum.keys = NULL;
34791
0
    }
34792
0
    datum.values = NULL;
34793
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_db_version, &datum);
34794
0
}
34795
34796
/* Sets the "dpdk_initialized" column from the "Open_vSwitch" table in 'row' to
34797
 * 'dpdk_initialized'.
34798
 *
34799
 * The caller retains ownership of the arguments. */
34800
void
34801
ovsrec_open_vswitch_set_dpdk_initialized(const struct ovsrec_open_vswitch *row, bool dpdk_initialized)
34802
0
{
34803
0
    struct ovsdb_datum datum;
34804
34805
0
    datum.refcnt = NULL;
34806
34807
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
34808
34809
0
    datum.n = 1;
34810
0
    datum.keys = key;
34811
0
    key->boolean = dpdk_initialized;
34812
0
    datum.values = NULL;
34813
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_dpdk_initialized, &datum);
34814
0
}
34815
34816
/* Sets the "dpdk_version" column from the "Open_vSwitch" table in 'row' to
34817
 * the 'dpdk_version' set.
34818
 *
34819
 * If "dpdk_version" is null, the column will be the empty set,
34820
 * otherwise it will contain the specified value.
34821
 *
34822
 * The caller retains ownership of the arguments. */
34823
void
34824
ovsrec_open_vswitch_set_dpdk_version(const struct ovsrec_open_vswitch *row, const char *dpdk_version)
34825
0
{
34826
0
    struct ovsdb_datum datum;
34827
34828
0
    datum.refcnt = NULL;
34829
34830
0
    if (dpdk_version) {
34831
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
34832
0
        datum.n = 1;
34833
0
        datum.keys = key;
34834
0
        key->s = ovsdb_atom_string_create(dpdk_version);
34835
0
    } else {
34836
0
        datum.n = 0;
34837
0
        datum.keys = NULL;
34838
0
    }
34839
0
    datum.values = NULL;
34840
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_dpdk_version, &datum);
34841
0
}
34842
34843
/* Sets the "external_ids" column's value from the "Open_vSwitch" table in 'row'
34844
 * to 'external_ids'.
34845
 *
34846
 * The caller retains ownership of 'external_ids' and everything in it. */
34847
void
34848
ovsrec_open_vswitch_set_external_ids(const struct ovsrec_open_vswitch *row, const struct smap *external_ids)
34849
0
{
34850
0
    struct ovsdb_datum datum;
34851
34852
0
    if (external_ids) {
34853
0
        ovsdb_datum_from_smap(&datum, external_ids);
34854
0
    } else {
34855
0
        ovsdb_datum_init_empty(&datum);
34856
0
    }
34857
0
    ovsdb_idl_txn_write(&row->header_,
34858
0
                        &ovsrec_open_vswitch_col_external_ids,
34859
0
                        &datum);
34860
0
}
34861
34862
34863
/* Sets the "iface_types" column from the "Open_vSwitch" table in 'row' to
34864
 * the 'iface_types' set with 'n_iface_types' entries.
34865
 *
34866
 * The caller retains ownership of the arguments. */
34867
void
34868
ovsrec_open_vswitch_set_iface_types(const struct ovsrec_open_vswitch *row, const char **iface_types, size_t n_iface_types)
34869
0
{
34870
0
    struct ovsdb_datum datum;
34871
34872
0
    datum.refcnt = NULL;
34873
34874
0
    datum.n = n_iface_types;
34875
0
    datum.keys = n_iface_types ? xmalloc(n_iface_types * sizeof *datum.keys) : NULL;
34876
0
    datum.values = NULL;
34877
0
    for (size_t i = 0; i < n_iface_types; i++) {
34878
0
        datum.keys[i].s = ovsdb_atom_string_create(iface_types[i]);
34879
0
    }
34880
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_iface_types, &datum);
34881
0
}
34882
34883
/* Sets the "manager_options" column from the "Open_vSwitch" table in 'row' to
34884
 * the 'manager_options' set with 'n_manager_options' entries.
34885
 *
34886
 * The caller retains ownership of the arguments. */
34887
void
34888
ovsrec_open_vswitch_set_manager_options(const struct ovsrec_open_vswitch *row, struct ovsrec_manager **manager_options, size_t n_manager_options)
34889
0
{
34890
0
    struct ovsdb_datum datum;
34891
34892
0
    datum.refcnt = NULL;
34893
34894
0
    datum.n = n_manager_options;
34895
0
    datum.keys = n_manager_options ? xmalloc(n_manager_options * sizeof *datum.keys) : NULL;
34896
0
    datum.values = NULL;
34897
0
    for (size_t i = 0; i < n_manager_options; i++) {
34898
0
        datum.keys[i].uuid = manager_options[i]->header_.uuid;
34899
0
    }
34900
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_manager_options, &datum);
34901
0
}
34902
34903
/* Sets the "next_cfg" column from the "Open_vSwitch" table in 'row' to
34904
 * 'next_cfg'.
34905
 *
34906
 * The caller retains ownership of the arguments. */
34907
void
34908
ovsrec_open_vswitch_set_next_cfg(const struct ovsrec_open_vswitch *row, int64_t next_cfg)
34909
0
{
34910
0
    struct ovsdb_datum datum;
34911
34912
0
    datum.refcnt = NULL;
34913
34914
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
34915
34916
0
    datum.n = 1;
34917
0
    datum.keys = key;
34918
0
    key->integer = next_cfg;
34919
0
    datum.values = NULL;
34920
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_next_cfg, &datum);
34921
0
}
34922
34923
/* Sets the "other_config" column's value from the "Open_vSwitch" table in 'row'
34924
 * to 'other_config'.
34925
 *
34926
 * The caller retains ownership of 'other_config' and everything in it. */
34927
void
34928
ovsrec_open_vswitch_set_other_config(const struct ovsrec_open_vswitch *row, const struct smap *other_config)
34929
0
{
34930
0
    struct ovsdb_datum datum;
34931
34932
0
    if (other_config) {
34933
0
        ovsdb_datum_from_smap(&datum, other_config);
34934
0
    } else {
34935
0
        ovsdb_datum_init_empty(&datum);
34936
0
    }
34937
0
    ovsdb_idl_txn_write(&row->header_,
34938
0
                        &ovsrec_open_vswitch_col_other_config,
34939
0
                        &datum);
34940
0
}
34941
34942
34943
/* Sets the "ovs_version" column from the "Open_vSwitch" table in 'row' to
34944
 * the 'ovs_version' set.
34945
 *
34946
 * If "ovs_version" is null, the column will be the empty set,
34947
 * otherwise it will contain the specified value.
34948
 *
34949
 * The caller retains ownership of the arguments. */
34950
void
34951
ovsrec_open_vswitch_set_ovs_version(const struct ovsrec_open_vswitch *row, const char *ovs_version)
34952
0
{
34953
0
    struct ovsdb_datum datum;
34954
34955
0
    datum.refcnt = NULL;
34956
34957
0
    if (ovs_version) {
34958
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
34959
0
        datum.n = 1;
34960
0
        datum.keys = key;
34961
0
        key->s = ovsdb_atom_string_create(ovs_version);
34962
0
    } else {
34963
0
        datum.n = 0;
34964
0
        datum.keys = NULL;
34965
0
    }
34966
0
    datum.values = NULL;
34967
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_ovs_version, &datum);
34968
0
}
34969
34970
/* Sets the "ssl" column from the "Open_vSwitch" table in 'row' to
34971
 * the 'ssl' set.
34972
 *
34973
 * If "ssl" is null, the column will be the empty set,
34974
 * otherwise it will contain the specified value.
34975
 *
34976
 * The caller retains ownership of the arguments. */
34977
void
34978
ovsrec_open_vswitch_set_ssl(const struct ovsrec_open_vswitch *row, const struct ovsrec_ssl *ssl)
34979
0
{
34980
0
    struct ovsdb_datum datum;
34981
34982
0
    datum.refcnt = NULL;
34983
34984
0
    if (ssl) {
34985
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
34986
0
        datum.n = 1;
34987
0
        datum.keys = key;
34988
0
        key->uuid = ssl->header_.uuid;
34989
0
    } else {
34990
0
        datum.n = 0;
34991
0
        datum.keys = NULL;
34992
0
    }
34993
0
    datum.values = NULL;
34994
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_ssl, &datum);
34995
0
}
34996
34997
/* Sets the "statistics" column's value from the "Open_vSwitch" table in 'row'
34998
 * to 'statistics'.
34999
 *
35000
 * The caller retains ownership of 'statistics' and everything in it. */
35001
void
35002
ovsrec_open_vswitch_set_statistics(const struct ovsrec_open_vswitch *row, const struct smap *statistics)
35003
0
{
35004
0
    struct ovsdb_datum datum;
35005
35006
0
    if (statistics) {
35007
0
        ovsdb_datum_from_smap(&datum, statistics);
35008
0
    } else {
35009
0
        ovsdb_datum_init_empty(&datum);
35010
0
    }
35011
0
    ovsdb_idl_txn_write(&row->header_,
35012
0
                        &ovsrec_open_vswitch_col_statistics,
35013
0
                        &datum);
35014
0
}
35015
35016
35017
/* Sets the "system_type" column from the "Open_vSwitch" table in 'row' to
35018
 * the 'system_type' set.
35019
 *
35020
 * If "system_type" is null, the column will be the empty set,
35021
 * otherwise it will contain the specified value.
35022
 *
35023
 * The caller retains ownership of the arguments. */
35024
void
35025
ovsrec_open_vswitch_set_system_type(const struct ovsrec_open_vswitch *row, const char *system_type)
35026
0
{
35027
0
    struct ovsdb_datum datum;
35028
35029
0
    datum.refcnt = NULL;
35030
35031
0
    if (system_type) {
35032
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
35033
0
        datum.n = 1;
35034
0
        datum.keys = key;
35035
0
        key->s = ovsdb_atom_string_create(system_type);
35036
0
    } else {
35037
0
        datum.n = 0;
35038
0
        datum.keys = NULL;
35039
0
    }
35040
0
    datum.values = NULL;
35041
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_system_type, &datum);
35042
0
}
35043
35044
/* Sets the "system_version" column from the "Open_vSwitch" table in 'row' to
35045
 * the 'system_version' set.
35046
 *
35047
 * If "system_version" is null, the column will be the empty set,
35048
 * otherwise it will contain the specified value.
35049
 *
35050
 * The caller retains ownership of the arguments. */
35051
void
35052
ovsrec_open_vswitch_set_system_version(const struct ovsrec_open_vswitch *row, const char *system_version)
35053
0
{
35054
0
    struct ovsdb_datum datum;
35055
35056
0
    datum.refcnt = NULL;
35057
35058
0
    if (system_version) {
35059
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
35060
0
        datum.n = 1;
35061
0
        datum.keys = key;
35062
0
        key->s = ovsdb_atom_string_create(system_version);
35063
0
    } else {
35064
0
        datum.n = 0;
35065
0
        datum.keys = NULL;
35066
0
    }
35067
0
    datum.values = NULL;
35068
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_system_version, &datum);
35069
0
}
35070
35071
/* Adds the value 'new_value' to the "bridges" set column from the "Open_vSwitch" table
35072
 * in 'row'.
35073
 *
35074
 */
35075
void
35076
ovsrec_open_vswitch_update_bridges_addvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_bridge *new_value)
35077
0
{
35078
0
    struct ovsdb_datum *datum;
35079
35080
0
    datum = xmalloc(sizeof *datum);
35081
0
    datum->n = 1;
35082
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35083
0
    datum->values = NULL;
35084
0
    datum->refcnt = NULL;
35085
35086
0
    datum->keys[0].uuid = new_value->header_.uuid;
35087
35088
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
35089
0
                                    &ovsrec_open_vswitch_col_bridges,
35090
0
                                    datum);
35091
0
}
35092
35093
/* Deletes the value 'delete_value' from the "bridges" set column from the
35094
 * "Open_vSwitch" table in 'row'.
35095
 *
35096
 */
35097
void
35098
ovsrec_open_vswitch_update_bridges_delvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_bridge *delete_value)
35099
0
{
35100
0
    struct ovsdb_datum *datum;
35101
35102
0
    datum = xmalloc(sizeof *datum);
35103
0
    datum->n = 1;
35104
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35105
0
    datum->values = NULL;
35106
0
    datum->refcnt = NULL;
35107
35108
0
    datum->keys[0].uuid = delete_value->header_.uuid;
35109
35110
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
35111
0
                                    &ovsrec_open_vswitch_col_bridges,
35112
0
                                    datum);
35113
0
}
35114
35115
/* Adds the value 'new_value' to the "datapath_types" set column from the "Open_vSwitch" table
35116
 * in 'row'.
35117
 *
35118
 */
35119
void
35120
ovsrec_open_vswitch_update_datapath_types_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
35121
0
{
35122
0
    struct ovsdb_datum *datum;
35123
35124
0
    datum = xmalloc(sizeof *datum);
35125
0
    datum->n = 1;
35126
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35127
0
    datum->values = NULL;
35128
0
    datum->refcnt = NULL;
35129
35130
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
35131
35132
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
35133
0
                                    &ovsrec_open_vswitch_col_datapath_types,
35134
0
                                    datum);
35135
0
}
35136
35137
/* Deletes the value 'delete_value' from the "datapath_types" set column from the
35138
 * "Open_vSwitch" table in 'row'.
35139
 *
35140
 */
35141
void
35142
ovsrec_open_vswitch_update_datapath_types_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
35143
0
{
35144
0
    struct ovsdb_datum *datum;
35145
35146
0
    datum = xmalloc(sizeof *datum);
35147
0
    datum->n = 1;
35148
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35149
0
    datum->values = NULL;
35150
0
    datum->refcnt = NULL;
35151
35152
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
35153
35154
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
35155
0
                                    &ovsrec_open_vswitch_col_datapath_types,
35156
0
                                    datum);
35157
0
}
35158
35159
/* Sets an element of the "datapaths" map column from the "Open_vSwitch" table in 'row'
35160
 * to 'new_value' given the key value 'new_key'.
35161
 *
35162
 */
35163
void
35164
ovsrec_open_vswitch_update_datapaths_setkey(const struct ovsrec_open_vswitch *row, const char *new_key, const struct ovsrec_datapath *new_value)
35165
0
{
35166
0
    struct ovsdb_datum *datum;
35167
35168
0
    datum = xmalloc(sizeof *datum);
35169
0
    datum->n = 1;
35170
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
35171
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
35172
0
    datum->refcnt = NULL;
35173
35174
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
35175
0
    datum->values[0].uuid = new_value->header_.uuid;
35176
35177
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
35178
0
                                    &ovsrec_open_vswitch_col_datapaths,
35179
0
                                    datum);
35180
0
}
35181
35182
/* Deletes an element of the "datapaths" map column from the "Open_vSwitch" table in 'row'
35183
 * given the key value 'delete_key'.
35184
 *
35185
 */
35186
void
35187
ovsrec_open_vswitch_update_datapaths_delkey(const struct ovsrec_open_vswitch *row, const char *delete_key)
35188
0
{
35189
0
    struct ovsdb_datum *datum;
35190
35191
0
    datum = xmalloc(sizeof *datum);
35192
0
    datum->n = 1;
35193
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
35194
0
    datum->values = NULL;
35195
0
    datum->refcnt = NULL;
35196
35197
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
35198
35199
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
35200
0
                                    &ovsrec_open_vswitch_col_datapaths,
35201
0
                                    datum);
35202
0
}
35203
35204
/* Adds the value 'new_value' to the "db_version" set column from the "Open_vSwitch" table
35205
 * in 'row'.
35206
 *
35207
 */
35208
void
35209
ovsrec_open_vswitch_update_db_version_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
35210
0
{
35211
0
    struct ovsdb_datum *datum;
35212
35213
0
    datum = xmalloc(sizeof *datum);
35214
0
    datum->n = 1;
35215
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35216
0
    datum->values = NULL;
35217
0
    datum->refcnt = NULL;
35218
35219
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
35220
35221
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
35222
0
                                    &ovsrec_open_vswitch_col_db_version,
35223
0
                                    datum);
35224
0
}
35225
35226
/* Deletes the value 'delete_value' from the "db_version" set column from the
35227
 * "Open_vSwitch" table in 'row'.
35228
 *
35229
 */
35230
void
35231
ovsrec_open_vswitch_update_db_version_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
35232
0
{
35233
0
    struct ovsdb_datum *datum;
35234
35235
0
    datum = xmalloc(sizeof *datum);
35236
0
    datum->n = 1;
35237
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35238
0
    datum->values = NULL;
35239
0
    datum->refcnt = NULL;
35240
35241
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
35242
35243
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
35244
0
                                    &ovsrec_open_vswitch_col_db_version,
35245
0
                                    datum);
35246
0
}
35247
35248
/* Adds the value 'new_value' to the "dpdk_version" set column from the "Open_vSwitch" table
35249
 * in 'row'.
35250
 *
35251
 */
35252
void
35253
ovsrec_open_vswitch_update_dpdk_version_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
35254
0
{
35255
0
    struct ovsdb_datum *datum;
35256
35257
0
    datum = xmalloc(sizeof *datum);
35258
0
    datum->n = 1;
35259
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35260
0
    datum->values = NULL;
35261
0
    datum->refcnt = NULL;
35262
35263
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
35264
35265
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
35266
0
                                    &ovsrec_open_vswitch_col_dpdk_version,
35267
0
                                    datum);
35268
0
}
35269
35270
/* Deletes the value 'delete_value' from the "dpdk_version" set column from the
35271
 * "Open_vSwitch" table in 'row'.
35272
 *
35273
 */
35274
void
35275
ovsrec_open_vswitch_update_dpdk_version_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
35276
0
{
35277
0
    struct ovsdb_datum *datum;
35278
35279
0
    datum = xmalloc(sizeof *datum);
35280
0
    datum->n = 1;
35281
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35282
0
    datum->values = NULL;
35283
0
    datum->refcnt = NULL;
35284
35285
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
35286
35287
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
35288
0
                                    &ovsrec_open_vswitch_col_dpdk_version,
35289
0
                                    datum);
35290
0
}
35291
35292
/* Sets an element of the "external_ids" map column from the "Open_vSwitch" table in 'row'
35293
 * to 'new_value' given the key value 'new_key'.
35294
 *
35295
 */
35296
void
35297
ovsrec_open_vswitch_update_external_ids_setkey(const struct ovsrec_open_vswitch *row, const char *new_key, const char *new_value)
35298
0
{
35299
0
    struct ovsdb_datum *datum;
35300
35301
0
    datum = xmalloc(sizeof *datum);
35302
0
    datum->n = 1;
35303
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
35304
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
35305
0
    datum->refcnt = NULL;
35306
35307
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
35308
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
35309
35310
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
35311
0
                                    &ovsrec_open_vswitch_col_external_ids,
35312
0
                                    datum);
35313
0
}
35314
35315
/* Deletes an element of the "external_ids" map column from the "Open_vSwitch" table in 'row'
35316
 * given the key value 'delete_key'.
35317
 *
35318
 */
35319
void
35320
ovsrec_open_vswitch_update_external_ids_delkey(const struct ovsrec_open_vswitch *row, const char *delete_key)
35321
0
{
35322
0
    struct ovsdb_datum *datum;
35323
35324
0
    datum = xmalloc(sizeof *datum);
35325
0
    datum->n = 1;
35326
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
35327
0
    datum->values = NULL;
35328
0
    datum->refcnt = NULL;
35329
35330
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
35331
35332
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
35333
0
                                    &ovsrec_open_vswitch_col_external_ids,
35334
0
                                    datum);
35335
0
}
35336
35337
/* Adds the value 'new_value' to the "iface_types" set column from the "Open_vSwitch" table
35338
 * in 'row'.
35339
 *
35340
 */
35341
void
35342
ovsrec_open_vswitch_update_iface_types_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
35343
0
{
35344
0
    struct ovsdb_datum *datum;
35345
35346
0
    datum = xmalloc(sizeof *datum);
35347
0
    datum->n = 1;
35348
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35349
0
    datum->values = NULL;
35350
0
    datum->refcnt = NULL;
35351
35352
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
35353
35354
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
35355
0
                                    &ovsrec_open_vswitch_col_iface_types,
35356
0
                                    datum);
35357
0
}
35358
35359
/* Deletes the value 'delete_value' from the "iface_types" set column from the
35360
 * "Open_vSwitch" table in 'row'.
35361
 *
35362
 */
35363
void
35364
ovsrec_open_vswitch_update_iface_types_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
35365
0
{
35366
0
    struct ovsdb_datum *datum;
35367
35368
0
    datum = xmalloc(sizeof *datum);
35369
0
    datum->n = 1;
35370
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35371
0
    datum->values = NULL;
35372
0
    datum->refcnt = NULL;
35373
35374
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
35375
35376
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
35377
0
                                    &ovsrec_open_vswitch_col_iface_types,
35378
0
                                    datum);
35379
0
}
35380
35381
/* Adds the value 'new_value' to the "manager_options" set column from the "Open_vSwitch" table
35382
 * in 'row'.
35383
 *
35384
 */
35385
void
35386
ovsrec_open_vswitch_update_manager_options_addvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_manager *new_value)
35387
0
{
35388
0
    struct ovsdb_datum *datum;
35389
35390
0
    datum = xmalloc(sizeof *datum);
35391
0
    datum->n = 1;
35392
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35393
0
    datum->values = NULL;
35394
0
    datum->refcnt = NULL;
35395
35396
0
    datum->keys[0].uuid = new_value->header_.uuid;
35397
35398
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
35399
0
                                    &ovsrec_open_vswitch_col_manager_options,
35400
0
                                    datum);
35401
0
}
35402
35403
/* Deletes the value 'delete_value' from the "manager_options" set column from the
35404
 * "Open_vSwitch" table in 'row'.
35405
 *
35406
 */
35407
void
35408
ovsrec_open_vswitch_update_manager_options_delvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_manager *delete_value)
35409
0
{
35410
0
    struct ovsdb_datum *datum;
35411
35412
0
    datum = xmalloc(sizeof *datum);
35413
0
    datum->n = 1;
35414
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35415
0
    datum->values = NULL;
35416
0
    datum->refcnt = NULL;
35417
35418
0
    datum->keys[0].uuid = delete_value->header_.uuid;
35419
35420
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
35421
0
                                    &ovsrec_open_vswitch_col_manager_options,
35422
0
                                    datum);
35423
0
}
35424
35425
/* Sets an element of the "other_config" map column from the "Open_vSwitch" table in 'row'
35426
 * to 'new_value' given the key value 'new_key'.
35427
 *
35428
 */
35429
void
35430
ovsrec_open_vswitch_update_other_config_setkey(const struct ovsrec_open_vswitch *row, const char *new_key, const char *new_value)
35431
0
{
35432
0
    struct ovsdb_datum *datum;
35433
35434
0
    datum = xmalloc(sizeof *datum);
35435
0
    datum->n = 1;
35436
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
35437
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
35438
0
    datum->refcnt = NULL;
35439
35440
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
35441
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
35442
35443
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
35444
0
                                    &ovsrec_open_vswitch_col_other_config,
35445
0
                                    datum);
35446
0
}
35447
35448
/* Deletes an element of the "other_config" map column from the "Open_vSwitch" table in 'row'
35449
 * given the key value 'delete_key'.
35450
 *
35451
 */
35452
void
35453
ovsrec_open_vswitch_update_other_config_delkey(const struct ovsrec_open_vswitch *row, const char *delete_key)
35454
0
{
35455
0
    struct ovsdb_datum *datum;
35456
35457
0
    datum = xmalloc(sizeof *datum);
35458
0
    datum->n = 1;
35459
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
35460
0
    datum->values = NULL;
35461
0
    datum->refcnt = NULL;
35462
35463
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
35464
35465
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
35466
0
                                    &ovsrec_open_vswitch_col_other_config,
35467
0
                                    datum);
35468
0
}
35469
35470
/* Adds the value 'new_value' to the "ovs_version" set column from the "Open_vSwitch" table
35471
 * in 'row'.
35472
 *
35473
 */
35474
void
35475
ovsrec_open_vswitch_update_ovs_version_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
35476
0
{
35477
0
    struct ovsdb_datum *datum;
35478
35479
0
    datum = xmalloc(sizeof *datum);
35480
0
    datum->n = 1;
35481
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35482
0
    datum->values = NULL;
35483
0
    datum->refcnt = NULL;
35484
35485
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
35486
35487
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
35488
0
                                    &ovsrec_open_vswitch_col_ovs_version,
35489
0
                                    datum);
35490
0
}
35491
35492
/* Deletes the value 'delete_value' from the "ovs_version" set column from the
35493
 * "Open_vSwitch" table in 'row'.
35494
 *
35495
 */
35496
void
35497
ovsrec_open_vswitch_update_ovs_version_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
35498
0
{
35499
0
    struct ovsdb_datum *datum;
35500
35501
0
    datum = xmalloc(sizeof *datum);
35502
0
    datum->n = 1;
35503
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35504
0
    datum->values = NULL;
35505
0
    datum->refcnt = NULL;
35506
35507
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
35508
35509
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
35510
0
                                    &ovsrec_open_vswitch_col_ovs_version,
35511
0
                                    datum);
35512
0
}
35513
35514
/* Adds the value 'new_value' to the "ssl" set column from the "Open_vSwitch" table
35515
 * in 'row'.
35516
 *
35517
 */
35518
void
35519
ovsrec_open_vswitch_update_ssl_addvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_ssl *new_value)
35520
0
{
35521
0
    struct ovsdb_datum *datum;
35522
35523
0
    datum = xmalloc(sizeof *datum);
35524
0
    datum->n = 1;
35525
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35526
0
    datum->values = NULL;
35527
0
    datum->refcnt = NULL;
35528
35529
0
    datum->keys[0].uuid = new_value->header_.uuid;
35530
35531
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
35532
0
                                    &ovsrec_open_vswitch_col_ssl,
35533
0
                                    datum);
35534
0
}
35535
35536
/* Deletes the value 'delete_value' from the "ssl" set column from the
35537
 * "Open_vSwitch" table in 'row'.
35538
 *
35539
 */
35540
void
35541
ovsrec_open_vswitch_update_ssl_delvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_ssl *delete_value)
35542
0
{
35543
0
    struct ovsdb_datum *datum;
35544
35545
0
    datum = xmalloc(sizeof *datum);
35546
0
    datum->n = 1;
35547
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35548
0
    datum->values = NULL;
35549
0
    datum->refcnt = NULL;
35550
35551
0
    datum->keys[0].uuid = delete_value->header_.uuid;
35552
35553
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
35554
0
                                    &ovsrec_open_vswitch_col_ssl,
35555
0
                                    datum);
35556
0
}
35557
35558
/* Sets an element of the "statistics" map column from the "Open_vSwitch" table in 'row'
35559
 * to 'new_value' given the key value 'new_key'.
35560
 *
35561
 */
35562
void
35563
ovsrec_open_vswitch_update_statistics_setkey(const struct ovsrec_open_vswitch *row, const char *new_key, const char *new_value)
35564
0
{
35565
0
    struct ovsdb_datum *datum;
35566
35567
0
    datum = xmalloc(sizeof *datum);
35568
0
    datum->n = 1;
35569
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
35570
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
35571
0
    datum->refcnt = NULL;
35572
35573
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
35574
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
35575
35576
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
35577
0
                                    &ovsrec_open_vswitch_col_statistics,
35578
0
                                    datum);
35579
0
}
35580
35581
/* Deletes an element of the "statistics" map column from the "Open_vSwitch" table in 'row'
35582
 * given the key value 'delete_key'.
35583
 *
35584
 */
35585
void
35586
ovsrec_open_vswitch_update_statistics_delkey(const struct ovsrec_open_vswitch *row, const char *delete_key)
35587
0
{
35588
0
    struct ovsdb_datum *datum;
35589
35590
0
    datum = xmalloc(sizeof *datum);
35591
0
    datum->n = 1;
35592
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
35593
0
    datum->values = NULL;
35594
0
    datum->refcnt = NULL;
35595
35596
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
35597
35598
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
35599
0
                                    &ovsrec_open_vswitch_col_statistics,
35600
0
                                    datum);
35601
0
}
35602
35603
/* Adds the value 'new_value' to the "system_type" set column from the "Open_vSwitch" table
35604
 * in 'row'.
35605
 *
35606
 */
35607
void
35608
ovsrec_open_vswitch_update_system_type_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
35609
0
{
35610
0
    struct ovsdb_datum *datum;
35611
35612
0
    datum = xmalloc(sizeof *datum);
35613
0
    datum->n = 1;
35614
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35615
0
    datum->values = NULL;
35616
0
    datum->refcnt = NULL;
35617
35618
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
35619
35620
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
35621
0
                                    &ovsrec_open_vswitch_col_system_type,
35622
0
                                    datum);
35623
0
}
35624
35625
/* Deletes the value 'delete_value' from the "system_type" set column from the
35626
 * "Open_vSwitch" table in 'row'.
35627
 *
35628
 */
35629
void
35630
ovsrec_open_vswitch_update_system_type_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
35631
0
{
35632
0
    struct ovsdb_datum *datum;
35633
35634
0
    datum = xmalloc(sizeof *datum);
35635
0
    datum->n = 1;
35636
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35637
0
    datum->values = NULL;
35638
0
    datum->refcnt = NULL;
35639
35640
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
35641
35642
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
35643
0
                                    &ovsrec_open_vswitch_col_system_type,
35644
0
                                    datum);
35645
0
}
35646
35647
/* Adds the value 'new_value' to the "system_version" set column from the "Open_vSwitch" table
35648
 * in 'row'.
35649
 *
35650
 */
35651
void
35652
ovsrec_open_vswitch_update_system_version_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
35653
0
{
35654
0
    struct ovsdb_datum *datum;
35655
35656
0
    datum = xmalloc(sizeof *datum);
35657
0
    datum->n = 1;
35658
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35659
0
    datum->values = NULL;
35660
0
    datum->refcnt = NULL;
35661
35662
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
35663
35664
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
35665
0
                                    &ovsrec_open_vswitch_col_system_version,
35666
0
                                    datum);
35667
0
}
35668
35669
/* Deletes the value 'delete_value' from the "system_version" set column from the
35670
 * "Open_vSwitch" table in 'row'.
35671
 *
35672
 */
35673
void
35674
ovsrec_open_vswitch_update_system_version_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
35675
0
{
35676
0
    struct ovsdb_datum *datum;
35677
35678
0
    datum = xmalloc(sizeof *datum);
35679
0
    datum->n = 1;
35680
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
35681
0
    datum->values = NULL;
35682
0
    datum->refcnt = NULL;
35683
35684
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
35685
35686
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
35687
0
                                    &ovsrec_open_vswitch_col_system_version,
35688
0
                                    datum);
35689
0
}
35690
35691
/* Sets the "bridges" column from the "Open_vSwitch" table in 'row' to
35692
 * the 'bridges' set with 'n_bridges' entries.
35693
 *
35694
 * The caller retains ownership of the arguments. */
35695
void
35696
ovsrec_open_vswitch_add_clause_bridges(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **bridges, size_t n_bridges)
35697
0
{
35698
0
    struct ovsdb_datum datum;
35699
35700
0
    datum.refcnt = NULL;
35701
0
    datum.n = n_bridges;
35702
0
    datum.keys = n_bridges ? xmalloc(n_bridges * sizeof *datum.keys) : NULL;
35703
0
    datum.values = NULL;
35704
0
    for (size_t i = 0; i < n_bridges; i++) {
35705
0
        datum.keys[i].uuid = *bridges[i];
35706
0
    }
35707
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_bridges.type);
35708
0
    ovsdb_idl_condition_add_clause(cond,
35709
0
                          function,
35710
0
                          &ovsrec_open_vswitch_col_bridges,
35711
0
                          &datum);
35712
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_bridges.type);
35713
0
}
35714
35715
/* Sets the "cur_cfg" column from the "Open_vSwitch" table in 'row' to
35716
 * 'cur_cfg'.
35717
 *
35718
 * The caller retains ownership of the arguments. */
35719
void
35720
ovsrec_open_vswitch_add_clause_cur_cfg(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t cur_cfg)
35721
0
{
35722
0
    struct ovsdb_datum datum;
35723
35724
0
    datum.refcnt = NULL;
35725
35726
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
35727
35728
0
    datum.n = 1;
35729
0
    datum.keys = key;
35730
0
    key->integer = cur_cfg;
35731
0
    datum.values = NULL;
35732
0
    ovsdb_idl_condition_add_clause(cond,
35733
0
                          function,
35734
0
                          &ovsrec_open_vswitch_col_cur_cfg,
35735
0
                          &datum);
35736
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_cur_cfg.type);
35737
0
}
35738
35739
/* Sets the "datapath_types" column from the "Open_vSwitch" table in 'row' to
35740
 * the 'datapath_types' set with 'n_datapath_types' entries.
35741
 *
35742
 * The caller retains ownership of the arguments. */
35743
void
35744
ovsrec_open_vswitch_add_clause_datapath_types(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **datapath_types, size_t n_datapath_types)
35745
0
{
35746
0
    struct ovsdb_datum datum;
35747
35748
0
    datum.refcnt = NULL;
35749
0
    datum.n = n_datapath_types;
35750
0
    datum.keys = n_datapath_types ? xmalloc(n_datapath_types * sizeof *datum.keys) : NULL;
35751
0
    datum.values = NULL;
35752
0
    for (size_t i = 0; i < n_datapath_types; i++) {
35753
0
        datum.keys[i].s = ovsdb_atom_string_create(datapath_types[i]);
35754
0
    }
35755
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_datapath_types.type);
35756
0
    ovsdb_idl_condition_add_clause(cond,
35757
0
                          function,
35758
0
                          &ovsrec_open_vswitch_col_datapath_types,
35759
0
                          &datum);
35760
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_datapath_types.type);
35761
0
}
35762
35763
/* Sets the "datapaths" column from the "Open_vSwitch" table in 'row' to
35764
 * the map with keys 'key_datapaths' and values 'value_datapaths'
35765
 * with 'n_datapaths' entries.
35766
 *
35767
 * The caller retains ownership of the arguments. */
35768
void
35769
ovsrec_open_vswitch_add_clause_datapaths(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **key_datapaths, struct uuid **value_datapaths, size_t n_datapaths)
35770
0
{
35771
0
    struct ovsdb_datum datum;
35772
35773
0
    datum.refcnt = NULL;
35774
0
    datum.n = n_datapaths;
35775
0
    datum.keys = n_datapaths ? xmalloc(n_datapaths * sizeof *datum.keys) : NULL;
35776
0
    datum.values = xmalloc(n_datapaths * sizeof *datum.values);
35777
0
    for (size_t i = 0; i < n_datapaths; i++) {
35778
0
        datum.keys[i].s = ovsdb_atom_string_create(key_datapaths[i]);
35779
0
        datum.values[i].uuid = *value_datapaths[i];
35780
0
    }
35781
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_datapaths.type);
35782
0
    ovsdb_idl_condition_add_clause(cond,
35783
0
                          function,
35784
0
                          &ovsrec_open_vswitch_col_datapaths,
35785
0
                          &datum);
35786
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_datapaths.type);
35787
0
}
35788
35789
/* Sets the "db_version" column from the "Open_vSwitch" table in 'row' to
35790
 * the 'db_version' set.
35791
 *
35792
 * If "db_version" is null, the column will be the empty set,
35793
 * otherwise it will contain the specified value.
35794
 *
35795
 * The caller retains ownership of the arguments. */
35796
void
35797
ovsrec_open_vswitch_add_clause_db_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *db_version)
35798
0
{
35799
0
    struct ovsdb_datum datum;
35800
35801
0
    datum.refcnt = NULL;
35802
35803
0
    if (db_version) {
35804
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
35805
0
        datum.n = 1;
35806
0
        datum.keys = key;
35807
0
        key->s = ovsdb_atom_string_create(db_version);
35808
0
    } else {
35809
0
        datum.n = 0;
35810
0
        datum.keys = NULL;
35811
0
    }
35812
0
    datum.values = NULL;
35813
0
    ovsdb_idl_condition_add_clause(cond,
35814
0
                          function,
35815
0
                          &ovsrec_open_vswitch_col_db_version,
35816
0
                          &datum);
35817
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_db_version.type);
35818
0
}
35819
35820
/* Sets the "dpdk_initialized" column from the "Open_vSwitch" table in 'row' to
35821
 * 'dpdk_initialized'.
35822
 *
35823
 * The caller retains ownership of the arguments. */
35824
void
35825
ovsrec_open_vswitch_add_clause_dpdk_initialized(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool dpdk_initialized)
35826
0
{
35827
0
    struct ovsdb_datum datum;
35828
35829
0
    datum.refcnt = NULL;
35830
35831
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
35832
35833
0
    datum.n = 1;
35834
0
    datum.keys = key;
35835
0
    key->boolean = dpdk_initialized;
35836
0
    datum.values = NULL;
35837
0
    ovsdb_idl_condition_add_clause(cond,
35838
0
                          function,
35839
0
                          &ovsrec_open_vswitch_col_dpdk_initialized,
35840
0
                          &datum);
35841
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_dpdk_initialized.type);
35842
0
}
35843
35844
/* Sets the "dpdk_version" column from the "Open_vSwitch" table in 'row' to
35845
 * the 'dpdk_version' set.
35846
 *
35847
 * If "dpdk_version" is null, the column will be the empty set,
35848
 * otherwise it will contain the specified value.
35849
 *
35850
 * The caller retains ownership of the arguments. */
35851
void
35852
ovsrec_open_vswitch_add_clause_dpdk_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *dpdk_version)
35853
0
{
35854
0
    struct ovsdb_datum datum;
35855
35856
0
    datum.refcnt = NULL;
35857
35858
0
    if (dpdk_version) {
35859
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
35860
0
        datum.n = 1;
35861
0
        datum.keys = key;
35862
0
        key->s = ovsdb_atom_string_create(dpdk_version);
35863
0
    } else {
35864
0
        datum.n = 0;
35865
0
        datum.keys = NULL;
35866
0
    }
35867
0
    datum.values = NULL;
35868
0
    ovsdb_idl_condition_add_clause(cond,
35869
0
                          function,
35870
0
                          &ovsrec_open_vswitch_col_dpdk_version,
35871
0
                          &datum);
35872
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_dpdk_version.type);
35873
0
}
35874
35875
/* Sets the "external_ids" column's value from the "Open_vSwitch" table in 'row'
35876
 * to 'external_ids'.
35877
 *
35878
 * The caller retains ownership of 'external_ids' and everything in it. */
35879
void
35880
ovsrec_open_vswitch_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
35881
0
{
35882
0
    struct ovsdb_datum datum;
35883
35884
0
    if (external_ids) {
35885
0
        ovsdb_datum_from_smap(&datum, external_ids);
35886
0
    } else {
35887
0
        ovsdb_datum_init_empty(&datum);
35888
0
    }
35889
35890
0
    ovsdb_idl_condition_add_clause(cond,
35891
0
                                   function,
35892
0
                                   &ovsrec_open_vswitch_col_external_ids,
35893
0
                                   &datum);
35894
35895
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_external_ids.type);
35896
0
}
35897
35898
35899
/* Sets the "iface_types" column from the "Open_vSwitch" table in 'row' to
35900
 * the 'iface_types' set with 'n_iface_types' entries.
35901
 *
35902
 * The caller retains ownership of the arguments. */
35903
void
35904
ovsrec_open_vswitch_add_clause_iface_types(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **iface_types, size_t n_iface_types)
35905
0
{
35906
0
    struct ovsdb_datum datum;
35907
35908
0
    datum.refcnt = NULL;
35909
0
    datum.n = n_iface_types;
35910
0
    datum.keys = n_iface_types ? xmalloc(n_iface_types * sizeof *datum.keys) : NULL;
35911
0
    datum.values = NULL;
35912
0
    for (size_t i = 0; i < n_iface_types; i++) {
35913
0
        datum.keys[i].s = ovsdb_atom_string_create(iface_types[i]);
35914
0
    }
35915
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_iface_types.type);
35916
0
    ovsdb_idl_condition_add_clause(cond,
35917
0
                          function,
35918
0
                          &ovsrec_open_vswitch_col_iface_types,
35919
0
                          &datum);
35920
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_iface_types.type);
35921
0
}
35922
35923
/* Sets the "manager_options" column from the "Open_vSwitch" table in 'row' to
35924
 * the 'manager_options' set with 'n_manager_options' entries.
35925
 *
35926
 * The caller retains ownership of the arguments. */
35927
void
35928
ovsrec_open_vswitch_add_clause_manager_options(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **manager_options, size_t n_manager_options)
35929
0
{
35930
0
    struct ovsdb_datum datum;
35931
35932
0
    datum.refcnt = NULL;
35933
0
    datum.n = n_manager_options;
35934
0
    datum.keys = n_manager_options ? xmalloc(n_manager_options * sizeof *datum.keys) : NULL;
35935
0
    datum.values = NULL;
35936
0
    for (size_t i = 0; i < n_manager_options; i++) {
35937
0
        datum.keys[i].uuid = *manager_options[i];
35938
0
    }
35939
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_manager_options.type);
35940
0
    ovsdb_idl_condition_add_clause(cond,
35941
0
                          function,
35942
0
                          &ovsrec_open_vswitch_col_manager_options,
35943
0
                          &datum);
35944
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_manager_options.type);
35945
0
}
35946
35947
/* Sets the "next_cfg" column from the "Open_vSwitch" table in 'row' to
35948
 * 'next_cfg'.
35949
 *
35950
 * The caller retains ownership of the arguments. */
35951
void
35952
ovsrec_open_vswitch_add_clause_next_cfg(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t next_cfg)
35953
0
{
35954
0
    struct ovsdb_datum datum;
35955
35956
0
    datum.refcnt = NULL;
35957
35958
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
35959
35960
0
    datum.n = 1;
35961
0
    datum.keys = key;
35962
0
    key->integer = next_cfg;
35963
0
    datum.values = NULL;
35964
0
    ovsdb_idl_condition_add_clause(cond,
35965
0
                          function,
35966
0
                          &ovsrec_open_vswitch_col_next_cfg,
35967
0
                          &datum);
35968
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_next_cfg.type);
35969
0
}
35970
35971
/* Sets the "other_config" column's value from the "Open_vSwitch" table in 'row'
35972
 * to 'other_config'.
35973
 *
35974
 * The caller retains ownership of 'other_config' and everything in it. */
35975
void
35976
ovsrec_open_vswitch_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
35977
0
{
35978
0
    struct ovsdb_datum datum;
35979
35980
0
    if (other_config) {
35981
0
        ovsdb_datum_from_smap(&datum, other_config);
35982
0
    } else {
35983
0
        ovsdb_datum_init_empty(&datum);
35984
0
    }
35985
35986
0
    ovsdb_idl_condition_add_clause(cond,
35987
0
                                   function,
35988
0
                                   &ovsrec_open_vswitch_col_other_config,
35989
0
                                   &datum);
35990
35991
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_other_config.type);
35992
0
}
35993
35994
35995
/* Sets the "ovs_version" column from the "Open_vSwitch" table in 'row' to
35996
 * the 'ovs_version' set.
35997
 *
35998
 * If "ovs_version" is null, the column will be the empty set,
35999
 * otherwise it will contain the specified value.
36000
 *
36001
 * The caller retains ownership of the arguments. */
36002
void
36003
ovsrec_open_vswitch_add_clause_ovs_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *ovs_version)
36004
0
{
36005
0
    struct ovsdb_datum datum;
36006
36007
0
    datum.refcnt = NULL;
36008
36009
0
    if (ovs_version) {
36010
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
36011
0
        datum.n = 1;
36012
0
        datum.keys = key;
36013
0
        key->s = ovsdb_atom_string_create(ovs_version);
36014
0
    } else {
36015
0
        datum.n = 0;
36016
0
        datum.keys = NULL;
36017
0
    }
36018
0
    datum.values = NULL;
36019
0
    ovsdb_idl_condition_add_clause(cond,
36020
0
                          function,
36021
0
                          &ovsrec_open_vswitch_col_ovs_version,
36022
0
                          &datum);
36023
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_ovs_version.type);
36024
0
}
36025
36026
/* Sets the "ssl" column from the "Open_vSwitch" table in 'row' to
36027
 * the 'ssl' set.
36028
 *
36029
 * If "ssl" is null, the column will be the empty set,
36030
 * otherwise it will contain the specified value.
36031
 *
36032
 * The caller retains ownership of the arguments. */
36033
void
36034
ovsrec_open_vswitch_add_clause_ssl(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *ssl)
36035
0
{
36036
0
    struct ovsdb_datum datum;
36037
36038
0
    datum.refcnt = NULL;
36039
36040
0
    if (ssl) {
36041
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
36042
0
        datum.n = 1;
36043
0
        datum.keys = key;
36044
0
        key->uuid = *ssl;
36045
0
    } else {
36046
0
        datum.n = 0;
36047
0
        datum.keys = NULL;
36048
0
    }
36049
0
    datum.values = NULL;
36050
0
    ovsdb_idl_condition_add_clause(cond,
36051
0
                          function,
36052
0
                          &ovsrec_open_vswitch_col_ssl,
36053
0
                          &datum);
36054
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_ssl.type);
36055
0
}
36056
36057
/* Sets the "statistics" column's value from the "Open_vSwitch" table in 'row'
36058
 * to 'statistics'.
36059
 *
36060
 * The caller retains ownership of 'statistics' and everything in it. */
36061
void
36062
ovsrec_open_vswitch_add_clause_statistics(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *statistics)
36063
0
{
36064
0
    struct ovsdb_datum datum;
36065
36066
0
    if (statistics) {
36067
0
        ovsdb_datum_from_smap(&datum, statistics);
36068
0
    } else {
36069
0
        ovsdb_datum_init_empty(&datum);
36070
0
    }
36071
36072
0
    ovsdb_idl_condition_add_clause(cond,
36073
0
                                   function,
36074
0
                                   &ovsrec_open_vswitch_col_statistics,
36075
0
                                   &datum);
36076
36077
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_statistics.type);
36078
0
}
36079
36080
36081
/* Sets the "system_type" column from the "Open_vSwitch" table in 'row' to
36082
 * the 'system_type' set.
36083
 *
36084
 * If "system_type" is null, the column will be the empty set,
36085
 * otherwise it will contain the specified value.
36086
 *
36087
 * The caller retains ownership of the arguments. */
36088
void
36089
ovsrec_open_vswitch_add_clause_system_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *system_type)
36090
0
{
36091
0
    struct ovsdb_datum datum;
36092
36093
0
    datum.refcnt = NULL;
36094
36095
0
    if (system_type) {
36096
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
36097
0
        datum.n = 1;
36098
0
        datum.keys = key;
36099
0
        key->s = ovsdb_atom_string_create(system_type);
36100
0
    } else {
36101
0
        datum.n = 0;
36102
0
        datum.keys = NULL;
36103
0
    }
36104
0
    datum.values = NULL;
36105
0
    ovsdb_idl_condition_add_clause(cond,
36106
0
                          function,
36107
0
                          &ovsrec_open_vswitch_col_system_type,
36108
0
                          &datum);
36109
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_system_type.type);
36110
0
}
36111
36112
/* Sets the "system_version" column from the "Open_vSwitch" table in 'row' to
36113
 * the 'system_version' set.
36114
 *
36115
 * If "system_version" is null, the column will be the empty set,
36116
 * otherwise it will contain the specified value.
36117
 *
36118
 * The caller retains ownership of the arguments. */
36119
void
36120
ovsrec_open_vswitch_add_clause_system_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *system_version)
36121
0
{
36122
0
    struct ovsdb_datum datum;
36123
36124
0
    datum.refcnt = NULL;
36125
36126
0
    if (system_version) {
36127
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
36128
0
        datum.n = 1;
36129
0
        datum.keys = key;
36130
0
        key->s = ovsdb_atom_string_create(system_version);
36131
0
    } else {
36132
0
        datum.n = 0;
36133
0
        datum.keys = NULL;
36134
0
    }
36135
0
    datum.values = NULL;
36136
0
    ovsdb_idl_condition_add_clause(cond,
36137
0
                          function,
36138
0
                          &ovsrec_open_vswitch_col_system_version,
36139
0
                          &datum);
36140
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_system_version.type);
36141
0
}
36142
36143
/* Destroy 'row' of kind "Open_vSwitch". The row must have been
36144
 * created with ovsdb_idl_index_init_row.
36145
 */
36146
void
36147
ovsrec_open_vswitch_index_destroy_row(const struct ovsrec_open_vswitch *row)
36148
0
{
36149
0
    ovsdb_idl_index_destroy_row(&row->header_);
36150
0
}
36151
        
36152
36153
/* Creates a new row of kind "Open_vSwitch". */
36154
struct ovsrec_open_vswitch *
36155
ovsrec_open_vswitch_index_init_row(struct ovsdb_idl_index *index)
36156
0
{
36157
0
    ovs_assert(index->table->class_ == &ovsrec_table_open_vswitch);
36158
0
    return ALIGNED_CAST(struct ovsrec_open_vswitch *, ovsdb_idl_index_init_row(index));
36159
0
}
36160
36161
struct ovsrec_open_vswitch *
36162
ovsrec_open_vswitch_index_find(struct ovsdb_idl_index *index, const struct ovsrec_open_vswitch *target)
36163
0
{
36164
0
    ovs_assert(index->table->class_ == &ovsrec_table_open_vswitch);
36165
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_index_find(index, &target->header_));
36166
0
}
36167
36168
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
36169
int
36170
ovsrec_open_vswitch_index_compare(
36171
    struct ovsdb_idl_index *index, 
36172
    const struct ovsrec_open_vswitch *a, 
36173
    const struct ovsrec_open_vswitch *b)
36174
0
{
36175
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
36176
0
}
36177
36178
struct ovsdb_idl_cursor
36179
ovsrec_open_vswitch_cursor_first(struct ovsdb_idl_index *index)
36180
0
{
36181
0
    ovs_assert(index->table->class_ == &ovsrec_table_open_vswitch);
36182
0
    return ovsdb_idl_cursor_first(index);
36183
0
}
36184
36185
struct ovsdb_idl_cursor
36186
ovsrec_open_vswitch_cursor_first_eq(
36187
    struct ovsdb_idl_index *index, const struct ovsrec_open_vswitch *target)
36188
0
{
36189
0
    ovs_assert(index->table->class_ == &ovsrec_table_open_vswitch);
36190
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
36191
0
}
36192
36193
struct ovsdb_idl_cursor
36194
ovsrec_open_vswitch_cursor_first_ge(
36195
    struct ovsdb_idl_index *index, const struct ovsrec_open_vswitch *target)
36196
0
{
36197
0
    ovs_assert(index->table->class_ == &ovsrec_table_open_vswitch);
36198
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
36199
0
}
36200
36201
struct ovsrec_open_vswitch *
36202
ovsrec_open_vswitch_cursor_data(struct ovsdb_idl_cursor *cursor)
36203
0
{
36204
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_cursor_data(cursor));
36205
0
}
36206
36207
36208
/* Sets the "bridges" column from the "Open_vSwitch" table in 'row' to
36209
 * the 'bridges' set with 'n_bridges' entries.
36210
 *
36211
 * The caller retains ownership of the arguments. */
36212
void
36213
ovsrec_open_vswitch_index_set_bridges(const struct ovsrec_open_vswitch *row, struct ovsrec_bridge **bridges, size_t n_bridges)
36214
0
{
36215
0
    struct ovsdb_datum datum;
36216
36217
0
    datum.refcnt = NULL;
36218
0
    size_t i;
36219
36220
0
    datum.n = n_bridges;
36221
0
    datum.keys = n_bridges ? xmalloc(n_bridges * sizeof *datum.keys) : NULL;
36222
0
    datum.values = NULL;
36223
0
    for (i = 0; i < n_bridges; i++) {
36224
0
        datum.keys[i].uuid = bridges[i]->header_.uuid;
36225
0
    }
36226
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_bridges.type);
36227
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_BRIDGES ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36228
0
}
36229
36230
/* Sets the "cur_cfg" column from the "Open_vSwitch" table in 'row' to
36231
 * 'cur_cfg'.
36232
 *
36233
 * The caller retains ownership of the arguments. */
36234
void
36235
ovsrec_open_vswitch_index_set_cur_cfg(const struct ovsrec_open_vswitch *row, int64_t cur_cfg)
36236
0
{
36237
0
    struct ovsdb_datum datum;
36238
36239
0
    datum.refcnt = NULL;
36240
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
36241
36242
0
    datum.n = 1;
36243
0
    datum.keys = key;
36244
0
    key->integer = cur_cfg;
36245
0
    datum.values = NULL;
36246
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_CUR_CFG ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36247
0
}
36248
36249
/* Sets the "datapath_types" column from the "Open_vSwitch" table in 'row' to
36250
 * the 'datapath_types' set with 'n_datapath_types' entries.
36251
 *
36252
 * The caller retains ownership of the arguments. */
36253
void
36254
ovsrec_open_vswitch_index_set_datapath_types(const struct ovsrec_open_vswitch *row, const char **datapath_types, size_t n_datapath_types)
36255
0
{
36256
0
    struct ovsdb_datum datum;
36257
36258
0
    datum.refcnt = NULL;
36259
0
    size_t i;
36260
36261
0
    datum.n = n_datapath_types;
36262
0
    datum.keys = n_datapath_types ? xmalloc(n_datapath_types * sizeof *datum.keys) : NULL;
36263
0
    datum.values = NULL;
36264
0
    for (i = 0; i < n_datapath_types; i++) {
36265
0
        datum.keys[i].s = ovsdb_atom_string_create(datapath_types[i]);
36266
0
    }
36267
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_datapath_types.type);
36268
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_DATAPATH_TYPES ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36269
0
}
36270
36271
/* Sets the "datapaths" column from the "Open_vSwitch" table in 'row' to
36272
 * the map with keys 'key_datapaths' and values 'value_datapaths'
36273
 * with 'n_datapaths' entries.
36274
 *
36275
 * The caller retains ownership of the arguments. */
36276
void
36277
ovsrec_open_vswitch_index_set_datapaths(const struct ovsrec_open_vswitch *row, const char **key_datapaths, struct ovsrec_datapath **value_datapaths, size_t n_datapaths)
36278
0
{
36279
0
    struct ovsdb_datum datum;
36280
36281
0
    datum.refcnt = NULL;
36282
0
    size_t i;
36283
36284
0
    datum.n = n_datapaths;
36285
0
    datum.keys = n_datapaths ? xmalloc(n_datapaths * sizeof *datum.keys) : NULL;
36286
0
    datum.values = xmalloc(n_datapaths * sizeof *datum.values);
36287
0
    for (i = 0; i < n_datapaths; i++) {
36288
0
        datum.keys[i].s = ovsdb_atom_string_create(key_datapaths[i]);
36289
0
        datum.values[i].uuid = value_datapaths[i]->header_.uuid;
36290
0
    }
36291
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_datapaths.type);
36292
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_DATAPATHS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36293
0
}
36294
36295
/* Sets the "db_version" column from the "Open_vSwitch" table in 'row' to
36296
 * the 'db_version' set.
36297
 *
36298
 * If "db_version" is null, the column will be the empty set,
36299
 * otherwise it will contain the specified value.
36300
 *
36301
 * The caller retains ownership of the arguments. */
36302
void
36303
ovsrec_open_vswitch_index_set_db_version(const struct ovsrec_open_vswitch *row, const char *db_version)
36304
0
{
36305
0
    struct ovsdb_datum datum;
36306
36307
0
    datum.refcnt = NULL;
36308
0
    union ovsdb_atom *key;
36309
36310
0
    if (db_version) {
36311
0
        key = xmalloc(sizeof (union ovsdb_atom));
36312
0
        datum.n = 1;
36313
0
        datum.keys = key;
36314
0
        key->s = ovsdb_atom_string_create(db_version);
36315
0
    } else {
36316
0
        datum.n = 0;
36317
0
        datum.keys = NULL;
36318
0
    }
36319
0
    datum.values = NULL;
36320
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_DB_VERSION ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36321
0
}
36322
36323
/* Sets the "dpdk_initialized" column from the "Open_vSwitch" table in 'row' to
36324
 * 'dpdk_initialized'.
36325
 *
36326
 * The caller retains ownership of the arguments. */
36327
void
36328
ovsrec_open_vswitch_index_set_dpdk_initialized(const struct ovsrec_open_vswitch *row, bool dpdk_initialized)
36329
0
{
36330
0
    struct ovsdb_datum datum;
36331
36332
0
    datum.refcnt = NULL;
36333
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
36334
36335
0
    datum.n = 1;
36336
0
    datum.keys = key;
36337
0
    key->boolean = dpdk_initialized;
36338
0
    datum.values = NULL;
36339
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_DPDK_INITIALIZED ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36340
0
}
36341
36342
/* Sets the "dpdk_version" column from the "Open_vSwitch" table in 'row' to
36343
 * the 'dpdk_version' set.
36344
 *
36345
 * If "dpdk_version" is null, the column will be the empty set,
36346
 * otherwise it will contain the specified value.
36347
 *
36348
 * The caller retains ownership of the arguments. */
36349
void
36350
ovsrec_open_vswitch_index_set_dpdk_version(const struct ovsrec_open_vswitch *row, const char *dpdk_version)
36351
0
{
36352
0
    struct ovsdb_datum datum;
36353
36354
0
    datum.refcnt = NULL;
36355
0
    union ovsdb_atom *key;
36356
36357
0
    if (dpdk_version) {
36358
0
        key = xmalloc(sizeof (union ovsdb_atom));
36359
0
        datum.n = 1;
36360
0
        datum.keys = key;
36361
0
        key->s = ovsdb_atom_string_create(dpdk_version);
36362
0
    } else {
36363
0
        datum.n = 0;
36364
0
        datum.keys = NULL;
36365
0
    }
36366
0
    datum.values = NULL;
36367
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_DPDK_VERSION ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36368
0
}
36369
36370
/* Sets the "external_ids" column's value from the "Open_vSwitch" table in 'row'
36371
 * to 'external_ids'.
36372
 *
36373
 * The caller retains ownership of 'external_ids' and everything in it. */
36374
void
36375
ovsrec_open_vswitch_index_set_external_ids(const struct ovsrec_open_vswitch *row, const struct smap *external_ids)
36376
0
{
36377
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
36378
36379
0
    if (external_ids) {
36380
0
        struct smap_node *node;
36381
0
        size_t i;
36382
36383
0
        datum->n = smap_count(external_ids);
36384
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
36385
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
36386
0
        datum->refcnt = NULL;
36387
36388
0
        i = 0;
36389
0
        SMAP_FOR_EACH (node, external_ids) {
36390
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
36391
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
36392
0
            i++;
36393
0
        }
36394
0
        ovsdb_datum_sort_unique(datum, &ovsrec_open_vswitch_col_external_ids.type);
36395
0
    } else {
36396
0
        ovsdb_datum_init_empty(datum);
36397
0
    }
36398
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
36399
0
                          &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_EXTERNAL_IDS],
36400
0
                          datum,
36401
0
                          &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36402
0
    free(datum);
36403
0
}
36404
36405
36406
/* Sets the "iface_types" column from the "Open_vSwitch" table in 'row' to
36407
 * the 'iface_types' set with 'n_iface_types' entries.
36408
 *
36409
 * The caller retains ownership of the arguments. */
36410
void
36411
ovsrec_open_vswitch_index_set_iface_types(const struct ovsrec_open_vswitch *row, const char **iface_types, size_t n_iface_types)
36412
0
{
36413
0
    struct ovsdb_datum datum;
36414
36415
0
    datum.refcnt = NULL;
36416
0
    size_t i;
36417
36418
0
    datum.n = n_iface_types;
36419
0
    datum.keys = n_iface_types ? xmalloc(n_iface_types * sizeof *datum.keys) : NULL;
36420
0
    datum.values = NULL;
36421
0
    for (i = 0; i < n_iface_types; i++) {
36422
0
        datum.keys[i].s = ovsdb_atom_string_create(iface_types[i]);
36423
0
    }
36424
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_iface_types.type);
36425
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_IFACE_TYPES ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36426
0
}
36427
36428
/* Sets the "manager_options" column from the "Open_vSwitch" table in 'row' to
36429
 * the 'manager_options' set with 'n_manager_options' entries.
36430
 *
36431
 * The caller retains ownership of the arguments. */
36432
void
36433
ovsrec_open_vswitch_index_set_manager_options(const struct ovsrec_open_vswitch *row, struct ovsrec_manager **manager_options, size_t n_manager_options)
36434
0
{
36435
0
    struct ovsdb_datum datum;
36436
36437
0
    datum.refcnt = NULL;
36438
0
    size_t i;
36439
36440
0
    datum.n = n_manager_options;
36441
0
    datum.keys = n_manager_options ? xmalloc(n_manager_options * sizeof *datum.keys) : NULL;
36442
0
    datum.values = NULL;
36443
0
    for (i = 0; i < n_manager_options; i++) {
36444
0
        datum.keys[i].uuid = manager_options[i]->header_.uuid;
36445
0
    }
36446
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_manager_options.type);
36447
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_MANAGER_OPTIONS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36448
0
}
36449
36450
/* Sets the "next_cfg" column from the "Open_vSwitch" table in 'row' to
36451
 * 'next_cfg'.
36452
 *
36453
 * The caller retains ownership of the arguments. */
36454
void
36455
ovsrec_open_vswitch_index_set_next_cfg(const struct ovsrec_open_vswitch *row, int64_t next_cfg)
36456
0
{
36457
0
    struct ovsdb_datum datum;
36458
36459
0
    datum.refcnt = NULL;
36460
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
36461
36462
0
    datum.n = 1;
36463
0
    datum.keys = key;
36464
0
    key->integer = next_cfg;
36465
0
    datum.values = NULL;
36466
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_NEXT_CFG ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36467
0
}
36468
36469
/* Sets the "other_config" column's value from the "Open_vSwitch" table in 'row'
36470
 * to 'other_config'.
36471
 *
36472
 * The caller retains ownership of 'other_config' and everything in it. */
36473
void
36474
ovsrec_open_vswitch_index_set_other_config(const struct ovsrec_open_vswitch *row, const struct smap *other_config)
36475
0
{
36476
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
36477
36478
0
    if (other_config) {
36479
0
        struct smap_node *node;
36480
0
        size_t i;
36481
36482
0
        datum->n = smap_count(other_config);
36483
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
36484
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
36485
0
        datum->refcnt = NULL;
36486
36487
0
        i = 0;
36488
0
        SMAP_FOR_EACH (node, other_config) {
36489
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
36490
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
36491
0
            i++;
36492
0
        }
36493
0
        ovsdb_datum_sort_unique(datum, &ovsrec_open_vswitch_col_other_config.type);
36494
0
    } else {
36495
0
        ovsdb_datum_init_empty(datum);
36496
0
    }
36497
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
36498
0
                          &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_OTHER_CONFIG],
36499
0
                          datum,
36500
0
                          &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36501
0
    free(datum);
36502
0
}
36503
36504
36505
/* Sets the "ovs_version" column from the "Open_vSwitch" table in 'row' to
36506
 * the 'ovs_version' set.
36507
 *
36508
 * If "ovs_version" is null, the column will be the empty set,
36509
 * otherwise it will contain the specified value.
36510
 *
36511
 * The caller retains ownership of the arguments. */
36512
void
36513
ovsrec_open_vswitch_index_set_ovs_version(const struct ovsrec_open_vswitch *row, const char *ovs_version)
36514
0
{
36515
0
    struct ovsdb_datum datum;
36516
36517
0
    datum.refcnt = NULL;
36518
0
    union ovsdb_atom *key;
36519
36520
0
    if (ovs_version) {
36521
0
        key = xmalloc(sizeof (union ovsdb_atom));
36522
0
        datum.n = 1;
36523
0
        datum.keys = key;
36524
0
        key->s = ovsdb_atom_string_create(ovs_version);
36525
0
    } else {
36526
0
        datum.n = 0;
36527
0
        datum.keys = NULL;
36528
0
    }
36529
0
    datum.values = NULL;
36530
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_OVS_VERSION ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36531
0
}
36532
36533
/* Sets the "ssl" column from the "Open_vSwitch" table in 'row' to
36534
 * the 'ssl' set.
36535
 *
36536
 * If "ssl" is null, the column will be the empty set,
36537
 * otherwise it will contain the specified value.
36538
 *
36539
 * The caller retains ownership of the arguments. */
36540
void
36541
ovsrec_open_vswitch_index_set_ssl(const struct ovsrec_open_vswitch *row, const struct ovsrec_ssl *ssl)
36542
0
{
36543
0
    struct ovsdb_datum datum;
36544
36545
0
    datum.refcnt = NULL;
36546
0
    union ovsdb_atom *key;
36547
36548
0
    if (ssl) {
36549
0
        key = xmalloc(sizeof (union ovsdb_atom));
36550
0
        datum.n = 1;
36551
0
        datum.keys = key;
36552
0
        key->uuid = ssl->header_.uuid;
36553
0
    } else {
36554
0
        datum.n = 0;
36555
0
        datum.keys = NULL;
36556
0
    }
36557
0
    datum.values = NULL;
36558
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_SSL ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36559
0
}
36560
36561
/* Sets the "statistics" column's value from the "Open_vSwitch" table in 'row'
36562
 * to 'statistics'.
36563
 *
36564
 * The caller retains ownership of 'statistics' and everything in it. */
36565
void
36566
ovsrec_open_vswitch_index_set_statistics(const struct ovsrec_open_vswitch *row, const struct smap *statistics)
36567
0
{
36568
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
36569
36570
0
    if (statistics) {
36571
0
        struct smap_node *node;
36572
0
        size_t i;
36573
36574
0
        datum->n = smap_count(statistics);
36575
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
36576
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
36577
0
        datum->refcnt = NULL;
36578
36579
0
        i = 0;
36580
0
        SMAP_FOR_EACH (node, statistics) {
36581
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
36582
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
36583
0
            i++;
36584
0
        }
36585
0
        ovsdb_datum_sort_unique(datum, &ovsrec_open_vswitch_col_statistics.type);
36586
0
    } else {
36587
0
        ovsdb_datum_init_empty(datum);
36588
0
    }
36589
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
36590
0
                          &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_STATISTICS],
36591
0
                          datum,
36592
0
                          &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36593
0
    free(datum);
36594
0
}
36595
36596
36597
/* Sets the "system_type" column from the "Open_vSwitch" table in 'row' to
36598
 * the 'system_type' set.
36599
 *
36600
 * If "system_type" is null, the column will be the empty set,
36601
 * otherwise it will contain the specified value.
36602
 *
36603
 * The caller retains ownership of the arguments. */
36604
void
36605
ovsrec_open_vswitch_index_set_system_type(const struct ovsrec_open_vswitch *row, const char *system_type)
36606
0
{
36607
0
    struct ovsdb_datum datum;
36608
36609
0
    datum.refcnt = NULL;
36610
0
    union ovsdb_atom *key;
36611
36612
0
    if (system_type) {
36613
0
        key = xmalloc(sizeof (union ovsdb_atom));
36614
0
        datum.n = 1;
36615
0
        datum.keys = key;
36616
0
        key->s = ovsdb_atom_string_create(system_type);
36617
0
    } else {
36618
0
        datum.n = 0;
36619
0
        datum.keys = NULL;
36620
0
    }
36621
0
    datum.values = NULL;
36622
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_SYSTEM_TYPE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36623
0
}
36624
36625
/* Sets the "system_version" column from the "Open_vSwitch" table in 'row' to
36626
 * the 'system_version' set.
36627
 *
36628
 * If "system_version" is null, the column will be the empty set,
36629
 * otherwise it will contain the specified value.
36630
 *
36631
 * The caller retains ownership of the arguments. */
36632
void
36633
ovsrec_open_vswitch_index_set_system_version(const struct ovsrec_open_vswitch *row, const char *system_version)
36634
0
{
36635
0
    struct ovsdb_datum datum;
36636
36637
0
    datum.refcnt = NULL;
36638
0
    union ovsdb_atom *key;
36639
36640
0
    if (system_version) {
36641
0
        key = xmalloc(sizeof (union ovsdb_atom));
36642
0
        datum.n = 1;
36643
0
        datum.keys = key;
36644
0
        key->s = ovsdb_atom_string_create(system_version);
36645
0
    } else {
36646
0
        datum.n = 0;
36647
0
        datum.keys = NULL;
36648
0
    }
36649
0
    datum.values = NULL;
36650
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_open_vswitch_columns[ OVSREC_OPEN_VSWITCH_COL_SYSTEM_VERSION ], &datum, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
36651
0
}
36652
36653
struct ovsdb_idl_column ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_N_COLUMNS];
36654
36655
unsigned int
36656
ovsrec_open_vswitch_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
36657
0
{
36658
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_open_vswitch, condition);
36659
0
}
36660
36661
struct ovsdb_idl_column ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_N_COLUMNS] = {
36662
    [OVSREC_OPEN_VSWITCH_COL_BRIDGES] = {
36663
         .name = "bridges",
36664
         .type = {
36665
            .key = {
36666
               .type = OVSDB_TYPE_UUID,
36667
               .uuid = { .refTableName = "Bridge", .refType = OVSDB_REF_STRONG },
36668
            },
36669
            .value = OVSDB_BASE_VOID_INIT,
36670
            .n_min = 0,
36671
            .n_max = UINT_MAX,
36672
         },
36673
         .is_mutable = true,
36674
         .is_synthetic = false,
36675
         .parse = ovsrec_open_vswitch_parse_bridges,
36676
         .unparse = ovsrec_open_vswitch_unparse_bridges,
36677
    },
36678
36679
    [OVSREC_OPEN_VSWITCH_COL_CUR_CFG] = {
36680
         .name = "cur_cfg",
36681
         .type = {
36682
            .key = {
36683
               .type = OVSDB_TYPE_INTEGER,
36684
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
36685
            },
36686
            .value = OVSDB_BASE_VOID_INIT,
36687
            .n_min = 1,
36688
            .n_max = 1,
36689
         },
36690
         .is_mutable = true,
36691
         .is_synthetic = false,
36692
         .parse = ovsrec_open_vswitch_parse_cur_cfg,
36693
         .unparse = ovsrec_open_vswitch_unparse_cur_cfg,
36694
    },
36695
36696
    [OVSREC_OPEN_VSWITCH_COL_DATAPATH_TYPES] = {
36697
         .name = "datapath_types",
36698
         .type = {
36699
            .key = {
36700
               .type = OVSDB_TYPE_STRING,
36701
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36702
            },
36703
            .value = OVSDB_BASE_VOID_INIT,
36704
            .n_min = 0,
36705
            .n_max = UINT_MAX,
36706
         },
36707
         .is_mutable = true,
36708
         .is_synthetic = false,
36709
         .parse = ovsrec_open_vswitch_parse_datapath_types,
36710
         .unparse = ovsrec_open_vswitch_unparse_datapath_types,
36711
    },
36712
36713
    [OVSREC_OPEN_VSWITCH_COL_DATAPATHS] = {
36714
         .name = "datapaths",
36715
         .type = {
36716
            .key = {
36717
               .type = OVSDB_TYPE_STRING,
36718
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36719
            },
36720
            .value = {
36721
                .type = OVSDB_TYPE_UUID,
36722
                .uuid = { .refTableName = "Datapath", .refType = OVSDB_REF_STRONG },
36723
            },
36724
            .n_min = 0,
36725
            .n_max = UINT_MAX,
36726
         },
36727
         .is_mutable = true,
36728
         .is_synthetic = false,
36729
         .parse = ovsrec_open_vswitch_parse_datapaths,
36730
         .unparse = ovsrec_open_vswitch_unparse_datapaths,
36731
    },
36732
36733
    [OVSREC_OPEN_VSWITCH_COL_DB_VERSION] = {
36734
         .name = "db_version",
36735
         .type = {
36736
            .key = {
36737
               .type = OVSDB_TYPE_STRING,
36738
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36739
            },
36740
            .value = OVSDB_BASE_VOID_INIT,
36741
            .n_min = 0,
36742
            .n_max = 1,
36743
         },
36744
         .is_mutable = true,
36745
         .is_synthetic = false,
36746
         .parse = ovsrec_open_vswitch_parse_db_version,
36747
         .unparse = ovsrec_open_vswitch_unparse_db_version,
36748
    },
36749
36750
    [OVSREC_OPEN_VSWITCH_COL_DPDK_INITIALIZED] = {
36751
         .name = "dpdk_initialized",
36752
         .type = {
36753
            .key = {
36754
               .type = OVSDB_TYPE_BOOLEAN,
36755
            },
36756
            .value = OVSDB_BASE_VOID_INIT,
36757
            .n_min = 1,
36758
            .n_max = 1,
36759
         },
36760
         .is_mutable = true,
36761
         .is_synthetic = false,
36762
         .parse = ovsrec_open_vswitch_parse_dpdk_initialized,
36763
         .unparse = ovsrec_open_vswitch_unparse_dpdk_initialized,
36764
    },
36765
36766
    [OVSREC_OPEN_VSWITCH_COL_DPDK_VERSION] = {
36767
         .name = "dpdk_version",
36768
         .type = {
36769
            .key = {
36770
               .type = OVSDB_TYPE_STRING,
36771
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36772
            },
36773
            .value = OVSDB_BASE_VOID_INIT,
36774
            .n_min = 0,
36775
            .n_max = 1,
36776
         },
36777
         .is_mutable = true,
36778
         .is_synthetic = false,
36779
         .parse = ovsrec_open_vswitch_parse_dpdk_version,
36780
         .unparse = ovsrec_open_vswitch_unparse_dpdk_version,
36781
    },
36782
36783
    [OVSREC_OPEN_VSWITCH_COL_EXTERNAL_IDS] = {
36784
         .name = "external_ids",
36785
         .type = {
36786
            .key = {
36787
               .type = OVSDB_TYPE_STRING,
36788
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36789
            },
36790
            .value = {
36791
                .type = OVSDB_TYPE_STRING,
36792
                .string = { .minLen = 0, .maxLen = UINT_MAX },
36793
            },
36794
            .n_min = 0,
36795
            .n_max = UINT_MAX,
36796
         },
36797
         .is_mutable = true,
36798
         .is_synthetic = false,
36799
         .parse = ovsrec_open_vswitch_parse_external_ids,
36800
         .unparse = ovsrec_open_vswitch_unparse_external_ids,
36801
    },
36802
36803
    [OVSREC_OPEN_VSWITCH_COL_IFACE_TYPES] = {
36804
         .name = "iface_types",
36805
         .type = {
36806
            .key = {
36807
               .type = OVSDB_TYPE_STRING,
36808
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36809
            },
36810
            .value = OVSDB_BASE_VOID_INIT,
36811
            .n_min = 0,
36812
            .n_max = UINT_MAX,
36813
         },
36814
         .is_mutable = true,
36815
         .is_synthetic = false,
36816
         .parse = ovsrec_open_vswitch_parse_iface_types,
36817
         .unparse = ovsrec_open_vswitch_unparse_iface_types,
36818
    },
36819
36820
    [OVSREC_OPEN_VSWITCH_COL_MANAGER_OPTIONS] = {
36821
         .name = "manager_options",
36822
         .type = {
36823
            .key = {
36824
               .type = OVSDB_TYPE_UUID,
36825
               .uuid = { .refTableName = "Manager", .refType = OVSDB_REF_STRONG },
36826
            },
36827
            .value = OVSDB_BASE_VOID_INIT,
36828
            .n_min = 0,
36829
            .n_max = UINT_MAX,
36830
         },
36831
         .is_mutable = true,
36832
         .is_synthetic = false,
36833
         .parse = ovsrec_open_vswitch_parse_manager_options,
36834
         .unparse = ovsrec_open_vswitch_unparse_manager_options,
36835
    },
36836
36837
    [OVSREC_OPEN_VSWITCH_COL_NEXT_CFG] = {
36838
         .name = "next_cfg",
36839
         .type = {
36840
            .key = {
36841
               .type = OVSDB_TYPE_INTEGER,
36842
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
36843
            },
36844
            .value = OVSDB_BASE_VOID_INIT,
36845
            .n_min = 1,
36846
            .n_max = 1,
36847
         },
36848
         .is_mutable = true,
36849
         .is_synthetic = false,
36850
         .parse = ovsrec_open_vswitch_parse_next_cfg,
36851
         .unparse = ovsrec_open_vswitch_unparse_next_cfg,
36852
    },
36853
36854
    [OVSREC_OPEN_VSWITCH_COL_OTHER_CONFIG] = {
36855
         .name = "other_config",
36856
         .type = {
36857
            .key = {
36858
               .type = OVSDB_TYPE_STRING,
36859
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36860
            },
36861
            .value = {
36862
                .type = OVSDB_TYPE_STRING,
36863
                .string = { .minLen = 0, .maxLen = UINT_MAX },
36864
            },
36865
            .n_min = 0,
36866
            .n_max = UINT_MAX,
36867
         },
36868
         .is_mutable = true,
36869
         .is_synthetic = false,
36870
         .parse = ovsrec_open_vswitch_parse_other_config,
36871
         .unparse = ovsrec_open_vswitch_unparse_other_config,
36872
    },
36873
36874
    [OVSREC_OPEN_VSWITCH_COL_OVS_VERSION] = {
36875
         .name = "ovs_version",
36876
         .type = {
36877
            .key = {
36878
               .type = OVSDB_TYPE_STRING,
36879
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36880
            },
36881
            .value = OVSDB_BASE_VOID_INIT,
36882
            .n_min = 0,
36883
            .n_max = 1,
36884
         },
36885
         .is_mutable = true,
36886
         .is_synthetic = false,
36887
         .parse = ovsrec_open_vswitch_parse_ovs_version,
36888
         .unparse = ovsrec_open_vswitch_unparse_ovs_version,
36889
    },
36890
36891
    [OVSREC_OPEN_VSWITCH_COL_SSL] = {
36892
         .name = "ssl",
36893
         .type = {
36894
            .key = {
36895
               .type = OVSDB_TYPE_UUID,
36896
               .uuid = { .refTableName = "SSL", .refType = OVSDB_REF_STRONG },
36897
            },
36898
            .value = OVSDB_BASE_VOID_INIT,
36899
            .n_min = 0,
36900
            .n_max = 1,
36901
         },
36902
         .is_mutable = true,
36903
         .is_synthetic = false,
36904
         .parse = ovsrec_open_vswitch_parse_ssl,
36905
         .unparse = ovsrec_open_vswitch_unparse_ssl,
36906
    },
36907
36908
    [OVSREC_OPEN_VSWITCH_COL_STATISTICS] = {
36909
         .name = "statistics",
36910
         .type = {
36911
            .key = {
36912
               .type = OVSDB_TYPE_STRING,
36913
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36914
            },
36915
            .value = {
36916
                .type = OVSDB_TYPE_STRING,
36917
                .string = { .minLen = 0, .maxLen = UINT_MAX },
36918
            },
36919
            .n_min = 0,
36920
            .n_max = UINT_MAX,
36921
         },
36922
         .is_mutable = true,
36923
         .is_synthetic = false,
36924
         .parse = ovsrec_open_vswitch_parse_statistics,
36925
         .unparse = ovsrec_open_vswitch_unparse_statistics,
36926
    },
36927
36928
    [OVSREC_OPEN_VSWITCH_COL_SYSTEM_TYPE] = {
36929
         .name = "system_type",
36930
         .type = {
36931
            .key = {
36932
               .type = OVSDB_TYPE_STRING,
36933
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36934
            },
36935
            .value = OVSDB_BASE_VOID_INIT,
36936
            .n_min = 0,
36937
            .n_max = 1,
36938
         },
36939
         .is_mutable = true,
36940
         .is_synthetic = false,
36941
         .parse = ovsrec_open_vswitch_parse_system_type,
36942
         .unparse = ovsrec_open_vswitch_unparse_system_type,
36943
    },
36944
36945
    [OVSREC_OPEN_VSWITCH_COL_SYSTEM_VERSION] = {
36946
         .name = "system_version",
36947
         .type = {
36948
            .key = {
36949
               .type = OVSDB_TYPE_STRING,
36950
               .string = { .minLen = 0, .maxLen = UINT_MAX },
36951
            },
36952
            .value = OVSDB_BASE_VOID_INIT,
36953
            .n_min = 0,
36954
            .n_max = 1,
36955
         },
36956
         .is_mutable = true,
36957
         .is_synthetic = false,
36958
         .parse = ovsrec_open_vswitch_parse_system_version,
36959
         .unparse = ovsrec_open_vswitch_unparse_system_version,
36960
    },
36961
36962
};
36963

36964
/* Port table. */
36965
36966
bool
36967
ovsrec_server_has_port_table_col_bond_active_slave(const struct ovsdb_idl *idl)
36968
0
{
36969
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_bond_active_slave);
36970
0
}
36971
36972
const struct ovsdb_type *
36973
ovsrec_port_bond_active_slave_server_type(const struct ovsdb_idl *idl)
36974
0
{
36975
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_bond_active_slave);
36976
0
}
36977
36978
36979
bool
36980
ovsrec_server_has_port_table_col_bond_downdelay(const struct ovsdb_idl *idl)
36981
0
{
36982
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_bond_downdelay);
36983
0
}
36984
36985
const struct ovsdb_type *
36986
ovsrec_port_bond_downdelay_server_type(const struct ovsdb_idl *idl)
36987
0
{
36988
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_bond_downdelay);
36989
0
}
36990
36991
36992
bool
36993
ovsrec_server_has_port_table_col_bond_fake_iface(const struct ovsdb_idl *idl)
36994
0
{
36995
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_bond_fake_iface);
36996
0
}
36997
36998
const struct ovsdb_type *
36999
ovsrec_port_bond_fake_iface_server_type(const struct ovsdb_idl *idl)
37000
0
{
37001
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_bond_fake_iface);
37002
0
}
37003
37004
37005
bool
37006
ovsrec_server_has_port_table_col_bond_mode(const struct ovsdb_idl *idl)
37007
0
{
37008
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_bond_mode);
37009
0
}
37010
37011
const struct ovsdb_type *
37012
ovsrec_port_bond_mode_server_type(const struct ovsdb_idl *idl)
37013
0
{
37014
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_bond_mode);
37015
0
}
37016
37017
37018
bool
37019
ovsrec_server_has_port_table_col_bond_updelay(const struct ovsdb_idl *idl)
37020
0
{
37021
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_bond_updelay);
37022
0
}
37023
37024
const struct ovsdb_type *
37025
ovsrec_port_bond_updelay_server_type(const struct ovsdb_idl *idl)
37026
0
{
37027
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_bond_updelay);
37028
0
}
37029
37030
37031
bool
37032
ovsrec_server_has_port_table_col_cvlans(const struct ovsdb_idl *idl)
37033
0
{
37034
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_cvlans);
37035
0
}
37036
37037
const struct ovsdb_type *
37038
ovsrec_port_cvlans_server_type(const struct ovsdb_idl *idl)
37039
0
{
37040
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_cvlans);
37041
0
}
37042
37043
37044
bool
37045
ovsrec_server_has_port_table_col_external_ids(const struct ovsdb_idl *idl)
37046
0
{
37047
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_external_ids);
37048
0
}
37049
37050
const struct ovsdb_type *
37051
ovsrec_port_external_ids_server_type(const struct ovsdb_idl *idl)
37052
0
{
37053
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_external_ids);
37054
0
}
37055
37056
37057
bool
37058
ovsrec_server_has_port_table_col_fake_bridge(const struct ovsdb_idl *idl)
37059
0
{
37060
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_fake_bridge);
37061
0
}
37062
37063
const struct ovsdb_type *
37064
ovsrec_port_fake_bridge_server_type(const struct ovsdb_idl *idl)
37065
0
{
37066
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_fake_bridge);
37067
0
}
37068
37069
37070
bool
37071
ovsrec_server_has_port_table_col_interfaces(const struct ovsdb_idl *idl)
37072
0
{
37073
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_interfaces);
37074
0
}
37075
37076
const struct ovsdb_type *
37077
ovsrec_port_interfaces_server_type(const struct ovsdb_idl *idl)
37078
0
{
37079
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_interfaces);
37080
0
}
37081
37082
37083
bool
37084
ovsrec_server_has_port_table_col_lacp(const struct ovsdb_idl *idl)
37085
0
{
37086
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_lacp);
37087
0
}
37088
37089
const struct ovsdb_type *
37090
ovsrec_port_lacp_server_type(const struct ovsdb_idl *idl)
37091
0
{
37092
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_lacp);
37093
0
}
37094
37095
37096
bool
37097
ovsrec_server_has_port_table_col_mac(const struct ovsdb_idl *idl)
37098
0
{
37099
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_mac);
37100
0
}
37101
37102
const struct ovsdb_type *
37103
ovsrec_port_mac_server_type(const struct ovsdb_idl *idl)
37104
0
{
37105
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_mac);
37106
0
}
37107
37108
37109
bool
37110
ovsrec_server_has_port_table_col_name(const struct ovsdb_idl *idl)
37111
0
{
37112
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_name);
37113
0
}
37114
37115
const struct ovsdb_type *
37116
ovsrec_port_name_server_type(const struct ovsdb_idl *idl)
37117
0
{
37118
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_name);
37119
0
}
37120
37121
37122
bool
37123
ovsrec_server_has_port_table_col_other_config(const struct ovsdb_idl *idl)
37124
0
{
37125
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_other_config);
37126
0
}
37127
37128
const struct ovsdb_type *
37129
ovsrec_port_other_config_server_type(const struct ovsdb_idl *idl)
37130
0
{
37131
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_other_config);
37132
0
}
37133
37134
37135
bool
37136
ovsrec_server_has_port_table_col_qos(const struct ovsdb_idl *idl)
37137
0
{
37138
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_qos);
37139
0
}
37140
37141
const struct ovsdb_type *
37142
ovsrec_port_qos_server_type(const struct ovsdb_idl *idl)
37143
0
{
37144
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_qos);
37145
0
}
37146
37147
37148
bool
37149
ovsrec_server_has_port_table_col_rstp_statistics(const struct ovsdb_idl *idl)
37150
0
{
37151
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_rstp_statistics);
37152
0
}
37153
37154
const struct ovsdb_type *
37155
ovsrec_port_rstp_statistics_server_type(const struct ovsdb_idl *idl)
37156
0
{
37157
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_rstp_statistics);
37158
0
}
37159
37160
37161
bool
37162
ovsrec_server_has_port_table_col_rstp_status(const struct ovsdb_idl *idl)
37163
0
{
37164
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_rstp_status);
37165
0
}
37166
37167
const struct ovsdb_type *
37168
ovsrec_port_rstp_status_server_type(const struct ovsdb_idl *idl)
37169
0
{
37170
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_rstp_status);
37171
0
}
37172
37173
37174
bool
37175
ovsrec_server_has_port_table_col_statistics(const struct ovsdb_idl *idl)
37176
0
{
37177
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_statistics);
37178
0
}
37179
37180
const struct ovsdb_type *
37181
ovsrec_port_statistics_server_type(const struct ovsdb_idl *idl)
37182
0
{
37183
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_statistics);
37184
0
}
37185
37186
37187
bool
37188
ovsrec_server_has_port_table_col_status(const struct ovsdb_idl *idl)
37189
0
{
37190
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_status);
37191
0
}
37192
37193
const struct ovsdb_type *
37194
ovsrec_port_status_server_type(const struct ovsdb_idl *idl)
37195
0
{
37196
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_status);
37197
0
}
37198
37199
37200
bool
37201
ovsrec_server_has_port_table_col_tag(const struct ovsdb_idl *idl)
37202
0
{
37203
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_tag);
37204
0
}
37205
37206
const struct ovsdb_type *
37207
ovsrec_port_tag_server_type(const struct ovsdb_idl *idl)
37208
0
{
37209
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_tag);
37210
0
}
37211
37212
37213
bool
37214
ovsrec_server_has_port_table_col_trunks(const struct ovsdb_idl *idl)
37215
0
{
37216
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_trunks);
37217
0
}
37218
37219
const struct ovsdb_type *
37220
ovsrec_port_trunks_server_type(const struct ovsdb_idl *idl)
37221
0
{
37222
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_trunks);
37223
0
}
37224
37225
37226
bool
37227
ovsrec_server_has_port_table_col_vlan_mode(const struct ovsdb_idl *idl)
37228
0
{
37229
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_vlan_mode);
37230
0
}
37231
37232
const struct ovsdb_type *
37233
ovsrec_port_vlan_mode_server_type(const struct ovsdb_idl *idl)
37234
0
{
37235
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_vlan_mode);
37236
0
}
37237
37238
37239
bool
37240
ovsrec_server_has_port_table_col_protected_(const struct ovsdb_idl *idl)
37241
0
{
37242
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_protected_);
37243
0
}
37244
37245
const struct ovsdb_type *
37246
ovsrec_port_protected__server_type(const struct ovsdb_idl *idl)
37247
0
{
37248
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_port_col_protected_);
37249
0
}
37250
37251
37252
bool
37253
ovsrec_server_has_port_table(const struct ovsdb_idl *idl)
37254
0
{
37255
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
37256
0
}
37257
37258
37259
const struct ovsrec_port_table *
37260
ovsrec_port_table_get(const struct ovsdb_idl *idl)
37261
0
{
37262
0
    return (const struct ovsrec_port_table *) idl;
37263
0
}
37264
37265
const struct ovsrec_port *
37266
ovsrec_port_table_first(const struct ovsrec_port_table *table)
37267
0
{
37268
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
37269
0
    return ovsrec_port_first(idl);
37270
0
}
37271
37272
37273
const struct ovsrec_port *
37274
ovsrec_port_table_track_get_first(const struct ovsrec_port_table *table)
37275
0
{
37276
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
37277
0
    return ovsrec_port_track_get_first(idl);
37278
0
}
37279
37280
37281
static void
37282
ovsrec_port_parse_bond_active_slave(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37283
0
{
37284
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37285
37286
0
    if (datum->n >= 1) {
37287
0
        row->bond_active_slave = CONST_CAST(char *, json_string(datum->keys[0].s));
37288
0
    } else {
37289
0
        row->bond_active_slave = NULL;
37290
0
    }
37291
0
}
37292
37293
static void
37294
ovsrec_port_parse_bond_downdelay(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37295
0
{
37296
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37297
37298
0
    if (datum->n >= 1) {
37299
0
        row->bond_downdelay = datum->keys[0].integer;
37300
0
    } else {
37301
0
        row->bond_downdelay = 0;
37302
0
    }
37303
0
}
37304
37305
static void
37306
ovsrec_port_parse_bond_fake_iface(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37307
0
{
37308
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37309
37310
0
    if (datum->n >= 1) {
37311
0
        row->bond_fake_iface = datum->keys[0].boolean;
37312
0
    } else {
37313
0
        row->bond_fake_iface = false;
37314
0
    }
37315
0
}
37316
37317
static void
37318
ovsrec_port_parse_bond_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37319
0
{
37320
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37321
37322
0
    if (datum->n >= 1) {
37323
0
        row->bond_mode = CONST_CAST(char *, json_string(datum->keys[0].s));
37324
0
    } else {
37325
0
        row->bond_mode = NULL;
37326
0
    }
37327
0
}
37328
37329
static void
37330
ovsrec_port_parse_bond_updelay(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37331
0
{
37332
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37333
37334
0
    if (datum->n >= 1) {
37335
0
        row->bond_updelay = datum->keys[0].integer;
37336
0
    } else {
37337
0
        row->bond_updelay = 0;
37338
0
    }
37339
0
}
37340
37341
static void
37342
ovsrec_port_parse_cvlans(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37343
0
{
37344
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37345
0
    size_t n = MIN(4096, datum->n);
37346
0
    row->cvlans = NULL;
37347
0
    row->n_cvlans = 0;
37348
0
    for (size_t i = 0; i < n; i++) {
37349
0
        if (!row->n_cvlans) {
37350
0
            row->cvlans = xmalloc(n * sizeof *row->cvlans);
37351
0
        }
37352
0
        row->cvlans[row->n_cvlans] = datum->keys[i].integer;
37353
0
        row->n_cvlans++;
37354
0
    }
37355
0
}
37356
37357
static void
37358
ovsrec_port_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37359
0
{
37360
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37361
0
    smap_init(&row->external_ids);
37362
0
    for (size_t i = 0; i < datum->n; i++) {
37363
0
        smap_add(&row->external_ids,
37364
0
                 json_string(datum->keys[i].s),
37365
0
                 json_string(datum->values[i].s));
37366
0
    }
37367
0
}
37368
37369
static void
37370
ovsrec_port_parse_fake_bridge(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37371
0
{
37372
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37373
37374
0
    if (datum->n >= 1) {
37375
0
        row->fake_bridge = datum->keys[0].boolean;
37376
0
    } else {
37377
0
        row->fake_bridge = false;
37378
0
    }
37379
0
}
37380
37381
static void
37382
ovsrec_port_parse_interfaces(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37383
0
{
37384
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37385
0
    row->interfaces = NULL;
37386
0
    row->n_interfaces = 0;
37387
0
    for (size_t i = 0; i < datum->n; i++) {
37388
0
        struct ovsrec_interface *keyRow = ovsrec_interface_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_interface, &datum->keys[i].uuid));
37389
0
        if (!keyRow) {
37390
0
            continue;
37391
0
        }
37392
0
        if (!row->n_interfaces) {
37393
0
            row->interfaces = xmalloc(datum->n * sizeof *row->interfaces);
37394
0
        }
37395
0
        row->interfaces[row->n_interfaces] = keyRow;
37396
0
        row->n_interfaces++;
37397
0
    }
37398
0
}
37399
37400
static void
37401
ovsrec_port_parse_lacp(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37402
0
{
37403
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37404
37405
0
    if (datum->n >= 1) {
37406
0
        row->lacp = CONST_CAST(char *, json_string(datum->keys[0].s));
37407
0
    } else {
37408
0
        row->lacp = NULL;
37409
0
    }
37410
0
}
37411
37412
static void
37413
ovsrec_port_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37414
0
{
37415
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37416
37417
0
    if (datum->n >= 1) {
37418
0
        row->mac = CONST_CAST(char *, json_string(datum->keys[0].s));
37419
0
    } else {
37420
0
        row->mac = NULL;
37421
0
    }
37422
0
}
37423
37424
static void
37425
ovsrec_port_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37426
0
{
37427
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37428
37429
0
    if (datum->n >= 1) {
37430
0
        row->name = CONST_CAST(char *, json_string(datum->keys[0].s));
37431
0
    } else {
37432
0
        row->name = "";
37433
0
    }
37434
0
}
37435
37436
static void
37437
ovsrec_port_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37438
0
{
37439
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37440
0
    smap_init(&row->other_config);
37441
0
    for (size_t i = 0; i < datum->n; i++) {
37442
0
        smap_add(&row->other_config,
37443
0
                 json_string(datum->keys[i].s),
37444
0
                 json_string(datum->values[i].s));
37445
0
    }
37446
0
}
37447
37448
static void
37449
ovsrec_port_parse_protected_(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37450
0
{
37451
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37452
37453
0
    if (datum->n >= 1) {
37454
0
        row->protected_ = datum->keys[0].boolean;
37455
0
    } else {
37456
0
        row->protected_ = false;
37457
0
    }
37458
0
}
37459
37460
static void
37461
ovsrec_port_parse_qos(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37462
0
{
37463
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37464
37465
0
    if (datum->n >= 1) {
37466
0
        row->qos = ovsrec_qos_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_qos, &datum->keys[0].uuid));
37467
0
    } else {
37468
0
        row->qos = NULL;
37469
0
    }
37470
0
}
37471
37472
static void
37473
ovsrec_port_parse_rstp_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37474
0
{
37475
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37476
0
    row->key_rstp_statistics = NULL;
37477
0
    row->value_rstp_statistics = NULL;
37478
0
    row->n_rstp_statistics = 0;
37479
0
    for (size_t i = 0; i < datum->n; i++) {
37480
0
        if (!row->n_rstp_statistics) {
37481
0
            row->key_rstp_statistics = xmalloc(datum->n * sizeof *row->key_rstp_statistics);
37482
0
            row->value_rstp_statistics = xmalloc(datum->n * sizeof *row->value_rstp_statistics);
37483
0
        }
37484
0
        row->key_rstp_statistics[row->n_rstp_statistics] = CONST_CAST(char *, json_string(datum->keys[i].s));
37485
0
        row->value_rstp_statistics[row->n_rstp_statistics] = datum->values[i].integer;
37486
0
        row->n_rstp_statistics++;
37487
0
    }
37488
0
}
37489
37490
static void
37491
ovsrec_port_parse_rstp_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37492
0
{
37493
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37494
0
    smap_init(&row->rstp_status);
37495
0
    for (size_t i = 0; i < datum->n; i++) {
37496
0
        smap_add(&row->rstp_status,
37497
0
                 json_string(datum->keys[i].s),
37498
0
                 json_string(datum->values[i].s));
37499
0
    }
37500
0
}
37501
37502
static void
37503
ovsrec_port_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37504
0
{
37505
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37506
0
    row->key_statistics = NULL;
37507
0
    row->value_statistics = NULL;
37508
0
    row->n_statistics = 0;
37509
0
    for (size_t i = 0; i < datum->n; i++) {
37510
0
        if (!row->n_statistics) {
37511
0
            row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
37512
0
            row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
37513
0
        }
37514
0
        row->key_statistics[row->n_statistics] = CONST_CAST(char *, json_string(datum->keys[i].s));
37515
0
        row->value_statistics[row->n_statistics] = datum->values[i].integer;
37516
0
        row->n_statistics++;
37517
0
    }
37518
0
}
37519
37520
static void
37521
ovsrec_port_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37522
0
{
37523
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37524
0
    smap_init(&row->status);
37525
0
    for (size_t i = 0; i < datum->n; i++) {
37526
0
        smap_add(&row->status,
37527
0
                 json_string(datum->keys[i].s),
37528
0
                 json_string(datum->values[i].s));
37529
0
    }
37530
0
}
37531
37532
static void
37533
ovsrec_port_parse_tag(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37534
0
{
37535
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37536
0
    size_t n = MIN(1, datum->n);
37537
0
    row->tag = NULL;
37538
0
    row->n_tag = 0;
37539
0
    for (size_t i = 0; i < n; i++) {
37540
0
        if (!row->n_tag) {
37541
0
            row->tag = xmalloc(n * sizeof *row->tag);
37542
0
        }
37543
0
        row->tag[row->n_tag] = datum->keys[i].integer;
37544
0
        row->n_tag++;
37545
0
    }
37546
0
}
37547
37548
static void
37549
ovsrec_port_parse_trunks(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37550
0
{
37551
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37552
0
    size_t n = MIN(4096, datum->n);
37553
0
    row->trunks = NULL;
37554
0
    row->n_trunks = 0;
37555
0
    for (size_t i = 0; i < n; i++) {
37556
0
        if (!row->n_trunks) {
37557
0
            row->trunks = xmalloc(n * sizeof *row->trunks);
37558
0
        }
37559
0
        row->trunks[row->n_trunks] = datum->keys[i].integer;
37560
0
        row->n_trunks++;
37561
0
    }
37562
0
}
37563
37564
static void
37565
ovsrec_port_parse_vlan_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
37566
0
{
37567
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37568
37569
0
    if (datum->n >= 1) {
37570
0
        row->vlan_mode = CONST_CAST(char *, json_string(datum->keys[0].s));
37571
0
    } else {
37572
0
        row->vlan_mode = NULL;
37573
0
    }
37574
0
}
37575
37576
static void
37577
ovsrec_port_unparse_bond_active_slave(struct ovsdb_idl_row *row OVS_UNUSED)
37578
0
{
37579
    /* Nothing to do. */
37580
0
}
37581
37582
static void
37583
ovsrec_port_unparse_bond_downdelay(struct ovsdb_idl_row *row OVS_UNUSED)
37584
0
{
37585
    /* Nothing to do. */
37586
0
}
37587
37588
static void
37589
ovsrec_port_unparse_bond_fake_iface(struct ovsdb_idl_row *row OVS_UNUSED)
37590
0
{
37591
    /* Nothing to do. */
37592
0
}
37593
37594
static void
37595
ovsrec_port_unparse_bond_mode(struct ovsdb_idl_row *row OVS_UNUSED)
37596
0
{
37597
    /* Nothing to do. */
37598
0
}
37599
37600
static void
37601
ovsrec_port_unparse_bond_updelay(struct ovsdb_idl_row *row OVS_UNUSED)
37602
0
{
37603
    /* Nothing to do. */
37604
0
}
37605
37606
static void
37607
ovsrec_port_unparse_cvlans(struct ovsdb_idl_row *row_)
37608
0
{
37609
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37610
0
    free(row->cvlans);
37611
0
}
37612
37613
static void
37614
ovsrec_port_unparse_external_ids(struct ovsdb_idl_row *row_)
37615
0
{
37616
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37617
0
    smap_destroy(&row->external_ids);
37618
0
}
37619
37620
static void
37621
ovsrec_port_unparse_fake_bridge(struct ovsdb_idl_row *row OVS_UNUSED)
37622
0
{
37623
    /* Nothing to do. */
37624
0
}
37625
37626
static void
37627
ovsrec_port_unparse_interfaces(struct ovsdb_idl_row *row_)
37628
0
{
37629
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37630
0
    free(row->interfaces);
37631
0
}
37632
37633
static void
37634
ovsrec_port_unparse_lacp(struct ovsdb_idl_row *row OVS_UNUSED)
37635
0
{
37636
    /* Nothing to do. */
37637
0
}
37638
37639
static void
37640
ovsrec_port_unparse_mac(struct ovsdb_idl_row *row OVS_UNUSED)
37641
0
{
37642
    /* Nothing to do. */
37643
0
}
37644
37645
static void
37646
ovsrec_port_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
37647
0
{
37648
    /* Nothing to do. */
37649
0
}
37650
37651
static void
37652
ovsrec_port_unparse_other_config(struct ovsdb_idl_row *row_)
37653
0
{
37654
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37655
0
    smap_destroy(&row->other_config);
37656
0
}
37657
37658
static void
37659
ovsrec_port_unparse_protected_(struct ovsdb_idl_row *row OVS_UNUSED)
37660
0
{
37661
    /* Nothing to do. */
37662
0
}
37663
37664
static void
37665
ovsrec_port_unparse_qos(struct ovsdb_idl_row *row OVS_UNUSED)
37666
0
{
37667
    /* Nothing to do. */
37668
0
}
37669
37670
static void
37671
ovsrec_port_unparse_rstp_statistics(struct ovsdb_idl_row *row_)
37672
0
{
37673
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37674
0
    free(row->key_rstp_statistics);
37675
0
    free(row->value_rstp_statistics);
37676
0
}
37677
37678
static void
37679
ovsrec_port_unparse_rstp_status(struct ovsdb_idl_row *row_)
37680
0
{
37681
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37682
0
    smap_destroy(&row->rstp_status);
37683
0
}
37684
37685
static void
37686
ovsrec_port_unparse_statistics(struct ovsdb_idl_row *row_)
37687
0
{
37688
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37689
0
    free(row->key_statistics);
37690
0
    free(row->value_statistics);
37691
0
}
37692
37693
static void
37694
ovsrec_port_unparse_status(struct ovsdb_idl_row *row_)
37695
0
{
37696
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37697
0
    smap_destroy(&row->status);
37698
0
}
37699
37700
static void
37701
ovsrec_port_unparse_tag(struct ovsdb_idl_row *row_)
37702
0
{
37703
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37704
0
    free(row->tag);
37705
0
}
37706
37707
static void
37708
ovsrec_port_unparse_trunks(struct ovsdb_idl_row *row_)
37709
0
{
37710
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
37711
0
    free(row->trunks);
37712
0
}
37713
37714
static void
37715
ovsrec_port_unparse_vlan_mode(struct ovsdb_idl_row *row OVS_UNUSED)
37716
0
{
37717
    /* Nothing to do. */
37718
0
}
37719
37720
static void
37721
ovsrec_port_init__(struct ovsdb_idl_row *row)
37722
0
{
37723
0
    ovsrec_port_init(ovsrec_port_cast(row));
37724
0
}
37725
37726
/* Clears the contents of 'row' in table "Port". */
37727
void
37728
ovsrec_port_init(struct ovsrec_port *row)
37729
0
{
37730
0
    memset(row, 0, sizeof *row); 
37731
0
    smap_init(&row->external_ids);
37732
0
    row->name = "";
37733
0
    smap_init(&row->other_config);
37734
0
    smap_init(&row->rstp_status);
37735
0
    smap_init(&row->status);
37736
0
}
37737
37738
/* Searches table "Port" in 'idl' for a row with UUID 'uuid'.  Returns
37739
 * a pointer to the row if there is one, otherwise a null pointer.  */
37740
const struct ovsrec_port *
37741
ovsrec_port_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
37742
0
{
37743
0
    return ovsrec_port_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_port, uuid));
37744
0
}
37745
37746
/* Searches table "Port" for a row with UUID 'uuid'.  Returns
37747
 * a pointer to the row if there is one, otherwise a null pointer.  */
37748
const struct ovsrec_port *
37749
ovsrec_port_table_get_for_uuid(const struct ovsrec_port_table *table, const struct uuid *uuid)
37750
0
{
37751
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
37752
0
    return ovsrec_port_get_for_uuid(idl, uuid);
37753
0
}
37754
37755
/* Returns a row in table "Port" in 'idl', or a null pointer if that
37756
 * table is empty.
37757
 *
37758
 * Database tables are internally maintained as hash tables, so adding or
37759
 * removing rows while traversing the same table can cause some rows to be
37760
 * visited twice or not at apply. */
37761
const struct ovsrec_port *
37762
ovsrec_port_first(const struct ovsdb_idl *idl)
37763
0
{
37764
0
    return ovsrec_port_cast(ovsdb_idl_first_row(idl, &ovsrec_table_port));
37765
0
}
37766
37767
/* Returns a row following 'row' within its table, or a null pointer if 'row'
37768
 * is the last row in its table. */
37769
const struct ovsrec_port *
37770
ovsrec_port_next(const struct ovsrec_port *row)
37771
0
{
37772
0
    return ovsrec_port_cast(ovsdb_idl_next_row(&row->header_));
37773
0
}
37774
37775
unsigned int ovsrec_port_get_seqno(const struct ovsdb_idl *idl)
37776
0
{
37777
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_port);
37778
0
}
37779
37780
unsigned int ovsrec_port_row_get_seqno(const struct ovsrec_port *row, enum ovsdb_idl_change change)
37781
0
{
37782
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
37783
0
}
37784
37785
const struct ovsrec_port *
37786
ovsrec_port_track_get_first(const struct ovsdb_idl *idl)
37787
0
{
37788
0
    return ovsrec_port_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_port));
37789
0
}
37790
37791
const struct ovsrec_port
37792
*ovsrec_port_track_get_next(const struct ovsrec_port *row)
37793
0
{
37794
0
    return ovsrec_port_cast(ovsdb_idl_track_get_next(&row->header_));
37795
0
}
37796
37797
37798
/* Deletes 'row' from table "Port".  'row' may be freed, so it must not be
37799
 * accessed afterward.
37800
 *
37801
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
37802
void
37803
ovsrec_port_delete(const struct ovsrec_port *row)
37804
0
{
37805
0
    ovsdb_idl_txn_delete(&row->header_);
37806
0
}
37807
37808
/* Inserts and returns a new row in the table "Port" in the database
37809
 * with open transaction 'txn'.
37810
 *
37811
 * The new row is assigned a randomly generated provisional UUID.
37812
 * ovsdb-server will assign a different UUID when 'txn' is committed,
37813
 * but the IDL will replace any uses of the provisional UUID in the
37814
 * data to be to be committed by the UUID assigned by ovsdb-server. */
37815
struct ovsrec_port *
37816
ovsrec_port_insert(struct ovsdb_idl_txn *txn)
37817
0
{
37818
0
    return ovsrec_port_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_port, NULL));
37819
0
}
37820
37821
/* Inserts and returns a new row in the table "Port" in the database
37822
 * with open transaction 'txn'.
37823
 *
37824
 * The new row is assigned the UUID specified in the 'uuid' parameter
37825
 * (which cannot be null).  ovsdb-server will try to assign the same
37826
 * UUID when 'txn' is committed. */
37827
struct ovsrec_port *
37828
ovsrec_port_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
37829
0
{
37830
0
    return ovsrec_port_cast(ovsdb_idl_txn_insert_persist_uuid(
37831
0
        txn, &ovsrec_table_port, uuid));
37832
0
}
37833
37834
bool
37835
ovsrec_port_is_updated(const struct ovsrec_port *row, enum ovsrec_port_column_id column)
37836
0
{
37837
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_port_columns[column]);
37838
0
}
37839
37840
/* Causes the original contents of column "bond_active_slave" in 'row' to be
37841
 * verified as a prerequisite to completing the transaction.  That is, if
37842
 * "bond_active_slave" in 'row' changed (or if 'row' was deleted) between the
37843
 * time that the IDL originally read its contents and the time that the
37844
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
37845
 *
37846
 * The intention is that, to ensure that no transaction commits based on dirty
37847
 * reads, an application should call this function any time "bond_active_slave" is
37848
 * read as part of a read-modify-write operation.
37849
 *
37850
 * In some cases this function reduces to a no-op, because the current value
37851
 * of "bond_active_slave" is already known:
37852
 *
37853
 *   - If 'row' is a row created by the current transaction (returned by
37854
 *     ovsrec_port_insert()).
37855
 *
37856
 *   - If "bond_active_slave" has already been modified (with
37857
 *     ovsrec_port_set_bond_active_slave()) within the current transaction.
37858
 *
37859
 * Because of the latter property, always call this function *before*
37860
 * ovsrec_port_set_bond_active_slave() for a given read-modify-write.
37861
 *
37862
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
37863
void
37864
ovsrec_port_verify_bond_active_slave(const struct ovsrec_port *row)
37865
0
{
37866
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_bond_active_slave);
37867
0
}
37868
37869
/* Causes the original contents of column "bond_downdelay" in 'row' to be
37870
 * verified as a prerequisite to completing the transaction.  That is, if
37871
 * "bond_downdelay" in 'row' changed (or if 'row' was deleted) between the
37872
 * time that the IDL originally read its contents and the time that the
37873
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
37874
 *
37875
 * The intention is that, to ensure that no transaction commits based on dirty
37876
 * reads, an application should call this function any time "bond_downdelay" is
37877
 * read as part of a read-modify-write operation.
37878
 *
37879
 * In some cases this function reduces to a no-op, because the current value
37880
 * of "bond_downdelay" is already known:
37881
 *
37882
 *   - If 'row' is a row created by the current transaction (returned by
37883
 *     ovsrec_port_insert()).
37884
 *
37885
 *   - If "bond_downdelay" has already been modified (with
37886
 *     ovsrec_port_set_bond_downdelay()) within the current transaction.
37887
 *
37888
 * Because of the latter property, always call this function *before*
37889
 * ovsrec_port_set_bond_downdelay() for a given read-modify-write.
37890
 *
37891
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
37892
void
37893
ovsrec_port_verify_bond_downdelay(const struct ovsrec_port *row)
37894
0
{
37895
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_bond_downdelay);
37896
0
}
37897
37898
/* Causes the original contents of column "bond_fake_iface" in 'row' to be
37899
 * verified as a prerequisite to completing the transaction.  That is, if
37900
 * "bond_fake_iface" in 'row' changed (or if 'row' was deleted) between the
37901
 * time that the IDL originally read its contents and the time that the
37902
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
37903
 *
37904
 * The intention is that, to ensure that no transaction commits based on dirty
37905
 * reads, an application should call this function any time "bond_fake_iface" is
37906
 * read as part of a read-modify-write operation.
37907
 *
37908
 * In some cases this function reduces to a no-op, because the current value
37909
 * of "bond_fake_iface" is already known:
37910
 *
37911
 *   - If 'row' is a row created by the current transaction (returned by
37912
 *     ovsrec_port_insert()).
37913
 *
37914
 *   - If "bond_fake_iface" has already been modified (with
37915
 *     ovsrec_port_set_bond_fake_iface()) within the current transaction.
37916
 *
37917
 * Because of the latter property, always call this function *before*
37918
 * ovsrec_port_set_bond_fake_iface() for a given read-modify-write.
37919
 *
37920
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
37921
void
37922
ovsrec_port_verify_bond_fake_iface(const struct ovsrec_port *row)
37923
0
{
37924
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_bond_fake_iface);
37925
0
}
37926
37927
/* Causes the original contents of column "bond_mode" in 'row' to be
37928
 * verified as a prerequisite to completing the transaction.  That is, if
37929
 * "bond_mode" in 'row' changed (or if 'row' was deleted) between the
37930
 * time that the IDL originally read its contents and the time that the
37931
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
37932
 *
37933
 * The intention is that, to ensure that no transaction commits based on dirty
37934
 * reads, an application should call this function any time "bond_mode" is
37935
 * read as part of a read-modify-write operation.
37936
 *
37937
 * In some cases this function reduces to a no-op, because the current value
37938
 * of "bond_mode" is already known:
37939
 *
37940
 *   - If 'row' is a row created by the current transaction (returned by
37941
 *     ovsrec_port_insert()).
37942
 *
37943
 *   - If "bond_mode" has already been modified (with
37944
 *     ovsrec_port_set_bond_mode()) within the current transaction.
37945
 *
37946
 * Because of the latter property, always call this function *before*
37947
 * ovsrec_port_set_bond_mode() for a given read-modify-write.
37948
 *
37949
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
37950
void
37951
ovsrec_port_verify_bond_mode(const struct ovsrec_port *row)
37952
0
{
37953
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_bond_mode);
37954
0
}
37955
37956
/* Causes the original contents of column "bond_updelay" in 'row' to be
37957
 * verified as a prerequisite to completing the transaction.  That is, if
37958
 * "bond_updelay" in 'row' changed (or if 'row' was deleted) between the
37959
 * time that the IDL originally read its contents and the time that the
37960
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
37961
 *
37962
 * The intention is that, to ensure that no transaction commits based on dirty
37963
 * reads, an application should call this function any time "bond_updelay" is
37964
 * read as part of a read-modify-write operation.
37965
 *
37966
 * In some cases this function reduces to a no-op, because the current value
37967
 * of "bond_updelay" is already known:
37968
 *
37969
 *   - If 'row' is a row created by the current transaction (returned by
37970
 *     ovsrec_port_insert()).
37971
 *
37972
 *   - If "bond_updelay" has already been modified (with
37973
 *     ovsrec_port_set_bond_updelay()) within the current transaction.
37974
 *
37975
 * Because of the latter property, always call this function *before*
37976
 * ovsrec_port_set_bond_updelay() for a given read-modify-write.
37977
 *
37978
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
37979
void
37980
ovsrec_port_verify_bond_updelay(const struct ovsrec_port *row)
37981
0
{
37982
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_bond_updelay);
37983
0
}
37984
37985
/* Causes the original contents of column "cvlans" in 'row' to be
37986
 * verified as a prerequisite to completing the transaction.  That is, if
37987
 * "cvlans" in 'row' changed (or if 'row' was deleted) between the
37988
 * time that the IDL originally read its contents and the time that the
37989
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
37990
 *
37991
 * The intention is that, to ensure that no transaction commits based on dirty
37992
 * reads, an application should call this function any time "cvlans" is
37993
 * read as part of a read-modify-write operation.
37994
 *
37995
 * In some cases this function reduces to a no-op, because the current value
37996
 * of "cvlans" is already known:
37997
 *
37998
 *   - If 'row' is a row created by the current transaction (returned by
37999
 *     ovsrec_port_insert()).
38000
 *
38001
 *   - If "cvlans" has already been modified (with
38002
 *     ovsrec_port_set_cvlans()) within the current transaction.
38003
 *
38004
 * Because of the latter property, always call this function *before*
38005
 * ovsrec_port_set_cvlans() for a given read-modify-write.
38006
 *
38007
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38008
void
38009
ovsrec_port_verify_cvlans(const struct ovsrec_port *row)
38010
0
{
38011
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_cvlans);
38012
0
}
38013
38014
/* Causes the original contents of column "external_ids" in 'row' to be
38015
 * verified as a prerequisite to completing the transaction.  That is, if
38016
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
38017
 * time that the IDL originally read its contents and the time that the
38018
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38019
 *
38020
 * The intention is that, to ensure that no transaction commits based on dirty
38021
 * reads, an application should call this function any time "external_ids" is
38022
 * read as part of a read-modify-write operation.
38023
 *
38024
 * In some cases this function reduces to a no-op, because the current value
38025
 * of "external_ids" is already known:
38026
 *
38027
 *   - If 'row' is a row created by the current transaction (returned by
38028
 *     ovsrec_port_insert()).
38029
 *
38030
 *   - If "external_ids" has already been modified (with
38031
 *     ovsrec_port_set_external_ids()) within the current transaction.
38032
 *
38033
 * Because of the latter property, always call this function *before*
38034
 * ovsrec_port_set_external_ids() for a given read-modify-write.
38035
 *
38036
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38037
void
38038
ovsrec_port_verify_external_ids(const struct ovsrec_port *row)
38039
0
{
38040
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_external_ids);
38041
0
}
38042
38043
/* Causes the original contents of column "fake_bridge" in 'row' to be
38044
 * verified as a prerequisite to completing the transaction.  That is, if
38045
 * "fake_bridge" in 'row' changed (or if 'row' was deleted) between the
38046
 * time that the IDL originally read its contents and the time that the
38047
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38048
 *
38049
 * The intention is that, to ensure that no transaction commits based on dirty
38050
 * reads, an application should call this function any time "fake_bridge" is
38051
 * read as part of a read-modify-write operation.
38052
 *
38053
 * In some cases this function reduces to a no-op, because the current value
38054
 * of "fake_bridge" is already known:
38055
 *
38056
 *   - If 'row' is a row created by the current transaction (returned by
38057
 *     ovsrec_port_insert()).
38058
 *
38059
 *   - If "fake_bridge" has already been modified (with
38060
 *     ovsrec_port_set_fake_bridge()) within the current transaction.
38061
 *
38062
 * Because of the latter property, always call this function *before*
38063
 * ovsrec_port_set_fake_bridge() for a given read-modify-write.
38064
 *
38065
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38066
void
38067
ovsrec_port_verify_fake_bridge(const struct ovsrec_port *row)
38068
0
{
38069
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_fake_bridge);
38070
0
}
38071
38072
/* Causes the original contents of column "interfaces" in 'row' to be
38073
 * verified as a prerequisite to completing the transaction.  That is, if
38074
 * "interfaces" in 'row' changed (or if 'row' was deleted) between the
38075
 * time that the IDL originally read its contents and the time that the
38076
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38077
 *
38078
 * The intention is that, to ensure that no transaction commits based on dirty
38079
 * reads, an application should call this function any time "interfaces" is
38080
 * read as part of a read-modify-write operation.
38081
 *
38082
 * In some cases this function reduces to a no-op, because the current value
38083
 * of "interfaces" is already known:
38084
 *
38085
 *   - If 'row' is a row created by the current transaction (returned by
38086
 *     ovsrec_port_insert()).
38087
 *
38088
 *   - If "interfaces" has already been modified (with
38089
 *     ovsrec_port_set_interfaces()) within the current transaction.
38090
 *
38091
 * Because of the latter property, always call this function *before*
38092
 * ovsrec_port_set_interfaces() for a given read-modify-write.
38093
 *
38094
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38095
void
38096
ovsrec_port_verify_interfaces(const struct ovsrec_port *row)
38097
0
{
38098
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_interfaces);
38099
0
}
38100
38101
/* Causes the original contents of column "lacp" in 'row' to be
38102
 * verified as a prerequisite to completing the transaction.  That is, if
38103
 * "lacp" in 'row' changed (or if 'row' was deleted) between the
38104
 * time that the IDL originally read its contents and the time that the
38105
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38106
 *
38107
 * The intention is that, to ensure that no transaction commits based on dirty
38108
 * reads, an application should call this function any time "lacp" is
38109
 * read as part of a read-modify-write operation.
38110
 *
38111
 * In some cases this function reduces to a no-op, because the current value
38112
 * of "lacp" is already known:
38113
 *
38114
 *   - If 'row' is a row created by the current transaction (returned by
38115
 *     ovsrec_port_insert()).
38116
 *
38117
 *   - If "lacp" has already been modified (with
38118
 *     ovsrec_port_set_lacp()) within the current transaction.
38119
 *
38120
 * Because of the latter property, always call this function *before*
38121
 * ovsrec_port_set_lacp() for a given read-modify-write.
38122
 *
38123
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38124
void
38125
ovsrec_port_verify_lacp(const struct ovsrec_port *row)
38126
0
{
38127
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_lacp);
38128
0
}
38129
38130
/* Causes the original contents of column "mac" in 'row' to be
38131
 * verified as a prerequisite to completing the transaction.  That is, if
38132
 * "mac" in 'row' changed (or if 'row' was deleted) between the
38133
 * time that the IDL originally read its contents and the time that the
38134
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38135
 *
38136
 * The intention is that, to ensure that no transaction commits based on dirty
38137
 * reads, an application should call this function any time "mac" is
38138
 * read as part of a read-modify-write operation.
38139
 *
38140
 * In some cases this function reduces to a no-op, because the current value
38141
 * of "mac" is already known:
38142
 *
38143
 *   - If 'row' is a row created by the current transaction (returned by
38144
 *     ovsrec_port_insert()).
38145
 *
38146
 *   - If "mac" has already been modified (with
38147
 *     ovsrec_port_set_mac()) within the current transaction.
38148
 *
38149
 * Because of the latter property, always call this function *before*
38150
 * ovsrec_port_set_mac() for a given read-modify-write.
38151
 *
38152
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38153
void
38154
ovsrec_port_verify_mac(const struct ovsrec_port *row)
38155
0
{
38156
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_mac);
38157
0
}
38158
38159
/* Causes the original contents of column "name" in 'row' to be
38160
 * verified as a prerequisite to completing the transaction.  That is, if
38161
 * "name" in 'row' changed (or if 'row' was deleted) between the
38162
 * time that the IDL originally read its contents and the time that the
38163
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38164
 *
38165
 * The intention is that, to ensure that no transaction commits based on dirty
38166
 * reads, an application should call this function any time "name" is
38167
 * read as part of a read-modify-write operation.
38168
 *
38169
 * In some cases this function reduces to a no-op, because the current value
38170
 * of "name" is already known:
38171
 *
38172
 *   - If 'row' is a row created by the current transaction (returned by
38173
 *     ovsrec_port_insert()).
38174
 *
38175
 *   - If "name" has already been modified (with
38176
 *     ovsrec_port_set_name()) within the current transaction.
38177
 *
38178
 * Because of the latter property, always call this function *before*
38179
 * ovsrec_port_set_name() for a given read-modify-write.
38180
 *
38181
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38182
void
38183
ovsrec_port_verify_name(const struct ovsrec_port *row)
38184
0
{
38185
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_name);
38186
0
}
38187
38188
/* Causes the original contents of column "other_config" in 'row' to be
38189
 * verified as a prerequisite to completing the transaction.  That is, if
38190
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
38191
 * time that the IDL originally read its contents and the time that the
38192
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38193
 *
38194
 * The intention is that, to ensure that no transaction commits based on dirty
38195
 * reads, an application should call this function any time "other_config" is
38196
 * read as part of a read-modify-write operation.
38197
 *
38198
 * In some cases this function reduces to a no-op, because the current value
38199
 * of "other_config" is already known:
38200
 *
38201
 *   - If 'row' is a row created by the current transaction (returned by
38202
 *     ovsrec_port_insert()).
38203
 *
38204
 *   - If "other_config" has already been modified (with
38205
 *     ovsrec_port_set_other_config()) within the current transaction.
38206
 *
38207
 * Because of the latter property, always call this function *before*
38208
 * ovsrec_port_set_other_config() for a given read-modify-write.
38209
 *
38210
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38211
void
38212
ovsrec_port_verify_other_config(const struct ovsrec_port *row)
38213
0
{
38214
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_other_config);
38215
0
}
38216
38217
/* Causes the original contents of column "protected_" in 'row' to be
38218
 * verified as a prerequisite to completing the transaction.  That is, if
38219
 * "protected_" in 'row' changed (or if 'row' was deleted) between the
38220
 * time that the IDL originally read its contents and the time that the
38221
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38222
 *
38223
 * The intention is that, to ensure that no transaction commits based on dirty
38224
 * reads, an application should call this function any time "protected_" is
38225
 * read as part of a read-modify-write operation.
38226
 *
38227
 * In some cases this function reduces to a no-op, because the current value
38228
 * of "protected_" is already known:
38229
 *
38230
 *   - If 'row' is a row created by the current transaction (returned by
38231
 *     ovsrec_port_insert()).
38232
 *
38233
 *   - If "protected_" has already been modified (with
38234
 *     ovsrec_port_set_protected_()) within the current transaction.
38235
 *
38236
 * Because of the latter property, always call this function *before*
38237
 * ovsrec_port_set_protected_() for a given read-modify-write.
38238
 *
38239
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38240
void
38241
ovsrec_port_verify_protected_(const struct ovsrec_port *row)
38242
0
{
38243
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_protected_);
38244
0
}
38245
38246
/* Causes the original contents of column "qos" in 'row' to be
38247
 * verified as a prerequisite to completing the transaction.  That is, if
38248
 * "qos" in 'row' changed (or if 'row' was deleted) between the
38249
 * time that the IDL originally read its contents and the time that the
38250
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38251
 *
38252
 * The intention is that, to ensure that no transaction commits based on dirty
38253
 * reads, an application should call this function any time "qos" is
38254
 * read as part of a read-modify-write operation.
38255
 *
38256
 * In some cases this function reduces to a no-op, because the current value
38257
 * of "qos" is already known:
38258
 *
38259
 *   - If 'row' is a row created by the current transaction (returned by
38260
 *     ovsrec_port_insert()).
38261
 *
38262
 *   - If "qos" has already been modified (with
38263
 *     ovsrec_port_set_qos()) within the current transaction.
38264
 *
38265
 * Because of the latter property, always call this function *before*
38266
 * ovsrec_port_set_qos() for a given read-modify-write.
38267
 *
38268
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38269
void
38270
ovsrec_port_verify_qos(const struct ovsrec_port *row)
38271
0
{
38272
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_qos);
38273
0
}
38274
38275
/* Causes the original contents of column "rstp_statistics" in 'row' to be
38276
 * verified as a prerequisite to completing the transaction.  That is, if
38277
 * "rstp_statistics" in 'row' changed (or if 'row' was deleted) between the
38278
 * time that the IDL originally read its contents and the time that the
38279
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38280
 *
38281
 * The intention is that, to ensure that no transaction commits based on dirty
38282
 * reads, an application should call this function any time "rstp_statistics" is
38283
 * read as part of a read-modify-write operation.
38284
 *
38285
 * In some cases this function reduces to a no-op, because the current value
38286
 * of "rstp_statistics" is already known:
38287
 *
38288
 *   - If 'row' is a row created by the current transaction (returned by
38289
 *     ovsrec_port_insert()).
38290
 *
38291
 *   - If "rstp_statistics" has already been modified (with
38292
 *     ovsrec_port_set_rstp_statistics()) within the current transaction.
38293
 *
38294
 * Because of the latter property, always call this function *before*
38295
 * ovsrec_port_set_rstp_statistics() for a given read-modify-write.
38296
 *
38297
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38298
void
38299
ovsrec_port_verify_rstp_statistics(const struct ovsrec_port *row)
38300
0
{
38301
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_rstp_statistics);
38302
0
}
38303
38304
/* Causes the original contents of column "rstp_status" in 'row' to be
38305
 * verified as a prerequisite to completing the transaction.  That is, if
38306
 * "rstp_status" in 'row' changed (or if 'row' was deleted) between the
38307
 * time that the IDL originally read its contents and the time that the
38308
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38309
 *
38310
 * The intention is that, to ensure that no transaction commits based on dirty
38311
 * reads, an application should call this function any time "rstp_status" is
38312
 * read as part of a read-modify-write operation.
38313
 *
38314
 * In some cases this function reduces to a no-op, because the current value
38315
 * of "rstp_status" is already known:
38316
 *
38317
 *   - If 'row' is a row created by the current transaction (returned by
38318
 *     ovsrec_port_insert()).
38319
 *
38320
 *   - If "rstp_status" has already been modified (with
38321
 *     ovsrec_port_set_rstp_status()) within the current transaction.
38322
 *
38323
 * Because of the latter property, always call this function *before*
38324
 * ovsrec_port_set_rstp_status() for a given read-modify-write.
38325
 *
38326
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38327
void
38328
ovsrec_port_verify_rstp_status(const struct ovsrec_port *row)
38329
0
{
38330
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_rstp_status);
38331
0
}
38332
38333
/* Causes the original contents of column "statistics" in 'row' to be
38334
 * verified as a prerequisite to completing the transaction.  That is, if
38335
 * "statistics" in 'row' changed (or if 'row' was deleted) between the
38336
 * time that the IDL originally read its contents and the time that the
38337
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38338
 *
38339
 * The intention is that, to ensure that no transaction commits based on dirty
38340
 * reads, an application should call this function any time "statistics" is
38341
 * read as part of a read-modify-write operation.
38342
 *
38343
 * In some cases this function reduces to a no-op, because the current value
38344
 * of "statistics" is already known:
38345
 *
38346
 *   - If 'row' is a row created by the current transaction (returned by
38347
 *     ovsrec_port_insert()).
38348
 *
38349
 *   - If "statistics" has already been modified (with
38350
 *     ovsrec_port_set_statistics()) within the current transaction.
38351
 *
38352
 * Because of the latter property, always call this function *before*
38353
 * ovsrec_port_set_statistics() for a given read-modify-write.
38354
 *
38355
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38356
void
38357
ovsrec_port_verify_statistics(const struct ovsrec_port *row)
38358
0
{
38359
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_statistics);
38360
0
}
38361
38362
/* Causes the original contents of column "status" in 'row' to be
38363
 * verified as a prerequisite to completing the transaction.  That is, if
38364
 * "status" in 'row' changed (or if 'row' was deleted) between the
38365
 * time that the IDL originally read its contents and the time that the
38366
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38367
 *
38368
 * The intention is that, to ensure that no transaction commits based on dirty
38369
 * reads, an application should call this function any time "status" is
38370
 * read as part of a read-modify-write operation.
38371
 *
38372
 * In some cases this function reduces to a no-op, because the current value
38373
 * of "status" is already known:
38374
 *
38375
 *   - If 'row' is a row created by the current transaction (returned by
38376
 *     ovsrec_port_insert()).
38377
 *
38378
 *   - If "status" has already been modified (with
38379
 *     ovsrec_port_set_status()) within the current transaction.
38380
 *
38381
 * Because of the latter property, always call this function *before*
38382
 * ovsrec_port_set_status() for a given read-modify-write.
38383
 *
38384
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38385
void
38386
ovsrec_port_verify_status(const struct ovsrec_port *row)
38387
0
{
38388
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_status);
38389
0
}
38390
38391
/* Causes the original contents of column "tag" in 'row' to be
38392
 * verified as a prerequisite to completing the transaction.  That is, if
38393
 * "tag" in 'row' changed (or if 'row' was deleted) between the
38394
 * time that the IDL originally read its contents and the time that the
38395
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38396
 *
38397
 * The intention is that, to ensure that no transaction commits based on dirty
38398
 * reads, an application should call this function any time "tag" is
38399
 * read as part of a read-modify-write operation.
38400
 *
38401
 * In some cases this function reduces to a no-op, because the current value
38402
 * of "tag" is already known:
38403
 *
38404
 *   - If 'row' is a row created by the current transaction (returned by
38405
 *     ovsrec_port_insert()).
38406
 *
38407
 *   - If "tag" has already been modified (with
38408
 *     ovsrec_port_set_tag()) within the current transaction.
38409
 *
38410
 * Because of the latter property, always call this function *before*
38411
 * ovsrec_port_set_tag() for a given read-modify-write.
38412
 *
38413
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38414
void
38415
ovsrec_port_verify_tag(const struct ovsrec_port *row)
38416
0
{
38417
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_tag);
38418
0
}
38419
38420
/* Causes the original contents of column "trunks" in 'row' to be
38421
 * verified as a prerequisite to completing the transaction.  That is, if
38422
 * "trunks" in 'row' changed (or if 'row' was deleted) between the
38423
 * time that the IDL originally read its contents and the time that the
38424
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38425
 *
38426
 * The intention is that, to ensure that no transaction commits based on dirty
38427
 * reads, an application should call this function any time "trunks" is
38428
 * read as part of a read-modify-write operation.
38429
 *
38430
 * In some cases this function reduces to a no-op, because the current value
38431
 * of "trunks" is already known:
38432
 *
38433
 *   - If 'row' is a row created by the current transaction (returned by
38434
 *     ovsrec_port_insert()).
38435
 *
38436
 *   - If "trunks" has already been modified (with
38437
 *     ovsrec_port_set_trunks()) within the current transaction.
38438
 *
38439
 * Because of the latter property, always call this function *before*
38440
 * ovsrec_port_set_trunks() for a given read-modify-write.
38441
 *
38442
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38443
void
38444
ovsrec_port_verify_trunks(const struct ovsrec_port *row)
38445
0
{
38446
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_trunks);
38447
0
}
38448
38449
/* Causes the original contents of column "vlan_mode" in 'row' to be
38450
 * verified as a prerequisite to completing the transaction.  That is, if
38451
 * "vlan_mode" in 'row' changed (or if 'row' was deleted) between the
38452
 * time that the IDL originally read its contents and the time that the
38453
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
38454
 *
38455
 * The intention is that, to ensure that no transaction commits based on dirty
38456
 * reads, an application should call this function any time "vlan_mode" is
38457
 * read as part of a read-modify-write operation.
38458
 *
38459
 * In some cases this function reduces to a no-op, because the current value
38460
 * of "vlan_mode" is already known:
38461
 *
38462
 *   - If 'row' is a row created by the current transaction (returned by
38463
 *     ovsrec_port_insert()).
38464
 *
38465
 *   - If "vlan_mode" has already been modified (with
38466
 *     ovsrec_port_set_vlan_mode()) within the current transaction.
38467
 *
38468
 * Because of the latter property, always call this function *before*
38469
 * ovsrec_port_set_vlan_mode() for a given read-modify-write.
38470
 *
38471
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
38472
void
38473
ovsrec_port_verify_vlan_mode(const struct ovsrec_port *row)
38474
0
{
38475
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_vlan_mode);
38476
0
}
38477
38478
/* Returns the "bond_active_slave" column's value from the "Port" table in 'row'
38479
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38480
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38481
 * for a given key than implementing the same operation on the "cooked"
38482
 * form in 'row'.
38483
 *
38484
 * 'key_type' must be OVSDB_TYPE_STRING.
38485
 * (This helps to avoid silent bugs if someone changes bond_active_slave's
38486
 * type without updating the caller.)
38487
 *
38488
 * The caller must not modify or free the returned value.
38489
 *
38490
 * Various kinds of changes can invalidate the returned value: modifying
38491
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38492
 * If the returned value is needed for a long time, it is best to make a copy
38493
 * of it with ovsdb_datum_clone().
38494
 *
38495
 * This function is rarely useful, since it is easier to access the value
38496
 * directly through the "bond_active_slave" member in ovsrec_port. */
38497
const struct ovsdb_datum *
38498
ovsrec_port_get_bond_active_slave(const struct ovsrec_port *row,
38499
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38500
0
{
38501
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
38502
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_active_slave);
38503
0
}
38504
38505
/* Returns the "bond_downdelay" column's value from the "Port" table in 'row'
38506
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38507
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38508
 * for a given key than implementing the same operation on the "cooked"
38509
 * form in 'row'.
38510
 *
38511
 * 'key_type' must be OVSDB_TYPE_INTEGER.
38512
 * (This helps to avoid silent bugs if someone changes bond_downdelay's
38513
 * type without updating the caller.)
38514
 *
38515
 * The caller must not modify or free the returned value.
38516
 *
38517
 * Various kinds of changes can invalidate the returned value: modifying
38518
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38519
 * If the returned value is needed for a long time, it is best to make a copy
38520
 * of it with ovsdb_datum_clone().
38521
 *
38522
 * This function is rarely useful, since it is easier to access the value
38523
 * directly through the "bond_downdelay" member in ovsrec_port. */
38524
const struct ovsdb_datum *
38525
ovsrec_port_get_bond_downdelay(const struct ovsrec_port *row,
38526
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38527
0
{
38528
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
38529
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_downdelay);
38530
0
}
38531
38532
/* Returns the "bond_fake_iface" column's value from the "Port" table in 'row'
38533
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38534
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38535
 * for a given key than implementing the same operation on the "cooked"
38536
 * form in 'row'.
38537
 *
38538
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
38539
 * (This helps to avoid silent bugs if someone changes bond_fake_iface's
38540
 * type without updating the caller.)
38541
 *
38542
 * The caller must not modify or free the returned value.
38543
 *
38544
 * Various kinds of changes can invalidate the returned value: modifying
38545
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38546
 * If the returned value is needed for a long time, it is best to make a copy
38547
 * of it with ovsdb_datum_clone().
38548
 *
38549
 * This function is rarely useful, since it is easier to access the value
38550
 * directly through the "bond_fake_iface" member in ovsrec_port. */
38551
const struct ovsdb_datum *
38552
ovsrec_port_get_bond_fake_iface(const struct ovsrec_port *row,
38553
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38554
0
{
38555
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
38556
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_fake_iface);
38557
0
}
38558
38559
/* Returns the "bond_mode" column's value from the "Port" table in 'row'
38560
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38561
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38562
 * for a given key than implementing the same operation on the "cooked"
38563
 * form in 'row'.
38564
 *
38565
 * 'key_type' must be OVSDB_TYPE_STRING.
38566
 * (This helps to avoid silent bugs if someone changes bond_mode's
38567
 * type without updating the caller.)
38568
 *
38569
 * The caller must not modify or free the returned value.
38570
 *
38571
 * Various kinds of changes can invalidate the returned value: modifying
38572
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38573
 * If the returned value is needed for a long time, it is best to make a copy
38574
 * of it with ovsdb_datum_clone().
38575
 *
38576
 * This function is rarely useful, since it is easier to access the value
38577
 * directly through the "bond_mode" member in ovsrec_port. */
38578
const struct ovsdb_datum *
38579
ovsrec_port_get_bond_mode(const struct ovsrec_port *row,
38580
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38581
0
{
38582
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
38583
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_mode);
38584
0
}
38585
38586
/* Returns the "bond_updelay" column's value from the "Port" table in 'row'
38587
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38588
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38589
 * for a given key than implementing the same operation on the "cooked"
38590
 * form in 'row'.
38591
 *
38592
 * 'key_type' must be OVSDB_TYPE_INTEGER.
38593
 * (This helps to avoid silent bugs if someone changes bond_updelay's
38594
 * type without updating the caller.)
38595
 *
38596
 * The caller must not modify or free the returned value.
38597
 *
38598
 * Various kinds of changes can invalidate the returned value: modifying
38599
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38600
 * If the returned value is needed for a long time, it is best to make a copy
38601
 * of it with ovsdb_datum_clone().
38602
 *
38603
 * This function is rarely useful, since it is easier to access the value
38604
 * directly through the "bond_updelay" member in ovsrec_port. */
38605
const struct ovsdb_datum *
38606
ovsrec_port_get_bond_updelay(const struct ovsrec_port *row,
38607
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38608
0
{
38609
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
38610
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_updelay);
38611
0
}
38612
38613
/* Returns the "cvlans" column's value from the "Port" table in 'row'
38614
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38615
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38616
 * for a given key than implementing the same operation on the "cooked"
38617
 * form in 'row'.
38618
 *
38619
 * 'key_type' must be OVSDB_TYPE_INTEGER.
38620
 * (This helps to avoid silent bugs if someone changes cvlans's
38621
 * type without updating the caller.)
38622
 *
38623
 * The caller must not modify or free the returned value.
38624
 *
38625
 * Various kinds of changes can invalidate the returned value: modifying
38626
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38627
 * If the returned value is needed for a long time, it is best to make a copy
38628
 * of it with ovsdb_datum_clone().
38629
 *
38630
 * This function is rarely useful, since it is easier to access the value
38631
 * directly through the "cvlans" member in ovsrec_port. */
38632
const struct ovsdb_datum *
38633
ovsrec_port_get_cvlans(const struct ovsrec_port *row,
38634
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38635
0
{
38636
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
38637
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_cvlans);
38638
0
}
38639
38640
/* Returns the "external_ids" column's value from the "Port" table in 'row'
38641
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38642
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38643
 * for a given key than implementing the same operation on the "cooked"
38644
 * form in 'row'.
38645
 *
38646
 * 'key_type' must be OVSDB_TYPE_STRING.
38647
 * 'value_type' must be OVSDB_TYPE_STRING.
38648
 * (This helps to avoid silent bugs if someone changes external_ids's
38649
 * type without updating the caller.)
38650
 *
38651
 * The caller must not modify or free the returned value.
38652
 *
38653
 * Various kinds of changes can invalidate the returned value: modifying
38654
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38655
 * If the returned value is needed for a long time, it is best to make a copy
38656
 * of it with ovsdb_datum_clone().
38657
 *
38658
 * This function is rarely useful, since it is easier to access the value
38659
 * directly through the "external_ids" member in ovsrec_port. */
38660
const struct ovsdb_datum *
38661
ovsrec_port_get_external_ids(const struct ovsrec_port *row,
38662
  enum ovsdb_atomic_type key_type OVS_UNUSED,
38663
  enum ovsdb_atomic_type value_type OVS_UNUSED)
38664
0
{
38665
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
38666
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
38667
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_external_ids);
38668
0
}
38669
38670
/* Returns the "fake_bridge" column's value from the "Port" table in 'row'
38671
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38672
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38673
 * for a given key than implementing the same operation on the "cooked"
38674
 * form in 'row'.
38675
 *
38676
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
38677
 * (This helps to avoid silent bugs if someone changes fake_bridge's
38678
 * type without updating the caller.)
38679
 *
38680
 * The caller must not modify or free the returned value.
38681
 *
38682
 * Various kinds of changes can invalidate the returned value: modifying
38683
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38684
 * If the returned value is needed for a long time, it is best to make a copy
38685
 * of it with ovsdb_datum_clone().
38686
 *
38687
 * This function is rarely useful, since it is easier to access the value
38688
 * directly through the "fake_bridge" member in ovsrec_port. */
38689
const struct ovsdb_datum *
38690
ovsrec_port_get_fake_bridge(const struct ovsrec_port *row,
38691
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38692
0
{
38693
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
38694
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_fake_bridge);
38695
0
}
38696
38697
/* Returns the "interfaces" column's value from the "Port" table in 'row'
38698
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38699
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38700
 * for a given key than implementing the same operation on the "cooked"
38701
 * form in 'row'.
38702
 *
38703
 * 'key_type' must be OVSDB_TYPE_UUID.
38704
 * (This helps to avoid silent bugs if someone changes interfaces's
38705
 * type without updating the caller.)
38706
 *
38707
 * The caller must not modify or free the returned value.
38708
 *
38709
 * Various kinds of changes can invalidate the returned value: modifying
38710
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38711
 * If the returned value is needed for a long time, it is best to make a copy
38712
 * of it with ovsdb_datum_clone().
38713
 *
38714
 * This function is rarely useful, since it is easier to access the value
38715
 * directly through the "interfaces" member in ovsrec_port. */
38716
const struct ovsdb_datum *
38717
ovsrec_port_get_interfaces(const struct ovsrec_port *row,
38718
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38719
0
{
38720
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
38721
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_interfaces);
38722
0
}
38723
38724
/* Returns the "lacp" column's value from the "Port" table in 'row'
38725
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38726
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38727
 * for a given key than implementing the same operation on the "cooked"
38728
 * form in 'row'.
38729
 *
38730
 * 'key_type' must be OVSDB_TYPE_STRING.
38731
 * (This helps to avoid silent bugs if someone changes lacp's
38732
 * type without updating the caller.)
38733
 *
38734
 * The caller must not modify or free the returned value.
38735
 *
38736
 * Various kinds of changes can invalidate the returned value: modifying
38737
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38738
 * If the returned value is needed for a long time, it is best to make a copy
38739
 * of it with ovsdb_datum_clone().
38740
 *
38741
 * This function is rarely useful, since it is easier to access the value
38742
 * directly through the "lacp" member in ovsrec_port. */
38743
const struct ovsdb_datum *
38744
ovsrec_port_get_lacp(const struct ovsrec_port *row,
38745
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38746
0
{
38747
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
38748
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_lacp);
38749
0
}
38750
38751
/* Returns the "mac" column's value from the "Port" table in 'row'
38752
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38753
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38754
 * for a given key than implementing the same operation on the "cooked"
38755
 * form in 'row'.
38756
 *
38757
 * 'key_type' must be OVSDB_TYPE_STRING.
38758
 * (This helps to avoid silent bugs if someone changes mac's
38759
 * type without updating the caller.)
38760
 *
38761
 * The caller must not modify or free the returned value.
38762
 *
38763
 * Various kinds of changes can invalidate the returned value: modifying
38764
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38765
 * If the returned value is needed for a long time, it is best to make a copy
38766
 * of it with ovsdb_datum_clone().
38767
 *
38768
 * This function is rarely useful, since it is easier to access the value
38769
 * directly through the "mac" member in ovsrec_port. */
38770
const struct ovsdb_datum *
38771
ovsrec_port_get_mac(const struct ovsrec_port *row,
38772
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38773
0
{
38774
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
38775
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_mac);
38776
0
}
38777
38778
/* Returns the "name" column's value from the "Port" table in 'row'
38779
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38780
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38781
 * for a given key than implementing the same operation on the "cooked"
38782
 * form in 'row'.
38783
 *
38784
 * 'key_type' must be OVSDB_TYPE_STRING.
38785
 * (This helps to avoid silent bugs if someone changes name's
38786
 * type without updating the caller.)
38787
 *
38788
 * The caller must not modify or free the returned value.
38789
 *
38790
 * Various kinds of changes can invalidate the returned value: modifying
38791
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38792
 * If the returned value is needed for a long time, it is best to make a copy
38793
 * of it with ovsdb_datum_clone().
38794
 *
38795
 * This function is rarely useful, since it is easier to access the value
38796
 * directly through the "name" member in ovsrec_port. */
38797
const struct ovsdb_datum *
38798
ovsrec_port_get_name(const struct ovsrec_port *row,
38799
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38800
0
{
38801
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
38802
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_name);
38803
0
}
38804
38805
/* Returns the "other_config" column's value from the "Port" table in 'row'
38806
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38807
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38808
 * for a given key than implementing the same operation on the "cooked"
38809
 * form in 'row'.
38810
 *
38811
 * 'key_type' must be OVSDB_TYPE_STRING.
38812
 * 'value_type' must be OVSDB_TYPE_STRING.
38813
 * (This helps to avoid silent bugs if someone changes other_config's
38814
 * type without updating the caller.)
38815
 *
38816
 * The caller must not modify or free the returned value.
38817
 *
38818
 * Various kinds of changes can invalidate the returned value: modifying
38819
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38820
 * If the returned value is needed for a long time, it is best to make a copy
38821
 * of it with ovsdb_datum_clone().
38822
 *
38823
 * This function is rarely useful, since it is easier to access the value
38824
 * directly through the "other_config" member in ovsrec_port. */
38825
const struct ovsdb_datum *
38826
ovsrec_port_get_other_config(const struct ovsrec_port *row,
38827
  enum ovsdb_atomic_type key_type OVS_UNUSED,
38828
  enum ovsdb_atomic_type value_type OVS_UNUSED)
38829
0
{
38830
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
38831
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
38832
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_other_config);
38833
0
}
38834
38835
/* Returns the "protected_" column's value from the "Port" table in 'row'
38836
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38837
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38838
 * for a given key than implementing the same operation on the "cooked"
38839
 * form in 'row'.
38840
 *
38841
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
38842
 * (This helps to avoid silent bugs if someone changes protected_'s
38843
 * type without updating the caller.)
38844
 *
38845
 * The caller must not modify or free the returned value.
38846
 *
38847
 * Various kinds of changes can invalidate the returned value: modifying
38848
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38849
 * If the returned value is needed for a long time, it is best to make a copy
38850
 * of it with ovsdb_datum_clone().
38851
 *
38852
 * This function is rarely useful, since it is easier to access the value
38853
 * directly through the "protected_" member in ovsrec_port. */
38854
const struct ovsdb_datum *
38855
ovsrec_port_get_protected_(const struct ovsrec_port *row,
38856
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38857
0
{
38858
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
38859
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_protected_);
38860
0
}
38861
38862
/* Returns the "qos" column's value from the "Port" table in 'row'
38863
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38864
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38865
 * for a given key than implementing the same operation on the "cooked"
38866
 * form in 'row'.
38867
 *
38868
 * 'key_type' must be OVSDB_TYPE_UUID.
38869
 * (This helps to avoid silent bugs if someone changes qos's
38870
 * type without updating the caller.)
38871
 *
38872
 * The caller must not modify or free the returned value.
38873
 *
38874
 * Various kinds of changes can invalidate the returned value: modifying
38875
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38876
 * If the returned value is needed for a long time, it is best to make a copy
38877
 * of it with ovsdb_datum_clone().
38878
 *
38879
 * This function is rarely useful, since it is easier to access the value
38880
 * directly through the "qos" member in ovsrec_port. */
38881
const struct ovsdb_datum *
38882
ovsrec_port_get_qos(const struct ovsrec_port *row,
38883
  enum ovsdb_atomic_type key_type OVS_UNUSED)
38884
0
{
38885
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
38886
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_qos);
38887
0
}
38888
38889
/* Returns the "rstp_statistics" column's value from the "Port" table in 'row'
38890
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38891
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38892
 * for a given key than implementing the same operation on the "cooked"
38893
 * form in 'row'.
38894
 *
38895
 * 'key_type' must be OVSDB_TYPE_STRING.
38896
 * 'value_type' must be OVSDB_TYPE_INTEGER.
38897
 * (This helps to avoid silent bugs if someone changes rstp_statistics's
38898
 * type without updating the caller.)
38899
 *
38900
 * The caller must not modify or free the returned value.
38901
 *
38902
 * Various kinds of changes can invalidate the returned value: modifying
38903
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38904
 * If the returned value is needed for a long time, it is best to make a copy
38905
 * of it with ovsdb_datum_clone().
38906
 *
38907
 * This function is rarely useful, since it is easier to access the value
38908
 * directly through the "rstp_statistics" member in ovsrec_port. */
38909
const struct ovsdb_datum *
38910
ovsrec_port_get_rstp_statistics(const struct ovsrec_port *row,
38911
  enum ovsdb_atomic_type key_type OVS_UNUSED,
38912
  enum ovsdb_atomic_type value_type OVS_UNUSED)
38913
0
{
38914
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
38915
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
38916
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_rstp_statistics);
38917
0
}
38918
38919
/* Returns the "rstp_status" column's value from the "Port" table in 'row'
38920
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38921
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38922
 * for a given key than implementing the same operation on the "cooked"
38923
 * form in 'row'.
38924
 *
38925
 * 'key_type' must be OVSDB_TYPE_STRING.
38926
 * 'value_type' must be OVSDB_TYPE_STRING.
38927
 * (This helps to avoid silent bugs if someone changes rstp_status's
38928
 * type without updating the caller.)
38929
 *
38930
 * The caller must not modify or free the returned value.
38931
 *
38932
 * Various kinds of changes can invalidate the returned value: modifying
38933
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38934
 * If the returned value is needed for a long time, it is best to make a copy
38935
 * of it with ovsdb_datum_clone().
38936
 *
38937
 * This function is rarely useful, since it is easier to access the value
38938
 * directly through the "rstp_status" member in ovsrec_port. */
38939
const struct ovsdb_datum *
38940
ovsrec_port_get_rstp_status(const struct ovsrec_port *row,
38941
  enum ovsdb_atomic_type key_type OVS_UNUSED,
38942
  enum ovsdb_atomic_type value_type OVS_UNUSED)
38943
0
{
38944
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
38945
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
38946
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_rstp_status);
38947
0
}
38948
38949
/* Returns the "statistics" column's value from the "Port" table in 'row'
38950
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38951
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38952
 * for a given key than implementing the same operation on the "cooked"
38953
 * form in 'row'.
38954
 *
38955
 * 'key_type' must be OVSDB_TYPE_STRING.
38956
 * 'value_type' must be OVSDB_TYPE_INTEGER.
38957
 * (This helps to avoid silent bugs if someone changes statistics's
38958
 * type without updating the caller.)
38959
 *
38960
 * The caller must not modify or free the returned value.
38961
 *
38962
 * Various kinds of changes can invalidate the returned value: modifying
38963
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38964
 * If the returned value is needed for a long time, it is best to make a copy
38965
 * of it with ovsdb_datum_clone().
38966
 *
38967
 * This function is rarely useful, since it is easier to access the value
38968
 * directly through the "statistics" member in ovsrec_port. */
38969
const struct ovsdb_datum *
38970
ovsrec_port_get_statistics(const struct ovsrec_port *row,
38971
  enum ovsdb_atomic_type key_type OVS_UNUSED,
38972
  enum ovsdb_atomic_type value_type OVS_UNUSED)
38973
0
{
38974
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
38975
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
38976
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_statistics);
38977
0
}
38978
38979
/* Returns the "status" column's value from the "Port" table in 'row'
38980
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
38981
 * ovsdb_datum_find_key() is an easier and more efficient way to search
38982
 * for a given key than implementing the same operation on the "cooked"
38983
 * form in 'row'.
38984
 *
38985
 * 'key_type' must be OVSDB_TYPE_STRING.
38986
 * 'value_type' must be OVSDB_TYPE_STRING.
38987
 * (This helps to avoid silent bugs if someone changes status's
38988
 * type without updating the caller.)
38989
 *
38990
 * The caller must not modify or free the returned value.
38991
 *
38992
 * Various kinds of changes can invalidate the returned value: modifying
38993
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
38994
 * If the returned value is needed for a long time, it is best to make a copy
38995
 * of it with ovsdb_datum_clone().
38996
 *
38997
 * This function is rarely useful, since it is easier to access the value
38998
 * directly through the "status" member in ovsrec_port. */
38999
const struct ovsdb_datum *
39000
ovsrec_port_get_status(const struct ovsrec_port *row,
39001
  enum ovsdb_atomic_type key_type OVS_UNUSED,
39002
  enum ovsdb_atomic_type value_type OVS_UNUSED)
39003
0
{
39004
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
39005
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
39006
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_status);
39007
0
}
39008
39009
/* Returns the "tag" column's value from the "Port" table in 'row'
39010
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
39011
 * ovsdb_datum_find_key() is an easier and more efficient way to search
39012
 * for a given key than implementing the same operation on the "cooked"
39013
 * form in 'row'.
39014
 *
39015
 * 'key_type' must be OVSDB_TYPE_INTEGER.
39016
 * (This helps to avoid silent bugs if someone changes tag's
39017
 * type without updating the caller.)
39018
 *
39019
 * The caller must not modify or free the returned value.
39020
 *
39021
 * Various kinds of changes can invalidate the returned value: modifying
39022
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
39023
 * If the returned value is needed for a long time, it is best to make a copy
39024
 * of it with ovsdb_datum_clone().
39025
 *
39026
 * This function is rarely useful, since it is easier to access the value
39027
 * directly through the "tag" member in ovsrec_port. */
39028
const struct ovsdb_datum *
39029
ovsrec_port_get_tag(const struct ovsrec_port *row,
39030
  enum ovsdb_atomic_type key_type OVS_UNUSED)
39031
0
{
39032
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
39033
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_tag);
39034
0
}
39035
39036
/* Returns the "trunks" column's value from the "Port" table in 'row'
39037
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
39038
 * ovsdb_datum_find_key() is an easier and more efficient way to search
39039
 * for a given key than implementing the same operation on the "cooked"
39040
 * form in 'row'.
39041
 *
39042
 * 'key_type' must be OVSDB_TYPE_INTEGER.
39043
 * (This helps to avoid silent bugs if someone changes trunks's
39044
 * type without updating the caller.)
39045
 *
39046
 * The caller must not modify or free the returned value.
39047
 *
39048
 * Various kinds of changes can invalidate the returned value: modifying
39049
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
39050
 * If the returned value is needed for a long time, it is best to make a copy
39051
 * of it with ovsdb_datum_clone().
39052
 *
39053
 * This function is rarely useful, since it is easier to access the value
39054
 * directly through the "trunks" member in ovsrec_port. */
39055
const struct ovsdb_datum *
39056
ovsrec_port_get_trunks(const struct ovsrec_port *row,
39057
  enum ovsdb_atomic_type key_type OVS_UNUSED)
39058
0
{
39059
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
39060
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_trunks);
39061
0
}
39062
39063
/* Returns the "vlan_mode" column's value from the "Port" table in 'row'
39064
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
39065
 * ovsdb_datum_find_key() is an easier and more efficient way to search
39066
 * for a given key than implementing the same operation on the "cooked"
39067
 * form in 'row'.
39068
 *
39069
 * 'key_type' must be OVSDB_TYPE_STRING.
39070
 * (This helps to avoid silent bugs if someone changes vlan_mode's
39071
 * type without updating the caller.)
39072
 *
39073
 * The caller must not modify or free the returned value.
39074
 *
39075
 * Various kinds of changes can invalidate the returned value: modifying
39076
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
39077
 * If the returned value is needed for a long time, it is best to make a copy
39078
 * of it with ovsdb_datum_clone().
39079
 *
39080
 * This function is rarely useful, since it is easier to access the value
39081
 * directly through the "vlan_mode" member in ovsrec_port. */
39082
const struct ovsdb_datum *
39083
ovsrec_port_get_vlan_mode(const struct ovsrec_port *row,
39084
  enum ovsdb_atomic_type key_type OVS_UNUSED)
39085
0
{
39086
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
39087
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_vlan_mode);
39088
0
}
39089
39090
/* Sets the "bond_active_slave" column from the "Port" table in 'row' to
39091
 * the 'bond_active_slave' set.
39092
 *
39093
 * If "bond_active_slave" is null, the column will be the empty set,
39094
 * otherwise it will contain the specified value.
39095
 *
39096
 * The caller retains ownership of the arguments. */
39097
void
39098
ovsrec_port_set_bond_active_slave(const struct ovsrec_port *row, const char *bond_active_slave)
39099
0
{
39100
0
    struct ovsdb_datum datum;
39101
39102
0
    datum.refcnt = NULL;
39103
39104
0
    if (bond_active_slave) {
39105
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
39106
0
        datum.n = 1;
39107
0
        datum.keys = key;
39108
0
        key->s = ovsdb_atom_string_create(bond_active_slave);
39109
0
    } else {
39110
0
        datum.n = 0;
39111
0
        datum.keys = NULL;
39112
0
    }
39113
0
    datum.values = NULL;
39114
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_bond_active_slave, &datum);
39115
0
}
39116
39117
/* Sets the "bond_downdelay" column from the "Port" table in 'row' to
39118
 * 'bond_downdelay'.
39119
 *
39120
 * The caller retains ownership of the arguments. */
39121
void
39122
ovsrec_port_set_bond_downdelay(const struct ovsrec_port *row, int64_t bond_downdelay)
39123
0
{
39124
0
    struct ovsdb_datum datum;
39125
39126
0
    datum.refcnt = NULL;
39127
39128
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
39129
39130
0
    datum.n = 1;
39131
0
    datum.keys = key;
39132
0
    key->integer = bond_downdelay;
39133
0
    datum.values = NULL;
39134
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_bond_downdelay, &datum);
39135
0
}
39136
39137
/* Sets the "bond_fake_iface" column from the "Port" table in 'row' to
39138
 * 'bond_fake_iface'.
39139
 *
39140
 * The caller retains ownership of the arguments. */
39141
void
39142
ovsrec_port_set_bond_fake_iface(const struct ovsrec_port *row, bool bond_fake_iface)
39143
0
{
39144
0
    struct ovsdb_datum datum;
39145
39146
0
    datum.refcnt = NULL;
39147
39148
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
39149
39150
0
    datum.n = 1;
39151
0
    datum.keys = key;
39152
0
    key->boolean = bond_fake_iface;
39153
0
    datum.values = NULL;
39154
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_bond_fake_iface, &datum);
39155
0
}
39156
39157
/* Sets the "bond_mode" column from the "Port" table in 'row' to
39158
 * the 'bond_mode' set.
39159
 *
39160
 * If "bond_mode" is null, the column will be the empty set,
39161
 * otherwise it will contain the specified value.
39162
 *
39163
 * Argument constraints: one of "active-backup", "balance-slb", or "balance-tcp"
39164
 *
39165
 * The caller retains ownership of the arguments. */
39166
void
39167
ovsrec_port_set_bond_mode(const struct ovsrec_port *row, const char *bond_mode)
39168
0
{
39169
0
    struct ovsdb_datum datum;
39170
39171
0
    datum.refcnt = NULL;
39172
39173
0
    if (bond_mode) {
39174
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
39175
0
        datum.n = 1;
39176
0
        datum.keys = key;
39177
0
        key->s = ovsdb_atom_string_create(bond_mode);
39178
0
    } else {
39179
0
        datum.n = 0;
39180
0
        datum.keys = NULL;
39181
0
    }
39182
0
    datum.values = NULL;
39183
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_bond_mode, &datum);
39184
0
}
39185
39186
/* Sets the "bond_updelay" column from the "Port" table in 'row' to
39187
 * 'bond_updelay'.
39188
 *
39189
 * The caller retains ownership of the arguments. */
39190
void
39191
ovsrec_port_set_bond_updelay(const struct ovsrec_port *row, int64_t bond_updelay)
39192
0
{
39193
0
    struct ovsdb_datum datum;
39194
39195
0
    datum.refcnt = NULL;
39196
39197
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
39198
39199
0
    datum.n = 1;
39200
0
    datum.keys = key;
39201
0
    key->integer = bond_updelay;
39202
0
    datum.values = NULL;
39203
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_bond_updelay, &datum);
39204
0
}
39205
39206
/* Sets the "cvlans" column from the "Port" table in 'row' to
39207
 * the 'cvlans' set with 'n_cvlans' entries.
39208
 *
39209
 * Argument constraints: in range 0 to 4,095
39210
 *
39211
 * The caller retains ownership of the arguments. */
39212
void
39213
ovsrec_port_set_cvlans(const struct ovsrec_port *row, const int64_t *cvlans, size_t n_cvlans)
39214
0
{
39215
0
    struct ovsdb_datum datum;
39216
39217
0
    datum.refcnt = NULL;
39218
39219
0
    datum.n = n_cvlans;
39220
0
    datum.keys = n_cvlans ? xmalloc(n_cvlans * sizeof *datum.keys) : NULL;
39221
0
    datum.values = NULL;
39222
0
    for (size_t i = 0; i < n_cvlans; i++) {
39223
0
        datum.keys[i].integer = cvlans[i];
39224
0
    }
39225
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_cvlans, &datum);
39226
0
}
39227
39228
/* Sets the "external_ids" column's value from the "Port" table in 'row'
39229
 * to 'external_ids'.
39230
 *
39231
 * The caller retains ownership of 'external_ids' and everything in it. */
39232
void
39233
ovsrec_port_set_external_ids(const struct ovsrec_port *row, const struct smap *external_ids)
39234
0
{
39235
0
    struct ovsdb_datum datum;
39236
39237
0
    if (external_ids) {
39238
0
        ovsdb_datum_from_smap(&datum, external_ids);
39239
0
    } else {
39240
0
        ovsdb_datum_init_empty(&datum);
39241
0
    }
39242
0
    ovsdb_idl_txn_write(&row->header_,
39243
0
                        &ovsrec_port_col_external_ids,
39244
0
                        &datum);
39245
0
}
39246
39247
39248
/* Sets the "fake_bridge" column from the "Port" table in 'row' to
39249
 * 'fake_bridge'.
39250
 *
39251
 * The caller retains ownership of the arguments. */
39252
void
39253
ovsrec_port_set_fake_bridge(const struct ovsrec_port *row, bool fake_bridge)
39254
0
{
39255
0
    struct ovsdb_datum datum;
39256
39257
0
    datum.refcnt = NULL;
39258
39259
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
39260
39261
0
    datum.n = 1;
39262
0
    datum.keys = key;
39263
0
    key->boolean = fake_bridge;
39264
0
    datum.values = NULL;
39265
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_fake_bridge, &datum);
39266
0
}
39267
39268
/* Sets the "interfaces" column from the "Port" table in 'row' to
39269
 * the 'interfaces' set with 'n_interfaces' entries.
39270
 *
39271
 * The caller retains ownership of the arguments. */
39272
void
39273
ovsrec_port_set_interfaces(const struct ovsrec_port *row, struct ovsrec_interface **interfaces, size_t n_interfaces)
39274
0
{
39275
0
    struct ovsdb_datum datum;
39276
39277
0
    datum.refcnt = NULL;
39278
39279
0
    datum.n = n_interfaces;
39280
0
    datum.keys = n_interfaces ? xmalloc(n_interfaces * sizeof *datum.keys) : NULL;
39281
0
    datum.values = NULL;
39282
0
    for (size_t i = 0; i < n_interfaces; i++) {
39283
0
        datum.keys[i].uuid = interfaces[i]->header_.uuid;
39284
0
    }
39285
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_interfaces, &datum);
39286
0
}
39287
39288
/* Sets the "lacp" column from the "Port" table in 'row' to
39289
 * the 'lacp' set.
39290
 *
39291
 * If "lacp" is null, the column will be the empty set,
39292
 * otherwise it will contain the specified value.
39293
 *
39294
 * Argument constraints: one of "active", "off", or "passive"
39295
 *
39296
 * The caller retains ownership of the arguments. */
39297
void
39298
ovsrec_port_set_lacp(const struct ovsrec_port *row, const char *lacp)
39299
0
{
39300
0
    struct ovsdb_datum datum;
39301
39302
0
    datum.refcnt = NULL;
39303
39304
0
    if (lacp) {
39305
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
39306
0
        datum.n = 1;
39307
0
        datum.keys = key;
39308
0
        key->s = ovsdb_atom_string_create(lacp);
39309
0
    } else {
39310
0
        datum.n = 0;
39311
0
        datum.keys = NULL;
39312
0
    }
39313
0
    datum.values = NULL;
39314
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_lacp, &datum);
39315
0
}
39316
39317
/* Sets the "mac" column from the "Port" table in 'row' to
39318
 * the 'mac' set.
39319
 *
39320
 * If "mac" is null, the column will be the empty set,
39321
 * otherwise it will contain the specified value.
39322
 *
39323
 * The caller retains ownership of the arguments. */
39324
void
39325
ovsrec_port_set_mac(const struct ovsrec_port *row, const char *mac)
39326
0
{
39327
0
    struct ovsdb_datum datum;
39328
39329
0
    datum.refcnt = NULL;
39330
39331
0
    if (mac) {
39332
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
39333
0
        datum.n = 1;
39334
0
        datum.keys = key;
39335
0
        key->s = ovsdb_atom_string_create(mac);
39336
0
    } else {
39337
0
        datum.n = 0;
39338
0
        datum.keys = NULL;
39339
0
    }
39340
0
    datum.values = NULL;
39341
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_mac, &datum);
39342
0
}
39343
39344
/* Sets the "name" column from the "Port" table in 'row' to
39345
 * 'name'.
39346
 *
39347
 * The caller retains ownership of the arguments. */
39348
void
39349
ovsrec_port_set_name(const struct ovsrec_port *row, const char *name)
39350
0
{
39351
0
    struct ovsdb_datum datum;
39352
39353
0
    datum.refcnt = NULL;
39354
39355
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
39356
39357
0
    datum.n = 1;
39358
0
    datum.keys = key;
39359
0
    key->s = ovsdb_atom_string_create(name);
39360
0
    datum.values = NULL;
39361
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_name, &datum);
39362
0
}
39363
39364
/* Sets the "other_config" column's value from the "Port" table in 'row'
39365
 * to 'other_config'.
39366
 *
39367
 * The caller retains ownership of 'other_config' and everything in it. */
39368
void
39369
ovsrec_port_set_other_config(const struct ovsrec_port *row, const struct smap *other_config)
39370
0
{
39371
0
    struct ovsdb_datum datum;
39372
39373
0
    if (other_config) {
39374
0
        ovsdb_datum_from_smap(&datum, other_config);
39375
0
    } else {
39376
0
        ovsdb_datum_init_empty(&datum);
39377
0
    }
39378
0
    ovsdb_idl_txn_write(&row->header_,
39379
0
                        &ovsrec_port_col_other_config,
39380
0
                        &datum);
39381
0
}
39382
39383
39384
/* Sets the "protected_" column from the "Port" table in 'row' to
39385
 * 'protected_'.
39386
 *
39387
 * The caller retains ownership of the arguments. */
39388
void
39389
ovsrec_port_set_protected_(const struct ovsrec_port *row, bool protected_)
39390
0
{
39391
0
    struct ovsdb_datum datum;
39392
39393
0
    datum.refcnt = NULL;
39394
39395
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
39396
39397
0
    datum.n = 1;
39398
0
    datum.keys = key;
39399
0
    key->boolean = protected_;
39400
0
    datum.values = NULL;
39401
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_protected_, &datum);
39402
0
}
39403
39404
/* Sets the "qos" column from the "Port" table in 'row' to
39405
 * the 'qos' set.
39406
 *
39407
 * If "qos" is null, the column will be the empty set,
39408
 * otherwise it will contain the specified value.
39409
 *
39410
 * The caller retains ownership of the arguments. */
39411
void
39412
ovsrec_port_set_qos(const struct ovsrec_port *row, const struct ovsrec_qos *qos)
39413
0
{
39414
0
    struct ovsdb_datum datum;
39415
39416
0
    datum.refcnt = NULL;
39417
39418
0
    if (qos) {
39419
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
39420
0
        datum.n = 1;
39421
0
        datum.keys = key;
39422
0
        key->uuid = qos->header_.uuid;
39423
0
    } else {
39424
0
        datum.n = 0;
39425
0
        datum.keys = NULL;
39426
0
    }
39427
0
    datum.values = NULL;
39428
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_qos, &datum);
39429
0
}
39430
39431
/* Sets the "rstp_statistics" column from the "Port" table in 'row' to
39432
 * the map with keys 'key_rstp_statistics' and values 'value_rstp_statistics'
39433
 * with 'n_rstp_statistics' entries.
39434
 *
39435
 * The caller retains ownership of the arguments. */
39436
void
39437
ovsrec_port_set_rstp_statistics(const struct ovsrec_port *row, const char **key_rstp_statistics, const int64_t *value_rstp_statistics, size_t n_rstp_statistics)
39438
0
{
39439
0
    struct ovsdb_datum datum;
39440
39441
0
    datum.refcnt = NULL;
39442
39443
0
    datum.n = n_rstp_statistics;
39444
0
    datum.keys = n_rstp_statistics ? xmalloc(n_rstp_statistics * sizeof *datum.keys) : NULL;
39445
0
    datum.values = xmalloc(n_rstp_statistics * sizeof *datum.values);
39446
0
    for (size_t i = 0; i < n_rstp_statistics; i++) {
39447
0
        datum.keys[i].s = ovsdb_atom_string_create(key_rstp_statistics[i]);
39448
0
        datum.values[i].integer = value_rstp_statistics[i];
39449
0
    }
39450
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_rstp_statistics, &datum);
39451
0
}
39452
39453
/* Sets the "rstp_status" column's value from the "Port" table in 'row'
39454
 * to 'rstp_status'.
39455
 *
39456
 * The caller retains ownership of 'rstp_status' and everything in it. */
39457
void
39458
ovsrec_port_set_rstp_status(const struct ovsrec_port *row, const struct smap *rstp_status)
39459
0
{
39460
0
    struct ovsdb_datum datum;
39461
39462
0
    if (rstp_status) {
39463
0
        ovsdb_datum_from_smap(&datum, rstp_status);
39464
0
    } else {
39465
0
        ovsdb_datum_init_empty(&datum);
39466
0
    }
39467
0
    ovsdb_idl_txn_write(&row->header_,
39468
0
                        &ovsrec_port_col_rstp_status,
39469
0
                        &datum);
39470
0
}
39471
39472
39473
/* Sets the "statistics" column from the "Port" table in 'row' to
39474
 * the map with keys 'key_statistics' and values 'value_statistics'
39475
 * with 'n_statistics' entries.
39476
 *
39477
 * The caller retains ownership of the arguments. */
39478
void
39479
ovsrec_port_set_statistics(const struct ovsrec_port *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
39480
0
{
39481
0
    struct ovsdb_datum datum;
39482
39483
0
    datum.refcnt = NULL;
39484
39485
0
    datum.n = n_statistics;
39486
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
39487
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
39488
0
    for (size_t i = 0; i < n_statistics; i++) {
39489
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
39490
0
        datum.values[i].integer = value_statistics[i];
39491
0
    }
39492
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_statistics, &datum);
39493
0
}
39494
39495
/* Sets the "status" column's value from the "Port" table in 'row'
39496
 * to 'status'.
39497
 *
39498
 * The caller retains ownership of 'status' and everything in it. */
39499
void
39500
ovsrec_port_set_status(const struct ovsrec_port *row, const struct smap *status)
39501
0
{
39502
0
    struct ovsdb_datum datum;
39503
39504
0
    if (status) {
39505
0
        ovsdb_datum_from_smap(&datum, status);
39506
0
    } else {
39507
0
        ovsdb_datum_init_empty(&datum);
39508
0
    }
39509
0
    ovsdb_idl_txn_write(&row->header_,
39510
0
                        &ovsrec_port_col_status,
39511
0
                        &datum);
39512
0
}
39513
39514
39515
/* Sets the "tag" column from the "Port" table in 'row' to
39516
 * the 'tag' set with 'n_tag' entries.
39517
 *
39518
 * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
39519
 * may be NULL.
39520
 *
39521
 * Argument constraints: in range 0 to 4,095
39522
 *
39523
 * The caller retains ownership of the arguments. */
39524
void
39525
ovsrec_port_set_tag(const struct ovsrec_port *row, const int64_t *tag, size_t n_tag)
39526
0
{
39527
0
    struct ovsdb_datum datum;
39528
39529
0
    datum.refcnt = NULL;
39530
39531
0
    if (n_tag) {
39532
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
39533
0
        datum.n = 1;
39534
0
        datum.keys = key;
39535
0
        key->integer = *tag;
39536
0
    } else {
39537
0
        datum.n = 0;
39538
0
        datum.keys = NULL;
39539
0
    }
39540
0
    datum.values = NULL;
39541
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_tag, &datum);
39542
0
}
39543
39544
/* Sets the "trunks" column from the "Port" table in 'row' to
39545
 * the 'trunks' set with 'n_trunks' entries.
39546
 *
39547
 * Argument constraints: in range 0 to 4,095
39548
 *
39549
 * The caller retains ownership of the arguments. */
39550
void
39551
ovsrec_port_set_trunks(const struct ovsrec_port *row, const int64_t *trunks, size_t n_trunks)
39552
0
{
39553
0
    struct ovsdb_datum datum;
39554
39555
0
    datum.refcnt = NULL;
39556
39557
0
    datum.n = n_trunks;
39558
0
    datum.keys = n_trunks ? xmalloc(n_trunks * sizeof *datum.keys) : NULL;
39559
0
    datum.values = NULL;
39560
0
    for (size_t i = 0; i < n_trunks; i++) {
39561
0
        datum.keys[i].integer = trunks[i];
39562
0
    }
39563
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_trunks, &datum);
39564
0
}
39565
39566
/* Sets the "vlan_mode" column from the "Port" table in 'row' to
39567
 * the 'vlan_mode' set.
39568
 *
39569
 * If "vlan_mode" is null, the column will be the empty set,
39570
 * otherwise it will contain the specified value.
39571
 *
39572
 * Argument constraints: one of "access", "dot1q-tunnel", "native-tagged", "native-untagged", or "trunk"
39573
 *
39574
 * The caller retains ownership of the arguments. */
39575
void
39576
ovsrec_port_set_vlan_mode(const struct ovsrec_port *row, const char *vlan_mode)
39577
0
{
39578
0
    struct ovsdb_datum datum;
39579
39580
0
    datum.refcnt = NULL;
39581
39582
0
    if (vlan_mode) {
39583
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
39584
0
        datum.n = 1;
39585
0
        datum.keys = key;
39586
0
        key->s = ovsdb_atom_string_create(vlan_mode);
39587
0
    } else {
39588
0
        datum.n = 0;
39589
0
        datum.keys = NULL;
39590
0
    }
39591
0
    datum.values = NULL;
39592
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_vlan_mode, &datum);
39593
0
}
39594
39595
/* Adds the value 'new_value' to the "bond_active_slave" set column from the "Port" table
39596
 * in 'row'.
39597
 *
39598
 */
39599
void
39600
ovsrec_port_update_bond_active_slave_addvalue(const struct ovsrec_port *row, const char *new_value)
39601
0
{
39602
0
    struct ovsdb_datum *datum;
39603
39604
0
    datum = xmalloc(sizeof *datum);
39605
0
    datum->n = 1;
39606
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39607
0
    datum->values = NULL;
39608
0
    datum->refcnt = NULL;
39609
39610
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
39611
39612
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
39613
0
                                    &ovsrec_port_col_bond_active_slave,
39614
0
                                    datum);
39615
0
}
39616
39617
/* Deletes the value 'delete_value' from the "bond_active_slave" set column from the
39618
 * "Port" table in 'row'.
39619
 *
39620
 */
39621
void
39622
ovsrec_port_update_bond_active_slave_delvalue(const struct ovsrec_port *row, const char *delete_value)
39623
0
{
39624
0
    struct ovsdb_datum *datum;
39625
39626
0
    datum = xmalloc(sizeof *datum);
39627
0
    datum->n = 1;
39628
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39629
0
    datum->values = NULL;
39630
0
    datum->refcnt = NULL;
39631
39632
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
39633
39634
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
39635
0
                                    &ovsrec_port_col_bond_active_slave,
39636
0
                                    datum);
39637
0
}
39638
39639
/* Adds the value 'new_value' to the "bond_mode" set column from the "Port" table
39640
 * in 'row'.
39641
 *
39642
 */
39643
void
39644
ovsrec_port_update_bond_mode_addvalue(const struct ovsrec_port *row, const char *new_value)
39645
0
{
39646
0
    struct ovsdb_datum *datum;
39647
39648
0
    datum = xmalloc(sizeof *datum);
39649
0
    datum->n = 1;
39650
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39651
0
    datum->values = NULL;
39652
0
    datum->refcnt = NULL;
39653
39654
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
39655
39656
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
39657
0
                                    &ovsrec_port_col_bond_mode,
39658
0
                                    datum);
39659
0
}
39660
39661
/* Deletes the value 'delete_value' from the "bond_mode" set column from the
39662
 * "Port" table in 'row'.
39663
 *
39664
 */
39665
void
39666
ovsrec_port_update_bond_mode_delvalue(const struct ovsrec_port *row, const char *delete_value)
39667
0
{
39668
0
    struct ovsdb_datum *datum;
39669
39670
0
    datum = xmalloc(sizeof *datum);
39671
0
    datum->n = 1;
39672
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39673
0
    datum->values = NULL;
39674
0
    datum->refcnt = NULL;
39675
39676
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
39677
39678
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
39679
0
                                    &ovsrec_port_col_bond_mode,
39680
0
                                    datum);
39681
0
}
39682
39683
/* Adds the value 'new_value' to the "cvlans" set column from the "Port" table
39684
 * in 'row'.
39685
 *
39686
 */
39687
void
39688
ovsrec_port_update_cvlans_addvalue(const struct ovsrec_port *row, int64_t new_value)
39689
0
{
39690
0
    struct ovsdb_datum *datum;
39691
39692
0
    datum = xmalloc(sizeof *datum);
39693
0
    datum->n = 1;
39694
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39695
0
    datum->values = NULL;
39696
0
    datum->refcnt = NULL;
39697
39698
0
    datum->keys[0].integer = new_value;
39699
39700
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
39701
0
                                    &ovsrec_port_col_cvlans,
39702
0
                                    datum);
39703
0
}
39704
39705
/* Deletes the value 'delete_value' from the "cvlans" set column from the
39706
 * "Port" table in 'row'.
39707
 *
39708
 */
39709
void
39710
ovsrec_port_update_cvlans_delvalue(const struct ovsrec_port *row, int64_t delete_value)
39711
0
{
39712
0
    struct ovsdb_datum *datum;
39713
39714
0
    datum = xmalloc(sizeof *datum);
39715
0
    datum->n = 1;
39716
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39717
0
    datum->values = NULL;
39718
0
    datum->refcnt = NULL;
39719
39720
0
    datum->keys[0].integer = delete_value;
39721
39722
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
39723
0
                                    &ovsrec_port_col_cvlans,
39724
0
                                    datum);
39725
0
}
39726
39727
/* Sets an element of the "external_ids" map column from the "Port" table in 'row'
39728
 * to 'new_value' given the key value 'new_key'.
39729
 *
39730
 */
39731
void
39732
ovsrec_port_update_external_ids_setkey(const struct ovsrec_port *row, const char *new_key, const char *new_value)
39733
0
{
39734
0
    struct ovsdb_datum *datum;
39735
39736
0
    datum = xmalloc(sizeof *datum);
39737
0
    datum->n = 1;
39738
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
39739
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
39740
0
    datum->refcnt = NULL;
39741
39742
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
39743
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
39744
39745
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
39746
0
                                    &ovsrec_port_col_external_ids,
39747
0
                                    datum);
39748
0
}
39749
39750
/* Deletes an element of the "external_ids" map column from the "Port" table in 'row'
39751
 * given the key value 'delete_key'.
39752
 *
39753
 */
39754
void
39755
ovsrec_port_update_external_ids_delkey(const struct ovsrec_port *row, const char *delete_key)
39756
0
{
39757
0
    struct ovsdb_datum *datum;
39758
39759
0
    datum = xmalloc(sizeof *datum);
39760
0
    datum->n = 1;
39761
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
39762
0
    datum->values = NULL;
39763
0
    datum->refcnt = NULL;
39764
39765
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
39766
39767
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
39768
0
                                    &ovsrec_port_col_external_ids,
39769
0
                                    datum);
39770
0
}
39771
39772
/* Adds the value 'new_value' to the "interfaces" set column from the "Port" table
39773
 * in 'row'.
39774
 *
39775
 */
39776
void
39777
ovsrec_port_update_interfaces_addvalue(const struct ovsrec_port *row, const struct ovsrec_interface *new_value)
39778
0
{
39779
0
    struct ovsdb_datum *datum;
39780
39781
0
    datum = xmalloc(sizeof *datum);
39782
0
    datum->n = 1;
39783
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39784
0
    datum->values = NULL;
39785
0
    datum->refcnt = NULL;
39786
39787
0
    datum->keys[0].uuid = new_value->header_.uuid;
39788
39789
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
39790
0
                                    &ovsrec_port_col_interfaces,
39791
0
                                    datum);
39792
0
}
39793
39794
/* Deletes the value 'delete_value' from the "interfaces" set column from the
39795
 * "Port" table in 'row'.
39796
 *
39797
 */
39798
void
39799
ovsrec_port_update_interfaces_delvalue(const struct ovsrec_port *row, const struct ovsrec_interface *delete_value)
39800
0
{
39801
0
    struct ovsdb_datum *datum;
39802
39803
0
    datum = xmalloc(sizeof *datum);
39804
0
    datum->n = 1;
39805
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39806
0
    datum->values = NULL;
39807
0
    datum->refcnt = NULL;
39808
39809
0
    datum->keys[0].uuid = delete_value->header_.uuid;
39810
39811
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
39812
0
                                    &ovsrec_port_col_interfaces,
39813
0
                                    datum);
39814
0
}
39815
39816
/* Adds the value 'new_value' to the "lacp" set column from the "Port" table
39817
 * in 'row'.
39818
 *
39819
 */
39820
void
39821
ovsrec_port_update_lacp_addvalue(const struct ovsrec_port *row, const char *new_value)
39822
0
{
39823
0
    struct ovsdb_datum *datum;
39824
39825
0
    datum = xmalloc(sizeof *datum);
39826
0
    datum->n = 1;
39827
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39828
0
    datum->values = NULL;
39829
0
    datum->refcnt = NULL;
39830
39831
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
39832
39833
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
39834
0
                                    &ovsrec_port_col_lacp,
39835
0
                                    datum);
39836
0
}
39837
39838
/* Deletes the value 'delete_value' from the "lacp" set column from the
39839
 * "Port" table in 'row'.
39840
 *
39841
 */
39842
void
39843
ovsrec_port_update_lacp_delvalue(const struct ovsrec_port *row, const char *delete_value)
39844
0
{
39845
0
    struct ovsdb_datum *datum;
39846
39847
0
    datum = xmalloc(sizeof *datum);
39848
0
    datum->n = 1;
39849
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39850
0
    datum->values = NULL;
39851
0
    datum->refcnt = NULL;
39852
39853
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
39854
39855
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
39856
0
                                    &ovsrec_port_col_lacp,
39857
0
                                    datum);
39858
0
}
39859
39860
/* Adds the value 'new_value' to the "mac" set column from the "Port" table
39861
 * in 'row'.
39862
 *
39863
 */
39864
void
39865
ovsrec_port_update_mac_addvalue(const struct ovsrec_port *row, const char *new_value)
39866
0
{
39867
0
    struct ovsdb_datum *datum;
39868
39869
0
    datum = xmalloc(sizeof *datum);
39870
0
    datum->n = 1;
39871
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39872
0
    datum->values = NULL;
39873
0
    datum->refcnt = NULL;
39874
39875
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
39876
39877
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
39878
0
                                    &ovsrec_port_col_mac,
39879
0
                                    datum);
39880
0
}
39881
39882
/* Deletes the value 'delete_value' from the "mac" set column from the
39883
 * "Port" table in 'row'.
39884
 *
39885
 */
39886
void
39887
ovsrec_port_update_mac_delvalue(const struct ovsrec_port *row, const char *delete_value)
39888
0
{
39889
0
    struct ovsdb_datum *datum;
39890
39891
0
    datum = xmalloc(sizeof *datum);
39892
0
    datum->n = 1;
39893
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39894
0
    datum->values = NULL;
39895
0
    datum->refcnt = NULL;
39896
39897
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
39898
39899
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
39900
0
                                    &ovsrec_port_col_mac,
39901
0
                                    datum);
39902
0
}
39903
39904
/* Sets an element of the "other_config" map column from the "Port" table in 'row'
39905
 * to 'new_value' given the key value 'new_key'.
39906
 *
39907
 */
39908
void
39909
ovsrec_port_update_other_config_setkey(const struct ovsrec_port *row, const char *new_key, const char *new_value)
39910
0
{
39911
0
    struct ovsdb_datum *datum;
39912
39913
0
    datum = xmalloc(sizeof *datum);
39914
0
    datum->n = 1;
39915
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
39916
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
39917
0
    datum->refcnt = NULL;
39918
39919
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
39920
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
39921
39922
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
39923
0
                                    &ovsrec_port_col_other_config,
39924
0
                                    datum);
39925
0
}
39926
39927
/* Deletes an element of the "other_config" map column from the "Port" table in 'row'
39928
 * given the key value 'delete_key'.
39929
 *
39930
 */
39931
void
39932
ovsrec_port_update_other_config_delkey(const struct ovsrec_port *row, const char *delete_key)
39933
0
{
39934
0
    struct ovsdb_datum *datum;
39935
39936
0
    datum = xmalloc(sizeof *datum);
39937
0
    datum->n = 1;
39938
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
39939
0
    datum->values = NULL;
39940
0
    datum->refcnt = NULL;
39941
39942
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
39943
39944
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
39945
0
                                    &ovsrec_port_col_other_config,
39946
0
                                    datum);
39947
0
}
39948
39949
/* Adds the value 'new_value' to the "qos" set column from the "Port" table
39950
 * in 'row'.
39951
 *
39952
 */
39953
void
39954
ovsrec_port_update_qos_addvalue(const struct ovsrec_port *row, const struct ovsrec_qos *new_value)
39955
0
{
39956
0
    struct ovsdb_datum *datum;
39957
39958
0
    datum = xmalloc(sizeof *datum);
39959
0
    datum->n = 1;
39960
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39961
0
    datum->values = NULL;
39962
0
    datum->refcnt = NULL;
39963
39964
0
    datum->keys[0].uuid = new_value->header_.uuid;
39965
39966
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
39967
0
                                    &ovsrec_port_col_qos,
39968
0
                                    datum);
39969
0
}
39970
39971
/* Deletes the value 'delete_value' from the "qos" set column from the
39972
 * "Port" table in 'row'.
39973
 *
39974
 */
39975
void
39976
ovsrec_port_update_qos_delvalue(const struct ovsrec_port *row, const struct ovsrec_qos *delete_value)
39977
0
{
39978
0
    struct ovsdb_datum *datum;
39979
39980
0
    datum = xmalloc(sizeof *datum);
39981
0
    datum->n = 1;
39982
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
39983
0
    datum->values = NULL;
39984
0
    datum->refcnt = NULL;
39985
39986
0
    datum->keys[0].uuid = delete_value->header_.uuid;
39987
39988
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
39989
0
                                    &ovsrec_port_col_qos,
39990
0
                                    datum);
39991
0
}
39992
39993
/* Sets an element of the "rstp_statistics" map column from the "Port" table in 'row'
39994
 * to 'new_value' given the key value 'new_key'.
39995
 *
39996
 */
39997
void
39998
ovsrec_port_update_rstp_statistics_setkey(const struct ovsrec_port *row, const char *new_key, int64_t new_value)
39999
0
{
40000
0
    struct ovsdb_datum *datum;
40001
40002
0
    datum = xmalloc(sizeof *datum);
40003
0
    datum->n = 1;
40004
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40005
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
40006
0
    datum->refcnt = NULL;
40007
40008
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
40009
0
    datum->values[0].integer = new_value;
40010
40011
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
40012
0
                                    &ovsrec_port_col_rstp_statistics,
40013
0
                                    datum);
40014
0
}
40015
40016
/* Deletes an element of the "rstp_statistics" map column from the "Port" table in 'row'
40017
 * given the key value 'delete_key'.
40018
 *
40019
 */
40020
void
40021
ovsrec_port_update_rstp_statistics_delkey(const struct ovsrec_port *row, const char *delete_key)
40022
0
{
40023
0
    struct ovsdb_datum *datum;
40024
40025
0
    datum = xmalloc(sizeof *datum);
40026
0
    datum->n = 1;
40027
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40028
0
    datum->values = NULL;
40029
0
    datum->refcnt = NULL;
40030
40031
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
40032
40033
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
40034
0
                                    &ovsrec_port_col_rstp_statistics,
40035
0
                                    datum);
40036
0
}
40037
40038
/* Sets an element of the "rstp_status" map column from the "Port" table in 'row'
40039
 * to 'new_value' given the key value 'new_key'.
40040
 *
40041
 */
40042
void
40043
ovsrec_port_update_rstp_status_setkey(const struct ovsrec_port *row, const char *new_key, const char *new_value)
40044
0
{
40045
0
    struct ovsdb_datum *datum;
40046
40047
0
    datum = xmalloc(sizeof *datum);
40048
0
    datum->n = 1;
40049
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40050
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
40051
0
    datum->refcnt = NULL;
40052
40053
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
40054
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
40055
40056
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
40057
0
                                    &ovsrec_port_col_rstp_status,
40058
0
                                    datum);
40059
0
}
40060
40061
/* Deletes an element of the "rstp_status" map column from the "Port" table in 'row'
40062
 * given the key value 'delete_key'.
40063
 *
40064
 */
40065
void
40066
ovsrec_port_update_rstp_status_delkey(const struct ovsrec_port *row, const char *delete_key)
40067
0
{
40068
0
    struct ovsdb_datum *datum;
40069
40070
0
    datum = xmalloc(sizeof *datum);
40071
0
    datum->n = 1;
40072
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40073
0
    datum->values = NULL;
40074
0
    datum->refcnt = NULL;
40075
40076
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
40077
40078
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
40079
0
                                    &ovsrec_port_col_rstp_status,
40080
0
                                    datum);
40081
0
}
40082
40083
/* Sets an element of the "statistics" map column from the "Port" table in 'row'
40084
 * to 'new_value' given the key value 'new_key'.
40085
 *
40086
 */
40087
void
40088
ovsrec_port_update_statistics_setkey(const struct ovsrec_port *row, const char *new_key, int64_t new_value)
40089
0
{
40090
0
    struct ovsdb_datum *datum;
40091
40092
0
    datum = xmalloc(sizeof *datum);
40093
0
    datum->n = 1;
40094
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40095
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
40096
0
    datum->refcnt = NULL;
40097
40098
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
40099
0
    datum->values[0].integer = new_value;
40100
40101
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
40102
0
                                    &ovsrec_port_col_statistics,
40103
0
                                    datum);
40104
0
}
40105
40106
/* Deletes an element of the "statistics" map column from the "Port" table in 'row'
40107
 * given the key value 'delete_key'.
40108
 *
40109
 */
40110
void
40111
ovsrec_port_update_statistics_delkey(const struct ovsrec_port *row, const char *delete_key)
40112
0
{
40113
0
    struct ovsdb_datum *datum;
40114
40115
0
    datum = xmalloc(sizeof *datum);
40116
0
    datum->n = 1;
40117
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40118
0
    datum->values = NULL;
40119
0
    datum->refcnt = NULL;
40120
40121
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
40122
40123
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
40124
0
                                    &ovsrec_port_col_statistics,
40125
0
                                    datum);
40126
0
}
40127
40128
/* Sets an element of the "status" map column from the "Port" table in 'row'
40129
 * to 'new_value' given the key value 'new_key'.
40130
 *
40131
 */
40132
void
40133
ovsrec_port_update_status_setkey(const struct ovsrec_port *row, const char *new_key, const char *new_value)
40134
0
{
40135
0
    struct ovsdb_datum *datum;
40136
40137
0
    datum = xmalloc(sizeof *datum);
40138
0
    datum->n = 1;
40139
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40140
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
40141
0
    datum->refcnt = NULL;
40142
40143
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
40144
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
40145
40146
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
40147
0
                                    &ovsrec_port_col_status,
40148
0
                                    datum);
40149
0
}
40150
40151
/* Deletes an element of the "status" map column from the "Port" table in 'row'
40152
 * given the key value 'delete_key'.
40153
 *
40154
 */
40155
void
40156
ovsrec_port_update_status_delkey(const struct ovsrec_port *row, const char *delete_key)
40157
0
{
40158
0
    struct ovsdb_datum *datum;
40159
40160
0
    datum = xmalloc(sizeof *datum);
40161
0
    datum->n = 1;
40162
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40163
0
    datum->values = NULL;
40164
0
    datum->refcnt = NULL;
40165
40166
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
40167
40168
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
40169
0
                                    &ovsrec_port_col_status,
40170
0
                                    datum);
40171
0
}
40172
40173
/* Adds the value 'new_value' to the "tag" set column from the "Port" table
40174
 * in 'row'.
40175
 *
40176
 */
40177
void
40178
ovsrec_port_update_tag_addvalue(const struct ovsrec_port *row, int64_t new_value)
40179
0
{
40180
0
    struct ovsdb_datum *datum;
40181
40182
0
    datum = xmalloc(sizeof *datum);
40183
0
    datum->n = 1;
40184
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
40185
0
    datum->values = NULL;
40186
0
    datum->refcnt = NULL;
40187
40188
0
    datum->keys[0].integer = new_value;
40189
40190
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
40191
0
                                    &ovsrec_port_col_tag,
40192
0
                                    datum);
40193
0
}
40194
40195
/* Deletes the value 'delete_value' from the "tag" set column from the
40196
 * "Port" table in 'row'.
40197
 *
40198
 */
40199
void
40200
ovsrec_port_update_tag_delvalue(const struct ovsrec_port *row, int64_t delete_value)
40201
0
{
40202
0
    struct ovsdb_datum *datum;
40203
40204
0
    datum = xmalloc(sizeof *datum);
40205
0
    datum->n = 1;
40206
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
40207
0
    datum->values = NULL;
40208
0
    datum->refcnt = NULL;
40209
40210
0
    datum->keys[0].integer = delete_value;
40211
40212
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
40213
0
                                    &ovsrec_port_col_tag,
40214
0
                                    datum);
40215
0
}
40216
40217
/* Adds the value 'new_value' to the "trunks" set column from the "Port" table
40218
 * in 'row'.
40219
 *
40220
 */
40221
void
40222
ovsrec_port_update_trunks_addvalue(const struct ovsrec_port *row, int64_t new_value)
40223
0
{
40224
0
    struct ovsdb_datum *datum;
40225
40226
0
    datum = xmalloc(sizeof *datum);
40227
0
    datum->n = 1;
40228
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
40229
0
    datum->values = NULL;
40230
0
    datum->refcnt = NULL;
40231
40232
0
    datum->keys[0].integer = new_value;
40233
40234
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
40235
0
                                    &ovsrec_port_col_trunks,
40236
0
                                    datum);
40237
0
}
40238
40239
/* Deletes the value 'delete_value' from the "trunks" set column from the
40240
 * "Port" table in 'row'.
40241
 *
40242
 */
40243
void
40244
ovsrec_port_update_trunks_delvalue(const struct ovsrec_port *row, int64_t delete_value)
40245
0
{
40246
0
    struct ovsdb_datum *datum;
40247
40248
0
    datum = xmalloc(sizeof *datum);
40249
0
    datum->n = 1;
40250
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
40251
0
    datum->values = NULL;
40252
0
    datum->refcnt = NULL;
40253
40254
0
    datum->keys[0].integer = delete_value;
40255
40256
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
40257
0
                                    &ovsrec_port_col_trunks,
40258
0
                                    datum);
40259
0
}
40260
40261
/* Adds the value 'new_value' to the "vlan_mode" set column from the "Port" table
40262
 * in 'row'.
40263
 *
40264
 */
40265
void
40266
ovsrec_port_update_vlan_mode_addvalue(const struct ovsrec_port *row, const char *new_value)
40267
0
{
40268
0
    struct ovsdb_datum *datum;
40269
40270
0
    datum = xmalloc(sizeof *datum);
40271
0
    datum->n = 1;
40272
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
40273
0
    datum->values = NULL;
40274
0
    datum->refcnt = NULL;
40275
40276
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
40277
40278
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
40279
0
                                    &ovsrec_port_col_vlan_mode,
40280
0
                                    datum);
40281
0
}
40282
40283
/* Deletes the value 'delete_value' from the "vlan_mode" set column from the
40284
 * "Port" table in 'row'.
40285
 *
40286
 */
40287
void
40288
ovsrec_port_update_vlan_mode_delvalue(const struct ovsrec_port *row, const char *delete_value)
40289
0
{
40290
0
    struct ovsdb_datum *datum;
40291
40292
0
    datum = xmalloc(sizeof *datum);
40293
0
    datum->n = 1;
40294
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
40295
0
    datum->values = NULL;
40296
0
    datum->refcnt = NULL;
40297
40298
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
40299
40300
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
40301
0
                                    &ovsrec_port_col_vlan_mode,
40302
0
                                    datum);
40303
0
}
40304
40305
/* Sets the "bond_active_slave" column from the "Port" table in 'row' to
40306
 * the 'bond_active_slave' set.
40307
 *
40308
 * If "bond_active_slave" is null, the column will be the empty set,
40309
 * otherwise it will contain the specified value.
40310
 *
40311
 * The caller retains ownership of the arguments. */
40312
void
40313
ovsrec_port_add_clause_bond_active_slave(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *bond_active_slave)
40314
0
{
40315
0
    struct ovsdb_datum datum;
40316
40317
0
    datum.refcnt = NULL;
40318
40319
0
    if (bond_active_slave) {
40320
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
40321
0
        datum.n = 1;
40322
0
        datum.keys = key;
40323
0
        key->s = ovsdb_atom_string_create(bond_active_slave);
40324
0
    } else {
40325
0
        datum.n = 0;
40326
0
        datum.keys = NULL;
40327
0
    }
40328
0
    datum.values = NULL;
40329
0
    ovsdb_idl_condition_add_clause(cond,
40330
0
                          function,
40331
0
                          &ovsrec_port_col_bond_active_slave,
40332
0
                          &datum);
40333
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_bond_active_slave.type);
40334
0
}
40335
40336
/* Sets the "bond_downdelay" column from the "Port" table in 'row' to
40337
 * 'bond_downdelay'.
40338
 *
40339
 * The caller retains ownership of the arguments. */
40340
void
40341
ovsrec_port_add_clause_bond_downdelay(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t bond_downdelay)
40342
0
{
40343
0
    struct ovsdb_datum datum;
40344
40345
0
    datum.refcnt = NULL;
40346
40347
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
40348
40349
0
    datum.n = 1;
40350
0
    datum.keys = key;
40351
0
    key->integer = bond_downdelay;
40352
0
    datum.values = NULL;
40353
0
    ovsdb_idl_condition_add_clause(cond,
40354
0
                          function,
40355
0
                          &ovsrec_port_col_bond_downdelay,
40356
0
                          &datum);
40357
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_bond_downdelay.type);
40358
0
}
40359
40360
/* Sets the "bond_fake_iface" column from the "Port" table in 'row' to
40361
 * 'bond_fake_iface'.
40362
 *
40363
 * The caller retains ownership of the arguments. */
40364
void
40365
ovsrec_port_add_clause_bond_fake_iface(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool bond_fake_iface)
40366
0
{
40367
0
    struct ovsdb_datum datum;
40368
40369
0
    datum.refcnt = NULL;
40370
40371
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
40372
40373
0
    datum.n = 1;
40374
0
    datum.keys = key;
40375
0
    key->boolean = bond_fake_iface;
40376
0
    datum.values = NULL;
40377
0
    ovsdb_idl_condition_add_clause(cond,
40378
0
                          function,
40379
0
                          &ovsrec_port_col_bond_fake_iface,
40380
0
                          &datum);
40381
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_bond_fake_iface.type);
40382
0
}
40383
40384
/* Sets the "bond_mode" column from the "Port" table in 'row' to
40385
 * the 'bond_mode' set.
40386
 *
40387
 * If "bond_mode" is null, the column will be the empty set,
40388
 * otherwise it will contain the specified value.
40389
 *
40390
 * Argument constraints: one of "active-backup", "balance-slb", or "balance-tcp"
40391
 *
40392
 * The caller retains ownership of the arguments. */
40393
void
40394
ovsrec_port_add_clause_bond_mode(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *bond_mode)
40395
0
{
40396
0
    struct ovsdb_datum datum;
40397
40398
0
    datum.refcnt = NULL;
40399
40400
0
    if (bond_mode) {
40401
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
40402
0
        datum.n = 1;
40403
0
        datum.keys = key;
40404
0
        key->s = ovsdb_atom_string_create(bond_mode);
40405
0
    } else {
40406
0
        datum.n = 0;
40407
0
        datum.keys = NULL;
40408
0
    }
40409
0
    datum.values = NULL;
40410
0
    ovsdb_idl_condition_add_clause(cond,
40411
0
                          function,
40412
0
                          &ovsrec_port_col_bond_mode,
40413
0
                          &datum);
40414
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_bond_mode.type);
40415
0
}
40416
40417
/* Sets the "bond_updelay" column from the "Port" table in 'row' to
40418
 * 'bond_updelay'.
40419
 *
40420
 * The caller retains ownership of the arguments. */
40421
void
40422
ovsrec_port_add_clause_bond_updelay(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t bond_updelay)
40423
0
{
40424
0
    struct ovsdb_datum datum;
40425
40426
0
    datum.refcnt = NULL;
40427
40428
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
40429
40430
0
    datum.n = 1;
40431
0
    datum.keys = key;
40432
0
    key->integer = bond_updelay;
40433
0
    datum.values = NULL;
40434
0
    ovsdb_idl_condition_add_clause(cond,
40435
0
                          function,
40436
0
                          &ovsrec_port_col_bond_updelay,
40437
0
                          &datum);
40438
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_bond_updelay.type);
40439
0
}
40440
40441
/* Sets the "cvlans" column from the "Port" table in 'row' to
40442
 * the 'cvlans' set with 'n_cvlans' entries.
40443
 *
40444
 * Argument constraints: in range 0 to 4,095
40445
 *
40446
 * The caller retains ownership of the arguments. */
40447
void
40448
ovsrec_port_add_clause_cvlans(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *cvlans, size_t n_cvlans)
40449
0
{
40450
0
    struct ovsdb_datum datum;
40451
40452
0
    datum.refcnt = NULL;
40453
0
    datum.n = n_cvlans;
40454
0
    datum.keys = n_cvlans ? xmalloc(n_cvlans * sizeof *datum.keys) : NULL;
40455
0
    datum.values = NULL;
40456
0
    for (size_t i = 0; i < n_cvlans; i++) {
40457
0
        datum.keys[i].integer = cvlans[i];
40458
0
    }
40459
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_cvlans.type);
40460
0
    ovsdb_idl_condition_add_clause(cond,
40461
0
                          function,
40462
0
                          &ovsrec_port_col_cvlans,
40463
0
                          &datum);
40464
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_cvlans.type);
40465
0
}
40466
40467
/* Sets the "external_ids" column's value from the "Port" table in 'row'
40468
 * to 'external_ids'.
40469
 *
40470
 * The caller retains ownership of 'external_ids' and everything in it. */
40471
void
40472
ovsrec_port_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
40473
0
{
40474
0
    struct ovsdb_datum datum;
40475
40476
0
    if (external_ids) {
40477
0
        ovsdb_datum_from_smap(&datum, external_ids);
40478
0
    } else {
40479
0
        ovsdb_datum_init_empty(&datum);
40480
0
    }
40481
40482
0
    ovsdb_idl_condition_add_clause(cond,
40483
0
                                   function,
40484
0
                                   &ovsrec_port_col_external_ids,
40485
0
                                   &datum);
40486
40487
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_external_ids.type);
40488
0
}
40489
40490
40491
/* Sets the "fake_bridge" column from the "Port" table in 'row' to
40492
 * 'fake_bridge'.
40493
 *
40494
 * The caller retains ownership of the arguments. */
40495
void
40496
ovsrec_port_add_clause_fake_bridge(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool fake_bridge)
40497
0
{
40498
0
    struct ovsdb_datum datum;
40499
40500
0
    datum.refcnt = NULL;
40501
40502
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
40503
40504
0
    datum.n = 1;
40505
0
    datum.keys = key;
40506
0
    key->boolean = fake_bridge;
40507
0
    datum.values = NULL;
40508
0
    ovsdb_idl_condition_add_clause(cond,
40509
0
                          function,
40510
0
                          &ovsrec_port_col_fake_bridge,
40511
0
                          &datum);
40512
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_fake_bridge.type);
40513
0
}
40514
40515
/* Sets the "interfaces" column from the "Port" table in 'row' to
40516
 * the 'interfaces' set with 'n_interfaces' entries.
40517
 *
40518
 * The caller retains ownership of the arguments. */
40519
void
40520
ovsrec_port_add_clause_interfaces(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **interfaces, size_t n_interfaces)
40521
0
{
40522
0
    struct ovsdb_datum datum;
40523
40524
0
    datum.refcnt = NULL;
40525
0
    datum.n = n_interfaces;
40526
0
    datum.keys = n_interfaces ? xmalloc(n_interfaces * sizeof *datum.keys) : NULL;
40527
0
    datum.values = NULL;
40528
0
    for (size_t i = 0; i < n_interfaces; i++) {
40529
0
        datum.keys[i].uuid = *interfaces[i];
40530
0
    }
40531
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_interfaces.type);
40532
0
    ovsdb_idl_condition_add_clause(cond,
40533
0
                          function,
40534
0
                          &ovsrec_port_col_interfaces,
40535
0
                          &datum);
40536
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_interfaces.type);
40537
0
}
40538
40539
/* Sets the "lacp" column from the "Port" table in 'row' to
40540
 * the 'lacp' set.
40541
 *
40542
 * If "lacp" is null, the column will be the empty set,
40543
 * otherwise it will contain the specified value.
40544
 *
40545
 * Argument constraints: one of "active", "off", or "passive"
40546
 *
40547
 * The caller retains ownership of the arguments. */
40548
void
40549
ovsrec_port_add_clause_lacp(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *lacp)
40550
0
{
40551
0
    struct ovsdb_datum datum;
40552
40553
0
    datum.refcnt = NULL;
40554
40555
0
    if (lacp) {
40556
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
40557
0
        datum.n = 1;
40558
0
        datum.keys = key;
40559
0
        key->s = ovsdb_atom_string_create(lacp);
40560
0
    } else {
40561
0
        datum.n = 0;
40562
0
        datum.keys = NULL;
40563
0
    }
40564
0
    datum.values = NULL;
40565
0
    ovsdb_idl_condition_add_clause(cond,
40566
0
                          function,
40567
0
                          &ovsrec_port_col_lacp,
40568
0
                          &datum);
40569
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_lacp.type);
40570
0
}
40571
40572
/* Sets the "mac" column from the "Port" table in 'row' to
40573
 * the 'mac' set.
40574
 *
40575
 * If "mac" is null, the column will be the empty set,
40576
 * otherwise it will contain the specified value.
40577
 *
40578
 * The caller retains ownership of the arguments. */
40579
void
40580
ovsrec_port_add_clause_mac(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *mac)
40581
0
{
40582
0
    struct ovsdb_datum datum;
40583
40584
0
    datum.refcnt = NULL;
40585
40586
0
    if (mac) {
40587
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
40588
0
        datum.n = 1;
40589
0
        datum.keys = key;
40590
0
        key->s = ovsdb_atom_string_create(mac);
40591
0
    } else {
40592
0
        datum.n = 0;
40593
0
        datum.keys = NULL;
40594
0
    }
40595
0
    datum.values = NULL;
40596
0
    ovsdb_idl_condition_add_clause(cond,
40597
0
                          function,
40598
0
                          &ovsrec_port_col_mac,
40599
0
                          &datum);
40600
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_mac.type);
40601
0
}
40602
40603
/* Sets the "name" column from the "Port" table in 'row' to
40604
 * 'name'.
40605
 *
40606
 * The caller retains ownership of the arguments. */
40607
void
40608
ovsrec_port_add_clause_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *name)
40609
0
{
40610
0
    struct ovsdb_datum datum;
40611
40612
0
    datum.refcnt = NULL;
40613
40614
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
40615
40616
0
    datum.n = 1;
40617
0
    datum.keys = key;
40618
0
    key->s = ovsdb_atom_string_create(name);
40619
0
    datum.values = NULL;
40620
0
    ovsdb_idl_condition_add_clause(cond,
40621
0
                          function,
40622
0
                          &ovsrec_port_col_name,
40623
0
                          &datum);
40624
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_name.type);
40625
0
}
40626
40627
/* Sets the "other_config" column's value from the "Port" table in 'row'
40628
 * to 'other_config'.
40629
 *
40630
 * The caller retains ownership of 'other_config' and everything in it. */
40631
void
40632
ovsrec_port_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
40633
0
{
40634
0
    struct ovsdb_datum datum;
40635
40636
0
    if (other_config) {
40637
0
        ovsdb_datum_from_smap(&datum, other_config);
40638
0
    } else {
40639
0
        ovsdb_datum_init_empty(&datum);
40640
0
    }
40641
40642
0
    ovsdb_idl_condition_add_clause(cond,
40643
0
                                   function,
40644
0
                                   &ovsrec_port_col_other_config,
40645
0
                                   &datum);
40646
40647
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_other_config.type);
40648
0
}
40649
40650
40651
/* Sets the "protected_" column from the "Port" table in 'row' to
40652
 * 'protected_'.
40653
 *
40654
 * The caller retains ownership of the arguments. */
40655
void
40656
ovsrec_port_add_clause_protected_(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool protected_)
40657
0
{
40658
0
    struct ovsdb_datum datum;
40659
40660
0
    datum.refcnt = NULL;
40661
40662
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
40663
40664
0
    datum.n = 1;
40665
0
    datum.keys = key;
40666
0
    key->boolean = protected_;
40667
0
    datum.values = NULL;
40668
0
    ovsdb_idl_condition_add_clause(cond,
40669
0
                          function,
40670
0
                          &ovsrec_port_col_protected_,
40671
0
                          &datum);
40672
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_protected_.type);
40673
0
}
40674
40675
/* Sets the "qos" column from the "Port" table in 'row' to
40676
 * the 'qos' set.
40677
 *
40678
 * If "qos" is null, the column will be the empty set,
40679
 * otherwise it will contain the specified value.
40680
 *
40681
 * The caller retains ownership of the arguments. */
40682
void
40683
ovsrec_port_add_clause_qos(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *qos)
40684
0
{
40685
0
    struct ovsdb_datum datum;
40686
40687
0
    datum.refcnt = NULL;
40688
40689
0
    if (qos) {
40690
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
40691
0
        datum.n = 1;
40692
0
        datum.keys = key;
40693
0
        key->uuid = *qos;
40694
0
    } else {
40695
0
        datum.n = 0;
40696
0
        datum.keys = NULL;
40697
0
    }
40698
0
    datum.values = NULL;
40699
0
    ovsdb_idl_condition_add_clause(cond,
40700
0
                          function,
40701
0
                          &ovsrec_port_col_qos,
40702
0
                          &datum);
40703
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_qos.type);
40704
0
}
40705
40706
/* Sets the "rstp_statistics" column from the "Port" table in 'row' to
40707
 * the map with keys 'key_rstp_statistics' and values 'value_rstp_statistics'
40708
 * with 'n_rstp_statistics' entries.
40709
 *
40710
 * The caller retains ownership of the arguments. */
40711
void
40712
ovsrec_port_add_clause_rstp_statistics(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **key_rstp_statistics, const int64_t *value_rstp_statistics, size_t n_rstp_statistics)
40713
0
{
40714
0
    struct ovsdb_datum datum;
40715
40716
0
    datum.refcnt = NULL;
40717
0
    datum.n = n_rstp_statistics;
40718
0
    datum.keys = n_rstp_statistics ? xmalloc(n_rstp_statistics * sizeof *datum.keys) : NULL;
40719
0
    datum.values = xmalloc(n_rstp_statistics * sizeof *datum.values);
40720
0
    for (size_t i = 0; i < n_rstp_statistics; i++) {
40721
0
        datum.keys[i].s = ovsdb_atom_string_create(key_rstp_statistics[i]);
40722
0
        datum.values[i].integer = value_rstp_statistics[i];
40723
0
    }
40724
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_rstp_statistics.type);
40725
0
    ovsdb_idl_condition_add_clause(cond,
40726
0
                          function,
40727
0
                          &ovsrec_port_col_rstp_statistics,
40728
0
                          &datum);
40729
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_rstp_statistics.type);
40730
0
}
40731
40732
/* Sets the "rstp_status" column's value from the "Port" table in 'row'
40733
 * to 'rstp_status'.
40734
 *
40735
 * The caller retains ownership of 'rstp_status' and everything in it. */
40736
void
40737
ovsrec_port_add_clause_rstp_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *rstp_status)
40738
0
{
40739
0
    struct ovsdb_datum datum;
40740
40741
0
    if (rstp_status) {
40742
0
        ovsdb_datum_from_smap(&datum, rstp_status);
40743
0
    } else {
40744
0
        ovsdb_datum_init_empty(&datum);
40745
0
    }
40746
40747
0
    ovsdb_idl_condition_add_clause(cond,
40748
0
                                   function,
40749
0
                                   &ovsrec_port_col_rstp_status,
40750
0
                                   &datum);
40751
40752
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_rstp_status.type);
40753
0
}
40754
40755
40756
/* Sets the "statistics" column from the "Port" table in 'row' to
40757
 * the map with keys 'key_statistics' and values 'value_statistics'
40758
 * with 'n_statistics' entries.
40759
 *
40760
 * The caller retains ownership of the arguments. */
40761
void
40762
ovsrec_port_add_clause_statistics(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
40763
0
{
40764
0
    struct ovsdb_datum datum;
40765
40766
0
    datum.refcnt = NULL;
40767
0
    datum.n = n_statistics;
40768
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
40769
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
40770
0
    for (size_t i = 0; i < n_statistics; i++) {
40771
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
40772
0
        datum.values[i].integer = value_statistics[i];
40773
0
    }
40774
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_statistics.type);
40775
0
    ovsdb_idl_condition_add_clause(cond,
40776
0
                          function,
40777
0
                          &ovsrec_port_col_statistics,
40778
0
                          &datum);
40779
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_statistics.type);
40780
0
}
40781
40782
/* Sets the "status" column's value from the "Port" table in 'row'
40783
 * to 'status'.
40784
 *
40785
 * The caller retains ownership of 'status' and everything in it. */
40786
void
40787
ovsrec_port_add_clause_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *status)
40788
0
{
40789
0
    struct ovsdb_datum datum;
40790
40791
0
    if (status) {
40792
0
        ovsdb_datum_from_smap(&datum, status);
40793
0
    } else {
40794
0
        ovsdb_datum_init_empty(&datum);
40795
0
    }
40796
40797
0
    ovsdb_idl_condition_add_clause(cond,
40798
0
                                   function,
40799
0
                                   &ovsrec_port_col_status,
40800
0
                                   &datum);
40801
40802
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_status.type);
40803
0
}
40804
40805
40806
/* Sets the "tag" column from the "Port" table in 'row' to
40807
 * the 'tag' set with 'n_tag' entries.
40808
 *
40809
 * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
40810
 * may be NULL.
40811
 *
40812
 * Argument constraints: in range 0 to 4,095
40813
 *
40814
 * The caller retains ownership of the arguments. */
40815
void
40816
ovsrec_port_add_clause_tag(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *tag, size_t n_tag)
40817
0
{
40818
0
    struct ovsdb_datum datum;
40819
40820
0
    datum.refcnt = NULL;
40821
40822
0
    if (n_tag) {
40823
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
40824
0
        datum.n = 1;
40825
0
        datum.keys = key;
40826
0
        key->integer = *tag;
40827
0
    } else {
40828
0
        datum.n = 0;
40829
0
        datum.keys = NULL;
40830
0
    }
40831
0
    datum.values = NULL;
40832
0
    ovsdb_idl_condition_add_clause(cond,
40833
0
                          function,
40834
0
                          &ovsrec_port_col_tag,
40835
0
                          &datum);
40836
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_tag.type);
40837
0
}
40838
40839
/* Sets the "trunks" column from the "Port" table in 'row' to
40840
 * the 'trunks' set with 'n_trunks' entries.
40841
 *
40842
 * Argument constraints: in range 0 to 4,095
40843
 *
40844
 * The caller retains ownership of the arguments. */
40845
void
40846
ovsrec_port_add_clause_trunks(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *trunks, size_t n_trunks)
40847
0
{
40848
0
    struct ovsdb_datum datum;
40849
40850
0
    datum.refcnt = NULL;
40851
0
    datum.n = n_trunks;
40852
0
    datum.keys = n_trunks ? xmalloc(n_trunks * sizeof *datum.keys) : NULL;
40853
0
    datum.values = NULL;
40854
0
    for (size_t i = 0; i < n_trunks; i++) {
40855
0
        datum.keys[i].integer = trunks[i];
40856
0
    }
40857
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_trunks.type);
40858
0
    ovsdb_idl_condition_add_clause(cond,
40859
0
                          function,
40860
0
                          &ovsrec_port_col_trunks,
40861
0
                          &datum);
40862
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_trunks.type);
40863
0
}
40864
40865
/* Sets the "vlan_mode" column from the "Port" table in 'row' to
40866
 * the 'vlan_mode' set.
40867
 *
40868
 * If "vlan_mode" is null, the column will be the empty set,
40869
 * otherwise it will contain the specified value.
40870
 *
40871
 * Argument constraints: one of "access", "dot1q-tunnel", "native-tagged", "native-untagged", or "trunk"
40872
 *
40873
 * The caller retains ownership of the arguments. */
40874
void
40875
ovsrec_port_add_clause_vlan_mode(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *vlan_mode)
40876
0
{
40877
0
    struct ovsdb_datum datum;
40878
40879
0
    datum.refcnt = NULL;
40880
40881
0
    if (vlan_mode) {
40882
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
40883
0
        datum.n = 1;
40884
0
        datum.keys = key;
40885
0
        key->s = ovsdb_atom_string_create(vlan_mode);
40886
0
    } else {
40887
0
        datum.n = 0;
40888
0
        datum.keys = NULL;
40889
0
    }
40890
0
    datum.values = NULL;
40891
0
    ovsdb_idl_condition_add_clause(cond,
40892
0
                          function,
40893
0
                          &ovsrec_port_col_vlan_mode,
40894
0
                          &datum);
40895
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_vlan_mode.type);
40896
0
}
40897
40898
/* Destroy 'row' of kind "Port". The row must have been
40899
 * created with ovsdb_idl_index_init_row.
40900
 */
40901
void
40902
ovsrec_port_index_destroy_row(const struct ovsrec_port *row)
40903
0
{
40904
0
    ovsdb_idl_index_destroy_row(&row->header_);
40905
0
}
40906
        
40907
40908
/* Creates a new row of kind "Port". */
40909
struct ovsrec_port *
40910
ovsrec_port_index_init_row(struct ovsdb_idl_index *index)
40911
0
{
40912
0
    ovs_assert(index->table->class_ == &ovsrec_table_port);
40913
0
    return ALIGNED_CAST(struct ovsrec_port *, ovsdb_idl_index_init_row(index));
40914
0
}
40915
40916
struct ovsrec_port *
40917
ovsrec_port_index_find(struct ovsdb_idl_index *index, const struct ovsrec_port *target)
40918
0
{
40919
0
    ovs_assert(index->table->class_ == &ovsrec_table_port);
40920
0
    return ovsrec_port_cast(ovsdb_idl_index_find(index, &target->header_));
40921
0
}
40922
40923
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
40924
int
40925
ovsrec_port_index_compare(
40926
    struct ovsdb_idl_index *index, 
40927
    const struct ovsrec_port *a, 
40928
    const struct ovsrec_port *b)
40929
0
{
40930
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
40931
0
}
40932
40933
struct ovsdb_idl_cursor
40934
ovsrec_port_cursor_first(struct ovsdb_idl_index *index)
40935
0
{
40936
0
    ovs_assert(index->table->class_ == &ovsrec_table_port);
40937
0
    return ovsdb_idl_cursor_first(index);
40938
0
}
40939
40940
struct ovsdb_idl_cursor
40941
ovsrec_port_cursor_first_eq(
40942
    struct ovsdb_idl_index *index, const struct ovsrec_port *target)
40943
0
{
40944
0
    ovs_assert(index->table->class_ == &ovsrec_table_port);
40945
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
40946
0
}
40947
40948
struct ovsdb_idl_cursor
40949
ovsrec_port_cursor_first_ge(
40950
    struct ovsdb_idl_index *index, const struct ovsrec_port *target)
40951
0
{
40952
0
    ovs_assert(index->table->class_ == &ovsrec_table_port);
40953
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
40954
0
}
40955
40956
struct ovsrec_port *
40957
ovsrec_port_cursor_data(struct ovsdb_idl_cursor *cursor)
40958
0
{
40959
0
    return ovsrec_port_cast(ovsdb_idl_cursor_data(cursor));
40960
0
}
40961
40962
40963
/* Sets the "bond_active_slave" column from the "Port" table in 'row' to
40964
 * the 'bond_active_slave' set.
40965
 *
40966
 * If "bond_active_slave" is null, the column will be the empty set,
40967
 * otherwise it will contain the specified value.
40968
 *
40969
 * The caller retains ownership of the arguments. */
40970
void
40971
ovsrec_port_index_set_bond_active_slave(const struct ovsrec_port *row, const char *bond_active_slave)
40972
0
{
40973
0
    struct ovsdb_datum datum;
40974
40975
0
    datum.refcnt = NULL;
40976
0
    union ovsdb_atom *key;
40977
40978
0
    if (bond_active_slave) {
40979
0
        key = xmalloc(sizeof (union ovsdb_atom));
40980
0
        datum.n = 1;
40981
0
        datum.keys = key;
40982
0
        key->s = ovsdb_atom_string_create(bond_active_slave);
40983
0
    } else {
40984
0
        datum.n = 0;
40985
0
        datum.keys = NULL;
40986
0
    }
40987
0
    datum.values = NULL;
40988
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_BOND_ACTIVE_SLAVE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
40989
0
}
40990
40991
/* Sets the "bond_downdelay" column from the "Port" table in 'row' to
40992
 * 'bond_downdelay'.
40993
 *
40994
 * The caller retains ownership of the arguments. */
40995
void
40996
ovsrec_port_index_set_bond_downdelay(const struct ovsrec_port *row, int64_t bond_downdelay)
40997
0
{
40998
0
    struct ovsdb_datum datum;
40999
41000
0
    datum.refcnt = NULL;
41001
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
41002
41003
0
    datum.n = 1;
41004
0
    datum.keys = key;
41005
0
    key->integer = bond_downdelay;
41006
0
    datum.values = NULL;
41007
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_BOND_DOWNDELAY ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41008
0
}
41009
41010
/* Sets the "bond_fake_iface" column from the "Port" table in 'row' to
41011
 * 'bond_fake_iface'.
41012
 *
41013
 * The caller retains ownership of the arguments. */
41014
void
41015
ovsrec_port_index_set_bond_fake_iface(const struct ovsrec_port *row, bool bond_fake_iface)
41016
0
{
41017
0
    struct ovsdb_datum datum;
41018
41019
0
    datum.refcnt = NULL;
41020
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
41021
41022
0
    datum.n = 1;
41023
0
    datum.keys = key;
41024
0
    key->boolean = bond_fake_iface;
41025
0
    datum.values = NULL;
41026
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_BOND_FAKE_IFACE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41027
0
}
41028
41029
/* Sets the "bond_mode" column from the "Port" table in 'row' to
41030
 * the 'bond_mode' set.
41031
 *
41032
 * If "bond_mode" is null, the column will be the empty set,
41033
 * otherwise it will contain the specified value.
41034
 *
41035
 * Argument constraints: one of "active-backup", "balance-slb", or "balance-tcp"
41036
 *
41037
 * The caller retains ownership of the arguments. */
41038
void
41039
ovsrec_port_index_set_bond_mode(const struct ovsrec_port *row, const char *bond_mode)
41040
0
{
41041
0
    struct ovsdb_datum datum;
41042
41043
0
    datum.refcnt = NULL;
41044
0
    union ovsdb_atom *key;
41045
41046
0
    if (bond_mode) {
41047
0
        key = xmalloc(sizeof (union ovsdb_atom));
41048
0
        datum.n = 1;
41049
0
        datum.keys = key;
41050
0
        key->s = ovsdb_atom_string_create(bond_mode);
41051
0
    } else {
41052
0
        datum.n = 0;
41053
0
        datum.keys = NULL;
41054
0
    }
41055
0
    datum.values = NULL;
41056
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_BOND_MODE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41057
0
}
41058
41059
/* Sets the "bond_updelay" column from the "Port" table in 'row' to
41060
 * 'bond_updelay'.
41061
 *
41062
 * The caller retains ownership of the arguments. */
41063
void
41064
ovsrec_port_index_set_bond_updelay(const struct ovsrec_port *row, int64_t bond_updelay)
41065
0
{
41066
0
    struct ovsdb_datum datum;
41067
41068
0
    datum.refcnt = NULL;
41069
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
41070
41071
0
    datum.n = 1;
41072
0
    datum.keys = key;
41073
0
    key->integer = bond_updelay;
41074
0
    datum.values = NULL;
41075
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_BOND_UPDELAY ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41076
0
}
41077
41078
/* Sets the "cvlans" column from the "Port" table in 'row' to
41079
 * the 'cvlans' set with 'n_cvlans' entries.
41080
 *
41081
 * Argument constraints: in range 0 to 4,095
41082
 *
41083
 * The caller retains ownership of the arguments. */
41084
void
41085
ovsrec_port_index_set_cvlans(const struct ovsrec_port *row, const int64_t *cvlans, size_t n_cvlans)
41086
0
{
41087
0
    struct ovsdb_datum datum;
41088
41089
0
    datum.refcnt = NULL;
41090
0
    size_t i;
41091
41092
0
    datum.n = n_cvlans;
41093
0
    datum.keys = n_cvlans ? xmalloc(n_cvlans * sizeof *datum.keys) : NULL;
41094
0
    datum.values = NULL;
41095
0
    for (i = 0; i < n_cvlans; i++) {
41096
0
        datum.keys[i].integer = cvlans[i];
41097
0
    }
41098
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_cvlans.type);
41099
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_CVLANS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41100
0
}
41101
41102
/* Sets the "external_ids" column's value from the "Port" table in 'row'
41103
 * to 'external_ids'.
41104
 *
41105
 * The caller retains ownership of 'external_ids' and everything in it. */
41106
void
41107
ovsrec_port_index_set_external_ids(const struct ovsrec_port *row, const struct smap *external_ids)
41108
0
{
41109
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
41110
41111
0
    if (external_ids) {
41112
0
        struct smap_node *node;
41113
0
        size_t i;
41114
41115
0
        datum->n = smap_count(external_ids);
41116
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
41117
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
41118
0
        datum->refcnt = NULL;
41119
41120
0
        i = 0;
41121
0
        SMAP_FOR_EACH (node, external_ids) {
41122
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
41123
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
41124
0
            i++;
41125
0
        }
41126
0
        ovsdb_datum_sort_unique(datum, &ovsrec_port_col_external_ids.type);
41127
0
    } else {
41128
0
        ovsdb_datum_init_empty(datum);
41129
0
    }
41130
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
41131
0
                          &ovsrec_port_columns[OVSREC_PORT_COL_EXTERNAL_IDS],
41132
0
                          datum,
41133
0
                          &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41134
0
    free(datum);
41135
0
}
41136
41137
41138
/* Sets the "fake_bridge" column from the "Port" table in 'row' to
41139
 * 'fake_bridge'.
41140
 *
41141
 * The caller retains ownership of the arguments. */
41142
void
41143
ovsrec_port_index_set_fake_bridge(const struct ovsrec_port *row, bool fake_bridge)
41144
0
{
41145
0
    struct ovsdb_datum datum;
41146
41147
0
    datum.refcnt = NULL;
41148
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
41149
41150
0
    datum.n = 1;
41151
0
    datum.keys = key;
41152
0
    key->boolean = fake_bridge;
41153
0
    datum.values = NULL;
41154
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_FAKE_BRIDGE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41155
0
}
41156
41157
/* Sets the "interfaces" column from the "Port" table in 'row' to
41158
 * the 'interfaces' set with 'n_interfaces' entries.
41159
 *
41160
 * The caller retains ownership of the arguments. */
41161
void
41162
ovsrec_port_index_set_interfaces(const struct ovsrec_port *row, struct ovsrec_interface **interfaces, size_t n_interfaces)
41163
0
{
41164
0
    struct ovsdb_datum datum;
41165
41166
0
    datum.refcnt = NULL;
41167
0
    size_t i;
41168
41169
0
    datum.n = n_interfaces;
41170
0
    datum.keys = n_interfaces ? xmalloc(n_interfaces * sizeof *datum.keys) : NULL;
41171
0
    datum.values = NULL;
41172
0
    for (i = 0; i < n_interfaces; i++) {
41173
0
        datum.keys[i].uuid = interfaces[i]->header_.uuid;
41174
0
    }
41175
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_interfaces.type);
41176
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_INTERFACES ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41177
0
}
41178
41179
/* Sets the "lacp" column from the "Port" table in 'row' to
41180
 * the 'lacp' set.
41181
 *
41182
 * If "lacp" is null, the column will be the empty set,
41183
 * otherwise it will contain the specified value.
41184
 *
41185
 * Argument constraints: one of "active", "off", or "passive"
41186
 *
41187
 * The caller retains ownership of the arguments. */
41188
void
41189
ovsrec_port_index_set_lacp(const struct ovsrec_port *row, const char *lacp)
41190
0
{
41191
0
    struct ovsdb_datum datum;
41192
41193
0
    datum.refcnt = NULL;
41194
0
    union ovsdb_atom *key;
41195
41196
0
    if (lacp) {
41197
0
        key = xmalloc(sizeof (union ovsdb_atom));
41198
0
        datum.n = 1;
41199
0
        datum.keys = key;
41200
0
        key->s = ovsdb_atom_string_create(lacp);
41201
0
    } else {
41202
0
        datum.n = 0;
41203
0
        datum.keys = NULL;
41204
0
    }
41205
0
    datum.values = NULL;
41206
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_LACP ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41207
0
}
41208
41209
/* Sets the "mac" column from the "Port" table in 'row' to
41210
 * the 'mac' set.
41211
 *
41212
 * If "mac" is null, the column will be the empty set,
41213
 * otherwise it will contain the specified value.
41214
 *
41215
 * The caller retains ownership of the arguments. */
41216
void
41217
ovsrec_port_index_set_mac(const struct ovsrec_port *row, const char *mac)
41218
0
{
41219
0
    struct ovsdb_datum datum;
41220
41221
0
    datum.refcnt = NULL;
41222
0
    union ovsdb_atom *key;
41223
41224
0
    if (mac) {
41225
0
        key = xmalloc(sizeof (union ovsdb_atom));
41226
0
        datum.n = 1;
41227
0
        datum.keys = key;
41228
0
        key->s = ovsdb_atom_string_create(mac);
41229
0
    } else {
41230
0
        datum.n = 0;
41231
0
        datum.keys = NULL;
41232
0
    }
41233
0
    datum.values = NULL;
41234
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_MAC ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41235
0
}
41236
41237
/* Sets the "name" column from the "Port" table in 'row' to
41238
 * 'name'.
41239
 *
41240
 * The caller retains ownership of the arguments. */
41241
void
41242
ovsrec_port_index_set_name(const struct ovsrec_port *row, const char *name)
41243
0
{
41244
0
    struct ovsdb_datum datum;
41245
41246
0
    datum.refcnt = NULL;
41247
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
41248
41249
0
    datum.n = 1;
41250
0
    datum.keys = key;
41251
0
    key->s = ovsdb_atom_string_create(name);
41252
0
    datum.values = NULL;
41253
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_NAME ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41254
0
}
41255
41256
/* Sets the "other_config" column's value from the "Port" table in 'row'
41257
 * to 'other_config'.
41258
 *
41259
 * The caller retains ownership of 'other_config' and everything in it. */
41260
void
41261
ovsrec_port_index_set_other_config(const struct ovsrec_port *row, const struct smap *other_config)
41262
0
{
41263
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
41264
41265
0
    if (other_config) {
41266
0
        struct smap_node *node;
41267
0
        size_t i;
41268
41269
0
        datum->n = smap_count(other_config);
41270
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
41271
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
41272
0
        datum->refcnt = NULL;
41273
41274
0
        i = 0;
41275
0
        SMAP_FOR_EACH (node, other_config) {
41276
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
41277
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
41278
0
            i++;
41279
0
        }
41280
0
        ovsdb_datum_sort_unique(datum, &ovsrec_port_col_other_config.type);
41281
0
    } else {
41282
0
        ovsdb_datum_init_empty(datum);
41283
0
    }
41284
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
41285
0
                          &ovsrec_port_columns[OVSREC_PORT_COL_OTHER_CONFIG],
41286
0
                          datum,
41287
0
                          &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41288
0
    free(datum);
41289
0
}
41290
41291
41292
/* Sets the "protected_" column from the "Port" table in 'row' to
41293
 * 'protected_'.
41294
 *
41295
 * The caller retains ownership of the arguments. */
41296
void
41297
ovsrec_port_index_set_protected_(const struct ovsrec_port *row, bool protected_)
41298
0
{
41299
0
    struct ovsdb_datum datum;
41300
41301
0
    datum.refcnt = NULL;
41302
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
41303
41304
0
    datum.n = 1;
41305
0
    datum.keys = key;
41306
0
    key->boolean = protected_;
41307
0
    datum.values = NULL;
41308
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_PROTECTED_ ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41309
0
}
41310
41311
/* Sets the "qos" column from the "Port" table in 'row' to
41312
 * the 'qos' set.
41313
 *
41314
 * If "qos" is null, the column will be the empty set,
41315
 * otherwise it will contain the specified value.
41316
 *
41317
 * The caller retains ownership of the arguments. */
41318
void
41319
ovsrec_port_index_set_qos(const struct ovsrec_port *row, const struct ovsrec_qos *qos)
41320
0
{
41321
0
    struct ovsdb_datum datum;
41322
41323
0
    datum.refcnt = NULL;
41324
0
    union ovsdb_atom *key;
41325
41326
0
    if (qos) {
41327
0
        key = xmalloc(sizeof (union ovsdb_atom));
41328
0
        datum.n = 1;
41329
0
        datum.keys = key;
41330
0
        key->uuid = qos->header_.uuid;
41331
0
    } else {
41332
0
        datum.n = 0;
41333
0
        datum.keys = NULL;
41334
0
    }
41335
0
    datum.values = NULL;
41336
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_QOS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41337
0
}
41338
41339
/* Sets the "rstp_statistics" column from the "Port" table in 'row' to
41340
 * the map with keys 'key_rstp_statistics' and values 'value_rstp_statistics'
41341
 * with 'n_rstp_statistics' entries.
41342
 *
41343
 * The caller retains ownership of the arguments. */
41344
void
41345
ovsrec_port_index_set_rstp_statistics(const struct ovsrec_port *row, const char **key_rstp_statistics, const int64_t *value_rstp_statistics, size_t n_rstp_statistics)
41346
0
{
41347
0
    struct ovsdb_datum datum;
41348
41349
0
    datum.refcnt = NULL;
41350
0
    size_t i;
41351
41352
0
    datum.n = n_rstp_statistics;
41353
0
    datum.keys = n_rstp_statistics ? xmalloc(n_rstp_statistics * sizeof *datum.keys) : NULL;
41354
0
    datum.values = xmalloc(n_rstp_statistics * sizeof *datum.values);
41355
0
    for (i = 0; i < n_rstp_statistics; i++) {
41356
0
        datum.keys[i].s = ovsdb_atom_string_create(key_rstp_statistics[i]);
41357
0
        datum.values[i].integer = value_rstp_statistics[i];
41358
0
    }
41359
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_rstp_statistics.type);
41360
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_RSTP_STATISTICS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41361
0
}
41362
41363
/* Sets the "rstp_status" column's value from the "Port" table in 'row'
41364
 * to 'rstp_status'.
41365
 *
41366
 * The caller retains ownership of 'rstp_status' and everything in it. */
41367
void
41368
ovsrec_port_index_set_rstp_status(const struct ovsrec_port *row, const struct smap *rstp_status)
41369
0
{
41370
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
41371
41372
0
    if (rstp_status) {
41373
0
        struct smap_node *node;
41374
0
        size_t i;
41375
41376
0
        datum->n = smap_count(rstp_status);
41377
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
41378
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
41379
0
        datum->refcnt = NULL;
41380
41381
0
        i = 0;
41382
0
        SMAP_FOR_EACH (node, rstp_status) {
41383
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
41384
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
41385
0
            i++;
41386
0
        }
41387
0
        ovsdb_datum_sort_unique(datum, &ovsrec_port_col_rstp_status.type);
41388
0
    } else {
41389
0
        ovsdb_datum_init_empty(datum);
41390
0
    }
41391
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
41392
0
                          &ovsrec_port_columns[OVSREC_PORT_COL_RSTP_STATUS],
41393
0
                          datum,
41394
0
                          &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41395
0
    free(datum);
41396
0
}
41397
41398
41399
/* Sets the "statistics" column from the "Port" table in 'row' to
41400
 * the map with keys 'key_statistics' and values 'value_statistics'
41401
 * with 'n_statistics' entries.
41402
 *
41403
 * The caller retains ownership of the arguments. */
41404
void
41405
ovsrec_port_index_set_statistics(const struct ovsrec_port *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
41406
0
{
41407
0
    struct ovsdb_datum datum;
41408
41409
0
    datum.refcnt = NULL;
41410
0
    size_t i;
41411
41412
0
    datum.n = n_statistics;
41413
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
41414
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
41415
0
    for (i = 0; i < n_statistics; i++) {
41416
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
41417
0
        datum.values[i].integer = value_statistics[i];
41418
0
    }
41419
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_statistics.type);
41420
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_STATISTICS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41421
0
}
41422
41423
/* Sets the "status" column's value from the "Port" table in 'row'
41424
 * to 'status'.
41425
 *
41426
 * The caller retains ownership of 'status' and everything in it. */
41427
void
41428
ovsrec_port_index_set_status(const struct ovsrec_port *row, const struct smap *status)
41429
0
{
41430
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
41431
41432
0
    if (status) {
41433
0
        struct smap_node *node;
41434
0
        size_t i;
41435
41436
0
        datum->n = smap_count(status);
41437
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
41438
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
41439
0
        datum->refcnt = NULL;
41440
41441
0
        i = 0;
41442
0
        SMAP_FOR_EACH (node, status) {
41443
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
41444
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
41445
0
            i++;
41446
0
        }
41447
0
        ovsdb_datum_sort_unique(datum, &ovsrec_port_col_status.type);
41448
0
    } else {
41449
0
        ovsdb_datum_init_empty(datum);
41450
0
    }
41451
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
41452
0
                          &ovsrec_port_columns[OVSREC_PORT_COL_STATUS],
41453
0
                          datum,
41454
0
                          &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41455
0
    free(datum);
41456
0
}
41457
41458
41459
/* Sets the "tag" column from the "Port" table in 'row' to
41460
 * the 'tag' set with 'n_tag' entries.
41461
 *
41462
 * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
41463
 * may be NULL.
41464
 *
41465
 * Argument constraints: in range 0 to 4,095
41466
 *
41467
 * The caller retains ownership of the arguments. */
41468
void
41469
ovsrec_port_index_set_tag(const struct ovsrec_port *row, const int64_t *tag, size_t n_tag)
41470
0
{
41471
0
    struct ovsdb_datum datum;
41472
41473
0
    datum.refcnt = NULL;
41474
0
    union ovsdb_atom *key;
41475
41476
0
    if (n_tag) {
41477
0
        key = xmalloc(sizeof(union ovsdb_atom));
41478
0
        datum.n = 1;
41479
0
        datum.keys = key;
41480
0
        key->integer = *tag;
41481
0
    } else {
41482
0
        datum.n = 0;
41483
0
        datum.keys = NULL;
41484
0
    }
41485
0
    datum.values = NULL;
41486
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_TAG ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41487
0
}
41488
41489
/* Sets the "trunks" column from the "Port" table in 'row' to
41490
 * the 'trunks' set with 'n_trunks' entries.
41491
 *
41492
 * Argument constraints: in range 0 to 4,095
41493
 *
41494
 * The caller retains ownership of the arguments. */
41495
void
41496
ovsrec_port_index_set_trunks(const struct ovsrec_port *row, const int64_t *trunks, size_t n_trunks)
41497
0
{
41498
0
    struct ovsdb_datum datum;
41499
41500
0
    datum.refcnt = NULL;
41501
0
    size_t i;
41502
41503
0
    datum.n = n_trunks;
41504
0
    datum.keys = n_trunks ? xmalloc(n_trunks * sizeof *datum.keys) : NULL;
41505
0
    datum.values = NULL;
41506
0
    for (i = 0; i < n_trunks; i++) {
41507
0
        datum.keys[i].integer = trunks[i];
41508
0
    }
41509
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_trunks.type);
41510
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_TRUNKS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41511
0
}
41512
41513
/* Sets the "vlan_mode" column from the "Port" table in 'row' to
41514
 * the 'vlan_mode' set.
41515
 *
41516
 * If "vlan_mode" is null, the column will be the empty set,
41517
 * otherwise it will contain the specified value.
41518
 *
41519
 * Argument constraints: one of "access", "dot1q-tunnel", "native-tagged", "native-untagged", or "trunk"
41520
 *
41521
 * The caller retains ownership of the arguments. */
41522
void
41523
ovsrec_port_index_set_vlan_mode(const struct ovsrec_port *row, const char *vlan_mode)
41524
0
{
41525
0
    struct ovsdb_datum datum;
41526
41527
0
    datum.refcnt = NULL;
41528
0
    union ovsdb_atom *key;
41529
41530
0
    if (vlan_mode) {
41531
0
        key = xmalloc(sizeof (union ovsdb_atom));
41532
0
        datum.n = 1;
41533
0
        datum.keys = key;
41534
0
        key->s = ovsdb_atom_string_create(vlan_mode);
41535
0
    } else {
41536
0
        datum.n = 0;
41537
0
        datum.keys = NULL;
41538
0
    }
41539
0
    datum.values = NULL;
41540
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_port_columns[ OVSREC_PORT_COL_VLAN_MODE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
41541
0
}
41542
41543
struct ovsdb_idl_column ovsrec_port_columns[OVSREC_PORT_N_COLUMNS];
41544
41545
unsigned int
41546
ovsrec_port_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
41547
0
{
41548
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_port, condition);
41549
0
}
41550
static struct json Port_col_bond_mode_key_enum_key_strings[3] = {
41551
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "active-backup", .count = 2 },
41552
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "balance-slb", .count = 2 },
41553
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "balance-tcp", .count = 2 },
41554
};
41555
static union ovsdb_atom Port_col_bond_mode_key_enum_keys[3] = {
41556
    { .s = &Port_col_bond_mode_key_enum_key_strings[0] },
41557
    { .s = &Port_col_bond_mode_key_enum_key_strings[1] },
41558
    { .s = &Port_col_bond_mode_key_enum_key_strings[2] },
41559
};
41560
static struct ovsdb_datum Port_col_bond_mode_key_enum = {
41561
    .n = 3,
41562
    .keys = Port_col_bond_mode_key_enum_keys,
41563
};
41564
static struct json Port_col_lacp_key_enum_key_strings[3] = {
41565
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "active", .count = 2 },
41566
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "off", .count = 2 },
41567
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "passive", .count = 2 },
41568
};
41569
static union ovsdb_atom Port_col_lacp_key_enum_keys[3] = {
41570
    { .s = &Port_col_lacp_key_enum_key_strings[0] },
41571
    { .s = &Port_col_lacp_key_enum_key_strings[1] },
41572
    { .s = &Port_col_lacp_key_enum_key_strings[2] },
41573
};
41574
static struct ovsdb_datum Port_col_lacp_key_enum = {
41575
    .n = 3,
41576
    .keys = Port_col_lacp_key_enum_keys,
41577
};
41578
static struct json Port_col_vlan_mode_key_enum_key_strings[5] = {
41579
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "access", .count = 2 },
41580
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "dot1q-tunnel", .count = 2 },
41581
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "native-tagged", .count = 2 },
41582
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "native-untagged", .count = 2 },
41583
    { .type = JSON_STRING, .storage_type = JSON_STRING_DYNAMIC, .str_ptr = "trunk", .count = 2 },
41584
};
41585
static union ovsdb_atom Port_col_vlan_mode_key_enum_keys[5] = {
41586
    { .s = &Port_col_vlan_mode_key_enum_key_strings[0] },
41587
    { .s = &Port_col_vlan_mode_key_enum_key_strings[1] },
41588
    { .s = &Port_col_vlan_mode_key_enum_key_strings[2] },
41589
    { .s = &Port_col_vlan_mode_key_enum_key_strings[3] },
41590
    { .s = &Port_col_vlan_mode_key_enum_key_strings[4] },
41591
};
41592
static struct ovsdb_datum Port_col_vlan_mode_key_enum = {
41593
    .n = 5,
41594
    .keys = Port_col_vlan_mode_key_enum_keys,
41595
};
41596
41597
struct ovsdb_idl_column ovsrec_port_columns[OVSREC_PORT_N_COLUMNS] = {
41598
    [OVSREC_PORT_COL_BOND_ACTIVE_SLAVE] = {
41599
         .name = "bond_active_slave",
41600
         .type = {
41601
            .key = {
41602
               .type = OVSDB_TYPE_STRING,
41603
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41604
            },
41605
            .value = OVSDB_BASE_VOID_INIT,
41606
            .n_min = 0,
41607
            .n_max = 1,
41608
         },
41609
         .is_mutable = true,
41610
         .is_synthetic = false,
41611
         .parse = ovsrec_port_parse_bond_active_slave,
41612
         .unparse = ovsrec_port_unparse_bond_active_slave,
41613
    },
41614
41615
    [OVSREC_PORT_COL_BOND_DOWNDELAY] = {
41616
         .name = "bond_downdelay",
41617
         .type = {
41618
            .key = {
41619
               .type = OVSDB_TYPE_INTEGER,
41620
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
41621
            },
41622
            .value = OVSDB_BASE_VOID_INIT,
41623
            .n_min = 1,
41624
            .n_max = 1,
41625
         },
41626
         .is_mutable = true,
41627
         .is_synthetic = false,
41628
         .parse = ovsrec_port_parse_bond_downdelay,
41629
         .unparse = ovsrec_port_unparse_bond_downdelay,
41630
    },
41631
41632
    [OVSREC_PORT_COL_BOND_FAKE_IFACE] = {
41633
         .name = "bond_fake_iface",
41634
         .type = {
41635
            .key = {
41636
               .type = OVSDB_TYPE_BOOLEAN,
41637
            },
41638
            .value = OVSDB_BASE_VOID_INIT,
41639
            .n_min = 1,
41640
            .n_max = 1,
41641
         },
41642
         .is_mutable = true,
41643
         .is_synthetic = false,
41644
         .parse = ovsrec_port_parse_bond_fake_iface,
41645
         .unparse = ovsrec_port_unparse_bond_fake_iface,
41646
    },
41647
41648
    [OVSREC_PORT_COL_BOND_MODE] = {
41649
         .name = "bond_mode",
41650
         .type = {
41651
            .key = {
41652
               .type = OVSDB_TYPE_STRING,
41653
               .enum_ = &Port_col_bond_mode_key_enum,
41654
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41655
            },
41656
            .value = OVSDB_BASE_VOID_INIT,
41657
            .n_min = 0,
41658
            .n_max = 1,
41659
         },
41660
         .is_mutable = true,
41661
         .is_synthetic = false,
41662
         .parse = ovsrec_port_parse_bond_mode,
41663
         .unparse = ovsrec_port_unparse_bond_mode,
41664
    },
41665
41666
    [OVSREC_PORT_COL_BOND_UPDELAY] = {
41667
         .name = "bond_updelay",
41668
         .type = {
41669
            .key = {
41670
               .type = OVSDB_TYPE_INTEGER,
41671
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
41672
            },
41673
            .value = OVSDB_BASE_VOID_INIT,
41674
            .n_min = 1,
41675
            .n_max = 1,
41676
         },
41677
         .is_mutable = true,
41678
         .is_synthetic = false,
41679
         .parse = ovsrec_port_parse_bond_updelay,
41680
         .unparse = ovsrec_port_unparse_bond_updelay,
41681
    },
41682
41683
    [OVSREC_PORT_COL_CVLANS] = {
41684
         .name = "cvlans",
41685
         .type = {
41686
            .key = {
41687
               .type = OVSDB_TYPE_INTEGER,
41688
               .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
41689
            },
41690
            .value = OVSDB_BASE_VOID_INIT,
41691
            .n_min = 0,
41692
            .n_max = 4096,
41693
         },
41694
         .is_mutable = true,
41695
         .is_synthetic = false,
41696
         .parse = ovsrec_port_parse_cvlans,
41697
         .unparse = ovsrec_port_unparse_cvlans,
41698
    },
41699
41700
    [OVSREC_PORT_COL_EXTERNAL_IDS] = {
41701
         .name = "external_ids",
41702
         .type = {
41703
            .key = {
41704
               .type = OVSDB_TYPE_STRING,
41705
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41706
            },
41707
            .value = {
41708
                .type = OVSDB_TYPE_STRING,
41709
                .string = { .minLen = 0, .maxLen = UINT_MAX },
41710
            },
41711
            .n_min = 0,
41712
            .n_max = UINT_MAX,
41713
         },
41714
         .is_mutable = true,
41715
         .is_synthetic = false,
41716
         .parse = ovsrec_port_parse_external_ids,
41717
         .unparse = ovsrec_port_unparse_external_ids,
41718
    },
41719
41720
    [OVSREC_PORT_COL_FAKE_BRIDGE] = {
41721
         .name = "fake_bridge",
41722
         .type = {
41723
            .key = {
41724
               .type = OVSDB_TYPE_BOOLEAN,
41725
            },
41726
            .value = OVSDB_BASE_VOID_INIT,
41727
            .n_min = 1,
41728
            .n_max = 1,
41729
         },
41730
         .is_mutable = true,
41731
         .is_synthetic = false,
41732
         .parse = ovsrec_port_parse_fake_bridge,
41733
         .unparse = ovsrec_port_unparse_fake_bridge,
41734
    },
41735
41736
    [OVSREC_PORT_COL_INTERFACES] = {
41737
         .name = "interfaces",
41738
         .type = {
41739
            .key = {
41740
               .type = OVSDB_TYPE_UUID,
41741
               .uuid = { .refTableName = "Interface", .refType = OVSDB_REF_STRONG },
41742
            },
41743
            .value = OVSDB_BASE_VOID_INIT,
41744
            .n_min = 1,
41745
            .n_max = UINT_MAX,
41746
         },
41747
         .is_mutable = true,
41748
         .is_synthetic = false,
41749
         .parse = ovsrec_port_parse_interfaces,
41750
         .unparse = ovsrec_port_unparse_interfaces,
41751
    },
41752
41753
    [OVSREC_PORT_COL_LACP] = {
41754
         .name = "lacp",
41755
         .type = {
41756
            .key = {
41757
               .type = OVSDB_TYPE_STRING,
41758
               .enum_ = &Port_col_lacp_key_enum,
41759
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41760
            },
41761
            .value = OVSDB_BASE_VOID_INIT,
41762
            .n_min = 0,
41763
            .n_max = 1,
41764
         },
41765
         .is_mutable = true,
41766
         .is_synthetic = false,
41767
         .parse = ovsrec_port_parse_lacp,
41768
         .unparse = ovsrec_port_unparse_lacp,
41769
    },
41770
41771
    [OVSREC_PORT_COL_MAC] = {
41772
         .name = "mac",
41773
         .type = {
41774
            .key = {
41775
               .type = OVSDB_TYPE_STRING,
41776
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41777
            },
41778
            .value = OVSDB_BASE_VOID_INIT,
41779
            .n_min = 0,
41780
            .n_max = 1,
41781
         },
41782
         .is_mutable = true,
41783
         .is_synthetic = false,
41784
         .parse = ovsrec_port_parse_mac,
41785
         .unparse = ovsrec_port_unparse_mac,
41786
    },
41787
41788
    [OVSREC_PORT_COL_NAME] = {
41789
         .name = "name",
41790
         .type = {
41791
            .key = {
41792
               .type = OVSDB_TYPE_STRING,
41793
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41794
            },
41795
            .value = OVSDB_BASE_VOID_INIT,
41796
            .n_min = 1,
41797
            .n_max = 1,
41798
         },
41799
         .is_mutable = false,
41800
         .is_synthetic = false,
41801
         .parse = ovsrec_port_parse_name,
41802
         .unparse = ovsrec_port_unparse_name,
41803
    },
41804
41805
    [OVSREC_PORT_COL_OTHER_CONFIG] = {
41806
         .name = "other_config",
41807
         .type = {
41808
            .key = {
41809
               .type = OVSDB_TYPE_STRING,
41810
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41811
            },
41812
            .value = {
41813
                .type = OVSDB_TYPE_STRING,
41814
                .string = { .minLen = 0, .maxLen = UINT_MAX },
41815
            },
41816
            .n_min = 0,
41817
            .n_max = UINT_MAX,
41818
         },
41819
         .is_mutable = true,
41820
         .is_synthetic = false,
41821
         .parse = ovsrec_port_parse_other_config,
41822
         .unparse = ovsrec_port_unparse_other_config,
41823
    },
41824
41825
    [OVSREC_PORT_COL_PROTECTED_] = {
41826
         .name = "protected",
41827
         .type = {
41828
            .key = {
41829
               .type = OVSDB_TYPE_BOOLEAN,
41830
            },
41831
            .value = OVSDB_BASE_VOID_INIT,
41832
            .n_min = 1,
41833
            .n_max = 1,
41834
         },
41835
         .is_mutable = true,
41836
         .is_synthetic = false,
41837
         .parse = ovsrec_port_parse_protected_,
41838
         .unparse = ovsrec_port_unparse_protected_,
41839
    },
41840
41841
    [OVSREC_PORT_COL_QOS] = {
41842
         .name = "qos",
41843
         .type = {
41844
            .key = {
41845
               .type = OVSDB_TYPE_UUID,
41846
               .uuid = { .refTableName = "QoS", .refType = OVSDB_REF_STRONG },
41847
            },
41848
            .value = OVSDB_BASE_VOID_INIT,
41849
            .n_min = 0,
41850
            .n_max = 1,
41851
         },
41852
         .is_mutable = true,
41853
         .is_synthetic = false,
41854
         .parse = ovsrec_port_parse_qos,
41855
         .unparse = ovsrec_port_unparse_qos,
41856
    },
41857
41858
    [OVSREC_PORT_COL_RSTP_STATISTICS] = {
41859
         .name = "rstp_statistics",
41860
         .type = {
41861
            .key = {
41862
               .type = OVSDB_TYPE_STRING,
41863
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41864
            },
41865
            .value = {
41866
                .type = OVSDB_TYPE_INTEGER,
41867
                .integer = { .min = INT64_MIN, .max = INT64_MAX },
41868
            },
41869
            .n_min = 0,
41870
            .n_max = UINT_MAX,
41871
         },
41872
         .is_mutable = true,
41873
         .is_synthetic = false,
41874
         .parse = ovsrec_port_parse_rstp_statistics,
41875
         .unparse = ovsrec_port_unparse_rstp_statistics,
41876
    },
41877
41878
    [OVSREC_PORT_COL_RSTP_STATUS] = {
41879
         .name = "rstp_status",
41880
         .type = {
41881
            .key = {
41882
               .type = OVSDB_TYPE_STRING,
41883
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41884
            },
41885
            .value = {
41886
                .type = OVSDB_TYPE_STRING,
41887
                .string = { .minLen = 0, .maxLen = UINT_MAX },
41888
            },
41889
            .n_min = 0,
41890
            .n_max = UINT_MAX,
41891
         },
41892
         .is_mutable = true,
41893
         .is_synthetic = false,
41894
         .parse = ovsrec_port_parse_rstp_status,
41895
         .unparse = ovsrec_port_unparse_rstp_status,
41896
    },
41897
41898
    [OVSREC_PORT_COL_STATISTICS] = {
41899
         .name = "statistics",
41900
         .type = {
41901
            .key = {
41902
               .type = OVSDB_TYPE_STRING,
41903
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41904
            },
41905
            .value = {
41906
                .type = OVSDB_TYPE_INTEGER,
41907
                .integer = { .min = INT64_MIN, .max = INT64_MAX },
41908
            },
41909
            .n_min = 0,
41910
            .n_max = UINT_MAX,
41911
         },
41912
         .is_mutable = true,
41913
         .is_synthetic = false,
41914
         .parse = ovsrec_port_parse_statistics,
41915
         .unparse = ovsrec_port_unparse_statistics,
41916
    },
41917
41918
    [OVSREC_PORT_COL_STATUS] = {
41919
         .name = "status",
41920
         .type = {
41921
            .key = {
41922
               .type = OVSDB_TYPE_STRING,
41923
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41924
            },
41925
            .value = {
41926
                .type = OVSDB_TYPE_STRING,
41927
                .string = { .minLen = 0, .maxLen = UINT_MAX },
41928
            },
41929
            .n_min = 0,
41930
            .n_max = UINT_MAX,
41931
         },
41932
         .is_mutable = true,
41933
         .is_synthetic = false,
41934
         .parse = ovsrec_port_parse_status,
41935
         .unparse = ovsrec_port_unparse_status,
41936
    },
41937
41938
    [OVSREC_PORT_COL_TAG] = {
41939
         .name = "tag",
41940
         .type = {
41941
            .key = {
41942
               .type = OVSDB_TYPE_INTEGER,
41943
               .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
41944
            },
41945
            .value = OVSDB_BASE_VOID_INIT,
41946
            .n_min = 0,
41947
            .n_max = 1,
41948
         },
41949
         .is_mutable = true,
41950
         .is_synthetic = false,
41951
         .parse = ovsrec_port_parse_tag,
41952
         .unparse = ovsrec_port_unparse_tag,
41953
    },
41954
41955
    [OVSREC_PORT_COL_TRUNKS] = {
41956
         .name = "trunks",
41957
         .type = {
41958
            .key = {
41959
               .type = OVSDB_TYPE_INTEGER,
41960
               .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
41961
            },
41962
            .value = OVSDB_BASE_VOID_INIT,
41963
            .n_min = 0,
41964
            .n_max = 4096,
41965
         },
41966
         .is_mutable = true,
41967
         .is_synthetic = false,
41968
         .parse = ovsrec_port_parse_trunks,
41969
         .unparse = ovsrec_port_unparse_trunks,
41970
    },
41971
41972
    [OVSREC_PORT_COL_VLAN_MODE] = {
41973
         .name = "vlan_mode",
41974
         .type = {
41975
            .key = {
41976
               .type = OVSDB_TYPE_STRING,
41977
               .enum_ = &Port_col_vlan_mode_key_enum,
41978
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41979
            },
41980
            .value = OVSDB_BASE_VOID_INIT,
41981
            .n_min = 0,
41982
            .n_max = 1,
41983
         },
41984
         .is_mutable = true,
41985
         .is_synthetic = false,
41986
         .parse = ovsrec_port_parse_vlan_mode,
41987
         .unparse = ovsrec_port_unparse_vlan_mode,
41988
    },
41989
41990
};
41991

41992
/* QoS table. */
41993
41994
bool
41995
ovsrec_server_has_qos_table_col_external_ids(const struct ovsdb_idl *idl)
41996
0
{
41997
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_qos_col_external_ids);
41998
0
}
41999
42000
const struct ovsdb_type *
42001
ovsrec_qos_external_ids_server_type(const struct ovsdb_idl *idl)
42002
0
{
42003
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_qos_col_external_ids);
42004
0
}
42005
42006
42007
bool
42008
ovsrec_server_has_qos_table_col_other_config(const struct ovsdb_idl *idl)
42009
0
{
42010
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_qos_col_other_config);
42011
0
}
42012
42013
const struct ovsdb_type *
42014
ovsrec_qos_other_config_server_type(const struct ovsdb_idl *idl)
42015
0
{
42016
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_qos_col_other_config);
42017
0
}
42018
42019
42020
bool
42021
ovsrec_server_has_qos_table_col_queues(const struct ovsdb_idl *idl)
42022
0
{
42023
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_qos_col_queues);
42024
0
}
42025
42026
const struct ovsdb_type *
42027
ovsrec_qos_queues_server_type(const struct ovsdb_idl *idl)
42028
0
{
42029
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_qos_col_queues);
42030
0
}
42031
42032
42033
bool
42034
ovsrec_server_has_qos_table_col_type(const struct ovsdb_idl *idl)
42035
0
{
42036
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_qos_col_type);
42037
0
}
42038
42039
const struct ovsdb_type *
42040
ovsrec_qos_type_server_type(const struct ovsdb_idl *idl)
42041
0
{
42042
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_qos_col_type);
42043
0
}
42044
42045
42046
bool
42047
ovsrec_server_has_qos_table(const struct ovsdb_idl *idl)
42048
0
{
42049
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_QOS]);
42050
0
}
42051
42052
42053
const struct ovsrec_qos_table *
42054
ovsrec_qos_table_get(const struct ovsdb_idl *idl)
42055
0
{
42056
0
    return (const struct ovsrec_qos_table *) idl;
42057
0
}
42058
42059
const struct ovsrec_qos *
42060
ovsrec_qos_table_first(const struct ovsrec_qos_table *table)
42061
0
{
42062
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
42063
0
    return ovsrec_qos_first(idl);
42064
0
}
42065
42066
42067
const struct ovsrec_qos *
42068
ovsrec_qos_table_track_get_first(const struct ovsrec_qos_table *table)
42069
0
{
42070
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
42071
0
    return ovsrec_qos_track_get_first(idl);
42072
0
}
42073
42074
42075
static void
42076
ovsrec_qos_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
42077
0
{
42078
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
42079
0
    smap_init(&row->external_ids);
42080
0
    for (size_t i = 0; i < datum->n; i++) {
42081
0
        smap_add(&row->external_ids,
42082
0
                 json_string(datum->keys[i].s),
42083
0
                 json_string(datum->values[i].s));
42084
0
    }
42085
0
}
42086
42087
static void
42088
ovsrec_qos_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
42089
0
{
42090
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
42091
0
    smap_init(&row->other_config);
42092
0
    for (size_t i = 0; i < datum->n; i++) {
42093
0
        smap_add(&row->other_config,
42094
0
                 json_string(datum->keys[i].s),
42095
0
                 json_string(datum->values[i].s));
42096
0
    }
42097
0
}
42098
42099
static void
42100
ovsrec_qos_parse_queues(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
42101
0
{
42102
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
42103
0
    row->key_queues = NULL;
42104
0
    row->value_queues = NULL;
42105
0
    row->n_queues = 0;
42106
0
    for (size_t i = 0; i < datum->n; i++) {
42107
0
        struct ovsrec_queue *valueRow = ovsrec_queue_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_queue, &datum->values[i].uuid));
42108
0
        if (!valueRow) {
42109
0
            continue;
42110
0
        }
42111
0
        if (!row->n_queues) {
42112
0
            row->key_queues = xmalloc(datum->n * sizeof *row->key_queues);
42113
0
            row->value_queues = xmalloc(datum->n * sizeof *row->value_queues);
42114
0
        }
42115
0
        row->key_queues[row->n_queues] = datum->keys[i].integer;
42116
0
        row->value_queues[row->n_queues] = valueRow;
42117
0
        row->n_queues++;
42118
0
    }
42119
0
}
42120
42121
static void
42122
ovsrec_qos_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
42123
0
{
42124
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
42125
42126
0
    if (datum->n >= 1) {
42127
0
        row->type = CONST_CAST(char *, json_string(datum->keys[0].s));
42128
0
    } else {
42129
0
        row->type = "";
42130
0
    }
42131
0
}
42132
42133
static void
42134
ovsrec_qos_unparse_external_ids(struct ovsdb_idl_row *row_)
42135
0
{
42136
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
42137
0
    smap_destroy(&row->external_ids);
42138
0
}
42139
42140
static void
42141
ovsrec_qos_unparse_other_config(struct ovsdb_idl_row *row_)
42142
0
{
42143
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
42144
0
    smap_destroy(&row->other_config);
42145
0
}
42146
42147
static void
42148
ovsrec_qos_unparse_queues(struct ovsdb_idl_row *row_)
42149
0
{
42150
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
42151
0
    free(row->key_queues);
42152
0
    free(row->value_queues);
42153
0
}
42154
42155
static void
42156
ovsrec_qos_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
42157
0
{
42158
    /* Nothing to do. */
42159
0
}
42160
42161
static void
42162
ovsrec_qos_init__(struct ovsdb_idl_row *row)
42163
0
{
42164
0
    ovsrec_qos_init(ovsrec_qos_cast(row));
42165
0
}
42166
42167
/* Clears the contents of 'row' in table "QoS". */
42168
void
42169
ovsrec_qos_init(struct ovsrec_qos *row)
42170
0
{
42171
0
    memset(row, 0, sizeof *row); 
42172
0
    smap_init(&row->external_ids);
42173
0
    smap_init(&row->other_config);
42174
0
    row->type = "";
42175
0
}
42176
42177
/* Searches table "QoS" in 'idl' for a row with UUID 'uuid'.  Returns
42178
 * a pointer to the row if there is one, otherwise a null pointer.  */
42179
const struct ovsrec_qos *
42180
ovsrec_qos_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
42181
0
{
42182
0
    return ovsrec_qos_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_qos, uuid));
42183
0
}
42184
42185
/* Searches table "QoS" for a row with UUID 'uuid'.  Returns
42186
 * a pointer to the row if there is one, otherwise a null pointer.  */
42187
const struct ovsrec_qos *
42188
ovsrec_qos_table_get_for_uuid(const struct ovsrec_qos_table *table, const struct uuid *uuid)
42189
0
{
42190
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
42191
0
    return ovsrec_qos_get_for_uuid(idl, uuid);
42192
0
}
42193
42194
/* Returns a row in table "QoS" in 'idl', or a null pointer if that
42195
 * table is empty.
42196
 *
42197
 * Database tables are internally maintained as hash tables, so adding or
42198
 * removing rows while traversing the same table can cause some rows to be
42199
 * visited twice or not at apply. */
42200
const struct ovsrec_qos *
42201
ovsrec_qos_first(const struct ovsdb_idl *idl)
42202
0
{
42203
0
    return ovsrec_qos_cast(ovsdb_idl_first_row(idl, &ovsrec_table_qos));
42204
0
}
42205
42206
/* Returns a row following 'row' within its table, or a null pointer if 'row'
42207
 * is the last row in its table. */
42208
const struct ovsrec_qos *
42209
ovsrec_qos_next(const struct ovsrec_qos *row)
42210
0
{
42211
0
    return ovsrec_qos_cast(ovsdb_idl_next_row(&row->header_));
42212
0
}
42213
42214
unsigned int ovsrec_qos_get_seqno(const struct ovsdb_idl *idl)
42215
0
{
42216
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_qos);
42217
0
}
42218
42219
unsigned int ovsrec_qos_row_get_seqno(const struct ovsrec_qos *row, enum ovsdb_idl_change change)
42220
0
{
42221
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
42222
0
}
42223
42224
const struct ovsrec_qos *
42225
ovsrec_qos_track_get_first(const struct ovsdb_idl *idl)
42226
0
{
42227
0
    return ovsrec_qos_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_qos));
42228
0
}
42229
42230
const struct ovsrec_qos
42231
*ovsrec_qos_track_get_next(const struct ovsrec_qos *row)
42232
0
{
42233
0
    return ovsrec_qos_cast(ovsdb_idl_track_get_next(&row->header_));
42234
0
}
42235
42236
42237
/* Deletes 'row' from table "QoS".  'row' may be freed, so it must not be
42238
 * accessed afterward.
42239
 *
42240
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42241
void
42242
ovsrec_qos_delete(const struct ovsrec_qos *row)
42243
0
{
42244
0
    ovsdb_idl_txn_delete(&row->header_);
42245
0
}
42246
42247
/* Inserts and returns a new row in the table "QoS" in the database
42248
 * with open transaction 'txn'.
42249
 *
42250
 * The new row is assigned a randomly generated provisional UUID.
42251
 * ovsdb-server will assign a different UUID when 'txn' is committed,
42252
 * but the IDL will replace any uses of the provisional UUID in the
42253
 * data to be to be committed by the UUID assigned by ovsdb-server. */
42254
struct ovsrec_qos *
42255
ovsrec_qos_insert(struct ovsdb_idl_txn *txn)
42256
0
{
42257
0
    return ovsrec_qos_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_qos, NULL));
42258
0
}
42259
42260
/* Inserts and returns a new row in the table "QoS" in the database
42261
 * with open transaction 'txn'.
42262
 *
42263
 * The new row is assigned the UUID specified in the 'uuid' parameter
42264
 * (which cannot be null).  ovsdb-server will try to assign the same
42265
 * UUID when 'txn' is committed. */
42266
struct ovsrec_qos *
42267
ovsrec_qos_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
42268
0
{
42269
0
    return ovsrec_qos_cast(ovsdb_idl_txn_insert_persist_uuid(
42270
0
        txn, &ovsrec_table_qos, uuid));
42271
0
}
42272
42273
bool
42274
ovsrec_qos_is_updated(const struct ovsrec_qos *row, enum ovsrec_qos_column_id column)
42275
0
{
42276
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_qos_columns[column]);
42277
0
}
42278
42279
/* Causes the original contents of column "external_ids" in 'row' to be
42280
 * verified as a prerequisite to completing the transaction.  That is, if
42281
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
42282
 * time that the IDL originally read its contents and the time that the
42283
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
42284
 *
42285
 * The intention is that, to ensure that no transaction commits based on dirty
42286
 * reads, an application should call this function any time "external_ids" is
42287
 * read as part of a read-modify-write operation.
42288
 *
42289
 * In some cases this function reduces to a no-op, because the current value
42290
 * of "external_ids" is already known:
42291
 *
42292
 *   - If 'row' is a row created by the current transaction (returned by
42293
 *     ovsrec_qos_insert()).
42294
 *
42295
 *   - If "external_ids" has already been modified (with
42296
 *     ovsrec_qos_set_external_ids()) within the current transaction.
42297
 *
42298
 * Because of the latter property, always call this function *before*
42299
 * ovsrec_qos_set_external_ids() for a given read-modify-write.
42300
 *
42301
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42302
void
42303
ovsrec_qos_verify_external_ids(const struct ovsrec_qos *row)
42304
0
{
42305
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_col_external_ids);
42306
0
}
42307
42308
/* Causes the original contents of column "other_config" in 'row' to be
42309
 * verified as a prerequisite to completing the transaction.  That is, if
42310
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
42311
 * time that the IDL originally read its contents and the time that the
42312
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
42313
 *
42314
 * The intention is that, to ensure that no transaction commits based on dirty
42315
 * reads, an application should call this function any time "other_config" is
42316
 * read as part of a read-modify-write operation.
42317
 *
42318
 * In some cases this function reduces to a no-op, because the current value
42319
 * of "other_config" is already known:
42320
 *
42321
 *   - If 'row' is a row created by the current transaction (returned by
42322
 *     ovsrec_qos_insert()).
42323
 *
42324
 *   - If "other_config" has already been modified (with
42325
 *     ovsrec_qos_set_other_config()) within the current transaction.
42326
 *
42327
 * Because of the latter property, always call this function *before*
42328
 * ovsrec_qos_set_other_config() for a given read-modify-write.
42329
 *
42330
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42331
void
42332
ovsrec_qos_verify_other_config(const struct ovsrec_qos *row)
42333
0
{
42334
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_col_other_config);
42335
0
}
42336
42337
/* Causes the original contents of column "queues" in 'row' to be
42338
 * verified as a prerequisite to completing the transaction.  That is, if
42339
 * "queues" in 'row' changed (or if 'row' was deleted) between the
42340
 * time that the IDL originally read its contents and the time that the
42341
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
42342
 *
42343
 * The intention is that, to ensure that no transaction commits based on dirty
42344
 * reads, an application should call this function any time "queues" is
42345
 * read as part of a read-modify-write operation.
42346
 *
42347
 * In some cases this function reduces to a no-op, because the current value
42348
 * of "queues" is already known:
42349
 *
42350
 *   - If 'row' is a row created by the current transaction (returned by
42351
 *     ovsrec_qos_insert()).
42352
 *
42353
 *   - If "queues" has already been modified (with
42354
 *     ovsrec_qos_set_queues()) within the current transaction.
42355
 *
42356
 * Because of the latter property, always call this function *before*
42357
 * ovsrec_qos_set_queues() for a given read-modify-write.
42358
 *
42359
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42360
void
42361
ovsrec_qos_verify_queues(const struct ovsrec_qos *row)
42362
0
{
42363
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_col_queues);
42364
0
}
42365
42366
/* Causes the original contents of column "type" in 'row' to be
42367
 * verified as a prerequisite to completing the transaction.  That is, if
42368
 * "type" in 'row' changed (or if 'row' was deleted) between the
42369
 * time that the IDL originally read its contents and the time that the
42370
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
42371
 *
42372
 * The intention is that, to ensure that no transaction commits based on dirty
42373
 * reads, an application should call this function any time "type" is
42374
 * read as part of a read-modify-write operation.
42375
 *
42376
 * In some cases this function reduces to a no-op, because the current value
42377
 * of "type" is already known:
42378
 *
42379
 *   - If 'row' is a row created by the current transaction (returned by
42380
 *     ovsrec_qos_insert()).
42381
 *
42382
 *   - If "type" has already been modified (with
42383
 *     ovsrec_qos_set_type()) within the current transaction.
42384
 *
42385
 * Because of the latter property, always call this function *before*
42386
 * ovsrec_qos_set_type() for a given read-modify-write.
42387
 *
42388
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42389
void
42390
ovsrec_qos_verify_type(const struct ovsrec_qos *row)
42391
0
{
42392
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_col_type);
42393
0
}
42394
42395
/* Returns the "external_ids" column's value from the "QoS" table in 'row'
42396
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
42397
 * ovsdb_datum_find_key() is an easier and more efficient way to search
42398
 * for a given key than implementing the same operation on the "cooked"
42399
 * form in 'row'.
42400
 *
42401
 * 'key_type' must be OVSDB_TYPE_STRING.
42402
 * 'value_type' must be OVSDB_TYPE_STRING.
42403
 * (This helps to avoid silent bugs if someone changes external_ids's
42404
 * type without updating the caller.)
42405
 *
42406
 * The caller must not modify or free the returned value.
42407
 *
42408
 * Various kinds of changes can invalidate the returned value: modifying
42409
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
42410
 * If the returned value is needed for a long time, it is best to make a copy
42411
 * of it with ovsdb_datum_clone().
42412
 *
42413
 * This function is rarely useful, since it is easier to access the value
42414
 * directly through the "external_ids" member in ovsrec_qos. */
42415
const struct ovsdb_datum *
42416
ovsrec_qos_get_external_ids(const struct ovsrec_qos *row,
42417
  enum ovsdb_atomic_type key_type OVS_UNUSED,
42418
  enum ovsdb_atomic_type value_type OVS_UNUSED)
42419
0
{
42420
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
42421
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
42422
0
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_external_ids);
42423
0
}
42424
42425
/* Returns the "other_config" column's value from the "QoS" table in 'row'
42426
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
42427
 * ovsdb_datum_find_key() is an easier and more efficient way to search
42428
 * for a given key than implementing the same operation on the "cooked"
42429
 * form in 'row'.
42430
 *
42431
 * 'key_type' must be OVSDB_TYPE_STRING.
42432
 * 'value_type' must be OVSDB_TYPE_STRING.
42433
 * (This helps to avoid silent bugs if someone changes other_config's
42434
 * type without updating the caller.)
42435
 *
42436
 * The caller must not modify or free the returned value.
42437
 *
42438
 * Various kinds of changes can invalidate the returned value: modifying
42439
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
42440
 * If the returned value is needed for a long time, it is best to make a copy
42441
 * of it with ovsdb_datum_clone().
42442
 *
42443
 * This function is rarely useful, since it is easier to access the value
42444
 * directly through the "other_config" member in ovsrec_qos. */
42445
const struct ovsdb_datum *
42446
ovsrec_qos_get_other_config(const struct ovsrec_qos *row,
42447
  enum ovsdb_atomic_type key_type OVS_UNUSED,
42448
  enum ovsdb_atomic_type value_type OVS_UNUSED)
42449
0
{
42450
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
42451
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
42452
0
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_other_config);
42453
0
}
42454
42455
/* Returns the "queues" column's value from the "QoS" table in 'row'
42456
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
42457
 * ovsdb_datum_find_key() is an easier and more efficient way to search
42458
 * for a given key than implementing the same operation on the "cooked"
42459
 * form in 'row'.
42460
 *
42461
 * 'key_type' must be OVSDB_TYPE_INTEGER.
42462
 * 'value_type' must be OVSDB_TYPE_UUID.
42463
 * (This helps to avoid silent bugs if someone changes queues's
42464
 * type without updating the caller.)
42465
 *
42466
 * The caller must not modify or free the returned value.
42467
 *
42468
 * Various kinds of changes can invalidate the returned value: modifying
42469
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
42470
 * If the returned value is needed for a long time, it is best to make a copy
42471
 * of it with ovsdb_datum_clone().
42472
 *
42473
 * This function is rarely useful, since it is easier to access the value
42474
 * directly through the "queues" member in ovsrec_qos. */
42475
const struct ovsdb_datum *
42476
ovsrec_qos_get_queues(const struct ovsrec_qos *row,
42477
  enum ovsdb_atomic_type key_type OVS_UNUSED,
42478
  enum ovsdb_atomic_type value_type OVS_UNUSED)
42479
0
{
42480
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
42481
0
    ovs_assert(value_type == OVSDB_TYPE_UUID);
42482
0
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_queues);
42483
0
}
42484
42485
/* Returns the "type" column's value from the "QoS" table in 'row'
42486
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
42487
 * ovsdb_datum_find_key() is an easier and more efficient way to search
42488
 * for a given key than implementing the same operation on the "cooked"
42489
 * form in 'row'.
42490
 *
42491
 * 'key_type' must be OVSDB_TYPE_STRING.
42492
 * (This helps to avoid silent bugs if someone changes type's
42493
 * type without updating the caller.)
42494
 *
42495
 * The caller must not modify or free the returned value.
42496
 *
42497
 * Various kinds of changes can invalidate the returned value: modifying
42498
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
42499
 * If the returned value is needed for a long time, it is best to make a copy
42500
 * of it with ovsdb_datum_clone().
42501
 *
42502
 * This function is rarely useful, since it is easier to access the value
42503
 * directly through the "type" member in ovsrec_qos. */
42504
const struct ovsdb_datum *
42505
ovsrec_qos_get_type(const struct ovsrec_qos *row,
42506
  enum ovsdb_atomic_type key_type OVS_UNUSED)
42507
0
{
42508
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
42509
0
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_type);
42510
0
}
42511
42512
/* Sets the "external_ids" column's value from the "QoS" table in 'row'
42513
 * to 'external_ids'.
42514
 *
42515
 * The caller retains ownership of 'external_ids' and everything in it. */
42516
void
42517
ovsrec_qos_set_external_ids(const struct ovsrec_qos *row, const struct smap *external_ids)
42518
0
{
42519
0
    struct ovsdb_datum datum;
42520
42521
0
    if (external_ids) {
42522
0
        ovsdb_datum_from_smap(&datum, external_ids);
42523
0
    } else {
42524
0
        ovsdb_datum_init_empty(&datum);
42525
0
    }
42526
0
    ovsdb_idl_txn_write(&row->header_,
42527
0
                        &ovsrec_qos_col_external_ids,
42528
0
                        &datum);
42529
0
}
42530
42531
42532
/* Sets the "other_config" column's value from the "QoS" table in 'row'
42533
 * to 'other_config'.
42534
 *
42535
 * The caller retains ownership of 'other_config' and everything in it. */
42536
void
42537
ovsrec_qos_set_other_config(const struct ovsrec_qos *row, const struct smap *other_config)
42538
0
{
42539
0
    struct ovsdb_datum datum;
42540
42541
0
    if (other_config) {
42542
0
        ovsdb_datum_from_smap(&datum, other_config);
42543
0
    } else {
42544
0
        ovsdb_datum_init_empty(&datum);
42545
0
    }
42546
0
    ovsdb_idl_txn_write(&row->header_,
42547
0
                        &ovsrec_qos_col_other_config,
42548
0
                        &datum);
42549
0
}
42550
42551
42552
/* Sets the "queues" column from the "QoS" table in 'row' to
42553
 * the map with keys 'key_queues' and values 'value_queues'
42554
 * with 'n_queues' entries.
42555
 *
42556
 * Argument constraints: key in range 0 to 4,294,967,295
42557
 *
42558
 * The caller retains ownership of the arguments. */
42559
void
42560
ovsrec_qos_set_queues(const struct ovsrec_qos *row, const int64_t *key_queues, struct ovsrec_queue **value_queues, size_t n_queues)
42561
0
{
42562
0
    struct ovsdb_datum datum;
42563
42564
0
    datum.refcnt = NULL;
42565
42566
0
    datum.n = n_queues;
42567
0
    datum.keys = n_queues ? xmalloc(n_queues * sizeof *datum.keys) : NULL;
42568
0
    datum.values = xmalloc(n_queues * sizeof *datum.values);
42569
0
    for (size_t i = 0; i < n_queues; i++) {
42570
0
        datum.keys[i].integer = key_queues[i];
42571
0
        datum.values[i].uuid = value_queues[i]->header_.uuid;
42572
0
    }
42573
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_qos_col_queues, &datum);
42574
0
}
42575
42576
/* Sets the "type" column from the "QoS" table in 'row' to
42577
 * 'type'.
42578
 *
42579
 * The caller retains ownership of the arguments. */
42580
void
42581
ovsrec_qos_set_type(const struct ovsrec_qos *row, const char *type)
42582
0
{
42583
0
    struct ovsdb_datum datum;
42584
42585
0
    datum.refcnt = NULL;
42586
42587
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
42588
42589
0
    datum.n = 1;
42590
0
    datum.keys = key;
42591
0
    key->s = ovsdb_atom_string_create(type);
42592
0
    datum.values = NULL;
42593
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_qos_col_type, &datum);
42594
0
}
42595
42596
/* Sets an element of the "external_ids" map column from the "QoS" table in 'row'
42597
 * to 'new_value' given the key value 'new_key'.
42598
 *
42599
 */
42600
void
42601
ovsrec_qos_update_external_ids_setkey(const struct ovsrec_qos *row, const char *new_key, const char *new_value)
42602
0
{
42603
0
    struct ovsdb_datum *datum;
42604
42605
0
    datum = xmalloc(sizeof *datum);
42606
0
    datum->n = 1;
42607
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42608
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
42609
0
    datum->refcnt = NULL;
42610
42611
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
42612
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
42613
42614
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
42615
0
                                    &ovsrec_qos_col_external_ids,
42616
0
                                    datum);
42617
0
}
42618
42619
/* Deletes an element of the "external_ids" map column from the "QoS" table in 'row'
42620
 * given the key value 'delete_key'.
42621
 *
42622
 */
42623
void
42624
ovsrec_qos_update_external_ids_delkey(const struct ovsrec_qos *row, const char *delete_key)
42625
0
{
42626
0
    struct ovsdb_datum *datum;
42627
42628
0
    datum = xmalloc(sizeof *datum);
42629
0
    datum->n = 1;
42630
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42631
0
    datum->values = NULL;
42632
0
    datum->refcnt = NULL;
42633
42634
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
42635
42636
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
42637
0
                                    &ovsrec_qos_col_external_ids,
42638
0
                                    datum);
42639
0
}
42640
42641
/* Sets an element of the "other_config" map column from the "QoS" table in 'row'
42642
 * to 'new_value' given the key value 'new_key'.
42643
 *
42644
 */
42645
void
42646
ovsrec_qos_update_other_config_setkey(const struct ovsrec_qos *row, const char *new_key, const char *new_value)
42647
0
{
42648
0
    struct ovsdb_datum *datum;
42649
42650
0
    datum = xmalloc(sizeof *datum);
42651
0
    datum->n = 1;
42652
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42653
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
42654
0
    datum->refcnt = NULL;
42655
42656
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
42657
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
42658
42659
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
42660
0
                                    &ovsrec_qos_col_other_config,
42661
0
                                    datum);
42662
0
}
42663
42664
/* Deletes an element of the "other_config" map column from the "QoS" table in 'row'
42665
 * given the key value 'delete_key'.
42666
 *
42667
 */
42668
void
42669
ovsrec_qos_update_other_config_delkey(const struct ovsrec_qos *row, const char *delete_key)
42670
0
{
42671
0
    struct ovsdb_datum *datum;
42672
42673
0
    datum = xmalloc(sizeof *datum);
42674
0
    datum->n = 1;
42675
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42676
0
    datum->values = NULL;
42677
0
    datum->refcnt = NULL;
42678
42679
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
42680
42681
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
42682
0
                                    &ovsrec_qos_col_other_config,
42683
0
                                    datum);
42684
0
}
42685
42686
/* Sets an element of the "queues" map column from the "QoS" table in 'row'
42687
 * to 'new_value' given the key value 'new_key'.
42688
 *
42689
 */
42690
void
42691
ovsrec_qos_update_queues_setkey(const struct ovsrec_qos *row, int64_t new_key, const struct ovsrec_queue *new_value)
42692
0
{
42693
0
    struct ovsdb_datum *datum;
42694
42695
0
    datum = xmalloc(sizeof *datum);
42696
0
    datum->n = 1;
42697
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42698
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
42699
0
    datum->refcnt = NULL;
42700
42701
0
    datum->keys[0].integer = new_key;
42702
0
    datum->values[0].uuid = new_value->header_.uuid;
42703
42704
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
42705
0
                                    &ovsrec_qos_col_queues,
42706
0
                                    datum);
42707
0
}
42708
42709
/* Deletes an element of the "queues" map column from the "QoS" table in 'row'
42710
 * given the key value 'delete_key'.
42711
 *
42712
 */
42713
void
42714
ovsrec_qos_update_queues_delkey(const struct ovsrec_qos *row, int64_t delete_key)
42715
0
{
42716
0
    struct ovsdb_datum *datum;
42717
42718
0
    datum = xmalloc(sizeof *datum);
42719
0
    datum->n = 1;
42720
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42721
0
    datum->values = NULL;
42722
0
    datum->refcnt = NULL;
42723
42724
0
    datum->keys[0].integer = delete_key;
42725
42726
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
42727
0
                                    &ovsrec_qos_col_queues,
42728
0
                                    datum);
42729
0
}
42730
42731
/* Sets the "external_ids" column's value from the "QoS" table in 'row'
42732
 * to 'external_ids'.
42733
 *
42734
 * The caller retains ownership of 'external_ids' and everything in it. */
42735
void
42736
ovsrec_qos_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
42737
0
{
42738
0
    struct ovsdb_datum datum;
42739
42740
0
    if (external_ids) {
42741
0
        ovsdb_datum_from_smap(&datum, external_ids);
42742
0
    } else {
42743
0
        ovsdb_datum_init_empty(&datum);
42744
0
    }
42745
42746
0
    ovsdb_idl_condition_add_clause(cond,
42747
0
                                   function,
42748
0
                                   &ovsrec_qos_col_external_ids,
42749
0
                                   &datum);
42750
42751
0
    ovsdb_datum_destroy(&datum, &ovsrec_qos_col_external_ids.type);
42752
0
}
42753
42754
42755
/* Sets the "other_config" column's value from the "QoS" table in 'row'
42756
 * to 'other_config'.
42757
 *
42758
 * The caller retains ownership of 'other_config' and everything in it. */
42759
void
42760
ovsrec_qos_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
42761
0
{
42762
0
    struct ovsdb_datum datum;
42763
42764
0
    if (other_config) {
42765
0
        ovsdb_datum_from_smap(&datum, other_config);
42766
0
    } else {
42767
0
        ovsdb_datum_init_empty(&datum);
42768
0
    }
42769
42770
0
    ovsdb_idl_condition_add_clause(cond,
42771
0
                                   function,
42772
0
                                   &ovsrec_qos_col_other_config,
42773
0
                                   &datum);
42774
42775
0
    ovsdb_datum_destroy(&datum, &ovsrec_qos_col_other_config.type);
42776
0
}
42777
42778
42779
/* Sets the "queues" column from the "QoS" table in 'row' to
42780
 * the map with keys 'key_queues' and values 'value_queues'
42781
 * with 'n_queues' entries.
42782
 *
42783
 * Argument constraints: key in range 0 to 4,294,967,295
42784
 *
42785
 * The caller retains ownership of the arguments. */
42786
void
42787
ovsrec_qos_add_clause_queues(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *key_queues, struct uuid **value_queues, size_t n_queues)
42788
0
{
42789
0
    struct ovsdb_datum datum;
42790
42791
0
    datum.refcnt = NULL;
42792
0
    datum.n = n_queues;
42793
0
    datum.keys = n_queues ? xmalloc(n_queues * sizeof *datum.keys) : NULL;
42794
0
    datum.values = xmalloc(n_queues * sizeof *datum.values);
42795
0
    for (size_t i = 0; i < n_queues; i++) {
42796
0
        datum.keys[i].integer = key_queues[i];
42797
0
        datum.values[i].uuid = *value_queues[i];
42798
0
    }
42799
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_qos_col_queues.type);
42800
0
    ovsdb_idl_condition_add_clause(cond,
42801
0
                          function,
42802
0
                          &ovsrec_qos_col_queues,
42803
0
                          &datum);
42804
0
    ovsdb_datum_destroy(&datum, &ovsrec_qos_col_queues.type);
42805
0
}
42806
42807
/* Sets the "type" column from the "QoS" table in 'row' to
42808
 * 'type'.
42809
 *
42810
 * The caller retains ownership of the arguments. */
42811
void
42812
ovsrec_qos_add_clause_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *type)
42813
0
{
42814
0
    struct ovsdb_datum datum;
42815
42816
0
    datum.refcnt = NULL;
42817
42818
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
42819
42820
0
    datum.n = 1;
42821
0
    datum.keys = key;
42822
0
    key->s = ovsdb_atom_string_create(type);
42823
0
    datum.values = NULL;
42824
0
    ovsdb_idl_condition_add_clause(cond,
42825
0
                          function,
42826
0
                          &ovsrec_qos_col_type,
42827
0
                          &datum);
42828
0
    ovsdb_datum_destroy(&datum, &ovsrec_qos_col_type.type);
42829
0
}
42830
42831
/* Destroy 'row' of kind "QoS". The row must have been
42832
 * created with ovsdb_idl_index_init_row.
42833
 */
42834
void
42835
ovsrec_qos_index_destroy_row(const struct ovsrec_qos *row)
42836
0
{
42837
0
    ovsdb_idl_index_destroy_row(&row->header_);
42838
0
}
42839
        
42840
42841
/* Creates a new row of kind "QoS". */
42842
struct ovsrec_qos *
42843
ovsrec_qos_index_init_row(struct ovsdb_idl_index *index)
42844
0
{
42845
0
    ovs_assert(index->table->class_ == &ovsrec_table_qos);
42846
0
    return ALIGNED_CAST(struct ovsrec_qos *, ovsdb_idl_index_init_row(index));
42847
0
}
42848
42849
struct ovsrec_qos *
42850
ovsrec_qos_index_find(struct ovsdb_idl_index *index, const struct ovsrec_qos *target)
42851
0
{
42852
0
    ovs_assert(index->table->class_ == &ovsrec_table_qos);
42853
0
    return ovsrec_qos_cast(ovsdb_idl_index_find(index, &target->header_));
42854
0
}
42855
42856
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
42857
int
42858
ovsrec_qos_index_compare(
42859
    struct ovsdb_idl_index *index, 
42860
    const struct ovsrec_qos *a, 
42861
    const struct ovsrec_qos *b)
42862
0
{
42863
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
42864
0
}
42865
42866
struct ovsdb_idl_cursor
42867
ovsrec_qos_cursor_first(struct ovsdb_idl_index *index)
42868
0
{
42869
0
    ovs_assert(index->table->class_ == &ovsrec_table_qos);
42870
0
    return ovsdb_idl_cursor_first(index);
42871
0
}
42872
42873
struct ovsdb_idl_cursor
42874
ovsrec_qos_cursor_first_eq(
42875
    struct ovsdb_idl_index *index, const struct ovsrec_qos *target)
42876
0
{
42877
0
    ovs_assert(index->table->class_ == &ovsrec_table_qos);
42878
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
42879
0
}
42880
42881
struct ovsdb_idl_cursor
42882
ovsrec_qos_cursor_first_ge(
42883
    struct ovsdb_idl_index *index, const struct ovsrec_qos *target)
42884
0
{
42885
0
    ovs_assert(index->table->class_ == &ovsrec_table_qos);
42886
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
42887
0
}
42888
42889
struct ovsrec_qos *
42890
ovsrec_qos_cursor_data(struct ovsdb_idl_cursor *cursor)
42891
0
{
42892
0
    return ovsrec_qos_cast(ovsdb_idl_cursor_data(cursor));
42893
0
}
42894
42895
42896
/* Sets the "external_ids" column's value from the "QoS" table in 'row'
42897
 * to 'external_ids'.
42898
 *
42899
 * The caller retains ownership of 'external_ids' and everything in it. */
42900
void
42901
ovsrec_qos_index_set_external_ids(const struct ovsrec_qos *row, const struct smap *external_ids)
42902
0
{
42903
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
42904
42905
0
    if (external_ids) {
42906
0
        struct smap_node *node;
42907
0
        size_t i;
42908
42909
0
        datum->n = smap_count(external_ids);
42910
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42911
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
42912
0
        datum->refcnt = NULL;
42913
42914
0
        i = 0;
42915
0
        SMAP_FOR_EACH (node, external_ids) {
42916
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
42917
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
42918
0
            i++;
42919
0
        }
42920
0
        ovsdb_datum_sort_unique(datum, &ovsrec_qos_col_external_ids.type);
42921
0
    } else {
42922
0
        ovsdb_datum_init_empty(datum);
42923
0
    }
42924
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
42925
0
                          &ovsrec_qos_columns[OVSREC_QOS_COL_EXTERNAL_IDS],
42926
0
                          datum,
42927
0
                          &ovsrec_table_classes[OVSREC_TABLE_QOS]);
42928
0
    free(datum);
42929
0
}
42930
42931
42932
/* Sets the "other_config" column's value from the "QoS" table in 'row'
42933
 * to 'other_config'.
42934
 *
42935
 * The caller retains ownership of 'other_config' and everything in it. */
42936
void
42937
ovsrec_qos_index_set_other_config(const struct ovsrec_qos *row, const struct smap *other_config)
42938
0
{
42939
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
42940
42941
0
    if (other_config) {
42942
0
        struct smap_node *node;
42943
0
        size_t i;
42944
42945
0
        datum->n = smap_count(other_config);
42946
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42947
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
42948
0
        datum->refcnt = NULL;
42949
42950
0
        i = 0;
42951
0
        SMAP_FOR_EACH (node, other_config) {
42952
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
42953
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
42954
0
            i++;
42955
0
        }
42956
0
        ovsdb_datum_sort_unique(datum, &ovsrec_qos_col_other_config.type);
42957
0
    } else {
42958
0
        ovsdb_datum_init_empty(datum);
42959
0
    }
42960
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
42961
0
                          &ovsrec_qos_columns[OVSREC_QOS_COL_OTHER_CONFIG],
42962
0
                          datum,
42963
0
                          &ovsrec_table_classes[OVSREC_TABLE_QOS]);
42964
0
    free(datum);
42965
0
}
42966
42967
42968
/* Sets the "queues" column from the "QoS" table in 'row' to
42969
 * the map with keys 'key_queues' and values 'value_queues'
42970
 * with 'n_queues' entries.
42971
 *
42972
 * Argument constraints: key in range 0 to 4,294,967,295
42973
 *
42974
 * The caller retains ownership of the arguments. */
42975
void
42976
ovsrec_qos_index_set_queues(const struct ovsrec_qos *row, const int64_t *key_queues, struct ovsrec_queue **value_queues, size_t n_queues)
42977
0
{
42978
0
    struct ovsdb_datum datum;
42979
42980
0
    datum.refcnt = NULL;
42981
0
    size_t i;
42982
42983
0
    datum.n = n_queues;
42984
0
    datum.keys = n_queues ? xmalloc(n_queues * sizeof *datum.keys) : NULL;
42985
0
    datum.values = xmalloc(n_queues * sizeof *datum.values);
42986
0
    for (i = 0; i < n_queues; i++) {
42987
0
        datum.keys[i].integer = key_queues[i];
42988
0
        datum.values[i].uuid = value_queues[i]->header_.uuid;
42989
0
    }
42990
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_qos_col_queues.type);
42991
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_qos_columns[ OVSREC_QOS_COL_QUEUES ], &datum, &ovsrec_table_classes[OVSREC_TABLE_QOS]);
42992
0
}
42993
42994
/* Sets the "type" column from the "QoS" table in 'row' to
42995
 * 'type'.
42996
 *
42997
 * The caller retains ownership of the arguments. */
42998
void
42999
ovsrec_qos_index_set_type(const struct ovsrec_qos *row, const char *type)
43000
0
{
43001
0
    struct ovsdb_datum datum;
43002
43003
0
    datum.refcnt = NULL;
43004
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
43005
43006
0
    datum.n = 1;
43007
0
    datum.keys = key;
43008
0
    key->s = ovsdb_atom_string_create(type);
43009
0
    datum.values = NULL;
43010
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_qos_columns[ OVSREC_QOS_COL_TYPE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_QOS]);
43011
0
}
43012
43013
struct ovsdb_idl_column ovsrec_qos_columns[OVSREC_QOS_N_COLUMNS];
43014
43015
unsigned int
43016
ovsrec_qos_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
43017
0
{
43018
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_qos, condition);
43019
0
}
43020
43021
struct ovsdb_idl_column ovsrec_qos_columns[OVSREC_QOS_N_COLUMNS] = {
43022
    [OVSREC_QOS_COL_EXTERNAL_IDS] = {
43023
         .name = "external_ids",
43024
         .type = {
43025
            .key = {
43026
               .type = OVSDB_TYPE_STRING,
43027
               .string = { .minLen = 0, .maxLen = UINT_MAX },
43028
            },
43029
            .value = {
43030
                .type = OVSDB_TYPE_STRING,
43031
                .string = { .minLen = 0, .maxLen = UINT_MAX },
43032
            },
43033
            .n_min = 0,
43034
            .n_max = UINT_MAX,
43035
         },
43036
         .is_mutable = true,
43037
         .is_synthetic = false,
43038
         .parse = ovsrec_qos_parse_external_ids,
43039
         .unparse = ovsrec_qos_unparse_external_ids,
43040
    },
43041
43042
    [OVSREC_QOS_COL_OTHER_CONFIG] = {
43043
         .name = "other_config",
43044
         .type = {
43045
            .key = {
43046
               .type = OVSDB_TYPE_STRING,
43047
               .string = { .minLen = 0, .maxLen = UINT_MAX },
43048
            },
43049
            .value = {
43050
                .type = OVSDB_TYPE_STRING,
43051
                .string = { .minLen = 0, .maxLen = UINT_MAX },
43052
            },
43053
            .n_min = 0,
43054
            .n_max = UINT_MAX,
43055
         },
43056
         .is_mutable = true,
43057
         .is_synthetic = false,
43058
         .parse = ovsrec_qos_parse_other_config,
43059
         .unparse = ovsrec_qos_unparse_other_config,
43060
    },
43061
43062
    [OVSREC_QOS_COL_QUEUES] = {
43063
         .name = "queues",
43064
         .type = {
43065
            .key = {
43066
               .type = OVSDB_TYPE_INTEGER,
43067
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
43068
            },
43069
            .value = {
43070
                .type = OVSDB_TYPE_UUID,
43071
                .uuid = { .refTableName = "Queue", .refType = OVSDB_REF_STRONG },
43072
            },
43073
            .n_min = 0,
43074
            .n_max = UINT_MAX,
43075
         },
43076
         .is_mutable = true,
43077
         .is_synthetic = false,
43078
         .parse = ovsrec_qos_parse_queues,
43079
         .unparse = ovsrec_qos_unparse_queues,
43080
    },
43081
43082
    [OVSREC_QOS_COL_TYPE] = {
43083
         .name = "type",
43084
         .type = {
43085
            .key = {
43086
               .type = OVSDB_TYPE_STRING,
43087
               .string = { .minLen = 0, .maxLen = UINT_MAX },
43088
            },
43089
            .value = OVSDB_BASE_VOID_INIT,
43090
            .n_min = 1,
43091
            .n_max = 1,
43092
         },
43093
         .is_mutable = true,
43094
         .is_synthetic = false,
43095
         .parse = ovsrec_qos_parse_type,
43096
         .unparse = ovsrec_qos_unparse_type,
43097
    },
43098
43099
};
43100

43101
/* Queue table. */
43102
43103
bool
43104
ovsrec_server_has_queue_table_col_dscp(const struct ovsdb_idl *idl)
43105
0
{
43106
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_queue_col_dscp);
43107
0
}
43108
43109
const struct ovsdb_type *
43110
ovsrec_queue_dscp_server_type(const struct ovsdb_idl *idl)
43111
0
{
43112
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_queue_col_dscp);
43113
0
}
43114
43115
43116
bool
43117
ovsrec_server_has_queue_table_col_external_ids(const struct ovsdb_idl *idl)
43118
0
{
43119
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_queue_col_external_ids);
43120
0
}
43121
43122
const struct ovsdb_type *
43123
ovsrec_queue_external_ids_server_type(const struct ovsdb_idl *idl)
43124
0
{
43125
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_queue_col_external_ids);
43126
0
}
43127
43128
43129
bool
43130
ovsrec_server_has_queue_table_col_other_config(const struct ovsdb_idl *idl)
43131
0
{
43132
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_queue_col_other_config);
43133
0
}
43134
43135
const struct ovsdb_type *
43136
ovsrec_queue_other_config_server_type(const struct ovsdb_idl *idl)
43137
0
{
43138
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_queue_col_other_config);
43139
0
}
43140
43141
43142
bool
43143
ovsrec_server_has_queue_table(const struct ovsdb_idl *idl)
43144
0
{
43145
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_QUEUE]);
43146
0
}
43147
43148
43149
const struct ovsrec_queue_table *
43150
ovsrec_queue_table_get(const struct ovsdb_idl *idl)
43151
0
{
43152
0
    return (const struct ovsrec_queue_table *) idl;
43153
0
}
43154
43155
const struct ovsrec_queue *
43156
ovsrec_queue_table_first(const struct ovsrec_queue_table *table)
43157
0
{
43158
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
43159
0
    return ovsrec_queue_first(idl);
43160
0
}
43161
43162
43163
const struct ovsrec_queue *
43164
ovsrec_queue_table_track_get_first(const struct ovsrec_queue_table *table)
43165
0
{
43166
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
43167
0
    return ovsrec_queue_track_get_first(idl);
43168
0
}
43169
43170
43171
static void
43172
ovsrec_queue_parse_dscp(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
43173
0
{
43174
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
43175
0
    size_t n = MIN(1, datum->n);
43176
0
    row->dscp = NULL;
43177
0
    row->n_dscp = 0;
43178
0
    for (size_t i = 0; i < n; i++) {
43179
0
        if (!row->n_dscp) {
43180
0
            row->dscp = xmalloc(n * sizeof *row->dscp);
43181
0
        }
43182
0
        row->dscp[row->n_dscp] = datum->keys[i].integer;
43183
0
        row->n_dscp++;
43184
0
    }
43185
0
}
43186
43187
static void
43188
ovsrec_queue_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
43189
0
{
43190
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
43191
0
    smap_init(&row->external_ids);
43192
0
    for (size_t i = 0; i < datum->n; i++) {
43193
0
        smap_add(&row->external_ids,
43194
0
                 json_string(datum->keys[i].s),
43195
0
                 json_string(datum->values[i].s));
43196
0
    }
43197
0
}
43198
43199
static void
43200
ovsrec_queue_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
43201
0
{
43202
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
43203
0
    smap_init(&row->other_config);
43204
0
    for (size_t i = 0; i < datum->n; i++) {
43205
0
        smap_add(&row->other_config,
43206
0
                 json_string(datum->keys[i].s),
43207
0
                 json_string(datum->values[i].s));
43208
0
    }
43209
0
}
43210
43211
static void
43212
ovsrec_queue_unparse_dscp(struct ovsdb_idl_row *row_)
43213
0
{
43214
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
43215
0
    free(row->dscp);
43216
0
}
43217
43218
static void
43219
ovsrec_queue_unparse_external_ids(struct ovsdb_idl_row *row_)
43220
0
{
43221
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
43222
0
    smap_destroy(&row->external_ids);
43223
0
}
43224
43225
static void
43226
ovsrec_queue_unparse_other_config(struct ovsdb_idl_row *row_)
43227
0
{
43228
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
43229
0
    smap_destroy(&row->other_config);
43230
0
}
43231
43232
static void
43233
ovsrec_queue_init__(struct ovsdb_idl_row *row)
43234
0
{
43235
0
    ovsrec_queue_init(ovsrec_queue_cast(row));
43236
0
}
43237
43238
/* Clears the contents of 'row' in table "Queue". */
43239
void
43240
ovsrec_queue_init(struct ovsrec_queue *row)
43241
0
{
43242
0
    memset(row, 0, sizeof *row); 
43243
0
    smap_init(&row->external_ids);
43244
0
    smap_init(&row->other_config);
43245
0
}
43246
43247
/* Searches table "Queue" in 'idl' for a row with UUID 'uuid'.  Returns
43248
 * a pointer to the row if there is one, otherwise a null pointer.  */
43249
const struct ovsrec_queue *
43250
ovsrec_queue_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
43251
0
{
43252
0
    return ovsrec_queue_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_queue, uuid));
43253
0
}
43254
43255
/* Searches table "Queue" for a row with UUID 'uuid'.  Returns
43256
 * a pointer to the row if there is one, otherwise a null pointer.  */
43257
const struct ovsrec_queue *
43258
ovsrec_queue_table_get_for_uuid(const struct ovsrec_queue_table *table, const struct uuid *uuid)
43259
0
{
43260
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
43261
0
    return ovsrec_queue_get_for_uuid(idl, uuid);
43262
0
}
43263
43264
/* Returns a row in table "Queue" in 'idl', or a null pointer if that
43265
 * table is empty.
43266
 *
43267
 * Database tables are internally maintained as hash tables, so adding or
43268
 * removing rows while traversing the same table can cause some rows to be
43269
 * visited twice or not at apply. */
43270
const struct ovsrec_queue *
43271
ovsrec_queue_first(const struct ovsdb_idl *idl)
43272
0
{
43273
0
    return ovsrec_queue_cast(ovsdb_idl_first_row(idl, &ovsrec_table_queue));
43274
0
}
43275
43276
/* Returns a row following 'row' within its table, or a null pointer if 'row'
43277
 * is the last row in its table. */
43278
const struct ovsrec_queue *
43279
ovsrec_queue_next(const struct ovsrec_queue *row)
43280
0
{
43281
0
    return ovsrec_queue_cast(ovsdb_idl_next_row(&row->header_));
43282
0
}
43283
43284
unsigned int ovsrec_queue_get_seqno(const struct ovsdb_idl *idl)
43285
0
{
43286
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_queue);
43287
0
}
43288
43289
unsigned int ovsrec_queue_row_get_seqno(const struct ovsrec_queue *row, enum ovsdb_idl_change change)
43290
0
{
43291
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
43292
0
}
43293
43294
const struct ovsrec_queue *
43295
ovsrec_queue_track_get_first(const struct ovsdb_idl *idl)
43296
0
{
43297
0
    return ovsrec_queue_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_queue));
43298
0
}
43299
43300
const struct ovsrec_queue
43301
*ovsrec_queue_track_get_next(const struct ovsrec_queue *row)
43302
0
{
43303
0
    return ovsrec_queue_cast(ovsdb_idl_track_get_next(&row->header_));
43304
0
}
43305
43306
43307
/* Deletes 'row' from table "Queue".  'row' may be freed, so it must not be
43308
 * accessed afterward.
43309
 *
43310
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43311
void
43312
ovsrec_queue_delete(const struct ovsrec_queue *row)
43313
0
{
43314
0
    ovsdb_idl_txn_delete(&row->header_);
43315
0
}
43316
43317
/* Inserts and returns a new row in the table "Queue" in the database
43318
 * with open transaction 'txn'.
43319
 *
43320
 * The new row is assigned a randomly generated provisional UUID.
43321
 * ovsdb-server will assign a different UUID when 'txn' is committed,
43322
 * but the IDL will replace any uses of the provisional UUID in the
43323
 * data to be to be committed by the UUID assigned by ovsdb-server. */
43324
struct ovsrec_queue *
43325
ovsrec_queue_insert(struct ovsdb_idl_txn *txn)
43326
0
{
43327
0
    return ovsrec_queue_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_queue, NULL));
43328
0
}
43329
43330
/* Inserts and returns a new row in the table "Queue" in the database
43331
 * with open transaction 'txn'.
43332
 *
43333
 * The new row is assigned the UUID specified in the 'uuid' parameter
43334
 * (which cannot be null).  ovsdb-server will try to assign the same
43335
 * UUID when 'txn' is committed. */
43336
struct ovsrec_queue *
43337
ovsrec_queue_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
43338
0
{
43339
0
    return ovsrec_queue_cast(ovsdb_idl_txn_insert_persist_uuid(
43340
0
        txn, &ovsrec_table_queue, uuid));
43341
0
}
43342
43343
bool
43344
ovsrec_queue_is_updated(const struct ovsrec_queue *row, enum ovsrec_queue_column_id column)
43345
0
{
43346
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_queue_columns[column]);
43347
0
}
43348
43349
/* Causes the original contents of column "dscp" in 'row' to be
43350
 * verified as a prerequisite to completing the transaction.  That is, if
43351
 * "dscp" in 'row' changed (or if 'row' was deleted) between the
43352
 * time that the IDL originally read its contents and the time that the
43353
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
43354
 *
43355
 * The intention is that, to ensure that no transaction commits based on dirty
43356
 * reads, an application should call this function any time "dscp" is
43357
 * read as part of a read-modify-write operation.
43358
 *
43359
 * In some cases this function reduces to a no-op, because the current value
43360
 * of "dscp" is already known:
43361
 *
43362
 *   - If 'row' is a row created by the current transaction (returned by
43363
 *     ovsrec_queue_insert()).
43364
 *
43365
 *   - If "dscp" has already been modified (with
43366
 *     ovsrec_queue_set_dscp()) within the current transaction.
43367
 *
43368
 * Because of the latter property, always call this function *before*
43369
 * ovsrec_queue_set_dscp() for a given read-modify-write.
43370
 *
43371
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43372
void
43373
ovsrec_queue_verify_dscp(const struct ovsrec_queue *row)
43374
0
{
43375
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_col_dscp);
43376
0
}
43377
43378
/* Causes the original contents of column "external_ids" in 'row' to be
43379
 * verified as a prerequisite to completing the transaction.  That is, if
43380
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
43381
 * time that the IDL originally read its contents and the time that the
43382
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
43383
 *
43384
 * The intention is that, to ensure that no transaction commits based on dirty
43385
 * reads, an application should call this function any time "external_ids" is
43386
 * read as part of a read-modify-write operation.
43387
 *
43388
 * In some cases this function reduces to a no-op, because the current value
43389
 * of "external_ids" is already known:
43390
 *
43391
 *   - If 'row' is a row created by the current transaction (returned by
43392
 *     ovsrec_queue_insert()).
43393
 *
43394
 *   - If "external_ids" has already been modified (with
43395
 *     ovsrec_queue_set_external_ids()) within the current transaction.
43396
 *
43397
 * Because of the latter property, always call this function *before*
43398
 * ovsrec_queue_set_external_ids() for a given read-modify-write.
43399
 *
43400
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43401
void
43402
ovsrec_queue_verify_external_ids(const struct ovsrec_queue *row)
43403
0
{
43404
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_col_external_ids);
43405
0
}
43406
43407
/* Causes the original contents of column "other_config" in 'row' to be
43408
 * verified as a prerequisite to completing the transaction.  That is, if
43409
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
43410
 * time that the IDL originally read its contents and the time that the
43411
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
43412
 *
43413
 * The intention is that, to ensure that no transaction commits based on dirty
43414
 * reads, an application should call this function any time "other_config" is
43415
 * read as part of a read-modify-write operation.
43416
 *
43417
 * In some cases this function reduces to a no-op, because the current value
43418
 * of "other_config" is already known:
43419
 *
43420
 *   - If 'row' is a row created by the current transaction (returned by
43421
 *     ovsrec_queue_insert()).
43422
 *
43423
 *   - If "other_config" has already been modified (with
43424
 *     ovsrec_queue_set_other_config()) within the current transaction.
43425
 *
43426
 * Because of the latter property, always call this function *before*
43427
 * ovsrec_queue_set_other_config() for a given read-modify-write.
43428
 *
43429
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43430
void
43431
ovsrec_queue_verify_other_config(const struct ovsrec_queue *row)
43432
0
{
43433
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_col_other_config);
43434
0
}
43435
43436
/* Returns the "dscp" column's value from the "Queue" table in 'row'
43437
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
43438
 * ovsdb_datum_find_key() is an easier and more efficient way to search
43439
 * for a given key than implementing the same operation on the "cooked"
43440
 * form in 'row'.
43441
 *
43442
 * 'key_type' must be OVSDB_TYPE_INTEGER.
43443
 * (This helps to avoid silent bugs if someone changes dscp's
43444
 * type without updating the caller.)
43445
 *
43446
 * The caller must not modify or free the returned value.
43447
 *
43448
 * Various kinds of changes can invalidate the returned value: modifying
43449
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
43450
 * If the returned value is needed for a long time, it is best to make a copy
43451
 * of it with ovsdb_datum_clone().
43452
 *
43453
 * This function is rarely useful, since it is easier to access the value
43454
 * directly through the "dscp" member in ovsrec_queue. */
43455
const struct ovsdb_datum *
43456
ovsrec_queue_get_dscp(const struct ovsrec_queue *row,
43457
  enum ovsdb_atomic_type key_type OVS_UNUSED)
43458
0
{
43459
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
43460
0
    return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_dscp);
43461
0
}
43462
43463
/* Returns the "external_ids" column's value from the "Queue" table in 'row'
43464
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
43465
 * ovsdb_datum_find_key() is an easier and more efficient way to search
43466
 * for a given key than implementing the same operation on the "cooked"
43467
 * form in 'row'.
43468
 *
43469
 * 'key_type' must be OVSDB_TYPE_STRING.
43470
 * 'value_type' must be OVSDB_TYPE_STRING.
43471
 * (This helps to avoid silent bugs if someone changes external_ids's
43472
 * type without updating the caller.)
43473
 *
43474
 * The caller must not modify or free the returned value.
43475
 *
43476
 * Various kinds of changes can invalidate the returned value: modifying
43477
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
43478
 * If the returned value is needed for a long time, it is best to make a copy
43479
 * of it with ovsdb_datum_clone().
43480
 *
43481
 * This function is rarely useful, since it is easier to access the value
43482
 * directly through the "external_ids" member in ovsrec_queue. */
43483
const struct ovsdb_datum *
43484
ovsrec_queue_get_external_ids(const struct ovsrec_queue *row,
43485
  enum ovsdb_atomic_type key_type OVS_UNUSED,
43486
  enum ovsdb_atomic_type value_type OVS_UNUSED)
43487
0
{
43488
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
43489
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
43490
0
    return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_external_ids);
43491
0
}
43492
43493
/* Returns the "other_config" column's value from the "Queue" table in 'row'
43494
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
43495
 * ovsdb_datum_find_key() is an easier and more efficient way to search
43496
 * for a given key than implementing the same operation on the "cooked"
43497
 * form in 'row'.
43498
 *
43499
 * 'key_type' must be OVSDB_TYPE_STRING.
43500
 * 'value_type' must be OVSDB_TYPE_STRING.
43501
 * (This helps to avoid silent bugs if someone changes other_config's
43502
 * type without updating the caller.)
43503
 *
43504
 * The caller must not modify or free the returned value.
43505
 *
43506
 * Various kinds of changes can invalidate the returned value: modifying
43507
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
43508
 * If the returned value is needed for a long time, it is best to make a copy
43509
 * of it with ovsdb_datum_clone().
43510
 *
43511
 * This function is rarely useful, since it is easier to access the value
43512
 * directly through the "other_config" member in ovsrec_queue. */
43513
const struct ovsdb_datum *
43514
ovsrec_queue_get_other_config(const struct ovsrec_queue *row,
43515
  enum ovsdb_atomic_type key_type OVS_UNUSED,
43516
  enum ovsdb_atomic_type value_type OVS_UNUSED)
43517
0
{
43518
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
43519
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
43520
0
    return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_other_config);
43521
0
}
43522
43523
/* Sets the "dscp" column from the "Queue" table in 'row' to
43524
 * the 'dscp' set with 'n_dscp' entries.
43525
 *
43526
 * 'n_dscp' may be 0 or 1; if it is 0, then 'dscp'
43527
 * may be NULL.
43528
 *
43529
 * Argument constraints: in range 0 to 63
43530
 *
43531
 * The caller retains ownership of the arguments. */
43532
void
43533
ovsrec_queue_set_dscp(const struct ovsrec_queue *row, const int64_t *dscp, size_t n_dscp)
43534
0
{
43535
0
    struct ovsdb_datum datum;
43536
43537
0
    datum.refcnt = NULL;
43538
43539
0
    if (n_dscp) {
43540
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
43541
0
        datum.n = 1;
43542
0
        datum.keys = key;
43543
0
        key->integer = *dscp;
43544
0
    } else {
43545
0
        datum.n = 0;
43546
0
        datum.keys = NULL;
43547
0
    }
43548
0
    datum.values = NULL;
43549
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_queue_col_dscp, &datum);
43550
0
}
43551
43552
/* Sets the "external_ids" column's value from the "Queue" table in 'row'
43553
 * to 'external_ids'.
43554
 *
43555
 * The caller retains ownership of 'external_ids' and everything in it. */
43556
void
43557
ovsrec_queue_set_external_ids(const struct ovsrec_queue *row, const struct smap *external_ids)
43558
0
{
43559
0
    struct ovsdb_datum datum;
43560
43561
0
    if (external_ids) {
43562
0
        ovsdb_datum_from_smap(&datum, external_ids);
43563
0
    } else {
43564
0
        ovsdb_datum_init_empty(&datum);
43565
0
    }
43566
0
    ovsdb_idl_txn_write(&row->header_,
43567
0
                        &ovsrec_queue_col_external_ids,
43568
0
                        &datum);
43569
0
}
43570
43571
43572
/* Sets the "other_config" column's value from the "Queue" table in 'row'
43573
 * to 'other_config'.
43574
 *
43575
 * The caller retains ownership of 'other_config' and everything in it. */
43576
void
43577
ovsrec_queue_set_other_config(const struct ovsrec_queue *row, const struct smap *other_config)
43578
0
{
43579
0
    struct ovsdb_datum datum;
43580
43581
0
    if (other_config) {
43582
0
        ovsdb_datum_from_smap(&datum, other_config);
43583
0
    } else {
43584
0
        ovsdb_datum_init_empty(&datum);
43585
0
    }
43586
0
    ovsdb_idl_txn_write(&row->header_,
43587
0
                        &ovsrec_queue_col_other_config,
43588
0
                        &datum);
43589
0
}
43590
43591
43592
/* Adds the value 'new_value' to the "dscp" set column from the "Queue" table
43593
 * in 'row'.
43594
 *
43595
 */
43596
void
43597
ovsrec_queue_update_dscp_addvalue(const struct ovsrec_queue *row, int64_t new_value)
43598
0
{
43599
0
    struct ovsdb_datum *datum;
43600
43601
0
    datum = xmalloc(sizeof *datum);
43602
0
    datum->n = 1;
43603
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
43604
0
    datum->values = NULL;
43605
0
    datum->refcnt = NULL;
43606
43607
0
    datum->keys[0].integer = new_value;
43608
43609
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
43610
0
                                    &ovsrec_queue_col_dscp,
43611
0
                                    datum);
43612
0
}
43613
43614
/* Deletes the value 'delete_value' from the "dscp" set column from the
43615
 * "Queue" table in 'row'.
43616
 *
43617
 */
43618
void
43619
ovsrec_queue_update_dscp_delvalue(const struct ovsrec_queue *row, int64_t delete_value)
43620
0
{
43621
0
    struct ovsdb_datum *datum;
43622
43623
0
    datum = xmalloc(sizeof *datum);
43624
0
    datum->n = 1;
43625
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
43626
0
    datum->values = NULL;
43627
0
    datum->refcnt = NULL;
43628
43629
0
    datum->keys[0].integer = delete_value;
43630
43631
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
43632
0
                                    &ovsrec_queue_col_dscp,
43633
0
                                    datum);
43634
0
}
43635
43636
/* Sets an element of the "external_ids" map column from the "Queue" table in 'row'
43637
 * to 'new_value' given the key value 'new_key'.
43638
 *
43639
 */
43640
void
43641
ovsrec_queue_update_external_ids_setkey(const struct ovsrec_queue *row, const char *new_key, const char *new_value)
43642
0
{
43643
0
    struct ovsdb_datum *datum;
43644
43645
0
    datum = xmalloc(sizeof *datum);
43646
0
    datum->n = 1;
43647
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
43648
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
43649
0
    datum->refcnt = NULL;
43650
43651
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
43652
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
43653
43654
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
43655
0
                                    &ovsrec_queue_col_external_ids,
43656
0
                                    datum);
43657
0
}
43658
43659
/* Deletes an element of the "external_ids" map column from the "Queue" table in 'row'
43660
 * given the key value 'delete_key'.
43661
 *
43662
 */
43663
void
43664
ovsrec_queue_update_external_ids_delkey(const struct ovsrec_queue *row, const char *delete_key)
43665
0
{
43666
0
    struct ovsdb_datum *datum;
43667
43668
0
    datum = xmalloc(sizeof *datum);
43669
0
    datum->n = 1;
43670
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
43671
0
    datum->values = NULL;
43672
0
    datum->refcnt = NULL;
43673
43674
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
43675
43676
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
43677
0
                                    &ovsrec_queue_col_external_ids,
43678
0
                                    datum);
43679
0
}
43680
43681
/* Sets an element of the "other_config" map column from the "Queue" table in 'row'
43682
 * to 'new_value' given the key value 'new_key'.
43683
 *
43684
 */
43685
void
43686
ovsrec_queue_update_other_config_setkey(const struct ovsrec_queue *row, const char *new_key, const char *new_value)
43687
0
{
43688
0
    struct ovsdb_datum *datum;
43689
43690
0
    datum = xmalloc(sizeof *datum);
43691
0
    datum->n = 1;
43692
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
43693
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
43694
0
    datum->refcnt = NULL;
43695
43696
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
43697
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
43698
43699
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
43700
0
                                    &ovsrec_queue_col_other_config,
43701
0
                                    datum);
43702
0
}
43703
43704
/* Deletes an element of the "other_config" map column from the "Queue" table in 'row'
43705
 * given the key value 'delete_key'.
43706
 *
43707
 */
43708
void
43709
ovsrec_queue_update_other_config_delkey(const struct ovsrec_queue *row, const char *delete_key)
43710
0
{
43711
0
    struct ovsdb_datum *datum;
43712
43713
0
    datum = xmalloc(sizeof *datum);
43714
0
    datum->n = 1;
43715
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
43716
0
    datum->values = NULL;
43717
0
    datum->refcnt = NULL;
43718
43719
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
43720
43721
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
43722
0
                                    &ovsrec_queue_col_other_config,
43723
0
                                    datum);
43724
0
}
43725
43726
/* Sets the "dscp" column from the "Queue" table in 'row' to
43727
 * the 'dscp' set with 'n_dscp' entries.
43728
 *
43729
 * 'n_dscp' may be 0 or 1; if it is 0, then 'dscp'
43730
 * may be NULL.
43731
 *
43732
 * Argument constraints: in range 0 to 63
43733
 *
43734
 * The caller retains ownership of the arguments. */
43735
void
43736
ovsrec_queue_add_clause_dscp(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *dscp, size_t n_dscp)
43737
0
{
43738
0
    struct ovsdb_datum datum;
43739
43740
0
    datum.refcnt = NULL;
43741
43742
0
    if (n_dscp) {
43743
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
43744
0
        datum.n = 1;
43745
0
        datum.keys = key;
43746
0
        key->integer = *dscp;
43747
0
    } else {
43748
0
        datum.n = 0;
43749
0
        datum.keys = NULL;
43750
0
    }
43751
0
    datum.values = NULL;
43752
0
    ovsdb_idl_condition_add_clause(cond,
43753
0
                          function,
43754
0
                          &ovsrec_queue_col_dscp,
43755
0
                          &datum);
43756
0
    ovsdb_datum_destroy(&datum, &ovsrec_queue_col_dscp.type);
43757
0
}
43758
43759
/* Sets the "external_ids" column's value from the "Queue" table in 'row'
43760
 * to 'external_ids'.
43761
 *
43762
 * The caller retains ownership of 'external_ids' and everything in it. */
43763
void
43764
ovsrec_queue_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
43765
0
{
43766
0
    struct ovsdb_datum datum;
43767
43768
0
    if (external_ids) {
43769
0
        ovsdb_datum_from_smap(&datum, external_ids);
43770
0
    } else {
43771
0
        ovsdb_datum_init_empty(&datum);
43772
0
    }
43773
43774
0
    ovsdb_idl_condition_add_clause(cond,
43775
0
                                   function,
43776
0
                                   &ovsrec_queue_col_external_ids,
43777
0
                                   &datum);
43778
43779
0
    ovsdb_datum_destroy(&datum, &ovsrec_queue_col_external_ids.type);
43780
0
}
43781
43782
43783
/* Sets the "other_config" column's value from the "Queue" table in 'row'
43784
 * to 'other_config'.
43785
 *
43786
 * The caller retains ownership of 'other_config' and everything in it. */
43787
void
43788
ovsrec_queue_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
43789
0
{
43790
0
    struct ovsdb_datum datum;
43791
43792
0
    if (other_config) {
43793
0
        ovsdb_datum_from_smap(&datum, other_config);
43794
0
    } else {
43795
0
        ovsdb_datum_init_empty(&datum);
43796
0
    }
43797
43798
0
    ovsdb_idl_condition_add_clause(cond,
43799
0
                                   function,
43800
0
                                   &ovsrec_queue_col_other_config,
43801
0
                                   &datum);
43802
43803
0
    ovsdb_datum_destroy(&datum, &ovsrec_queue_col_other_config.type);
43804
0
}
43805
43806
43807
/* Destroy 'row' of kind "Queue". The row must have been
43808
 * created with ovsdb_idl_index_init_row.
43809
 */
43810
void
43811
ovsrec_queue_index_destroy_row(const struct ovsrec_queue *row)
43812
0
{
43813
0
    ovsdb_idl_index_destroy_row(&row->header_);
43814
0
}
43815
        
43816
43817
/* Creates a new row of kind "Queue". */
43818
struct ovsrec_queue *
43819
ovsrec_queue_index_init_row(struct ovsdb_idl_index *index)
43820
0
{
43821
0
    ovs_assert(index->table->class_ == &ovsrec_table_queue);
43822
0
    return ALIGNED_CAST(struct ovsrec_queue *, ovsdb_idl_index_init_row(index));
43823
0
}
43824
43825
struct ovsrec_queue *
43826
ovsrec_queue_index_find(struct ovsdb_idl_index *index, const struct ovsrec_queue *target)
43827
0
{
43828
0
    ovs_assert(index->table->class_ == &ovsrec_table_queue);
43829
0
    return ovsrec_queue_cast(ovsdb_idl_index_find(index, &target->header_));
43830
0
}
43831
43832
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
43833
int
43834
ovsrec_queue_index_compare(
43835
    struct ovsdb_idl_index *index, 
43836
    const struct ovsrec_queue *a, 
43837
    const struct ovsrec_queue *b)
43838
0
{
43839
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
43840
0
}
43841
43842
struct ovsdb_idl_cursor
43843
ovsrec_queue_cursor_first(struct ovsdb_idl_index *index)
43844
0
{
43845
0
    ovs_assert(index->table->class_ == &ovsrec_table_queue);
43846
0
    return ovsdb_idl_cursor_first(index);
43847
0
}
43848
43849
struct ovsdb_idl_cursor
43850
ovsrec_queue_cursor_first_eq(
43851
    struct ovsdb_idl_index *index, const struct ovsrec_queue *target)
43852
0
{
43853
0
    ovs_assert(index->table->class_ == &ovsrec_table_queue);
43854
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
43855
0
}
43856
43857
struct ovsdb_idl_cursor
43858
ovsrec_queue_cursor_first_ge(
43859
    struct ovsdb_idl_index *index, const struct ovsrec_queue *target)
43860
0
{
43861
0
    ovs_assert(index->table->class_ == &ovsrec_table_queue);
43862
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
43863
0
}
43864
43865
struct ovsrec_queue *
43866
ovsrec_queue_cursor_data(struct ovsdb_idl_cursor *cursor)
43867
0
{
43868
0
    return ovsrec_queue_cast(ovsdb_idl_cursor_data(cursor));
43869
0
}
43870
43871
43872
/* Sets the "dscp" column from the "Queue" table in 'row' to
43873
 * the 'dscp' set with 'n_dscp' entries.
43874
 *
43875
 * 'n_dscp' may be 0 or 1; if it is 0, then 'dscp'
43876
 * may be NULL.
43877
 *
43878
 * Argument constraints: in range 0 to 63
43879
 *
43880
 * The caller retains ownership of the arguments. */
43881
void
43882
ovsrec_queue_index_set_dscp(const struct ovsrec_queue *row, const int64_t *dscp, size_t n_dscp)
43883
0
{
43884
0
    struct ovsdb_datum datum;
43885
43886
0
    datum.refcnt = NULL;
43887
0
    union ovsdb_atom *key;
43888
43889
0
    if (n_dscp) {
43890
0
        key = xmalloc(sizeof(union ovsdb_atom));
43891
0
        datum.n = 1;
43892
0
        datum.keys = key;
43893
0
        key->integer = *dscp;
43894
0
    } else {
43895
0
        datum.n = 0;
43896
0
        datum.keys = NULL;
43897
0
    }
43898
0
    datum.values = NULL;
43899
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_queue_columns[ OVSREC_QUEUE_COL_DSCP ], &datum, &ovsrec_table_classes[OVSREC_TABLE_QUEUE]);
43900
0
}
43901
43902
/* Sets the "external_ids" column's value from the "Queue" table in 'row'
43903
 * to 'external_ids'.
43904
 *
43905
 * The caller retains ownership of 'external_ids' and everything in it. */
43906
void
43907
ovsrec_queue_index_set_external_ids(const struct ovsrec_queue *row, const struct smap *external_ids)
43908
0
{
43909
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
43910
43911
0
    if (external_ids) {
43912
0
        struct smap_node *node;
43913
0
        size_t i;
43914
43915
0
        datum->n = smap_count(external_ids);
43916
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
43917
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
43918
0
        datum->refcnt = NULL;
43919
43920
0
        i = 0;
43921
0
        SMAP_FOR_EACH (node, external_ids) {
43922
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
43923
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
43924
0
            i++;
43925
0
        }
43926
0
        ovsdb_datum_sort_unique(datum, &ovsrec_queue_col_external_ids.type);
43927
0
    } else {
43928
0
        ovsdb_datum_init_empty(datum);
43929
0
    }
43930
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
43931
0
                          &ovsrec_queue_columns[OVSREC_QUEUE_COL_EXTERNAL_IDS],
43932
0
                          datum,
43933
0
                          &ovsrec_table_classes[OVSREC_TABLE_QUEUE]);
43934
0
    free(datum);
43935
0
}
43936
43937
43938
/* Sets the "other_config" column's value from the "Queue" table in 'row'
43939
 * to 'other_config'.
43940
 *
43941
 * The caller retains ownership of 'other_config' and everything in it. */
43942
void
43943
ovsrec_queue_index_set_other_config(const struct ovsrec_queue *row, const struct smap *other_config)
43944
0
{
43945
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
43946
43947
0
    if (other_config) {
43948
0
        struct smap_node *node;
43949
0
        size_t i;
43950
43951
0
        datum->n = smap_count(other_config);
43952
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
43953
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
43954
0
        datum->refcnt = NULL;
43955
43956
0
        i = 0;
43957
0
        SMAP_FOR_EACH (node, other_config) {
43958
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
43959
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
43960
0
            i++;
43961
0
        }
43962
0
        ovsdb_datum_sort_unique(datum, &ovsrec_queue_col_other_config.type);
43963
0
    } else {
43964
0
        ovsdb_datum_init_empty(datum);
43965
0
    }
43966
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
43967
0
                          &ovsrec_queue_columns[OVSREC_QUEUE_COL_OTHER_CONFIG],
43968
0
                          datum,
43969
0
                          &ovsrec_table_classes[OVSREC_TABLE_QUEUE]);
43970
0
    free(datum);
43971
0
}
43972
43973
43974
struct ovsdb_idl_column ovsrec_queue_columns[OVSREC_QUEUE_N_COLUMNS];
43975
43976
unsigned int
43977
ovsrec_queue_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
43978
0
{
43979
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_queue, condition);
43980
0
}
43981
43982
struct ovsdb_idl_column ovsrec_queue_columns[OVSREC_QUEUE_N_COLUMNS] = {
43983
    [OVSREC_QUEUE_COL_DSCP] = {
43984
         .name = "dscp",
43985
         .type = {
43986
            .key = {
43987
               .type = OVSDB_TYPE_INTEGER,
43988
               .integer = { .min = INT64_C(0), .max = INT64_C(63) },
43989
            },
43990
            .value = OVSDB_BASE_VOID_INIT,
43991
            .n_min = 0,
43992
            .n_max = 1,
43993
         },
43994
         .is_mutable = true,
43995
         .is_synthetic = false,
43996
         .parse = ovsrec_queue_parse_dscp,
43997
         .unparse = ovsrec_queue_unparse_dscp,
43998
    },
43999
44000
    [OVSREC_QUEUE_COL_EXTERNAL_IDS] = {
44001
         .name = "external_ids",
44002
         .type = {
44003
            .key = {
44004
               .type = OVSDB_TYPE_STRING,
44005
               .string = { .minLen = 0, .maxLen = UINT_MAX },
44006
            },
44007
            .value = {
44008
                .type = OVSDB_TYPE_STRING,
44009
                .string = { .minLen = 0, .maxLen = UINT_MAX },
44010
            },
44011
            .n_min = 0,
44012
            .n_max = UINT_MAX,
44013
         },
44014
         .is_mutable = true,
44015
         .is_synthetic = false,
44016
         .parse = ovsrec_queue_parse_external_ids,
44017
         .unparse = ovsrec_queue_unparse_external_ids,
44018
    },
44019
44020
    [OVSREC_QUEUE_COL_OTHER_CONFIG] = {
44021
         .name = "other_config",
44022
         .type = {
44023
            .key = {
44024
               .type = OVSDB_TYPE_STRING,
44025
               .string = { .minLen = 0, .maxLen = UINT_MAX },
44026
            },
44027
            .value = {
44028
                .type = OVSDB_TYPE_STRING,
44029
                .string = { .minLen = 0, .maxLen = UINT_MAX },
44030
            },
44031
            .n_min = 0,
44032
            .n_max = UINT_MAX,
44033
         },
44034
         .is_mutable = true,
44035
         .is_synthetic = false,
44036
         .parse = ovsrec_queue_parse_other_config,
44037
         .unparse = ovsrec_queue_unparse_other_config,
44038
    },
44039
44040
};
44041

44042
/* SSL table. */
44043
44044
bool
44045
ovsrec_server_has_ssl_table_col_bootstrap_ca_cert(const struct ovsdb_idl *idl)
44046
0
{
44047
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ssl_col_bootstrap_ca_cert);
44048
0
}
44049
44050
const struct ovsdb_type *
44051
ovsrec_ssl_bootstrap_ca_cert_server_type(const struct ovsdb_idl *idl)
44052
0
{
44053
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ssl_col_bootstrap_ca_cert);
44054
0
}
44055
44056
44057
bool
44058
ovsrec_server_has_ssl_table_col_ca_cert(const struct ovsdb_idl *idl)
44059
0
{
44060
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ssl_col_ca_cert);
44061
0
}
44062
44063
const struct ovsdb_type *
44064
ovsrec_ssl_ca_cert_server_type(const struct ovsdb_idl *idl)
44065
0
{
44066
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ssl_col_ca_cert);
44067
0
}
44068
44069
44070
bool
44071
ovsrec_server_has_ssl_table_col_certificate(const struct ovsdb_idl *idl)
44072
0
{
44073
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ssl_col_certificate);
44074
0
}
44075
44076
const struct ovsdb_type *
44077
ovsrec_ssl_certificate_server_type(const struct ovsdb_idl *idl)
44078
0
{
44079
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ssl_col_certificate);
44080
0
}
44081
44082
44083
bool
44084
ovsrec_server_has_ssl_table_col_external_ids(const struct ovsdb_idl *idl)
44085
0
{
44086
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ssl_col_external_ids);
44087
0
}
44088
44089
const struct ovsdb_type *
44090
ovsrec_ssl_external_ids_server_type(const struct ovsdb_idl *idl)
44091
0
{
44092
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ssl_col_external_ids);
44093
0
}
44094
44095
44096
bool
44097
ovsrec_server_has_ssl_table_col_private_key(const struct ovsdb_idl *idl)
44098
0
{
44099
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ssl_col_private_key);
44100
0
}
44101
44102
const struct ovsdb_type *
44103
ovsrec_ssl_private_key_server_type(const struct ovsdb_idl *idl)
44104
0
{
44105
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_ssl_col_private_key);
44106
0
}
44107
44108
44109
bool
44110
ovsrec_server_has_ssl_table(const struct ovsdb_idl *idl)
44111
0
{
44112
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_SSL]);
44113
0
}
44114
44115
44116
const struct ovsrec_ssl_table *
44117
ovsrec_ssl_table_get(const struct ovsdb_idl *idl)
44118
0
{
44119
0
    return (const struct ovsrec_ssl_table *) idl;
44120
0
}
44121
44122
const struct ovsrec_ssl *
44123
ovsrec_ssl_table_first(const struct ovsrec_ssl_table *table)
44124
0
{
44125
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
44126
0
    return ovsrec_ssl_first(idl);
44127
0
}
44128
44129
44130
const struct ovsrec_ssl *
44131
ovsrec_ssl_table_track_get_first(const struct ovsrec_ssl_table *table)
44132
0
{
44133
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
44134
0
    return ovsrec_ssl_track_get_first(idl);
44135
0
}
44136
44137
44138
static void
44139
ovsrec_ssl_parse_bootstrap_ca_cert(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
44140
0
{
44141
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
44142
44143
0
    if (datum->n >= 1) {
44144
0
        row->bootstrap_ca_cert = datum->keys[0].boolean;
44145
0
    } else {
44146
0
        row->bootstrap_ca_cert = false;
44147
0
    }
44148
0
}
44149
44150
static void
44151
ovsrec_ssl_parse_ca_cert(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
44152
0
{
44153
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
44154
44155
0
    if (datum->n >= 1) {
44156
0
        row->ca_cert = CONST_CAST(char *, json_string(datum->keys[0].s));
44157
0
    } else {
44158
0
        row->ca_cert = "";
44159
0
    }
44160
0
}
44161
44162
static void
44163
ovsrec_ssl_parse_certificate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
44164
0
{
44165
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
44166
44167
0
    if (datum->n >= 1) {
44168
0
        row->certificate = CONST_CAST(char *, json_string(datum->keys[0].s));
44169
0
    } else {
44170
0
        row->certificate = "";
44171
0
    }
44172
0
}
44173
44174
static void
44175
ovsrec_ssl_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
44176
0
{
44177
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
44178
0
    smap_init(&row->external_ids);
44179
0
    for (size_t i = 0; i < datum->n; i++) {
44180
0
        smap_add(&row->external_ids,
44181
0
                 json_string(datum->keys[i].s),
44182
0
                 json_string(datum->values[i].s));
44183
0
    }
44184
0
}
44185
44186
static void
44187
ovsrec_ssl_parse_private_key(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
44188
0
{
44189
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
44190
44191
0
    if (datum->n >= 1) {
44192
0
        row->private_key = CONST_CAST(char *, json_string(datum->keys[0].s));
44193
0
    } else {
44194
0
        row->private_key = "";
44195
0
    }
44196
0
}
44197
44198
static void
44199
ovsrec_ssl_unparse_bootstrap_ca_cert(struct ovsdb_idl_row *row OVS_UNUSED)
44200
0
{
44201
    /* Nothing to do. */
44202
0
}
44203
44204
static void
44205
ovsrec_ssl_unparse_ca_cert(struct ovsdb_idl_row *row OVS_UNUSED)
44206
0
{
44207
    /* Nothing to do. */
44208
0
}
44209
44210
static void
44211
ovsrec_ssl_unparse_certificate(struct ovsdb_idl_row *row OVS_UNUSED)
44212
0
{
44213
    /* Nothing to do. */
44214
0
}
44215
44216
static void
44217
ovsrec_ssl_unparse_external_ids(struct ovsdb_idl_row *row_)
44218
0
{
44219
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
44220
0
    smap_destroy(&row->external_ids);
44221
0
}
44222
44223
static void
44224
ovsrec_ssl_unparse_private_key(struct ovsdb_idl_row *row OVS_UNUSED)
44225
0
{
44226
    /* Nothing to do. */
44227
0
}
44228
44229
static void
44230
ovsrec_ssl_init__(struct ovsdb_idl_row *row)
44231
0
{
44232
0
    ovsrec_ssl_init(ovsrec_ssl_cast(row));
44233
0
}
44234
44235
/* Clears the contents of 'row' in table "SSL". */
44236
void
44237
ovsrec_ssl_init(struct ovsrec_ssl *row)
44238
0
{
44239
0
    memset(row, 0, sizeof *row); 
44240
0
    row->ca_cert = "";
44241
0
    row->certificate = "";
44242
0
    smap_init(&row->external_ids);
44243
0
    row->private_key = "";
44244
0
}
44245
44246
/* Searches table "SSL" in 'idl' for a row with UUID 'uuid'.  Returns
44247
 * a pointer to the row if there is one, otherwise a null pointer.  */
44248
const struct ovsrec_ssl *
44249
ovsrec_ssl_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
44250
0
{
44251
0
    return ovsrec_ssl_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_ssl, uuid));
44252
0
}
44253
44254
/* Searches table "SSL" for a row with UUID 'uuid'.  Returns
44255
 * a pointer to the row if there is one, otherwise a null pointer.  */
44256
const struct ovsrec_ssl *
44257
ovsrec_ssl_table_get_for_uuid(const struct ovsrec_ssl_table *table, const struct uuid *uuid)
44258
0
{
44259
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
44260
0
    return ovsrec_ssl_get_for_uuid(idl, uuid);
44261
0
}
44262
44263
/* Returns a row in table "SSL" in 'idl', or a null pointer if that
44264
 * table is empty.
44265
 *
44266
 * Database tables are internally maintained as hash tables, so adding or
44267
 * removing rows while traversing the same table can cause some rows to be
44268
 * visited twice or not at apply. */
44269
const struct ovsrec_ssl *
44270
ovsrec_ssl_first(const struct ovsdb_idl *idl)
44271
0
{
44272
0
    return ovsrec_ssl_cast(ovsdb_idl_first_row(idl, &ovsrec_table_ssl));
44273
0
}
44274
44275
/* Returns a row following 'row' within its table, or a null pointer if 'row'
44276
 * is the last row in its table. */
44277
const struct ovsrec_ssl *
44278
ovsrec_ssl_next(const struct ovsrec_ssl *row)
44279
0
{
44280
0
    return ovsrec_ssl_cast(ovsdb_idl_next_row(&row->header_));
44281
0
}
44282
44283
unsigned int ovsrec_ssl_get_seqno(const struct ovsdb_idl *idl)
44284
0
{
44285
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_ssl);
44286
0
}
44287
44288
unsigned int ovsrec_ssl_row_get_seqno(const struct ovsrec_ssl *row, enum ovsdb_idl_change change)
44289
0
{
44290
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
44291
0
}
44292
44293
const struct ovsrec_ssl *
44294
ovsrec_ssl_track_get_first(const struct ovsdb_idl *idl)
44295
0
{
44296
0
    return ovsrec_ssl_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_ssl));
44297
0
}
44298
44299
const struct ovsrec_ssl
44300
*ovsrec_ssl_track_get_next(const struct ovsrec_ssl *row)
44301
0
{
44302
0
    return ovsrec_ssl_cast(ovsdb_idl_track_get_next(&row->header_));
44303
0
}
44304
44305
44306
/* Deletes 'row' from table "SSL".  'row' may be freed, so it must not be
44307
 * accessed afterward.
44308
 *
44309
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
44310
void
44311
ovsrec_ssl_delete(const struct ovsrec_ssl *row)
44312
0
{
44313
0
    ovsdb_idl_txn_delete(&row->header_);
44314
0
}
44315
44316
/* Inserts and returns a new row in the table "SSL" in the database
44317
 * with open transaction 'txn'.
44318
 *
44319
 * The new row is assigned a randomly generated provisional UUID.
44320
 * ovsdb-server will assign a different UUID when 'txn' is committed,
44321
 * but the IDL will replace any uses of the provisional UUID in the
44322
 * data to be to be committed by the UUID assigned by ovsdb-server. */
44323
struct ovsrec_ssl *
44324
ovsrec_ssl_insert(struct ovsdb_idl_txn *txn)
44325
0
{
44326
0
    return ovsrec_ssl_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_ssl, NULL));
44327
0
}
44328
44329
/* Inserts and returns a new row in the table "SSL" in the database
44330
 * with open transaction 'txn'.
44331
 *
44332
 * The new row is assigned the UUID specified in the 'uuid' parameter
44333
 * (which cannot be null).  ovsdb-server will try to assign the same
44334
 * UUID when 'txn' is committed. */
44335
struct ovsrec_ssl *
44336
ovsrec_ssl_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
44337
0
{
44338
0
    return ovsrec_ssl_cast(ovsdb_idl_txn_insert_persist_uuid(
44339
0
        txn, &ovsrec_table_ssl, uuid));
44340
0
}
44341
44342
bool
44343
ovsrec_ssl_is_updated(const struct ovsrec_ssl *row, enum ovsrec_ssl_column_id column)
44344
0
{
44345
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_ssl_columns[column]);
44346
0
}
44347
44348
/* Causes the original contents of column "bootstrap_ca_cert" in 'row' to be
44349
 * verified as a prerequisite to completing the transaction.  That is, if
44350
 * "bootstrap_ca_cert" in 'row' changed (or if 'row' was deleted) between the
44351
 * time that the IDL originally read its contents and the time that the
44352
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
44353
 *
44354
 * The intention is that, to ensure that no transaction commits based on dirty
44355
 * reads, an application should call this function any time "bootstrap_ca_cert" is
44356
 * read as part of a read-modify-write operation.
44357
 *
44358
 * In some cases this function reduces to a no-op, because the current value
44359
 * of "bootstrap_ca_cert" is already known:
44360
 *
44361
 *   - If 'row' is a row created by the current transaction (returned by
44362
 *     ovsrec_ssl_insert()).
44363
 *
44364
 *   - If "bootstrap_ca_cert" has already been modified (with
44365
 *     ovsrec_ssl_set_bootstrap_ca_cert()) within the current transaction.
44366
 *
44367
 * Because of the latter property, always call this function *before*
44368
 * ovsrec_ssl_set_bootstrap_ca_cert() for a given read-modify-write.
44369
 *
44370
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
44371
void
44372
ovsrec_ssl_verify_bootstrap_ca_cert(const struct ovsrec_ssl *row)
44373
0
{
44374
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_col_bootstrap_ca_cert);
44375
0
}
44376
44377
/* Causes the original contents of column "ca_cert" in 'row' to be
44378
 * verified as a prerequisite to completing the transaction.  That is, if
44379
 * "ca_cert" in 'row' changed (or if 'row' was deleted) between the
44380
 * time that the IDL originally read its contents and the time that the
44381
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
44382
 *
44383
 * The intention is that, to ensure that no transaction commits based on dirty
44384
 * reads, an application should call this function any time "ca_cert" is
44385
 * read as part of a read-modify-write operation.
44386
 *
44387
 * In some cases this function reduces to a no-op, because the current value
44388
 * of "ca_cert" is already known:
44389
 *
44390
 *   - If 'row' is a row created by the current transaction (returned by
44391
 *     ovsrec_ssl_insert()).
44392
 *
44393
 *   - If "ca_cert" has already been modified (with
44394
 *     ovsrec_ssl_set_ca_cert()) within the current transaction.
44395
 *
44396
 * Because of the latter property, always call this function *before*
44397
 * ovsrec_ssl_set_ca_cert() for a given read-modify-write.
44398
 *
44399
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
44400
void
44401
ovsrec_ssl_verify_ca_cert(const struct ovsrec_ssl *row)
44402
0
{
44403
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_col_ca_cert);
44404
0
}
44405
44406
/* Causes the original contents of column "certificate" in 'row' to be
44407
 * verified as a prerequisite to completing the transaction.  That is, if
44408
 * "certificate" in 'row' changed (or if 'row' was deleted) between the
44409
 * time that the IDL originally read its contents and the time that the
44410
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
44411
 *
44412
 * The intention is that, to ensure that no transaction commits based on dirty
44413
 * reads, an application should call this function any time "certificate" is
44414
 * read as part of a read-modify-write operation.
44415
 *
44416
 * In some cases this function reduces to a no-op, because the current value
44417
 * of "certificate" is already known:
44418
 *
44419
 *   - If 'row' is a row created by the current transaction (returned by
44420
 *     ovsrec_ssl_insert()).
44421
 *
44422
 *   - If "certificate" has already been modified (with
44423
 *     ovsrec_ssl_set_certificate()) within the current transaction.
44424
 *
44425
 * Because of the latter property, always call this function *before*
44426
 * ovsrec_ssl_set_certificate() for a given read-modify-write.
44427
 *
44428
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
44429
void
44430
ovsrec_ssl_verify_certificate(const struct ovsrec_ssl *row)
44431
0
{
44432
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_col_certificate);
44433
0
}
44434
44435
/* Causes the original contents of column "external_ids" in 'row' to be
44436
 * verified as a prerequisite to completing the transaction.  That is, if
44437
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
44438
 * time that the IDL originally read its contents and the time that the
44439
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
44440
 *
44441
 * The intention is that, to ensure that no transaction commits based on dirty
44442
 * reads, an application should call this function any time "external_ids" is
44443
 * read as part of a read-modify-write operation.
44444
 *
44445
 * In some cases this function reduces to a no-op, because the current value
44446
 * of "external_ids" is already known:
44447
 *
44448
 *   - If 'row' is a row created by the current transaction (returned by
44449
 *     ovsrec_ssl_insert()).
44450
 *
44451
 *   - If "external_ids" has already been modified (with
44452
 *     ovsrec_ssl_set_external_ids()) within the current transaction.
44453
 *
44454
 * Because of the latter property, always call this function *before*
44455
 * ovsrec_ssl_set_external_ids() for a given read-modify-write.
44456
 *
44457
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
44458
void
44459
ovsrec_ssl_verify_external_ids(const struct ovsrec_ssl *row)
44460
0
{
44461
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_col_external_ids);
44462
0
}
44463
44464
/* Causes the original contents of column "private_key" in 'row' to be
44465
 * verified as a prerequisite to completing the transaction.  That is, if
44466
 * "private_key" in 'row' changed (or if 'row' was deleted) between the
44467
 * time that the IDL originally read its contents and the time that the
44468
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
44469
 *
44470
 * The intention is that, to ensure that no transaction commits based on dirty
44471
 * reads, an application should call this function any time "private_key" is
44472
 * read as part of a read-modify-write operation.
44473
 *
44474
 * In some cases this function reduces to a no-op, because the current value
44475
 * of "private_key" is already known:
44476
 *
44477
 *   - If 'row' is a row created by the current transaction (returned by
44478
 *     ovsrec_ssl_insert()).
44479
 *
44480
 *   - If "private_key" has already been modified (with
44481
 *     ovsrec_ssl_set_private_key()) within the current transaction.
44482
 *
44483
 * Because of the latter property, always call this function *before*
44484
 * ovsrec_ssl_set_private_key() for a given read-modify-write.
44485
 *
44486
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
44487
void
44488
ovsrec_ssl_verify_private_key(const struct ovsrec_ssl *row)
44489
0
{
44490
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_col_private_key);
44491
0
}
44492
44493
/* Returns the "bootstrap_ca_cert" column's value from the "SSL" table in 'row'
44494
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
44495
 * ovsdb_datum_find_key() is an easier and more efficient way to search
44496
 * for a given key than implementing the same operation on the "cooked"
44497
 * form in 'row'.
44498
 *
44499
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
44500
 * (This helps to avoid silent bugs if someone changes bootstrap_ca_cert's
44501
 * type without updating the caller.)
44502
 *
44503
 * The caller must not modify or free the returned value.
44504
 *
44505
 * Various kinds of changes can invalidate the returned value: modifying
44506
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
44507
 * If the returned value is needed for a long time, it is best to make a copy
44508
 * of it with ovsdb_datum_clone().
44509
 *
44510
 * This function is rarely useful, since it is easier to access the value
44511
 * directly through the "bootstrap_ca_cert" member in ovsrec_ssl. */
44512
const struct ovsdb_datum *
44513
ovsrec_ssl_get_bootstrap_ca_cert(const struct ovsrec_ssl *row,
44514
  enum ovsdb_atomic_type key_type OVS_UNUSED)
44515
0
{
44516
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
44517
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_bootstrap_ca_cert);
44518
0
}
44519
44520
/* Returns the "ca_cert" column's value from the "SSL" table in 'row'
44521
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
44522
 * ovsdb_datum_find_key() is an easier and more efficient way to search
44523
 * for a given key than implementing the same operation on the "cooked"
44524
 * form in 'row'.
44525
 *
44526
 * 'key_type' must be OVSDB_TYPE_STRING.
44527
 * (This helps to avoid silent bugs if someone changes ca_cert's
44528
 * type without updating the caller.)
44529
 *
44530
 * The caller must not modify or free the returned value.
44531
 *
44532
 * Various kinds of changes can invalidate the returned value: modifying
44533
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
44534
 * If the returned value is needed for a long time, it is best to make a copy
44535
 * of it with ovsdb_datum_clone().
44536
 *
44537
 * This function is rarely useful, since it is easier to access the value
44538
 * directly through the "ca_cert" member in ovsrec_ssl. */
44539
const struct ovsdb_datum *
44540
ovsrec_ssl_get_ca_cert(const struct ovsrec_ssl *row,
44541
  enum ovsdb_atomic_type key_type OVS_UNUSED)
44542
0
{
44543
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
44544
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_ca_cert);
44545
0
}
44546
44547
/* Returns the "certificate" column's value from the "SSL" table in 'row'
44548
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
44549
 * ovsdb_datum_find_key() is an easier and more efficient way to search
44550
 * for a given key than implementing the same operation on the "cooked"
44551
 * form in 'row'.
44552
 *
44553
 * 'key_type' must be OVSDB_TYPE_STRING.
44554
 * (This helps to avoid silent bugs if someone changes certificate's
44555
 * type without updating the caller.)
44556
 *
44557
 * The caller must not modify or free the returned value.
44558
 *
44559
 * Various kinds of changes can invalidate the returned value: modifying
44560
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
44561
 * If the returned value is needed for a long time, it is best to make a copy
44562
 * of it with ovsdb_datum_clone().
44563
 *
44564
 * This function is rarely useful, since it is easier to access the value
44565
 * directly through the "certificate" member in ovsrec_ssl. */
44566
const struct ovsdb_datum *
44567
ovsrec_ssl_get_certificate(const struct ovsrec_ssl *row,
44568
  enum ovsdb_atomic_type key_type OVS_UNUSED)
44569
0
{
44570
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
44571
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_certificate);
44572
0
}
44573
44574
/* Returns the "external_ids" column's value from the "SSL" table in 'row'
44575
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
44576
 * ovsdb_datum_find_key() is an easier and more efficient way to search
44577
 * for a given key than implementing the same operation on the "cooked"
44578
 * form in 'row'.
44579
 *
44580
 * 'key_type' must be OVSDB_TYPE_STRING.
44581
 * 'value_type' must be OVSDB_TYPE_STRING.
44582
 * (This helps to avoid silent bugs if someone changes external_ids's
44583
 * type without updating the caller.)
44584
 *
44585
 * The caller must not modify or free the returned value.
44586
 *
44587
 * Various kinds of changes can invalidate the returned value: modifying
44588
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
44589
 * If the returned value is needed for a long time, it is best to make a copy
44590
 * of it with ovsdb_datum_clone().
44591
 *
44592
 * This function is rarely useful, since it is easier to access the value
44593
 * directly through the "external_ids" member in ovsrec_ssl. */
44594
const struct ovsdb_datum *
44595
ovsrec_ssl_get_external_ids(const struct ovsrec_ssl *row,
44596
  enum ovsdb_atomic_type key_type OVS_UNUSED,
44597
  enum ovsdb_atomic_type value_type OVS_UNUSED)
44598
0
{
44599
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
44600
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
44601
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_external_ids);
44602
0
}
44603
44604
/* Returns the "private_key" column's value from the "SSL" table in 'row'
44605
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
44606
 * ovsdb_datum_find_key() is an easier and more efficient way to search
44607
 * for a given key than implementing the same operation on the "cooked"
44608
 * form in 'row'.
44609
 *
44610
 * 'key_type' must be OVSDB_TYPE_STRING.
44611
 * (This helps to avoid silent bugs if someone changes private_key's
44612
 * type without updating the caller.)
44613
 *
44614
 * The caller must not modify or free the returned value.
44615
 *
44616
 * Various kinds of changes can invalidate the returned value: modifying
44617
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
44618
 * If the returned value is needed for a long time, it is best to make a copy
44619
 * of it with ovsdb_datum_clone().
44620
 *
44621
 * This function is rarely useful, since it is easier to access the value
44622
 * directly through the "private_key" member in ovsrec_ssl. */
44623
const struct ovsdb_datum *
44624
ovsrec_ssl_get_private_key(const struct ovsrec_ssl *row,
44625
  enum ovsdb_atomic_type key_type OVS_UNUSED)
44626
0
{
44627
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
44628
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_private_key);
44629
0
}
44630
44631
/* Sets the "bootstrap_ca_cert" column from the "SSL" table in 'row' to
44632
 * 'bootstrap_ca_cert'.
44633
 *
44634
 * The caller retains ownership of the arguments. */
44635
void
44636
ovsrec_ssl_set_bootstrap_ca_cert(const struct ovsrec_ssl *row, bool bootstrap_ca_cert)
44637
0
{
44638
0
    struct ovsdb_datum datum;
44639
44640
0
    datum.refcnt = NULL;
44641
44642
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
44643
44644
0
    datum.n = 1;
44645
0
    datum.keys = key;
44646
0
    key->boolean = bootstrap_ca_cert;
44647
0
    datum.values = NULL;
44648
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ssl_col_bootstrap_ca_cert, &datum);
44649
0
}
44650
44651
/* Sets the "ca_cert" column from the "SSL" table in 'row' to
44652
 * 'ca_cert'.
44653
 *
44654
 * The caller retains ownership of the arguments. */
44655
void
44656
ovsrec_ssl_set_ca_cert(const struct ovsrec_ssl *row, const char *ca_cert)
44657
0
{
44658
0
    struct ovsdb_datum datum;
44659
44660
0
    datum.refcnt = NULL;
44661
44662
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
44663
44664
0
    datum.n = 1;
44665
0
    datum.keys = key;
44666
0
    key->s = ovsdb_atom_string_create(ca_cert);
44667
0
    datum.values = NULL;
44668
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ssl_col_ca_cert, &datum);
44669
0
}
44670
44671
/* Sets the "certificate" column from the "SSL" table in 'row' to
44672
 * 'certificate'.
44673
 *
44674
 * The caller retains ownership of the arguments. */
44675
void
44676
ovsrec_ssl_set_certificate(const struct ovsrec_ssl *row, const char *certificate)
44677
0
{
44678
0
    struct ovsdb_datum datum;
44679
44680
0
    datum.refcnt = NULL;
44681
44682
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
44683
44684
0
    datum.n = 1;
44685
0
    datum.keys = key;
44686
0
    key->s = ovsdb_atom_string_create(certificate);
44687
0
    datum.values = NULL;
44688
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ssl_col_certificate, &datum);
44689
0
}
44690
44691
/* Sets the "external_ids" column's value from the "SSL" table in 'row'
44692
 * to 'external_ids'.
44693
 *
44694
 * The caller retains ownership of 'external_ids' and everything in it. */
44695
void
44696
ovsrec_ssl_set_external_ids(const struct ovsrec_ssl *row, const struct smap *external_ids)
44697
0
{
44698
0
    struct ovsdb_datum datum;
44699
44700
0
    if (external_ids) {
44701
0
        ovsdb_datum_from_smap(&datum, external_ids);
44702
0
    } else {
44703
0
        ovsdb_datum_init_empty(&datum);
44704
0
    }
44705
0
    ovsdb_idl_txn_write(&row->header_,
44706
0
                        &ovsrec_ssl_col_external_ids,
44707
0
                        &datum);
44708
0
}
44709
44710
44711
/* Sets the "private_key" column from the "SSL" table in 'row' to
44712
 * 'private_key'.
44713
 *
44714
 * The caller retains ownership of the arguments. */
44715
void
44716
ovsrec_ssl_set_private_key(const struct ovsrec_ssl *row, const char *private_key)
44717
0
{
44718
0
    struct ovsdb_datum datum;
44719
44720
0
    datum.refcnt = NULL;
44721
44722
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
44723
44724
0
    datum.n = 1;
44725
0
    datum.keys = key;
44726
0
    key->s = ovsdb_atom_string_create(private_key);
44727
0
    datum.values = NULL;
44728
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ssl_col_private_key, &datum);
44729
0
}
44730
44731
/* Sets an element of the "external_ids" map column from the "SSL" table in 'row'
44732
 * to 'new_value' given the key value 'new_key'.
44733
 *
44734
 */
44735
void
44736
ovsrec_ssl_update_external_ids_setkey(const struct ovsrec_ssl *row, const char *new_key, const char *new_value)
44737
0
{
44738
0
    struct ovsdb_datum *datum;
44739
44740
0
    datum = xmalloc(sizeof *datum);
44741
0
    datum->n = 1;
44742
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
44743
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
44744
0
    datum->refcnt = NULL;
44745
44746
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
44747
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
44748
44749
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
44750
0
                                    &ovsrec_ssl_col_external_ids,
44751
0
                                    datum);
44752
0
}
44753
44754
/* Deletes an element of the "external_ids" map column from the "SSL" table in 'row'
44755
 * given the key value 'delete_key'.
44756
 *
44757
 */
44758
void
44759
ovsrec_ssl_update_external_ids_delkey(const struct ovsrec_ssl *row, const char *delete_key)
44760
0
{
44761
0
    struct ovsdb_datum *datum;
44762
44763
0
    datum = xmalloc(sizeof *datum);
44764
0
    datum->n = 1;
44765
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
44766
0
    datum->values = NULL;
44767
0
    datum->refcnt = NULL;
44768
44769
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
44770
44771
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
44772
0
                                    &ovsrec_ssl_col_external_ids,
44773
0
                                    datum);
44774
0
}
44775
44776
/* Sets the "bootstrap_ca_cert" column from the "SSL" table in 'row' to
44777
 * 'bootstrap_ca_cert'.
44778
 *
44779
 * The caller retains ownership of the arguments. */
44780
void
44781
ovsrec_ssl_add_clause_bootstrap_ca_cert(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool bootstrap_ca_cert)
44782
0
{
44783
0
    struct ovsdb_datum datum;
44784
44785
0
    datum.refcnt = NULL;
44786
44787
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
44788
44789
0
    datum.n = 1;
44790
0
    datum.keys = key;
44791
0
    key->boolean = bootstrap_ca_cert;
44792
0
    datum.values = NULL;
44793
0
    ovsdb_idl_condition_add_clause(cond,
44794
0
                          function,
44795
0
                          &ovsrec_ssl_col_bootstrap_ca_cert,
44796
0
                          &datum);
44797
0
    ovsdb_datum_destroy(&datum, &ovsrec_ssl_col_bootstrap_ca_cert.type);
44798
0
}
44799
44800
/* Sets the "ca_cert" column from the "SSL" table in 'row' to
44801
 * 'ca_cert'.
44802
 *
44803
 * The caller retains ownership of the arguments. */
44804
void
44805
ovsrec_ssl_add_clause_ca_cert(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *ca_cert)
44806
0
{
44807
0
    struct ovsdb_datum datum;
44808
44809
0
    datum.refcnt = NULL;
44810
44811
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
44812
44813
0
    datum.n = 1;
44814
0
    datum.keys = key;
44815
0
    key->s = ovsdb_atom_string_create(ca_cert);
44816
0
    datum.values = NULL;
44817
0
    ovsdb_idl_condition_add_clause(cond,
44818
0
                          function,
44819
0
                          &ovsrec_ssl_col_ca_cert,
44820
0
                          &datum);
44821
0
    ovsdb_datum_destroy(&datum, &ovsrec_ssl_col_ca_cert.type);
44822
0
}
44823
44824
/* Sets the "certificate" column from the "SSL" table in 'row' to
44825
 * 'certificate'.
44826
 *
44827
 * The caller retains ownership of the arguments. */
44828
void
44829
ovsrec_ssl_add_clause_certificate(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *certificate)
44830
0
{
44831
0
    struct ovsdb_datum datum;
44832
44833
0
    datum.refcnt = NULL;
44834
44835
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
44836
44837
0
    datum.n = 1;
44838
0
    datum.keys = key;
44839
0
    key->s = ovsdb_atom_string_create(certificate);
44840
0
    datum.values = NULL;
44841
0
    ovsdb_idl_condition_add_clause(cond,
44842
0
                          function,
44843
0
                          &ovsrec_ssl_col_certificate,
44844
0
                          &datum);
44845
0
    ovsdb_datum_destroy(&datum, &ovsrec_ssl_col_certificate.type);
44846
0
}
44847
44848
/* Sets the "external_ids" column's value from the "SSL" table in 'row'
44849
 * to 'external_ids'.
44850
 *
44851
 * The caller retains ownership of 'external_ids' and everything in it. */
44852
void
44853
ovsrec_ssl_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
44854
0
{
44855
0
    struct ovsdb_datum datum;
44856
44857
0
    if (external_ids) {
44858
0
        ovsdb_datum_from_smap(&datum, external_ids);
44859
0
    } else {
44860
0
        ovsdb_datum_init_empty(&datum);
44861
0
    }
44862
44863
0
    ovsdb_idl_condition_add_clause(cond,
44864
0
                                   function,
44865
0
                                   &ovsrec_ssl_col_external_ids,
44866
0
                                   &datum);
44867
44868
0
    ovsdb_datum_destroy(&datum, &ovsrec_ssl_col_external_ids.type);
44869
0
}
44870
44871
44872
/* Sets the "private_key" column from the "SSL" table in 'row' to
44873
 * 'private_key'.
44874
 *
44875
 * The caller retains ownership of the arguments. */
44876
void
44877
ovsrec_ssl_add_clause_private_key(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *private_key)
44878
0
{
44879
0
    struct ovsdb_datum datum;
44880
44881
0
    datum.refcnt = NULL;
44882
44883
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
44884
44885
0
    datum.n = 1;
44886
0
    datum.keys = key;
44887
0
    key->s = ovsdb_atom_string_create(private_key);
44888
0
    datum.values = NULL;
44889
0
    ovsdb_idl_condition_add_clause(cond,
44890
0
                          function,
44891
0
                          &ovsrec_ssl_col_private_key,
44892
0
                          &datum);
44893
0
    ovsdb_datum_destroy(&datum, &ovsrec_ssl_col_private_key.type);
44894
0
}
44895
44896
/* Destroy 'row' of kind "SSL". The row must have been
44897
 * created with ovsdb_idl_index_init_row.
44898
 */
44899
void
44900
ovsrec_ssl_index_destroy_row(const struct ovsrec_ssl *row)
44901
0
{
44902
0
    ovsdb_idl_index_destroy_row(&row->header_);
44903
0
}
44904
        
44905
44906
/* Creates a new row of kind "SSL". */
44907
struct ovsrec_ssl *
44908
ovsrec_ssl_index_init_row(struct ovsdb_idl_index *index)
44909
0
{
44910
0
    ovs_assert(index->table->class_ == &ovsrec_table_ssl);
44911
0
    return ALIGNED_CAST(struct ovsrec_ssl *, ovsdb_idl_index_init_row(index));
44912
0
}
44913
44914
struct ovsrec_ssl *
44915
ovsrec_ssl_index_find(struct ovsdb_idl_index *index, const struct ovsrec_ssl *target)
44916
0
{
44917
0
    ovs_assert(index->table->class_ == &ovsrec_table_ssl);
44918
0
    return ovsrec_ssl_cast(ovsdb_idl_index_find(index, &target->header_));
44919
0
}
44920
44921
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
44922
int
44923
ovsrec_ssl_index_compare(
44924
    struct ovsdb_idl_index *index, 
44925
    const struct ovsrec_ssl *a, 
44926
    const struct ovsrec_ssl *b)
44927
0
{
44928
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
44929
0
}
44930
44931
struct ovsdb_idl_cursor
44932
ovsrec_ssl_cursor_first(struct ovsdb_idl_index *index)
44933
0
{
44934
0
    ovs_assert(index->table->class_ == &ovsrec_table_ssl);
44935
0
    return ovsdb_idl_cursor_first(index);
44936
0
}
44937
44938
struct ovsdb_idl_cursor
44939
ovsrec_ssl_cursor_first_eq(
44940
    struct ovsdb_idl_index *index, const struct ovsrec_ssl *target)
44941
0
{
44942
0
    ovs_assert(index->table->class_ == &ovsrec_table_ssl);
44943
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
44944
0
}
44945
44946
struct ovsdb_idl_cursor
44947
ovsrec_ssl_cursor_first_ge(
44948
    struct ovsdb_idl_index *index, const struct ovsrec_ssl *target)
44949
0
{
44950
0
    ovs_assert(index->table->class_ == &ovsrec_table_ssl);
44951
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
44952
0
}
44953
44954
struct ovsrec_ssl *
44955
ovsrec_ssl_cursor_data(struct ovsdb_idl_cursor *cursor)
44956
0
{
44957
0
    return ovsrec_ssl_cast(ovsdb_idl_cursor_data(cursor));
44958
0
}
44959
44960
44961
/* Sets the "bootstrap_ca_cert" column from the "SSL" table in 'row' to
44962
 * 'bootstrap_ca_cert'.
44963
 *
44964
 * The caller retains ownership of the arguments. */
44965
void
44966
ovsrec_ssl_index_set_bootstrap_ca_cert(const struct ovsrec_ssl *row, bool bootstrap_ca_cert)
44967
0
{
44968
0
    struct ovsdb_datum datum;
44969
44970
0
    datum.refcnt = NULL;
44971
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
44972
44973
0
    datum.n = 1;
44974
0
    datum.keys = key;
44975
0
    key->boolean = bootstrap_ca_cert;
44976
0
    datum.values = NULL;
44977
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ssl_columns[ OVSREC_SSL_COL_BOOTSTRAP_CA_CERT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_SSL]);
44978
0
}
44979
44980
/* Sets the "ca_cert" column from the "SSL" table in 'row' to
44981
 * 'ca_cert'.
44982
 *
44983
 * The caller retains ownership of the arguments. */
44984
void
44985
ovsrec_ssl_index_set_ca_cert(const struct ovsrec_ssl *row, const char *ca_cert)
44986
0
{
44987
0
    struct ovsdb_datum datum;
44988
44989
0
    datum.refcnt = NULL;
44990
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
44991
44992
0
    datum.n = 1;
44993
0
    datum.keys = key;
44994
0
    key->s = ovsdb_atom_string_create(ca_cert);
44995
0
    datum.values = NULL;
44996
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ssl_columns[ OVSREC_SSL_COL_CA_CERT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_SSL]);
44997
0
}
44998
44999
/* Sets the "certificate" column from the "SSL" table in 'row' to
45000
 * 'certificate'.
45001
 *
45002
 * The caller retains ownership of the arguments. */
45003
void
45004
ovsrec_ssl_index_set_certificate(const struct ovsrec_ssl *row, const char *certificate)
45005
0
{
45006
0
    struct ovsdb_datum datum;
45007
45008
0
    datum.refcnt = NULL;
45009
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
45010
45011
0
    datum.n = 1;
45012
0
    datum.keys = key;
45013
0
    key->s = ovsdb_atom_string_create(certificate);
45014
0
    datum.values = NULL;
45015
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ssl_columns[ OVSREC_SSL_COL_CERTIFICATE ], &datum, &ovsrec_table_classes[OVSREC_TABLE_SSL]);
45016
0
}
45017
45018
/* Sets the "external_ids" column's value from the "SSL" table in 'row'
45019
 * to 'external_ids'.
45020
 *
45021
 * The caller retains ownership of 'external_ids' and everything in it. */
45022
void
45023
ovsrec_ssl_index_set_external_ids(const struct ovsrec_ssl *row, const struct smap *external_ids)
45024
0
{
45025
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
45026
45027
0
    if (external_ids) {
45028
0
        struct smap_node *node;
45029
0
        size_t i;
45030
45031
0
        datum->n = smap_count(external_ids);
45032
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
45033
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
45034
0
        datum->refcnt = NULL;
45035
45036
0
        i = 0;
45037
0
        SMAP_FOR_EACH (node, external_ids) {
45038
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
45039
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
45040
0
            i++;
45041
0
        }
45042
0
        ovsdb_datum_sort_unique(datum, &ovsrec_ssl_col_external_ids.type);
45043
0
    } else {
45044
0
        ovsdb_datum_init_empty(datum);
45045
0
    }
45046
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
45047
0
                          &ovsrec_ssl_columns[OVSREC_SSL_COL_EXTERNAL_IDS],
45048
0
                          datum,
45049
0
                          &ovsrec_table_classes[OVSREC_TABLE_SSL]);
45050
0
    free(datum);
45051
0
}
45052
45053
45054
/* Sets the "private_key" column from the "SSL" table in 'row' to
45055
 * 'private_key'.
45056
 *
45057
 * The caller retains ownership of the arguments. */
45058
void
45059
ovsrec_ssl_index_set_private_key(const struct ovsrec_ssl *row, const char *private_key)
45060
0
{
45061
0
    struct ovsdb_datum datum;
45062
45063
0
    datum.refcnt = NULL;
45064
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
45065
45066
0
    datum.n = 1;
45067
0
    datum.keys = key;
45068
0
    key->s = ovsdb_atom_string_create(private_key);
45069
0
    datum.values = NULL;
45070
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_ssl_columns[ OVSREC_SSL_COL_PRIVATE_KEY ], &datum, &ovsrec_table_classes[OVSREC_TABLE_SSL]);
45071
0
}
45072
45073
struct ovsdb_idl_column ovsrec_ssl_columns[OVSREC_SSL_N_COLUMNS];
45074
45075
unsigned int
45076
ovsrec_ssl_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
45077
0
{
45078
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_ssl, condition);
45079
0
}
45080
45081
struct ovsdb_idl_column ovsrec_ssl_columns[OVSREC_SSL_N_COLUMNS] = {
45082
    [OVSREC_SSL_COL_BOOTSTRAP_CA_CERT] = {
45083
         .name = "bootstrap_ca_cert",
45084
         .type = {
45085
            .key = {
45086
               .type = OVSDB_TYPE_BOOLEAN,
45087
            },
45088
            .value = OVSDB_BASE_VOID_INIT,
45089
            .n_min = 1,
45090
            .n_max = 1,
45091
         },
45092
         .is_mutable = true,
45093
         .is_synthetic = false,
45094
         .parse = ovsrec_ssl_parse_bootstrap_ca_cert,
45095
         .unparse = ovsrec_ssl_unparse_bootstrap_ca_cert,
45096
    },
45097
45098
    [OVSREC_SSL_COL_CA_CERT] = {
45099
         .name = "ca_cert",
45100
         .type = {
45101
            .key = {
45102
               .type = OVSDB_TYPE_STRING,
45103
               .string = { .minLen = 0, .maxLen = UINT_MAX },
45104
            },
45105
            .value = OVSDB_BASE_VOID_INIT,
45106
            .n_min = 1,
45107
            .n_max = 1,
45108
         },
45109
         .is_mutable = true,
45110
         .is_synthetic = false,
45111
         .parse = ovsrec_ssl_parse_ca_cert,
45112
         .unparse = ovsrec_ssl_unparse_ca_cert,
45113
    },
45114
45115
    [OVSREC_SSL_COL_CERTIFICATE] = {
45116
         .name = "certificate",
45117
         .type = {
45118
            .key = {
45119
               .type = OVSDB_TYPE_STRING,
45120
               .string = { .minLen = 0, .maxLen = UINT_MAX },
45121
            },
45122
            .value = OVSDB_BASE_VOID_INIT,
45123
            .n_min = 1,
45124
            .n_max = 1,
45125
         },
45126
         .is_mutable = true,
45127
         .is_synthetic = false,
45128
         .parse = ovsrec_ssl_parse_certificate,
45129
         .unparse = ovsrec_ssl_unparse_certificate,
45130
    },
45131
45132
    [OVSREC_SSL_COL_EXTERNAL_IDS] = {
45133
         .name = "external_ids",
45134
         .type = {
45135
            .key = {
45136
               .type = OVSDB_TYPE_STRING,
45137
               .string = { .minLen = 0, .maxLen = UINT_MAX },
45138
            },
45139
            .value = {
45140
                .type = OVSDB_TYPE_STRING,
45141
                .string = { .minLen = 0, .maxLen = UINT_MAX },
45142
            },
45143
            .n_min = 0,
45144
            .n_max = UINT_MAX,
45145
         },
45146
         .is_mutable = true,
45147
         .is_synthetic = false,
45148
         .parse = ovsrec_ssl_parse_external_ids,
45149
         .unparse = ovsrec_ssl_unparse_external_ids,
45150
    },
45151
45152
    [OVSREC_SSL_COL_PRIVATE_KEY] = {
45153
         .name = "private_key",
45154
         .type = {
45155
            .key = {
45156
               .type = OVSDB_TYPE_STRING,
45157
               .string = { .minLen = 0, .maxLen = UINT_MAX },
45158
            },
45159
            .value = OVSDB_BASE_VOID_INIT,
45160
            .n_min = 1,
45161
            .n_max = 1,
45162
         },
45163
         .is_mutable = true,
45164
         .is_synthetic = false,
45165
         .parse = ovsrec_ssl_parse_private_key,
45166
         .unparse = ovsrec_ssl_unparse_private_key,
45167
    },
45168
45169
};
45170

45171
/* sFlow table. */
45172
45173
bool
45174
ovsrec_server_has_sflow_table_col_agent(const struct ovsdb_idl *idl)
45175
0
{
45176
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_agent);
45177
0
}
45178
45179
const struct ovsdb_type *
45180
ovsrec_sflow_agent_server_type(const struct ovsdb_idl *idl)
45181
0
{
45182
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_sflow_col_agent);
45183
0
}
45184
45185
45186
bool
45187
ovsrec_server_has_sflow_table_col_external_ids(const struct ovsdb_idl *idl)
45188
0
{
45189
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_external_ids);
45190
0
}
45191
45192
const struct ovsdb_type *
45193
ovsrec_sflow_external_ids_server_type(const struct ovsdb_idl *idl)
45194
0
{
45195
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_sflow_col_external_ids);
45196
0
}
45197
45198
45199
bool
45200
ovsrec_server_has_sflow_table_col_header(const struct ovsdb_idl *idl)
45201
0
{
45202
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_header);
45203
0
}
45204
45205
const struct ovsdb_type *
45206
ovsrec_sflow_header_server_type(const struct ovsdb_idl *idl)
45207
0
{
45208
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_sflow_col_header);
45209
0
}
45210
45211
45212
bool
45213
ovsrec_server_has_sflow_table_col_polling(const struct ovsdb_idl *idl)
45214
0
{
45215
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_polling);
45216
0
}
45217
45218
const struct ovsdb_type *
45219
ovsrec_sflow_polling_server_type(const struct ovsdb_idl *idl)
45220
0
{
45221
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_sflow_col_polling);
45222
0
}
45223
45224
45225
bool
45226
ovsrec_server_has_sflow_table_col_sampling(const struct ovsdb_idl *idl)
45227
0
{
45228
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_sampling);
45229
0
}
45230
45231
const struct ovsdb_type *
45232
ovsrec_sflow_sampling_server_type(const struct ovsdb_idl *idl)
45233
0
{
45234
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_sflow_col_sampling);
45235
0
}
45236
45237
45238
bool
45239
ovsrec_server_has_sflow_table_col_targets(const struct ovsdb_idl *idl)
45240
0
{
45241
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_targets);
45242
0
}
45243
45244
const struct ovsdb_type *
45245
ovsrec_sflow_targets_server_type(const struct ovsdb_idl *idl)
45246
0
{
45247
0
    return ovsdb_idl_server_column_type(idl, &ovsrec_sflow_col_targets);
45248
0
}
45249
45250
45251
bool
45252
ovsrec_server_has_sflow_table(const struct ovsdb_idl *idl)
45253
0
{
45254
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_SFLOW]);
45255
0
}
45256
45257
45258
const struct ovsrec_sflow_table *
45259
ovsrec_sflow_table_get(const struct ovsdb_idl *idl)
45260
0
{
45261
0
    return (const struct ovsrec_sflow_table *) idl;
45262
0
}
45263
45264
const struct ovsrec_sflow *
45265
ovsrec_sflow_table_first(const struct ovsrec_sflow_table *table)
45266
0
{
45267
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
45268
0
    return ovsrec_sflow_first(idl);
45269
0
}
45270
45271
45272
const struct ovsrec_sflow *
45273
ovsrec_sflow_table_track_get_first(const struct ovsrec_sflow_table *table)
45274
0
{
45275
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
45276
0
    return ovsrec_sflow_track_get_first(idl);
45277
0
}
45278
45279
45280
static void
45281
ovsrec_sflow_parse_agent(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
45282
0
{
45283
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45284
45285
0
    if (datum->n >= 1) {
45286
0
        row->agent = CONST_CAST(char *, json_string(datum->keys[0].s));
45287
0
    } else {
45288
0
        row->agent = NULL;
45289
0
    }
45290
0
}
45291
45292
static void
45293
ovsrec_sflow_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
45294
0
{
45295
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45296
0
    smap_init(&row->external_ids);
45297
0
    for (size_t i = 0; i < datum->n; i++) {
45298
0
        smap_add(&row->external_ids,
45299
0
                 json_string(datum->keys[i].s),
45300
0
                 json_string(datum->values[i].s));
45301
0
    }
45302
0
}
45303
45304
static void
45305
ovsrec_sflow_parse_header(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
45306
0
{
45307
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45308
0
    size_t n = MIN(1, datum->n);
45309
0
    row->header = NULL;
45310
0
    row->n_header = 0;
45311
0
    for (size_t i = 0; i < n; i++) {
45312
0
        if (!row->n_header) {
45313
0
            row->header = xmalloc(n * sizeof *row->header);
45314
0
        }
45315
0
        row->header[row->n_header] = datum->keys[i].integer;
45316
0
        row->n_header++;
45317
0
    }
45318
0
}
45319
45320
static void
45321
ovsrec_sflow_parse_polling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
45322
0
{
45323
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45324
0
    size_t n = MIN(1, datum->n);
45325
0
    row->polling = NULL;
45326
0
    row->n_polling = 0;
45327
0
    for (size_t i = 0; i < n; i++) {
45328
0
        if (!row->n_polling) {
45329
0
            row->polling = xmalloc(n * sizeof *row->polling);
45330
0
        }
45331
0
        row->polling[row->n_polling] = datum->keys[i].integer;
45332
0
        row->n_polling++;
45333
0
    }
45334
0
}
45335
45336
static void
45337
ovsrec_sflow_parse_sampling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
45338
0
{
45339
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45340
0
    size_t n = MIN(1, datum->n);
45341
0
    row->sampling = NULL;
45342
0
    row->n_sampling = 0;
45343
0
    for (size_t i = 0; i < n; i++) {
45344
0
        if (!row->n_sampling) {
45345
0
            row->sampling = xmalloc(n * sizeof *row->sampling);
45346
0
        }
45347
0
        row->sampling[row->n_sampling] = datum->keys[i].integer;
45348
0
        row->n_sampling++;
45349
0
    }
45350
0
}
45351
45352
static void
45353
ovsrec_sflow_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
45354
0
{
45355
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45356
0
    row->targets = NULL;
45357
0
    row->n_targets = 0;
45358
0
    for (size_t i = 0; i < datum->n; i++) {
45359
0
        if (!row->n_targets) {
45360
0
            row->targets = xmalloc(datum->n * sizeof *row->targets);
45361
0
        }
45362
0
        row->targets[row->n_targets] = CONST_CAST(char *, json_string(datum->keys[i].s));
45363
0
        row->n_targets++;
45364
0
    }
45365
0
}
45366
45367
static void
45368
ovsrec_sflow_unparse_agent(struct ovsdb_idl_row *row OVS_UNUSED)
45369
0
{
45370
    /* Nothing to do. */
45371
0
}
45372
45373
static void
45374
ovsrec_sflow_unparse_external_ids(struct ovsdb_idl_row *row_)
45375
0
{
45376
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45377
0
    smap_destroy(&row->external_ids);
45378
0
}
45379
45380
static void
45381
ovsrec_sflow_unparse_header(struct ovsdb_idl_row *row_)
45382
0
{
45383
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45384
0
    free(row->header);
45385
0
}
45386
45387
static void
45388
ovsrec_sflow_unparse_polling(struct ovsdb_idl_row *row_)
45389
0
{
45390
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45391
0
    free(row->polling);
45392
0
}
45393
45394
static void
45395
ovsrec_sflow_unparse_sampling(struct ovsdb_idl_row *row_)
45396
0
{
45397
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45398
0
    free(row->sampling);
45399
0
}
45400
45401
static void
45402
ovsrec_sflow_unparse_targets(struct ovsdb_idl_row *row_)
45403
0
{
45404
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
45405
0
    free(row->targets);
45406
0
}
45407
45408
static void
45409
ovsrec_sflow_init__(struct ovsdb_idl_row *row)
45410
0
{
45411
0
    ovsrec_sflow_init(ovsrec_sflow_cast(row));
45412
0
}
45413
45414
/* Clears the contents of 'row' in table "sFlow". */
45415
void
45416
ovsrec_sflow_init(struct ovsrec_sflow *row)
45417
0
{
45418
0
    memset(row, 0, sizeof *row); 
45419
0
    smap_init(&row->external_ids);
45420
0
}
45421
45422
/* Searches table "sFlow" in 'idl' for a row with UUID 'uuid'.  Returns
45423
 * a pointer to the row if there is one, otherwise a null pointer.  */
45424
const struct ovsrec_sflow *
45425
ovsrec_sflow_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
45426
0
{
45427
0
    return ovsrec_sflow_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_sflow, uuid));
45428
0
}
45429
45430
/* Searches table "sFlow" for a row with UUID 'uuid'.  Returns
45431
 * a pointer to the row if there is one, otherwise a null pointer.  */
45432
const struct ovsrec_sflow *
45433
ovsrec_sflow_table_get_for_uuid(const struct ovsrec_sflow_table *table, const struct uuid *uuid)
45434
0
{
45435
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
45436
0
    return ovsrec_sflow_get_for_uuid(idl, uuid);
45437
0
}
45438
45439
/* Returns a row in table "sFlow" in 'idl', or a null pointer if that
45440
 * table is empty.
45441
 *
45442
 * Database tables are internally maintained as hash tables, so adding or
45443
 * removing rows while traversing the same table can cause some rows to be
45444
 * visited twice or not at apply. */
45445
const struct ovsrec_sflow *
45446
ovsrec_sflow_first(const struct ovsdb_idl *idl)
45447
0
{
45448
0
    return ovsrec_sflow_cast(ovsdb_idl_first_row(idl, &ovsrec_table_sflow));
45449
0
}
45450
45451
/* Returns a row following 'row' within its table, or a null pointer if 'row'
45452
 * is the last row in its table. */
45453
const struct ovsrec_sflow *
45454
ovsrec_sflow_next(const struct ovsrec_sflow *row)
45455
0
{
45456
0
    return ovsrec_sflow_cast(ovsdb_idl_next_row(&row->header_));
45457
0
}
45458
45459
unsigned int ovsrec_sflow_get_seqno(const struct ovsdb_idl *idl)
45460
0
{
45461
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_sflow);
45462
0
}
45463
45464
unsigned int ovsrec_sflow_row_get_seqno(const struct ovsrec_sflow *row, enum ovsdb_idl_change change)
45465
0
{
45466
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
45467
0
}
45468
45469
const struct ovsrec_sflow *
45470
ovsrec_sflow_track_get_first(const struct ovsdb_idl *idl)
45471
0
{
45472
0
    return ovsrec_sflow_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_sflow));
45473
0
}
45474
45475
const struct ovsrec_sflow
45476
*ovsrec_sflow_track_get_next(const struct ovsrec_sflow *row)
45477
0
{
45478
0
    return ovsrec_sflow_cast(ovsdb_idl_track_get_next(&row->header_));
45479
0
}
45480
45481
45482
/* Deletes 'row' from table "sFlow".  'row' may be freed, so it must not be
45483
 * accessed afterward.
45484
 *
45485
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
45486
void
45487
ovsrec_sflow_delete(const struct ovsrec_sflow *row)
45488
0
{
45489
0
    ovsdb_idl_txn_delete(&row->header_);
45490
0
}
45491
45492
/* Inserts and returns a new row in the table "sFlow" in the database
45493
 * with open transaction 'txn'.
45494
 *
45495
 * The new row is assigned a randomly generated provisional UUID.
45496
 * ovsdb-server will assign a different UUID when 'txn' is committed,
45497
 * but the IDL will replace any uses of the provisional UUID in the
45498
 * data to be to be committed by the UUID assigned by ovsdb-server. */
45499
struct ovsrec_sflow *
45500
ovsrec_sflow_insert(struct ovsdb_idl_txn *txn)
45501
0
{
45502
0
    return ovsrec_sflow_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_sflow, NULL));
45503
0
}
45504
45505
/* Inserts and returns a new row in the table "sFlow" in the database
45506
 * with open transaction 'txn'.
45507
 *
45508
 * The new row is assigned the UUID specified in the 'uuid' parameter
45509
 * (which cannot be null).  ovsdb-server will try to assign the same
45510
 * UUID when 'txn' is committed. */
45511
struct ovsrec_sflow *
45512
ovsrec_sflow_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
45513
0
{
45514
0
    return ovsrec_sflow_cast(ovsdb_idl_txn_insert_persist_uuid(
45515
0
        txn, &ovsrec_table_sflow, uuid));
45516
0
}
45517
45518
bool
45519
ovsrec_sflow_is_updated(const struct ovsrec_sflow *row, enum ovsrec_sflow_column_id column)
45520
0
{
45521
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_sflow_columns[column]);
45522
0
}
45523
45524
/* Causes the original contents of column "agent" in 'row' to be
45525
 * verified as a prerequisite to completing the transaction.  That is, if
45526
 * "agent" in 'row' changed (or if 'row' was deleted) between the
45527
 * time that the IDL originally read its contents and the time that the
45528
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
45529
 *
45530
 * The intention is that, to ensure that no transaction commits based on dirty
45531
 * reads, an application should call this function any time "agent" is
45532
 * read as part of a read-modify-write operation.
45533
 *
45534
 * In some cases this function reduces to a no-op, because the current value
45535
 * of "agent" is already known:
45536
 *
45537
 *   - If 'row' is a row created by the current transaction (returned by
45538
 *     ovsrec_sflow_insert()).
45539
 *
45540
 *   - If "agent" has already been modified (with
45541
 *     ovsrec_sflow_set_agent()) within the current transaction.
45542
 *
45543
 * Because of the latter property, always call this function *before*
45544
 * ovsrec_sflow_set_agent() for a given read-modify-write.
45545
 *
45546
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
45547
void
45548
ovsrec_sflow_verify_agent(const struct ovsrec_sflow *row)
45549
0
{
45550
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_agent);
45551
0
}
45552
45553
/* Causes the original contents of column "external_ids" in 'row' to be
45554
 * verified as a prerequisite to completing the transaction.  That is, if
45555
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
45556
 * time that the IDL originally read its contents and the time that the
45557
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
45558
 *
45559
 * The intention is that, to ensure that no transaction commits based on dirty
45560
 * reads, an application should call this function any time "external_ids" is
45561
 * read as part of a read-modify-write operation.
45562
 *
45563
 * In some cases this function reduces to a no-op, because the current value
45564
 * of "external_ids" is already known:
45565
 *
45566
 *   - If 'row' is a row created by the current transaction (returned by
45567
 *     ovsrec_sflow_insert()).
45568
 *
45569
 *   - If "external_ids" has already been modified (with
45570
 *     ovsrec_sflow_set_external_ids()) within the current transaction.
45571
 *
45572
 * Because of the latter property, always call this function *before*
45573
 * ovsrec_sflow_set_external_ids() for a given read-modify-write.
45574
 *
45575
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
45576
void
45577
ovsrec_sflow_verify_external_ids(const struct ovsrec_sflow *row)
45578
0
{
45579
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_external_ids);
45580
0
}
45581
45582
/* Causes the original contents of column "header" in 'row' to be
45583
 * verified as a prerequisite to completing the transaction.  That is, if
45584
 * "header" in 'row' changed (or if 'row' was deleted) between the
45585
 * time that the IDL originally read its contents and the time that the
45586
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
45587
 *
45588
 * The intention is that, to ensure that no transaction commits based on dirty
45589
 * reads, an application should call this function any time "header" is
45590
 * read as part of a read-modify-write operation.
45591
 *
45592
 * In some cases this function reduces to a no-op, because the current value
45593
 * of "header" is already known:
45594
 *
45595
 *   - If 'row' is a row created by the current transaction (returned by
45596
 *     ovsrec_sflow_insert()).
45597
 *
45598
 *   - If "header" has already been modified (with
45599
 *     ovsrec_sflow_set_header()) within the current transaction.
45600
 *
45601
 * Because of the latter property, always call this function *before*
45602
 * ovsrec_sflow_set_header() for a given read-modify-write.
45603
 *
45604
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
45605
void
45606
ovsrec_sflow_verify_header(const struct ovsrec_sflow *row)
45607
0
{
45608
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_header);
45609
0
}
45610
45611
/* Causes the original contents of column "polling" in 'row' to be
45612
 * verified as a prerequisite to completing the transaction.  That is, if
45613
 * "polling" in 'row' changed (or if 'row' was deleted) between the
45614
 * time that the IDL originally read its contents and the time that the
45615
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
45616
 *
45617
 * The intention is that, to ensure that no transaction commits based on dirty
45618
 * reads, an application should call this function any time "polling" is
45619
 * read as part of a read-modify-write operation.
45620
 *
45621
 * In some cases this function reduces to a no-op, because the current value
45622
 * of "polling" is already known:
45623
 *
45624
 *   - If 'row' is a row created by the current transaction (returned by
45625
 *     ovsrec_sflow_insert()).
45626
 *
45627
 *   - If "polling" has already been modified (with
45628
 *     ovsrec_sflow_set_polling()) within the current transaction.
45629
 *
45630
 * Because of the latter property, always call this function *before*
45631
 * ovsrec_sflow_set_polling() for a given read-modify-write.
45632
 *
45633
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
45634
void
45635
ovsrec_sflow_verify_polling(const struct ovsrec_sflow *row)
45636
0
{
45637
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_polling);
45638
0
}
45639
45640
/* Causes the original contents of column "sampling" in 'row' to be
45641
 * verified as a prerequisite to completing the transaction.  That is, if
45642
 * "sampling" in 'row' changed (or if 'row' was deleted) between the
45643
 * time that the IDL originally read its contents and the time that the
45644
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
45645
 *
45646
 * The intention is that, to ensure that no transaction commits based on dirty
45647
 * reads, an application should call this function any time "sampling" is
45648
 * read as part of a read-modify-write operation.
45649
 *
45650
 * In some cases this function reduces to a no-op, because the current value
45651
 * of "sampling" is already known:
45652
 *
45653
 *   - If 'row' is a row created by the current transaction (returned by
45654
 *     ovsrec_sflow_insert()).
45655
 *
45656
 *   - If "sampling" has already been modified (with
45657
 *     ovsrec_sflow_set_sampling()) within the current transaction.
45658
 *
45659
 * Because of the latter property, always call this function *before*
45660
 * ovsrec_sflow_set_sampling() for a given read-modify-write.
45661
 *
45662
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
45663
void
45664
ovsrec_sflow_verify_sampling(const struct ovsrec_sflow *row)
45665
0
{
45666
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_sampling);
45667
0
}
45668
45669
/* Causes the original contents of column "targets" in 'row' to be
45670
 * verified as a prerequisite to completing the transaction.  That is, if
45671
 * "targets" in 'row' changed (or if 'row' was deleted) between the
45672
 * time that the IDL originally read its contents and the time that the
45673
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
45674
 *
45675
 * The intention is that, to ensure that no transaction commits based on dirty
45676
 * reads, an application should call this function any time "targets" is
45677
 * read as part of a read-modify-write operation.
45678
 *
45679
 * In some cases this function reduces to a no-op, because the current value
45680
 * of "targets" is already known:
45681
 *
45682
 *   - If 'row' is a row created by the current transaction (returned by
45683
 *     ovsrec_sflow_insert()).
45684
 *
45685
 *   - If "targets" has already been modified (with
45686
 *     ovsrec_sflow_set_targets()) within the current transaction.
45687
 *
45688
 * Because of the latter property, always call this function *before*
45689
 * ovsrec_sflow_set_targets() for a given read-modify-write.
45690
 *
45691
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
45692
void
45693
ovsrec_sflow_verify_targets(const struct ovsrec_sflow *row)
45694
0
{
45695
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_targets);
45696
0
}
45697
45698
/* Returns the "agent" column's value from the "sFlow" table in 'row'
45699
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
45700
 * ovsdb_datum_find_key() is an easier and more efficient way to search
45701
 * for a given key than implementing the same operation on the "cooked"
45702
 * form in 'row'.
45703
 *
45704
 * 'key_type' must be OVSDB_TYPE_STRING.
45705
 * (This helps to avoid silent bugs if someone changes agent's
45706
 * type without updating the caller.)
45707
 *
45708
 * The caller must not modify or free the returned value.
45709
 *
45710
 * Various kinds of changes can invalidate the returned value: modifying
45711
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
45712
 * If the returned value is needed for a long time, it is best to make a copy
45713
 * of it with ovsdb_datum_clone().
45714
 *
45715
 * This function is rarely useful, since it is easier to access the value
45716
 * directly through the "agent" member in ovsrec_sflow. */
45717
const struct ovsdb_datum *
45718
ovsrec_sflow_get_agent(const struct ovsrec_sflow *row,
45719
  enum ovsdb_atomic_type key_type OVS_UNUSED)
45720
0
{
45721
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
45722
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_agent);
45723
0
}
45724
45725
/* Returns the "external_ids" column's value from the "sFlow" table in 'row'
45726
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
45727
 * ovsdb_datum_find_key() is an easier and more efficient way to search
45728
 * for a given key than implementing the same operation on the "cooked"
45729
 * form in 'row'.
45730
 *
45731
 * 'key_type' must be OVSDB_TYPE_STRING.
45732
 * 'value_type' must be OVSDB_TYPE_STRING.
45733
 * (This helps to avoid silent bugs if someone changes external_ids's
45734
 * type without updating the caller.)
45735
 *
45736
 * The caller must not modify or free the returned value.
45737
 *
45738
 * Various kinds of changes can invalidate the returned value: modifying
45739
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
45740
 * If the returned value is needed for a long time, it is best to make a copy
45741
 * of it with ovsdb_datum_clone().
45742
 *
45743
 * This function is rarely useful, since it is easier to access the value
45744
 * directly through the "external_ids" member in ovsrec_sflow. */
45745
const struct ovsdb_datum *
45746
ovsrec_sflow_get_external_ids(const struct ovsrec_sflow *row,
45747
  enum ovsdb_atomic_type key_type OVS_UNUSED,
45748
  enum ovsdb_atomic_type value_type OVS_UNUSED)
45749
0
{
45750
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
45751
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
45752
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_external_ids);
45753
0
}
45754
45755
/* Returns the "header" column's value from the "sFlow" table in 'row'
45756
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
45757
 * ovsdb_datum_find_key() is an easier and more efficient way to search
45758
 * for a given key than implementing the same operation on the "cooked"
45759
 * form in 'row'.
45760
 *
45761
 * 'key_type' must be OVSDB_TYPE_INTEGER.
45762
 * (This helps to avoid silent bugs if someone changes header's
45763
 * type without updating the caller.)
45764
 *
45765
 * The caller must not modify or free the returned value.
45766
 *
45767
 * Various kinds of changes can invalidate the returned value: modifying
45768
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
45769
 * If the returned value is needed for a long time, it is best to make a copy
45770
 * of it with ovsdb_datum_clone().
45771
 *
45772
 * This function is rarely useful, since it is easier to access the value
45773
 * directly through the "header" member in ovsrec_sflow. */
45774
const struct ovsdb_datum *
45775
ovsrec_sflow_get_header(const struct ovsrec_sflow *row,
45776
  enum ovsdb_atomic_type key_type OVS_UNUSED)
45777
0
{
45778
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
45779
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_header);
45780
0
}
45781
45782
/* Returns the "polling" column's value from the "sFlow" table in 'row'
45783
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
45784
 * ovsdb_datum_find_key() is an easier and more efficient way to search
45785
 * for a given key than implementing the same operation on the "cooked"
45786
 * form in 'row'.
45787
 *
45788
 * 'key_type' must be OVSDB_TYPE_INTEGER.
45789
 * (This helps to avoid silent bugs if someone changes polling's
45790
 * type without updating the caller.)
45791
 *
45792
 * The caller must not modify or free the returned value.
45793
 *
45794
 * Various kinds of changes can invalidate the returned value: modifying
45795
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
45796
 * If the returned value is needed for a long time, it is best to make a copy
45797
 * of it with ovsdb_datum_clone().
45798
 *
45799
 * This function is rarely useful, since it is easier to access the value
45800
 * directly through the "polling" member in ovsrec_sflow. */
45801
const struct ovsdb_datum *
45802
ovsrec_sflow_get_polling(const struct ovsrec_sflow *row,
45803
  enum ovsdb_atomic_type key_type OVS_UNUSED)
45804
0
{
45805
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
45806
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_polling);
45807
0
}
45808
45809
/* Returns the "sampling" column's value from the "sFlow" table in 'row'
45810
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
45811
 * ovsdb_datum_find_key() is an easier and more efficient way to search
45812
 * for a given key than implementing the same operation on the "cooked"
45813
 * form in 'row'.
45814
 *
45815
 * 'key_type' must be OVSDB_TYPE_INTEGER.
45816
 * (This helps to avoid silent bugs if someone changes sampling's
45817
 * type without updating the caller.)
45818
 *
45819
 * The caller must not modify or free the returned value.
45820
 *
45821
 * Various kinds of changes can invalidate the returned value: modifying
45822
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
45823
 * If the returned value is needed for a long time, it is best to make a copy
45824
 * of it with ovsdb_datum_clone().
45825
 *
45826
 * This function is rarely useful, since it is easier to access the value
45827
 * directly through the "sampling" member in ovsrec_sflow. */
45828
const struct ovsdb_datum *
45829
ovsrec_sflow_get_sampling(const struct ovsrec_sflow *row,
45830
  enum ovsdb_atomic_type key_type OVS_UNUSED)
45831
0
{
45832
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
45833
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_sampling);
45834
0
}
45835
45836
/* Returns the "targets" column's value from the "sFlow" table in 'row'
45837
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
45838
 * ovsdb_datum_find_key() is an easier and more efficient way to search
45839
 * for a given key than implementing the same operation on the "cooked"
45840
 * form in 'row'.
45841
 *
45842
 * 'key_type' must be OVSDB_TYPE_STRING.
45843
 * (This helps to avoid silent bugs if someone changes targets's
45844
 * type without updating the caller.)
45845
 *
45846
 * The caller must not modify or free the returned value.
45847
 *
45848
 * Various kinds of changes can invalidate the returned value: modifying
45849
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
45850
 * If the returned value is needed for a long time, it is best to make a copy
45851
 * of it with ovsdb_datum_clone().
45852
 *
45853
 * This function is rarely useful, since it is easier to access the value
45854
 * directly through the "targets" member in ovsrec_sflow. */
45855
const struct ovsdb_datum *
45856
ovsrec_sflow_get_targets(const struct ovsrec_sflow *row,
45857
  enum ovsdb_atomic_type key_type OVS_UNUSED)
45858
0
{
45859
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
45860
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_targets);
45861
0
}
45862
45863
/* Sets the "agent" column from the "sFlow" table in 'row' to
45864
 * the 'agent' set.
45865
 *
45866
 * If "agent" is null, the column will be the empty set,
45867
 * otherwise it will contain the specified value.
45868
 *
45869
 * The caller retains ownership of the arguments. */
45870
void
45871
ovsrec_sflow_set_agent(const struct ovsrec_sflow *row, const char *agent)
45872
0
{
45873
0
    struct ovsdb_datum datum;
45874
45875
0
    datum.refcnt = NULL;
45876
45877
0
    if (agent) {
45878
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
45879
0
        datum.n = 1;
45880
0
        datum.keys = key;
45881
0
        key->s = ovsdb_atom_string_create(agent);
45882
0
    } else {
45883
0
        datum.n = 0;
45884
0
        datum.keys = NULL;
45885
0
    }
45886
0
    datum.values = NULL;
45887
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_col_agent, &datum);
45888
0
}
45889
45890
/* Sets the "external_ids" column's value from the "sFlow" table in 'row'
45891
 * to 'external_ids'.
45892
 *
45893
 * The caller retains ownership of 'external_ids' and everything in it. */
45894
void
45895
ovsrec_sflow_set_external_ids(const struct ovsrec_sflow *row, const struct smap *external_ids)
45896
0
{
45897
0
    struct ovsdb_datum datum;
45898
45899
0
    if (external_ids) {
45900
0
        ovsdb_datum_from_smap(&datum, external_ids);
45901
0
    } else {
45902
0
        ovsdb_datum_init_empty(&datum);
45903
0
    }
45904
0
    ovsdb_idl_txn_write(&row->header_,
45905
0
                        &ovsrec_sflow_col_external_ids,
45906
0
                        &datum);
45907
0
}
45908
45909
45910
/* Sets the "header" column from the "sFlow" table in 'row' to
45911
 * the 'header' set with 'n_header' entries.
45912
 *
45913
 * 'n_header' may be 0 or 1; if it is 0, then 'header'
45914
 * may be NULL.
45915
 *
45916
 * The caller retains ownership of the arguments. */
45917
void
45918
ovsrec_sflow_set_header(const struct ovsrec_sflow *row, const int64_t *header, size_t n_header)
45919
0
{
45920
0
    struct ovsdb_datum datum;
45921
45922
0
    datum.refcnt = NULL;
45923
45924
0
    if (n_header) {
45925
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
45926
0
        datum.n = 1;
45927
0
        datum.keys = key;
45928
0
        key->integer = *header;
45929
0
    } else {
45930
0
        datum.n = 0;
45931
0
        datum.keys = NULL;
45932
0
    }
45933
0
    datum.values = NULL;
45934
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_col_header, &datum);
45935
0
}
45936
45937
/* Sets the "polling" column from the "sFlow" table in 'row' to
45938
 * the 'polling' set with 'n_polling' entries.
45939
 *
45940
 * 'n_polling' may be 0 or 1; if it is 0, then 'polling'
45941
 * may be NULL.
45942
 *
45943
 * The caller retains ownership of the arguments. */
45944
void
45945
ovsrec_sflow_set_polling(const struct ovsrec_sflow *row, const int64_t *polling, size_t n_polling)
45946
0
{
45947
0
    struct ovsdb_datum datum;
45948
45949
0
    datum.refcnt = NULL;
45950
45951
0
    if (n_polling) {
45952
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
45953
0
        datum.n = 1;
45954
0
        datum.keys = key;
45955
0
        key->integer = *polling;
45956
0
    } else {
45957
0
        datum.n = 0;
45958
0
        datum.keys = NULL;
45959
0
    }
45960
0
    datum.values = NULL;
45961
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_col_polling, &datum);
45962
0
}
45963
45964
/* Sets the "sampling" column from the "sFlow" table in 'row' to
45965
 * the 'sampling' set with 'n_sampling' entries.
45966
 *
45967
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
45968
 * may be NULL.
45969
 *
45970
 * The caller retains ownership of the arguments. */
45971
void
45972
ovsrec_sflow_set_sampling(const struct ovsrec_sflow *row, const int64_t *sampling, size_t n_sampling)
45973
0
{
45974
0
    struct ovsdb_datum datum;
45975
45976
0
    datum.refcnt = NULL;
45977
45978
0
    if (n_sampling) {
45979
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
45980
0
        datum.n = 1;
45981
0
        datum.keys = key;
45982
0
        key->integer = *sampling;
45983
0
    } else {
45984
0
        datum.n = 0;
45985
0
        datum.keys = NULL;
45986
0
    }
45987
0
    datum.values = NULL;
45988
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_col_sampling, &datum);
45989
0
}
45990
45991
/* Sets the "targets" column from the "sFlow" table in 'row' to
45992
 * the 'targets' set with 'n_targets' entries.
45993
 *
45994
 * The caller retains ownership of the arguments. */
45995
void
45996
ovsrec_sflow_set_targets(const struct ovsrec_sflow *row, const char **targets, size_t n_targets)
45997
0
{
45998
0
    struct ovsdb_datum datum;
45999
46000
0
    datum.refcnt = NULL;
46001
46002
0
    datum.n = n_targets;
46003
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
46004
0
    datum.values = NULL;
46005
0
    for (size_t i = 0; i < n_targets; i++) {
46006
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
46007
0
    }
46008
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_col_targets, &datum);
46009
0
}
46010
46011
/* Adds the value 'new_value' to the "agent" set column from the "sFlow" table
46012
 * in 'row'.
46013
 *
46014
 */
46015
void
46016
ovsrec_sflow_update_agent_addvalue(const struct ovsrec_sflow *row, const char *new_value)
46017
0
{
46018
0
    struct ovsdb_datum *datum;
46019
46020
0
    datum = xmalloc(sizeof *datum);
46021
0
    datum->n = 1;
46022
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
46023
0
    datum->values = NULL;
46024
0
    datum->refcnt = NULL;
46025
46026
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
46027
46028
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
46029
0
                                    &ovsrec_sflow_col_agent,
46030
0
                                    datum);
46031
0
}
46032
46033
/* Deletes the value 'delete_value' from the "agent" set column from the
46034
 * "sFlow" table in 'row'.
46035
 *
46036
 */
46037
void
46038
ovsrec_sflow_update_agent_delvalue(const struct ovsrec_sflow *row, const char *delete_value)
46039
0
{
46040
0
    struct ovsdb_datum *datum;
46041
46042
0
    datum = xmalloc(sizeof *datum);
46043
0
    datum->n = 1;
46044
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
46045
0
    datum->values = NULL;
46046
0
    datum->refcnt = NULL;
46047
46048
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
46049
46050
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
46051
0
                                    &ovsrec_sflow_col_agent,
46052
0
                                    datum);
46053
0
}
46054
46055
/* Sets an element of the "external_ids" map column from the "sFlow" table in 'row'
46056
 * to 'new_value' given the key value 'new_key'.
46057
 *
46058
 */
46059
void
46060
ovsrec_sflow_update_external_ids_setkey(const struct ovsrec_sflow *row, const char *new_key, const char *new_value)
46061
0
{
46062
0
    struct ovsdb_datum *datum;
46063
46064
0
    datum = xmalloc(sizeof *datum);
46065
0
    datum->n = 1;
46066
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
46067
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
46068
0
    datum->refcnt = NULL;
46069
46070
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
46071
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
46072
46073
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
46074
0
                                    &ovsrec_sflow_col_external_ids,
46075
0
                                    datum);
46076
0
}
46077
46078
/* Deletes an element of the "external_ids" map column from the "sFlow" table in 'row'
46079
 * given the key value 'delete_key'.
46080
 *
46081
 */
46082
void
46083
ovsrec_sflow_update_external_ids_delkey(const struct ovsrec_sflow *row, const char *delete_key)
46084
0
{
46085
0
    struct ovsdb_datum *datum;
46086
46087
0
    datum = xmalloc(sizeof *datum);
46088
0
    datum->n = 1;
46089
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
46090
0
    datum->values = NULL;
46091
0
    datum->refcnt = NULL;
46092
46093
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
46094
46095
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
46096
0
                                    &ovsrec_sflow_col_external_ids,
46097
0
                                    datum);
46098
0
}
46099
46100
/* Adds the value 'new_value' to the "header" set column from the "sFlow" table
46101
 * in 'row'.
46102
 *
46103
 */
46104
void
46105
ovsrec_sflow_update_header_addvalue(const struct ovsrec_sflow *row, int64_t new_value)
46106
0
{
46107
0
    struct ovsdb_datum *datum;
46108
46109
0
    datum = xmalloc(sizeof *datum);
46110
0
    datum->n = 1;
46111
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
46112
0
    datum->values = NULL;
46113
0
    datum->refcnt = NULL;
46114
46115
0
    datum->keys[0].integer = new_value;
46116
46117
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
46118
0
                                    &ovsrec_sflow_col_header,
46119
0
                                    datum);
46120
0
}
46121
46122
/* Deletes the value 'delete_value' from the "header" set column from the
46123
 * "sFlow" table in 'row'.
46124
 *
46125
 */
46126
void
46127
ovsrec_sflow_update_header_delvalue(const struct ovsrec_sflow *row, int64_t delete_value)
46128
0
{
46129
0
    struct ovsdb_datum *datum;
46130
46131
0
    datum = xmalloc(sizeof *datum);
46132
0
    datum->n = 1;
46133
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
46134
0
    datum->values = NULL;
46135
0
    datum->refcnt = NULL;
46136
46137
0
    datum->keys[0].integer = delete_value;
46138
46139
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
46140
0
                                    &ovsrec_sflow_col_header,
46141
0
                                    datum);
46142
0
}
46143
46144
/* Adds the value 'new_value' to the "polling" set column from the "sFlow" table
46145
 * in 'row'.
46146
 *
46147
 */
46148
void
46149
ovsrec_sflow_update_polling_addvalue(const struct ovsrec_sflow *row, int64_t new_value)
46150
0
{
46151
0
    struct ovsdb_datum *datum;
46152
46153
0
    datum = xmalloc(sizeof *datum);
46154
0
    datum->n = 1;
46155
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
46156
0
    datum->values = NULL;
46157
0
    datum->refcnt = NULL;
46158
46159
0
    datum->keys[0].integer = new_value;
46160
46161
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
46162
0
                                    &ovsrec_sflow_col_polling,
46163
0
                                    datum);
46164
0
}
46165
46166
/* Deletes the value 'delete_value' from the "polling" set column from the
46167
 * "sFlow" table in 'row'.
46168
 *
46169
 */
46170
void
46171
ovsrec_sflow_update_polling_delvalue(const struct ovsrec_sflow *row, int64_t delete_value)
46172
0
{
46173
0
    struct ovsdb_datum *datum;
46174
46175
0
    datum = xmalloc(sizeof *datum);
46176
0
    datum->n = 1;
46177
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
46178
0
    datum->values = NULL;
46179
0
    datum->refcnt = NULL;
46180
46181
0
    datum->keys[0].integer = delete_value;
46182
46183
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
46184
0
                                    &ovsrec_sflow_col_polling,
46185
0
                                    datum);
46186
0
}
46187
46188
/* Adds the value 'new_value' to the "sampling" set column from the "sFlow" table
46189
 * in 'row'.
46190
 *
46191
 */
46192
void
46193
ovsrec_sflow_update_sampling_addvalue(const struct ovsrec_sflow *row, int64_t new_value)
46194
0
{
46195
0
    struct ovsdb_datum *datum;
46196
46197
0
    datum = xmalloc(sizeof *datum);
46198
0
    datum->n = 1;
46199
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
46200
0
    datum->values = NULL;
46201
0
    datum->refcnt = NULL;
46202
46203
0
    datum->keys[0].integer = new_value;
46204
46205
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
46206
0
                                    &ovsrec_sflow_col_sampling,
46207
0
                                    datum);
46208
0
}
46209
46210
/* Deletes the value 'delete_value' from the "sampling" set column from the
46211
 * "sFlow" table in 'row'.
46212
 *
46213
 */
46214
void
46215
ovsrec_sflow_update_sampling_delvalue(const struct ovsrec_sflow *row, int64_t delete_value)
46216
0
{
46217
0
    struct ovsdb_datum *datum;
46218
46219
0
    datum = xmalloc(sizeof *datum);
46220
0
    datum->n = 1;
46221
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
46222
0
    datum->values = NULL;
46223
0
    datum->refcnt = NULL;
46224
46225
0
    datum->keys[0].integer = delete_value;
46226
46227
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
46228
0
                                    &ovsrec_sflow_col_sampling,
46229
0
                                    datum);
46230
0
}
46231
46232
/* Adds the value 'new_value' to the "targets" set column from the "sFlow" table
46233
 * in 'row'.
46234
 *
46235
 */
46236
void
46237
ovsrec_sflow_update_targets_addvalue(const struct ovsrec_sflow *row, const char *new_value)
46238
0
{
46239
0
    struct ovsdb_datum *datum;
46240
46241
0
    datum = xmalloc(sizeof *datum);
46242
0
    datum->n = 1;
46243
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
46244
0
    datum->values = NULL;
46245
0
    datum->refcnt = NULL;
46246
46247
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
46248
46249
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
46250
0
                                    &ovsrec_sflow_col_targets,
46251
0
                                    datum);
46252
0
}
46253
46254
/* Deletes the value 'delete_value' from the "targets" set column from the
46255
 * "sFlow" table in 'row'.
46256
 *
46257
 */
46258
void
46259
ovsrec_sflow_update_targets_delvalue(const struct ovsrec_sflow *row, const char *delete_value)
46260
0
{
46261
0
    struct ovsdb_datum *datum;
46262
46263
0
    datum = xmalloc(sizeof *datum);
46264
0
    datum->n = 1;
46265
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
46266
0
    datum->values = NULL;
46267
0
    datum->refcnt = NULL;
46268
46269
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
46270
46271
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
46272
0
                                    &ovsrec_sflow_col_targets,
46273
0
                                    datum);
46274
0
}
46275
46276
/* Sets the "agent" column from the "sFlow" table in 'row' to
46277
 * the 'agent' set.
46278
 *
46279
 * If "agent" is null, the column will be the empty set,
46280
 * otherwise it will contain the specified value.
46281
 *
46282
 * The caller retains ownership of the arguments. */
46283
void
46284
ovsrec_sflow_add_clause_agent(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *agent)
46285
0
{
46286
0
    struct ovsdb_datum datum;
46287
46288
0
    datum.refcnt = NULL;
46289
46290
0
    if (agent) {
46291
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
46292
0
        datum.n = 1;
46293
0
        datum.keys = key;
46294
0
        key->s = ovsdb_atom_string_create(agent);
46295
0
    } else {
46296
0
        datum.n = 0;
46297
0
        datum.keys = NULL;
46298
0
    }
46299
0
    datum.values = NULL;
46300
0
    ovsdb_idl_condition_add_clause(cond,
46301
0
                          function,
46302
0
                          &ovsrec_sflow_col_agent,
46303
0
                          &datum);
46304
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_agent.type);
46305
0
}
46306
46307
/* Sets the "external_ids" column's value from the "sFlow" table in 'row'
46308
 * to 'external_ids'.
46309
 *
46310
 * The caller retains ownership of 'external_ids' and everything in it. */
46311
void
46312
ovsrec_sflow_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
46313
0
{
46314
0
    struct ovsdb_datum datum;
46315
46316
0
    if (external_ids) {
46317
0
        ovsdb_datum_from_smap(&datum, external_ids);
46318
0
    } else {
46319
0
        ovsdb_datum_init_empty(&datum);
46320
0
    }
46321
46322
0
    ovsdb_idl_condition_add_clause(cond,
46323
0
                                   function,
46324
0
                                   &ovsrec_sflow_col_external_ids,
46325
0
                                   &datum);
46326
46327
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_external_ids.type);
46328
0
}
46329
46330
46331
/* Sets the "header" column from the "sFlow" table in 'row' to
46332
 * the 'header' set with 'n_header' entries.
46333
 *
46334
 * 'n_header' may be 0 or 1; if it is 0, then 'header'
46335
 * may be NULL.
46336
 *
46337
 * The caller retains ownership of the arguments. */
46338
void
46339
ovsrec_sflow_add_clause_header(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *header, size_t n_header)
46340
0
{
46341
0
    struct ovsdb_datum datum;
46342
46343
0
    datum.refcnt = NULL;
46344
46345
0
    if (n_header) {
46346
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
46347
0
        datum.n = 1;
46348
0
        datum.keys = key;
46349
0
        key->integer = *header;
46350
0
    } else {
46351
0
        datum.n = 0;
46352
0
        datum.keys = NULL;
46353
0
    }
46354
0
    datum.values = NULL;
46355
0
    ovsdb_idl_condition_add_clause(cond,
46356
0
                          function,
46357
0
                          &ovsrec_sflow_col_header,
46358
0
                          &datum);
46359
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_header.type);
46360
0
}
46361
46362
/* Sets the "polling" column from the "sFlow" table in 'row' to
46363
 * the 'polling' set with 'n_polling' entries.
46364
 *
46365
 * 'n_polling' may be 0 or 1; if it is 0, then 'polling'
46366
 * may be NULL.
46367
 *
46368
 * The caller retains ownership of the arguments. */
46369
void
46370
ovsrec_sflow_add_clause_polling(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *polling, size_t n_polling)
46371
0
{
46372
0
    struct ovsdb_datum datum;
46373
46374
0
    datum.refcnt = NULL;
46375
46376
0
    if (n_polling) {
46377
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
46378
0
        datum.n = 1;
46379
0
        datum.keys = key;
46380
0
        key->integer = *polling;
46381
0
    } else {
46382
0
        datum.n = 0;
46383
0
        datum.keys = NULL;
46384
0
    }
46385
0
    datum.values = NULL;
46386
0
    ovsdb_idl_condition_add_clause(cond,
46387
0
                          function,
46388
0
                          &ovsrec_sflow_col_polling,
46389
0
                          &datum);
46390
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_polling.type);
46391
0
}
46392
46393
/* Sets the "sampling" column from the "sFlow" table in 'row' to
46394
 * the 'sampling' set with 'n_sampling' entries.
46395
 *
46396
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
46397
 * may be NULL.
46398
 *
46399
 * The caller retains ownership of the arguments. */
46400
void
46401
ovsrec_sflow_add_clause_sampling(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *sampling, size_t n_sampling)
46402
0
{
46403
0
    struct ovsdb_datum datum;
46404
46405
0
    datum.refcnt = NULL;
46406
46407
0
    if (n_sampling) {
46408
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
46409
0
        datum.n = 1;
46410
0
        datum.keys = key;
46411
0
        key->integer = *sampling;
46412
0
    } else {
46413
0
        datum.n = 0;
46414
0
        datum.keys = NULL;
46415
0
    }
46416
0
    datum.values = NULL;
46417
0
    ovsdb_idl_condition_add_clause(cond,
46418
0
                          function,
46419
0
                          &ovsrec_sflow_col_sampling,
46420
0
                          &datum);
46421
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_sampling.type);
46422
0
}
46423
46424
/* Sets the "targets" column from the "sFlow" table in 'row' to
46425
 * the 'targets' set with 'n_targets' entries.
46426
 *
46427
 * The caller retains ownership of the arguments. */
46428
void
46429
ovsrec_sflow_add_clause_targets(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **targets, size_t n_targets)
46430
0
{
46431
0
    struct ovsdb_datum datum;
46432
46433
0
    datum.refcnt = NULL;
46434
0
    datum.n = n_targets;
46435
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
46436
0
    datum.values = NULL;
46437
0
    for (size_t i = 0; i < n_targets; i++) {
46438
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
46439
0
    }
46440
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_sflow_col_targets.type);
46441
0
    ovsdb_idl_condition_add_clause(cond,
46442
0
                          function,
46443
0
                          &ovsrec_sflow_col_targets,
46444
0
                          &datum);
46445
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_targets.type);
46446
0
}
46447
46448
/* Destroy 'row' of kind "sFlow". The row must have been
46449
 * created with ovsdb_idl_index_init_row.
46450
 */
46451
void
46452
ovsrec_sflow_index_destroy_row(const struct ovsrec_sflow *row)
46453
0
{
46454
0
    ovsdb_idl_index_destroy_row(&row->header_);
46455
0
}
46456
        
46457
46458
/* Creates a new row of kind "sFlow". */
46459
struct ovsrec_sflow *
46460
ovsrec_sflow_index_init_row(struct ovsdb_idl_index *index)
46461
0
{
46462
0
    ovs_assert(index->table->class_ == &ovsrec_table_sflow);
46463
0
    return ALIGNED_CAST(struct ovsrec_sflow *, ovsdb_idl_index_init_row(index));
46464
0
}
46465
46466
struct ovsrec_sflow *
46467
ovsrec_sflow_index_find(struct ovsdb_idl_index *index, const struct ovsrec_sflow *target)
46468
0
{
46469
0
    ovs_assert(index->table->class_ == &ovsrec_table_sflow);
46470
0
    return ovsrec_sflow_cast(ovsdb_idl_index_find(index, &target->header_));
46471
0
}
46472
46473
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
46474
int
46475
ovsrec_sflow_index_compare(
46476
    struct ovsdb_idl_index *index, 
46477
    const struct ovsrec_sflow *a, 
46478
    const struct ovsrec_sflow *b)
46479
0
{
46480
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
46481
0
}
46482
46483
struct ovsdb_idl_cursor
46484
ovsrec_sflow_cursor_first(struct ovsdb_idl_index *index)
46485
0
{
46486
0
    ovs_assert(index->table->class_ == &ovsrec_table_sflow);
46487
0
    return ovsdb_idl_cursor_first(index);
46488
0
}
46489
46490
struct ovsdb_idl_cursor
46491
ovsrec_sflow_cursor_first_eq(
46492
    struct ovsdb_idl_index *index, const struct ovsrec_sflow *target)
46493
0
{
46494
0
    ovs_assert(index->table->class_ == &ovsrec_table_sflow);
46495
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
46496
0
}
46497
46498
struct ovsdb_idl_cursor
46499
ovsrec_sflow_cursor_first_ge(
46500
    struct ovsdb_idl_index *index, const struct ovsrec_sflow *target)
46501
0
{
46502
0
    ovs_assert(index->table->class_ == &ovsrec_table_sflow);
46503
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
46504
0
}
46505
46506
struct ovsrec_sflow *
46507
ovsrec_sflow_cursor_data(struct ovsdb_idl_cursor *cursor)
46508
0
{
46509
0
    return ovsrec_sflow_cast(ovsdb_idl_cursor_data(cursor));
46510
0
}
46511
46512
46513
/* Sets the "agent" column from the "sFlow" table in 'row' to
46514
 * the 'agent' set.
46515
 *
46516
 * If "agent" is null, the column will be the empty set,
46517
 * otherwise it will contain the specified value.
46518
 *
46519
 * The caller retains ownership of the arguments. */
46520
void
46521
ovsrec_sflow_index_set_agent(const struct ovsrec_sflow *row, const char *agent)
46522
0
{
46523
0
    struct ovsdb_datum datum;
46524
46525
0
    datum.refcnt = NULL;
46526
0
    union ovsdb_atom *key;
46527
46528
0
    if (agent) {
46529
0
        key = xmalloc(sizeof (union ovsdb_atom));
46530
0
        datum.n = 1;
46531
0
        datum.keys = key;
46532
0
        key->s = ovsdb_atom_string_create(agent);
46533
0
    } else {
46534
0
        datum.n = 0;
46535
0
        datum.keys = NULL;
46536
0
    }
46537
0
    datum.values = NULL;
46538
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_sflow_columns[ OVSREC_SFLOW_COL_AGENT ], &datum, &ovsrec_table_classes[OVSREC_TABLE_SFLOW]);
46539
0
}
46540
46541
/* Sets the "external_ids" column's value from the "sFlow" table in 'row'
46542
 * to 'external_ids'.
46543
 *
46544
 * The caller retains ownership of 'external_ids' and everything in it. */
46545
void
46546
ovsrec_sflow_index_set_external_ids(const struct ovsrec_sflow *row, const struct smap *external_ids)
46547
0
{
46548
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
46549
46550
0
    if (external_ids) {
46551
0
        struct smap_node *node;
46552
0
        size_t i;
46553
46554
0
        datum->n = smap_count(external_ids);
46555
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
46556
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
46557
0
        datum->refcnt = NULL;
46558
46559
0
        i = 0;
46560
0
        SMAP_FOR_EACH (node, external_ids) {
46561
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
46562
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
46563
0
            i++;
46564
0
        }
46565
0
        ovsdb_datum_sort_unique(datum, &ovsrec_sflow_col_external_ids.type);
46566
0
    } else {
46567
0
        ovsdb_datum_init_empty(datum);
46568
0
    }
46569
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
46570
0
                          &ovsrec_sflow_columns[OVSREC_SFLOW_COL_EXTERNAL_IDS],
46571
0
                          datum,
46572
0
                          &ovsrec_table_classes[OVSREC_TABLE_SFLOW]);
46573
0
    free(datum);
46574
0
}
46575
46576
46577
/* Sets the "header" column from the "sFlow" table in 'row' to
46578
 * the 'header' set with 'n_header' entries.
46579
 *
46580
 * 'n_header' may be 0 or 1; if it is 0, then 'header'
46581
 * may be NULL.
46582
 *
46583
 * The caller retains ownership of the arguments. */
46584
void
46585
ovsrec_sflow_index_set_header(const struct ovsrec_sflow *row, const int64_t *header, size_t n_header)
46586
0
{
46587
0
    struct ovsdb_datum datum;
46588
46589
0
    datum.refcnt = NULL;
46590
0
    union ovsdb_atom *key;
46591
46592
0
    if (n_header) {
46593
0
        key = xmalloc(sizeof(union ovsdb_atom));
46594
0
        datum.n = 1;
46595
0
        datum.keys = key;
46596
0
        key->integer = *header;
46597
0
    } else {
46598
0
        datum.n = 0;
46599
0
        datum.keys = NULL;
46600
0
    }
46601
0
    datum.values = NULL;
46602
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_sflow_columns[ OVSREC_SFLOW_COL_HEADER ], &datum, &ovsrec_table_classes[OVSREC_TABLE_SFLOW]);
46603
0
}
46604
46605
/* Sets the "polling" column from the "sFlow" table in 'row' to
46606
 * the 'polling' set with 'n_polling' entries.
46607
 *
46608
 * 'n_polling' may be 0 or 1; if it is 0, then 'polling'
46609
 * may be NULL.
46610
 *
46611
 * The caller retains ownership of the arguments. */
46612
void
46613
ovsrec_sflow_index_set_polling(const struct ovsrec_sflow *row, const int64_t *polling, size_t n_polling)
46614
0
{
46615
0
    struct ovsdb_datum datum;
46616
46617
0
    datum.refcnt = NULL;
46618
0
    union ovsdb_atom *key;
46619
46620
0
    if (n_polling) {
46621
0
        key = xmalloc(sizeof(union ovsdb_atom));
46622
0
        datum.n = 1;
46623
0
        datum.keys = key;
46624
0
        key->integer = *polling;
46625
0
    } else {
46626
0
        datum.n = 0;
46627
0
        datum.keys = NULL;
46628
0
    }
46629
0
    datum.values = NULL;
46630
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_sflow_columns[ OVSREC_SFLOW_COL_POLLING ], &datum, &ovsrec_table_classes[OVSREC_TABLE_SFLOW]);
46631
0
}
46632
46633
/* Sets the "sampling" column from the "sFlow" table in 'row' to
46634
 * the 'sampling' set with 'n_sampling' entries.
46635
 *
46636
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
46637
 * may be NULL.
46638
 *
46639
 * The caller retains ownership of the arguments. */
46640
void
46641
ovsrec_sflow_index_set_sampling(const struct ovsrec_sflow *row, const int64_t *sampling, size_t n_sampling)
46642
0
{
46643
0
    struct ovsdb_datum datum;
46644
46645
0
    datum.refcnt = NULL;
46646
0
    union ovsdb_atom *key;
46647
46648
0
    if (n_sampling) {
46649
0
        key = xmalloc(sizeof(union ovsdb_atom));
46650
0
        datum.n = 1;
46651
0
        datum.keys = key;
46652
0
        key->integer = *sampling;
46653
0
    } else {
46654
0
        datum.n = 0;
46655
0
        datum.keys = NULL;
46656
0
    }
46657
0
    datum.values = NULL;
46658
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_sflow_columns[ OVSREC_SFLOW_COL_SAMPLING ], &datum, &ovsrec_table_classes[OVSREC_TABLE_SFLOW]);
46659
0
}
46660
46661
/* Sets the "targets" column from the "sFlow" table in 'row' to
46662
 * the 'targets' set with 'n_targets' entries.
46663
 *
46664
 * The caller retains ownership of the arguments. */
46665
void
46666
ovsrec_sflow_index_set_targets(const struct ovsrec_sflow *row, const char **targets, size_t n_targets)
46667
0
{
46668
0
    struct ovsdb_datum datum;
46669
46670
0
    datum.refcnt = NULL;
46671
0
    size_t i;
46672
46673
0
    datum.n = n_targets;
46674
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
46675
0
    datum.values = NULL;
46676
0
    for (i = 0; i < n_targets; i++) {
46677
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
46678
0
    }
46679
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_sflow_col_targets.type);
46680
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_), &ovsrec_sflow_columns[ OVSREC_SFLOW_COL_TARGETS ], &datum, &ovsrec_table_classes[OVSREC_TABLE_SFLOW]);
46681
0
}
46682
46683
struct ovsdb_idl_column ovsrec_sflow_columns[OVSREC_SFLOW_N_COLUMNS];
46684
46685
unsigned int
46686
ovsrec_sflow_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
46687
0
{
46688
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_sflow, condition);
46689
0
}
46690
46691
struct ovsdb_idl_column ovsrec_sflow_columns[OVSREC_SFLOW_N_COLUMNS] = {
46692
    [OVSREC_SFLOW_COL_AGENT] = {
46693
         .name = "agent",
46694
         .type = {
46695
            .key = {
46696
               .type = OVSDB_TYPE_STRING,
46697
               .string = { .minLen = 0, .maxLen = UINT_MAX },
46698
            },
46699
            .value = OVSDB_BASE_VOID_INIT,
46700
            .n_min = 0,
46701
            .n_max = 1,
46702
         },
46703
         .is_mutable = true,
46704
         .is_synthetic = false,
46705
         .parse = ovsrec_sflow_parse_agent,
46706
         .unparse = ovsrec_sflow_unparse_agent,
46707
    },
46708
46709
    [OVSREC_SFLOW_COL_EXTERNAL_IDS] = {
46710
         .name = "external_ids",
46711
         .type = {
46712
            .key = {
46713
               .type = OVSDB_TYPE_STRING,
46714
               .string = { .minLen = 0, .maxLen = UINT_MAX },
46715
            },
46716
            .value = {
46717
                .type = OVSDB_TYPE_STRING,
46718
                .string = { .minLen = 0, .maxLen = UINT_MAX },
46719
            },
46720
            .n_min = 0,
46721
            .n_max = UINT_MAX,
46722
         },
46723
         .is_mutable = true,
46724
         .is_synthetic = false,
46725
         .parse = ovsrec_sflow_parse_external_ids,
46726
         .unparse = ovsrec_sflow_unparse_external_ids,
46727
    },
46728
46729
    [OVSREC_SFLOW_COL_HEADER] = {
46730
         .name = "header",
46731
         .type = {
46732
            .key = {
46733
               .type = OVSDB_TYPE_INTEGER,
46734
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
46735
            },
46736
            .value = OVSDB_BASE_VOID_INIT,
46737
            .n_min = 0,
46738
            .n_max = 1,
46739
         },
46740
         .is_mutable = true,
46741
         .is_synthetic = false,
46742
         .parse = ovsrec_sflow_parse_header,
46743
         .unparse = ovsrec_sflow_unparse_header,
46744
    },
46745
46746
    [OVSREC_SFLOW_COL_POLLING] = {
46747
         .name = "polling",
46748
         .type = {
46749
            .key = {
46750
               .type = OVSDB_TYPE_INTEGER,
46751
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
46752
            },
46753
            .value = OVSDB_BASE_VOID_INIT,
46754
            .n_min = 0,
46755
            .n_max = 1,
46756
         },
46757
         .is_mutable = true,
46758
         .is_synthetic = false,
46759
         .parse = ovsrec_sflow_parse_polling,
46760
         .unparse = ovsrec_sflow_unparse_polling,
46761
    },
46762
46763
    [OVSREC_SFLOW_COL_SAMPLING] = {
46764
         .name = "sampling",
46765
         .type = {
46766
            .key = {
46767
               .type = OVSDB_TYPE_INTEGER,
46768
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
46769
            },
46770
            .value = OVSDB_BASE_VOID_INIT,
46771
            .n_min = 0,
46772
            .n_max = 1,
46773
         },
46774
         .is_mutable = true,
46775
         .is_synthetic = false,
46776
         .parse = ovsrec_sflow_parse_sampling,
46777
         .unparse = ovsrec_sflow_unparse_sampling,
46778
    },
46779
46780
    [OVSREC_SFLOW_COL_TARGETS] = {
46781
         .name = "targets",
46782
         .type = {
46783
            .key = {
46784
               .type = OVSDB_TYPE_STRING,
46785
               .string = { .minLen = 0, .maxLen = UINT_MAX },
46786
            },
46787
            .value = OVSDB_BASE_VOID_INIT,
46788
            .n_min = 1,
46789
            .n_max = UINT_MAX,
46790
         },
46791
         .is_mutable = true,
46792
         .is_synthetic = false,
46793
         .parse = ovsrec_sflow_parse_targets,
46794
         .unparse = ovsrec_sflow_unparse_targets,
46795
    },
46796
46797
};
46798

46799
struct ovsdb_idl_table_class ovsrec_table_classes[OVSREC_N_TABLES] = {
46800
    {"AutoAttach", false, false,
46801
     ovsrec_autoattach_columns, ARRAY_SIZE(ovsrec_autoattach_columns),
46802
     sizeof(struct ovsrec_autoattach), ovsrec_autoattach_init__},
46803
    {"Bridge", false, false,
46804
     ovsrec_bridge_columns, ARRAY_SIZE(ovsrec_bridge_columns),
46805
     sizeof(struct ovsrec_bridge), ovsrec_bridge_init__},
46806
    {"CT_Timeout_Policy", false, false,
46807
     ovsrec_ct_timeout_policy_columns, ARRAY_SIZE(ovsrec_ct_timeout_policy_columns),
46808
     sizeof(struct ovsrec_ct_timeout_policy), ovsrec_ct_timeout_policy_init__},
46809
    {"CT_Zone", false, false,
46810
     ovsrec_ct_zone_columns, ARRAY_SIZE(ovsrec_ct_zone_columns),
46811
     sizeof(struct ovsrec_ct_zone), ovsrec_ct_zone_init__},
46812
    {"Controller", false, false,
46813
     ovsrec_controller_columns, ARRAY_SIZE(ovsrec_controller_columns),
46814
     sizeof(struct ovsrec_controller), ovsrec_controller_init__},
46815
    {"Datapath", false, false,
46816
     ovsrec_datapath_columns, ARRAY_SIZE(ovsrec_datapath_columns),
46817
     sizeof(struct ovsrec_datapath), ovsrec_datapath_init__},
46818
    {"Flow_Sample_Collector_Set", true, false,
46819
     ovsrec_flow_sample_collector_set_columns, ARRAY_SIZE(ovsrec_flow_sample_collector_set_columns),
46820
     sizeof(struct ovsrec_flow_sample_collector_set), ovsrec_flow_sample_collector_set_init__},
46821
    {"Flow_Table", false, false,
46822
     ovsrec_flow_table_columns, ARRAY_SIZE(ovsrec_flow_table_columns),
46823
     sizeof(struct ovsrec_flow_table), ovsrec_flow_table_init__},
46824
    {"IPFIX", false, false,
46825
     ovsrec_ipfix_columns, ARRAY_SIZE(ovsrec_ipfix_columns),
46826
     sizeof(struct ovsrec_ipfix), ovsrec_ipfix_init__},
46827
    {"Interface", false, false,
46828
     ovsrec_interface_columns, ARRAY_SIZE(ovsrec_interface_columns),
46829
     sizeof(struct ovsrec_interface), ovsrec_interface_init__},
46830
    {"Manager", false, false,
46831
     ovsrec_manager_columns, ARRAY_SIZE(ovsrec_manager_columns),
46832
     sizeof(struct ovsrec_manager), ovsrec_manager_init__},
46833
    {"Mirror", false, false,
46834
     ovsrec_mirror_columns, ARRAY_SIZE(ovsrec_mirror_columns),
46835
     sizeof(struct ovsrec_mirror), ovsrec_mirror_init__},
46836
    {"NetFlow", false, false,
46837
     ovsrec_netflow_columns, ARRAY_SIZE(ovsrec_netflow_columns),
46838
     sizeof(struct ovsrec_netflow), ovsrec_netflow_init__},
46839
    {"Open_vSwitch", true, true,
46840
     ovsrec_open_vswitch_columns, ARRAY_SIZE(ovsrec_open_vswitch_columns),
46841
     sizeof(struct ovsrec_open_vswitch), ovsrec_open_vswitch_init__},
46842
    {"Port", false, false,
46843
     ovsrec_port_columns, ARRAY_SIZE(ovsrec_port_columns),
46844
     sizeof(struct ovsrec_port), ovsrec_port_init__},
46845
    {"QoS", true, false,
46846
     ovsrec_qos_columns, ARRAY_SIZE(ovsrec_qos_columns),
46847
     sizeof(struct ovsrec_qos), ovsrec_qos_init__},
46848
    {"Queue", true, false,
46849
     ovsrec_queue_columns, ARRAY_SIZE(ovsrec_queue_columns),
46850
     sizeof(struct ovsrec_queue), ovsrec_queue_init__},
46851
    {"SSL", false, true,
46852
     ovsrec_ssl_columns, ARRAY_SIZE(ovsrec_ssl_columns),
46853
     sizeof(struct ovsrec_ssl), ovsrec_ssl_init__},
46854
    {"sFlow", false, false,
46855
     ovsrec_sflow_columns, ARRAY_SIZE(ovsrec_sflow_columns),
46856
     sizeof(struct ovsrec_sflow), ovsrec_sflow_init__},
46857
};
46858
46859
struct ovsdb_idl_class ovsrec_idl_class = {
46860
    "Open_vSwitch", ovsrec_table_classes, ARRAY_SIZE(ovsrec_table_classes)
46861
};
46862
46863
/* Return the schema version.  The caller must not free the returned value. */
46864
const char *
46865
ovsrec_get_db_version(void)
46866
0
{
46867
0
    return "8.8.0";
46868
0
}
46869