Coverage Report

Created: 2023-03-26 07:42

/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
138
bool
139
ovsrec_server_has_autoattach_table_col_system_description(const struct ovsdb_idl *idl)
140
0
{
141
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_autoattach_col_system_description);
142
0
}
143
144
145
bool
146
ovsrec_server_has_autoattach_table_col_system_name(const struct ovsdb_idl *idl)
147
0
{
148
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_autoattach_col_system_name);
149
0
}
150
151
152
bool
153
ovsrec_server_has_autoattach_table(const struct ovsdb_idl *idl)
154
0
{
155
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_AUTOATTACH]);
156
0
}
157
158
159
const struct ovsrec_autoattach_table *
160
ovsrec_autoattach_table_get(const struct ovsdb_idl *idl)
161
0
{
162
0
    return (const struct ovsrec_autoattach_table *) idl;
163
0
}
164
165
const struct ovsrec_autoattach *
166
ovsrec_autoattach_table_first(const struct ovsrec_autoattach_table *table)
167
0
{
168
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
169
0
    return ovsrec_autoattach_first(idl);
170
0
}
171
172
173
const struct ovsrec_autoattach *
174
ovsrec_autoattach_table_track_get_first(const struct ovsrec_autoattach_table *table)
175
0
{
176
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
177
0
    return ovsrec_autoattach_track_get_first(idl);
178
0
}
179
180
181
static void
182
ovsrec_autoattach_parse_mappings(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
183
0
{
184
0
    struct ovsrec_autoattach *row = ovsrec_autoattach_cast(row_);
185
0
    row->key_mappings = NULL;
186
0
    row->value_mappings = NULL;
187
0
    row->n_mappings = 0;
188
0
    for (size_t i = 0; i < datum->n; i++) {
189
0
        if (!row->n_mappings) {
190
0
            row->key_mappings = xmalloc(datum->n * sizeof *row->key_mappings);
191
0
            row->value_mappings = xmalloc(datum->n * sizeof *row->value_mappings);
192
0
        }
193
0
        row->key_mappings[row->n_mappings] = datum->keys[i].integer;
194
0
        row->value_mappings[row->n_mappings] = datum->values[i].integer;
195
0
        row->n_mappings++;
196
0
    }
197
0
}
198
199
static void
200
ovsrec_autoattach_parse_system_description(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
201
0
{
202
0
    struct ovsrec_autoattach *row = ovsrec_autoattach_cast(row_);
203
204
0
    if (datum->n >= 1) {
205
0
        row->system_description = datum->keys[0].s->string;
206
0
    } else {
207
0
        row->system_description = "";
208
0
    }
209
0
}
210
211
static void
212
ovsrec_autoattach_parse_system_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
213
0
{
214
0
    struct ovsrec_autoattach *row = ovsrec_autoattach_cast(row_);
215
216
0
    if (datum->n >= 1) {
217
0
        row->system_name = datum->keys[0].s->string;
218
0
    } else {
219
0
        row->system_name = "";
220
0
    }
221
0
}
222
223
static void
224
ovsrec_autoattach_unparse_mappings(struct ovsdb_idl_row *row_)
225
0
{
226
0
    struct ovsrec_autoattach *row = ovsrec_autoattach_cast(row_);
227
0
    free(row->key_mappings);
228
0
    free(row->value_mappings);
229
0
}
230
231
static void
232
ovsrec_autoattach_unparse_system_description(struct ovsdb_idl_row *row OVS_UNUSED)
233
0
{
234
    /* Nothing to do. */
235
0
}
236
237
static void
238
ovsrec_autoattach_unparse_system_name(struct ovsdb_idl_row *row OVS_UNUSED)
239
0
{
240
    /* Nothing to do. */
241
0
}
242
243
static void
244
ovsrec_autoattach_init__(struct ovsdb_idl_row *row)
245
0
{
246
0
    ovsrec_autoattach_init(ovsrec_autoattach_cast(row));
247
0
}
248
249
/* Clears the contents of 'row' in table "AutoAttach". */
250
void
251
ovsrec_autoattach_init(struct ovsrec_autoattach *row)
252
0
{
253
0
    memset(row, 0, sizeof *row); 
254
0
    row->system_description = "";
255
0
    row->system_name = "";
256
0
}
257
258
/* Searches table "AutoAttach" in 'idl' for a row with UUID 'uuid'.  Returns
259
 * a pointer to the row if there is one, otherwise a null pointer.  */
260
const struct ovsrec_autoattach *
261
ovsrec_autoattach_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
262
0
{
263
0
    return ovsrec_autoattach_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_autoattach, uuid));
264
0
}
265
266
/* Searches table "AutoAttach" for a row with UUID 'uuid'.  Returns
267
 * a pointer to the row if there is one, otherwise a null pointer.  */
268
const struct ovsrec_autoattach *
269
ovsrec_autoattach_table_get_for_uuid(const struct ovsrec_autoattach_table *table, const struct uuid *uuid)
270
0
{
271
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
272
0
    return ovsrec_autoattach_get_for_uuid(idl, uuid);
273
0
}
274
275
/* Returns a row in table "AutoAttach" in 'idl', or a null pointer if that
276
 * table is empty.
277
 *
278
 * Database tables are internally maintained as hash tables, so adding or
279
 * removing rows while traversing the same table can cause some rows to be
280
 * visited twice or not at apply. */
281
const struct ovsrec_autoattach *
282
ovsrec_autoattach_first(const struct ovsdb_idl *idl)
283
0
{
284
0
    return ovsrec_autoattach_cast(ovsdb_idl_first_row(idl, &ovsrec_table_autoattach));
285
0
}
286
287
/* Returns a row following 'row' within its table, or a null pointer if 'row'
288
 * is the last row in its table. */
289
const struct ovsrec_autoattach *
290
ovsrec_autoattach_next(const struct ovsrec_autoattach *row)
291
0
{
292
0
    return ovsrec_autoattach_cast(ovsdb_idl_next_row(&row->header_));
293
0
}
294
295
unsigned int ovsrec_autoattach_get_seqno(const struct ovsdb_idl *idl)
296
0
{
297
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_autoattach);
298
0
}
299
300
unsigned int ovsrec_autoattach_row_get_seqno(const struct ovsrec_autoattach *row, enum ovsdb_idl_change change)
301
0
{
302
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
303
0
}
304
305
const struct ovsrec_autoattach *
306
ovsrec_autoattach_track_get_first(const struct ovsdb_idl *idl)
307
0
{
308
0
    return ovsrec_autoattach_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_autoattach));
309
0
}
310
311
const struct ovsrec_autoattach
312
*ovsrec_autoattach_track_get_next(const struct ovsrec_autoattach *row)
313
0
{
314
0
    return ovsrec_autoattach_cast(ovsdb_idl_track_get_next(&row->header_));
315
0
}
316
317
318
/* Deletes 'row' from table "AutoAttach".  'row' may be freed, so it must not be
319
 * accessed afterward.
320
 *
321
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
322
void
323
ovsrec_autoattach_delete(const struct ovsrec_autoattach *row)
324
0
{
325
0
    ovsdb_idl_txn_delete(&row->header_);
326
0
}
327
328
/* Inserts and returns a new row in the table "AutoAttach" in the database
329
 * with open transaction 'txn'.
330
 *
331
 * The new row is assigned a randomly generated provisional UUID.
332
 * ovsdb-server will assign a different UUID when 'txn' is committed,
333
 * but the IDL will replace any uses of the provisional UUID in the
334
 * data to be to be committed by the UUID assigned by ovsdb-server. */
335
struct ovsrec_autoattach *
336
ovsrec_autoattach_insert(struct ovsdb_idl_txn *txn)
337
0
{
338
0
    return ovsrec_autoattach_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_autoattach, NULL));
339
0
}
340
341
/* Inserts and returns a new row in the table "AutoAttach" in the database
342
 * with open transaction 'txn'.
343
 *
344
 * The new row is assigned the UUID specified in the 'uuid' parameter
345
 * (which cannot be null).  ovsdb-server will try to assign the same
346
 * UUID when 'txn' is committed. */
347
struct ovsrec_autoattach *
348
ovsrec_autoattach_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
349
0
{
350
0
    return ovsrec_autoattach_cast(ovsdb_idl_txn_insert_persist_uuid(
351
0
        txn, &ovsrec_table_autoattach, uuid));
352
0
}
353
354
bool
355
ovsrec_autoattach_is_updated(const struct ovsrec_autoattach *row, enum ovsrec_autoattach_column_id column)
356
0
{
357
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_autoattach_columns[column]);
358
0
}
359
360
/* Causes the original contents of column "mappings" in 'row' to be
361
 * verified as a prerequisite to completing the transaction.  That is, if
362
 * "mappings" in 'row' changed (or if 'row' was deleted) between the
363
 * time that the IDL originally read its contents and the time that the
364
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
365
 *
366
 * The intention is that, to ensure that no transaction commits based on dirty
367
 * reads, an application should call this function any time "mappings" is
368
 * read as part of a read-modify-write operation.
369
 *
370
 * In some cases this function reduces to a no-op, because the current value
371
 * of "mappings" is already known:
372
 *
373
 *   - If 'row' is a row created by the current transaction (returned by
374
 *     ovsrec_autoattach_insert()).
375
 *
376
 *   - If "mappings" has already been modified (with
377
 *     ovsrec_autoattach_set_mappings()) within the current transaction.
378
 *
379
 * Because of the latter property, always call this function *before*
380
 * ovsrec_autoattach_set_mappings() for a given read-modify-write.
381
 *
382
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
383
void
384
ovsrec_autoattach_verify_mappings(const struct ovsrec_autoattach *row)
385
0
{
386
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_autoattach_col_mappings);
387
0
}
388
389
/* Causes the original contents of column "system_description" in 'row' to be
390
 * verified as a prerequisite to completing the transaction.  That is, if
391
 * "system_description" in 'row' changed (or if 'row' was deleted) between the
392
 * time that the IDL originally read its contents and the time that the
393
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
394
 *
395
 * The intention is that, to ensure that no transaction commits based on dirty
396
 * reads, an application should call this function any time "system_description" is
397
 * read as part of a read-modify-write operation.
398
 *
399
 * In some cases this function reduces to a no-op, because the current value
400
 * of "system_description" is already known:
401
 *
402
 *   - If 'row' is a row created by the current transaction (returned by
403
 *     ovsrec_autoattach_insert()).
404
 *
405
 *   - If "system_description" has already been modified (with
406
 *     ovsrec_autoattach_set_system_description()) within the current transaction.
407
 *
408
 * Because of the latter property, always call this function *before*
409
 * ovsrec_autoattach_set_system_description() for a given read-modify-write.
410
 *
411
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
412
void
413
ovsrec_autoattach_verify_system_description(const struct ovsrec_autoattach *row)
414
0
{
415
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_autoattach_col_system_description);
416
0
}
417
418
/* Causes the original contents of column "system_name" in 'row' to be
419
 * verified as a prerequisite to completing the transaction.  That is, if
420
 * "system_name" in 'row' changed (or if 'row' was deleted) between the
421
 * time that the IDL originally read its contents and the time that the
422
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
423
 *
424
 * The intention is that, to ensure that no transaction commits based on dirty
425
 * reads, an application should call this function any time "system_name" is
426
 * read as part of a read-modify-write operation.
427
 *
428
 * In some cases this function reduces to a no-op, because the current value
429
 * of "system_name" is already known:
430
 *
431
 *   - If 'row' is a row created by the current transaction (returned by
432
 *     ovsrec_autoattach_insert()).
433
 *
434
 *   - If "system_name" has already been modified (with
435
 *     ovsrec_autoattach_set_system_name()) within the current transaction.
436
 *
437
 * Because of the latter property, always call this function *before*
438
 * ovsrec_autoattach_set_system_name() for a given read-modify-write.
439
 *
440
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
441
void
442
ovsrec_autoattach_verify_system_name(const struct ovsrec_autoattach *row)
443
0
{
444
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_autoattach_col_system_name);
445
0
}
446
447
/* Returns the "mappings" column's value from the "AutoAttach" table in 'row'
448
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
449
 * ovsdb_datum_find_key() is an easier and more efficient way to search
450
 * for a given key than implementing the same operation on the "cooked"
451
 * form in 'row'.
452
 *
453
 * 'key_type' must be OVSDB_TYPE_INTEGER.
454
 * 'value_type' must be OVSDB_TYPE_INTEGER.
455
 * (This helps to avoid silent bugs if someone changes mappings's
456
 * type without updating the caller.)
457
 *
458
 * The caller must not modify or free the returned value.
459
 *
460
 * Various kinds of changes can invalidate the returned value: modifying
461
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
462
 * If the returned value is needed for a long time, it is best to make a copy
463
 * of it with ovsdb_datum_clone().
464
 *
465
 * This function is rarely useful, since it is easier to access the value
466
 * directly through the "mappings" member in ovsrec_autoattach. */
467
const struct ovsdb_datum *
468
ovsrec_autoattach_get_mappings(const struct ovsrec_autoattach *row,
469
  enum ovsdb_atomic_type key_type OVS_UNUSED,
470
  enum ovsdb_atomic_type value_type OVS_UNUSED)
471
0
{
472
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
473
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
474
0
    return ovsdb_idl_read(&row->header_, &ovsrec_autoattach_col_mappings);
475
0
}
476
477
/* Returns the "system_description" column's value from the "AutoAttach" table in 'row'
478
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
479
 * ovsdb_datum_find_key() is an easier and more efficient way to search
480
 * for a given key than implementing the same operation on the "cooked"
481
 * form in 'row'.
482
 *
483
 * 'key_type' must be OVSDB_TYPE_STRING.
484
 * (This helps to avoid silent bugs if someone changes system_description's
485
 * type without updating the caller.)
486
 *
487
 * The caller must not modify or free the returned value.
488
 *
489
 * Various kinds of changes can invalidate the returned value: modifying
490
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
491
 * If the returned value is needed for a long time, it is best to make a copy
492
 * of it with ovsdb_datum_clone().
493
 *
494
 * This function is rarely useful, since it is easier to access the value
495
 * directly through the "system_description" member in ovsrec_autoattach. */
496
const struct ovsdb_datum *
497
ovsrec_autoattach_get_system_description(const struct ovsrec_autoattach *row,
498
  enum ovsdb_atomic_type key_type OVS_UNUSED)
499
0
{
500
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
501
0
    return ovsdb_idl_read(&row->header_, &ovsrec_autoattach_col_system_description);
502
0
}
503
504
/* Returns the "system_name" column's value from the "AutoAttach" table in 'row'
505
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
506
 * ovsdb_datum_find_key() is an easier and more efficient way to search
507
 * for a given key than implementing the same operation on the "cooked"
508
 * form in 'row'.
509
 *
510
 * 'key_type' must be OVSDB_TYPE_STRING.
511
 * (This helps to avoid silent bugs if someone changes system_name's
512
 * type without updating the caller.)
513
 *
514
 * The caller must not modify or free the returned value.
515
 *
516
 * Various kinds of changes can invalidate the returned value: modifying
517
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
518
 * If the returned value is needed for a long time, it is best to make a copy
519
 * of it with ovsdb_datum_clone().
520
 *
521
 * This function is rarely useful, since it is easier to access the value
522
 * directly through the "system_name" member in ovsrec_autoattach. */
523
const struct ovsdb_datum *
524
ovsrec_autoattach_get_system_name(const struct ovsrec_autoattach *row,
525
  enum ovsdb_atomic_type key_type OVS_UNUSED)
526
0
{
527
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
528
0
    return ovsdb_idl_read(&row->header_, &ovsrec_autoattach_col_system_name);
529
0
}
530
531
/* Sets the "mappings" column from the "AutoAttach" table in 'row' to
532
 * the map with keys 'key_mappings' and values 'value_mappings'
533
 * with 'n_mappings' entries.
534
 *
535
 * Argument constraints: key in range 0 to 16,777,215, value in range 0 to 4,095
536
 *
537
 * The caller retains ownership of the arguments. */
538
void
539
ovsrec_autoattach_set_mappings(const struct ovsrec_autoattach *row, const int64_t *key_mappings, const int64_t *value_mappings, size_t n_mappings)
540
0
{
541
0
    struct ovsdb_datum datum;
542
543
0
    datum.refcnt = NULL;
544
545
0
    datum.n = n_mappings;
546
0
    datum.keys = n_mappings ? xmalloc(n_mappings * sizeof *datum.keys) : NULL;
547
0
    datum.values = xmalloc(n_mappings * sizeof *datum.values);
548
0
    for (size_t i = 0; i < n_mappings; i++) {
549
0
        datum.keys[i].integer = key_mappings[i];
550
0
        datum.values[i].integer = value_mappings[i];
551
0
    }
552
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_autoattach_col_mappings, &datum);
553
0
}
554
555
/* Sets the "system_description" column from the "AutoAttach" table in 'row' to
556
 * 'system_description'.
557
 *
558
 * The caller retains ownership of the arguments. */
559
void
560
ovsrec_autoattach_set_system_description(const struct ovsrec_autoattach *row, const char *system_description)
561
0
{
562
0
    struct ovsdb_datum datum;
563
564
0
    datum.refcnt = NULL;
565
566
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
567
568
0
    datum.n = 1;
569
0
    datum.keys = key;
570
0
    key->s = ovsdb_atom_string_create(system_description);
571
0
    datum.values = NULL;
572
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_autoattach_col_system_description, &datum);
573
0
}
574
575
/* Sets the "system_name" column from the "AutoAttach" table in 'row' to
576
 * 'system_name'.
577
 *
578
 * The caller retains ownership of the arguments. */
579
void
580
ovsrec_autoattach_set_system_name(const struct ovsrec_autoattach *row, const char *system_name)
581
0
{
582
0
    struct ovsdb_datum datum;
583
584
0
    datum.refcnt = NULL;
585
586
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
587
588
0
    datum.n = 1;
589
0
    datum.keys = key;
590
0
    key->s = ovsdb_atom_string_create(system_name);
591
0
    datum.values = NULL;
592
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_autoattach_col_system_name, &datum);
593
0
}
594
595
/* Sets an element of the "mappings" map column from the "AutoAttach" table in 'row'
596
 * to 'new_value' given the key value 'new_key'.
597
 *
598
 */
599
void
600
ovsrec_autoattach_update_mappings_setkey(const struct ovsrec_autoattach *row, int64_t new_key, int64_t new_value)
601
0
{
602
0
    struct ovsdb_datum *datum;
603
604
0
    datum = xmalloc(sizeof *datum);
605
0
    datum->n = 1;
606
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
607
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
608
0
    datum->refcnt = NULL;
609
610
0
    datum->keys[0].integer = new_key;
611
0
    datum->values[0].integer = new_value;
612
613
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
614
0
                                    &ovsrec_autoattach_col_mappings,
615
0
                                    datum);
616
0
}
617
618
/* Deletes an element of the "mappings" map column from the "AutoAttach" table in 'row'
619
 * given the key value 'delete_key'.
620
 *
621
 */
622
void
623
ovsrec_autoattach_update_mappings_delkey(const struct ovsrec_autoattach *row, int64_t delete_key)
624
0
{
625
0
    struct ovsdb_datum *datum;
626
627
0
    datum = xmalloc(sizeof *datum);
628
0
    datum->n = 1;
629
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
630
0
    datum->values = NULL;
631
0
    datum->refcnt = NULL;
632
633
0
    datum->keys[0].integer = delete_key;
634
635
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
636
0
                                    &ovsrec_autoattach_col_mappings,
637
0
                                    datum);
638
0
}
639
640
/* Sets the "mappings" column from the "AutoAttach" table in 'row' to
641
 * the map with keys 'key_mappings' and values 'value_mappings'
642
 * with 'n_mappings' entries.
643
 *
644
 * Argument constraints: key in range 0 to 16,777,215, value in range 0 to 4,095
645
 *
646
 * The caller retains ownership of the arguments. */
647
void
648
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)
649
0
{
650
0
    struct ovsdb_datum datum;
651
652
0
    datum.refcnt = NULL;
653
0
    datum.n = n_mappings;
654
0
    datum.keys = n_mappings ? xmalloc(n_mappings * sizeof *datum.keys) : NULL;
655
0
    datum.values = xmalloc(n_mappings * sizeof *datum.values);
656
0
    for (size_t i = 0; i < n_mappings; i++) {
657
0
        datum.keys[i].integer = key_mappings[i];
658
0
        datum.values[i].integer = value_mappings[i];
659
0
    }
660
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_autoattach_col_mappings.type);
661
0
    ovsdb_idl_condition_add_clause(cond,
662
0
                          function,
663
0
                          &ovsrec_autoattach_col_mappings,
664
0
                          &datum);
665
0
    ovsdb_datum_destroy(&datum, &ovsrec_autoattach_col_mappings.type);
666
0
}
667
668
/* Sets the "system_description" column from the "AutoAttach" table in 'row' to
669
 * 'system_description'.
670
 *
671
 * The caller retains ownership of the arguments. */
672
void
673
ovsrec_autoattach_add_clause_system_description(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *system_description)
674
0
{
675
0
    struct ovsdb_datum datum;
676
677
0
    datum.refcnt = NULL;
678
679
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
680
681
0
    datum.n = 1;
682
0
    datum.keys = key;
683
0
    key->s = ovsdb_atom_string_create(system_description);
684
0
    datum.values = NULL;
685
0
    ovsdb_idl_condition_add_clause(cond,
686
0
                          function,
687
0
                          &ovsrec_autoattach_col_system_description,
688
0
                          &datum);
689
0
    ovsdb_datum_destroy(&datum, &ovsrec_autoattach_col_system_description.type);
690
0
}
691
692
/* Sets the "system_name" column from the "AutoAttach" table in 'row' to
693
 * 'system_name'.
694
 *
695
 * The caller retains ownership of the arguments. */
696
void
697
ovsrec_autoattach_add_clause_system_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *system_name)
698
0
{
699
0
    struct ovsdb_datum datum;
700
701
0
    datum.refcnt = NULL;
702
703
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
704
705
0
    datum.n = 1;
706
0
    datum.keys = key;
707
0
    key->s = ovsdb_atom_string_create(system_name);
708
0
    datum.values = NULL;
709
0
    ovsdb_idl_condition_add_clause(cond,
710
0
                          function,
711
0
                          &ovsrec_autoattach_col_system_name,
712
0
                          &datum);
713
0
    ovsdb_datum_destroy(&datum, &ovsrec_autoattach_col_system_name.type);
714
0
}
715
716
/* Destroy 'row' of kind "AutoAttach". The row must have been
717
 * created with ovsdb_idl_index_init_row.
718
 */
719
void
720
ovsrec_autoattach_index_destroy_row(const struct ovsrec_autoattach *row)
721
0
{
722
0
    ovsdb_idl_index_destroy_row(&row->header_);
723
0
}
724
        
725
726
/* Creates a new row of kind "AutoAttach". */
727
struct ovsrec_autoattach *
728
ovsrec_autoattach_index_init_row(struct ovsdb_idl_index *index)
729
0
{
730
0
    ovs_assert(index->table->class_ == &ovsrec_table_autoattach);
731
0
    return ALIGNED_CAST(struct ovsrec_autoattach *, ovsdb_idl_index_init_row(index));
732
0
}
733
734
struct ovsrec_autoattach *
735
ovsrec_autoattach_index_find(struct ovsdb_idl_index *index, const struct ovsrec_autoattach *target)
736
0
{
737
0
    ovs_assert(index->table->class_ == &ovsrec_table_autoattach);
738
0
    return ovsrec_autoattach_cast(ovsdb_idl_index_find(index, &target->header_));
739
0
}
740
741
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
742
int
743
ovsrec_autoattach_index_compare(
744
    struct ovsdb_idl_index *index, 
745
    const struct ovsrec_autoattach *a, 
746
    const struct ovsrec_autoattach *b)
747
0
{
748
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
749
0
}
750
751
struct ovsdb_idl_cursor
752
ovsrec_autoattach_cursor_first(struct ovsdb_idl_index *index)
753
0
{
754
0
    ovs_assert(index->table->class_ == &ovsrec_table_autoattach);
755
0
    return ovsdb_idl_cursor_first(index);
756
0
}
757
758
struct ovsdb_idl_cursor
759
ovsrec_autoattach_cursor_first_eq(
760
    struct ovsdb_idl_index *index, const struct ovsrec_autoattach *target)
761
0
{
762
0
    ovs_assert(index->table->class_ == &ovsrec_table_autoattach);
763
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
764
0
}
765
766
struct ovsdb_idl_cursor
767
ovsrec_autoattach_cursor_first_ge(
768
    struct ovsdb_idl_index *index, const struct ovsrec_autoattach *target)
769
0
{
770
0
    ovs_assert(index->table->class_ == &ovsrec_table_autoattach);
771
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
772
0
}
773
774
struct ovsrec_autoattach *
775
ovsrec_autoattach_cursor_data(struct ovsdb_idl_cursor *cursor)
776
0
{
777
0
    return ovsrec_autoattach_cast(ovsdb_idl_cursor_data(cursor));
778
0
}
779
780
781
/* Sets the "mappings" column from the "AutoAttach" table in 'row' to
782
 * the map with keys 'key_mappings' and values 'value_mappings'
783
 * with 'n_mappings' entries.
784
 *
785
 * Argument constraints: key in range 0 to 16,777,215, value in range 0 to 4,095
786
 *
787
 * The caller retains ownership of the arguments. */
788
void
789
ovsrec_autoattach_index_set_mappings(const struct ovsrec_autoattach *row, const int64_t *key_mappings, const int64_t *value_mappings, size_t n_mappings)
790
0
{
791
0
    struct ovsdb_datum datum;
792
793
0
    datum.refcnt = NULL;
794
0
    size_t i;
795
796
0
    datum.n = n_mappings;
797
0
    datum.keys = n_mappings ? xmalloc(n_mappings * sizeof *datum.keys) : NULL;
798
0
    datum.values = xmalloc(n_mappings * sizeof *datum.values);
799
0
    for (i = 0; i < n_mappings; i++) {
800
0
        datum.keys[i].integer = key_mappings[i];
801
0
        datum.values[i].integer = value_mappings[i];
802
0
    }
803
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_autoattach_col_mappings.type);
804
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]);
805
0
}
806
807
/* Sets the "system_description" column from the "AutoAttach" table in 'row' to
808
 * 'system_description'.
809
 *
810
 * The caller retains ownership of the arguments. */
811
void
812
ovsrec_autoattach_index_set_system_description(const struct ovsrec_autoattach *row, const char *system_description)
813
0
{
814
0
    struct ovsdb_datum datum;
815
816
0
    datum.refcnt = NULL;
817
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
818
819
0
    datum.n = 1;
820
0
    datum.keys = key;
821
0
    key->s = ovsdb_atom_string_create(system_description);
822
0
    datum.values = NULL;
823
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]);
824
0
}
825
826
/* Sets the "system_name" column from the "AutoAttach" table in 'row' to
827
 * 'system_name'.
828
 *
829
 * The caller retains ownership of the arguments. */
830
void
831
ovsrec_autoattach_index_set_system_name(const struct ovsrec_autoattach *row, const char *system_name)
832
0
{
833
0
    struct ovsdb_datum datum;
834
835
0
    datum.refcnt = NULL;
836
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
837
838
0
    datum.n = 1;
839
0
    datum.keys = key;
840
0
    key->s = ovsdb_atom_string_create(system_name);
841
0
    datum.values = NULL;
842
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]);
843
0
}
844
845
struct ovsdb_idl_column ovsrec_autoattach_columns[OVSREC_AUTOATTACH_N_COLUMNS];
846
847
unsigned int
848
ovsrec_autoattach_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
849
0
{
850
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_autoattach, condition);
851
0
}
852
853
struct ovsdb_idl_column ovsrec_autoattach_columns[OVSREC_AUTOATTACH_N_COLUMNS] = {
854
    [OVSREC_AUTOATTACH_COL_MAPPINGS] = {
855
         .name = "mappings",
856
         .type = {
857
            .key = {
858
               .type = OVSDB_TYPE_INTEGER,
859
               .integer = { .min = INT64_C(0), .max = INT64_C(16777215) },
860
            },
861
            .value = {
862
                .type = OVSDB_TYPE_INTEGER,
863
                .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
864
            },
865
            .n_min = 0,
866
            .n_max = UINT_MAX,
867
         },
868
         .is_mutable = true,
869
         .is_synthetic = false,
870
         .parse = ovsrec_autoattach_parse_mappings,
871
         .unparse = ovsrec_autoattach_unparse_mappings,
872
    },
873
874
    [OVSREC_AUTOATTACH_COL_SYSTEM_DESCRIPTION] = {
875
         .name = "system_description",
876
         .type = {
877
            .key = {
878
               .type = OVSDB_TYPE_STRING,
879
               .string = { .minLen = 0, .maxLen = UINT_MAX },
880
            },
881
            .value = OVSDB_BASE_VOID_INIT,
882
            .n_min = 1,
883
            .n_max = 1,
884
         },
885
         .is_mutable = true,
886
         .is_synthetic = false,
887
         .parse = ovsrec_autoattach_parse_system_description,
888
         .unparse = ovsrec_autoattach_unparse_system_description,
889
    },
890
891
    [OVSREC_AUTOATTACH_COL_SYSTEM_NAME] = {
892
         .name = "system_name",
893
         .type = {
894
            .key = {
895
               .type = OVSDB_TYPE_STRING,
896
               .string = { .minLen = 0, .maxLen = UINT_MAX },
897
            },
898
            .value = OVSDB_BASE_VOID_INIT,
899
            .n_min = 1,
900
            .n_max = 1,
901
         },
902
         .is_mutable = true,
903
         .is_synthetic = false,
904
         .parse = ovsrec_autoattach_parse_system_name,
905
         .unparse = ovsrec_autoattach_unparse_system_name,
906
    },
907
908
};
909

910
/* Bridge table. */
911
912
bool
913
ovsrec_server_has_bridge_table_col_auto_attach(const struct ovsdb_idl *idl)
914
0
{
915
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_auto_attach);
916
0
}
917
918
919
bool
920
ovsrec_server_has_bridge_table_col_controller(const struct ovsdb_idl *idl)
921
0
{
922
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_controller);
923
0
}
924
925
926
bool
927
ovsrec_server_has_bridge_table_col_datapath_id(const struct ovsdb_idl *idl)
928
0
{
929
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_datapath_id);
930
0
}
931
932
933
bool
934
ovsrec_server_has_bridge_table_col_datapath_type(const struct ovsdb_idl *idl)
935
0
{
936
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_datapath_type);
937
0
}
938
939
940
bool
941
ovsrec_server_has_bridge_table_col_datapath_version(const struct ovsdb_idl *idl)
942
0
{
943
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_datapath_version);
944
0
}
945
946
947
bool
948
ovsrec_server_has_bridge_table_col_external_ids(const struct ovsdb_idl *idl)
949
0
{
950
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_external_ids);
951
0
}
952
953
954
bool
955
ovsrec_server_has_bridge_table_col_fail_mode(const struct ovsdb_idl *idl)
956
0
{
957
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_fail_mode);
958
0
}
959
960
961
bool
962
ovsrec_server_has_bridge_table_col_flood_vlans(const struct ovsdb_idl *idl)
963
0
{
964
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_flood_vlans);
965
0
}
966
967
968
bool
969
ovsrec_server_has_bridge_table_col_flow_tables(const struct ovsdb_idl *idl)
970
0
{
971
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_flow_tables);
972
0
}
973
974
975
bool
976
ovsrec_server_has_bridge_table_col_ipfix(const struct ovsdb_idl *idl)
977
0
{
978
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_ipfix);
979
0
}
980
981
982
bool
983
ovsrec_server_has_bridge_table_col_mcast_snooping_enable(const struct ovsdb_idl *idl)
984
0
{
985
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_mcast_snooping_enable);
986
0
}
987
988
989
bool
990
ovsrec_server_has_bridge_table_col_mirrors(const struct ovsdb_idl *idl)
991
0
{
992
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_mirrors);
993
0
}
994
995
996
bool
997
ovsrec_server_has_bridge_table_col_name(const struct ovsdb_idl *idl)
998
0
{
999
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_name);
1000
0
}
1001
1002
1003
bool
1004
ovsrec_server_has_bridge_table_col_netflow(const struct ovsdb_idl *idl)
1005
0
{
1006
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_netflow);
1007
0
}
1008
1009
1010
bool
1011
ovsrec_server_has_bridge_table_col_other_config(const struct ovsdb_idl *idl)
1012
0
{
1013
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_other_config);
1014
0
}
1015
1016
1017
bool
1018
ovsrec_server_has_bridge_table_col_ports(const struct ovsdb_idl *idl)
1019
0
{
1020
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_ports);
1021
0
}
1022
1023
1024
bool
1025
ovsrec_server_has_bridge_table_col_protocols(const struct ovsdb_idl *idl)
1026
0
{
1027
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_protocols);
1028
0
}
1029
1030
1031
bool
1032
ovsrec_server_has_bridge_table_col_rstp_enable(const struct ovsdb_idl *idl)
1033
0
{
1034
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_rstp_enable);
1035
0
}
1036
1037
1038
bool
1039
ovsrec_server_has_bridge_table_col_rstp_status(const struct ovsdb_idl *idl)
1040
0
{
1041
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_rstp_status);
1042
0
}
1043
1044
1045
bool
1046
ovsrec_server_has_bridge_table_col_sflow(const struct ovsdb_idl *idl)
1047
0
{
1048
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_sflow);
1049
0
}
1050
1051
1052
bool
1053
ovsrec_server_has_bridge_table_col_status(const struct ovsdb_idl *idl)
1054
0
{
1055
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_status);
1056
0
}
1057
1058
1059
bool
1060
ovsrec_server_has_bridge_table_col_stp_enable(const struct ovsdb_idl *idl)
1061
0
{
1062
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_bridge_col_stp_enable);
1063
0
}
1064
1065
1066
bool
1067
ovsrec_server_has_bridge_table(const struct ovsdb_idl *idl)
1068
0
{
1069
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
1070
0
}
1071
1072
1073
const struct ovsrec_bridge_table *
1074
ovsrec_bridge_table_get(const struct ovsdb_idl *idl)
1075
0
{
1076
0
    return (const struct ovsrec_bridge_table *) idl;
1077
0
}
1078
1079
const struct ovsrec_bridge *
1080
ovsrec_bridge_table_first(const struct ovsrec_bridge_table *table)
1081
0
{
1082
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
1083
0
    return ovsrec_bridge_first(idl);
1084
0
}
1085
1086
1087
const struct ovsrec_bridge *
1088
ovsrec_bridge_table_track_get_first(const struct ovsrec_bridge_table *table)
1089
0
{
1090
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
1091
0
    return ovsrec_bridge_track_get_first(idl);
1092
0
}
1093
1094
1095
static void
1096
ovsrec_bridge_parse_auto_attach(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1097
0
{
1098
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1099
1100
0
    if (datum->n >= 1) {
1101
0
        row->auto_attach = ovsrec_autoattach_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_autoattach, &datum->keys[0].uuid));
1102
0
    } else {
1103
0
        row->auto_attach = NULL;
1104
0
    }
1105
0
}
1106
1107
static void
1108
ovsrec_bridge_parse_controller(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1109
0
{
1110
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1111
0
    row->controller = NULL;
1112
0
    row->n_controller = 0;
1113
0
    for (size_t i = 0; i < datum->n; i++) {
1114
0
        struct ovsrec_controller *keyRow = ovsrec_controller_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_controller, &datum->keys[i].uuid));
1115
0
        if (!keyRow) {
1116
0
            continue;
1117
0
        }
1118
0
        if (!row->n_controller) {
1119
0
            row->controller = xmalloc(datum->n * sizeof *row->controller);
1120
0
        }
1121
0
        row->controller[row->n_controller] = keyRow;
1122
0
        row->n_controller++;
1123
0
    }
1124
0
}
1125
1126
static void
1127
ovsrec_bridge_parse_datapath_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1128
0
{
1129
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1130
1131
0
    if (datum->n >= 1) {
1132
0
        row->datapath_id = datum->keys[0].s->string;
1133
0
    } else {
1134
0
        row->datapath_id = NULL;
1135
0
    }
1136
0
}
1137
1138
static void
1139
ovsrec_bridge_parse_datapath_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1140
0
{
1141
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1142
1143
0
    if (datum->n >= 1) {
1144
0
        row->datapath_type = datum->keys[0].s->string;
1145
0
    } else {
1146
0
        row->datapath_type = "";
1147
0
    }
1148
0
}
1149
1150
static void
1151
ovsrec_bridge_parse_datapath_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1152
0
{
1153
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1154
1155
0
    if (datum->n >= 1) {
1156
0
        row->datapath_version = datum->keys[0].s->string;
1157
0
    } else {
1158
0
        row->datapath_version = "";
1159
0
    }
1160
0
}
1161
1162
static void
1163
ovsrec_bridge_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1164
0
{
1165
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1166
0
    smap_init(&row->external_ids);
1167
0
    for (size_t i = 0; i < datum->n; i++) {
1168
0
        smap_add(&row->external_ids,
1169
0
                 json_string(datum->keys[i].s),
1170
0
                 json_string(datum->values[i].s));
1171
0
    }
1172
0
}
1173
1174
static void
1175
ovsrec_bridge_parse_fail_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1176
0
{
1177
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1178
1179
0
    if (datum->n >= 1) {
1180
0
        row->fail_mode = datum->keys[0].s->string;
1181
0
    } else {
1182
0
        row->fail_mode = NULL;
1183
0
    }
1184
0
}
1185
1186
static void
1187
ovsrec_bridge_parse_flood_vlans(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1188
0
{
1189
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1190
0
    size_t n = MIN(4096, datum->n);
1191
0
    row->flood_vlans = NULL;
1192
0
    row->n_flood_vlans = 0;
1193
0
    for (size_t i = 0; i < n; i++) {
1194
0
        if (!row->n_flood_vlans) {
1195
0
            row->flood_vlans = xmalloc(n * sizeof *row->flood_vlans);
1196
0
        }
1197
0
        row->flood_vlans[row->n_flood_vlans] = datum->keys[i].integer;
1198
0
        row->n_flood_vlans++;
1199
0
    }
1200
0
}
1201
1202
static void
1203
ovsrec_bridge_parse_flow_tables(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1204
0
{
1205
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1206
0
    row->key_flow_tables = NULL;
1207
0
    row->value_flow_tables = NULL;
1208
0
    row->n_flow_tables = 0;
1209
0
    for (size_t i = 0; i < datum->n; i++) {
1210
0
        struct ovsrec_flow_table *valueRow = ovsrec_flow_table_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_flow_table, &datum->values[i].uuid));
1211
0
        if (!valueRow) {
1212
0
            continue;
1213
0
        }
1214
0
        if (!row->n_flow_tables) {
1215
0
            row->key_flow_tables = xmalloc(datum->n * sizeof *row->key_flow_tables);
1216
0
            row->value_flow_tables = xmalloc(datum->n * sizeof *row->value_flow_tables);
1217
0
        }
1218
0
        row->key_flow_tables[row->n_flow_tables] = datum->keys[i].integer;
1219
0
        row->value_flow_tables[row->n_flow_tables] = valueRow;
1220
0
        row->n_flow_tables++;
1221
0
    }
1222
0
}
1223
1224
static void
1225
ovsrec_bridge_parse_ipfix(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1226
0
{
1227
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1228
1229
0
    if (datum->n >= 1) {
1230
0
        row->ipfix = ovsrec_ipfix_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_ipfix, &datum->keys[0].uuid));
1231
0
    } else {
1232
0
        row->ipfix = NULL;
1233
0
    }
1234
0
}
1235
1236
static void
1237
ovsrec_bridge_parse_mcast_snooping_enable(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1238
0
{
1239
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1240
1241
0
    if (datum->n >= 1) {
1242
0
        row->mcast_snooping_enable = datum->keys[0].boolean;
1243
0
    } else {
1244
0
        row->mcast_snooping_enable = false;
1245
0
    }
1246
0
}
1247
1248
static void
1249
ovsrec_bridge_parse_mirrors(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1250
0
{
1251
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1252
0
    row->mirrors = NULL;
1253
0
    row->n_mirrors = 0;
1254
0
    for (size_t i = 0; i < datum->n; i++) {
1255
0
        struct ovsrec_mirror *keyRow = ovsrec_mirror_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_mirror, &datum->keys[i].uuid));
1256
0
        if (!keyRow) {
1257
0
            continue;
1258
0
        }
1259
0
        if (!row->n_mirrors) {
1260
0
            row->mirrors = xmalloc(datum->n * sizeof *row->mirrors);
1261
0
        }
1262
0
        row->mirrors[row->n_mirrors] = keyRow;
1263
0
        row->n_mirrors++;
1264
0
    }
1265
0
}
1266
1267
static void
1268
ovsrec_bridge_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1269
0
{
1270
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1271
1272
0
    if (datum->n >= 1) {
1273
0
        row->name = datum->keys[0].s->string;
1274
0
    } else {
1275
0
        row->name = "";
1276
0
    }
1277
0
}
1278
1279
static void
1280
ovsrec_bridge_parse_netflow(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1281
0
{
1282
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1283
1284
0
    if (datum->n >= 1) {
1285
0
        row->netflow = ovsrec_netflow_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_netflow, &datum->keys[0].uuid));
1286
0
    } else {
1287
0
        row->netflow = NULL;
1288
0
    }
1289
0
}
1290
1291
static void
1292
ovsrec_bridge_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1293
0
{
1294
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1295
0
    smap_init(&row->other_config);
1296
0
    for (size_t i = 0; i < datum->n; i++) {
1297
0
        smap_add(&row->other_config,
1298
0
                 json_string(datum->keys[i].s),
1299
0
                 json_string(datum->values[i].s));
1300
0
    }
1301
0
}
1302
1303
static void
1304
ovsrec_bridge_parse_ports(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1305
0
{
1306
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1307
0
    row->ports = NULL;
1308
0
    row->n_ports = 0;
1309
0
    for (size_t i = 0; i < datum->n; i++) {
1310
0
        struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_port, &datum->keys[i].uuid));
1311
0
        if (!keyRow) {
1312
0
            continue;
1313
0
        }
1314
0
        if (!row->n_ports) {
1315
0
            row->ports = xmalloc(datum->n * sizeof *row->ports);
1316
0
        }
1317
0
        row->ports[row->n_ports] = keyRow;
1318
0
        row->n_ports++;
1319
0
    }
1320
0
}
1321
1322
static void
1323
ovsrec_bridge_parse_protocols(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1324
0
{
1325
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1326
0
    row->protocols = NULL;
1327
0
    row->n_protocols = 0;
1328
0
    for (size_t i = 0; i < datum->n; i++) {
1329
0
        if (!row->n_protocols) {
1330
0
            row->protocols = xmalloc(datum->n * sizeof *row->protocols);
1331
0
        }
1332
0
        row->protocols[row->n_protocols] = datum->keys[i].s->string;
1333
0
        row->n_protocols++;
1334
0
    }
1335
0
}
1336
1337
static void
1338
ovsrec_bridge_parse_rstp_enable(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1339
0
{
1340
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1341
1342
0
    if (datum->n >= 1) {
1343
0
        row->rstp_enable = datum->keys[0].boolean;
1344
0
    } else {
1345
0
        row->rstp_enable = false;
1346
0
    }
1347
0
}
1348
1349
static void
1350
ovsrec_bridge_parse_rstp_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1351
0
{
1352
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1353
0
    smap_init(&row->rstp_status);
1354
0
    for (size_t i = 0; i < datum->n; i++) {
1355
0
        smap_add(&row->rstp_status,
1356
0
                 json_string(datum->keys[i].s),
1357
0
                 json_string(datum->values[i].s));
1358
0
    }
1359
0
}
1360
1361
static void
1362
ovsrec_bridge_parse_sflow(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1363
0
{
1364
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1365
1366
0
    if (datum->n >= 1) {
1367
0
        row->sflow = ovsrec_sflow_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_sflow, &datum->keys[0].uuid));
1368
0
    } else {
1369
0
        row->sflow = NULL;
1370
0
    }
1371
0
}
1372
1373
static void
1374
ovsrec_bridge_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1375
0
{
1376
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1377
0
    smap_init(&row->status);
1378
0
    for (size_t i = 0; i < datum->n; i++) {
1379
0
        smap_add(&row->status,
1380
0
                 json_string(datum->keys[i].s),
1381
0
                 json_string(datum->values[i].s));
1382
0
    }
1383
0
}
1384
1385
static void
1386
ovsrec_bridge_parse_stp_enable(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1387
0
{
1388
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1389
1390
0
    if (datum->n >= 1) {
1391
0
        row->stp_enable = datum->keys[0].boolean;
1392
0
    } else {
1393
0
        row->stp_enable = false;
1394
0
    }
1395
0
}
1396
1397
static void
1398
ovsrec_bridge_unparse_auto_attach(struct ovsdb_idl_row *row OVS_UNUSED)
1399
0
{
1400
    /* Nothing to do. */
1401
0
}
1402
1403
static void
1404
ovsrec_bridge_unparse_controller(struct ovsdb_idl_row *row_)
1405
0
{
1406
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1407
0
    free(row->controller);
1408
0
}
1409
1410
static void
1411
ovsrec_bridge_unparse_datapath_id(struct ovsdb_idl_row *row OVS_UNUSED)
1412
0
{
1413
    /* Nothing to do. */
1414
0
}
1415
1416
static void
1417
ovsrec_bridge_unparse_datapath_type(struct ovsdb_idl_row *row OVS_UNUSED)
1418
0
{
1419
    /* Nothing to do. */
1420
0
}
1421
1422
static void
1423
ovsrec_bridge_unparse_datapath_version(struct ovsdb_idl_row *row OVS_UNUSED)
1424
0
{
1425
    /* Nothing to do. */
1426
0
}
1427
1428
static void
1429
ovsrec_bridge_unparse_external_ids(struct ovsdb_idl_row *row_)
1430
0
{
1431
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1432
0
    smap_destroy(&row->external_ids);
1433
0
}
1434
1435
static void
1436
ovsrec_bridge_unparse_fail_mode(struct ovsdb_idl_row *row OVS_UNUSED)
1437
0
{
1438
    /* Nothing to do. */
1439
0
}
1440
1441
static void
1442
ovsrec_bridge_unparse_flood_vlans(struct ovsdb_idl_row *row_)
1443
0
{
1444
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1445
0
    free(row->flood_vlans);
1446
0
}
1447
1448
static void
1449
ovsrec_bridge_unparse_flow_tables(struct ovsdb_idl_row *row_)
1450
0
{
1451
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1452
0
    free(row->key_flow_tables);
1453
0
    free(row->value_flow_tables);
1454
0
}
1455
1456
static void
1457
ovsrec_bridge_unparse_ipfix(struct ovsdb_idl_row *row OVS_UNUSED)
1458
0
{
1459
    /* Nothing to do. */
1460
0
}
1461
1462
static void
1463
ovsrec_bridge_unparse_mcast_snooping_enable(struct ovsdb_idl_row *row OVS_UNUSED)
1464
0
{
1465
    /* Nothing to do. */
1466
0
}
1467
1468
static void
1469
ovsrec_bridge_unparse_mirrors(struct ovsdb_idl_row *row_)
1470
0
{
1471
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1472
0
    free(row->mirrors);
1473
0
}
1474
1475
static void
1476
ovsrec_bridge_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
1477
0
{
1478
    /* Nothing to do. */
1479
0
}
1480
1481
static void
1482
ovsrec_bridge_unparse_netflow(struct ovsdb_idl_row *row OVS_UNUSED)
1483
0
{
1484
    /* Nothing to do. */
1485
0
}
1486
1487
static void
1488
ovsrec_bridge_unparse_other_config(struct ovsdb_idl_row *row_)
1489
0
{
1490
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1491
0
    smap_destroy(&row->other_config);
1492
0
}
1493
1494
static void
1495
ovsrec_bridge_unparse_ports(struct ovsdb_idl_row *row_)
1496
0
{
1497
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1498
0
    free(row->ports);
1499
0
}
1500
1501
static void
1502
ovsrec_bridge_unparse_protocols(struct ovsdb_idl_row *row_)
1503
0
{
1504
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1505
0
    free(row->protocols);
1506
0
}
1507
1508
static void
1509
ovsrec_bridge_unparse_rstp_enable(struct ovsdb_idl_row *row OVS_UNUSED)
1510
0
{
1511
    /* Nothing to do. */
1512
0
}
1513
1514
static void
1515
ovsrec_bridge_unparse_rstp_status(struct ovsdb_idl_row *row_)
1516
0
{
1517
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1518
0
    smap_destroy(&row->rstp_status);
1519
0
}
1520
1521
static void
1522
ovsrec_bridge_unparse_sflow(struct ovsdb_idl_row *row OVS_UNUSED)
1523
0
{
1524
    /* Nothing to do. */
1525
0
}
1526
1527
static void
1528
ovsrec_bridge_unparse_status(struct ovsdb_idl_row *row_)
1529
0
{
1530
0
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
1531
0
    smap_destroy(&row->status);
1532
0
}
1533
1534
static void
1535
ovsrec_bridge_unparse_stp_enable(struct ovsdb_idl_row *row OVS_UNUSED)
1536
0
{
1537
    /* Nothing to do. */
1538
0
}
1539
1540
static void
1541
ovsrec_bridge_init__(struct ovsdb_idl_row *row)
1542
0
{
1543
0
    ovsrec_bridge_init(ovsrec_bridge_cast(row));
1544
0
}
1545
1546
/* Clears the contents of 'row' in table "Bridge". */
1547
void
1548
ovsrec_bridge_init(struct ovsrec_bridge *row)
1549
0
{
1550
0
    memset(row, 0, sizeof *row); 
1551
0
    row->datapath_type = "";
1552
0
    row->datapath_version = "";
1553
0
    smap_init(&row->external_ids);
1554
0
    row->name = "";
1555
0
    smap_init(&row->other_config);
1556
0
    smap_init(&row->rstp_status);
1557
0
    smap_init(&row->status);
1558
0
}
1559
1560
/* Searches table "Bridge" in 'idl' for a row with UUID 'uuid'.  Returns
1561
 * a pointer to the row if there is one, otherwise a null pointer.  */
1562
const struct ovsrec_bridge *
1563
ovsrec_bridge_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
1564
0
{
1565
0
    return ovsrec_bridge_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_bridge, uuid));
1566
0
}
1567
1568
/* Searches table "Bridge" for a row with UUID 'uuid'.  Returns
1569
 * a pointer to the row if there is one, otherwise a null pointer.  */
1570
const struct ovsrec_bridge *
1571
ovsrec_bridge_table_get_for_uuid(const struct ovsrec_bridge_table *table, const struct uuid *uuid)
1572
0
{
1573
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
1574
0
    return ovsrec_bridge_get_for_uuid(idl, uuid);
1575
0
}
1576
1577
/* Returns a row in table "Bridge" in 'idl', or a null pointer if that
1578
 * table is empty.
1579
 *
1580
 * Database tables are internally maintained as hash tables, so adding or
1581
 * removing rows while traversing the same table can cause some rows to be
1582
 * visited twice or not at apply. */
1583
const struct ovsrec_bridge *
1584
ovsrec_bridge_first(const struct ovsdb_idl *idl)
1585
0
{
1586
0
    return ovsrec_bridge_cast(ovsdb_idl_first_row(idl, &ovsrec_table_bridge));
1587
0
}
1588
1589
/* Returns a row following 'row' within its table, or a null pointer if 'row'
1590
 * is the last row in its table. */
1591
const struct ovsrec_bridge *
1592
ovsrec_bridge_next(const struct ovsrec_bridge *row)
1593
0
{
1594
0
    return ovsrec_bridge_cast(ovsdb_idl_next_row(&row->header_));
1595
0
}
1596
1597
unsigned int ovsrec_bridge_get_seqno(const struct ovsdb_idl *idl)
1598
0
{
1599
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_bridge);
1600
0
}
1601
1602
unsigned int ovsrec_bridge_row_get_seqno(const struct ovsrec_bridge *row, enum ovsdb_idl_change change)
1603
0
{
1604
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
1605
0
}
1606
1607
const struct ovsrec_bridge *
1608
ovsrec_bridge_track_get_first(const struct ovsdb_idl *idl)
1609
0
{
1610
0
    return ovsrec_bridge_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_bridge));
1611
0
}
1612
1613
const struct ovsrec_bridge
1614
*ovsrec_bridge_track_get_next(const struct ovsrec_bridge *row)
1615
0
{
1616
0
    return ovsrec_bridge_cast(ovsdb_idl_track_get_next(&row->header_));
1617
0
}
1618
1619
1620
/* Deletes 'row' from table "Bridge".  'row' may be freed, so it must not be
1621
 * accessed afterward.
1622
 *
1623
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1624
void
1625
ovsrec_bridge_delete(const struct ovsrec_bridge *row)
1626
0
{
1627
0
    ovsdb_idl_txn_delete(&row->header_);
1628
0
}
1629
1630
/* Inserts and returns a new row in the table "Bridge" in the database
1631
 * with open transaction 'txn'.
1632
 *
1633
 * The new row is assigned a randomly generated provisional UUID.
1634
 * ovsdb-server will assign a different UUID when 'txn' is committed,
1635
 * but the IDL will replace any uses of the provisional UUID in the
1636
 * data to be to be committed by the UUID assigned by ovsdb-server. */
1637
struct ovsrec_bridge *
1638
ovsrec_bridge_insert(struct ovsdb_idl_txn *txn)
1639
0
{
1640
0
    return ovsrec_bridge_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_bridge, NULL));
1641
0
}
1642
1643
/* Inserts and returns a new row in the table "Bridge" in the database
1644
 * with open transaction 'txn'.
1645
 *
1646
 * The new row is assigned the UUID specified in the 'uuid' parameter
1647
 * (which cannot be null).  ovsdb-server will try to assign the same
1648
 * UUID when 'txn' is committed. */
1649
struct ovsrec_bridge *
1650
ovsrec_bridge_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
1651
0
{
1652
0
    return ovsrec_bridge_cast(ovsdb_idl_txn_insert_persist_uuid(
1653
0
        txn, &ovsrec_table_bridge, uuid));
1654
0
}
1655
1656
bool
1657
ovsrec_bridge_is_updated(const struct ovsrec_bridge *row, enum ovsrec_bridge_column_id column)
1658
0
{
1659
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_bridge_columns[column]);
1660
0
}
1661
1662
/* Causes the original contents of column "auto_attach" in 'row' to be
1663
 * verified as a prerequisite to completing the transaction.  That is, if
1664
 * "auto_attach" in 'row' changed (or if 'row' was deleted) between the
1665
 * time that the IDL originally read its contents and the time that the
1666
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1667
 *
1668
 * The intention is that, to ensure that no transaction commits based on dirty
1669
 * reads, an application should call this function any time "auto_attach" is
1670
 * read as part of a read-modify-write operation.
1671
 *
1672
 * In some cases this function reduces to a no-op, because the current value
1673
 * of "auto_attach" is already known:
1674
 *
1675
 *   - If 'row' is a row created by the current transaction (returned by
1676
 *     ovsrec_bridge_insert()).
1677
 *
1678
 *   - If "auto_attach" has already been modified (with
1679
 *     ovsrec_bridge_set_auto_attach()) within the current transaction.
1680
 *
1681
 * Because of the latter property, always call this function *before*
1682
 * ovsrec_bridge_set_auto_attach() for a given read-modify-write.
1683
 *
1684
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1685
void
1686
ovsrec_bridge_verify_auto_attach(const struct ovsrec_bridge *row)
1687
0
{
1688
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_auto_attach);
1689
0
}
1690
1691
/* Causes the original contents of column "controller" in 'row' to be
1692
 * verified as a prerequisite to completing the transaction.  That is, if
1693
 * "controller" in 'row' changed (or if 'row' was deleted) between the
1694
 * time that the IDL originally read its contents and the time that the
1695
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1696
 *
1697
 * The intention is that, to ensure that no transaction commits based on dirty
1698
 * reads, an application should call this function any time "controller" is
1699
 * read as part of a read-modify-write operation.
1700
 *
1701
 * In some cases this function reduces to a no-op, because the current value
1702
 * of "controller" is already known:
1703
 *
1704
 *   - If 'row' is a row created by the current transaction (returned by
1705
 *     ovsrec_bridge_insert()).
1706
 *
1707
 *   - If "controller" has already been modified (with
1708
 *     ovsrec_bridge_set_controller()) within the current transaction.
1709
 *
1710
 * Because of the latter property, always call this function *before*
1711
 * ovsrec_bridge_set_controller() for a given read-modify-write.
1712
 *
1713
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1714
void
1715
ovsrec_bridge_verify_controller(const struct ovsrec_bridge *row)
1716
0
{
1717
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_controller);
1718
0
}
1719
1720
/* Causes the original contents of column "datapath_id" in 'row' to be
1721
 * verified as a prerequisite to completing the transaction.  That is, if
1722
 * "datapath_id" in 'row' changed (or if 'row' was deleted) between the
1723
 * time that the IDL originally read its contents and the time that the
1724
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1725
 *
1726
 * The intention is that, to ensure that no transaction commits based on dirty
1727
 * reads, an application should call this function any time "datapath_id" is
1728
 * read as part of a read-modify-write operation.
1729
 *
1730
 * In some cases this function reduces to a no-op, because the current value
1731
 * of "datapath_id" is already known:
1732
 *
1733
 *   - If 'row' is a row created by the current transaction (returned by
1734
 *     ovsrec_bridge_insert()).
1735
 *
1736
 *   - If "datapath_id" has already been modified (with
1737
 *     ovsrec_bridge_set_datapath_id()) within the current transaction.
1738
 *
1739
 * Because of the latter property, always call this function *before*
1740
 * ovsrec_bridge_set_datapath_id() for a given read-modify-write.
1741
 *
1742
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1743
void
1744
ovsrec_bridge_verify_datapath_id(const struct ovsrec_bridge *row)
1745
0
{
1746
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_datapath_id);
1747
0
}
1748
1749
/* Causes the original contents of column "datapath_type" in 'row' to be
1750
 * verified as a prerequisite to completing the transaction.  That is, if
1751
 * "datapath_type" in 'row' changed (or if 'row' was deleted) between the
1752
 * time that the IDL originally read its contents and the time that the
1753
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1754
 *
1755
 * The intention is that, to ensure that no transaction commits based on dirty
1756
 * reads, an application should call this function any time "datapath_type" is
1757
 * read as part of a read-modify-write operation.
1758
 *
1759
 * In some cases this function reduces to a no-op, because the current value
1760
 * of "datapath_type" is already known:
1761
 *
1762
 *   - If 'row' is a row created by the current transaction (returned by
1763
 *     ovsrec_bridge_insert()).
1764
 *
1765
 *   - If "datapath_type" has already been modified (with
1766
 *     ovsrec_bridge_set_datapath_type()) within the current transaction.
1767
 *
1768
 * Because of the latter property, always call this function *before*
1769
 * ovsrec_bridge_set_datapath_type() for a given read-modify-write.
1770
 *
1771
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1772
void
1773
ovsrec_bridge_verify_datapath_type(const struct ovsrec_bridge *row)
1774
0
{
1775
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_datapath_type);
1776
0
}
1777
1778
/* Causes the original contents of column "datapath_version" in 'row' to be
1779
 * verified as a prerequisite to completing the transaction.  That is, if
1780
 * "datapath_version" in 'row' changed (or if 'row' was deleted) between the
1781
 * time that the IDL originally read its contents and the time that the
1782
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1783
 *
1784
 * The intention is that, to ensure that no transaction commits based on dirty
1785
 * reads, an application should call this function any time "datapath_version" is
1786
 * read as part of a read-modify-write operation.
1787
 *
1788
 * In some cases this function reduces to a no-op, because the current value
1789
 * of "datapath_version" is already known:
1790
 *
1791
 *   - If 'row' is a row created by the current transaction (returned by
1792
 *     ovsrec_bridge_insert()).
1793
 *
1794
 *   - If "datapath_version" has already been modified (with
1795
 *     ovsrec_bridge_set_datapath_version()) within the current transaction.
1796
 *
1797
 * Because of the latter property, always call this function *before*
1798
 * ovsrec_bridge_set_datapath_version() for a given read-modify-write.
1799
 *
1800
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1801
void
1802
ovsrec_bridge_verify_datapath_version(const struct ovsrec_bridge *row)
1803
0
{
1804
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_datapath_version);
1805
0
}
1806
1807
/* Causes the original contents of column "external_ids" in 'row' to be
1808
 * verified as a prerequisite to completing the transaction.  That is, if
1809
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
1810
 * time that the IDL originally read its contents and the time that the
1811
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1812
 *
1813
 * The intention is that, to ensure that no transaction commits based on dirty
1814
 * reads, an application should call this function any time "external_ids" is
1815
 * read as part of a read-modify-write operation.
1816
 *
1817
 * In some cases this function reduces to a no-op, because the current value
1818
 * of "external_ids" is already known:
1819
 *
1820
 *   - If 'row' is a row created by the current transaction (returned by
1821
 *     ovsrec_bridge_insert()).
1822
 *
1823
 *   - If "external_ids" has already been modified (with
1824
 *     ovsrec_bridge_set_external_ids()) within the current transaction.
1825
 *
1826
 * Because of the latter property, always call this function *before*
1827
 * ovsrec_bridge_set_external_ids() for a given read-modify-write.
1828
 *
1829
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1830
void
1831
ovsrec_bridge_verify_external_ids(const struct ovsrec_bridge *row)
1832
0
{
1833
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_external_ids);
1834
0
}
1835
1836
/* Causes the original contents of column "fail_mode" in 'row' to be
1837
 * verified as a prerequisite to completing the transaction.  That is, if
1838
 * "fail_mode" in 'row' changed (or if 'row' was deleted) between the
1839
 * time that the IDL originally read its contents and the time that the
1840
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1841
 *
1842
 * The intention is that, to ensure that no transaction commits based on dirty
1843
 * reads, an application should call this function any time "fail_mode" is
1844
 * read as part of a read-modify-write operation.
1845
 *
1846
 * In some cases this function reduces to a no-op, because the current value
1847
 * of "fail_mode" is already known:
1848
 *
1849
 *   - If 'row' is a row created by the current transaction (returned by
1850
 *     ovsrec_bridge_insert()).
1851
 *
1852
 *   - If "fail_mode" has already been modified (with
1853
 *     ovsrec_bridge_set_fail_mode()) within the current transaction.
1854
 *
1855
 * Because of the latter property, always call this function *before*
1856
 * ovsrec_bridge_set_fail_mode() for a given read-modify-write.
1857
 *
1858
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1859
void
1860
ovsrec_bridge_verify_fail_mode(const struct ovsrec_bridge *row)
1861
0
{
1862
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_fail_mode);
1863
0
}
1864
1865
/* Causes the original contents of column "flood_vlans" in 'row' to be
1866
 * verified as a prerequisite to completing the transaction.  That is, if
1867
 * "flood_vlans" in 'row' changed (or if 'row' was deleted) between the
1868
 * time that the IDL originally read its contents and the time that the
1869
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1870
 *
1871
 * The intention is that, to ensure that no transaction commits based on dirty
1872
 * reads, an application should call this function any time "flood_vlans" is
1873
 * read as part of a read-modify-write operation.
1874
 *
1875
 * In some cases this function reduces to a no-op, because the current value
1876
 * of "flood_vlans" is already known:
1877
 *
1878
 *   - If 'row' is a row created by the current transaction (returned by
1879
 *     ovsrec_bridge_insert()).
1880
 *
1881
 *   - If "flood_vlans" has already been modified (with
1882
 *     ovsrec_bridge_set_flood_vlans()) within the current transaction.
1883
 *
1884
 * Because of the latter property, always call this function *before*
1885
 * ovsrec_bridge_set_flood_vlans() for a given read-modify-write.
1886
 *
1887
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1888
void
1889
ovsrec_bridge_verify_flood_vlans(const struct ovsrec_bridge *row)
1890
0
{
1891
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_flood_vlans);
1892
0
}
1893
1894
/* Causes the original contents of column "flow_tables" in 'row' to be
1895
 * verified as a prerequisite to completing the transaction.  That is, if
1896
 * "flow_tables" in 'row' changed (or if 'row' was deleted) between the
1897
 * time that the IDL originally read its contents and the time that the
1898
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1899
 *
1900
 * The intention is that, to ensure that no transaction commits based on dirty
1901
 * reads, an application should call this function any time "flow_tables" is
1902
 * read as part of a read-modify-write operation.
1903
 *
1904
 * In some cases this function reduces to a no-op, because the current value
1905
 * of "flow_tables" is already known:
1906
 *
1907
 *   - If 'row' is a row created by the current transaction (returned by
1908
 *     ovsrec_bridge_insert()).
1909
 *
1910
 *   - If "flow_tables" has already been modified (with
1911
 *     ovsrec_bridge_set_flow_tables()) within the current transaction.
1912
 *
1913
 * Because of the latter property, always call this function *before*
1914
 * ovsrec_bridge_set_flow_tables() for a given read-modify-write.
1915
 *
1916
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1917
void
1918
ovsrec_bridge_verify_flow_tables(const struct ovsrec_bridge *row)
1919
0
{
1920
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_flow_tables);
1921
0
}
1922
1923
/* Causes the original contents of column "ipfix" in 'row' to be
1924
 * verified as a prerequisite to completing the transaction.  That is, if
1925
 * "ipfix" in 'row' changed (or if 'row' was deleted) between the
1926
 * time that the IDL originally read its contents and the time that the
1927
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1928
 *
1929
 * The intention is that, to ensure that no transaction commits based on dirty
1930
 * reads, an application should call this function any time "ipfix" is
1931
 * read as part of a read-modify-write operation.
1932
 *
1933
 * In some cases this function reduces to a no-op, because the current value
1934
 * of "ipfix" is already known:
1935
 *
1936
 *   - If 'row' is a row created by the current transaction (returned by
1937
 *     ovsrec_bridge_insert()).
1938
 *
1939
 *   - If "ipfix" has already been modified (with
1940
 *     ovsrec_bridge_set_ipfix()) within the current transaction.
1941
 *
1942
 * Because of the latter property, always call this function *before*
1943
 * ovsrec_bridge_set_ipfix() for a given read-modify-write.
1944
 *
1945
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1946
void
1947
ovsrec_bridge_verify_ipfix(const struct ovsrec_bridge *row)
1948
0
{
1949
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_ipfix);
1950
0
}
1951
1952
/* Causes the original contents of column "mcast_snooping_enable" in 'row' to be
1953
 * verified as a prerequisite to completing the transaction.  That is, if
1954
 * "mcast_snooping_enable" in 'row' changed (or if 'row' was deleted) between the
1955
 * time that the IDL originally read its contents and the time that the
1956
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1957
 *
1958
 * The intention is that, to ensure that no transaction commits based on dirty
1959
 * reads, an application should call this function any time "mcast_snooping_enable" is
1960
 * read as part of a read-modify-write operation.
1961
 *
1962
 * In some cases this function reduces to a no-op, because the current value
1963
 * of "mcast_snooping_enable" is already known:
1964
 *
1965
 *   - If 'row' is a row created by the current transaction (returned by
1966
 *     ovsrec_bridge_insert()).
1967
 *
1968
 *   - If "mcast_snooping_enable" has already been modified (with
1969
 *     ovsrec_bridge_set_mcast_snooping_enable()) within the current transaction.
1970
 *
1971
 * Because of the latter property, always call this function *before*
1972
 * ovsrec_bridge_set_mcast_snooping_enable() for a given read-modify-write.
1973
 *
1974
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
1975
void
1976
ovsrec_bridge_verify_mcast_snooping_enable(const struct ovsrec_bridge *row)
1977
0
{
1978
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_mcast_snooping_enable);
1979
0
}
1980
1981
/* Causes the original contents of column "mirrors" in 'row' to be
1982
 * verified as a prerequisite to completing the transaction.  That is, if
1983
 * "mirrors" in 'row' changed (or if 'row' was deleted) between the
1984
 * time that the IDL originally read its contents and the time that the
1985
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
1986
 *
1987
 * The intention is that, to ensure that no transaction commits based on dirty
1988
 * reads, an application should call this function any time "mirrors" is
1989
 * read as part of a read-modify-write operation.
1990
 *
1991
 * In some cases this function reduces to a no-op, because the current value
1992
 * of "mirrors" is already known:
1993
 *
1994
 *   - If 'row' is a row created by the current transaction (returned by
1995
 *     ovsrec_bridge_insert()).
1996
 *
1997
 *   - If "mirrors" has already been modified (with
1998
 *     ovsrec_bridge_set_mirrors()) within the current transaction.
1999
 *
2000
 * Because of the latter property, always call this function *before*
2001
 * ovsrec_bridge_set_mirrors() for a given read-modify-write.
2002
 *
2003
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2004
void
2005
ovsrec_bridge_verify_mirrors(const struct ovsrec_bridge *row)
2006
0
{
2007
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_mirrors);
2008
0
}
2009
2010
/* Causes the original contents of column "name" in 'row' to be
2011
 * verified as a prerequisite to completing the transaction.  That is, if
2012
 * "name" in 'row' changed (or if 'row' was deleted) between the
2013
 * time that the IDL originally read its contents and the time that the
2014
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2015
 *
2016
 * The intention is that, to ensure that no transaction commits based on dirty
2017
 * reads, an application should call this function any time "name" is
2018
 * read as part of a read-modify-write operation.
2019
 *
2020
 * In some cases this function reduces to a no-op, because the current value
2021
 * of "name" is already known:
2022
 *
2023
 *   - If 'row' is a row created by the current transaction (returned by
2024
 *     ovsrec_bridge_insert()).
2025
 *
2026
 *   - If "name" has already been modified (with
2027
 *     ovsrec_bridge_set_name()) within the current transaction.
2028
 *
2029
 * Because of the latter property, always call this function *before*
2030
 * ovsrec_bridge_set_name() for a given read-modify-write.
2031
 *
2032
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2033
void
2034
ovsrec_bridge_verify_name(const struct ovsrec_bridge *row)
2035
0
{
2036
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_name);
2037
0
}
2038
2039
/* Causes the original contents of column "netflow" in 'row' to be
2040
 * verified as a prerequisite to completing the transaction.  That is, if
2041
 * "netflow" in 'row' changed (or if 'row' was deleted) between the
2042
 * time that the IDL originally read its contents and the time that the
2043
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2044
 *
2045
 * The intention is that, to ensure that no transaction commits based on dirty
2046
 * reads, an application should call this function any time "netflow" is
2047
 * read as part of a read-modify-write operation.
2048
 *
2049
 * In some cases this function reduces to a no-op, because the current value
2050
 * of "netflow" is already known:
2051
 *
2052
 *   - If 'row' is a row created by the current transaction (returned by
2053
 *     ovsrec_bridge_insert()).
2054
 *
2055
 *   - If "netflow" has already been modified (with
2056
 *     ovsrec_bridge_set_netflow()) within the current transaction.
2057
 *
2058
 * Because of the latter property, always call this function *before*
2059
 * ovsrec_bridge_set_netflow() for a given read-modify-write.
2060
 *
2061
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2062
void
2063
ovsrec_bridge_verify_netflow(const struct ovsrec_bridge *row)
2064
0
{
2065
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_netflow);
2066
0
}
2067
2068
/* Causes the original contents of column "other_config" in 'row' to be
2069
 * verified as a prerequisite to completing the transaction.  That is, if
2070
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
2071
 * time that the IDL originally read its contents and the time that the
2072
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2073
 *
2074
 * The intention is that, to ensure that no transaction commits based on dirty
2075
 * reads, an application should call this function any time "other_config" is
2076
 * read as part of a read-modify-write operation.
2077
 *
2078
 * In some cases this function reduces to a no-op, because the current value
2079
 * of "other_config" is already known:
2080
 *
2081
 *   - If 'row' is a row created by the current transaction (returned by
2082
 *     ovsrec_bridge_insert()).
2083
 *
2084
 *   - If "other_config" has already been modified (with
2085
 *     ovsrec_bridge_set_other_config()) within the current transaction.
2086
 *
2087
 * Because of the latter property, always call this function *before*
2088
 * ovsrec_bridge_set_other_config() for a given read-modify-write.
2089
 *
2090
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2091
void
2092
ovsrec_bridge_verify_other_config(const struct ovsrec_bridge *row)
2093
0
{
2094
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_other_config);
2095
0
}
2096
2097
/* Causes the original contents of column "ports" in 'row' to be
2098
 * verified as a prerequisite to completing the transaction.  That is, if
2099
 * "ports" in 'row' changed (or if 'row' was deleted) between the
2100
 * time that the IDL originally read its contents and the time that the
2101
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2102
 *
2103
 * The intention is that, to ensure that no transaction commits based on dirty
2104
 * reads, an application should call this function any time "ports" is
2105
 * read as part of a read-modify-write operation.
2106
 *
2107
 * In some cases this function reduces to a no-op, because the current value
2108
 * of "ports" is already known:
2109
 *
2110
 *   - If 'row' is a row created by the current transaction (returned by
2111
 *     ovsrec_bridge_insert()).
2112
 *
2113
 *   - If "ports" has already been modified (with
2114
 *     ovsrec_bridge_set_ports()) within the current transaction.
2115
 *
2116
 * Because of the latter property, always call this function *before*
2117
 * ovsrec_bridge_set_ports() for a given read-modify-write.
2118
 *
2119
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2120
void
2121
ovsrec_bridge_verify_ports(const struct ovsrec_bridge *row)
2122
0
{
2123
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_ports);
2124
0
}
2125
2126
/* Causes the original contents of column "protocols" in 'row' to be
2127
 * verified as a prerequisite to completing the transaction.  That is, if
2128
 * "protocols" in 'row' changed (or if 'row' was deleted) between the
2129
 * time that the IDL originally read its contents and the time that the
2130
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2131
 *
2132
 * The intention is that, to ensure that no transaction commits based on dirty
2133
 * reads, an application should call this function any time "protocols" is
2134
 * read as part of a read-modify-write operation.
2135
 *
2136
 * In some cases this function reduces to a no-op, because the current value
2137
 * of "protocols" is already known:
2138
 *
2139
 *   - If 'row' is a row created by the current transaction (returned by
2140
 *     ovsrec_bridge_insert()).
2141
 *
2142
 *   - If "protocols" has already been modified (with
2143
 *     ovsrec_bridge_set_protocols()) within the current transaction.
2144
 *
2145
 * Because of the latter property, always call this function *before*
2146
 * ovsrec_bridge_set_protocols() for a given read-modify-write.
2147
 *
2148
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2149
void
2150
ovsrec_bridge_verify_protocols(const struct ovsrec_bridge *row)
2151
0
{
2152
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_protocols);
2153
0
}
2154
2155
/* Causes the original contents of column "rstp_enable" in 'row' to be
2156
 * verified as a prerequisite to completing the transaction.  That is, if
2157
 * "rstp_enable" in 'row' changed (or if 'row' was deleted) between the
2158
 * time that the IDL originally read its contents and the time that the
2159
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2160
 *
2161
 * The intention is that, to ensure that no transaction commits based on dirty
2162
 * reads, an application should call this function any time "rstp_enable" is
2163
 * read as part of a read-modify-write operation.
2164
 *
2165
 * In some cases this function reduces to a no-op, because the current value
2166
 * of "rstp_enable" is already known:
2167
 *
2168
 *   - If 'row' is a row created by the current transaction (returned by
2169
 *     ovsrec_bridge_insert()).
2170
 *
2171
 *   - If "rstp_enable" has already been modified (with
2172
 *     ovsrec_bridge_set_rstp_enable()) within the current transaction.
2173
 *
2174
 * Because of the latter property, always call this function *before*
2175
 * ovsrec_bridge_set_rstp_enable() for a given read-modify-write.
2176
 *
2177
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2178
void
2179
ovsrec_bridge_verify_rstp_enable(const struct ovsrec_bridge *row)
2180
0
{
2181
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_rstp_enable);
2182
0
}
2183
2184
/* Causes the original contents of column "rstp_status" in 'row' to be
2185
 * verified as a prerequisite to completing the transaction.  That is, if
2186
 * "rstp_status" in 'row' changed (or if 'row' was deleted) between the
2187
 * time that the IDL originally read its contents and the time that the
2188
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2189
 *
2190
 * The intention is that, to ensure that no transaction commits based on dirty
2191
 * reads, an application should call this function any time "rstp_status" is
2192
 * read as part of a read-modify-write operation.
2193
 *
2194
 * In some cases this function reduces to a no-op, because the current value
2195
 * of "rstp_status" is already known:
2196
 *
2197
 *   - If 'row' is a row created by the current transaction (returned by
2198
 *     ovsrec_bridge_insert()).
2199
 *
2200
 *   - If "rstp_status" has already been modified (with
2201
 *     ovsrec_bridge_set_rstp_status()) within the current transaction.
2202
 *
2203
 * Because of the latter property, always call this function *before*
2204
 * ovsrec_bridge_set_rstp_status() for a given read-modify-write.
2205
 *
2206
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2207
void
2208
ovsrec_bridge_verify_rstp_status(const struct ovsrec_bridge *row)
2209
0
{
2210
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_rstp_status);
2211
0
}
2212
2213
/* Causes the original contents of column "sflow" in 'row' to be
2214
 * verified as a prerequisite to completing the transaction.  That is, if
2215
 * "sflow" in 'row' changed (or if 'row' was deleted) between the
2216
 * time that the IDL originally read its contents and the time that the
2217
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2218
 *
2219
 * The intention is that, to ensure that no transaction commits based on dirty
2220
 * reads, an application should call this function any time "sflow" is
2221
 * read as part of a read-modify-write operation.
2222
 *
2223
 * In some cases this function reduces to a no-op, because the current value
2224
 * of "sflow" is already known:
2225
 *
2226
 *   - If 'row' is a row created by the current transaction (returned by
2227
 *     ovsrec_bridge_insert()).
2228
 *
2229
 *   - If "sflow" has already been modified (with
2230
 *     ovsrec_bridge_set_sflow()) within the current transaction.
2231
 *
2232
 * Because of the latter property, always call this function *before*
2233
 * ovsrec_bridge_set_sflow() for a given read-modify-write.
2234
 *
2235
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2236
void
2237
ovsrec_bridge_verify_sflow(const struct ovsrec_bridge *row)
2238
0
{
2239
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_sflow);
2240
0
}
2241
2242
/* Causes the original contents of column "status" in 'row' to be
2243
 * verified as a prerequisite to completing the transaction.  That is, if
2244
 * "status" in 'row' changed (or if 'row' was deleted) between the
2245
 * time that the IDL originally read its contents and the time that the
2246
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2247
 *
2248
 * The intention is that, to ensure that no transaction commits based on dirty
2249
 * reads, an application should call this function any time "status" is
2250
 * read as part of a read-modify-write operation.
2251
 *
2252
 * In some cases this function reduces to a no-op, because the current value
2253
 * of "status" is already known:
2254
 *
2255
 *   - If 'row' is a row created by the current transaction (returned by
2256
 *     ovsrec_bridge_insert()).
2257
 *
2258
 *   - If "status" has already been modified (with
2259
 *     ovsrec_bridge_set_status()) within the current transaction.
2260
 *
2261
 * Because of the latter property, always call this function *before*
2262
 * ovsrec_bridge_set_status() for a given read-modify-write.
2263
 *
2264
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2265
void
2266
ovsrec_bridge_verify_status(const struct ovsrec_bridge *row)
2267
0
{
2268
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_status);
2269
0
}
2270
2271
/* Causes the original contents of column "stp_enable" in 'row' to be
2272
 * verified as a prerequisite to completing the transaction.  That is, if
2273
 * "stp_enable" in 'row' changed (or if 'row' was deleted) between the
2274
 * time that the IDL originally read its contents and the time that the
2275
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
2276
 *
2277
 * The intention is that, to ensure that no transaction commits based on dirty
2278
 * reads, an application should call this function any time "stp_enable" is
2279
 * read as part of a read-modify-write operation.
2280
 *
2281
 * In some cases this function reduces to a no-op, because the current value
2282
 * of "stp_enable" is already known:
2283
 *
2284
 *   - If 'row' is a row created by the current transaction (returned by
2285
 *     ovsrec_bridge_insert()).
2286
 *
2287
 *   - If "stp_enable" has already been modified (with
2288
 *     ovsrec_bridge_set_stp_enable()) within the current transaction.
2289
 *
2290
 * Because of the latter property, always call this function *before*
2291
 * ovsrec_bridge_set_stp_enable() for a given read-modify-write.
2292
 *
2293
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
2294
void
2295
ovsrec_bridge_verify_stp_enable(const struct ovsrec_bridge *row)
2296
0
{
2297
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_col_stp_enable);
2298
0
}
2299
2300
/* Returns the "auto_attach" column's value from the "Bridge" table in 'row'
2301
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2302
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2303
 * for a given key than implementing the same operation on the "cooked"
2304
 * form in 'row'.
2305
 *
2306
 * 'key_type' must be OVSDB_TYPE_UUID.
2307
 * (This helps to avoid silent bugs if someone changes auto_attach's
2308
 * type without updating the caller.)
2309
 *
2310
 * The caller must not modify or free the returned value.
2311
 *
2312
 * Various kinds of changes can invalidate the returned value: modifying
2313
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2314
 * If the returned value is needed for a long time, it is best to make a copy
2315
 * of it with ovsdb_datum_clone().
2316
 *
2317
 * This function is rarely useful, since it is easier to access the value
2318
 * directly through the "auto_attach" member in ovsrec_bridge. */
2319
const struct ovsdb_datum *
2320
ovsrec_bridge_get_auto_attach(const struct ovsrec_bridge *row,
2321
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2322
0
{
2323
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2324
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_auto_attach);
2325
0
}
2326
2327
/* Returns the "controller" column's value from the "Bridge" table in 'row'
2328
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2329
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2330
 * for a given key than implementing the same operation on the "cooked"
2331
 * form in 'row'.
2332
 *
2333
 * 'key_type' must be OVSDB_TYPE_UUID.
2334
 * (This helps to avoid silent bugs if someone changes controller's
2335
 * type without updating the caller.)
2336
 *
2337
 * The caller must not modify or free the returned value.
2338
 *
2339
 * Various kinds of changes can invalidate the returned value: modifying
2340
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2341
 * If the returned value is needed for a long time, it is best to make a copy
2342
 * of it with ovsdb_datum_clone().
2343
 *
2344
 * This function is rarely useful, since it is easier to access the value
2345
 * directly through the "controller" member in ovsrec_bridge. */
2346
const struct ovsdb_datum *
2347
ovsrec_bridge_get_controller(const struct ovsrec_bridge *row,
2348
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2349
0
{
2350
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2351
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_controller);
2352
0
}
2353
2354
/* Returns the "datapath_id" column's value from the "Bridge" table in 'row'
2355
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2356
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2357
 * for a given key than implementing the same operation on the "cooked"
2358
 * form in 'row'.
2359
 *
2360
 * 'key_type' must be OVSDB_TYPE_STRING.
2361
 * (This helps to avoid silent bugs if someone changes datapath_id's
2362
 * type without updating the caller.)
2363
 *
2364
 * The caller must not modify or free the returned value.
2365
 *
2366
 * Various kinds of changes can invalidate the returned value: modifying
2367
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2368
 * If the returned value is needed for a long time, it is best to make a copy
2369
 * of it with ovsdb_datum_clone().
2370
 *
2371
 * This function is rarely useful, since it is easier to access the value
2372
 * directly through the "datapath_id" member in ovsrec_bridge. */
2373
const struct ovsdb_datum *
2374
ovsrec_bridge_get_datapath_id(const struct ovsrec_bridge *row,
2375
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2376
0
{
2377
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2378
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_datapath_id);
2379
0
}
2380
2381
/* Returns the "datapath_type" column's value from the "Bridge" table in 'row'
2382
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2383
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2384
 * for a given key than implementing the same operation on the "cooked"
2385
 * form in 'row'.
2386
 *
2387
 * 'key_type' must be OVSDB_TYPE_STRING.
2388
 * (This helps to avoid silent bugs if someone changes datapath_type's
2389
 * type without updating the caller.)
2390
 *
2391
 * The caller must not modify or free the returned value.
2392
 *
2393
 * Various kinds of changes can invalidate the returned value: modifying
2394
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2395
 * If the returned value is needed for a long time, it is best to make a copy
2396
 * of it with ovsdb_datum_clone().
2397
 *
2398
 * This function is rarely useful, since it is easier to access the value
2399
 * directly through the "datapath_type" member in ovsrec_bridge. */
2400
const struct ovsdb_datum *
2401
ovsrec_bridge_get_datapath_type(const struct ovsrec_bridge *row,
2402
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2403
0
{
2404
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2405
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_datapath_type);
2406
0
}
2407
2408
/* Returns the "datapath_version" column's value from the "Bridge" table in 'row'
2409
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2410
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2411
 * for a given key than implementing the same operation on the "cooked"
2412
 * form in 'row'.
2413
 *
2414
 * 'key_type' must be OVSDB_TYPE_STRING.
2415
 * (This helps to avoid silent bugs if someone changes datapath_version's
2416
 * type without updating the caller.)
2417
 *
2418
 * The caller must not modify or free the returned value.
2419
 *
2420
 * Various kinds of changes can invalidate the returned value: modifying
2421
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2422
 * If the returned value is needed for a long time, it is best to make a copy
2423
 * of it with ovsdb_datum_clone().
2424
 *
2425
 * This function is rarely useful, since it is easier to access the value
2426
 * directly through the "datapath_version" member in ovsrec_bridge. */
2427
const struct ovsdb_datum *
2428
ovsrec_bridge_get_datapath_version(const struct ovsrec_bridge *row,
2429
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2430
0
{
2431
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2432
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_datapath_version);
2433
0
}
2434
2435
/* Returns the "external_ids" column's value from the "Bridge" table in 'row'
2436
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2437
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2438
 * for a given key than implementing the same operation on the "cooked"
2439
 * form in 'row'.
2440
 *
2441
 * 'key_type' must be OVSDB_TYPE_STRING.
2442
 * 'value_type' must be OVSDB_TYPE_STRING.
2443
 * (This helps to avoid silent bugs if someone changes external_ids's
2444
 * type without updating the caller.)
2445
 *
2446
 * The caller must not modify or free the returned value.
2447
 *
2448
 * Various kinds of changes can invalidate the returned value: modifying
2449
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2450
 * If the returned value is needed for a long time, it is best to make a copy
2451
 * of it with ovsdb_datum_clone().
2452
 *
2453
 * This function is rarely useful, since it is easier to access the value
2454
 * directly through the "external_ids" member in ovsrec_bridge. */
2455
const struct ovsdb_datum *
2456
ovsrec_bridge_get_external_ids(const struct ovsrec_bridge *row,
2457
  enum ovsdb_atomic_type key_type OVS_UNUSED,
2458
  enum ovsdb_atomic_type value_type OVS_UNUSED)
2459
0
{
2460
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2461
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
2462
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_external_ids);
2463
0
}
2464
2465
/* Returns the "fail_mode" column's value from the "Bridge" table in 'row'
2466
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2467
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2468
 * for a given key than implementing the same operation on the "cooked"
2469
 * form in 'row'.
2470
 *
2471
 * 'key_type' must be OVSDB_TYPE_STRING.
2472
 * (This helps to avoid silent bugs if someone changes fail_mode's
2473
 * type without updating the caller.)
2474
 *
2475
 * The caller must not modify or free the returned value.
2476
 *
2477
 * Various kinds of changes can invalidate the returned value: modifying
2478
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2479
 * If the returned value is needed for a long time, it is best to make a copy
2480
 * of it with ovsdb_datum_clone().
2481
 *
2482
 * This function is rarely useful, since it is easier to access the value
2483
 * directly through the "fail_mode" member in ovsrec_bridge. */
2484
const struct ovsdb_datum *
2485
ovsrec_bridge_get_fail_mode(const struct ovsrec_bridge *row,
2486
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2487
0
{
2488
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2489
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_fail_mode);
2490
0
}
2491
2492
/* Returns the "flood_vlans" column's value from the "Bridge" table in 'row'
2493
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2494
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2495
 * for a given key than implementing the same operation on the "cooked"
2496
 * form in 'row'.
2497
 *
2498
 * 'key_type' must be OVSDB_TYPE_INTEGER.
2499
 * (This helps to avoid silent bugs if someone changes flood_vlans's
2500
 * type without updating the caller.)
2501
 *
2502
 * The caller must not modify or free the returned value.
2503
 *
2504
 * Various kinds of changes can invalidate the returned value: modifying
2505
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2506
 * If the returned value is needed for a long time, it is best to make a copy
2507
 * of it with ovsdb_datum_clone().
2508
 *
2509
 * This function is rarely useful, since it is easier to access the value
2510
 * directly through the "flood_vlans" member in ovsrec_bridge. */
2511
const struct ovsdb_datum *
2512
ovsrec_bridge_get_flood_vlans(const struct ovsrec_bridge *row,
2513
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2514
0
{
2515
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2516
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_flood_vlans);
2517
0
}
2518
2519
/* Returns the "flow_tables" column's value from the "Bridge" table in 'row'
2520
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2521
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2522
 * for a given key than implementing the same operation on the "cooked"
2523
 * form in 'row'.
2524
 *
2525
 * 'key_type' must be OVSDB_TYPE_INTEGER.
2526
 * 'value_type' must be OVSDB_TYPE_UUID.
2527
 * (This helps to avoid silent bugs if someone changes flow_tables's
2528
 * type without updating the caller.)
2529
 *
2530
 * The caller must not modify or free the returned value.
2531
 *
2532
 * Various kinds of changes can invalidate the returned value: modifying
2533
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2534
 * If the returned value is needed for a long time, it is best to make a copy
2535
 * of it with ovsdb_datum_clone().
2536
 *
2537
 * This function is rarely useful, since it is easier to access the value
2538
 * directly through the "flow_tables" member in ovsrec_bridge. */
2539
const struct ovsdb_datum *
2540
ovsrec_bridge_get_flow_tables(const struct ovsrec_bridge *row,
2541
  enum ovsdb_atomic_type key_type OVS_UNUSED,
2542
  enum ovsdb_atomic_type value_type OVS_UNUSED)
2543
0
{
2544
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2545
0
    ovs_assert(value_type == OVSDB_TYPE_UUID);
2546
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_flow_tables);
2547
0
}
2548
2549
/* Returns the "ipfix" column's value from the "Bridge" table in 'row'
2550
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2551
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2552
 * for a given key than implementing the same operation on the "cooked"
2553
 * form in 'row'.
2554
 *
2555
 * 'key_type' must be OVSDB_TYPE_UUID.
2556
 * (This helps to avoid silent bugs if someone changes ipfix's
2557
 * type without updating the caller.)
2558
 *
2559
 * The caller must not modify or free the returned value.
2560
 *
2561
 * Various kinds of changes can invalidate the returned value: modifying
2562
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2563
 * If the returned value is needed for a long time, it is best to make a copy
2564
 * of it with ovsdb_datum_clone().
2565
 *
2566
 * This function is rarely useful, since it is easier to access the value
2567
 * directly through the "ipfix" member in ovsrec_bridge. */
2568
const struct ovsdb_datum *
2569
ovsrec_bridge_get_ipfix(const struct ovsrec_bridge *row,
2570
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2571
0
{
2572
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2573
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_ipfix);
2574
0
}
2575
2576
/* Returns the "mcast_snooping_enable" column's value from the "Bridge" table in 'row'
2577
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2578
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2579
 * for a given key than implementing the same operation on the "cooked"
2580
 * form in 'row'.
2581
 *
2582
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
2583
 * (This helps to avoid silent bugs if someone changes mcast_snooping_enable's
2584
 * type without updating the caller.)
2585
 *
2586
 * The caller must not modify or free the returned value.
2587
 *
2588
 * Various kinds of changes can invalidate the returned value: modifying
2589
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2590
 * If the returned value is needed for a long time, it is best to make a copy
2591
 * of it with ovsdb_datum_clone().
2592
 *
2593
 * This function is rarely useful, since it is easier to access the value
2594
 * directly through the "mcast_snooping_enable" member in ovsrec_bridge. */
2595
const struct ovsdb_datum *
2596
ovsrec_bridge_get_mcast_snooping_enable(const struct ovsrec_bridge *row,
2597
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2598
0
{
2599
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
2600
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_mcast_snooping_enable);
2601
0
}
2602
2603
/* Returns the "mirrors" column's value from the "Bridge" table in 'row'
2604
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2605
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2606
 * for a given key than implementing the same operation on the "cooked"
2607
 * form in 'row'.
2608
 *
2609
 * 'key_type' must be OVSDB_TYPE_UUID.
2610
 * (This helps to avoid silent bugs if someone changes mirrors's
2611
 * type without updating the caller.)
2612
 *
2613
 * The caller must not modify or free the returned value.
2614
 *
2615
 * Various kinds of changes can invalidate the returned value: modifying
2616
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2617
 * If the returned value is needed for a long time, it is best to make a copy
2618
 * of it with ovsdb_datum_clone().
2619
 *
2620
 * This function is rarely useful, since it is easier to access the value
2621
 * directly through the "mirrors" member in ovsrec_bridge. */
2622
const struct ovsdb_datum *
2623
ovsrec_bridge_get_mirrors(const struct ovsrec_bridge *row,
2624
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2625
0
{
2626
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2627
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_mirrors);
2628
0
}
2629
2630
/* Returns the "name" column's value from the "Bridge" table in 'row'
2631
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2632
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2633
 * for a given key than implementing the same operation on the "cooked"
2634
 * form in 'row'.
2635
 *
2636
 * 'key_type' must be OVSDB_TYPE_STRING.
2637
 * (This helps to avoid silent bugs if someone changes name's
2638
 * type without updating the caller.)
2639
 *
2640
 * The caller must not modify or free the returned value.
2641
 *
2642
 * Various kinds of changes can invalidate the returned value: modifying
2643
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2644
 * If the returned value is needed for a long time, it is best to make a copy
2645
 * of it with ovsdb_datum_clone().
2646
 *
2647
 * This function is rarely useful, since it is easier to access the value
2648
 * directly through the "name" member in ovsrec_bridge. */
2649
const struct ovsdb_datum *
2650
ovsrec_bridge_get_name(const struct ovsrec_bridge *row,
2651
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2652
0
{
2653
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2654
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_name);
2655
0
}
2656
2657
/* Returns the "netflow" column's value from the "Bridge" table in 'row'
2658
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2659
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2660
 * for a given key than implementing the same operation on the "cooked"
2661
 * form in 'row'.
2662
 *
2663
 * 'key_type' must be OVSDB_TYPE_UUID.
2664
 * (This helps to avoid silent bugs if someone changes netflow's
2665
 * type without updating the caller.)
2666
 *
2667
 * The caller must not modify or free the returned value.
2668
 *
2669
 * Various kinds of changes can invalidate the returned value: modifying
2670
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2671
 * If the returned value is needed for a long time, it is best to make a copy
2672
 * of it with ovsdb_datum_clone().
2673
 *
2674
 * This function is rarely useful, since it is easier to access the value
2675
 * directly through the "netflow" member in ovsrec_bridge. */
2676
const struct ovsdb_datum *
2677
ovsrec_bridge_get_netflow(const struct ovsrec_bridge *row,
2678
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2679
0
{
2680
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2681
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_netflow);
2682
0
}
2683
2684
/* Returns the "other_config" column's value from the "Bridge" table in 'row'
2685
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2686
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2687
 * for a given key than implementing the same operation on the "cooked"
2688
 * form in 'row'.
2689
 *
2690
 * 'key_type' must be OVSDB_TYPE_STRING.
2691
 * 'value_type' must be OVSDB_TYPE_STRING.
2692
 * (This helps to avoid silent bugs if someone changes other_config's
2693
 * type without updating the caller.)
2694
 *
2695
 * The caller must not modify or free the returned value.
2696
 *
2697
 * Various kinds of changes can invalidate the returned value: modifying
2698
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2699
 * If the returned value is needed for a long time, it is best to make a copy
2700
 * of it with ovsdb_datum_clone().
2701
 *
2702
 * This function is rarely useful, since it is easier to access the value
2703
 * directly through the "other_config" member in ovsrec_bridge. */
2704
const struct ovsdb_datum *
2705
ovsrec_bridge_get_other_config(const struct ovsrec_bridge *row,
2706
  enum ovsdb_atomic_type key_type OVS_UNUSED,
2707
  enum ovsdb_atomic_type value_type OVS_UNUSED)
2708
0
{
2709
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2710
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
2711
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_other_config);
2712
0
}
2713
2714
/* Returns the "ports" column's value from the "Bridge" table in 'row'
2715
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2716
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2717
 * for a given key than implementing the same operation on the "cooked"
2718
 * form in 'row'.
2719
 *
2720
 * 'key_type' must be OVSDB_TYPE_UUID.
2721
 * (This helps to avoid silent bugs if someone changes ports's
2722
 * type without updating the caller.)
2723
 *
2724
 * The caller must not modify or free the returned value.
2725
 *
2726
 * Various kinds of changes can invalidate the returned value: modifying
2727
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2728
 * If the returned value is needed for a long time, it is best to make a copy
2729
 * of it with ovsdb_datum_clone().
2730
 *
2731
 * This function is rarely useful, since it is easier to access the value
2732
 * directly through the "ports" member in ovsrec_bridge. */
2733
const struct ovsdb_datum *
2734
ovsrec_bridge_get_ports(const struct ovsrec_bridge *row,
2735
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2736
0
{
2737
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2738
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_ports);
2739
0
}
2740
2741
/* Returns the "protocols" column's value from the "Bridge" table in 'row'
2742
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2743
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2744
 * for a given key than implementing the same operation on the "cooked"
2745
 * form in 'row'.
2746
 *
2747
 * 'key_type' must be OVSDB_TYPE_STRING.
2748
 * (This helps to avoid silent bugs if someone changes protocols's
2749
 * type without updating the caller.)
2750
 *
2751
 * The caller must not modify or free the returned value.
2752
 *
2753
 * Various kinds of changes can invalidate the returned value: modifying
2754
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2755
 * If the returned value is needed for a long time, it is best to make a copy
2756
 * of it with ovsdb_datum_clone().
2757
 *
2758
 * This function is rarely useful, since it is easier to access the value
2759
 * directly through the "protocols" member in ovsrec_bridge. */
2760
const struct ovsdb_datum *
2761
ovsrec_bridge_get_protocols(const struct ovsrec_bridge *row,
2762
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2763
0
{
2764
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2765
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_protocols);
2766
0
}
2767
2768
/* Returns the "rstp_enable" column's value from the "Bridge" table in 'row'
2769
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2770
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2771
 * for a given key than implementing the same operation on the "cooked"
2772
 * form in 'row'.
2773
 *
2774
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
2775
 * (This helps to avoid silent bugs if someone changes rstp_enable's
2776
 * type without updating the caller.)
2777
 *
2778
 * The caller must not modify or free the returned value.
2779
 *
2780
 * Various kinds of changes can invalidate the returned value: modifying
2781
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2782
 * If the returned value is needed for a long time, it is best to make a copy
2783
 * of it with ovsdb_datum_clone().
2784
 *
2785
 * This function is rarely useful, since it is easier to access the value
2786
 * directly through the "rstp_enable" member in ovsrec_bridge. */
2787
const struct ovsdb_datum *
2788
ovsrec_bridge_get_rstp_enable(const struct ovsrec_bridge *row,
2789
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2790
0
{
2791
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
2792
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_rstp_enable);
2793
0
}
2794
2795
/* Returns the "rstp_status" column's value from the "Bridge" table in 'row'
2796
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2797
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2798
 * for a given key than implementing the same operation on the "cooked"
2799
 * form in 'row'.
2800
 *
2801
 * 'key_type' must be OVSDB_TYPE_STRING.
2802
 * 'value_type' must be OVSDB_TYPE_STRING.
2803
 * (This helps to avoid silent bugs if someone changes rstp_status's
2804
 * type without updating the caller.)
2805
 *
2806
 * The caller must not modify or free the returned value.
2807
 *
2808
 * Various kinds of changes can invalidate the returned value: modifying
2809
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2810
 * If the returned value is needed for a long time, it is best to make a copy
2811
 * of it with ovsdb_datum_clone().
2812
 *
2813
 * This function is rarely useful, since it is easier to access the value
2814
 * directly through the "rstp_status" member in ovsrec_bridge. */
2815
const struct ovsdb_datum *
2816
ovsrec_bridge_get_rstp_status(const struct ovsrec_bridge *row,
2817
  enum ovsdb_atomic_type key_type OVS_UNUSED,
2818
  enum ovsdb_atomic_type value_type OVS_UNUSED)
2819
0
{
2820
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2821
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
2822
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_rstp_status);
2823
0
}
2824
2825
/* Returns the "sflow" column's value from the "Bridge" table in 'row'
2826
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2827
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2828
 * for a given key than implementing the same operation on the "cooked"
2829
 * form in 'row'.
2830
 *
2831
 * 'key_type' must be OVSDB_TYPE_UUID.
2832
 * (This helps to avoid silent bugs if someone changes sflow's
2833
 * type without updating the caller.)
2834
 *
2835
 * The caller must not modify or free the returned value.
2836
 *
2837
 * Various kinds of changes can invalidate the returned value: modifying
2838
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2839
 * If the returned value is needed for a long time, it is best to make a copy
2840
 * of it with ovsdb_datum_clone().
2841
 *
2842
 * This function is rarely useful, since it is easier to access the value
2843
 * directly through the "sflow" member in ovsrec_bridge. */
2844
const struct ovsdb_datum *
2845
ovsrec_bridge_get_sflow(const struct ovsrec_bridge *row,
2846
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2847
0
{
2848
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
2849
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_sflow);
2850
0
}
2851
2852
/* Returns the "status" column's value from the "Bridge" table in 'row'
2853
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2854
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2855
 * for a given key than implementing the same operation on the "cooked"
2856
 * form in 'row'.
2857
 *
2858
 * 'key_type' must be OVSDB_TYPE_STRING.
2859
 * 'value_type' must be OVSDB_TYPE_STRING.
2860
 * (This helps to avoid silent bugs if someone changes status's
2861
 * type without updating the caller.)
2862
 *
2863
 * The caller must not modify or free the returned value.
2864
 *
2865
 * Various kinds of changes can invalidate the returned value: modifying
2866
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2867
 * If the returned value is needed for a long time, it is best to make a copy
2868
 * of it with ovsdb_datum_clone().
2869
 *
2870
 * This function is rarely useful, since it is easier to access the value
2871
 * directly through the "status" member in ovsrec_bridge. */
2872
const struct ovsdb_datum *
2873
ovsrec_bridge_get_status(const struct ovsrec_bridge *row,
2874
  enum ovsdb_atomic_type key_type OVS_UNUSED,
2875
  enum ovsdb_atomic_type value_type OVS_UNUSED)
2876
0
{
2877
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2878
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
2879
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_status);
2880
0
}
2881
2882
/* Returns the "stp_enable" column's value from the "Bridge" table in 'row'
2883
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
2884
 * ovsdb_datum_find_key() is an easier and more efficient way to search
2885
 * for a given key than implementing the same operation on the "cooked"
2886
 * form in 'row'.
2887
 *
2888
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
2889
 * (This helps to avoid silent bugs if someone changes stp_enable's
2890
 * type without updating the caller.)
2891
 *
2892
 * The caller must not modify or free the returned value.
2893
 *
2894
 * Various kinds of changes can invalidate the returned value: modifying
2895
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2896
 * If the returned value is needed for a long time, it is best to make a copy
2897
 * of it with ovsdb_datum_clone().
2898
 *
2899
 * This function is rarely useful, since it is easier to access the value
2900
 * directly through the "stp_enable" member in ovsrec_bridge. */
2901
const struct ovsdb_datum *
2902
ovsrec_bridge_get_stp_enable(const struct ovsrec_bridge *row,
2903
  enum ovsdb_atomic_type key_type OVS_UNUSED)
2904
0
{
2905
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
2906
0
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_stp_enable);
2907
0
}
2908
2909
/* Sets the "auto_attach" column from the "Bridge" table in 'row' to
2910
 * the 'auto_attach' set.
2911
 *
2912
 * If "auto_attach" is null, the column will be the empty set,
2913
 * otherwise it will contain the specified value.
2914
 *
2915
 * The caller retains ownership of the arguments. */
2916
void
2917
ovsrec_bridge_set_auto_attach(const struct ovsrec_bridge *row, const struct ovsrec_autoattach *auto_attach)
2918
0
{
2919
0
    struct ovsdb_datum datum;
2920
2921
0
    datum.refcnt = NULL;
2922
2923
0
    if (auto_attach) {
2924
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
2925
0
        datum.n = 1;
2926
0
        datum.keys = key;
2927
0
        key->uuid = auto_attach->header_.uuid;
2928
0
    } else {
2929
0
        datum.n = 0;
2930
0
        datum.keys = NULL;
2931
0
    }
2932
0
    datum.values = NULL;
2933
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_auto_attach, &datum);
2934
0
}
2935
2936
/* Sets the "controller" column from the "Bridge" table in 'row' to
2937
 * the 'controller' set with 'n_controller' entries.
2938
 *
2939
 * The caller retains ownership of the arguments. */
2940
void
2941
ovsrec_bridge_set_controller(const struct ovsrec_bridge *row, struct ovsrec_controller **controller, size_t n_controller)
2942
0
{
2943
0
    struct ovsdb_datum datum;
2944
2945
0
    datum.refcnt = NULL;
2946
2947
0
    datum.n = n_controller;
2948
0
    datum.keys = n_controller ? xmalloc(n_controller * sizeof *datum.keys) : NULL;
2949
0
    datum.values = NULL;
2950
0
    for (size_t i = 0; i < n_controller; i++) {
2951
0
        datum.keys[i].uuid = controller[i]->header_.uuid;
2952
0
    }
2953
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_controller, &datum);
2954
0
}
2955
2956
/* Sets the "datapath_id" column from the "Bridge" table in 'row' to
2957
 * the 'datapath_id' set.
2958
 *
2959
 * If "datapath_id" is null, the column will be the empty set,
2960
 * otherwise it will contain the specified value.
2961
 *
2962
 * The caller retains ownership of the arguments. */
2963
void
2964
ovsrec_bridge_set_datapath_id(const struct ovsrec_bridge *row, const char *datapath_id)
2965
0
{
2966
0
    struct ovsdb_datum datum;
2967
2968
0
    datum.refcnt = NULL;
2969
2970
0
    if (datapath_id) {
2971
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
2972
0
        datum.n = 1;
2973
0
        datum.keys = key;
2974
0
        key->s = ovsdb_atom_string_create(datapath_id);
2975
0
    } else {
2976
0
        datum.n = 0;
2977
0
        datum.keys = NULL;
2978
0
    }
2979
0
    datum.values = NULL;
2980
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_datapath_id, &datum);
2981
0
}
2982
2983
/* Sets the "datapath_type" column from the "Bridge" table in 'row' to
2984
 * 'datapath_type'.
2985
 *
2986
 * The caller retains ownership of the arguments. */
2987
void
2988
ovsrec_bridge_set_datapath_type(const struct ovsrec_bridge *row, const char *datapath_type)
2989
0
{
2990
0
    struct ovsdb_datum datum;
2991
2992
0
    datum.refcnt = NULL;
2993
2994
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
2995
2996
0
    datum.n = 1;
2997
0
    datum.keys = key;
2998
0
    key->s = ovsdb_atom_string_create(datapath_type);
2999
0
    datum.values = NULL;
3000
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_datapath_type, &datum);
3001
0
}
3002
3003
/* Sets the "datapath_version" column from the "Bridge" table in 'row' to
3004
 * 'datapath_version'.
3005
 *
3006
 * The caller retains ownership of the arguments. */
3007
void
3008
ovsrec_bridge_set_datapath_version(const struct ovsrec_bridge *row, const char *datapath_version)
3009
0
{
3010
0
    struct ovsdb_datum datum;
3011
3012
0
    datum.refcnt = NULL;
3013
3014
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3015
3016
0
    datum.n = 1;
3017
0
    datum.keys = key;
3018
0
    key->s = ovsdb_atom_string_create(datapath_version);
3019
0
    datum.values = NULL;
3020
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_datapath_version, &datum);
3021
0
}
3022
3023
/* Sets the "external_ids" column's value from the "Bridge" table in 'row'
3024
 * to 'external_ids'.
3025
 *
3026
 * The caller retains ownership of 'external_ids' and everything in it. */
3027
void
3028
ovsrec_bridge_set_external_ids(const struct ovsrec_bridge *row, const struct smap *external_ids)
3029
0
{
3030
0
    struct ovsdb_datum datum;
3031
3032
0
    if (external_ids) {
3033
0
        ovsdb_datum_from_smap(&datum, external_ids);
3034
0
    } else {
3035
0
        ovsdb_datum_init_empty(&datum);
3036
0
    }
3037
0
    ovsdb_idl_txn_write(&row->header_,
3038
0
                        &ovsrec_bridge_col_external_ids,
3039
0
                        &datum);
3040
0
}
3041
3042
3043
/* Sets the "fail_mode" column from the "Bridge" table in 'row' to
3044
 * the 'fail_mode' set.
3045
 *
3046
 * If "fail_mode" is null, the column will be the empty set,
3047
 * otherwise it will contain the specified value.
3048
 *
3049
 * Argument constraints: either "secure" or "standalone"
3050
 *
3051
 * The caller retains ownership of the arguments. */
3052
void
3053
ovsrec_bridge_set_fail_mode(const struct ovsrec_bridge *row, const char *fail_mode)
3054
0
{
3055
0
    struct ovsdb_datum datum;
3056
3057
0
    datum.refcnt = NULL;
3058
3059
0
    if (fail_mode) {
3060
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
3061
0
        datum.n = 1;
3062
0
        datum.keys = key;
3063
0
        key->s = ovsdb_atom_string_create(fail_mode);
3064
0
    } else {
3065
0
        datum.n = 0;
3066
0
        datum.keys = NULL;
3067
0
    }
3068
0
    datum.values = NULL;
3069
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_fail_mode, &datum);
3070
0
}
3071
3072
/* Sets the "flood_vlans" column from the "Bridge" table in 'row' to
3073
 * the 'flood_vlans' set with 'n_flood_vlans' entries.
3074
 *
3075
 * Argument constraints: in range 0 to 4,095
3076
 *
3077
 * The caller retains ownership of the arguments. */
3078
void
3079
ovsrec_bridge_set_flood_vlans(const struct ovsrec_bridge *row, const int64_t *flood_vlans, size_t n_flood_vlans)
3080
0
{
3081
0
    struct ovsdb_datum datum;
3082
3083
0
    datum.refcnt = NULL;
3084
3085
0
    datum.n = n_flood_vlans;
3086
0
    datum.keys = n_flood_vlans ? xmalloc(n_flood_vlans * sizeof *datum.keys) : NULL;
3087
0
    datum.values = NULL;
3088
0
    for (size_t i = 0; i < n_flood_vlans; i++) {
3089
0
        datum.keys[i].integer = flood_vlans[i];
3090
0
    }
3091
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_flood_vlans, &datum);
3092
0
}
3093
3094
/* Sets the "flow_tables" column from the "Bridge" table in 'row' to
3095
 * the map with keys 'key_flow_tables' and values 'value_flow_tables'
3096
 * with 'n_flow_tables' entries.
3097
 *
3098
 * Argument constraints: key in range 0 to 254
3099
 *
3100
 * The caller retains ownership of the arguments. */
3101
void
3102
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)
3103
0
{
3104
0
    struct ovsdb_datum datum;
3105
3106
0
    datum.refcnt = NULL;
3107
3108
0
    datum.n = n_flow_tables;
3109
0
    datum.keys = n_flow_tables ? xmalloc(n_flow_tables * sizeof *datum.keys) : NULL;
3110
0
    datum.values = xmalloc(n_flow_tables * sizeof *datum.values);
3111
0
    for (size_t i = 0; i < n_flow_tables; i++) {
3112
0
        datum.keys[i].integer = key_flow_tables[i];
3113
0
        datum.values[i].uuid = value_flow_tables[i]->header_.uuid;
3114
0
    }
3115
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_flow_tables, &datum);
3116
0
}
3117
3118
/* Sets the "ipfix" column from the "Bridge" table in 'row' to
3119
 * the 'ipfix' set.
3120
 *
3121
 * If "ipfix" is null, the column will be the empty set,
3122
 * otherwise it will contain the specified value.
3123
 *
3124
 * The caller retains ownership of the arguments. */
3125
void
3126
ovsrec_bridge_set_ipfix(const struct ovsrec_bridge *row, const struct ovsrec_ipfix *ipfix)
3127
0
{
3128
0
    struct ovsdb_datum datum;
3129
3130
0
    datum.refcnt = NULL;
3131
3132
0
    if (ipfix) {
3133
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
3134
0
        datum.n = 1;
3135
0
        datum.keys = key;
3136
0
        key->uuid = ipfix->header_.uuid;
3137
0
    } else {
3138
0
        datum.n = 0;
3139
0
        datum.keys = NULL;
3140
0
    }
3141
0
    datum.values = NULL;
3142
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_ipfix, &datum);
3143
0
}
3144
3145
/* Sets the "mcast_snooping_enable" column from the "Bridge" table in 'row' to
3146
 * 'mcast_snooping_enable'.
3147
 *
3148
 * The caller retains ownership of the arguments. */
3149
void
3150
ovsrec_bridge_set_mcast_snooping_enable(const struct ovsrec_bridge *row, bool mcast_snooping_enable)
3151
0
{
3152
0
    struct ovsdb_datum datum;
3153
3154
0
    datum.refcnt = NULL;
3155
3156
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3157
3158
0
    datum.n = 1;
3159
0
    datum.keys = key;
3160
0
    key->boolean = mcast_snooping_enable;
3161
0
    datum.values = NULL;
3162
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_mcast_snooping_enable, &datum);
3163
0
}
3164
3165
/* Sets the "mirrors" column from the "Bridge" table in 'row' to
3166
 * the 'mirrors' set with 'n_mirrors' entries.
3167
 *
3168
 * The caller retains ownership of the arguments. */
3169
void
3170
ovsrec_bridge_set_mirrors(const struct ovsrec_bridge *row, struct ovsrec_mirror **mirrors, size_t n_mirrors)
3171
0
{
3172
0
    struct ovsdb_datum datum;
3173
3174
0
    datum.refcnt = NULL;
3175
3176
0
    datum.n = n_mirrors;
3177
0
    datum.keys = n_mirrors ? xmalloc(n_mirrors * sizeof *datum.keys) : NULL;
3178
0
    datum.values = NULL;
3179
0
    for (size_t i = 0; i < n_mirrors; i++) {
3180
0
        datum.keys[i].uuid = mirrors[i]->header_.uuid;
3181
0
    }
3182
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_mirrors, &datum);
3183
0
}
3184
3185
/* Sets the "name" column from the "Bridge" table in 'row' to
3186
 * 'name'.
3187
 *
3188
 * The caller retains ownership of the arguments. */
3189
void
3190
ovsrec_bridge_set_name(const struct ovsrec_bridge *row, const char *name)
3191
0
{
3192
0
    struct ovsdb_datum datum;
3193
3194
0
    datum.refcnt = NULL;
3195
3196
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3197
3198
0
    datum.n = 1;
3199
0
    datum.keys = key;
3200
0
    key->s = ovsdb_atom_string_create(name);
3201
0
    datum.values = NULL;
3202
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_name, &datum);
3203
0
}
3204
3205
/* Sets the "netflow" column from the "Bridge" table in 'row' to
3206
 * the 'netflow' set.
3207
 *
3208
 * If "netflow" is null, the column will be the empty set,
3209
 * otherwise it will contain the specified value.
3210
 *
3211
 * The caller retains ownership of the arguments. */
3212
void
3213
ovsrec_bridge_set_netflow(const struct ovsrec_bridge *row, const struct ovsrec_netflow *netflow)
3214
0
{
3215
0
    struct ovsdb_datum datum;
3216
3217
0
    datum.refcnt = NULL;
3218
3219
0
    if (netflow) {
3220
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
3221
0
        datum.n = 1;
3222
0
        datum.keys = key;
3223
0
        key->uuid = netflow->header_.uuid;
3224
0
    } else {
3225
0
        datum.n = 0;
3226
0
        datum.keys = NULL;
3227
0
    }
3228
0
    datum.values = NULL;
3229
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_netflow, &datum);
3230
0
}
3231
3232
/* Sets the "other_config" column's value from the "Bridge" table in 'row'
3233
 * to 'other_config'.
3234
 *
3235
 * The caller retains ownership of 'other_config' and everything in it. */
3236
void
3237
ovsrec_bridge_set_other_config(const struct ovsrec_bridge *row, const struct smap *other_config)
3238
0
{
3239
0
    struct ovsdb_datum datum;
3240
3241
0
    if (other_config) {
3242
0
        ovsdb_datum_from_smap(&datum, other_config);
3243
0
    } else {
3244
0
        ovsdb_datum_init_empty(&datum);
3245
0
    }
3246
0
    ovsdb_idl_txn_write(&row->header_,
3247
0
                        &ovsrec_bridge_col_other_config,
3248
0
                        &datum);
3249
0
}
3250
3251
3252
/* Sets the "ports" column from the "Bridge" table in 'row' to
3253
 * the 'ports' set with 'n_ports' entries.
3254
 *
3255
 * The caller retains ownership of the arguments. */
3256
void
3257
ovsrec_bridge_set_ports(const struct ovsrec_bridge *row, struct ovsrec_port **ports, size_t n_ports)
3258
0
{
3259
0
    struct ovsdb_datum datum;
3260
3261
0
    datum.refcnt = NULL;
3262
3263
0
    datum.n = n_ports;
3264
0
    datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
3265
0
    datum.values = NULL;
3266
0
    for (size_t i = 0; i < n_ports; i++) {
3267
0
        datum.keys[i].uuid = ports[i]->header_.uuid;
3268
0
    }
3269
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_ports, &datum);
3270
0
}
3271
3272
/* Sets the "protocols" column from the "Bridge" table in 'row' to
3273
 * the 'protocols' set with 'n_protocols' entries.
3274
 *
3275
 * Argument constraints: one of "OpenFlow10", "OpenFlow11", "OpenFlow12", "OpenFlow13", "OpenFlow14", or "OpenFlow15"
3276
 *
3277
 * The caller retains ownership of the arguments. */
3278
void
3279
ovsrec_bridge_set_protocols(const struct ovsrec_bridge *row, const char **protocols, size_t n_protocols)
3280
0
{
3281
0
    struct ovsdb_datum datum;
3282
3283
0
    datum.refcnt = NULL;
3284
3285
0
    datum.n = n_protocols;
3286
0
    datum.keys = n_protocols ? xmalloc(n_protocols * sizeof *datum.keys) : NULL;
3287
0
    datum.values = NULL;
3288
0
    for (size_t i = 0; i < n_protocols; i++) {
3289
0
        datum.keys[i].s = ovsdb_atom_string_create(protocols[i]);
3290
0
    }
3291
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_protocols, &datum);
3292
0
}
3293
3294
/* Sets the "rstp_enable" column from the "Bridge" table in 'row' to
3295
 * 'rstp_enable'.
3296
 *
3297
 * The caller retains ownership of the arguments. */
3298
void
3299
ovsrec_bridge_set_rstp_enable(const struct ovsrec_bridge *row, bool rstp_enable)
3300
0
{
3301
0
    struct ovsdb_datum datum;
3302
3303
0
    datum.refcnt = NULL;
3304
3305
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3306
3307
0
    datum.n = 1;
3308
0
    datum.keys = key;
3309
0
    key->boolean = rstp_enable;
3310
0
    datum.values = NULL;
3311
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_rstp_enable, &datum);
3312
0
}
3313
3314
/* Sets the "rstp_status" column's value from the "Bridge" table in 'row'
3315
 * to 'rstp_status'.
3316
 *
3317
 * The caller retains ownership of 'rstp_status' and everything in it. */
3318
void
3319
ovsrec_bridge_set_rstp_status(const struct ovsrec_bridge *row, const struct smap *rstp_status)
3320
0
{
3321
0
    struct ovsdb_datum datum;
3322
3323
0
    if (rstp_status) {
3324
0
        ovsdb_datum_from_smap(&datum, rstp_status);
3325
0
    } else {
3326
0
        ovsdb_datum_init_empty(&datum);
3327
0
    }
3328
0
    ovsdb_idl_txn_write(&row->header_,
3329
0
                        &ovsrec_bridge_col_rstp_status,
3330
0
                        &datum);
3331
0
}
3332
3333
3334
/* Sets the "sflow" column from the "Bridge" table in 'row' to
3335
 * the 'sflow' set.
3336
 *
3337
 * If "sflow" is null, the column will be the empty set,
3338
 * otherwise it will contain the specified value.
3339
 *
3340
 * The caller retains ownership of the arguments. */
3341
void
3342
ovsrec_bridge_set_sflow(const struct ovsrec_bridge *row, const struct ovsrec_sflow *sflow)
3343
0
{
3344
0
    struct ovsdb_datum datum;
3345
3346
0
    datum.refcnt = NULL;
3347
3348
0
    if (sflow) {
3349
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
3350
0
        datum.n = 1;
3351
0
        datum.keys = key;
3352
0
        key->uuid = sflow->header_.uuid;
3353
0
    } else {
3354
0
        datum.n = 0;
3355
0
        datum.keys = NULL;
3356
0
    }
3357
0
    datum.values = NULL;
3358
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_sflow, &datum);
3359
0
}
3360
3361
/* Sets the "status" column's value from the "Bridge" table in 'row'
3362
 * to 'status'.
3363
 *
3364
 * The caller retains ownership of 'status' and everything in it. */
3365
void
3366
ovsrec_bridge_set_status(const struct ovsrec_bridge *row, const struct smap *status)
3367
0
{
3368
0
    struct ovsdb_datum datum;
3369
3370
0
    if (status) {
3371
0
        ovsdb_datum_from_smap(&datum, status);
3372
0
    } else {
3373
0
        ovsdb_datum_init_empty(&datum);
3374
0
    }
3375
0
    ovsdb_idl_txn_write(&row->header_,
3376
0
                        &ovsrec_bridge_col_status,
3377
0
                        &datum);
3378
0
}
3379
3380
3381
/* Sets the "stp_enable" column from the "Bridge" table in 'row' to
3382
 * 'stp_enable'.
3383
 *
3384
 * The caller retains ownership of the arguments. */
3385
void
3386
ovsrec_bridge_set_stp_enable(const struct ovsrec_bridge *row, bool stp_enable)
3387
0
{
3388
0
    struct ovsdb_datum datum;
3389
3390
0
    datum.refcnt = NULL;
3391
3392
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
3393
3394
0
    datum.n = 1;
3395
0
    datum.keys = key;
3396
0
    key->boolean = stp_enable;
3397
0
    datum.values = NULL;
3398
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_col_stp_enable, &datum);
3399
0
}
3400
3401
/* Adds the value 'new_value' to the "auto_attach" set column from the "Bridge" table
3402
 * in 'row'.
3403
 *
3404
 */
3405
void
3406
ovsrec_bridge_update_auto_attach_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_autoattach *new_value)
3407
0
{
3408
0
    struct ovsdb_datum *datum;
3409
3410
0
    datum = xmalloc(sizeof *datum);
3411
0
    datum->n = 1;
3412
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3413
0
    datum->values = NULL;
3414
0
    datum->refcnt = NULL;
3415
3416
0
    datum->keys[0].uuid = new_value->header_.uuid;
3417
3418
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3419
0
                                    &ovsrec_bridge_col_auto_attach,
3420
0
                                    datum);
3421
0
}
3422
3423
/* Deletes the value 'delete_value' from the "auto_attach" set column from the
3424
 * "Bridge" table in 'row'.
3425
 *
3426
 */
3427
void
3428
ovsrec_bridge_update_auto_attach_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_autoattach *delete_value)
3429
0
{
3430
0
    struct ovsdb_datum *datum;
3431
3432
0
    datum = xmalloc(sizeof *datum);
3433
0
    datum->n = 1;
3434
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3435
0
    datum->values = NULL;
3436
0
    datum->refcnt = NULL;
3437
3438
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3439
3440
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3441
0
                                    &ovsrec_bridge_col_auto_attach,
3442
0
                                    datum);
3443
0
}
3444
3445
/* Adds the value 'new_value' to the "controller" set column from the "Bridge" table
3446
 * in 'row'.
3447
 *
3448
 */
3449
void
3450
ovsrec_bridge_update_controller_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_controller *new_value)
3451
0
{
3452
0
    struct ovsdb_datum *datum;
3453
3454
0
    datum = xmalloc(sizeof *datum);
3455
0
    datum->n = 1;
3456
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3457
0
    datum->values = NULL;
3458
0
    datum->refcnt = NULL;
3459
3460
0
    datum->keys[0].uuid = new_value->header_.uuid;
3461
3462
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3463
0
                                    &ovsrec_bridge_col_controller,
3464
0
                                    datum);
3465
0
}
3466
3467
/* Deletes the value 'delete_value' from the "controller" set column from the
3468
 * "Bridge" table in 'row'.
3469
 *
3470
 */
3471
void
3472
ovsrec_bridge_update_controller_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_controller *delete_value)
3473
0
{
3474
0
    struct ovsdb_datum *datum;
3475
3476
0
    datum = xmalloc(sizeof *datum);
3477
0
    datum->n = 1;
3478
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3479
0
    datum->values = NULL;
3480
0
    datum->refcnt = NULL;
3481
3482
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3483
3484
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3485
0
                                    &ovsrec_bridge_col_controller,
3486
0
                                    datum);
3487
0
}
3488
3489
/* Adds the value 'new_value' to the "datapath_id" set column from the "Bridge" table
3490
 * in 'row'.
3491
 *
3492
 */
3493
void
3494
ovsrec_bridge_update_datapath_id_addvalue(const struct ovsrec_bridge *row, const char *new_value)
3495
0
{
3496
0
    struct ovsdb_datum *datum;
3497
3498
0
    datum = xmalloc(sizeof *datum);
3499
0
    datum->n = 1;
3500
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3501
0
    datum->values = NULL;
3502
0
    datum->refcnt = NULL;
3503
3504
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
3505
3506
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3507
0
                                    &ovsrec_bridge_col_datapath_id,
3508
0
                                    datum);
3509
0
}
3510
3511
/* Deletes the value 'delete_value' from the "datapath_id" set column from the
3512
 * "Bridge" table in 'row'.
3513
 *
3514
 */
3515
void
3516
ovsrec_bridge_update_datapath_id_delvalue(const struct ovsrec_bridge *row, const char *delete_value)
3517
0
{
3518
0
    struct ovsdb_datum *datum;
3519
3520
0
    datum = xmalloc(sizeof *datum);
3521
0
    datum->n = 1;
3522
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3523
0
    datum->values = NULL;
3524
0
    datum->refcnt = NULL;
3525
3526
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
3527
3528
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3529
0
                                    &ovsrec_bridge_col_datapath_id,
3530
0
                                    datum);
3531
0
}
3532
3533
/* Sets an element of the "external_ids" map column from the "Bridge" table in 'row'
3534
 * to 'new_value' given the key value 'new_key'.
3535
 *
3536
 */
3537
void
3538
ovsrec_bridge_update_external_ids_setkey(const struct ovsrec_bridge *row, const char *new_key, const char *new_value)
3539
0
{
3540
0
    struct ovsdb_datum *datum;
3541
3542
0
    datum = xmalloc(sizeof *datum);
3543
0
    datum->n = 1;
3544
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3545
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
3546
0
    datum->refcnt = NULL;
3547
3548
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
3549
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
3550
3551
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
3552
0
                                    &ovsrec_bridge_col_external_ids,
3553
0
                                    datum);
3554
0
}
3555
3556
/* Deletes an element of the "external_ids" map column from the "Bridge" table in 'row'
3557
 * given the key value 'delete_key'.
3558
 *
3559
 */
3560
void
3561
ovsrec_bridge_update_external_ids_delkey(const struct ovsrec_bridge *row, const char *delete_key)
3562
0
{
3563
0
    struct ovsdb_datum *datum;
3564
3565
0
    datum = xmalloc(sizeof *datum);
3566
0
    datum->n = 1;
3567
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3568
0
    datum->values = NULL;
3569
0
    datum->refcnt = NULL;
3570
3571
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
3572
3573
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
3574
0
                                    &ovsrec_bridge_col_external_ids,
3575
0
                                    datum);
3576
0
}
3577
3578
/* Adds the value 'new_value' to the "fail_mode" set column from the "Bridge" table
3579
 * in 'row'.
3580
 *
3581
 */
3582
void
3583
ovsrec_bridge_update_fail_mode_addvalue(const struct ovsrec_bridge *row, const char *new_value)
3584
0
{
3585
0
    struct ovsdb_datum *datum;
3586
3587
0
    datum = xmalloc(sizeof *datum);
3588
0
    datum->n = 1;
3589
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3590
0
    datum->values = NULL;
3591
0
    datum->refcnt = NULL;
3592
3593
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
3594
3595
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3596
0
                                    &ovsrec_bridge_col_fail_mode,
3597
0
                                    datum);
3598
0
}
3599
3600
/* Deletes the value 'delete_value' from the "fail_mode" set column from the
3601
 * "Bridge" table in 'row'.
3602
 *
3603
 */
3604
void
3605
ovsrec_bridge_update_fail_mode_delvalue(const struct ovsrec_bridge *row, const char *delete_value)
3606
0
{
3607
0
    struct ovsdb_datum *datum;
3608
3609
0
    datum = xmalloc(sizeof *datum);
3610
0
    datum->n = 1;
3611
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3612
0
    datum->values = NULL;
3613
0
    datum->refcnt = NULL;
3614
3615
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
3616
3617
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3618
0
                                    &ovsrec_bridge_col_fail_mode,
3619
0
                                    datum);
3620
0
}
3621
3622
/* Adds the value 'new_value' to the "flood_vlans" set column from the "Bridge" table
3623
 * in 'row'.
3624
 *
3625
 */
3626
void
3627
ovsrec_bridge_update_flood_vlans_addvalue(const struct ovsrec_bridge *row, int64_t new_value)
3628
0
{
3629
0
    struct ovsdb_datum *datum;
3630
3631
0
    datum = xmalloc(sizeof *datum);
3632
0
    datum->n = 1;
3633
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3634
0
    datum->values = NULL;
3635
0
    datum->refcnt = NULL;
3636
3637
0
    datum->keys[0].integer = new_value;
3638
3639
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3640
0
                                    &ovsrec_bridge_col_flood_vlans,
3641
0
                                    datum);
3642
0
}
3643
3644
/* Deletes the value 'delete_value' from the "flood_vlans" set column from the
3645
 * "Bridge" table in 'row'.
3646
 *
3647
 */
3648
void
3649
ovsrec_bridge_update_flood_vlans_delvalue(const struct ovsrec_bridge *row, int64_t delete_value)
3650
0
{
3651
0
    struct ovsdb_datum *datum;
3652
3653
0
    datum = xmalloc(sizeof *datum);
3654
0
    datum->n = 1;
3655
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3656
0
    datum->values = NULL;
3657
0
    datum->refcnt = NULL;
3658
3659
0
    datum->keys[0].integer = delete_value;
3660
3661
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3662
0
                                    &ovsrec_bridge_col_flood_vlans,
3663
0
                                    datum);
3664
0
}
3665
3666
/* Sets an element of the "flow_tables" map column from the "Bridge" table in 'row'
3667
 * to 'new_value' given the key value 'new_key'.
3668
 *
3669
 */
3670
void
3671
ovsrec_bridge_update_flow_tables_setkey(const struct ovsrec_bridge *row, int64_t new_key, const struct ovsrec_flow_table *new_value)
3672
0
{
3673
0
    struct ovsdb_datum *datum;
3674
3675
0
    datum = xmalloc(sizeof *datum);
3676
0
    datum->n = 1;
3677
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3678
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
3679
0
    datum->refcnt = NULL;
3680
3681
0
    datum->keys[0].integer = new_key;
3682
0
    datum->values[0].uuid = new_value->header_.uuid;
3683
3684
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
3685
0
                                    &ovsrec_bridge_col_flow_tables,
3686
0
                                    datum);
3687
0
}
3688
3689
/* Deletes an element of the "flow_tables" map column from the "Bridge" table in 'row'
3690
 * given the key value 'delete_key'.
3691
 *
3692
 */
3693
void
3694
ovsrec_bridge_update_flow_tables_delkey(const struct ovsrec_bridge *row, int64_t delete_key)
3695
0
{
3696
0
    struct ovsdb_datum *datum;
3697
3698
0
    datum = xmalloc(sizeof *datum);
3699
0
    datum->n = 1;
3700
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3701
0
    datum->values = NULL;
3702
0
    datum->refcnt = NULL;
3703
3704
0
    datum->keys[0].integer = delete_key;
3705
3706
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
3707
0
                                    &ovsrec_bridge_col_flow_tables,
3708
0
                                    datum);
3709
0
}
3710
3711
/* Adds the value 'new_value' to the "ipfix" set column from the "Bridge" table
3712
 * in 'row'.
3713
 *
3714
 */
3715
void
3716
ovsrec_bridge_update_ipfix_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_ipfix *new_value)
3717
0
{
3718
0
    struct ovsdb_datum *datum;
3719
3720
0
    datum = xmalloc(sizeof *datum);
3721
0
    datum->n = 1;
3722
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3723
0
    datum->values = NULL;
3724
0
    datum->refcnt = NULL;
3725
3726
0
    datum->keys[0].uuid = new_value->header_.uuid;
3727
3728
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3729
0
                                    &ovsrec_bridge_col_ipfix,
3730
0
                                    datum);
3731
0
}
3732
3733
/* Deletes the value 'delete_value' from the "ipfix" set column from the
3734
 * "Bridge" table in 'row'.
3735
 *
3736
 */
3737
void
3738
ovsrec_bridge_update_ipfix_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_ipfix *delete_value)
3739
0
{
3740
0
    struct ovsdb_datum *datum;
3741
3742
0
    datum = xmalloc(sizeof *datum);
3743
0
    datum->n = 1;
3744
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3745
0
    datum->values = NULL;
3746
0
    datum->refcnt = NULL;
3747
3748
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3749
3750
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3751
0
                                    &ovsrec_bridge_col_ipfix,
3752
0
                                    datum);
3753
0
}
3754
3755
/* Adds the value 'new_value' to the "mirrors" set column from the "Bridge" table
3756
 * in 'row'.
3757
 *
3758
 */
3759
void
3760
ovsrec_bridge_update_mirrors_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_mirror *new_value)
3761
0
{
3762
0
    struct ovsdb_datum *datum;
3763
3764
0
    datum = xmalloc(sizeof *datum);
3765
0
    datum->n = 1;
3766
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3767
0
    datum->values = NULL;
3768
0
    datum->refcnt = NULL;
3769
3770
0
    datum->keys[0].uuid = new_value->header_.uuid;
3771
3772
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3773
0
                                    &ovsrec_bridge_col_mirrors,
3774
0
                                    datum);
3775
0
}
3776
3777
/* Deletes the value 'delete_value' from the "mirrors" set column from the
3778
 * "Bridge" table in 'row'.
3779
 *
3780
 */
3781
void
3782
ovsrec_bridge_update_mirrors_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_mirror *delete_value)
3783
0
{
3784
0
    struct ovsdb_datum *datum;
3785
3786
0
    datum = xmalloc(sizeof *datum);
3787
0
    datum->n = 1;
3788
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3789
0
    datum->values = NULL;
3790
0
    datum->refcnt = NULL;
3791
3792
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3793
3794
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3795
0
                                    &ovsrec_bridge_col_mirrors,
3796
0
                                    datum);
3797
0
}
3798
3799
/* Adds the value 'new_value' to the "netflow" set column from the "Bridge" table
3800
 * in 'row'.
3801
 *
3802
 */
3803
void
3804
ovsrec_bridge_update_netflow_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_netflow *new_value)
3805
0
{
3806
0
    struct ovsdb_datum *datum;
3807
3808
0
    datum = xmalloc(sizeof *datum);
3809
0
    datum->n = 1;
3810
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3811
0
    datum->values = NULL;
3812
0
    datum->refcnt = NULL;
3813
3814
0
    datum->keys[0].uuid = new_value->header_.uuid;
3815
3816
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3817
0
                                    &ovsrec_bridge_col_netflow,
3818
0
                                    datum);
3819
0
}
3820
3821
/* Deletes the value 'delete_value' from the "netflow" set column from the
3822
 * "Bridge" table in 'row'.
3823
 *
3824
 */
3825
void
3826
ovsrec_bridge_update_netflow_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_netflow *delete_value)
3827
0
{
3828
0
    struct ovsdb_datum *datum;
3829
3830
0
    datum = xmalloc(sizeof *datum);
3831
0
    datum->n = 1;
3832
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3833
0
    datum->values = NULL;
3834
0
    datum->refcnt = NULL;
3835
3836
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3837
3838
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3839
0
                                    &ovsrec_bridge_col_netflow,
3840
0
                                    datum);
3841
0
}
3842
3843
/* Sets an element of the "other_config" map column from the "Bridge" table in 'row'
3844
 * to 'new_value' given the key value 'new_key'.
3845
 *
3846
 */
3847
void
3848
ovsrec_bridge_update_other_config_setkey(const struct ovsrec_bridge *row, const char *new_key, const char *new_value)
3849
0
{
3850
0
    struct ovsdb_datum *datum;
3851
3852
0
    datum = xmalloc(sizeof *datum);
3853
0
    datum->n = 1;
3854
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3855
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
3856
0
    datum->refcnt = NULL;
3857
3858
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
3859
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
3860
3861
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
3862
0
                                    &ovsrec_bridge_col_other_config,
3863
0
                                    datum);
3864
0
}
3865
3866
/* Deletes an element of the "other_config" map column from the "Bridge" table in 'row'
3867
 * given the key value 'delete_key'.
3868
 *
3869
 */
3870
void
3871
ovsrec_bridge_update_other_config_delkey(const struct ovsrec_bridge *row, const char *delete_key)
3872
0
{
3873
0
    struct ovsdb_datum *datum;
3874
3875
0
    datum = xmalloc(sizeof *datum);
3876
0
    datum->n = 1;
3877
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3878
0
    datum->values = NULL;
3879
0
    datum->refcnt = NULL;
3880
3881
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
3882
3883
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
3884
0
                                    &ovsrec_bridge_col_other_config,
3885
0
                                    datum);
3886
0
}
3887
3888
/* Adds the value 'new_value' to the "ports" set column from the "Bridge" table
3889
 * in 'row'.
3890
 *
3891
 */
3892
void
3893
ovsrec_bridge_update_ports_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_port *new_value)
3894
0
{
3895
0
    struct ovsdb_datum *datum;
3896
3897
0
    datum = xmalloc(sizeof *datum);
3898
0
    datum->n = 1;
3899
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3900
0
    datum->values = NULL;
3901
0
    datum->refcnt = NULL;
3902
3903
0
    datum->keys[0].uuid = new_value->header_.uuid;
3904
3905
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3906
0
                                    &ovsrec_bridge_col_ports,
3907
0
                                    datum);
3908
0
}
3909
3910
/* Deletes the value 'delete_value' from the "ports" set column from the
3911
 * "Bridge" table in 'row'.
3912
 *
3913
 */
3914
void
3915
ovsrec_bridge_update_ports_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_port *delete_value)
3916
0
{
3917
0
    struct ovsdb_datum *datum;
3918
3919
0
    datum = xmalloc(sizeof *datum);
3920
0
    datum->n = 1;
3921
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3922
0
    datum->values = NULL;
3923
0
    datum->refcnt = NULL;
3924
3925
0
    datum->keys[0].uuid = delete_value->header_.uuid;
3926
3927
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3928
0
                                    &ovsrec_bridge_col_ports,
3929
0
                                    datum);
3930
0
}
3931
3932
/* Adds the value 'new_value' to the "protocols" set column from the "Bridge" table
3933
 * in 'row'.
3934
 *
3935
 */
3936
void
3937
ovsrec_bridge_update_protocols_addvalue(const struct ovsrec_bridge *row, const char *new_value)
3938
0
{
3939
0
    struct ovsdb_datum *datum;
3940
3941
0
    datum = xmalloc(sizeof *datum);
3942
0
    datum->n = 1;
3943
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3944
0
    datum->values = NULL;
3945
0
    datum->refcnt = NULL;
3946
3947
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
3948
3949
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
3950
0
                                    &ovsrec_bridge_col_protocols,
3951
0
                                    datum);
3952
0
}
3953
3954
/* Deletes the value 'delete_value' from the "protocols" set column from the
3955
 * "Bridge" table in 'row'.
3956
 *
3957
 */
3958
void
3959
ovsrec_bridge_update_protocols_delvalue(const struct ovsrec_bridge *row, const char *delete_value)
3960
0
{
3961
0
    struct ovsdb_datum *datum;
3962
3963
0
    datum = xmalloc(sizeof *datum);
3964
0
    datum->n = 1;
3965
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
3966
0
    datum->values = NULL;
3967
0
    datum->refcnt = NULL;
3968
3969
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
3970
3971
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
3972
0
                                    &ovsrec_bridge_col_protocols,
3973
0
                                    datum);
3974
0
}
3975
3976
/* Sets an element of the "rstp_status" map column from the "Bridge" table in 'row'
3977
 * to 'new_value' given the key value 'new_key'.
3978
 *
3979
 */
3980
void
3981
ovsrec_bridge_update_rstp_status_setkey(const struct ovsrec_bridge *row, const char *new_key, const char *new_value)
3982
0
{
3983
0
    struct ovsdb_datum *datum;
3984
3985
0
    datum = xmalloc(sizeof *datum);
3986
0
    datum->n = 1;
3987
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
3988
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
3989
0
    datum->refcnt = NULL;
3990
3991
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
3992
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
3993
3994
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
3995
0
                                    &ovsrec_bridge_col_rstp_status,
3996
0
                                    datum);
3997
0
}
3998
3999
/* Deletes an element of the "rstp_status" map column from the "Bridge" table in 'row'
4000
 * given the key value 'delete_key'.
4001
 *
4002
 */
4003
void
4004
ovsrec_bridge_update_rstp_status_delkey(const struct ovsrec_bridge *row, const char *delete_key)
4005
0
{
4006
0
    struct ovsdb_datum *datum;
4007
4008
0
    datum = xmalloc(sizeof *datum);
4009
0
    datum->n = 1;
4010
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4011
0
    datum->values = NULL;
4012
0
    datum->refcnt = NULL;
4013
4014
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
4015
4016
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
4017
0
                                    &ovsrec_bridge_col_rstp_status,
4018
0
                                    datum);
4019
0
}
4020
4021
/* Adds the value 'new_value' to the "sflow" set column from the "Bridge" table
4022
 * in 'row'.
4023
 *
4024
 */
4025
void
4026
ovsrec_bridge_update_sflow_addvalue(const struct ovsrec_bridge *row, const struct ovsrec_sflow *new_value)
4027
0
{
4028
0
    struct ovsdb_datum *datum;
4029
4030
0
    datum = xmalloc(sizeof *datum);
4031
0
    datum->n = 1;
4032
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
4033
0
    datum->values = NULL;
4034
0
    datum->refcnt = NULL;
4035
4036
0
    datum->keys[0].uuid = new_value->header_.uuid;
4037
4038
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
4039
0
                                    &ovsrec_bridge_col_sflow,
4040
0
                                    datum);
4041
0
}
4042
4043
/* Deletes the value 'delete_value' from the "sflow" set column from the
4044
 * "Bridge" table in 'row'.
4045
 *
4046
 */
4047
void
4048
ovsrec_bridge_update_sflow_delvalue(const struct ovsrec_bridge *row, const struct ovsrec_sflow *delete_value)
4049
0
{
4050
0
    struct ovsdb_datum *datum;
4051
4052
0
    datum = xmalloc(sizeof *datum);
4053
0
    datum->n = 1;
4054
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
4055
0
    datum->values = NULL;
4056
0
    datum->refcnt = NULL;
4057
4058
0
    datum->keys[0].uuid = delete_value->header_.uuid;
4059
4060
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
4061
0
                                    &ovsrec_bridge_col_sflow,
4062
0
                                    datum);
4063
0
}
4064
4065
/* Sets an element of the "status" map column from the "Bridge" table in 'row'
4066
 * to 'new_value' given the key value 'new_key'.
4067
 *
4068
 */
4069
void
4070
ovsrec_bridge_update_status_setkey(const struct ovsrec_bridge *row, const char *new_key, const char *new_value)
4071
0
{
4072
0
    struct ovsdb_datum *datum;
4073
4074
0
    datum = xmalloc(sizeof *datum);
4075
0
    datum->n = 1;
4076
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4077
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
4078
0
    datum->refcnt = NULL;
4079
4080
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
4081
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
4082
4083
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
4084
0
                                    &ovsrec_bridge_col_status,
4085
0
                                    datum);
4086
0
}
4087
4088
/* Deletes an element of the "status" map column from the "Bridge" table in 'row'
4089
 * given the key value 'delete_key'.
4090
 *
4091
 */
4092
void
4093
ovsrec_bridge_update_status_delkey(const struct ovsrec_bridge *row, const char *delete_key)
4094
0
{
4095
0
    struct ovsdb_datum *datum;
4096
4097
0
    datum = xmalloc(sizeof *datum);
4098
0
    datum->n = 1;
4099
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4100
0
    datum->values = NULL;
4101
0
    datum->refcnt = NULL;
4102
4103
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
4104
4105
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
4106
0
                                    &ovsrec_bridge_col_status,
4107
0
                                    datum);
4108
0
}
4109
4110
/* Sets the "auto_attach" column from the "Bridge" table in 'row' to
4111
 * the 'auto_attach' set.
4112
 *
4113
 * If "auto_attach" is null, the column will be the empty set,
4114
 * otherwise it will contain the specified value.
4115
 *
4116
 * The caller retains ownership of the arguments. */
4117
void
4118
ovsrec_bridge_add_clause_auto_attach(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *auto_attach)
4119
0
{
4120
0
    struct ovsdb_datum datum;
4121
4122
0
    datum.refcnt = NULL;
4123
4124
0
    if (auto_attach) {
4125
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4126
0
        datum.n = 1;
4127
0
        datum.keys = key;
4128
0
        key->uuid = *auto_attach;
4129
0
    } else {
4130
0
        datum.n = 0;
4131
0
        datum.keys = NULL;
4132
0
    }
4133
0
    datum.values = NULL;
4134
0
    ovsdb_idl_condition_add_clause(cond,
4135
0
                          function,
4136
0
                          &ovsrec_bridge_col_auto_attach,
4137
0
                          &datum);
4138
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_auto_attach.type);
4139
0
}
4140
4141
/* Sets the "controller" column from the "Bridge" table in 'row' to
4142
 * the 'controller' set with 'n_controller' entries.
4143
 *
4144
 * The caller retains ownership of the arguments. */
4145
void
4146
ovsrec_bridge_add_clause_controller(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **controller, size_t n_controller)
4147
0
{
4148
0
    struct ovsdb_datum datum;
4149
4150
0
    datum.refcnt = NULL;
4151
0
    datum.n = n_controller;
4152
0
    datum.keys = n_controller ? xmalloc(n_controller * sizeof *datum.keys) : NULL;
4153
0
    datum.values = NULL;
4154
0
    for (size_t i = 0; i < n_controller; i++) {
4155
0
        datum.keys[i].uuid = *controller[i];
4156
0
    }
4157
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_controller.type);
4158
0
    ovsdb_idl_condition_add_clause(cond,
4159
0
                          function,
4160
0
                          &ovsrec_bridge_col_controller,
4161
0
                          &datum);
4162
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_controller.type);
4163
0
}
4164
4165
/* Sets the "datapath_id" column from the "Bridge" table in 'row' to
4166
 * the 'datapath_id' set.
4167
 *
4168
 * If "datapath_id" is null, the column will be the empty set,
4169
 * otherwise it will contain the specified value.
4170
 *
4171
 * The caller retains ownership of the arguments. */
4172
void
4173
ovsrec_bridge_add_clause_datapath_id(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *datapath_id)
4174
0
{
4175
0
    struct ovsdb_datum datum;
4176
4177
0
    datum.refcnt = NULL;
4178
4179
0
    if (datapath_id) {
4180
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4181
0
        datum.n = 1;
4182
0
        datum.keys = key;
4183
0
        key->s = ovsdb_atom_string_create(datapath_id);
4184
0
    } else {
4185
0
        datum.n = 0;
4186
0
        datum.keys = NULL;
4187
0
    }
4188
0
    datum.values = NULL;
4189
0
    ovsdb_idl_condition_add_clause(cond,
4190
0
                          function,
4191
0
                          &ovsrec_bridge_col_datapath_id,
4192
0
                          &datum);
4193
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_datapath_id.type);
4194
0
}
4195
4196
/* Sets the "datapath_type" column from the "Bridge" table in 'row' to
4197
 * 'datapath_type'.
4198
 *
4199
 * The caller retains ownership of the arguments. */
4200
void
4201
ovsrec_bridge_add_clause_datapath_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *datapath_type)
4202
0
{
4203
0
    struct ovsdb_datum datum;
4204
4205
0
    datum.refcnt = NULL;
4206
4207
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4208
4209
0
    datum.n = 1;
4210
0
    datum.keys = key;
4211
0
    key->s = ovsdb_atom_string_create(datapath_type);
4212
0
    datum.values = NULL;
4213
0
    ovsdb_idl_condition_add_clause(cond,
4214
0
                          function,
4215
0
                          &ovsrec_bridge_col_datapath_type,
4216
0
                          &datum);
4217
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_datapath_type.type);
4218
0
}
4219
4220
/* Sets the "datapath_version" column from the "Bridge" table in 'row' to
4221
 * 'datapath_version'.
4222
 *
4223
 * The caller retains ownership of the arguments. */
4224
void
4225
ovsrec_bridge_add_clause_datapath_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *datapath_version)
4226
0
{
4227
0
    struct ovsdb_datum datum;
4228
4229
0
    datum.refcnt = NULL;
4230
4231
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4232
4233
0
    datum.n = 1;
4234
0
    datum.keys = key;
4235
0
    key->s = ovsdb_atom_string_create(datapath_version);
4236
0
    datum.values = NULL;
4237
0
    ovsdb_idl_condition_add_clause(cond,
4238
0
                          function,
4239
0
                          &ovsrec_bridge_col_datapath_version,
4240
0
                          &datum);
4241
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_datapath_version.type);
4242
0
}
4243
4244
/* Sets the "external_ids" column's value from the "Bridge" table in 'row'
4245
 * to 'external_ids'.
4246
 *
4247
 * The caller retains ownership of 'external_ids' and everything in it. */
4248
void
4249
ovsrec_bridge_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
4250
0
{
4251
0
    struct ovsdb_datum datum;
4252
4253
0
    if (external_ids) {
4254
0
        ovsdb_datum_from_smap(&datum, external_ids);
4255
0
    } else {
4256
0
        ovsdb_datum_init_empty(&datum);
4257
0
    }
4258
4259
0
    ovsdb_idl_condition_add_clause(cond,
4260
0
                                   function,
4261
0
                                   &ovsrec_bridge_col_external_ids,
4262
0
                                   &datum);
4263
4264
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_external_ids.type);
4265
0
}
4266
4267
4268
/* Sets the "fail_mode" column from the "Bridge" table in 'row' to
4269
 * the 'fail_mode' set.
4270
 *
4271
 * If "fail_mode" is null, the column will be the empty set,
4272
 * otherwise it will contain the specified value.
4273
 *
4274
 * Argument constraints: either "secure" or "standalone"
4275
 *
4276
 * The caller retains ownership of the arguments. */
4277
void
4278
ovsrec_bridge_add_clause_fail_mode(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *fail_mode)
4279
0
{
4280
0
    struct ovsdb_datum datum;
4281
4282
0
    datum.refcnt = NULL;
4283
4284
0
    if (fail_mode) {
4285
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4286
0
        datum.n = 1;
4287
0
        datum.keys = key;
4288
0
        key->s = ovsdb_atom_string_create(fail_mode);
4289
0
    } else {
4290
0
        datum.n = 0;
4291
0
        datum.keys = NULL;
4292
0
    }
4293
0
    datum.values = NULL;
4294
0
    ovsdb_idl_condition_add_clause(cond,
4295
0
                          function,
4296
0
                          &ovsrec_bridge_col_fail_mode,
4297
0
                          &datum);
4298
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_fail_mode.type);
4299
0
}
4300
4301
/* Sets the "flood_vlans" column from the "Bridge" table in 'row' to
4302
 * the 'flood_vlans' set with 'n_flood_vlans' entries.
4303
 *
4304
 * Argument constraints: in range 0 to 4,095
4305
 *
4306
 * The caller retains ownership of the arguments. */
4307
void
4308
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)
4309
0
{
4310
0
    struct ovsdb_datum datum;
4311
4312
0
    datum.refcnt = NULL;
4313
0
    datum.n = n_flood_vlans;
4314
0
    datum.keys = n_flood_vlans ? xmalloc(n_flood_vlans * sizeof *datum.keys) : NULL;
4315
0
    datum.values = NULL;
4316
0
    for (size_t i = 0; i < n_flood_vlans; i++) {
4317
0
        datum.keys[i].integer = flood_vlans[i];
4318
0
    }
4319
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_flood_vlans.type);
4320
0
    ovsdb_idl_condition_add_clause(cond,
4321
0
                          function,
4322
0
                          &ovsrec_bridge_col_flood_vlans,
4323
0
                          &datum);
4324
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_flood_vlans.type);
4325
0
}
4326
4327
/* Sets the "flow_tables" column from the "Bridge" table in 'row' to
4328
 * the map with keys 'key_flow_tables' and values 'value_flow_tables'
4329
 * with 'n_flow_tables' entries.
4330
 *
4331
 * Argument constraints: key in range 0 to 254
4332
 *
4333
 * The caller retains ownership of the arguments. */
4334
void
4335
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)
4336
0
{
4337
0
    struct ovsdb_datum datum;
4338
4339
0
    datum.refcnt = NULL;
4340
0
    datum.n = n_flow_tables;
4341
0
    datum.keys = n_flow_tables ? xmalloc(n_flow_tables * sizeof *datum.keys) : NULL;
4342
0
    datum.values = xmalloc(n_flow_tables * sizeof *datum.values);
4343
0
    for (size_t i = 0; i < n_flow_tables; i++) {
4344
0
        datum.keys[i].integer = key_flow_tables[i];
4345
0
        datum.values[i].uuid = *value_flow_tables[i];
4346
0
    }
4347
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_flow_tables.type);
4348
0
    ovsdb_idl_condition_add_clause(cond,
4349
0
                          function,
4350
0
                          &ovsrec_bridge_col_flow_tables,
4351
0
                          &datum);
4352
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_flow_tables.type);
4353
0
}
4354
4355
/* Sets the "ipfix" column from the "Bridge" table in 'row' to
4356
 * the 'ipfix' set.
4357
 *
4358
 * If "ipfix" is null, the column will be the empty set,
4359
 * otherwise it will contain the specified value.
4360
 *
4361
 * The caller retains ownership of the arguments. */
4362
void
4363
ovsrec_bridge_add_clause_ipfix(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *ipfix)
4364
0
{
4365
0
    struct ovsdb_datum datum;
4366
4367
0
    datum.refcnt = NULL;
4368
4369
0
    if (ipfix) {
4370
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4371
0
        datum.n = 1;
4372
0
        datum.keys = key;
4373
0
        key->uuid = *ipfix;
4374
0
    } else {
4375
0
        datum.n = 0;
4376
0
        datum.keys = NULL;
4377
0
    }
4378
0
    datum.values = NULL;
4379
0
    ovsdb_idl_condition_add_clause(cond,
4380
0
                          function,
4381
0
                          &ovsrec_bridge_col_ipfix,
4382
0
                          &datum);
4383
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_ipfix.type);
4384
0
}
4385
4386
/* Sets the "mcast_snooping_enable" column from the "Bridge" table in 'row' to
4387
 * 'mcast_snooping_enable'.
4388
 *
4389
 * The caller retains ownership of the arguments. */
4390
void
4391
ovsrec_bridge_add_clause_mcast_snooping_enable(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool mcast_snooping_enable)
4392
0
{
4393
0
    struct ovsdb_datum datum;
4394
4395
0
    datum.refcnt = NULL;
4396
4397
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4398
4399
0
    datum.n = 1;
4400
0
    datum.keys = key;
4401
0
    key->boolean = mcast_snooping_enable;
4402
0
    datum.values = NULL;
4403
0
    ovsdb_idl_condition_add_clause(cond,
4404
0
                          function,
4405
0
                          &ovsrec_bridge_col_mcast_snooping_enable,
4406
0
                          &datum);
4407
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_mcast_snooping_enable.type);
4408
0
}
4409
4410
/* Sets the "mirrors" column from the "Bridge" table in 'row' to
4411
 * the 'mirrors' set with 'n_mirrors' entries.
4412
 *
4413
 * The caller retains ownership of the arguments. */
4414
void
4415
ovsrec_bridge_add_clause_mirrors(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **mirrors, size_t n_mirrors)
4416
0
{
4417
0
    struct ovsdb_datum datum;
4418
4419
0
    datum.refcnt = NULL;
4420
0
    datum.n = n_mirrors;
4421
0
    datum.keys = n_mirrors ? xmalloc(n_mirrors * sizeof *datum.keys) : NULL;
4422
0
    datum.values = NULL;
4423
0
    for (size_t i = 0; i < n_mirrors; i++) {
4424
0
        datum.keys[i].uuid = *mirrors[i];
4425
0
    }
4426
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_mirrors.type);
4427
0
    ovsdb_idl_condition_add_clause(cond,
4428
0
                          function,
4429
0
                          &ovsrec_bridge_col_mirrors,
4430
0
                          &datum);
4431
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_mirrors.type);
4432
0
}
4433
4434
/* Sets the "name" column from the "Bridge" table in 'row' to
4435
 * 'name'.
4436
 *
4437
 * The caller retains ownership of the arguments. */
4438
void
4439
ovsrec_bridge_add_clause_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *name)
4440
0
{
4441
0
    struct ovsdb_datum datum;
4442
4443
0
    datum.refcnt = NULL;
4444
4445
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4446
4447
0
    datum.n = 1;
4448
0
    datum.keys = key;
4449
0
    key->s = ovsdb_atom_string_create(name);
4450
0
    datum.values = NULL;
4451
0
    ovsdb_idl_condition_add_clause(cond,
4452
0
                          function,
4453
0
                          &ovsrec_bridge_col_name,
4454
0
                          &datum);
4455
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_name.type);
4456
0
}
4457
4458
/* Sets the "netflow" column from the "Bridge" table in 'row' to
4459
 * the 'netflow' set.
4460
 *
4461
 * If "netflow" is null, the column will be the empty set,
4462
 * otherwise it will contain the specified value.
4463
 *
4464
 * The caller retains ownership of the arguments. */
4465
void
4466
ovsrec_bridge_add_clause_netflow(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *netflow)
4467
0
{
4468
0
    struct ovsdb_datum datum;
4469
4470
0
    datum.refcnt = NULL;
4471
4472
0
    if (netflow) {
4473
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4474
0
        datum.n = 1;
4475
0
        datum.keys = key;
4476
0
        key->uuid = *netflow;
4477
0
    } else {
4478
0
        datum.n = 0;
4479
0
        datum.keys = NULL;
4480
0
    }
4481
0
    datum.values = NULL;
4482
0
    ovsdb_idl_condition_add_clause(cond,
4483
0
                          function,
4484
0
                          &ovsrec_bridge_col_netflow,
4485
0
                          &datum);
4486
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_netflow.type);
4487
0
}
4488
4489
/* Sets the "other_config" column's value from the "Bridge" table in 'row'
4490
 * to 'other_config'.
4491
 *
4492
 * The caller retains ownership of 'other_config' and everything in it. */
4493
void
4494
ovsrec_bridge_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
4495
0
{
4496
0
    struct ovsdb_datum datum;
4497
4498
0
    if (other_config) {
4499
0
        ovsdb_datum_from_smap(&datum, other_config);
4500
0
    } else {
4501
0
        ovsdb_datum_init_empty(&datum);
4502
0
    }
4503
4504
0
    ovsdb_idl_condition_add_clause(cond,
4505
0
                                   function,
4506
0
                                   &ovsrec_bridge_col_other_config,
4507
0
                                   &datum);
4508
4509
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_other_config.type);
4510
0
}
4511
4512
4513
/* Sets the "ports" column from the "Bridge" table in 'row' to
4514
 * the 'ports' set with 'n_ports' entries.
4515
 *
4516
 * The caller retains ownership of the arguments. */
4517
void
4518
ovsrec_bridge_add_clause_ports(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **ports, size_t n_ports)
4519
0
{
4520
0
    struct ovsdb_datum datum;
4521
4522
0
    datum.refcnt = NULL;
4523
0
    datum.n = n_ports;
4524
0
    datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
4525
0
    datum.values = NULL;
4526
0
    for (size_t i = 0; i < n_ports; i++) {
4527
0
        datum.keys[i].uuid = *ports[i];
4528
0
    }
4529
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_ports.type);
4530
0
    ovsdb_idl_condition_add_clause(cond,
4531
0
                          function,
4532
0
                          &ovsrec_bridge_col_ports,
4533
0
                          &datum);
4534
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_ports.type);
4535
0
}
4536
4537
/* Sets the "protocols" column from the "Bridge" table in 'row' to
4538
 * the 'protocols' set with 'n_protocols' entries.
4539
 *
4540
 * Argument constraints: one of "OpenFlow10", "OpenFlow11", "OpenFlow12", "OpenFlow13", "OpenFlow14", or "OpenFlow15"
4541
 *
4542
 * The caller retains ownership of the arguments. */
4543
void
4544
ovsrec_bridge_add_clause_protocols(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **protocols, size_t n_protocols)
4545
0
{
4546
0
    struct ovsdb_datum datum;
4547
4548
0
    datum.refcnt = NULL;
4549
0
    datum.n = n_protocols;
4550
0
    datum.keys = n_protocols ? xmalloc(n_protocols * sizeof *datum.keys) : NULL;
4551
0
    datum.values = NULL;
4552
0
    for (size_t i = 0; i < n_protocols; i++) {
4553
0
        datum.keys[i].s = ovsdb_atom_string_create(protocols[i]);
4554
0
    }
4555
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_protocols.type);
4556
0
    ovsdb_idl_condition_add_clause(cond,
4557
0
                          function,
4558
0
                          &ovsrec_bridge_col_protocols,
4559
0
                          &datum);
4560
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_protocols.type);
4561
0
}
4562
4563
/* Sets the "rstp_enable" column from the "Bridge" table in 'row' to
4564
 * 'rstp_enable'.
4565
 *
4566
 * The caller retains ownership of the arguments. */
4567
void
4568
ovsrec_bridge_add_clause_rstp_enable(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool rstp_enable)
4569
0
{
4570
0
    struct ovsdb_datum datum;
4571
4572
0
    datum.refcnt = NULL;
4573
4574
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4575
4576
0
    datum.n = 1;
4577
0
    datum.keys = key;
4578
0
    key->boolean = rstp_enable;
4579
0
    datum.values = NULL;
4580
0
    ovsdb_idl_condition_add_clause(cond,
4581
0
                          function,
4582
0
                          &ovsrec_bridge_col_rstp_enable,
4583
0
                          &datum);
4584
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_rstp_enable.type);
4585
0
}
4586
4587
/* Sets the "rstp_status" column's value from the "Bridge" table in 'row'
4588
 * to 'rstp_status'.
4589
 *
4590
 * The caller retains ownership of 'rstp_status' and everything in it. */
4591
void
4592
ovsrec_bridge_add_clause_rstp_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *rstp_status)
4593
0
{
4594
0
    struct ovsdb_datum datum;
4595
4596
0
    if (rstp_status) {
4597
0
        ovsdb_datum_from_smap(&datum, rstp_status);
4598
0
    } else {
4599
0
        ovsdb_datum_init_empty(&datum);
4600
0
    }
4601
4602
0
    ovsdb_idl_condition_add_clause(cond,
4603
0
                                   function,
4604
0
                                   &ovsrec_bridge_col_rstp_status,
4605
0
                                   &datum);
4606
4607
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_rstp_status.type);
4608
0
}
4609
4610
4611
/* Sets the "sflow" column from the "Bridge" table in 'row' to
4612
 * the 'sflow' set.
4613
 *
4614
 * If "sflow" is null, the column will be the empty set,
4615
 * otherwise it will contain the specified value.
4616
 *
4617
 * The caller retains ownership of the arguments. */
4618
void
4619
ovsrec_bridge_add_clause_sflow(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *sflow)
4620
0
{
4621
0
    struct ovsdb_datum datum;
4622
4623
0
    datum.refcnt = NULL;
4624
4625
0
    if (sflow) {
4626
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
4627
0
        datum.n = 1;
4628
0
        datum.keys = key;
4629
0
        key->uuid = *sflow;
4630
0
    } else {
4631
0
        datum.n = 0;
4632
0
        datum.keys = NULL;
4633
0
    }
4634
0
    datum.values = NULL;
4635
0
    ovsdb_idl_condition_add_clause(cond,
4636
0
                          function,
4637
0
                          &ovsrec_bridge_col_sflow,
4638
0
                          &datum);
4639
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_sflow.type);
4640
0
}
4641
4642
/* Sets the "status" column's value from the "Bridge" table in 'row'
4643
 * to 'status'.
4644
 *
4645
 * The caller retains ownership of 'status' and everything in it. */
4646
void
4647
ovsrec_bridge_add_clause_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *status)
4648
0
{
4649
0
    struct ovsdb_datum datum;
4650
4651
0
    if (status) {
4652
0
        ovsdb_datum_from_smap(&datum, status);
4653
0
    } else {
4654
0
        ovsdb_datum_init_empty(&datum);
4655
0
    }
4656
4657
0
    ovsdb_idl_condition_add_clause(cond,
4658
0
                                   function,
4659
0
                                   &ovsrec_bridge_col_status,
4660
0
                                   &datum);
4661
4662
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_status.type);
4663
0
}
4664
4665
4666
/* Sets the "stp_enable" column from the "Bridge" table in 'row' to
4667
 * 'stp_enable'.
4668
 *
4669
 * The caller retains ownership of the arguments. */
4670
void
4671
ovsrec_bridge_add_clause_stp_enable(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool stp_enable)
4672
0
{
4673
0
    struct ovsdb_datum datum;
4674
4675
0
    datum.refcnt = NULL;
4676
4677
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
4678
4679
0
    datum.n = 1;
4680
0
    datum.keys = key;
4681
0
    key->boolean = stp_enable;
4682
0
    datum.values = NULL;
4683
0
    ovsdb_idl_condition_add_clause(cond,
4684
0
                          function,
4685
0
                          &ovsrec_bridge_col_stp_enable,
4686
0
                          &datum);
4687
0
    ovsdb_datum_destroy(&datum, &ovsrec_bridge_col_stp_enable.type);
4688
0
}
4689
4690
/* Destroy 'row' of kind "Bridge". The row must have been
4691
 * created with ovsdb_idl_index_init_row.
4692
 */
4693
void
4694
ovsrec_bridge_index_destroy_row(const struct ovsrec_bridge *row)
4695
0
{
4696
0
    ovsdb_idl_index_destroy_row(&row->header_);
4697
0
}
4698
        
4699
4700
/* Creates a new row of kind "Bridge". */
4701
struct ovsrec_bridge *
4702
ovsrec_bridge_index_init_row(struct ovsdb_idl_index *index)
4703
0
{
4704
0
    ovs_assert(index->table->class_ == &ovsrec_table_bridge);
4705
0
    return ALIGNED_CAST(struct ovsrec_bridge *, ovsdb_idl_index_init_row(index));
4706
0
}
4707
4708
struct ovsrec_bridge *
4709
ovsrec_bridge_index_find(struct ovsdb_idl_index *index, const struct ovsrec_bridge *target)
4710
0
{
4711
0
    ovs_assert(index->table->class_ == &ovsrec_table_bridge);
4712
0
    return ovsrec_bridge_cast(ovsdb_idl_index_find(index, &target->header_));
4713
0
}
4714
4715
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
4716
int
4717
ovsrec_bridge_index_compare(
4718
    struct ovsdb_idl_index *index, 
4719
    const struct ovsrec_bridge *a, 
4720
    const struct ovsrec_bridge *b)
4721
0
{
4722
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
4723
0
}
4724
4725
struct ovsdb_idl_cursor
4726
ovsrec_bridge_cursor_first(struct ovsdb_idl_index *index)
4727
0
{
4728
0
    ovs_assert(index->table->class_ == &ovsrec_table_bridge);
4729
0
    return ovsdb_idl_cursor_first(index);
4730
0
}
4731
4732
struct ovsdb_idl_cursor
4733
ovsrec_bridge_cursor_first_eq(
4734
    struct ovsdb_idl_index *index, const struct ovsrec_bridge *target)
4735
0
{
4736
0
    ovs_assert(index->table->class_ == &ovsrec_table_bridge);
4737
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
4738
0
}
4739
4740
struct ovsdb_idl_cursor
4741
ovsrec_bridge_cursor_first_ge(
4742
    struct ovsdb_idl_index *index, const struct ovsrec_bridge *target)
4743
0
{
4744
0
    ovs_assert(index->table->class_ == &ovsrec_table_bridge);
4745
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
4746
0
}
4747
4748
struct ovsrec_bridge *
4749
ovsrec_bridge_cursor_data(struct ovsdb_idl_cursor *cursor)
4750
0
{
4751
0
    return ovsrec_bridge_cast(ovsdb_idl_cursor_data(cursor));
4752
0
}
4753
4754
4755
/* Sets the "auto_attach" column from the "Bridge" table in 'row' to
4756
 * the 'auto_attach' set.
4757
 *
4758
 * If "auto_attach" is null, the column will be the empty set,
4759
 * otherwise it will contain the specified value.
4760
 *
4761
 * The caller retains ownership of the arguments. */
4762
void
4763
ovsrec_bridge_index_set_auto_attach(const struct ovsrec_bridge *row, const struct ovsrec_autoattach *auto_attach)
4764
0
{
4765
0
    struct ovsdb_datum datum;
4766
4767
0
    datum.refcnt = NULL;
4768
0
    union ovsdb_atom *key;
4769
4770
0
    if (auto_attach) {
4771
0
        key = xmalloc(sizeof (union ovsdb_atom));
4772
0
        datum.n = 1;
4773
0
        datum.keys = key;
4774
0
        key->uuid = auto_attach->header_.uuid;
4775
0
    } else {
4776
0
        datum.n = 0;
4777
0
        datum.keys = NULL;
4778
0
    }
4779
0
    datum.values = NULL;
4780
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]);
4781
0
}
4782
4783
/* Sets the "controller" column from the "Bridge" table in 'row' to
4784
 * the 'controller' set with 'n_controller' entries.
4785
 *
4786
 * The caller retains ownership of the arguments. */
4787
void
4788
ovsrec_bridge_index_set_controller(const struct ovsrec_bridge *row, struct ovsrec_controller **controller, size_t n_controller)
4789
0
{
4790
0
    struct ovsdb_datum datum;
4791
4792
0
    datum.refcnt = NULL;
4793
0
    size_t i;
4794
4795
0
    datum.n = n_controller;
4796
0
    datum.keys = n_controller ? xmalloc(n_controller * sizeof *datum.keys) : NULL;
4797
0
    datum.values = NULL;
4798
0
    for (i = 0; i < n_controller; i++) {
4799
0
        datum.keys[i].uuid = controller[i]->header_.uuid;
4800
0
    }
4801
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_controller.type);
4802
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]);
4803
0
}
4804
4805
/* Sets the "datapath_id" column from the "Bridge" table in 'row' to
4806
 * the 'datapath_id' set.
4807
 *
4808
 * If "datapath_id" is null, the column will be the empty set,
4809
 * otherwise it will contain the specified value.
4810
 *
4811
 * The caller retains ownership of the arguments. */
4812
void
4813
ovsrec_bridge_index_set_datapath_id(const struct ovsrec_bridge *row, const char *datapath_id)
4814
0
{
4815
0
    struct ovsdb_datum datum;
4816
4817
0
    datum.refcnt = NULL;
4818
0
    union ovsdb_atom *key;
4819
4820
0
    if (datapath_id) {
4821
0
        key = xmalloc(sizeof (union ovsdb_atom));
4822
0
        datum.n = 1;
4823
0
        datum.keys = key;
4824
0
        key->s = ovsdb_atom_string_create(datapath_id);
4825
0
    } else {
4826
0
        datum.n = 0;
4827
0
        datum.keys = NULL;
4828
0
    }
4829
0
    datum.values = NULL;
4830
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]);
4831
0
}
4832
4833
/* Sets the "datapath_type" column from the "Bridge" table in 'row' to
4834
 * 'datapath_type'.
4835
 *
4836
 * The caller retains ownership of the arguments. */
4837
void
4838
ovsrec_bridge_index_set_datapath_type(const struct ovsrec_bridge *row, const char *datapath_type)
4839
0
{
4840
0
    struct ovsdb_datum datum;
4841
4842
0
    datum.refcnt = NULL;
4843
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
4844
4845
0
    datum.n = 1;
4846
0
    datum.keys = key;
4847
0
    key->s = ovsdb_atom_string_create(datapath_type);
4848
0
    datum.values = NULL;
4849
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]);
4850
0
}
4851
4852
/* Sets the "datapath_version" column from the "Bridge" table in 'row' to
4853
 * 'datapath_version'.
4854
 *
4855
 * The caller retains ownership of the arguments. */
4856
void
4857
ovsrec_bridge_index_set_datapath_version(const struct ovsrec_bridge *row, const char *datapath_version)
4858
0
{
4859
0
    struct ovsdb_datum datum;
4860
4861
0
    datum.refcnt = NULL;
4862
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
4863
4864
0
    datum.n = 1;
4865
0
    datum.keys = key;
4866
0
    key->s = ovsdb_atom_string_create(datapath_version);
4867
0
    datum.values = NULL;
4868
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]);
4869
0
}
4870
4871
/* Sets the "external_ids" column's value from the "Bridge" table in 'row'
4872
 * to 'external_ids'.
4873
 *
4874
 * The caller retains ownership of 'external_ids' and everything in it. */
4875
void
4876
ovsrec_bridge_index_set_external_ids(const struct ovsrec_bridge *row, const struct smap *external_ids)
4877
0
{
4878
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
4879
4880
0
    if (external_ids) {
4881
0
        struct smap_node *node;
4882
0
        size_t i;
4883
4884
0
        datum->n = smap_count(external_ids);
4885
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
4886
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
4887
0
        datum->refcnt = NULL;
4888
4889
0
        i = 0;
4890
0
        SMAP_FOR_EACH (node, external_ids) {
4891
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
4892
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
4893
0
            i++;
4894
0
        }
4895
0
        ovsdb_datum_sort_unique(datum, &ovsrec_bridge_col_external_ids.type);
4896
0
    } else {
4897
0
        ovsdb_datum_init_empty(datum);
4898
0
    }
4899
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
4900
0
                          &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_EXTERNAL_IDS],
4901
0
                          datum,
4902
0
                          &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
4903
0
    free(datum);
4904
0
}
4905
4906
4907
/* Sets the "fail_mode" column from the "Bridge" table in 'row' to
4908
 * the 'fail_mode' set.
4909
 *
4910
 * If "fail_mode" is null, the column will be the empty set,
4911
 * otherwise it will contain the specified value.
4912
 *
4913
 * Argument constraints: either "secure" or "standalone"
4914
 *
4915
 * The caller retains ownership of the arguments. */
4916
void
4917
ovsrec_bridge_index_set_fail_mode(const struct ovsrec_bridge *row, const char *fail_mode)
4918
0
{
4919
0
    struct ovsdb_datum datum;
4920
4921
0
    datum.refcnt = NULL;
4922
0
    union ovsdb_atom *key;
4923
4924
0
    if (fail_mode) {
4925
0
        key = xmalloc(sizeof (union ovsdb_atom));
4926
0
        datum.n = 1;
4927
0
        datum.keys = key;
4928
0
        key->s = ovsdb_atom_string_create(fail_mode);
4929
0
    } else {
4930
0
        datum.n = 0;
4931
0
        datum.keys = NULL;
4932
0
    }
4933
0
    datum.values = NULL;
4934
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]);
4935
0
}
4936
4937
/* Sets the "flood_vlans" column from the "Bridge" table in 'row' to
4938
 * the 'flood_vlans' set with 'n_flood_vlans' entries.
4939
 *
4940
 * Argument constraints: in range 0 to 4,095
4941
 *
4942
 * The caller retains ownership of the arguments. */
4943
void
4944
ovsrec_bridge_index_set_flood_vlans(const struct ovsrec_bridge *row, const int64_t *flood_vlans, size_t n_flood_vlans)
4945
0
{
4946
0
    struct ovsdb_datum datum;
4947
4948
0
    datum.refcnt = NULL;
4949
0
    size_t i;
4950
4951
0
    datum.n = n_flood_vlans;
4952
0
    datum.keys = n_flood_vlans ? xmalloc(n_flood_vlans * sizeof *datum.keys) : NULL;
4953
0
    datum.values = NULL;
4954
0
    for (i = 0; i < n_flood_vlans; i++) {
4955
0
        datum.keys[i].integer = flood_vlans[i];
4956
0
    }
4957
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_flood_vlans.type);
4958
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]);
4959
0
}
4960
4961
/* Sets the "flow_tables" column from the "Bridge" table in 'row' to
4962
 * the map with keys 'key_flow_tables' and values 'value_flow_tables'
4963
 * with 'n_flow_tables' entries.
4964
 *
4965
 * Argument constraints: key in range 0 to 254
4966
 *
4967
 * The caller retains ownership of the arguments. */
4968
void
4969
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)
4970
0
{
4971
0
    struct ovsdb_datum datum;
4972
4973
0
    datum.refcnt = NULL;
4974
0
    size_t i;
4975
4976
0
    datum.n = n_flow_tables;
4977
0
    datum.keys = n_flow_tables ? xmalloc(n_flow_tables * sizeof *datum.keys) : NULL;
4978
0
    datum.values = xmalloc(n_flow_tables * sizeof *datum.values);
4979
0
    for (i = 0; i < n_flow_tables; i++) {
4980
0
        datum.keys[i].integer = key_flow_tables[i];
4981
0
        datum.values[i].uuid = value_flow_tables[i]->header_.uuid;
4982
0
    }
4983
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_flow_tables.type);
4984
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]);
4985
0
}
4986
4987
/* Sets the "ipfix" column from the "Bridge" table in 'row' to
4988
 * the 'ipfix' set.
4989
 *
4990
 * If "ipfix" is null, the column will be the empty set,
4991
 * otherwise it will contain the specified value.
4992
 *
4993
 * The caller retains ownership of the arguments. */
4994
void
4995
ovsrec_bridge_index_set_ipfix(const struct ovsrec_bridge *row, const struct ovsrec_ipfix *ipfix)
4996
0
{
4997
0
    struct ovsdb_datum datum;
4998
4999
0
    datum.refcnt = NULL;
5000
0
    union ovsdb_atom *key;
5001
5002
0
    if (ipfix) {
5003
0
        key = xmalloc(sizeof (union ovsdb_atom));
5004
0
        datum.n = 1;
5005
0
        datum.keys = key;
5006
0
        key->uuid = ipfix->header_.uuid;
5007
0
    } else {
5008
0
        datum.n = 0;
5009
0
        datum.keys = NULL;
5010
0
    }
5011
0
    datum.values = NULL;
5012
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]);
5013
0
}
5014
5015
/* Sets the "mcast_snooping_enable" column from the "Bridge" table in 'row' to
5016
 * 'mcast_snooping_enable'.
5017
 *
5018
 * The caller retains ownership of the arguments. */
5019
void
5020
ovsrec_bridge_index_set_mcast_snooping_enable(const struct ovsrec_bridge *row, bool mcast_snooping_enable)
5021
0
{
5022
0
    struct ovsdb_datum datum;
5023
5024
0
    datum.refcnt = NULL;
5025
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
5026
5027
0
    datum.n = 1;
5028
0
    datum.keys = key;
5029
0
    key->boolean = mcast_snooping_enable;
5030
0
    datum.values = NULL;
5031
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]);
5032
0
}
5033
5034
/* Sets the "mirrors" column from the "Bridge" table in 'row' to
5035
 * the 'mirrors' set with 'n_mirrors' entries.
5036
 *
5037
 * The caller retains ownership of the arguments. */
5038
void
5039
ovsrec_bridge_index_set_mirrors(const struct ovsrec_bridge *row, struct ovsrec_mirror **mirrors, size_t n_mirrors)
5040
0
{
5041
0
    struct ovsdb_datum datum;
5042
5043
0
    datum.refcnt = NULL;
5044
0
    size_t i;
5045
5046
0
    datum.n = n_mirrors;
5047
0
    datum.keys = n_mirrors ? xmalloc(n_mirrors * sizeof *datum.keys) : NULL;
5048
0
    datum.values = NULL;
5049
0
    for (i = 0; i < n_mirrors; i++) {
5050
0
        datum.keys[i].uuid = mirrors[i]->header_.uuid;
5051
0
    }
5052
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_mirrors.type);
5053
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]);
5054
0
}
5055
5056
/* Sets the "name" column from the "Bridge" table in 'row' to
5057
 * 'name'.
5058
 *
5059
 * The caller retains ownership of the arguments. */
5060
void
5061
ovsrec_bridge_index_set_name(const struct ovsrec_bridge *row, const char *name)
5062
0
{
5063
0
    struct ovsdb_datum datum;
5064
5065
0
    datum.refcnt = NULL;
5066
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
5067
5068
0
    datum.n = 1;
5069
0
    datum.keys = key;
5070
0
    key->s = ovsdb_atom_string_create(name);
5071
0
    datum.values = NULL;
5072
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]);
5073
0
}
5074
5075
/* Sets the "netflow" column from the "Bridge" table in 'row' to
5076
 * the 'netflow' set.
5077
 *
5078
 * If "netflow" is null, the column will be the empty set,
5079
 * otherwise it will contain the specified value.
5080
 *
5081
 * The caller retains ownership of the arguments. */
5082
void
5083
ovsrec_bridge_index_set_netflow(const struct ovsrec_bridge *row, const struct ovsrec_netflow *netflow)
5084
0
{
5085
0
    struct ovsdb_datum datum;
5086
5087
0
    datum.refcnt = NULL;
5088
0
    union ovsdb_atom *key;
5089
5090
0
    if (netflow) {
5091
0
        key = xmalloc(sizeof (union ovsdb_atom));
5092
0
        datum.n = 1;
5093
0
        datum.keys = key;
5094
0
        key->uuid = netflow->header_.uuid;
5095
0
    } else {
5096
0
        datum.n = 0;
5097
0
        datum.keys = NULL;
5098
0
    }
5099
0
    datum.values = NULL;
5100
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]);
5101
0
}
5102
5103
/* Sets the "other_config" column's value from the "Bridge" table in 'row'
5104
 * to 'other_config'.
5105
 *
5106
 * The caller retains ownership of 'other_config' and everything in it. */
5107
void
5108
ovsrec_bridge_index_set_other_config(const struct ovsrec_bridge *row, const struct smap *other_config)
5109
0
{
5110
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
5111
5112
0
    if (other_config) {
5113
0
        struct smap_node *node;
5114
0
        size_t i;
5115
5116
0
        datum->n = smap_count(other_config);
5117
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
5118
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
5119
0
        datum->refcnt = NULL;
5120
5121
0
        i = 0;
5122
0
        SMAP_FOR_EACH (node, other_config) {
5123
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
5124
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
5125
0
            i++;
5126
0
        }
5127
0
        ovsdb_datum_sort_unique(datum, &ovsrec_bridge_col_other_config.type);
5128
0
    } else {
5129
0
        ovsdb_datum_init_empty(datum);
5130
0
    }
5131
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
5132
0
                          &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_OTHER_CONFIG],
5133
0
                          datum,
5134
0
                          &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5135
0
    free(datum);
5136
0
}
5137
5138
5139
/* Sets the "ports" column from the "Bridge" table in 'row' to
5140
 * the 'ports' set with 'n_ports' entries.
5141
 *
5142
 * The caller retains ownership of the arguments. */
5143
void
5144
ovsrec_bridge_index_set_ports(const struct ovsrec_bridge *row, struct ovsrec_port **ports, size_t n_ports)
5145
0
{
5146
0
    struct ovsdb_datum datum;
5147
5148
0
    datum.refcnt = NULL;
5149
0
    size_t i;
5150
5151
0
    datum.n = n_ports;
5152
0
    datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
5153
0
    datum.values = NULL;
5154
0
    for (i = 0; i < n_ports; i++) {
5155
0
        datum.keys[i].uuid = ports[i]->header_.uuid;
5156
0
    }
5157
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_ports.type);
5158
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]);
5159
0
}
5160
5161
/* Sets the "protocols" column from the "Bridge" table in 'row' to
5162
 * the 'protocols' set with 'n_protocols' entries.
5163
 *
5164
 * Argument constraints: one of "OpenFlow10", "OpenFlow11", "OpenFlow12", "OpenFlow13", "OpenFlow14", or "OpenFlow15"
5165
 *
5166
 * The caller retains ownership of the arguments. */
5167
void
5168
ovsrec_bridge_index_set_protocols(const struct ovsrec_bridge *row, const char **protocols, size_t n_protocols)
5169
0
{
5170
0
    struct ovsdb_datum datum;
5171
5172
0
    datum.refcnt = NULL;
5173
0
    size_t i;
5174
5175
0
    datum.n = n_protocols;
5176
0
    datum.keys = n_protocols ? xmalloc(n_protocols * sizeof *datum.keys) : NULL;
5177
0
    datum.values = NULL;
5178
0
    for (i = 0; i < n_protocols; i++) {
5179
0
        datum.keys[i].s = ovsdb_atom_string_create(protocols[i]);
5180
0
    }
5181
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_bridge_col_protocols.type);
5182
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]);
5183
0
}
5184
5185
/* Sets the "rstp_enable" column from the "Bridge" table in 'row' to
5186
 * 'rstp_enable'.
5187
 *
5188
 * The caller retains ownership of the arguments. */
5189
void
5190
ovsrec_bridge_index_set_rstp_enable(const struct ovsrec_bridge *row, bool rstp_enable)
5191
0
{
5192
0
    struct ovsdb_datum datum;
5193
5194
0
    datum.refcnt = NULL;
5195
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
5196
5197
0
    datum.n = 1;
5198
0
    datum.keys = key;
5199
0
    key->boolean = rstp_enable;
5200
0
    datum.values = NULL;
5201
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]);
5202
0
}
5203
5204
/* Sets the "rstp_status" column's value from the "Bridge" table in 'row'
5205
 * to 'rstp_status'.
5206
 *
5207
 * The caller retains ownership of 'rstp_status' and everything in it. */
5208
void
5209
ovsrec_bridge_index_set_rstp_status(const struct ovsrec_bridge *row, const struct smap *rstp_status)
5210
0
{
5211
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
5212
5213
0
    if (rstp_status) {
5214
0
        struct smap_node *node;
5215
0
        size_t i;
5216
5217
0
        datum->n = smap_count(rstp_status);
5218
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
5219
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
5220
0
        datum->refcnt = NULL;
5221
5222
0
        i = 0;
5223
0
        SMAP_FOR_EACH (node, rstp_status) {
5224
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
5225
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
5226
0
            i++;
5227
0
        }
5228
0
        ovsdb_datum_sort_unique(datum, &ovsrec_bridge_col_rstp_status.type);
5229
0
    } else {
5230
0
        ovsdb_datum_init_empty(datum);
5231
0
    }
5232
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
5233
0
                          &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_RSTP_STATUS],
5234
0
                          datum,
5235
0
                          &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5236
0
    free(datum);
5237
0
}
5238
5239
5240
/* Sets the "sflow" column from the "Bridge" table in 'row' to
5241
 * the 'sflow' set.
5242
 *
5243
 * If "sflow" is null, the column will be the empty set,
5244
 * otherwise it will contain the specified value.
5245
 *
5246
 * The caller retains ownership of the arguments. */
5247
void
5248
ovsrec_bridge_index_set_sflow(const struct ovsrec_bridge *row, const struct ovsrec_sflow *sflow)
5249
0
{
5250
0
    struct ovsdb_datum datum;
5251
5252
0
    datum.refcnt = NULL;
5253
0
    union ovsdb_atom *key;
5254
5255
0
    if (sflow) {
5256
0
        key = xmalloc(sizeof (union ovsdb_atom));
5257
0
        datum.n = 1;
5258
0
        datum.keys = key;
5259
0
        key->uuid = sflow->header_.uuid;
5260
0
    } else {
5261
0
        datum.n = 0;
5262
0
        datum.keys = NULL;
5263
0
    }
5264
0
    datum.values = NULL;
5265
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]);
5266
0
}
5267
5268
/* Sets the "status" column's value from the "Bridge" table in 'row'
5269
 * to 'status'.
5270
 *
5271
 * The caller retains ownership of 'status' and everything in it. */
5272
void
5273
ovsrec_bridge_index_set_status(const struct ovsrec_bridge *row, const struct smap *status)
5274
0
{
5275
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
5276
5277
0
    if (status) {
5278
0
        struct smap_node *node;
5279
0
        size_t i;
5280
5281
0
        datum->n = smap_count(status);
5282
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
5283
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
5284
0
        datum->refcnt = NULL;
5285
5286
0
        i = 0;
5287
0
        SMAP_FOR_EACH (node, status) {
5288
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
5289
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
5290
0
            i++;
5291
0
        }
5292
0
        ovsdb_datum_sort_unique(datum, &ovsrec_bridge_col_status.type);
5293
0
    } else {
5294
0
        ovsdb_datum_init_empty(datum);
5295
0
    }
5296
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
5297
0
                          &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_STATUS],
5298
0
                          datum,
5299
0
                          &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]);
5300
0
    free(datum);
5301
0
}
5302
5303
5304
/* Sets the "stp_enable" column from the "Bridge" table in 'row' to
5305
 * 'stp_enable'.
5306
 *
5307
 * The caller retains ownership of the arguments. */
5308
void
5309
ovsrec_bridge_index_set_stp_enable(const struct ovsrec_bridge *row, bool stp_enable)
5310
0
{
5311
0
    struct ovsdb_datum datum;
5312
5313
0
    datum.refcnt = NULL;
5314
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
5315
5316
0
    datum.n = 1;
5317
0
    datum.keys = key;
5318
0
    key->boolean = stp_enable;
5319
0
    datum.values = NULL;
5320
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]);
5321
0
}
5322
5323
struct ovsdb_idl_column ovsrec_bridge_columns[OVSREC_BRIDGE_N_COLUMNS];
5324
5325
unsigned int
5326
ovsrec_bridge_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
5327
0
{
5328
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_bridge, condition);
5329
0
}
5330
static struct json Bridge_col_fail_mode_key_enum_key_strings[2] = {
5331
    { .type = JSON_STRING, .string = "secure", .count = 2 },
5332
    { .type = JSON_STRING, .string = "standalone", .count = 2 },
5333
};
5334
static union ovsdb_atom Bridge_col_fail_mode_key_enum_keys[2] = {
5335
    { .s = &Bridge_col_fail_mode_key_enum_key_strings[0] },
5336
    { .s = &Bridge_col_fail_mode_key_enum_key_strings[1] },
5337
};
5338
static struct ovsdb_datum Bridge_col_fail_mode_key_enum = {
5339
    .n = 2,
5340
    .keys = Bridge_col_fail_mode_key_enum_keys,
5341
};
5342
static struct json Bridge_col_protocols_key_enum_key_strings[6] = {
5343
    { .type = JSON_STRING, .string = "OpenFlow10", .count = 2 },
5344
    { .type = JSON_STRING, .string = "OpenFlow11", .count = 2 },
5345
    { .type = JSON_STRING, .string = "OpenFlow12", .count = 2 },
5346
    { .type = JSON_STRING, .string = "OpenFlow13", .count = 2 },
5347
    { .type = JSON_STRING, .string = "OpenFlow14", .count = 2 },
5348
    { .type = JSON_STRING, .string = "OpenFlow15", .count = 2 },
5349
};
5350
static union ovsdb_atom Bridge_col_protocols_key_enum_keys[6] = {
5351
    { .s = &Bridge_col_protocols_key_enum_key_strings[0] },
5352
    { .s = &Bridge_col_protocols_key_enum_key_strings[1] },
5353
    { .s = &Bridge_col_protocols_key_enum_key_strings[2] },
5354
    { .s = &Bridge_col_protocols_key_enum_key_strings[3] },
5355
    { .s = &Bridge_col_protocols_key_enum_key_strings[4] },
5356
    { .s = &Bridge_col_protocols_key_enum_key_strings[5] },
5357
};
5358
static struct ovsdb_datum Bridge_col_protocols_key_enum = {
5359
    .n = 6,
5360
    .keys = Bridge_col_protocols_key_enum_keys,
5361
};
5362
5363
struct ovsdb_idl_column ovsrec_bridge_columns[OVSREC_BRIDGE_N_COLUMNS] = {
5364
    [OVSREC_BRIDGE_COL_AUTO_ATTACH] = {
5365
         .name = "auto_attach",
5366
         .type = {
5367
            .key = {
5368
               .type = OVSDB_TYPE_UUID,
5369
               .uuid = { .refTableName = "AutoAttach", .refType = OVSDB_REF_STRONG },
5370
            },
5371
            .value = OVSDB_BASE_VOID_INIT,
5372
            .n_min = 0,
5373
            .n_max = 1,
5374
         },
5375
         .is_mutable = true,
5376
         .is_synthetic = false,
5377
         .parse = ovsrec_bridge_parse_auto_attach,
5378
         .unparse = ovsrec_bridge_unparse_auto_attach,
5379
    },
5380
5381
    [OVSREC_BRIDGE_COL_CONTROLLER] = {
5382
         .name = "controller",
5383
         .type = {
5384
            .key = {
5385
               .type = OVSDB_TYPE_UUID,
5386
               .uuid = { .refTableName = "Controller", .refType = OVSDB_REF_STRONG },
5387
            },
5388
            .value = OVSDB_BASE_VOID_INIT,
5389
            .n_min = 0,
5390
            .n_max = UINT_MAX,
5391
         },
5392
         .is_mutable = true,
5393
         .is_synthetic = false,
5394
         .parse = ovsrec_bridge_parse_controller,
5395
         .unparse = ovsrec_bridge_unparse_controller,
5396
    },
5397
5398
    [OVSREC_BRIDGE_COL_DATAPATH_ID] = {
5399
         .name = "datapath_id",
5400
         .type = {
5401
            .key = {
5402
               .type = OVSDB_TYPE_STRING,
5403
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5404
            },
5405
            .value = OVSDB_BASE_VOID_INIT,
5406
            .n_min = 0,
5407
            .n_max = 1,
5408
         },
5409
         .is_mutable = true,
5410
         .is_synthetic = false,
5411
         .parse = ovsrec_bridge_parse_datapath_id,
5412
         .unparse = ovsrec_bridge_unparse_datapath_id,
5413
    },
5414
5415
    [OVSREC_BRIDGE_COL_DATAPATH_TYPE] = {
5416
         .name = "datapath_type",
5417
         .type = {
5418
            .key = {
5419
               .type = OVSDB_TYPE_STRING,
5420
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5421
            },
5422
            .value = OVSDB_BASE_VOID_INIT,
5423
            .n_min = 1,
5424
            .n_max = 1,
5425
         },
5426
         .is_mutable = true,
5427
         .is_synthetic = false,
5428
         .parse = ovsrec_bridge_parse_datapath_type,
5429
         .unparse = ovsrec_bridge_unparse_datapath_type,
5430
    },
5431
5432
    [OVSREC_BRIDGE_COL_DATAPATH_VERSION] = {
5433
         .name = "datapath_version",
5434
         .type = {
5435
            .key = {
5436
               .type = OVSDB_TYPE_STRING,
5437
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5438
            },
5439
            .value = OVSDB_BASE_VOID_INIT,
5440
            .n_min = 1,
5441
            .n_max = 1,
5442
         },
5443
         .is_mutable = true,
5444
         .is_synthetic = false,
5445
         .parse = ovsrec_bridge_parse_datapath_version,
5446
         .unparse = ovsrec_bridge_unparse_datapath_version,
5447
    },
5448
5449
    [OVSREC_BRIDGE_COL_EXTERNAL_IDS] = {
5450
         .name = "external_ids",
5451
         .type = {
5452
            .key = {
5453
               .type = OVSDB_TYPE_STRING,
5454
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5455
            },
5456
            .value = {
5457
                .type = OVSDB_TYPE_STRING,
5458
                .string = { .minLen = 0, .maxLen = UINT_MAX },
5459
            },
5460
            .n_min = 0,
5461
            .n_max = UINT_MAX,
5462
         },
5463
         .is_mutable = true,
5464
         .is_synthetic = false,
5465
         .parse = ovsrec_bridge_parse_external_ids,
5466
         .unparse = ovsrec_bridge_unparse_external_ids,
5467
    },
5468
5469
    [OVSREC_BRIDGE_COL_FAIL_MODE] = {
5470
         .name = "fail_mode",
5471
         .type = {
5472
            .key = {
5473
               .type = OVSDB_TYPE_STRING,
5474
               .enum_ = &Bridge_col_fail_mode_key_enum,
5475
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5476
            },
5477
            .value = OVSDB_BASE_VOID_INIT,
5478
            .n_min = 0,
5479
            .n_max = 1,
5480
         },
5481
         .is_mutable = true,
5482
         .is_synthetic = false,
5483
         .parse = ovsrec_bridge_parse_fail_mode,
5484
         .unparse = ovsrec_bridge_unparse_fail_mode,
5485
    },
5486
5487
    [OVSREC_BRIDGE_COL_FLOOD_VLANS] = {
5488
         .name = "flood_vlans",
5489
         .type = {
5490
            .key = {
5491
               .type = OVSDB_TYPE_INTEGER,
5492
               .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
5493
            },
5494
            .value = OVSDB_BASE_VOID_INIT,
5495
            .n_min = 0,
5496
            .n_max = 4096,
5497
         },
5498
         .is_mutable = true,
5499
         .is_synthetic = false,
5500
         .parse = ovsrec_bridge_parse_flood_vlans,
5501
         .unparse = ovsrec_bridge_unparse_flood_vlans,
5502
    },
5503
5504
    [OVSREC_BRIDGE_COL_FLOW_TABLES] = {
5505
         .name = "flow_tables",
5506
         .type = {
5507
            .key = {
5508
               .type = OVSDB_TYPE_INTEGER,
5509
               .integer = { .min = INT64_C(0), .max = INT64_C(254) },
5510
            },
5511
            .value = {
5512
                .type = OVSDB_TYPE_UUID,
5513
                .uuid = { .refTableName = "Flow_Table", .refType = OVSDB_REF_STRONG },
5514
            },
5515
            .n_min = 0,
5516
            .n_max = UINT_MAX,
5517
         },
5518
         .is_mutable = true,
5519
         .is_synthetic = false,
5520
         .parse = ovsrec_bridge_parse_flow_tables,
5521
         .unparse = ovsrec_bridge_unparse_flow_tables,
5522
    },
5523
5524
    [OVSREC_BRIDGE_COL_IPFIX] = {
5525
         .name = "ipfix",
5526
         .type = {
5527
            .key = {
5528
               .type = OVSDB_TYPE_UUID,
5529
               .uuid = { .refTableName = "IPFIX", .refType = OVSDB_REF_STRONG },
5530
            },
5531
            .value = OVSDB_BASE_VOID_INIT,
5532
            .n_min = 0,
5533
            .n_max = 1,
5534
         },
5535
         .is_mutable = true,
5536
         .is_synthetic = false,
5537
         .parse = ovsrec_bridge_parse_ipfix,
5538
         .unparse = ovsrec_bridge_unparse_ipfix,
5539
    },
5540
5541
    [OVSREC_BRIDGE_COL_MCAST_SNOOPING_ENABLE] = {
5542
         .name = "mcast_snooping_enable",
5543
         .type = {
5544
            .key = {
5545
               .type = OVSDB_TYPE_BOOLEAN,
5546
            },
5547
            .value = OVSDB_BASE_VOID_INIT,
5548
            .n_min = 1,
5549
            .n_max = 1,
5550
         },
5551
         .is_mutable = true,
5552
         .is_synthetic = false,
5553
         .parse = ovsrec_bridge_parse_mcast_snooping_enable,
5554
         .unparse = ovsrec_bridge_unparse_mcast_snooping_enable,
5555
    },
5556
5557
    [OVSREC_BRIDGE_COL_MIRRORS] = {
5558
         .name = "mirrors",
5559
         .type = {
5560
            .key = {
5561
               .type = OVSDB_TYPE_UUID,
5562
               .uuid = { .refTableName = "Mirror", .refType = OVSDB_REF_STRONG },
5563
            },
5564
            .value = OVSDB_BASE_VOID_INIT,
5565
            .n_min = 0,
5566
            .n_max = UINT_MAX,
5567
         },
5568
         .is_mutable = true,
5569
         .is_synthetic = false,
5570
         .parse = ovsrec_bridge_parse_mirrors,
5571
         .unparse = ovsrec_bridge_unparse_mirrors,
5572
    },
5573
5574
    [OVSREC_BRIDGE_COL_NAME] = {
5575
         .name = "name",
5576
         .type = {
5577
            .key = {
5578
               .type = OVSDB_TYPE_STRING,
5579
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5580
            },
5581
            .value = OVSDB_BASE_VOID_INIT,
5582
            .n_min = 1,
5583
            .n_max = 1,
5584
         },
5585
         .is_mutable = false,
5586
         .is_synthetic = false,
5587
         .parse = ovsrec_bridge_parse_name,
5588
         .unparse = ovsrec_bridge_unparse_name,
5589
    },
5590
5591
    [OVSREC_BRIDGE_COL_NETFLOW] = {
5592
         .name = "netflow",
5593
         .type = {
5594
            .key = {
5595
               .type = OVSDB_TYPE_UUID,
5596
               .uuid = { .refTableName = "NetFlow", .refType = OVSDB_REF_STRONG },
5597
            },
5598
            .value = OVSDB_BASE_VOID_INIT,
5599
            .n_min = 0,
5600
            .n_max = 1,
5601
         },
5602
         .is_mutable = true,
5603
         .is_synthetic = false,
5604
         .parse = ovsrec_bridge_parse_netflow,
5605
         .unparse = ovsrec_bridge_unparse_netflow,
5606
    },
5607
5608
    [OVSREC_BRIDGE_COL_OTHER_CONFIG] = {
5609
         .name = "other_config",
5610
         .type = {
5611
            .key = {
5612
               .type = OVSDB_TYPE_STRING,
5613
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5614
            },
5615
            .value = {
5616
                .type = OVSDB_TYPE_STRING,
5617
                .string = { .minLen = 0, .maxLen = UINT_MAX },
5618
            },
5619
            .n_min = 0,
5620
            .n_max = UINT_MAX,
5621
         },
5622
         .is_mutable = true,
5623
         .is_synthetic = false,
5624
         .parse = ovsrec_bridge_parse_other_config,
5625
         .unparse = ovsrec_bridge_unparse_other_config,
5626
    },
5627
5628
    [OVSREC_BRIDGE_COL_PORTS] = {
5629
         .name = "ports",
5630
         .type = {
5631
            .key = {
5632
               .type = OVSDB_TYPE_UUID,
5633
               .uuid = { .refTableName = "Port", .refType = OVSDB_REF_STRONG },
5634
            },
5635
            .value = OVSDB_BASE_VOID_INIT,
5636
            .n_min = 0,
5637
            .n_max = UINT_MAX,
5638
         },
5639
         .is_mutable = true,
5640
         .is_synthetic = false,
5641
         .parse = ovsrec_bridge_parse_ports,
5642
         .unparse = ovsrec_bridge_unparse_ports,
5643
    },
5644
5645
    [OVSREC_BRIDGE_COL_PROTOCOLS] = {
5646
         .name = "protocols",
5647
         .type = {
5648
            .key = {
5649
               .type = OVSDB_TYPE_STRING,
5650
               .enum_ = &Bridge_col_protocols_key_enum,
5651
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5652
            },
5653
            .value = OVSDB_BASE_VOID_INIT,
5654
            .n_min = 0,
5655
            .n_max = UINT_MAX,
5656
         },
5657
         .is_mutable = true,
5658
         .is_synthetic = false,
5659
         .parse = ovsrec_bridge_parse_protocols,
5660
         .unparse = ovsrec_bridge_unparse_protocols,
5661
    },
5662
5663
    [OVSREC_BRIDGE_COL_RSTP_ENABLE] = {
5664
         .name = "rstp_enable",
5665
         .type = {
5666
            .key = {
5667
               .type = OVSDB_TYPE_BOOLEAN,
5668
            },
5669
            .value = OVSDB_BASE_VOID_INIT,
5670
            .n_min = 1,
5671
            .n_max = 1,
5672
         },
5673
         .is_mutable = true,
5674
         .is_synthetic = false,
5675
         .parse = ovsrec_bridge_parse_rstp_enable,
5676
         .unparse = ovsrec_bridge_unparse_rstp_enable,
5677
    },
5678
5679
    [OVSREC_BRIDGE_COL_RSTP_STATUS] = {
5680
         .name = "rstp_status",
5681
         .type = {
5682
            .key = {
5683
               .type = OVSDB_TYPE_STRING,
5684
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5685
            },
5686
            .value = {
5687
                .type = OVSDB_TYPE_STRING,
5688
                .string = { .minLen = 0, .maxLen = UINT_MAX },
5689
            },
5690
            .n_min = 0,
5691
            .n_max = UINT_MAX,
5692
         },
5693
         .is_mutable = true,
5694
         .is_synthetic = false,
5695
         .parse = ovsrec_bridge_parse_rstp_status,
5696
         .unparse = ovsrec_bridge_unparse_rstp_status,
5697
    },
5698
5699
    [OVSREC_BRIDGE_COL_SFLOW] = {
5700
         .name = "sflow",
5701
         .type = {
5702
            .key = {
5703
               .type = OVSDB_TYPE_UUID,
5704
               .uuid = { .refTableName = "sFlow", .refType = OVSDB_REF_STRONG },
5705
            },
5706
            .value = OVSDB_BASE_VOID_INIT,
5707
            .n_min = 0,
5708
            .n_max = 1,
5709
         },
5710
         .is_mutable = true,
5711
         .is_synthetic = false,
5712
         .parse = ovsrec_bridge_parse_sflow,
5713
         .unparse = ovsrec_bridge_unparse_sflow,
5714
    },
5715
5716
    [OVSREC_BRIDGE_COL_STATUS] = {
5717
         .name = "status",
5718
         .type = {
5719
            .key = {
5720
               .type = OVSDB_TYPE_STRING,
5721
               .string = { .minLen = 0, .maxLen = UINT_MAX },
5722
            },
5723
            .value = {
5724
                .type = OVSDB_TYPE_STRING,
5725
                .string = { .minLen = 0, .maxLen = UINT_MAX },
5726
            },
5727
            .n_min = 0,
5728
            .n_max = UINT_MAX,
5729
         },
5730
         .is_mutable = true,
5731
         .is_synthetic = false,
5732
         .parse = ovsrec_bridge_parse_status,
5733
         .unparse = ovsrec_bridge_unparse_status,
5734
    },
5735
5736
    [OVSREC_BRIDGE_COL_STP_ENABLE] = {
5737
         .name = "stp_enable",
5738
         .type = {
5739
            .key = {
5740
               .type = OVSDB_TYPE_BOOLEAN,
5741
            },
5742
            .value = OVSDB_BASE_VOID_INIT,
5743
            .n_min = 1,
5744
            .n_max = 1,
5745
         },
5746
         .is_mutable = true,
5747
         .is_synthetic = false,
5748
         .parse = ovsrec_bridge_parse_stp_enable,
5749
         .unparse = ovsrec_bridge_unparse_stp_enable,
5750
    },
5751
5752
};
5753

5754
/* CT_Timeout_Policy table. */
5755
5756
bool
5757
ovsrec_server_has_ct_timeout_policy_table_col_external_ids(const struct ovsdb_idl *idl)
5758
0
{
5759
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ct_timeout_policy_col_external_ids);
5760
0
}
5761
5762
5763
bool
5764
ovsrec_server_has_ct_timeout_policy_table_col_timeouts(const struct ovsdb_idl *idl)
5765
0
{
5766
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ct_timeout_policy_col_timeouts);
5767
0
}
5768
5769
5770
bool
5771
ovsrec_server_has_ct_timeout_policy_table(const struct ovsdb_idl *idl)
5772
0
{
5773
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_CT_TIMEOUT_POLICY]);
5774
0
}
5775
5776
5777
const struct ovsrec_ct_timeout_policy_table *
5778
ovsrec_ct_timeout_policy_table_get(const struct ovsdb_idl *idl)
5779
0
{
5780
0
    return (const struct ovsrec_ct_timeout_policy_table *) idl;
5781
0
}
5782
5783
const struct ovsrec_ct_timeout_policy *
5784
ovsrec_ct_timeout_policy_table_first(const struct ovsrec_ct_timeout_policy_table *table)
5785
0
{
5786
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
5787
0
    return ovsrec_ct_timeout_policy_first(idl);
5788
0
}
5789
5790
5791
const struct ovsrec_ct_timeout_policy *
5792
ovsrec_ct_timeout_policy_table_track_get_first(const struct ovsrec_ct_timeout_policy_table *table)
5793
0
{
5794
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
5795
0
    return ovsrec_ct_timeout_policy_track_get_first(idl);
5796
0
}
5797
5798
5799
static void
5800
ovsrec_ct_timeout_policy_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5801
0
{
5802
0
    struct ovsrec_ct_timeout_policy *row = ovsrec_ct_timeout_policy_cast(row_);
5803
0
    smap_init(&row->external_ids);
5804
0
    for (size_t i = 0; i < datum->n; i++) {
5805
0
        smap_add(&row->external_ids,
5806
0
                 json_string(datum->keys[i].s),
5807
0
                 json_string(datum->values[i].s));
5808
0
    }
5809
0
}
5810
5811
static void
5812
ovsrec_ct_timeout_policy_parse_timeouts(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5813
0
{
5814
0
    struct ovsrec_ct_timeout_policy *row = ovsrec_ct_timeout_policy_cast(row_);
5815
0
    row->key_timeouts = NULL;
5816
0
    row->value_timeouts = NULL;
5817
0
    row->n_timeouts = 0;
5818
0
    for (size_t i = 0; i < datum->n; i++) {
5819
0
        if (!row->n_timeouts) {
5820
0
            row->key_timeouts = xmalloc(datum->n * sizeof *row->key_timeouts);
5821
0
            row->value_timeouts = xmalloc(datum->n * sizeof *row->value_timeouts);
5822
0
        }
5823
0
        row->key_timeouts[row->n_timeouts] = datum->keys[i].s->string;
5824
0
        row->value_timeouts[row->n_timeouts] = datum->values[i].integer;
5825
0
        row->n_timeouts++;
5826
0
    }
5827
0
}
5828
5829
static void
5830
ovsrec_ct_timeout_policy_unparse_external_ids(struct ovsdb_idl_row *row_)
5831
0
{
5832
0
    struct ovsrec_ct_timeout_policy *row = ovsrec_ct_timeout_policy_cast(row_);
5833
0
    smap_destroy(&row->external_ids);
5834
0
}
5835
5836
static void
5837
ovsrec_ct_timeout_policy_unparse_timeouts(struct ovsdb_idl_row *row_)
5838
0
{
5839
0
    struct ovsrec_ct_timeout_policy *row = ovsrec_ct_timeout_policy_cast(row_);
5840
0
    free(row->key_timeouts);
5841
0
    free(row->value_timeouts);
5842
0
}
5843
5844
static void
5845
ovsrec_ct_timeout_policy_init__(struct ovsdb_idl_row *row)
5846
0
{
5847
0
    ovsrec_ct_timeout_policy_init(ovsrec_ct_timeout_policy_cast(row));
5848
0
}
5849
5850
/* Clears the contents of 'row' in table "CT_Timeout_Policy". */
5851
void
5852
ovsrec_ct_timeout_policy_init(struct ovsrec_ct_timeout_policy *row)
5853
0
{
5854
0
    memset(row, 0, sizeof *row); 
5855
0
    smap_init(&row->external_ids);
5856
0
}
5857
5858
/* Searches table "CT_Timeout_Policy" in 'idl' for a row with UUID 'uuid'.  Returns
5859
 * a pointer to the row if there is one, otherwise a null pointer.  */
5860
const struct ovsrec_ct_timeout_policy *
5861
ovsrec_ct_timeout_policy_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
5862
0
{
5863
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_ct_timeout_policy, uuid));
5864
0
}
5865
5866
/* Searches table "CT_Timeout_Policy" for a row with UUID 'uuid'.  Returns
5867
 * a pointer to the row if there is one, otherwise a null pointer.  */
5868
const struct ovsrec_ct_timeout_policy *
5869
ovsrec_ct_timeout_policy_table_get_for_uuid(const struct ovsrec_ct_timeout_policy_table *table, const struct uuid *uuid)
5870
0
{
5871
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
5872
0
    return ovsrec_ct_timeout_policy_get_for_uuid(idl, uuid);
5873
0
}
5874
5875
/* Returns a row in table "CT_Timeout_Policy" in 'idl', or a null pointer if that
5876
 * table is empty.
5877
 *
5878
 * Database tables are internally maintained as hash tables, so adding or
5879
 * removing rows while traversing the same table can cause some rows to be
5880
 * visited twice or not at apply. */
5881
const struct ovsrec_ct_timeout_policy *
5882
ovsrec_ct_timeout_policy_first(const struct ovsdb_idl *idl)
5883
0
{
5884
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_first_row(idl, &ovsrec_table_ct_timeout_policy));
5885
0
}
5886
5887
/* Returns a row following 'row' within its table, or a null pointer if 'row'
5888
 * is the last row in its table. */
5889
const struct ovsrec_ct_timeout_policy *
5890
ovsrec_ct_timeout_policy_next(const struct ovsrec_ct_timeout_policy *row)
5891
0
{
5892
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_next_row(&row->header_));
5893
0
}
5894
5895
unsigned int ovsrec_ct_timeout_policy_get_seqno(const struct ovsdb_idl *idl)
5896
0
{
5897
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_ct_timeout_policy);
5898
0
}
5899
5900
unsigned int ovsrec_ct_timeout_policy_row_get_seqno(const struct ovsrec_ct_timeout_policy *row, enum ovsdb_idl_change change)
5901
0
{
5902
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
5903
0
}
5904
5905
const struct ovsrec_ct_timeout_policy *
5906
ovsrec_ct_timeout_policy_track_get_first(const struct ovsdb_idl *idl)
5907
0
{
5908
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_ct_timeout_policy));
5909
0
}
5910
5911
const struct ovsrec_ct_timeout_policy
5912
*ovsrec_ct_timeout_policy_track_get_next(const struct ovsrec_ct_timeout_policy *row)
5913
0
{
5914
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_track_get_next(&row->header_));
5915
0
}
5916
5917
5918
/* Deletes 'row' from table "CT_Timeout_Policy".  'row' may be freed, so it must not be
5919
 * accessed afterward.
5920
 *
5921
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5922
void
5923
ovsrec_ct_timeout_policy_delete(const struct ovsrec_ct_timeout_policy *row)
5924
0
{
5925
0
    ovsdb_idl_txn_delete(&row->header_);
5926
0
}
5927
5928
/* Inserts and returns a new row in the table "CT_Timeout_Policy" in the database
5929
 * with open transaction 'txn'.
5930
 *
5931
 * The new row is assigned a randomly generated provisional UUID.
5932
 * ovsdb-server will assign a different UUID when 'txn' is committed,
5933
 * but the IDL will replace any uses of the provisional UUID in the
5934
 * data to be to be committed by the UUID assigned by ovsdb-server. */
5935
struct ovsrec_ct_timeout_policy *
5936
ovsrec_ct_timeout_policy_insert(struct ovsdb_idl_txn *txn)
5937
0
{
5938
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_ct_timeout_policy, NULL));
5939
0
}
5940
5941
/* Inserts and returns a new row in the table "CT_Timeout_Policy" in the database
5942
 * with open transaction 'txn'.
5943
 *
5944
 * The new row is assigned the UUID specified in the 'uuid' parameter
5945
 * (which cannot be null).  ovsdb-server will try to assign the same
5946
 * UUID when 'txn' is committed. */
5947
struct ovsrec_ct_timeout_policy *
5948
ovsrec_ct_timeout_policy_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
5949
0
{
5950
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_txn_insert_persist_uuid(
5951
0
        txn, &ovsrec_table_ct_timeout_policy, uuid));
5952
0
}
5953
5954
bool
5955
ovsrec_ct_timeout_policy_is_updated(const struct ovsrec_ct_timeout_policy *row, enum ovsrec_ct_timeout_policy_column_id column)
5956
0
{
5957
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_ct_timeout_policy_columns[column]);
5958
0
}
5959
5960
/* Causes the original contents of column "external_ids" in 'row' to be
5961
 * verified as a prerequisite to completing the transaction.  That is, if
5962
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
5963
 * time that the IDL originally read its contents and the time that the
5964
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
5965
 *
5966
 * The intention is that, to ensure that no transaction commits based on dirty
5967
 * reads, an application should call this function any time "external_ids" is
5968
 * read as part of a read-modify-write operation.
5969
 *
5970
 * In some cases this function reduces to a no-op, because the current value
5971
 * of "external_ids" is already known:
5972
 *
5973
 *   - If 'row' is a row created by the current transaction (returned by
5974
 *     ovsrec_ct_timeout_policy_insert()).
5975
 *
5976
 *   - If "external_ids" has already been modified (with
5977
 *     ovsrec_ct_timeout_policy_set_external_ids()) within the current transaction.
5978
 *
5979
 * Because of the latter property, always call this function *before*
5980
 * ovsrec_ct_timeout_policy_set_external_ids() for a given read-modify-write.
5981
 *
5982
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
5983
void
5984
ovsrec_ct_timeout_policy_verify_external_ids(const struct ovsrec_ct_timeout_policy *row)
5985
0
{
5986
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ct_timeout_policy_col_external_ids);
5987
0
}
5988
5989
/* Causes the original contents of column "timeouts" in 'row' to be
5990
 * verified as a prerequisite to completing the transaction.  That is, if
5991
 * "timeouts" in 'row' changed (or if 'row' was deleted) between the
5992
 * time that the IDL originally read its contents and the time that the
5993
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
5994
 *
5995
 * The intention is that, to ensure that no transaction commits based on dirty
5996
 * reads, an application should call this function any time "timeouts" is
5997
 * read as part of a read-modify-write operation.
5998
 *
5999
 * In some cases this function reduces to a no-op, because the current value
6000
 * of "timeouts" is already known:
6001
 *
6002
 *   - If 'row' is a row created by the current transaction (returned by
6003
 *     ovsrec_ct_timeout_policy_insert()).
6004
 *
6005
 *   - If "timeouts" has already been modified (with
6006
 *     ovsrec_ct_timeout_policy_set_timeouts()) within the current transaction.
6007
 *
6008
 * Because of the latter property, always call this function *before*
6009
 * ovsrec_ct_timeout_policy_set_timeouts() for a given read-modify-write.
6010
 *
6011
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6012
void
6013
ovsrec_ct_timeout_policy_verify_timeouts(const struct ovsrec_ct_timeout_policy *row)
6014
0
{
6015
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ct_timeout_policy_col_timeouts);
6016
0
}
6017
6018
/* Returns the "external_ids" column's value from the "CT_Timeout_Policy" table in 'row'
6019
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
6020
 * ovsdb_datum_find_key() is an easier and more efficient way to search
6021
 * for a given key than implementing the same operation on the "cooked"
6022
 * form in 'row'.
6023
 *
6024
 * 'key_type' must be OVSDB_TYPE_STRING.
6025
 * 'value_type' must be OVSDB_TYPE_STRING.
6026
 * (This helps to avoid silent bugs if someone changes external_ids's
6027
 * type without updating the caller.)
6028
 *
6029
 * The caller must not modify or free the returned value.
6030
 *
6031
 * Various kinds of changes can invalidate the returned value: modifying
6032
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6033
 * If the returned value is needed for a long time, it is best to make a copy
6034
 * of it with ovsdb_datum_clone().
6035
 *
6036
 * This function is rarely useful, since it is easier to access the value
6037
 * directly through the "external_ids" member in ovsrec_ct_timeout_policy. */
6038
const struct ovsdb_datum *
6039
ovsrec_ct_timeout_policy_get_external_ids(const struct ovsrec_ct_timeout_policy *row,
6040
  enum ovsdb_atomic_type key_type OVS_UNUSED,
6041
  enum ovsdb_atomic_type value_type OVS_UNUSED)
6042
0
{
6043
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6044
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
6045
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ct_timeout_policy_col_external_ids);
6046
0
}
6047
6048
/* Returns the "timeouts" column's value from the "CT_Timeout_Policy" table in 'row'
6049
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
6050
 * ovsdb_datum_find_key() is an easier and more efficient way to search
6051
 * for a given key than implementing the same operation on the "cooked"
6052
 * form in 'row'.
6053
 *
6054
 * 'key_type' must be OVSDB_TYPE_STRING.
6055
 * 'value_type' must be OVSDB_TYPE_INTEGER.
6056
 * (This helps to avoid silent bugs if someone changes timeouts's
6057
 * type without updating the caller.)
6058
 *
6059
 * The caller must not modify or free the returned value.
6060
 *
6061
 * Various kinds of changes can invalidate the returned value: modifying
6062
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6063
 * If the returned value is needed for a long time, it is best to make a copy
6064
 * of it with ovsdb_datum_clone().
6065
 *
6066
 * This function is rarely useful, since it is easier to access the value
6067
 * directly through the "timeouts" member in ovsrec_ct_timeout_policy. */
6068
const struct ovsdb_datum *
6069
ovsrec_ct_timeout_policy_get_timeouts(const struct ovsrec_ct_timeout_policy *row,
6070
  enum ovsdb_atomic_type key_type OVS_UNUSED,
6071
  enum ovsdb_atomic_type value_type OVS_UNUSED)
6072
0
{
6073
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6074
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
6075
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ct_timeout_policy_col_timeouts);
6076
0
}
6077
6078
/* Sets the "external_ids" column's value from the "CT_Timeout_Policy" table in 'row'
6079
 * to 'external_ids'.
6080
 *
6081
 * The caller retains ownership of 'external_ids' and everything in it. */
6082
void
6083
ovsrec_ct_timeout_policy_set_external_ids(const struct ovsrec_ct_timeout_policy *row, const struct smap *external_ids)
6084
0
{
6085
0
    struct ovsdb_datum datum;
6086
6087
0
    if (external_ids) {
6088
0
        ovsdb_datum_from_smap(&datum, external_ids);
6089
0
    } else {
6090
0
        ovsdb_datum_init_empty(&datum);
6091
0
    }
6092
0
    ovsdb_idl_txn_write(&row->header_,
6093
0
                        &ovsrec_ct_timeout_policy_col_external_ids,
6094
0
                        &datum);
6095
0
}
6096
6097
6098
/* Sets the "timeouts" column from the "CT_Timeout_Policy" table in 'row' to
6099
 * the map with keys 'key_timeouts' and values 'value_timeouts'
6100
 * with 'n_timeouts' entries.
6101
 *
6102
 * 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
6103
 *
6104
 * The caller retains ownership of the arguments. */
6105
void
6106
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)
6107
0
{
6108
0
    struct ovsdb_datum datum;
6109
6110
0
    datum.refcnt = NULL;
6111
6112
0
    datum.n = n_timeouts;
6113
0
    datum.keys = n_timeouts ? xmalloc(n_timeouts * sizeof *datum.keys) : NULL;
6114
0
    datum.values = xmalloc(n_timeouts * sizeof *datum.values);
6115
0
    for (size_t i = 0; i < n_timeouts; i++) {
6116
0
        datum.keys[i].s = ovsdb_atom_string_create(key_timeouts[i]);
6117
0
        datum.values[i].integer = value_timeouts[i];
6118
0
    }
6119
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ct_timeout_policy_col_timeouts, &datum);
6120
0
}
6121
6122
/* Sets an element of the "external_ids" map column from the "CT_Timeout_Policy" table in 'row'
6123
 * to 'new_value' given the key value 'new_key'.
6124
 *
6125
 */
6126
void
6127
ovsrec_ct_timeout_policy_update_external_ids_setkey(const struct ovsrec_ct_timeout_policy *row, const char *new_key, const char *new_value)
6128
0
{
6129
0
    struct ovsdb_datum *datum;
6130
6131
0
    datum = xmalloc(sizeof *datum);
6132
0
    datum->n = 1;
6133
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6134
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
6135
0
    datum->refcnt = NULL;
6136
6137
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
6138
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
6139
6140
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
6141
0
                                    &ovsrec_ct_timeout_policy_col_external_ids,
6142
0
                                    datum);
6143
0
}
6144
6145
/* Deletes an element of the "external_ids" map column from the "CT_Timeout_Policy" table in 'row'
6146
 * given the key value 'delete_key'.
6147
 *
6148
 */
6149
void
6150
ovsrec_ct_timeout_policy_update_external_ids_delkey(const struct ovsrec_ct_timeout_policy *row, const char *delete_key)
6151
0
{
6152
0
    struct ovsdb_datum *datum;
6153
6154
0
    datum = xmalloc(sizeof *datum);
6155
0
    datum->n = 1;
6156
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6157
0
    datum->values = NULL;
6158
0
    datum->refcnt = NULL;
6159
6160
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
6161
6162
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
6163
0
                                    &ovsrec_ct_timeout_policy_col_external_ids,
6164
0
                                    datum);
6165
0
}
6166
6167
/* Sets an element of the "timeouts" map column from the "CT_Timeout_Policy" table in 'row'
6168
 * to 'new_value' given the key value 'new_key'.
6169
 *
6170
 */
6171
void
6172
ovsrec_ct_timeout_policy_update_timeouts_setkey(const struct ovsrec_ct_timeout_policy *row, const char *new_key, int64_t new_value)
6173
0
{
6174
0
    struct ovsdb_datum *datum;
6175
6176
0
    datum = xmalloc(sizeof *datum);
6177
0
    datum->n = 1;
6178
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6179
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
6180
0
    datum->refcnt = NULL;
6181
6182
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
6183
0
    datum->values[0].integer = new_value;
6184
6185
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
6186
0
                                    &ovsrec_ct_timeout_policy_col_timeouts,
6187
0
                                    datum);
6188
0
}
6189
6190
/* Deletes an element of the "timeouts" map column from the "CT_Timeout_Policy" table in 'row'
6191
 * given the key value 'delete_key'.
6192
 *
6193
 */
6194
void
6195
ovsrec_ct_timeout_policy_update_timeouts_delkey(const struct ovsrec_ct_timeout_policy *row, const char *delete_key)
6196
0
{
6197
0
    struct ovsdb_datum *datum;
6198
6199
0
    datum = xmalloc(sizeof *datum);
6200
0
    datum->n = 1;
6201
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6202
0
    datum->values = NULL;
6203
0
    datum->refcnt = NULL;
6204
6205
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
6206
6207
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
6208
0
                                    &ovsrec_ct_timeout_policy_col_timeouts,
6209
0
                                    datum);
6210
0
}
6211
6212
/* Sets the "external_ids" column's value from the "CT_Timeout_Policy" table in 'row'
6213
 * to 'external_ids'.
6214
 *
6215
 * The caller retains ownership of 'external_ids' and everything in it. */
6216
void
6217
ovsrec_ct_timeout_policy_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
6218
0
{
6219
0
    struct ovsdb_datum datum;
6220
6221
0
    if (external_ids) {
6222
0
        ovsdb_datum_from_smap(&datum, external_ids);
6223
0
    } else {
6224
0
        ovsdb_datum_init_empty(&datum);
6225
0
    }
6226
6227
0
    ovsdb_idl_condition_add_clause(cond,
6228
0
                                   function,
6229
0
                                   &ovsrec_ct_timeout_policy_col_external_ids,
6230
0
                                   &datum);
6231
6232
0
    ovsdb_datum_destroy(&datum, &ovsrec_ct_timeout_policy_col_external_ids.type);
6233
0
}
6234
6235
6236
/* Sets the "timeouts" column from the "CT_Timeout_Policy" table in 'row' to
6237
 * the map with keys 'key_timeouts' and values 'value_timeouts'
6238
 * with 'n_timeouts' entries.
6239
 *
6240
 * 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
6241
 *
6242
 * The caller retains ownership of the arguments. */
6243
void
6244
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)
6245
0
{
6246
0
    struct ovsdb_datum datum;
6247
6248
0
    datum.refcnt = NULL;
6249
0
    datum.n = n_timeouts;
6250
0
    datum.keys = n_timeouts ? xmalloc(n_timeouts * sizeof *datum.keys) : NULL;
6251
0
    datum.values = xmalloc(n_timeouts * sizeof *datum.values);
6252
0
    for (size_t i = 0; i < n_timeouts; i++) {
6253
0
        datum.keys[i].s = ovsdb_atom_string_create(key_timeouts[i]);
6254
0
        datum.values[i].integer = value_timeouts[i];
6255
0
    }
6256
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_ct_timeout_policy_col_timeouts.type);
6257
0
    ovsdb_idl_condition_add_clause(cond,
6258
0
                          function,
6259
0
                          &ovsrec_ct_timeout_policy_col_timeouts,
6260
0
                          &datum);
6261
0
    ovsdb_datum_destroy(&datum, &ovsrec_ct_timeout_policy_col_timeouts.type);
6262
0
}
6263
6264
/* Destroy 'row' of kind "CT_Timeout_Policy". The row must have been
6265
 * created with ovsdb_idl_index_init_row.
6266
 */
6267
void
6268
ovsrec_ct_timeout_policy_index_destroy_row(const struct ovsrec_ct_timeout_policy *row)
6269
0
{
6270
0
    ovsdb_idl_index_destroy_row(&row->header_);
6271
0
}
6272
        
6273
6274
/* Creates a new row of kind "CT_Timeout_Policy". */
6275
struct ovsrec_ct_timeout_policy *
6276
ovsrec_ct_timeout_policy_index_init_row(struct ovsdb_idl_index *index)
6277
0
{
6278
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_timeout_policy);
6279
0
    return ALIGNED_CAST(struct ovsrec_ct_timeout_policy *, ovsdb_idl_index_init_row(index));
6280
0
}
6281
6282
struct ovsrec_ct_timeout_policy *
6283
ovsrec_ct_timeout_policy_index_find(struct ovsdb_idl_index *index, const struct ovsrec_ct_timeout_policy *target)
6284
0
{
6285
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_timeout_policy);
6286
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_index_find(index, &target->header_));
6287
0
}
6288
6289
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
6290
int
6291
ovsrec_ct_timeout_policy_index_compare(
6292
    struct ovsdb_idl_index *index, 
6293
    const struct ovsrec_ct_timeout_policy *a, 
6294
    const struct ovsrec_ct_timeout_policy *b)
6295
0
{
6296
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
6297
0
}
6298
6299
struct ovsdb_idl_cursor
6300
ovsrec_ct_timeout_policy_cursor_first(struct ovsdb_idl_index *index)
6301
0
{
6302
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_timeout_policy);
6303
0
    return ovsdb_idl_cursor_first(index);
6304
0
}
6305
6306
struct ovsdb_idl_cursor
6307
ovsrec_ct_timeout_policy_cursor_first_eq(
6308
    struct ovsdb_idl_index *index, const struct ovsrec_ct_timeout_policy *target)
6309
0
{
6310
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_timeout_policy);
6311
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
6312
0
}
6313
6314
struct ovsdb_idl_cursor
6315
ovsrec_ct_timeout_policy_cursor_first_ge(
6316
    struct ovsdb_idl_index *index, const struct ovsrec_ct_timeout_policy *target)
6317
0
{
6318
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_timeout_policy);
6319
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
6320
0
}
6321
6322
struct ovsrec_ct_timeout_policy *
6323
ovsrec_ct_timeout_policy_cursor_data(struct ovsdb_idl_cursor *cursor)
6324
0
{
6325
0
    return ovsrec_ct_timeout_policy_cast(ovsdb_idl_cursor_data(cursor));
6326
0
}
6327
6328
6329
/* Sets the "external_ids" column's value from the "CT_Timeout_Policy" table in 'row'
6330
 * to 'external_ids'.
6331
 *
6332
 * The caller retains ownership of 'external_ids' and everything in it. */
6333
void
6334
ovsrec_ct_timeout_policy_index_set_external_ids(const struct ovsrec_ct_timeout_policy *row, const struct smap *external_ids)
6335
0
{
6336
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
6337
6338
0
    if (external_ids) {
6339
0
        struct smap_node *node;
6340
0
        size_t i;
6341
6342
0
        datum->n = smap_count(external_ids);
6343
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6344
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
6345
0
        datum->refcnt = NULL;
6346
6347
0
        i = 0;
6348
0
        SMAP_FOR_EACH (node, external_ids) {
6349
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
6350
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
6351
0
            i++;
6352
0
        }
6353
0
        ovsdb_datum_sort_unique(datum, &ovsrec_ct_timeout_policy_col_external_ids.type);
6354
0
    } else {
6355
0
        ovsdb_datum_init_empty(datum);
6356
0
    }
6357
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
6358
0
                          &ovsrec_ct_timeout_policy_columns[OVSREC_CT_TIMEOUT_POLICY_COL_EXTERNAL_IDS],
6359
0
                          datum,
6360
0
                          &ovsrec_table_classes[OVSREC_TABLE_CT_TIMEOUT_POLICY]);
6361
0
    free(datum);
6362
0
}
6363
6364
6365
/* Sets the "timeouts" column from the "CT_Timeout_Policy" table in 'row' to
6366
 * the map with keys 'key_timeouts' and values 'value_timeouts'
6367
 * with 'n_timeouts' entries.
6368
 *
6369
 * 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
6370
 *
6371
 * The caller retains ownership of the arguments. */
6372
void
6373
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)
6374
0
{
6375
0
    struct ovsdb_datum datum;
6376
6377
0
    datum.refcnt = NULL;
6378
0
    size_t i;
6379
6380
0
    datum.n = n_timeouts;
6381
0
    datum.keys = n_timeouts ? xmalloc(n_timeouts * sizeof *datum.keys) : NULL;
6382
0
    datum.values = xmalloc(n_timeouts * sizeof *datum.values);
6383
0
    for (i = 0; i < n_timeouts; i++) {
6384
0
        datum.keys[i].s = ovsdb_atom_string_create(key_timeouts[i]);
6385
0
        datum.values[i].integer = value_timeouts[i];
6386
0
    }
6387
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_ct_timeout_policy_col_timeouts.type);
6388
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]);
6389
0
}
6390
6391
struct ovsdb_idl_column ovsrec_ct_timeout_policy_columns[OVSREC_CT_TIMEOUT_POLICY_N_COLUMNS];
6392
6393
unsigned int
6394
ovsrec_ct_timeout_policy_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
6395
0
{
6396
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_ct_timeout_policy, condition);
6397
0
}
6398
static struct json CT_Timeout_Policy_col_timeouts_key_enum_key_strings[16] = {
6399
    { .type = JSON_STRING, .string = "icmp_first", .count = 2 },
6400
    { .type = JSON_STRING, .string = "icmp_reply", .count = 2 },
6401
    { .type = JSON_STRING, .string = "tcp_close", .count = 2 },
6402
    { .type = JSON_STRING, .string = "tcp_close_wait", .count = 2 },
6403
    { .type = JSON_STRING, .string = "tcp_established", .count = 2 },
6404
    { .type = JSON_STRING, .string = "tcp_fin_wait", .count = 2 },
6405
    { .type = JSON_STRING, .string = "tcp_last_ack", .count = 2 },
6406
    { .type = JSON_STRING, .string = "tcp_retransmit", .count = 2 },
6407
    { .type = JSON_STRING, .string = "tcp_syn_recv", .count = 2 },
6408
    { .type = JSON_STRING, .string = "tcp_syn_sent", .count = 2 },
6409
    { .type = JSON_STRING, .string = "tcp_syn_sent2", .count = 2 },
6410
    { .type = JSON_STRING, .string = "tcp_time_wait", .count = 2 },
6411
    { .type = JSON_STRING, .string = "tcp_unack", .count = 2 },
6412
    { .type = JSON_STRING, .string = "udp_first", .count = 2 },
6413
    { .type = JSON_STRING, .string = "udp_multiple", .count = 2 },
6414
    { .type = JSON_STRING, .string = "udp_single", .count = 2 },
6415
};
6416
static union ovsdb_atom CT_Timeout_Policy_col_timeouts_key_enum_keys[16] = {
6417
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[0] },
6418
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[1] },
6419
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[2] },
6420
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[3] },
6421
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[4] },
6422
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[5] },
6423
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[6] },
6424
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[7] },
6425
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[8] },
6426
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[9] },
6427
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[10] },
6428
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[11] },
6429
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[12] },
6430
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[13] },
6431
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[14] },
6432
    { .s = &CT_Timeout_Policy_col_timeouts_key_enum_key_strings[15] },
6433
};
6434
static struct ovsdb_datum CT_Timeout_Policy_col_timeouts_key_enum = {
6435
    .n = 16,
6436
    .keys = CT_Timeout_Policy_col_timeouts_key_enum_keys,
6437
};
6438
6439
struct ovsdb_idl_column ovsrec_ct_timeout_policy_columns[OVSREC_CT_TIMEOUT_POLICY_N_COLUMNS] = {
6440
    [OVSREC_CT_TIMEOUT_POLICY_COL_EXTERNAL_IDS] = {
6441
         .name = "external_ids",
6442
         .type = {
6443
            .key = {
6444
               .type = OVSDB_TYPE_STRING,
6445
               .string = { .minLen = 0, .maxLen = UINT_MAX },
6446
            },
6447
            .value = {
6448
                .type = OVSDB_TYPE_STRING,
6449
                .string = { .minLen = 0, .maxLen = UINT_MAX },
6450
            },
6451
            .n_min = 0,
6452
            .n_max = UINT_MAX,
6453
         },
6454
         .is_mutable = true,
6455
         .is_synthetic = false,
6456
         .parse = ovsrec_ct_timeout_policy_parse_external_ids,
6457
         .unparse = ovsrec_ct_timeout_policy_unparse_external_ids,
6458
    },
6459
6460
    [OVSREC_CT_TIMEOUT_POLICY_COL_TIMEOUTS] = {
6461
         .name = "timeouts",
6462
         .type = {
6463
            .key = {
6464
               .type = OVSDB_TYPE_STRING,
6465
               .enum_ = &CT_Timeout_Policy_col_timeouts_key_enum,
6466
               .string = { .minLen = 0, .maxLen = UINT_MAX },
6467
            },
6468
            .value = {
6469
                .type = OVSDB_TYPE_INTEGER,
6470
                .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
6471
            },
6472
            .n_min = 0,
6473
            .n_max = UINT_MAX,
6474
         },
6475
         .is_mutable = true,
6476
         .is_synthetic = false,
6477
         .parse = ovsrec_ct_timeout_policy_parse_timeouts,
6478
         .unparse = ovsrec_ct_timeout_policy_unparse_timeouts,
6479
    },
6480
6481
};
6482

6483
/* CT_Zone table. */
6484
6485
bool
6486
ovsrec_server_has_ct_zone_table_col_external_ids(const struct ovsdb_idl *idl)
6487
0
{
6488
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ct_zone_col_external_ids);
6489
0
}
6490
6491
6492
bool
6493
ovsrec_server_has_ct_zone_table_col_timeout_policy(const struct ovsdb_idl *idl)
6494
0
{
6495
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ct_zone_col_timeout_policy);
6496
0
}
6497
6498
6499
bool
6500
ovsrec_server_has_ct_zone_table(const struct ovsdb_idl *idl)
6501
0
{
6502
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_CT_ZONE]);
6503
0
}
6504
6505
6506
const struct ovsrec_ct_zone_table *
6507
ovsrec_ct_zone_table_get(const struct ovsdb_idl *idl)
6508
0
{
6509
0
    return (const struct ovsrec_ct_zone_table *) idl;
6510
0
}
6511
6512
const struct ovsrec_ct_zone *
6513
ovsrec_ct_zone_table_first(const struct ovsrec_ct_zone_table *table)
6514
0
{
6515
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
6516
0
    return ovsrec_ct_zone_first(idl);
6517
0
}
6518
6519
6520
const struct ovsrec_ct_zone *
6521
ovsrec_ct_zone_table_track_get_first(const struct ovsrec_ct_zone_table *table)
6522
0
{
6523
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
6524
0
    return ovsrec_ct_zone_track_get_first(idl);
6525
0
}
6526
6527
6528
static void
6529
ovsrec_ct_zone_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6530
0
{
6531
0
    struct ovsrec_ct_zone *row = ovsrec_ct_zone_cast(row_);
6532
0
    smap_init(&row->external_ids);
6533
0
    for (size_t i = 0; i < datum->n; i++) {
6534
0
        smap_add(&row->external_ids,
6535
0
                 json_string(datum->keys[i].s),
6536
0
                 json_string(datum->values[i].s));
6537
0
    }
6538
0
}
6539
6540
static void
6541
ovsrec_ct_zone_parse_timeout_policy(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
6542
0
{
6543
0
    struct ovsrec_ct_zone *row = ovsrec_ct_zone_cast(row_);
6544
6545
0
    if (datum->n >= 1) {
6546
0
        row->timeout_policy = ovsrec_ct_timeout_policy_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_ct_timeout_policy, &datum->keys[0].uuid));
6547
0
    } else {
6548
0
        row->timeout_policy = NULL;
6549
0
    }
6550
0
}
6551
6552
static void
6553
ovsrec_ct_zone_unparse_external_ids(struct ovsdb_idl_row *row_)
6554
0
{
6555
0
    struct ovsrec_ct_zone *row = ovsrec_ct_zone_cast(row_);
6556
0
    smap_destroy(&row->external_ids);
6557
0
}
6558
6559
static void
6560
ovsrec_ct_zone_unparse_timeout_policy(struct ovsdb_idl_row *row OVS_UNUSED)
6561
0
{
6562
    /* Nothing to do. */
6563
0
}
6564
6565
static void
6566
ovsrec_ct_zone_init__(struct ovsdb_idl_row *row)
6567
0
{
6568
0
    ovsrec_ct_zone_init(ovsrec_ct_zone_cast(row));
6569
0
}
6570
6571
/* Clears the contents of 'row' in table "CT_Zone". */
6572
void
6573
ovsrec_ct_zone_init(struct ovsrec_ct_zone *row)
6574
0
{
6575
0
    memset(row, 0, sizeof *row); 
6576
0
    smap_init(&row->external_ids);
6577
0
}
6578
6579
/* Searches table "CT_Zone" in 'idl' for a row with UUID 'uuid'.  Returns
6580
 * a pointer to the row if there is one, otherwise a null pointer.  */
6581
const struct ovsrec_ct_zone *
6582
ovsrec_ct_zone_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
6583
0
{
6584
0
    return ovsrec_ct_zone_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_ct_zone, uuid));
6585
0
}
6586
6587
/* Searches table "CT_Zone" for a row with UUID 'uuid'.  Returns
6588
 * a pointer to the row if there is one, otherwise a null pointer.  */
6589
const struct ovsrec_ct_zone *
6590
ovsrec_ct_zone_table_get_for_uuid(const struct ovsrec_ct_zone_table *table, const struct uuid *uuid)
6591
0
{
6592
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
6593
0
    return ovsrec_ct_zone_get_for_uuid(idl, uuid);
6594
0
}
6595
6596
/* Returns a row in table "CT_Zone" in 'idl', or a null pointer if that
6597
 * table is empty.
6598
 *
6599
 * Database tables are internally maintained as hash tables, so adding or
6600
 * removing rows while traversing the same table can cause some rows to be
6601
 * visited twice or not at apply. */
6602
const struct ovsrec_ct_zone *
6603
ovsrec_ct_zone_first(const struct ovsdb_idl *idl)
6604
0
{
6605
0
    return ovsrec_ct_zone_cast(ovsdb_idl_first_row(idl, &ovsrec_table_ct_zone));
6606
0
}
6607
6608
/* Returns a row following 'row' within its table, or a null pointer if 'row'
6609
 * is the last row in its table. */
6610
const struct ovsrec_ct_zone *
6611
ovsrec_ct_zone_next(const struct ovsrec_ct_zone *row)
6612
0
{
6613
0
    return ovsrec_ct_zone_cast(ovsdb_idl_next_row(&row->header_));
6614
0
}
6615
6616
unsigned int ovsrec_ct_zone_get_seqno(const struct ovsdb_idl *idl)
6617
0
{
6618
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_ct_zone);
6619
0
}
6620
6621
unsigned int ovsrec_ct_zone_row_get_seqno(const struct ovsrec_ct_zone *row, enum ovsdb_idl_change change)
6622
0
{
6623
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
6624
0
}
6625
6626
const struct ovsrec_ct_zone *
6627
ovsrec_ct_zone_track_get_first(const struct ovsdb_idl *idl)
6628
0
{
6629
0
    return ovsrec_ct_zone_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_ct_zone));
6630
0
}
6631
6632
const struct ovsrec_ct_zone
6633
*ovsrec_ct_zone_track_get_next(const struct ovsrec_ct_zone *row)
6634
0
{
6635
0
    return ovsrec_ct_zone_cast(ovsdb_idl_track_get_next(&row->header_));
6636
0
}
6637
6638
6639
/* Deletes 'row' from table "CT_Zone".  'row' may be freed, so it must not be
6640
 * accessed afterward.
6641
 *
6642
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6643
void
6644
ovsrec_ct_zone_delete(const struct ovsrec_ct_zone *row)
6645
0
{
6646
0
    ovsdb_idl_txn_delete(&row->header_);
6647
0
}
6648
6649
/* Inserts and returns a new row in the table "CT_Zone" in the database
6650
 * with open transaction 'txn'.
6651
 *
6652
 * The new row is assigned a randomly generated provisional UUID.
6653
 * ovsdb-server will assign a different UUID when 'txn' is committed,
6654
 * but the IDL will replace any uses of the provisional UUID in the
6655
 * data to be to be committed by the UUID assigned by ovsdb-server. */
6656
struct ovsrec_ct_zone *
6657
ovsrec_ct_zone_insert(struct ovsdb_idl_txn *txn)
6658
0
{
6659
0
    return ovsrec_ct_zone_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_ct_zone, NULL));
6660
0
}
6661
6662
/* Inserts and returns a new row in the table "CT_Zone" in the database
6663
 * with open transaction 'txn'.
6664
 *
6665
 * The new row is assigned the UUID specified in the 'uuid' parameter
6666
 * (which cannot be null).  ovsdb-server will try to assign the same
6667
 * UUID when 'txn' is committed. */
6668
struct ovsrec_ct_zone *
6669
ovsrec_ct_zone_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
6670
0
{
6671
0
    return ovsrec_ct_zone_cast(ovsdb_idl_txn_insert_persist_uuid(
6672
0
        txn, &ovsrec_table_ct_zone, uuid));
6673
0
}
6674
6675
bool
6676
ovsrec_ct_zone_is_updated(const struct ovsrec_ct_zone *row, enum ovsrec_ct_zone_column_id column)
6677
0
{
6678
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_ct_zone_columns[column]);
6679
0
}
6680
6681
/* Causes the original contents of column "external_ids" in 'row' to be
6682
 * verified as a prerequisite to completing the transaction.  That is, if
6683
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
6684
 * time that the IDL originally read its contents and the time that the
6685
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
6686
 *
6687
 * The intention is that, to ensure that no transaction commits based on dirty
6688
 * reads, an application should call this function any time "external_ids" is
6689
 * read as part of a read-modify-write operation.
6690
 *
6691
 * In some cases this function reduces to a no-op, because the current value
6692
 * of "external_ids" is already known:
6693
 *
6694
 *   - If 'row' is a row created by the current transaction (returned by
6695
 *     ovsrec_ct_zone_insert()).
6696
 *
6697
 *   - If "external_ids" has already been modified (with
6698
 *     ovsrec_ct_zone_set_external_ids()) within the current transaction.
6699
 *
6700
 * Because of the latter property, always call this function *before*
6701
 * ovsrec_ct_zone_set_external_ids() for a given read-modify-write.
6702
 *
6703
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6704
void
6705
ovsrec_ct_zone_verify_external_ids(const struct ovsrec_ct_zone *row)
6706
0
{
6707
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ct_zone_col_external_ids);
6708
0
}
6709
6710
/* Causes the original contents of column "timeout_policy" in 'row' to be
6711
 * verified as a prerequisite to completing the transaction.  That is, if
6712
 * "timeout_policy" in 'row' changed (or if 'row' was deleted) between the
6713
 * time that the IDL originally read its contents and the time that the
6714
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
6715
 *
6716
 * The intention is that, to ensure that no transaction commits based on dirty
6717
 * reads, an application should call this function any time "timeout_policy" is
6718
 * read as part of a read-modify-write operation.
6719
 *
6720
 * In some cases this function reduces to a no-op, because the current value
6721
 * of "timeout_policy" is already known:
6722
 *
6723
 *   - If 'row' is a row created by the current transaction (returned by
6724
 *     ovsrec_ct_zone_insert()).
6725
 *
6726
 *   - If "timeout_policy" has already been modified (with
6727
 *     ovsrec_ct_zone_set_timeout_policy()) within the current transaction.
6728
 *
6729
 * Because of the latter property, always call this function *before*
6730
 * ovsrec_ct_zone_set_timeout_policy() for a given read-modify-write.
6731
 *
6732
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
6733
void
6734
ovsrec_ct_zone_verify_timeout_policy(const struct ovsrec_ct_zone *row)
6735
0
{
6736
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ct_zone_col_timeout_policy);
6737
0
}
6738
6739
/* Returns the "external_ids" column's value from the "CT_Zone" table in 'row'
6740
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
6741
 * ovsdb_datum_find_key() is an easier and more efficient way to search
6742
 * for a given key than implementing the same operation on the "cooked"
6743
 * form in 'row'.
6744
 *
6745
 * 'key_type' must be OVSDB_TYPE_STRING.
6746
 * 'value_type' must be OVSDB_TYPE_STRING.
6747
 * (This helps to avoid silent bugs if someone changes external_ids's
6748
 * type without updating the caller.)
6749
 *
6750
 * The caller must not modify or free the returned value.
6751
 *
6752
 * Various kinds of changes can invalidate the returned value: modifying
6753
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6754
 * If the returned value is needed for a long time, it is best to make a copy
6755
 * of it with ovsdb_datum_clone().
6756
 *
6757
 * This function is rarely useful, since it is easier to access the value
6758
 * directly through the "external_ids" member in ovsrec_ct_zone. */
6759
const struct ovsdb_datum *
6760
ovsrec_ct_zone_get_external_ids(const struct ovsrec_ct_zone *row,
6761
  enum ovsdb_atomic_type key_type OVS_UNUSED,
6762
  enum ovsdb_atomic_type value_type OVS_UNUSED)
6763
0
{
6764
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6765
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
6766
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ct_zone_col_external_ids);
6767
0
}
6768
6769
/* Returns the "timeout_policy" column's value from the "CT_Zone" table in 'row'
6770
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
6771
 * ovsdb_datum_find_key() is an easier and more efficient way to search
6772
 * for a given key than implementing the same operation on the "cooked"
6773
 * form in 'row'.
6774
 *
6775
 * 'key_type' must be OVSDB_TYPE_UUID.
6776
 * (This helps to avoid silent bugs if someone changes timeout_policy's
6777
 * type without updating the caller.)
6778
 *
6779
 * The caller must not modify or free the returned value.
6780
 *
6781
 * Various kinds of changes can invalidate the returned value: modifying
6782
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6783
 * If the returned value is needed for a long time, it is best to make a copy
6784
 * of it with ovsdb_datum_clone().
6785
 *
6786
 * This function is rarely useful, since it is easier to access the value
6787
 * directly through the "timeout_policy" member in ovsrec_ct_zone. */
6788
const struct ovsdb_datum *
6789
ovsrec_ct_zone_get_timeout_policy(const struct ovsrec_ct_zone *row,
6790
  enum ovsdb_atomic_type key_type OVS_UNUSED)
6791
0
{
6792
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
6793
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ct_zone_col_timeout_policy);
6794
0
}
6795
6796
/* Sets the "external_ids" column's value from the "CT_Zone" table in 'row'
6797
 * to 'external_ids'.
6798
 *
6799
 * The caller retains ownership of 'external_ids' and everything in it. */
6800
void
6801
ovsrec_ct_zone_set_external_ids(const struct ovsrec_ct_zone *row, const struct smap *external_ids)
6802
0
{
6803
0
    struct ovsdb_datum datum;
6804
6805
0
    if (external_ids) {
6806
0
        ovsdb_datum_from_smap(&datum, external_ids);
6807
0
    } else {
6808
0
        ovsdb_datum_init_empty(&datum);
6809
0
    }
6810
0
    ovsdb_idl_txn_write(&row->header_,
6811
0
                        &ovsrec_ct_zone_col_external_ids,
6812
0
                        &datum);
6813
0
}
6814
6815
6816
/* Sets the "timeout_policy" column from the "CT_Zone" table in 'row' to
6817
 * the 'timeout_policy' set.
6818
 *
6819
 * If "timeout_policy" is null, the column will be the empty set,
6820
 * otherwise it will contain the specified value.
6821
 *
6822
 * The caller retains ownership of the arguments. */
6823
void
6824
ovsrec_ct_zone_set_timeout_policy(const struct ovsrec_ct_zone *row, const struct ovsrec_ct_timeout_policy *timeout_policy)
6825
0
{
6826
0
    struct ovsdb_datum datum;
6827
6828
0
    datum.refcnt = NULL;
6829
6830
0
    if (timeout_policy) {
6831
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
6832
0
        datum.n = 1;
6833
0
        datum.keys = key;
6834
0
        key->uuid = timeout_policy->header_.uuid;
6835
0
    } else {
6836
0
        datum.n = 0;
6837
0
        datum.keys = NULL;
6838
0
    }
6839
0
    datum.values = NULL;
6840
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ct_zone_col_timeout_policy, &datum);
6841
0
}
6842
6843
/* Sets an element of the "external_ids" map column from the "CT_Zone" table in 'row'
6844
 * to 'new_value' given the key value 'new_key'.
6845
 *
6846
 */
6847
void
6848
ovsrec_ct_zone_update_external_ids_setkey(const struct ovsrec_ct_zone *row, const char *new_key, const char *new_value)
6849
0
{
6850
0
    struct ovsdb_datum *datum;
6851
6852
0
    datum = xmalloc(sizeof *datum);
6853
0
    datum->n = 1;
6854
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6855
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
6856
0
    datum->refcnt = NULL;
6857
6858
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
6859
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
6860
6861
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
6862
0
                                    &ovsrec_ct_zone_col_external_ids,
6863
0
                                    datum);
6864
0
}
6865
6866
/* Deletes an element of the "external_ids" map column from the "CT_Zone" table in 'row'
6867
 * given the key value 'delete_key'.
6868
 *
6869
 */
6870
void
6871
ovsrec_ct_zone_update_external_ids_delkey(const struct ovsrec_ct_zone *row, const char *delete_key)
6872
0
{
6873
0
    struct ovsdb_datum *datum;
6874
6875
0
    datum = xmalloc(sizeof *datum);
6876
0
    datum->n = 1;
6877
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
6878
0
    datum->values = NULL;
6879
0
    datum->refcnt = NULL;
6880
6881
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
6882
6883
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
6884
0
                                    &ovsrec_ct_zone_col_external_ids,
6885
0
                                    datum);
6886
0
}
6887
6888
/* Adds the value 'new_value' to the "timeout_policy" set column from the "CT_Zone" table
6889
 * in 'row'.
6890
 *
6891
 */
6892
void
6893
ovsrec_ct_zone_update_timeout_policy_addvalue(const struct ovsrec_ct_zone *row, const struct ovsrec_ct_timeout_policy *new_value)
6894
0
{
6895
0
    struct ovsdb_datum *datum;
6896
6897
0
    datum = xmalloc(sizeof *datum);
6898
0
    datum->n = 1;
6899
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
6900
0
    datum->values = NULL;
6901
0
    datum->refcnt = NULL;
6902
6903
0
    datum->keys[0].uuid = new_value->header_.uuid;
6904
6905
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
6906
0
                                    &ovsrec_ct_zone_col_timeout_policy,
6907
0
                                    datum);
6908
0
}
6909
6910
/* Deletes the value 'delete_value' from the "timeout_policy" set column from the
6911
 * "CT_Zone" table in 'row'.
6912
 *
6913
 */
6914
void
6915
ovsrec_ct_zone_update_timeout_policy_delvalue(const struct ovsrec_ct_zone *row, const struct ovsrec_ct_timeout_policy *delete_value)
6916
0
{
6917
0
    struct ovsdb_datum *datum;
6918
6919
0
    datum = xmalloc(sizeof *datum);
6920
0
    datum->n = 1;
6921
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
6922
0
    datum->values = NULL;
6923
0
    datum->refcnt = NULL;
6924
6925
0
    datum->keys[0].uuid = delete_value->header_.uuid;
6926
6927
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
6928
0
                                    &ovsrec_ct_zone_col_timeout_policy,
6929
0
                                    datum);
6930
0
}
6931
6932
/* Sets the "external_ids" column's value from the "CT_Zone" table in 'row'
6933
 * to 'external_ids'.
6934
 *
6935
 * The caller retains ownership of 'external_ids' and everything in it. */
6936
void
6937
ovsrec_ct_zone_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
6938
0
{
6939
0
    struct ovsdb_datum datum;
6940
6941
0
    if (external_ids) {
6942
0
        ovsdb_datum_from_smap(&datum, external_ids);
6943
0
    } else {
6944
0
        ovsdb_datum_init_empty(&datum);
6945
0
    }
6946
6947
0
    ovsdb_idl_condition_add_clause(cond,
6948
0
                                   function,
6949
0
                                   &ovsrec_ct_zone_col_external_ids,
6950
0
                                   &datum);
6951
6952
0
    ovsdb_datum_destroy(&datum, &ovsrec_ct_zone_col_external_ids.type);
6953
0
}
6954
6955
6956
/* Sets the "timeout_policy" column from the "CT_Zone" table in 'row' to
6957
 * the 'timeout_policy' set.
6958
 *
6959
 * If "timeout_policy" is null, the column will be the empty set,
6960
 * otherwise it will contain the specified value.
6961
 *
6962
 * The caller retains ownership of the arguments. */
6963
void
6964
ovsrec_ct_zone_add_clause_timeout_policy(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *timeout_policy)
6965
0
{
6966
0
    struct ovsdb_datum datum;
6967
6968
0
    datum.refcnt = NULL;
6969
6970
0
    if (timeout_policy) {
6971
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
6972
0
        datum.n = 1;
6973
0
        datum.keys = key;
6974
0
        key->uuid = *timeout_policy;
6975
0
    } else {
6976
0
        datum.n = 0;
6977
0
        datum.keys = NULL;
6978
0
    }
6979
0
    datum.values = NULL;
6980
0
    ovsdb_idl_condition_add_clause(cond,
6981
0
                          function,
6982
0
                          &ovsrec_ct_zone_col_timeout_policy,
6983
0
                          &datum);
6984
0
    ovsdb_datum_destroy(&datum, &ovsrec_ct_zone_col_timeout_policy.type);
6985
0
}
6986
6987
/* Destroy 'row' of kind "CT_Zone". The row must have been
6988
 * created with ovsdb_idl_index_init_row.
6989
 */
6990
void
6991
ovsrec_ct_zone_index_destroy_row(const struct ovsrec_ct_zone *row)
6992
0
{
6993
0
    ovsdb_idl_index_destroy_row(&row->header_);
6994
0
}
6995
        
6996
6997
/* Creates a new row of kind "CT_Zone". */
6998
struct ovsrec_ct_zone *
6999
ovsrec_ct_zone_index_init_row(struct ovsdb_idl_index *index)
7000
0
{
7001
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_zone);
7002
0
    return ALIGNED_CAST(struct ovsrec_ct_zone *, ovsdb_idl_index_init_row(index));
7003
0
}
7004
7005
struct ovsrec_ct_zone *
7006
ovsrec_ct_zone_index_find(struct ovsdb_idl_index *index, const struct ovsrec_ct_zone *target)
7007
0
{
7008
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_zone);
7009
0
    return ovsrec_ct_zone_cast(ovsdb_idl_index_find(index, &target->header_));
7010
0
}
7011
7012
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
7013
int
7014
ovsrec_ct_zone_index_compare(
7015
    struct ovsdb_idl_index *index, 
7016
    const struct ovsrec_ct_zone *a, 
7017
    const struct ovsrec_ct_zone *b)
7018
0
{
7019
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
7020
0
}
7021
7022
struct ovsdb_idl_cursor
7023
ovsrec_ct_zone_cursor_first(struct ovsdb_idl_index *index)
7024
0
{
7025
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_zone);
7026
0
    return ovsdb_idl_cursor_first(index);
7027
0
}
7028
7029
struct ovsdb_idl_cursor
7030
ovsrec_ct_zone_cursor_first_eq(
7031
    struct ovsdb_idl_index *index, const struct ovsrec_ct_zone *target)
7032
0
{
7033
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_zone);
7034
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
7035
0
}
7036
7037
struct ovsdb_idl_cursor
7038
ovsrec_ct_zone_cursor_first_ge(
7039
    struct ovsdb_idl_index *index, const struct ovsrec_ct_zone *target)
7040
0
{
7041
0
    ovs_assert(index->table->class_ == &ovsrec_table_ct_zone);
7042
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
7043
0
}
7044
7045
struct ovsrec_ct_zone *
7046
ovsrec_ct_zone_cursor_data(struct ovsdb_idl_cursor *cursor)
7047
0
{
7048
0
    return ovsrec_ct_zone_cast(ovsdb_idl_cursor_data(cursor));
7049
0
}
7050
7051
7052
/* Sets the "external_ids" column's value from the "CT_Zone" table in 'row'
7053
 * to 'external_ids'.
7054
 *
7055
 * The caller retains ownership of 'external_ids' and everything in it. */
7056
void
7057
ovsrec_ct_zone_index_set_external_ids(const struct ovsrec_ct_zone *row, const struct smap *external_ids)
7058
0
{
7059
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
7060
7061
0
    if (external_ids) {
7062
0
        struct smap_node *node;
7063
0
        size_t i;
7064
7065
0
        datum->n = smap_count(external_ids);
7066
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
7067
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
7068
0
        datum->refcnt = NULL;
7069
7070
0
        i = 0;
7071
0
        SMAP_FOR_EACH (node, external_ids) {
7072
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
7073
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
7074
0
            i++;
7075
0
        }
7076
0
        ovsdb_datum_sort_unique(datum, &ovsrec_ct_zone_col_external_ids.type);
7077
0
    } else {
7078
0
        ovsdb_datum_init_empty(datum);
7079
0
    }
7080
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
7081
0
                          &ovsrec_ct_zone_columns[OVSREC_CT_ZONE_COL_EXTERNAL_IDS],
7082
0
                          datum,
7083
0
                          &ovsrec_table_classes[OVSREC_TABLE_CT_ZONE]);
7084
0
    free(datum);
7085
0
}
7086
7087
7088
/* Sets the "timeout_policy" column from the "CT_Zone" table in 'row' to
7089
 * the 'timeout_policy' set.
7090
 *
7091
 * If "timeout_policy" is null, the column will be the empty set,
7092
 * otherwise it will contain the specified value.
7093
 *
7094
 * The caller retains ownership of the arguments. */
7095
void
7096
ovsrec_ct_zone_index_set_timeout_policy(const struct ovsrec_ct_zone *row, const struct ovsrec_ct_timeout_policy *timeout_policy)
7097
0
{
7098
0
    struct ovsdb_datum datum;
7099
7100
0
    datum.refcnt = NULL;
7101
0
    union ovsdb_atom *key;
7102
7103
0
    if (timeout_policy) {
7104
0
        key = xmalloc(sizeof (union ovsdb_atom));
7105
0
        datum.n = 1;
7106
0
        datum.keys = key;
7107
0
        key->uuid = timeout_policy->header_.uuid;
7108
0
    } else {
7109
0
        datum.n = 0;
7110
0
        datum.keys = NULL;
7111
0
    }
7112
0
    datum.values = NULL;
7113
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]);
7114
0
}
7115
7116
struct ovsdb_idl_column ovsrec_ct_zone_columns[OVSREC_CT_ZONE_N_COLUMNS];
7117
7118
unsigned int
7119
ovsrec_ct_zone_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
7120
0
{
7121
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_ct_zone, condition);
7122
0
}
7123
7124
struct ovsdb_idl_column ovsrec_ct_zone_columns[OVSREC_CT_ZONE_N_COLUMNS] = {
7125
    [OVSREC_CT_ZONE_COL_EXTERNAL_IDS] = {
7126
         .name = "external_ids",
7127
         .type = {
7128
            .key = {
7129
               .type = OVSDB_TYPE_STRING,
7130
               .string = { .minLen = 0, .maxLen = UINT_MAX },
7131
            },
7132
            .value = {
7133
                .type = OVSDB_TYPE_STRING,
7134
                .string = { .minLen = 0, .maxLen = UINT_MAX },
7135
            },
7136
            .n_min = 0,
7137
            .n_max = UINT_MAX,
7138
         },
7139
         .is_mutable = true,
7140
         .is_synthetic = false,
7141
         .parse = ovsrec_ct_zone_parse_external_ids,
7142
         .unparse = ovsrec_ct_zone_unparse_external_ids,
7143
    },
7144
7145
    [OVSREC_CT_ZONE_COL_TIMEOUT_POLICY] = {
7146
         .name = "timeout_policy",
7147
         .type = {
7148
            .key = {
7149
               .type = OVSDB_TYPE_UUID,
7150
               .uuid = { .refTableName = "CT_Timeout_Policy", .refType = OVSDB_REF_STRONG },
7151
            },
7152
            .value = OVSDB_BASE_VOID_INIT,
7153
            .n_min = 0,
7154
            .n_max = 1,
7155
         },
7156
         .is_mutable = true,
7157
         .is_synthetic = false,
7158
         .parse = ovsrec_ct_zone_parse_timeout_policy,
7159
         .unparse = ovsrec_ct_zone_unparse_timeout_policy,
7160
    },
7161
7162
};
7163

7164
/* Controller table. */
7165
7166
bool
7167
ovsrec_server_has_controller_table_col_connection_mode(const struct ovsdb_idl *idl)
7168
0
{
7169
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_connection_mode);
7170
0
}
7171
7172
7173
bool
7174
ovsrec_server_has_controller_table_col_controller_burst_limit(const struct ovsdb_idl *idl)
7175
0
{
7176
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_controller_burst_limit);
7177
0
}
7178
7179
7180
bool
7181
ovsrec_server_has_controller_table_col_controller_queue_size(const struct ovsdb_idl *idl)
7182
0
{
7183
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_controller_queue_size);
7184
0
}
7185
7186
7187
bool
7188
ovsrec_server_has_controller_table_col_controller_rate_limit(const struct ovsdb_idl *idl)
7189
0
{
7190
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_controller_rate_limit);
7191
0
}
7192
7193
7194
bool
7195
ovsrec_server_has_controller_table_col_enable_async_messages(const struct ovsdb_idl *idl)
7196
0
{
7197
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_enable_async_messages);
7198
0
}
7199
7200
7201
bool
7202
ovsrec_server_has_controller_table_col_external_ids(const struct ovsdb_idl *idl)
7203
0
{
7204
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_external_ids);
7205
0
}
7206
7207
7208
bool
7209
ovsrec_server_has_controller_table_col_inactivity_probe(const struct ovsdb_idl *idl)
7210
0
{
7211
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_inactivity_probe);
7212
0
}
7213
7214
7215
bool
7216
ovsrec_server_has_controller_table_col_is_connected(const struct ovsdb_idl *idl)
7217
0
{
7218
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_is_connected);
7219
0
}
7220
7221
7222
bool
7223
ovsrec_server_has_controller_table_col_local_gateway(const struct ovsdb_idl *idl)
7224
0
{
7225
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_local_gateway);
7226
0
}
7227
7228
7229
bool
7230
ovsrec_server_has_controller_table_col_local_ip(const struct ovsdb_idl *idl)
7231
0
{
7232
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_local_ip);
7233
0
}
7234
7235
7236
bool
7237
ovsrec_server_has_controller_table_col_local_netmask(const struct ovsdb_idl *idl)
7238
0
{
7239
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_local_netmask);
7240
0
}
7241
7242
7243
bool
7244
ovsrec_server_has_controller_table_col_max_backoff(const struct ovsdb_idl *idl)
7245
0
{
7246
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_max_backoff);
7247
0
}
7248
7249
7250
bool
7251
ovsrec_server_has_controller_table_col_other_config(const struct ovsdb_idl *idl)
7252
0
{
7253
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_other_config);
7254
0
}
7255
7256
7257
bool
7258
ovsrec_server_has_controller_table_col_role(const struct ovsdb_idl *idl)
7259
0
{
7260
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_role);
7261
0
}
7262
7263
7264
bool
7265
ovsrec_server_has_controller_table_col_status(const struct ovsdb_idl *idl)
7266
0
{
7267
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_status);
7268
0
}
7269
7270
7271
bool
7272
ovsrec_server_has_controller_table_col_target(const struct ovsdb_idl *idl)
7273
0
{
7274
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_target);
7275
0
}
7276
7277
7278
bool
7279
ovsrec_server_has_controller_table_col_type(const struct ovsdb_idl *idl)
7280
0
{
7281
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_controller_col_type);
7282
0
}
7283
7284
7285
bool
7286
ovsrec_server_has_controller_table(const struct ovsdb_idl *idl)
7287
0
{
7288
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
7289
0
}
7290
7291
7292
const struct ovsrec_controller_table *
7293
ovsrec_controller_table_get(const struct ovsdb_idl *idl)
7294
0
{
7295
0
    return (const struct ovsrec_controller_table *) idl;
7296
0
}
7297
7298
const struct ovsrec_controller *
7299
ovsrec_controller_table_first(const struct ovsrec_controller_table *table)
7300
0
{
7301
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
7302
0
    return ovsrec_controller_first(idl);
7303
0
}
7304
7305
7306
const struct ovsrec_controller *
7307
ovsrec_controller_table_track_get_first(const struct ovsrec_controller_table *table)
7308
0
{
7309
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
7310
0
    return ovsrec_controller_track_get_first(idl);
7311
0
}
7312
7313
7314
static void
7315
ovsrec_controller_parse_connection_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7316
0
{
7317
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7318
7319
0
    if (datum->n >= 1) {
7320
0
        row->connection_mode = datum->keys[0].s->string;
7321
0
    } else {
7322
0
        row->connection_mode = NULL;
7323
0
    }
7324
0
}
7325
7326
static void
7327
ovsrec_controller_parse_controller_burst_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7328
0
{
7329
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7330
0
    size_t n = MIN(1, datum->n);
7331
0
    row->controller_burst_limit = NULL;
7332
0
    row->n_controller_burst_limit = 0;
7333
0
    for (size_t i = 0; i < n; i++) {
7334
0
        if (!row->n_controller_burst_limit) {
7335
0
            row->controller_burst_limit = xmalloc(n * sizeof *row->controller_burst_limit);
7336
0
        }
7337
0
        row->controller_burst_limit[row->n_controller_burst_limit] = datum->keys[i].integer;
7338
0
        row->n_controller_burst_limit++;
7339
0
    }
7340
0
}
7341
7342
static void
7343
ovsrec_controller_parse_controller_queue_size(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7344
0
{
7345
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7346
0
    size_t n = MIN(1, datum->n);
7347
0
    row->controller_queue_size = NULL;
7348
0
    row->n_controller_queue_size = 0;
7349
0
    for (size_t i = 0; i < n; i++) {
7350
0
        if (!row->n_controller_queue_size) {
7351
0
            row->controller_queue_size = xmalloc(n * sizeof *row->controller_queue_size);
7352
0
        }
7353
0
        row->controller_queue_size[row->n_controller_queue_size] = datum->keys[i].integer;
7354
0
        row->n_controller_queue_size++;
7355
0
    }
7356
0
}
7357
7358
static void
7359
ovsrec_controller_parse_controller_rate_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7360
0
{
7361
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7362
0
    size_t n = MIN(1, datum->n);
7363
0
    row->controller_rate_limit = NULL;
7364
0
    row->n_controller_rate_limit = 0;
7365
0
    for (size_t i = 0; i < n; i++) {
7366
0
        if (!row->n_controller_rate_limit) {
7367
0
            row->controller_rate_limit = xmalloc(n * sizeof *row->controller_rate_limit);
7368
0
        }
7369
0
        row->controller_rate_limit[row->n_controller_rate_limit] = datum->keys[i].integer;
7370
0
        row->n_controller_rate_limit++;
7371
0
    }
7372
0
}
7373
7374
static void
7375
ovsrec_controller_parse_enable_async_messages(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7376
0
{
7377
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7378
0
    size_t n = MIN(1, datum->n);
7379
0
    row->enable_async_messages = NULL;
7380
0
    row->n_enable_async_messages = 0;
7381
0
    for (size_t i = 0; i < n; i++) {
7382
0
        if (!row->n_enable_async_messages) {
7383
0
            row->enable_async_messages = xmalloc(n * sizeof *row->enable_async_messages);
7384
0
        }
7385
0
        row->enable_async_messages[row->n_enable_async_messages] = datum->keys[i].boolean;
7386
0
        row->n_enable_async_messages++;
7387
0
    }
7388
0
}
7389
7390
static void
7391
ovsrec_controller_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7392
0
{
7393
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7394
0
    smap_init(&row->external_ids);
7395
0
    for (size_t i = 0; i < datum->n; i++) {
7396
0
        smap_add(&row->external_ids,
7397
0
                 json_string(datum->keys[i].s),
7398
0
                 json_string(datum->values[i].s));
7399
0
    }
7400
0
}
7401
7402
static void
7403
ovsrec_controller_parse_inactivity_probe(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7404
0
{
7405
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7406
0
    size_t n = MIN(1, datum->n);
7407
0
    row->inactivity_probe = NULL;
7408
0
    row->n_inactivity_probe = 0;
7409
0
    for (size_t i = 0; i < n; i++) {
7410
0
        if (!row->n_inactivity_probe) {
7411
0
            row->inactivity_probe = xmalloc(n * sizeof *row->inactivity_probe);
7412
0
        }
7413
0
        row->inactivity_probe[row->n_inactivity_probe] = datum->keys[i].integer;
7414
0
        row->n_inactivity_probe++;
7415
0
    }
7416
0
}
7417
7418
static void
7419
ovsrec_controller_parse_is_connected(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7420
0
{
7421
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7422
7423
0
    if (datum->n >= 1) {
7424
0
        row->is_connected = datum->keys[0].boolean;
7425
0
    } else {
7426
0
        row->is_connected = false;
7427
0
    }
7428
0
}
7429
7430
static void
7431
ovsrec_controller_parse_local_gateway(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7432
0
{
7433
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7434
7435
0
    if (datum->n >= 1) {
7436
0
        row->local_gateway = datum->keys[0].s->string;
7437
0
    } else {
7438
0
        row->local_gateway = NULL;
7439
0
    }
7440
0
}
7441
7442
static void
7443
ovsrec_controller_parse_local_ip(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7444
0
{
7445
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7446
7447
0
    if (datum->n >= 1) {
7448
0
        row->local_ip = datum->keys[0].s->string;
7449
0
    } else {
7450
0
        row->local_ip = NULL;
7451
0
    }
7452
0
}
7453
7454
static void
7455
ovsrec_controller_parse_local_netmask(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7456
0
{
7457
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7458
7459
0
    if (datum->n >= 1) {
7460
0
        row->local_netmask = datum->keys[0].s->string;
7461
0
    } else {
7462
0
        row->local_netmask = NULL;
7463
0
    }
7464
0
}
7465
7466
static void
7467
ovsrec_controller_parse_max_backoff(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7468
0
{
7469
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7470
0
    size_t n = MIN(1, datum->n);
7471
0
    row->max_backoff = NULL;
7472
0
    row->n_max_backoff = 0;
7473
0
    for (size_t i = 0; i < n; i++) {
7474
0
        if (!row->n_max_backoff) {
7475
0
            row->max_backoff = xmalloc(n * sizeof *row->max_backoff);
7476
0
        }
7477
0
        row->max_backoff[row->n_max_backoff] = datum->keys[i].integer;
7478
0
        row->n_max_backoff++;
7479
0
    }
7480
0
}
7481
7482
static void
7483
ovsrec_controller_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7484
0
{
7485
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7486
0
    smap_init(&row->other_config);
7487
0
    for (size_t i = 0; i < datum->n; i++) {
7488
0
        smap_add(&row->other_config,
7489
0
                 json_string(datum->keys[i].s),
7490
0
                 json_string(datum->values[i].s));
7491
0
    }
7492
0
}
7493
7494
static void
7495
ovsrec_controller_parse_role(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7496
0
{
7497
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7498
7499
0
    if (datum->n >= 1) {
7500
0
        row->role = datum->keys[0].s->string;
7501
0
    } else {
7502
0
        row->role = NULL;
7503
0
    }
7504
0
}
7505
7506
static void
7507
ovsrec_controller_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7508
0
{
7509
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7510
0
    smap_init(&row->status);
7511
0
    for (size_t i = 0; i < datum->n; i++) {
7512
0
        smap_add(&row->status,
7513
0
                 json_string(datum->keys[i].s),
7514
0
                 json_string(datum->values[i].s));
7515
0
    }
7516
0
}
7517
7518
static void
7519
ovsrec_controller_parse_target(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7520
0
{
7521
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7522
7523
0
    if (datum->n >= 1) {
7524
0
        row->target = datum->keys[0].s->string;
7525
0
    } else {
7526
0
        row->target = "";
7527
0
    }
7528
0
}
7529
7530
static void
7531
ovsrec_controller_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7532
0
{
7533
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7534
7535
0
    if (datum->n >= 1) {
7536
0
        row->type = datum->keys[0].s->string;
7537
0
    } else {
7538
0
        row->type = NULL;
7539
0
    }
7540
0
}
7541
7542
static void
7543
ovsrec_controller_unparse_connection_mode(struct ovsdb_idl_row *row OVS_UNUSED)
7544
0
{
7545
    /* Nothing to do. */
7546
0
}
7547
7548
static void
7549
ovsrec_controller_unparse_controller_burst_limit(struct ovsdb_idl_row *row_)
7550
0
{
7551
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7552
0
    free(row->controller_burst_limit);
7553
0
}
7554
7555
static void
7556
ovsrec_controller_unparse_controller_queue_size(struct ovsdb_idl_row *row_)
7557
0
{
7558
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7559
0
    free(row->controller_queue_size);
7560
0
}
7561
7562
static void
7563
ovsrec_controller_unparse_controller_rate_limit(struct ovsdb_idl_row *row_)
7564
0
{
7565
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7566
0
    free(row->controller_rate_limit);
7567
0
}
7568
7569
static void
7570
ovsrec_controller_unparse_enable_async_messages(struct ovsdb_idl_row *row_)
7571
0
{
7572
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7573
0
    free(row->enable_async_messages);
7574
0
}
7575
7576
static void
7577
ovsrec_controller_unparse_external_ids(struct ovsdb_idl_row *row_)
7578
0
{
7579
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7580
0
    smap_destroy(&row->external_ids);
7581
0
}
7582
7583
static void
7584
ovsrec_controller_unparse_inactivity_probe(struct ovsdb_idl_row *row_)
7585
0
{
7586
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7587
0
    free(row->inactivity_probe);
7588
0
}
7589
7590
static void
7591
ovsrec_controller_unparse_is_connected(struct ovsdb_idl_row *row OVS_UNUSED)
7592
0
{
7593
    /* Nothing to do. */
7594
0
}
7595
7596
static void
7597
ovsrec_controller_unparse_local_gateway(struct ovsdb_idl_row *row OVS_UNUSED)
7598
0
{
7599
    /* Nothing to do. */
7600
0
}
7601
7602
static void
7603
ovsrec_controller_unparse_local_ip(struct ovsdb_idl_row *row OVS_UNUSED)
7604
0
{
7605
    /* Nothing to do. */
7606
0
}
7607
7608
static void
7609
ovsrec_controller_unparse_local_netmask(struct ovsdb_idl_row *row OVS_UNUSED)
7610
0
{
7611
    /* Nothing to do. */
7612
0
}
7613
7614
static void
7615
ovsrec_controller_unparse_max_backoff(struct ovsdb_idl_row *row_)
7616
0
{
7617
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7618
0
    free(row->max_backoff);
7619
0
}
7620
7621
static void
7622
ovsrec_controller_unparse_other_config(struct ovsdb_idl_row *row_)
7623
0
{
7624
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7625
0
    smap_destroy(&row->other_config);
7626
0
}
7627
7628
static void
7629
ovsrec_controller_unparse_role(struct ovsdb_idl_row *row OVS_UNUSED)
7630
0
{
7631
    /* Nothing to do. */
7632
0
}
7633
7634
static void
7635
ovsrec_controller_unparse_status(struct ovsdb_idl_row *row_)
7636
0
{
7637
0
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
7638
0
    smap_destroy(&row->status);
7639
0
}
7640
7641
static void
7642
ovsrec_controller_unparse_target(struct ovsdb_idl_row *row OVS_UNUSED)
7643
0
{
7644
    /* Nothing to do. */
7645
0
}
7646
7647
static void
7648
ovsrec_controller_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
7649
0
{
7650
    /* Nothing to do. */
7651
0
}
7652
7653
static void
7654
ovsrec_controller_init__(struct ovsdb_idl_row *row)
7655
0
{
7656
0
    ovsrec_controller_init(ovsrec_controller_cast(row));
7657
0
}
7658
7659
/* Clears the contents of 'row' in table "Controller". */
7660
void
7661
ovsrec_controller_init(struct ovsrec_controller *row)
7662
0
{
7663
0
    memset(row, 0, sizeof *row); 
7664
0
    smap_init(&row->external_ids);
7665
0
    smap_init(&row->other_config);
7666
0
    smap_init(&row->status);
7667
0
    row->target = "";
7668
0
}
7669
7670
/* Searches table "Controller" in 'idl' for a row with UUID 'uuid'.  Returns
7671
 * a pointer to the row if there is one, otherwise a null pointer.  */
7672
const struct ovsrec_controller *
7673
ovsrec_controller_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
7674
0
{
7675
0
    return ovsrec_controller_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_controller, uuid));
7676
0
}
7677
7678
/* Searches table "Controller" for a row with UUID 'uuid'.  Returns
7679
 * a pointer to the row if there is one, otherwise a null pointer.  */
7680
const struct ovsrec_controller *
7681
ovsrec_controller_table_get_for_uuid(const struct ovsrec_controller_table *table, const struct uuid *uuid)
7682
0
{
7683
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
7684
0
    return ovsrec_controller_get_for_uuid(idl, uuid);
7685
0
}
7686
7687
/* Returns a row in table "Controller" in 'idl', or a null pointer if that
7688
 * table is empty.
7689
 *
7690
 * Database tables are internally maintained as hash tables, so adding or
7691
 * removing rows while traversing the same table can cause some rows to be
7692
 * visited twice or not at apply. */
7693
const struct ovsrec_controller *
7694
ovsrec_controller_first(const struct ovsdb_idl *idl)
7695
0
{
7696
0
    return ovsrec_controller_cast(ovsdb_idl_first_row(idl, &ovsrec_table_controller));
7697
0
}
7698
7699
/* Returns a row following 'row' within its table, or a null pointer if 'row'
7700
 * is the last row in its table. */
7701
const struct ovsrec_controller *
7702
ovsrec_controller_next(const struct ovsrec_controller *row)
7703
0
{
7704
0
    return ovsrec_controller_cast(ovsdb_idl_next_row(&row->header_));
7705
0
}
7706
7707
unsigned int ovsrec_controller_get_seqno(const struct ovsdb_idl *idl)
7708
0
{
7709
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_controller);
7710
0
}
7711
7712
unsigned int ovsrec_controller_row_get_seqno(const struct ovsrec_controller *row, enum ovsdb_idl_change change)
7713
0
{
7714
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
7715
0
}
7716
7717
const struct ovsrec_controller *
7718
ovsrec_controller_track_get_first(const struct ovsdb_idl *idl)
7719
0
{
7720
0
    return ovsrec_controller_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_controller));
7721
0
}
7722
7723
const struct ovsrec_controller
7724
*ovsrec_controller_track_get_next(const struct ovsrec_controller *row)
7725
0
{
7726
0
    return ovsrec_controller_cast(ovsdb_idl_track_get_next(&row->header_));
7727
0
}
7728
7729
7730
/* Deletes 'row' from table "Controller".  'row' may be freed, so it must not be
7731
 * accessed afterward.
7732
 *
7733
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7734
void
7735
ovsrec_controller_delete(const struct ovsrec_controller *row)
7736
0
{
7737
0
    ovsdb_idl_txn_delete(&row->header_);
7738
0
}
7739
7740
/* Inserts and returns a new row in the table "Controller" in the database
7741
 * with open transaction 'txn'.
7742
 *
7743
 * The new row is assigned a randomly generated provisional UUID.
7744
 * ovsdb-server will assign a different UUID when 'txn' is committed,
7745
 * but the IDL will replace any uses of the provisional UUID in the
7746
 * data to be to be committed by the UUID assigned by ovsdb-server. */
7747
struct ovsrec_controller *
7748
ovsrec_controller_insert(struct ovsdb_idl_txn *txn)
7749
0
{
7750
0
    return ovsrec_controller_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_controller, NULL));
7751
0
}
7752
7753
/* Inserts and returns a new row in the table "Controller" in the database
7754
 * with open transaction 'txn'.
7755
 *
7756
 * The new row is assigned the UUID specified in the 'uuid' parameter
7757
 * (which cannot be null).  ovsdb-server will try to assign the same
7758
 * UUID when 'txn' is committed. */
7759
struct ovsrec_controller *
7760
ovsrec_controller_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
7761
0
{
7762
0
    return ovsrec_controller_cast(ovsdb_idl_txn_insert_persist_uuid(
7763
0
        txn, &ovsrec_table_controller, uuid));
7764
0
}
7765
7766
bool
7767
ovsrec_controller_is_updated(const struct ovsrec_controller *row, enum ovsrec_controller_column_id column)
7768
0
{
7769
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_controller_columns[column]);
7770
0
}
7771
7772
/* Causes the original contents of column "connection_mode" in 'row' to be
7773
 * verified as a prerequisite to completing the transaction.  That is, if
7774
 * "connection_mode" in 'row' changed (or if 'row' was deleted) between the
7775
 * time that the IDL originally read its contents and the time that the
7776
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
7777
 *
7778
 * The intention is that, to ensure that no transaction commits based on dirty
7779
 * reads, an application should call this function any time "connection_mode" is
7780
 * read as part of a read-modify-write operation.
7781
 *
7782
 * In some cases this function reduces to a no-op, because the current value
7783
 * of "connection_mode" is already known:
7784
 *
7785
 *   - If 'row' is a row created by the current transaction (returned by
7786
 *     ovsrec_controller_insert()).
7787
 *
7788
 *   - If "connection_mode" has already been modified (with
7789
 *     ovsrec_controller_set_connection_mode()) within the current transaction.
7790
 *
7791
 * Because of the latter property, always call this function *before*
7792
 * ovsrec_controller_set_connection_mode() for a given read-modify-write.
7793
 *
7794
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7795
void
7796
ovsrec_controller_verify_connection_mode(const struct ovsrec_controller *row)
7797
0
{
7798
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_connection_mode);
7799
0
}
7800
7801
/* Causes the original contents of column "controller_burst_limit" in 'row' to be
7802
 * verified as a prerequisite to completing the transaction.  That is, if
7803
 * "controller_burst_limit" in 'row' changed (or if 'row' was deleted) between the
7804
 * time that the IDL originally read its contents and the time that the
7805
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
7806
 *
7807
 * The intention is that, to ensure that no transaction commits based on dirty
7808
 * reads, an application should call this function any time "controller_burst_limit" is
7809
 * read as part of a read-modify-write operation.
7810
 *
7811
 * In some cases this function reduces to a no-op, because the current value
7812
 * of "controller_burst_limit" is already known:
7813
 *
7814
 *   - If 'row' is a row created by the current transaction (returned by
7815
 *     ovsrec_controller_insert()).
7816
 *
7817
 *   - If "controller_burst_limit" has already been modified (with
7818
 *     ovsrec_controller_set_controller_burst_limit()) within the current transaction.
7819
 *
7820
 * Because of the latter property, always call this function *before*
7821
 * ovsrec_controller_set_controller_burst_limit() for a given read-modify-write.
7822
 *
7823
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7824
void
7825
ovsrec_controller_verify_controller_burst_limit(const struct ovsrec_controller *row)
7826
0
{
7827
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_controller_burst_limit);
7828
0
}
7829
7830
/* Causes the original contents of column "controller_queue_size" in 'row' to be
7831
 * verified as a prerequisite to completing the transaction.  That is, if
7832
 * "controller_queue_size" in 'row' changed (or if 'row' was deleted) between the
7833
 * time that the IDL originally read its contents and the time that the
7834
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
7835
 *
7836
 * The intention is that, to ensure that no transaction commits based on dirty
7837
 * reads, an application should call this function any time "controller_queue_size" is
7838
 * read as part of a read-modify-write operation.
7839
 *
7840
 * In some cases this function reduces to a no-op, because the current value
7841
 * of "controller_queue_size" is already known:
7842
 *
7843
 *   - If 'row' is a row created by the current transaction (returned by
7844
 *     ovsrec_controller_insert()).
7845
 *
7846
 *   - If "controller_queue_size" has already been modified (with
7847
 *     ovsrec_controller_set_controller_queue_size()) within the current transaction.
7848
 *
7849
 * Because of the latter property, always call this function *before*
7850
 * ovsrec_controller_set_controller_queue_size() for a given read-modify-write.
7851
 *
7852
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7853
void
7854
ovsrec_controller_verify_controller_queue_size(const struct ovsrec_controller *row)
7855
0
{
7856
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_controller_queue_size);
7857
0
}
7858
7859
/* Causes the original contents of column "controller_rate_limit" in 'row' to be
7860
 * verified as a prerequisite to completing the transaction.  That is, if
7861
 * "controller_rate_limit" in 'row' changed (or if 'row' was deleted) between the
7862
 * time that the IDL originally read its contents and the time that the
7863
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
7864
 *
7865
 * The intention is that, to ensure that no transaction commits based on dirty
7866
 * reads, an application should call this function any time "controller_rate_limit" is
7867
 * read as part of a read-modify-write operation.
7868
 *
7869
 * In some cases this function reduces to a no-op, because the current value
7870
 * of "controller_rate_limit" is already known:
7871
 *
7872
 *   - If 'row' is a row created by the current transaction (returned by
7873
 *     ovsrec_controller_insert()).
7874
 *
7875
 *   - If "controller_rate_limit" has already been modified (with
7876
 *     ovsrec_controller_set_controller_rate_limit()) within the current transaction.
7877
 *
7878
 * Because of the latter property, always call this function *before*
7879
 * ovsrec_controller_set_controller_rate_limit() for a given read-modify-write.
7880
 *
7881
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7882
void
7883
ovsrec_controller_verify_controller_rate_limit(const struct ovsrec_controller *row)
7884
0
{
7885
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_controller_rate_limit);
7886
0
}
7887
7888
/* Causes the original contents of column "enable_async_messages" in 'row' to be
7889
 * verified as a prerequisite to completing the transaction.  That is, if
7890
 * "enable_async_messages" in 'row' changed (or if 'row' was deleted) between the
7891
 * time that the IDL originally read its contents and the time that the
7892
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
7893
 *
7894
 * The intention is that, to ensure that no transaction commits based on dirty
7895
 * reads, an application should call this function any time "enable_async_messages" is
7896
 * read as part of a read-modify-write operation.
7897
 *
7898
 * In some cases this function reduces to a no-op, because the current value
7899
 * of "enable_async_messages" is already known:
7900
 *
7901
 *   - If 'row' is a row created by the current transaction (returned by
7902
 *     ovsrec_controller_insert()).
7903
 *
7904
 *   - If "enable_async_messages" has already been modified (with
7905
 *     ovsrec_controller_set_enable_async_messages()) within the current transaction.
7906
 *
7907
 * Because of the latter property, always call this function *before*
7908
 * ovsrec_controller_set_enable_async_messages() for a given read-modify-write.
7909
 *
7910
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7911
void
7912
ovsrec_controller_verify_enable_async_messages(const struct ovsrec_controller *row)
7913
0
{
7914
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_enable_async_messages);
7915
0
}
7916
7917
/* Causes the original contents of column "external_ids" in 'row' to be
7918
 * verified as a prerequisite to completing the transaction.  That is, if
7919
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
7920
 * time that the IDL originally read its contents and the time that the
7921
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
7922
 *
7923
 * The intention is that, to ensure that no transaction commits based on dirty
7924
 * reads, an application should call this function any time "external_ids" is
7925
 * read as part of a read-modify-write operation.
7926
 *
7927
 * In some cases this function reduces to a no-op, because the current value
7928
 * of "external_ids" is already known:
7929
 *
7930
 *   - If 'row' is a row created by the current transaction (returned by
7931
 *     ovsrec_controller_insert()).
7932
 *
7933
 *   - If "external_ids" has already been modified (with
7934
 *     ovsrec_controller_set_external_ids()) within the current transaction.
7935
 *
7936
 * Because of the latter property, always call this function *before*
7937
 * ovsrec_controller_set_external_ids() for a given read-modify-write.
7938
 *
7939
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7940
void
7941
ovsrec_controller_verify_external_ids(const struct ovsrec_controller *row)
7942
0
{
7943
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_external_ids);
7944
0
}
7945
7946
/* Causes the original contents of column "inactivity_probe" in 'row' to be
7947
 * verified as a prerequisite to completing the transaction.  That is, if
7948
 * "inactivity_probe" in 'row' changed (or if 'row' was deleted) between the
7949
 * time that the IDL originally read its contents and the time that the
7950
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
7951
 *
7952
 * The intention is that, to ensure that no transaction commits based on dirty
7953
 * reads, an application should call this function any time "inactivity_probe" is
7954
 * read as part of a read-modify-write operation.
7955
 *
7956
 * In some cases this function reduces to a no-op, because the current value
7957
 * of "inactivity_probe" is already known:
7958
 *
7959
 *   - If 'row' is a row created by the current transaction (returned by
7960
 *     ovsrec_controller_insert()).
7961
 *
7962
 *   - If "inactivity_probe" has already been modified (with
7963
 *     ovsrec_controller_set_inactivity_probe()) within the current transaction.
7964
 *
7965
 * Because of the latter property, always call this function *before*
7966
 * ovsrec_controller_set_inactivity_probe() for a given read-modify-write.
7967
 *
7968
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7969
void
7970
ovsrec_controller_verify_inactivity_probe(const struct ovsrec_controller *row)
7971
0
{
7972
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_inactivity_probe);
7973
0
}
7974
7975
/* Causes the original contents of column "is_connected" in 'row' to be
7976
 * verified as a prerequisite to completing the transaction.  That is, if
7977
 * "is_connected" in 'row' changed (or if 'row' was deleted) between the
7978
 * time that the IDL originally read its contents and the time that the
7979
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
7980
 *
7981
 * The intention is that, to ensure that no transaction commits based on dirty
7982
 * reads, an application should call this function any time "is_connected" is
7983
 * read as part of a read-modify-write operation.
7984
 *
7985
 * In some cases this function reduces to a no-op, because the current value
7986
 * of "is_connected" is already known:
7987
 *
7988
 *   - If 'row' is a row created by the current transaction (returned by
7989
 *     ovsrec_controller_insert()).
7990
 *
7991
 *   - If "is_connected" has already been modified (with
7992
 *     ovsrec_controller_set_is_connected()) within the current transaction.
7993
 *
7994
 * Because of the latter property, always call this function *before*
7995
 * ovsrec_controller_set_is_connected() for a given read-modify-write.
7996
 *
7997
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
7998
void
7999
ovsrec_controller_verify_is_connected(const struct ovsrec_controller *row)
8000
0
{
8001
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_is_connected);
8002
0
}
8003
8004
/* Causes the original contents of column "local_gateway" in 'row' to be
8005
 * verified as a prerequisite to completing the transaction.  That is, if
8006
 * "local_gateway" in 'row' changed (or if 'row' was deleted) between the
8007
 * time that the IDL originally read its contents and the time that the
8008
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8009
 *
8010
 * The intention is that, to ensure that no transaction commits based on dirty
8011
 * reads, an application should call this function any time "local_gateway" is
8012
 * read as part of a read-modify-write operation.
8013
 *
8014
 * In some cases this function reduces to a no-op, because the current value
8015
 * of "local_gateway" is already known:
8016
 *
8017
 *   - If 'row' is a row created by the current transaction (returned by
8018
 *     ovsrec_controller_insert()).
8019
 *
8020
 *   - If "local_gateway" has already been modified (with
8021
 *     ovsrec_controller_set_local_gateway()) within the current transaction.
8022
 *
8023
 * Because of the latter property, always call this function *before*
8024
 * ovsrec_controller_set_local_gateway() for a given read-modify-write.
8025
 *
8026
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8027
void
8028
ovsrec_controller_verify_local_gateway(const struct ovsrec_controller *row)
8029
0
{
8030
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_local_gateway);
8031
0
}
8032
8033
/* Causes the original contents of column "local_ip" in 'row' to be
8034
 * verified as a prerequisite to completing the transaction.  That is, if
8035
 * "local_ip" in 'row' changed (or if 'row' was deleted) between the
8036
 * time that the IDL originally read its contents and the time that the
8037
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8038
 *
8039
 * The intention is that, to ensure that no transaction commits based on dirty
8040
 * reads, an application should call this function any time "local_ip" is
8041
 * read as part of a read-modify-write operation.
8042
 *
8043
 * In some cases this function reduces to a no-op, because the current value
8044
 * of "local_ip" is already known:
8045
 *
8046
 *   - If 'row' is a row created by the current transaction (returned by
8047
 *     ovsrec_controller_insert()).
8048
 *
8049
 *   - If "local_ip" has already been modified (with
8050
 *     ovsrec_controller_set_local_ip()) within the current transaction.
8051
 *
8052
 * Because of the latter property, always call this function *before*
8053
 * ovsrec_controller_set_local_ip() for a given read-modify-write.
8054
 *
8055
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8056
void
8057
ovsrec_controller_verify_local_ip(const struct ovsrec_controller *row)
8058
0
{
8059
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_local_ip);
8060
0
}
8061
8062
/* Causes the original contents of column "local_netmask" in 'row' to be
8063
 * verified as a prerequisite to completing the transaction.  That is, if
8064
 * "local_netmask" in 'row' changed (or if 'row' was deleted) between the
8065
 * time that the IDL originally read its contents and the time that the
8066
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8067
 *
8068
 * The intention is that, to ensure that no transaction commits based on dirty
8069
 * reads, an application should call this function any time "local_netmask" is
8070
 * read as part of a read-modify-write operation.
8071
 *
8072
 * In some cases this function reduces to a no-op, because the current value
8073
 * of "local_netmask" is already known:
8074
 *
8075
 *   - If 'row' is a row created by the current transaction (returned by
8076
 *     ovsrec_controller_insert()).
8077
 *
8078
 *   - If "local_netmask" has already been modified (with
8079
 *     ovsrec_controller_set_local_netmask()) within the current transaction.
8080
 *
8081
 * Because of the latter property, always call this function *before*
8082
 * ovsrec_controller_set_local_netmask() for a given read-modify-write.
8083
 *
8084
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8085
void
8086
ovsrec_controller_verify_local_netmask(const struct ovsrec_controller *row)
8087
0
{
8088
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_local_netmask);
8089
0
}
8090
8091
/* Causes the original contents of column "max_backoff" in 'row' to be
8092
 * verified as a prerequisite to completing the transaction.  That is, if
8093
 * "max_backoff" in 'row' changed (or if 'row' was deleted) between the
8094
 * time that the IDL originally read its contents and the time that the
8095
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8096
 *
8097
 * The intention is that, to ensure that no transaction commits based on dirty
8098
 * reads, an application should call this function any time "max_backoff" is
8099
 * read as part of a read-modify-write operation.
8100
 *
8101
 * In some cases this function reduces to a no-op, because the current value
8102
 * of "max_backoff" is already known:
8103
 *
8104
 *   - If 'row' is a row created by the current transaction (returned by
8105
 *     ovsrec_controller_insert()).
8106
 *
8107
 *   - If "max_backoff" has already been modified (with
8108
 *     ovsrec_controller_set_max_backoff()) within the current transaction.
8109
 *
8110
 * Because of the latter property, always call this function *before*
8111
 * ovsrec_controller_set_max_backoff() for a given read-modify-write.
8112
 *
8113
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8114
void
8115
ovsrec_controller_verify_max_backoff(const struct ovsrec_controller *row)
8116
0
{
8117
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_max_backoff);
8118
0
}
8119
8120
/* Causes the original contents of column "other_config" in 'row' to be
8121
 * verified as a prerequisite to completing the transaction.  That is, if
8122
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
8123
 * time that the IDL originally read its contents and the time that the
8124
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8125
 *
8126
 * The intention is that, to ensure that no transaction commits based on dirty
8127
 * reads, an application should call this function any time "other_config" is
8128
 * read as part of a read-modify-write operation.
8129
 *
8130
 * In some cases this function reduces to a no-op, because the current value
8131
 * of "other_config" is already known:
8132
 *
8133
 *   - If 'row' is a row created by the current transaction (returned by
8134
 *     ovsrec_controller_insert()).
8135
 *
8136
 *   - If "other_config" has already been modified (with
8137
 *     ovsrec_controller_set_other_config()) within the current transaction.
8138
 *
8139
 * Because of the latter property, always call this function *before*
8140
 * ovsrec_controller_set_other_config() for a given read-modify-write.
8141
 *
8142
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8143
void
8144
ovsrec_controller_verify_other_config(const struct ovsrec_controller *row)
8145
0
{
8146
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_other_config);
8147
0
}
8148
8149
/* Causes the original contents of column "role" in 'row' to be
8150
 * verified as a prerequisite to completing the transaction.  That is, if
8151
 * "role" in 'row' changed (or if 'row' was deleted) between the
8152
 * time that the IDL originally read its contents and the time that the
8153
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8154
 *
8155
 * The intention is that, to ensure that no transaction commits based on dirty
8156
 * reads, an application should call this function any time "role" is
8157
 * read as part of a read-modify-write operation.
8158
 *
8159
 * In some cases this function reduces to a no-op, because the current value
8160
 * of "role" is already known:
8161
 *
8162
 *   - If 'row' is a row created by the current transaction (returned by
8163
 *     ovsrec_controller_insert()).
8164
 *
8165
 *   - If "role" has already been modified (with
8166
 *     ovsrec_controller_set_role()) within the current transaction.
8167
 *
8168
 * Because of the latter property, always call this function *before*
8169
 * ovsrec_controller_set_role() for a given read-modify-write.
8170
 *
8171
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8172
void
8173
ovsrec_controller_verify_role(const struct ovsrec_controller *row)
8174
0
{
8175
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_role);
8176
0
}
8177
8178
/* Causes the original contents of column "status" in 'row' to be
8179
 * verified as a prerequisite to completing the transaction.  That is, if
8180
 * "status" in 'row' changed (or if 'row' was deleted) between the
8181
 * time that the IDL originally read its contents and the time that the
8182
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8183
 *
8184
 * The intention is that, to ensure that no transaction commits based on dirty
8185
 * reads, an application should call this function any time "status" is
8186
 * read as part of a read-modify-write operation.
8187
 *
8188
 * In some cases this function reduces to a no-op, because the current value
8189
 * of "status" is already known:
8190
 *
8191
 *   - If 'row' is a row created by the current transaction (returned by
8192
 *     ovsrec_controller_insert()).
8193
 *
8194
 *   - If "status" has already been modified (with
8195
 *     ovsrec_controller_set_status()) within the current transaction.
8196
 *
8197
 * Because of the latter property, always call this function *before*
8198
 * ovsrec_controller_set_status() for a given read-modify-write.
8199
 *
8200
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8201
void
8202
ovsrec_controller_verify_status(const struct ovsrec_controller *row)
8203
0
{
8204
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_status);
8205
0
}
8206
8207
/* Causes the original contents of column "target" in 'row' to be
8208
 * verified as a prerequisite to completing the transaction.  That is, if
8209
 * "target" in 'row' changed (or if 'row' was deleted) between the
8210
 * time that the IDL originally read its contents and the time that the
8211
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8212
 *
8213
 * The intention is that, to ensure that no transaction commits based on dirty
8214
 * reads, an application should call this function any time "target" is
8215
 * read as part of a read-modify-write operation.
8216
 *
8217
 * In some cases this function reduces to a no-op, because the current value
8218
 * of "target" is already known:
8219
 *
8220
 *   - If 'row' is a row created by the current transaction (returned by
8221
 *     ovsrec_controller_insert()).
8222
 *
8223
 *   - If "target" has already been modified (with
8224
 *     ovsrec_controller_set_target()) within the current transaction.
8225
 *
8226
 * Because of the latter property, always call this function *before*
8227
 * ovsrec_controller_set_target() for a given read-modify-write.
8228
 *
8229
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8230
void
8231
ovsrec_controller_verify_target(const struct ovsrec_controller *row)
8232
0
{
8233
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_target);
8234
0
}
8235
8236
/* Causes the original contents of column "type" in 'row' to be
8237
 * verified as a prerequisite to completing the transaction.  That is, if
8238
 * "type" in 'row' changed (or if 'row' was deleted) between the
8239
 * time that the IDL originally read its contents and the time that the
8240
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
8241
 *
8242
 * The intention is that, to ensure that no transaction commits based on dirty
8243
 * reads, an application should call this function any time "type" is
8244
 * read as part of a read-modify-write operation.
8245
 *
8246
 * In some cases this function reduces to a no-op, because the current value
8247
 * of "type" is already known:
8248
 *
8249
 *   - If 'row' is a row created by the current transaction (returned by
8250
 *     ovsrec_controller_insert()).
8251
 *
8252
 *   - If "type" has already been modified (with
8253
 *     ovsrec_controller_set_type()) within the current transaction.
8254
 *
8255
 * Because of the latter property, always call this function *before*
8256
 * ovsrec_controller_set_type() for a given read-modify-write.
8257
 *
8258
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
8259
void
8260
ovsrec_controller_verify_type(const struct ovsrec_controller *row)
8261
0
{
8262
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_col_type);
8263
0
}
8264
8265
/* Returns the "connection_mode" column's value from the "Controller" table in 'row'
8266
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8267
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8268
 * for a given key than implementing the same operation on the "cooked"
8269
 * form in 'row'.
8270
 *
8271
 * 'key_type' must be OVSDB_TYPE_STRING.
8272
 * (This helps to avoid silent bugs if someone changes connection_mode's
8273
 * type without updating the caller.)
8274
 *
8275
 * The caller must not modify or free the returned value.
8276
 *
8277
 * Various kinds of changes can invalidate the returned value: modifying
8278
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8279
 * If the returned value is needed for a long time, it is best to make a copy
8280
 * of it with ovsdb_datum_clone().
8281
 *
8282
 * This function is rarely useful, since it is easier to access the value
8283
 * directly through the "connection_mode" member in ovsrec_controller. */
8284
const struct ovsdb_datum *
8285
ovsrec_controller_get_connection_mode(const struct ovsrec_controller *row,
8286
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8287
0
{
8288
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8289
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_connection_mode);
8290
0
}
8291
8292
/* Returns the "controller_burst_limit" column's value from the "Controller" table in 'row'
8293
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8294
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8295
 * for a given key than implementing the same operation on the "cooked"
8296
 * form in 'row'.
8297
 *
8298
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8299
 * (This helps to avoid silent bugs if someone changes controller_burst_limit's
8300
 * type without updating the caller.)
8301
 *
8302
 * The caller must not modify or free the returned value.
8303
 *
8304
 * Various kinds of changes can invalidate the returned value: modifying
8305
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8306
 * If the returned value is needed for a long time, it is best to make a copy
8307
 * of it with ovsdb_datum_clone().
8308
 *
8309
 * This function is rarely useful, since it is easier to access the value
8310
 * directly through the "controller_burst_limit" member in ovsrec_controller. */
8311
const struct ovsdb_datum *
8312
ovsrec_controller_get_controller_burst_limit(const struct ovsrec_controller *row,
8313
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8314
0
{
8315
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8316
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_controller_burst_limit);
8317
0
}
8318
8319
/* Returns the "controller_queue_size" column's value from the "Controller" table in 'row'
8320
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8321
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8322
 * for a given key than implementing the same operation on the "cooked"
8323
 * form in 'row'.
8324
 *
8325
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8326
 * (This helps to avoid silent bugs if someone changes controller_queue_size's
8327
 * type without updating the caller.)
8328
 *
8329
 * The caller must not modify or free the returned value.
8330
 *
8331
 * Various kinds of changes can invalidate the returned value: modifying
8332
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8333
 * If the returned value is needed for a long time, it is best to make a copy
8334
 * of it with ovsdb_datum_clone().
8335
 *
8336
 * This function is rarely useful, since it is easier to access the value
8337
 * directly through the "controller_queue_size" member in ovsrec_controller. */
8338
const struct ovsdb_datum *
8339
ovsrec_controller_get_controller_queue_size(const struct ovsrec_controller *row,
8340
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8341
0
{
8342
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8343
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_controller_queue_size);
8344
0
}
8345
8346
/* Returns the "controller_rate_limit" column's value from the "Controller" table in 'row'
8347
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8348
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8349
 * for a given key than implementing the same operation on the "cooked"
8350
 * form in 'row'.
8351
 *
8352
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8353
 * (This helps to avoid silent bugs if someone changes controller_rate_limit's
8354
 * type without updating the caller.)
8355
 *
8356
 * The caller must not modify or free the returned value.
8357
 *
8358
 * Various kinds of changes can invalidate the returned value: modifying
8359
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8360
 * If the returned value is needed for a long time, it is best to make a copy
8361
 * of it with ovsdb_datum_clone().
8362
 *
8363
 * This function is rarely useful, since it is easier to access the value
8364
 * directly through the "controller_rate_limit" member in ovsrec_controller. */
8365
const struct ovsdb_datum *
8366
ovsrec_controller_get_controller_rate_limit(const struct ovsrec_controller *row,
8367
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8368
0
{
8369
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8370
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_controller_rate_limit);
8371
0
}
8372
8373
/* Returns the "enable_async_messages" column's value from the "Controller" table in 'row'
8374
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8375
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8376
 * for a given key than implementing the same operation on the "cooked"
8377
 * form in 'row'.
8378
 *
8379
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
8380
 * (This helps to avoid silent bugs if someone changes enable_async_messages's
8381
 * type without updating the caller.)
8382
 *
8383
 * The caller must not modify or free the returned value.
8384
 *
8385
 * Various kinds of changes can invalidate the returned value: modifying
8386
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8387
 * If the returned value is needed for a long time, it is best to make a copy
8388
 * of it with ovsdb_datum_clone().
8389
 *
8390
 * This function is rarely useful, since it is easier to access the value
8391
 * directly through the "enable_async_messages" member in ovsrec_controller. */
8392
const struct ovsdb_datum *
8393
ovsrec_controller_get_enable_async_messages(const struct ovsrec_controller *row,
8394
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8395
0
{
8396
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
8397
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_enable_async_messages);
8398
0
}
8399
8400
/* Returns the "external_ids" column's value from the "Controller" table in 'row'
8401
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8402
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8403
 * for a given key than implementing the same operation on the "cooked"
8404
 * form in 'row'.
8405
 *
8406
 * 'key_type' must be OVSDB_TYPE_STRING.
8407
 * 'value_type' must be OVSDB_TYPE_STRING.
8408
 * (This helps to avoid silent bugs if someone changes external_ids's
8409
 * type without updating the caller.)
8410
 *
8411
 * The caller must not modify or free the returned value.
8412
 *
8413
 * Various kinds of changes can invalidate the returned value: modifying
8414
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8415
 * If the returned value is needed for a long time, it is best to make a copy
8416
 * of it with ovsdb_datum_clone().
8417
 *
8418
 * This function is rarely useful, since it is easier to access the value
8419
 * directly through the "external_ids" member in ovsrec_controller. */
8420
const struct ovsdb_datum *
8421
ovsrec_controller_get_external_ids(const struct ovsrec_controller *row,
8422
  enum ovsdb_atomic_type key_type OVS_UNUSED,
8423
  enum ovsdb_atomic_type value_type OVS_UNUSED)
8424
0
{
8425
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8426
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
8427
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_external_ids);
8428
0
}
8429
8430
/* Returns the "inactivity_probe" column's value from the "Controller" table in 'row'
8431
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8432
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8433
 * for a given key than implementing the same operation on the "cooked"
8434
 * form in 'row'.
8435
 *
8436
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8437
 * (This helps to avoid silent bugs if someone changes inactivity_probe's
8438
 * type without updating the caller.)
8439
 *
8440
 * The caller must not modify or free the returned value.
8441
 *
8442
 * Various kinds of changes can invalidate the returned value: modifying
8443
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8444
 * If the returned value is needed for a long time, it is best to make a copy
8445
 * of it with ovsdb_datum_clone().
8446
 *
8447
 * This function is rarely useful, since it is easier to access the value
8448
 * directly through the "inactivity_probe" member in ovsrec_controller. */
8449
const struct ovsdb_datum *
8450
ovsrec_controller_get_inactivity_probe(const struct ovsrec_controller *row,
8451
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8452
0
{
8453
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8454
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_inactivity_probe);
8455
0
}
8456
8457
/* Returns the "is_connected" column's value from the "Controller" table in 'row'
8458
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8459
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8460
 * for a given key than implementing the same operation on the "cooked"
8461
 * form in 'row'.
8462
 *
8463
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
8464
 * (This helps to avoid silent bugs if someone changes is_connected's
8465
 * type without updating the caller.)
8466
 *
8467
 * The caller must not modify or free the returned value.
8468
 *
8469
 * Various kinds of changes can invalidate the returned value: modifying
8470
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8471
 * If the returned value is needed for a long time, it is best to make a copy
8472
 * of it with ovsdb_datum_clone().
8473
 *
8474
 * This function is rarely useful, since it is easier to access the value
8475
 * directly through the "is_connected" member in ovsrec_controller. */
8476
const struct ovsdb_datum *
8477
ovsrec_controller_get_is_connected(const struct ovsrec_controller *row,
8478
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8479
0
{
8480
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
8481
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_is_connected);
8482
0
}
8483
8484
/* Returns the "local_gateway" column's value from the "Controller" table in 'row'
8485
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8486
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8487
 * for a given key than implementing the same operation on the "cooked"
8488
 * form in 'row'.
8489
 *
8490
 * 'key_type' must be OVSDB_TYPE_STRING.
8491
 * (This helps to avoid silent bugs if someone changes local_gateway's
8492
 * type without updating the caller.)
8493
 *
8494
 * The caller must not modify or free the returned value.
8495
 *
8496
 * Various kinds of changes can invalidate the returned value: modifying
8497
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8498
 * If the returned value is needed for a long time, it is best to make a copy
8499
 * of it with ovsdb_datum_clone().
8500
 *
8501
 * This function is rarely useful, since it is easier to access the value
8502
 * directly through the "local_gateway" member in ovsrec_controller. */
8503
const struct ovsdb_datum *
8504
ovsrec_controller_get_local_gateway(const struct ovsrec_controller *row,
8505
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8506
0
{
8507
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8508
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_gateway);
8509
0
}
8510
8511
/* Returns the "local_ip" column's value from the "Controller" table in 'row'
8512
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8513
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8514
 * for a given key than implementing the same operation on the "cooked"
8515
 * form in 'row'.
8516
 *
8517
 * 'key_type' must be OVSDB_TYPE_STRING.
8518
 * (This helps to avoid silent bugs if someone changes local_ip's
8519
 * type without updating the caller.)
8520
 *
8521
 * The caller must not modify or free the returned value.
8522
 *
8523
 * Various kinds of changes can invalidate the returned value: modifying
8524
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8525
 * If the returned value is needed for a long time, it is best to make a copy
8526
 * of it with ovsdb_datum_clone().
8527
 *
8528
 * This function is rarely useful, since it is easier to access the value
8529
 * directly through the "local_ip" member in ovsrec_controller. */
8530
const struct ovsdb_datum *
8531
ovsrec_controller_get_local_ip(const struct ovsrec_controller *row,
8532
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8533
0
{
8534
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8535
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_ip);
8536
0
}
8537
8538
/* Returns the "local_netmask" column's value from the "Controller" table in 'row'
8539
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8540
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8541
 * for a given key than implementing the same operation on the "cooked"
8542
 * form in 'row'.
8543
 *
8544
 * 'key_type' must be OVSDB_TYPE_STRING.
8545
 * (This helps to avoid silent bugs if someone changes local_netmask's
8546
 * type without updating the caller.)
8547
 *
8548
 * The caller must not modify or free the returned value.
8549
 *
8550
 * Various kinds of changes can invalidate the returned value: modifying
8551
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8552
 * If the returned value is needed for a long time, it is best to make a copy
8553
 * of it with ovsdb_datum_clone().
8554
 *
8555
 * This function is rarely useful, since it is easier to access the value
8556
 * directly through the "local_netmask" member in ovsrec_controller. */
8557
const struct ovsdb_datum *
8558
ovsrec_controller_get_local_netmask(const struct ovsrec_controller *row,
8559
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8560
0
{
8561
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8562
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_netmask);
8563
0
}
8564
8565
/* Returns the "max_backoff" column's value from the "Controller" table in 'row'
8566
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8567
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8568
 * for a given key than implementing the same operation on the "cooked"
8569
 * form in 'row'.
8570
 *
8571
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8572
 * (This helps to avoid silent bugs if someone changes max_backoff's
8573
 * type without updating the caller.)
8574
 *
8575
 * The caller must not modify or free the returned value.
8576
 *
8577
 * Various kinds of changes can invalidate the returned value: modifying
8578
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8579
 * If the returned value is needed for a long time, it is best to make a copy
8580
 * of it with ovsdb_datum_clone().
8581
 *
8582
 * This function is rarely useful, since it is easier to access the value
8583
 * directly through the "max_backoff" member in ovsrec_controller. */
8584
const struct ovsdb_datum *
8585
ovsrec_controller_get_max_backoff(const struct ovsrec_controller *row,
8586
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8587
0
{
8588
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8589
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_max_backoff);
8590
0
}
8591
8592
/* Returns the "other_config" column's value from the "Controller" table in 'row'
8593
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8594
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8595
 * for a given key than implementing the same operation on the "cooked"
8596
 * form in 'row'.
8597
 *
8598
 * 'key_type' must be OVSDB_TYPE_STRING.
8599
 * 'value_type' must be OVSDB_TYPE_STRING.
8600
 * (This helps to avoid silent bugs if someone changes other_config's
8601
 * type without updating the caller.)
8602
 *
8603
 * The caller must not modify or free the returned value.
8604
 *
8605
 * Various kinds of changes can invalidate the returned value: modifying
8606
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8607
 * If the returned value is needed for a long time, it is best to make a copy
8608
 * of it with ovsdb_datum_clone().
8609
 *
8610
 * This function is rarely useful, since it is easier to access the value
8611
 * directly through the "other_config" member in ovsrec_controller. */
8612
const struct ovsdb_datum *
8613
ovsrec_controller_get_other_config(const struct ovsrec_controller *row,
8614
  enum ovsdb_atomic_type key_type OVS_UNUSED,
8615
  enum ovsdb_atomic_type value_type OVS_UNUSED)
8616
0
{
8617
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8618
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
8619
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_other_config);
8620
0
}
8621
8622
/* Returns the "role" column's value from the "Controller" table in 'row'
8623
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8624
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8625
 * for a given key than implementing the same operation on the "cooked"
8626
 * form in 'row'.
8627
 *
8628
 * 'key_type' must be OVSDB_TYPE_STRING.
8629
 * (This helps to avoid silent bugs if someone changes role's
8630
 * type without updating the caller.)
8631
 *
8632
 * The caller must not modify or free the returned value.
8633
 *
8634
 * Various kinds of changes can invalidate the returned value: modifying
8635
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8636
 * If the returned value is needed for a long time, it is best to make a copy
8637
 * of it with ovsdb_datum_clone().
8638
 *
8639
 * This function is rarely useful, since it is easier to access the value
8640
 * directly through the "role" member in ovsrec_controller. */
8641
const struct ovsdb_datum *
8642
ovsrec_controller_get_role(const struct ovsrec_controller *row,
8643
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8644
0
{
8645
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8646
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_role);
8647
0
}
8648
8649
/* Returns the "status" column's value from the "Controller" table in 'row'
8650
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8651
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8652
 * for a given key than implementing the same operation on the "cooked"
8653
 * form in 'row'.
8654
 *
8655
 * 'key_type' must be OVSDB_TYPE_STRING.
8656
 * 'value_type' must be OVSDB_TYPE_STRING.
8657
 * (This helps to avoid silent bugs if someone changes status's
8658
 * type without updating the caller.)
8659
 *
8660
 * The caller must not modify or free the returned value.
8661
 *
8662
 * Various kinds of changes can invalidate the returned value: modifying
8663
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8664
 * If the returned value is needed for a long time, it is best to make a copy
8665
 * of it with ovsdb_datum_clone().
8666
 *
8667
 * This function is rarely useful, since it is easier to access the value
8668
 * directly through the "status" member in ovsrec_controller. */
8669
const struct ovsdb_datum *
8670
ovsrec_controller_get_status(const struct ovsrec_controller *row,
8671
  enum ovsdb_atomic_type key_type OVS_UNUSED,
8672
  enum ovsdb_atomic_type value_type OVS_UNUSED)
8673
0
{
8674
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8675
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
8676
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_status);
8677
0
}
8678
8679
/* Returns the "target" column's value from the "Controller" table in 'row'
8680
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8681
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8682
 * for a given key than implementing the same operation on the "cooked"
8683
 * form in 'row'.
8684
 *
8685
 * 'key_type' must be OVSDB_TYPE_STRING.
8686
 * (This helps to avoid silent bugs if someone changes target's
8687
 * type without updating the caller.)
8688
 *
8689
 * The caller must not modify or free the returned value.
8690
 *
8691
 * Various kinds of changes can invalidate the returned value: modifying
8692
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8693
 * If the returned value is needed for a long time, it is best to make a copy
8694
 * of it with ovsdb_datum_clone().
8695
 *
8696
 * This function is rarely useful, since it is easier to access the value
8697
 * directly through the "target" member in ovsrec_controller. */
8698
const struct ovsdb_datum *
8699
ovsrec_controller_get_target(const struct ovsrec_controller *row,
8700
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8701
0
{
8702
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8703
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_target);
8704
0
}
8705
8706
/* Returns the "type" column's value from the "Controller" table in 'row'
8707
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
8708
 * ovsdb_datum_find_key() is an easier and more efficient way to search
8709
 * for a given key than implementing the same operation on the "cooked"
8710
 * form in 'row'.
8711
 *
8712
 * 'key_type' must be OVSDB_TYPE_STRING.
8713
 * (This helps to avoid silent bugs if someone changes type's
8714
 * type without updating the caller.)
8715
 *
8716
 * The caller must not modify or free the returned value.
8717
 *
8718
 * Various kinds of changes can invalidate the returned value: modifying
8719
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8720
 * If the returned value is needed for a long time, it is best to make a copy
8721
 * of it with ovsdb_datum_clone().
8722
 *
8723
 * This function is rarely useful, since it is easier to access the value
8724
 * directly through the "type" member in ovsrec_controller. */
8725
const struct ovsdb_datum *
8726
ovsrec_controller_get_type(const struct ovsrec_controller *row,
8727
  enum ovsdb_atomic_type key_type OVS_UNUSED)
8728
0
{
8729
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8730
0
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_type);
8731
0
}
8732
8733
/* Sets the "connection_mode" column from the "Controller" table in 'row' to
8734
 * the 'connection_mode' set.
8735
 *
8736
 * If "connection_mode" is null, the column will be the empty set,
8737
 * otherwise it will contain the specified value.
8738
 *
8739
 * Argument constraints: either "in-band" or "out-of-band"
8740
 *
8741
 * The caller retains ownership of the arguments. */
8742
void
8743
ovsrec_controller_set_connection_mode(const struct ovsrec_controller *row, const char *connection_mode)
8744
0
{
8745
0
    struct ovsdb_datum datum;
8746
8747
0
    datum.refcnt = NULL;
8748
8749
0
    if (connection_mode) {
8750
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
8751
0
        datum.n = 1;
8752
0
        datum.keys = key;
8753
0
        key->s = ovsdb_atom_string_create(connection_mode);
8754
0
    } else {
8755
0
        datum.n = 0;
8756
0
        datum.keys = NULL;
8757
0
    }
8758
0
    datum.values = NULL;
8759
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_connection_mode, &datum);
8760
0
}
8761
8762
/* Sets the "controller_burst_limit" column from the "Controller" table in 'row' to
8763
 * the 'controller_burst_limit' set with 'n_controller_burst_limit' entries.
8764
 *
8765
 * 'n_controller_burst_limit' may be 0 or 1; if it is 0, then 'controller_burst_limit'
8766
 * may be NULL.
8767
 *
8768
 * Argument constraints: at least 25
8769
 *
8770
 * The caller retains ownership of the arguments. */
8771
void
8772
ovsrec_controller_set_controller_burst_limit(const struct ovsrec_controller *row, const int64_t *controller_burst_limit, size_t n_controller_burst_limit)
8773
0
{
8774
0
    struct ovsdb_datum datum;
8775
8776
0
    datum.refcnt = NULL;
8777
8778
0
    if (n_controller_burst_limit) {
8779
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
8780
0
        datum.n = 1;
8781
0
        datum.keys = key;
8782
0
        key->integer = *controller_burst_limit;
8783
0
    } else {
8784
0
        datum.n = 0;
8785
0
        datum.keys = NULL;
8786
0
    }
8787
0
    datum.values = NULL;
8788
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_controller_burst_limit, &datum);
8789
0
}
8790
8791
/* Sets the "controller_queue_size" column from the "Controller" table in 'row' to
8792
 * the 'controller_queue_size' set with 'n_controller_queue_size' entries.
8793
 *
8794
 * 'n_controller_queue_size' may be 0 or 1; if it is 0, then 'controller_queue_size'
8795
 * may be NULL.
8796
 *
8797
 * Argument constraints: in range 1 to 512
8798
 *
8799
 * The caller retains ownership of the arguments. */
8800
void
8801
ovsrec_controller_set_controller_queue_size(const struct ovsrec_controller *row, const int64_t *controller_queue_size, size_t n_controller_queue_size)
8802
0
{
8803
0
    struct ovsdb_datum datum;
8804
8805
0
    datum.refcnt = NULL;
8806
8807
0
    if (n_controller_queue_size) {
8808
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
8809
0
        datum.n = 1;
8810
0
        datum.keys = key;
8811
0
        key->integer = *controller_queue_size;
8812
0
    } else {
8813
0
        datum.n = 0;
8814
0
        datum.keys = NULL;
8815
0
    }
8816
0
    datum.values = NULL;
8817
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_controller_queue_size, &datum);
8818
0
}
8819
8820
/* Sets the "controller_rate_limit" column from the "Controller" table in 'row' to
8821
 * the 'controller_rate_limit' set with 'n_controller_rate_limit' entries.
8822
 *
8823
 * 'n_controller_rate_limit' may be 0 or 1; if it is 0, then 'controller_rate_limit'
8824
 * may be NULL.
8825
 *
8826
 * Argument constraints: at least 100
8827
 *
8828
 * The caller retains ownership of the arguments. */
8829
void
8830
ovsrec_controller_set_controller_rate_limit(const struct ovsrec_controller *row, const int64_t *controller_rate_limit, size_t n_controller_rate_limit)
8831
0
{
8832
0
    struct ovsdb_datum datum;
8833
8834
0
    datum.refcnt = NULL;
8835
8836
0
    if (n_controller_rate_limit) {
8837
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
8838
0
        datum.n = 1;
8839
0
        datum.keys = key;
8840
0
        key->integer = *controller_rate_limit;
8841
0
    } else {
8842
0
        datum.n = 0;
8843
0
        datum.keys = NULL;
8844
0
    }
8845
0
    datum.values = NULL;
8846
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_controller_rate_limit, &datum);
8847
0
}
8848
8849
/* Sets the "enable_async_messages" column from the "Controller" table in 'row' to
8850
 * the 'enable_async_messages' set with 'n_enable_async_messages' entries.
8851
 *
8852
 * 'n_enable_async_messages' may be 0 or 1; if it is 0, then 'enable_async_messages'
8853
 * may be NULL.
8854
 *
8855
 * The caller retains ownership of the arguments. */
8856
void
8857
ovsrec_controller_set_enable_async_messages(const struct ovsrec_controller *row, const bool *enable_async_messages, size_t n_enable_async_messages)
8858
0
{
8859
0
    struct ovsdb_datum datum;
8860
8861
0
    datum.refcnt = NULL;
8862
8863
0
    if (n_enable_async_messages) {
8864
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
8865
0
        datum.n = 1;
8866
0
        datum.keys = key;
8867
0
        key->boolean = *enable_async_messages;
8868
0
    } else {
8869
0
        datum.n = 0;
8870
0
        datum.keys = NULL;
8871
0
    }
8872
0
    datum.values = NULL;
8873
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_enable_async_messages, &datum);
8874
0
}
8875
8876
/* Sets the "external_ids" column's value from the "Controller" table in 'row'
8877
 * to 'external_ids'.
8878
 *
8879
 * The caller retains ownership of 'external_ids' and everything in it. */
8880
void
8881
ovsrec_controller_set_external_ids(const struct ovsrec_controller *row, const struct smap *external_ids)
8882
0
{
8883
0
    struct ovsdb_datum datum;
8884
8885
0
    if (external_ids) {
8886
0
        ovsdb_datum_from_smap(&datum, external_ids);
8887
0
    } else {
8888
0
        ovsdb_datum_init_empty(&datum);
8889
0
    }
8890
0
    ovsdb_idl_txn_write(&row->header_,
8891
0
                        &ovsrec_controller_col_external_ids,
8892
0
                        &datum);
8893
0
}
8894
8895
8896
/* Sets the "inactivity_probe" column from the "Controller" table in 'row' to
8897
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
8898
 *
8899
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
8900
 * may be NULL.
8901
 *
8902
 * The caller retains ownership of the arguments. */
8903
void
8904
ovsrec_controller_set_inactivity_probe(const struct ovsrec_controller *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
8905
0
{
8906
0
    struct ovsdb_datum datum;
8907
8908
0
    datum.refcnt = NULL;
8909
8910
0
    if (n_inactivity_probe) {
8911
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
8912
0
        datum.n = 1;
8913
0
        datum.keys = key;
8914
0
        key->integer = *inactivity_probe;
8915
0
    } else {
8916
0
        datum.n = 0;
8917
0
        datum.keys = NULL;
8918
0
    }
8919
0
    datum.values = NULL;
8920
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_inactivity_probe, &datum);
8921
0
}
8922
8923
/* Sets the "is_connected" column from the "Controller" table in 'row' to
8924
 * 'is_connected'.
8925
 *
8926
 * The caller retains ownership of the arguments. */
8927
void
8928
ovsrec_controller_set_is_connected(const struct ovsrec_controller *row, bool is_connected)
8929
0
{
8930
0
    struct ovsdb_datum datum;
8931
8932
0
    datum.refcnt = NULL;
8933
8934
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
8935
8936
0
    datum.n = 1;
8937
0
    datum.keys = key;
8938
0
    key->boolean = is_connected;
8939
0
    datum.values = NULL;
8940
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_is_connected, &datum);
8941
0
}
8942
8943
/* Sets the "local_gateway" column from the "Controller" table in 'row' to
8944
 * the 'local_gateway' set.
8945
 *
8946
 * If "local_gateway" is null, the column will be the empty set,
8947
 * otherwise it will contain the specified value.
8948
 *
8949
 * The caller retains ownership of the arguments. */
8950
void
8951
ovsrec_controller_set_local_gateway(const struct ovsrec_controller *row, const char *local_gateway)
8952
0
{
8953
0
    struct ovsdb_datum datum;
8954
8955
0
    datum.refcnt = NULL;
8956
8957
0
    if (local_gateway) {
8958
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
8959
0
        datum.n = 1;
8960
0
        datum.keys = key;
8961
0
        key->s = ovsdb_atom_string_create(local_gateway);
8962
0
    } else {
8963
0
        datum.n = 0;
8964
0
        datum.keys = NULL;
8965
0
    }
8966
0
    datum.values = NULL;
8967
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_local_gateway, &datum);
8968
0
}
8969
8970
/* Sets the "local_ip" column from the "Controller" table in 'row' to
8971
 * the 'local_ip' set.
8972
 *
8973
 * If "local_ip" is null, the column will be the empty set,
8974
 * otherwise it will contain the specified value.
8975
 *
8976
 * The caller retains ownership of the arguments. */
8977
void
8978
ovsrec_controller_set_local_ip(const struct ovsrec_controller *row, const char *local_ip)
8979
0
{
8980
0
    struct ovsdb_datum datum;
8981
8982
0
    datum.refcnt = NULL;
8983
8984
0
    if (local_ip) {
8985
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
8986
0
        datum.n = 1;
8987
0
        datum.keys = key;
8988
0
        key->s = ovsdb_atom_string_create(local_ip);
8989
0
    } else {
8990
0
        datum.n = 0;
8991
0
        datum.keys = NULL;
8992
0
    }
8993
0
    datum.values = NULL;
8994
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_local_ip, &datum);
8995
0
}
8996
8997
/* Sets the "local_netmask" column from the "Controller" table in 'row' to
8998
 * the 'local_netmask' set.
8999
 *
9000
 * If "local_netmask" is null, the column will be the empty set,
9001
 * otherwise it will contain the specified value.
9002
 *
9003
 * The caller retains ownership of the arguments. */
9004
void
9005
ovsrec_controller_set_local_netmask(const struct ovsrec_controller *row, const char *local_netmask)
9006
0
{
9007
0
    struct ovsdb_datum datum;
9008
9009
0
    datum.refcnt = NULL;
9010
9011
0
    if (local_netmask) {
9012
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9013
0
        datum.n = 1;
9014
0
        datum.keys = key;
9015
0
        key->s = ovsdb_atom_string_create(local_netmask);
9016
0
    } else {
9017
0
        datum.n = 0;
9018
0
        datum.keys = NULL;
9019
0
    }
9020
0
    datum.values = NULL;
9021
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_local_netmask, &datum);
9022
0
}
9023
9024
/* Sets the "max_backoff" column from the "Controller" table in 'row' to
9025
 * the 'max_backoff' set with 'n_max_backoff' entries.
9026
 *
9027
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
9028
 * may be NULL.
9029
 *
9030
 * Argument constraints: at least 1,000
9031
 *
9032
 * The caller retains ownership of the arguments. */
9033
void
9034
ovsrec_controller_set_max_backoff(const struct ovsrec_controller *row, const int64_t *max_backoff, size_t n_max_backoff)
9035
0
{
9036
0
    struct ovsdb_datum datum;
9037
9038
0
    datum.refcnt = NULL;
9039
9040
0
    if (n_max_backoff) {
9041
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9042
0
        datum.n = 1;
9043
0
        datum.keys = key;
9044
0
        key->integer = *max_backoff;
9045
0
    } else {
9046
0
        datum.n = 0;
9047
0
        datum.keys = NULL;
9048
0
    }
9049
0
    datum.values = NULL;
9050
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_max_backoff, &datum);
9051
0
}
9052
9053
/* Sets the "other_config" column's value from the "Controller" table in 'row'
9054
 * to 'other_config'.
9055
 *
9056
 * The caller retains ownership of 'other_config' and everything in it. */
9057
void
9058
ovsrec_controller_set_other_config(const struct ovsrec_controller *row, const struct smap *other_config)
9059
0
{
9060
0
    struct ovsdb_datum datum;
9061
9062
0
    if (other_config) {
9063
0
        ovsdb_datum_from_smap(&datum, other_config);
9064
0
    } else {
9065
0
        ovsdb_datum_init_empty(&datum);
9066
0
    }
9067
0
    ovsdb_idl_txn_write(&row->header_,
9068
0
                        &ovsrec_controller_col_other_config,
9069
0
                        &datum);
9070
0
}
9071
9072
9073
/* Sets the "role" column from the "Controller" table in 'row' to
9074
 * the 'role' set.
9075
 *
9076
 * If "role" is null, the column will be the empty set,
9077
 * otherwise it will contain the specified value.
9078
 *
9079
 * Argument constraints: one of "master", "other", or "slave"
9080
 *
9081
 * The caller retains ownership of the arguments. */
9082
void
9083
ovsrec_controller_set_role(const struct ovsrec_controller *row, const char *role)
9084
0
{
9085
0
    struct ovsdb_datum datum;
9086
9087
0
    datum.refcnt = NULL;
9088
9089
0
    if (role) {
9090
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9091
0
        datum.n = 1;
9092
0
        datum.keys = key;
9093
0
        key->s = ovsdb_atom_string_create(role);
9094
0
    } else {
9095
0
        datum.n = 0;
9096
0
        datum.keys = NULL;
9097
0
    }
9098
0
    datum.values = NULL;
9099
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_role, &datum);
9100
0
}
9101
9102
/* Sets the "status" column's value from the "Controller" table in 'row'
9103
 * to 'status'.
9104
 *
9105
 * The caller retains ownership of 'status' and everything in it. */
9106
void
9107
ovsrec_controller_set_status(const struct ovsrec_controller *row, const struct smap *status)
9108
0
{
9109
0
    struct ovsdb_datum datum;
9110
9111
0
    if (status) {
9112
0
        ovsdb_datum_from_smap(&datum, status);
9113
0
    } else {
9114
0
        ovsdb_datum_init_empty(&datum);
9115
0
    }
9116
0
    ovsdb_idl_txn_write(&row->header_,
9117
0
                        &ovsrec_controller_col_status,
9118
0
                        &datum);
9119
0
}
9120
9121
9122
/* Sets the "target" column from the "Controller" table in 'row' to
9123
 * 'target'.
9124
 *
9125
 * The caller retains ownership of the arguments. */
9126
void
9127
ovsrec_controller_set_target(const struct ovsrec_controller *row, const char *target)
9128
0
{
9129
0
    struct ovsdb_datum datum;
9130
9131
0
    datum.refcnt = NULL;
9132
9133
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
9134
9135
0
    datum.n = 1;
9136
0
    datum.keys = key;
9137
0
    key->s = ovsdb_atom_string_create(target);
9138
0
    datum.values = NULL;
9139
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_target, &datum);
9140
0
}
9141
9142
/* Sets the "type" column from the "Controller" table in 'row' to
9143
 * the 'type' set.
9144
 *
9145
 * If "type" is null, the column will be the empty set,
9146
 * otherwise it will contain the specified value.
9147
 *
9148
 * Argument constraints: either "primary" or "service"
9149
 *
9150
 * The caller retains ownership of the arguments. */
9151
void
9152
ovsrec_controller_set_type(const struct ovsrec_controller *row, const char *type)
9153
0
{
9154
0
    struct ovsdb_datum datum;
9155
9156
0
    datum.refcnt = NULL;
9157
9158
0
    if (type) {
9159
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9160
0
        datum.n = 1;
9161
0
        datum.keys = key;
9162
0
        key->s = ovsdb_atom_string_create(type);
9163
0
    } else {
9164
0
        datum.n = 0;
9165
0
        datum.keys = NULL;
9166
0
    }
9167
0
    datum.values = NULL;
9168
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_controller_col_type, &datum);
9169
0
}
9170
9171
/* Adds the value 'new_value' to the "connection_mode" set column from the "Controller" table
9172
 * in 'row'.
9173
 *
9174
 */
9175
void
9176
ovsrec_controller_update_connection_mode_addvalue(const struct ovsrec_controller *row, const char *new_value)
9177
0
{
9178
0
    struct ovsdb_datum *datum;
9179
9180
0
    datum = xmalloc(sizeof *datum);
9181
0
    datum->n = 1;
9182
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9183
0
    datum->values = NULL;
9184
0
    datum->refcnt = NULL;
9185
9186
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
9187
9188
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9189
0
                                    &ovsrec_controller_col_connection_mode,
9190
0
                                    datum);
9191
0
}
9192
9193
/* Deletes the value 'delete_value' from the "connection_mode" set column from the
9194
 * "Controller" table in 'row'.
9195
 *
9196
 */
9197
void
9198
ovsrec_controller_update_connection_mode_delvalue(const struct ovsrec_controller *row, const char *delete_value)
9199
0
{
9200
0
    struct ovsdb_datum *datum;
9201
9202
0
    datum = xmalloc(sizeof *datum);
9203
0
    datum->n = 1;
9204
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9205
0
    datum->values = NULL;
9206
0
    datum->refcnt = NULL;
9207
9208
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
9209
9210
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9211
0
                                    &ovsrec_controller_col_connection_mode,
9212
0
                                    datum);
9213
0
}
9214
9215
/* Adds the value 'new_value' to the "controller_burst_limit" set column from the "Controller" table
9216
 * in 'row'.
9217
 *
9218
 */
9219
void
9220
ovsrec_controller_update_controller_burst_limit_addvalue(const struct ovsrec_controller *row, int64_t new_value)
9221
0
{
9222
0
    struct ovsdb_datum *datum;
9223
9224
0
    datum = xmalloc(sizeof *datum);
9225
0
    datum->n = 1;
9226
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9227
0
    datum->values = NULL;
9228
0
    datum->refcnt = NULL;
9229
9230
0
    datum->keys[0].integer = new_value;
9231
9232
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9233
0
                                    &ovsrec_controller_col_controller_burst_limit,
9234
0
                                    datum);
9235
0
}
9236
9237
/* Deletes the value 'delete_value' from the "controller_burst_limit" set column from the
9238
 * "Controller" table in 'row'.
9239
 *
9240
 */
9241
void
9242
ovsrec_controller_update_controller_burst_limit_delvalue(const struct ovsrec_controller *row, int64_t delete_value)
9243
0
{
9244
0
    struct ovsdb_datum *datum;
9245
9246
0
    datum = xmalloc(sizeof *datum);
9247
0
    datum->n = 1;
9248
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9249
0
    datum->values = NULL;
9250
0
    datum->refcnt = NULL;
9251
9252
0
    datum->keys[0].integer = delete_value;
9253
9254
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9255
0
                                    &ovsrec_controller_col_controller_burst_limit,
9256
0
                                    datum);
9257
0
}
9258
9259
/* Adds the value 'new_value' to the "controller_queue_size" set column from the "Controller" table
9260
 * in 'row'.
9261
 *
9262
 */
9263
void
9264
ovsrec_controller_update_controller_queue_size_addvalue(const struct ovsrec_controller *row, int64_t new_value)
9265
0
{
9266
0
    struct ovsdb_datum *datum;
9267
9268
0
    datum = xmalloc(sizeof *datum);
9269
0
    datum->n = 1;
9270
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9271
0
    datum->values = NULL;
9272
0
    datum->refcnt = NULL;
9273
9274
0
    datum->keys[0].integer = new_value;
9275
9276
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9277
0
                                    &ovsrec_controller_col_controller_queue_size,
9278
0
                                    datum);
9279
0
}
9280
9281
/* Deletes the value 'delete_value' from the "controller_queue_size" set column from the
9282
 * "Controller" table in 'row'.
9283
 *
9284
 */
9285
void
9286
ovsrec_controller_update_controller_queue_size_delvalue(const struct ovsrec_controller *row, int64_t delete_value)
9287
0
{
9288
0
    struct ovsdb_datum *datum;
9289
9290
0
    datum = xmalloc(sizeof *datum);
9291
0
    datum->n = 1;
9292
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9293
0
    datum->values = NULL;
9294
0
    datum->refcnt = NULL;
9295
9296
0
    datum->keys[0].integer = delete_value;
9297
9298
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9299
0
                                    &ovsrec_controller_col_controller_queue_size,
9300
0
                                    datum);
9301
0
}
9302
9303
/* Adds the value 'new_value' to the "controller_rate_limit" set column from the "Controller" table
9304
 * in 'row'.
9305
 *
9306
 */
9307
void
9308
ovsrec_controller_update_controller_rate_limit_addvalue(const struct ovsrec_controller *row, int64_t new_value)
9309
0
{
9310
0
    struct ovsdb_datum *datum;
9311
9312
0
    datum = xmalloc(sizeof *datum);
9313
0
    datum->n = 1;
9314
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9315
0
    datum->values = NULL;
9316
0
    datum->refcnt = NULL;
9317
9318
0
    datum->keys[0].integer = new_value;
9319
9320
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9321
0
                                    &ovsrec_controller_col_controller_rate_limit,
9322
0
                                    datum);
9323
0
}
9324
9325
/* Deletes the value 'delete_value' from the "controller_rate_limit" set column from the
9326
 * "Controller" table in 'row'.
9327
 *
9328
 */
9329
void
9330
ovsrec_controller_update_controller_rate_limit_delvalue(const struct ovsrec_controller *row, int64_t delete_value)
9331
0
{
9332
0
    struct ovsdb_datum *datum;
9333
9334
0
    datum = xmalloc(sizeof *datum);
9335
0
    datum->n = 1;
9336
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9337
0
    datum->values = NULL;
9338
0
    datum->refcnt = NULL;
9339
9340
0
    datum->keys[0].integer = delete_value;
9341
9342
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9343
0
                                    &ovsrec_controller_col_controller_rate_limit,
9344
0
                                    datum);
9345
0
}
9346
9347
/* Adds the value 'new_value' to the "enable_async_messages" set column from the "Controller" table
9348
 * in 'row'.
9349
 *
9350
 */
9351
void
9352
ovsrec_controller_update_enable_async_messages_addvalue(const struct ovsrec_controller *row, bool new_value)
9353
0
{
9354
0
    struct ovsdb_datum *datum;
9355
9356
0
    datum = xmalloc(sizeof *datum);
9357
0
    datum->n = 1;
9358
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9359
0
    datum->values = NULL;
9360
0
    datum->refcnt = NULL;
9361
9362
0
    datum->keys[0].boolean = new_value;
9363
9364
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9365
0
                                    &ovsrec_controller_col_enable_async_messages,
9366
0
                                    datum);
9367
0
}
9368
9369
/* Deletes the value 'delete_value' from the "enable_async_messages" set column from the
9370
 * "Controller" table in 'row'.
9371
 *
9372
 */
9373
void
9374
ovsrec_controller_update_enable_async_messages_delvalue(const struct ovsrec_controller *row, bool delete_value)
9375
0
{
9376
0
    struct ovsdb_datum *datum;
9377
9378
0
    datum = xmalloc(sizeof *datum);
9379
0
    datum->n = 1;
9380
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9381
0
    datum->values = NULL;
9382
0
    datum->refcnt = NULL;
9383
9384
0
    datum->keys[0].boolean = delete_value;
9385
9386
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9387
0
                                    &ovsrec_controller_col_enable_async_messages,
9388
0
                                    datum);
9389
0
}
9390
9391
/* Sets an element of the "external_ids" map column from the "Controller" table in 'row'
9392
 * to 'new_value' given the key value 'new_key'.
9393
 *
9394
 */
9395
void
9396
ovsrec_controller_update_external_ids_setkey(const struct ovsrec_controller *row, const char *new_key, const char *new_value)
9397
0
{
9398
0
    struct ovsdb_datum *datum;
9399
9400
0
    datum = xmalloc(sizeof *datum);
9401
0
    datum->n = 1;
9402
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
9403
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
9404
0
    datum->refcnt = NULL;
9405
9406
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
9407
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
9408
9409
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
9410
0
                                    &ovsrec_controller_col_external_ids,
9411
0
                                    datum);
9412
0
}
9413
9414
/* Deletes an element of the "external_ids" map column from the "Controller" table in 'row'
9415
 * given the key value 'delete_key'.
9416
 *
9417
 */
9418
void
9419
ovsrec_controller_update_external_ids_delkey(const struct ovsrec_controller *row, const char *delete_key)
9420
0
{
9421
0
    struct ovsdb_datum *datum;
9422
9423
0
    datum = xmalloc(sizeof *datum);
9424
0
    datum->n = 1;
9425
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
9426
0
    datum->values = NULL;
9427
0
    datum->refcnt = NULL;
9428
9429
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
9430
9431
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
9432
0
                                    &ovsrec_controller_col_external_ids,
9433
0
                                    datum);
9434
0
}
9435
9436
/* Adds the value 'new_value' to the "inactivity_probe" set column from the "Controller" table
9437
 * in 'row'.
9438
 *
9439
 */
9440
void
9441
ovsrec_controller_update_inactivity_probe_addvalue(const struct ovsrec_controller *row, int64_t new_value)
9442
0
{
9443
0
    struct ovsdb_datum *datum;
9444
9445
0
    datum = xmalloc(sizeof *datum);
9446
0
    datum->n = 1;
9447
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9448
0
    datum->values = NULL;
9449
0
    datum->refcnt = NULL;
9450
9451
0
    datum->keys[0].integer = new_value;
9452
9453
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9454
0
                                    &ovsrec_controller_col_inactivity_probe,
9455
0
                                    datum);
9456
0
}
9457
9458
/* Deletes the value 'delete_value' from the "inactivity_probe" set column from the
9459
 * "Controller" table in 'row'.
9460
 *
9461
 */
9462
void
9463
ovsrec_controller_update_inactivity_probe_delvalue(const struct ovsrec_controller *row, int64_t delete_value)
9464
0
{
9465
0
    struct ovsdb_datum *datum;
9466
9467
0
    datum = xmalloc(sizeof *datum);
9468
0
    datum->n = 1;
9469
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9470
0
    datum->values = NULL;
9471
0
    datum->refcnt = NULL;
9472
9473
0
    datum->keys[0].integer = delete_value;
9474
9475
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9476
0
                                    &ovsrec_controller_col_inactivity_probe,
9477
0
                                    datum);
9478
0
}
9479
9480
/* Adds the value 'new_value' to the "local_gateway" set column from the "Controller" table
9481
 * in 'row'.
9482
 *
9483
 */
9484
void
9485
ovsrec_controller_update_local_gateway_addvalue(const struct ovsrec_controller *row, const char *new_value)
9486
0
{
9487
0
    struct ovsdb_datum *datum;
9488
9489
0
    datum = xmalloc(sizeof *datum);
9490
0
    datum->n = 1;
9491
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9492
0
    datum->values = NULL;
9493
0
    datum->refcnt = NULL;
9494
9495
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
9496
9497
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9498
0
                                    &ovsrec_controller_col_local_gateway,
9499
0
                                    datum);
9500
0
}
9501
9502
/* Deletes the value 'delete_value' from the "local_gateway" set column from the
9503
 * "Controller" table in 'row'.
9504
 *
9505
 */
9506
void
9507
ovsrec_controller_update_local_gateway_delvalue(const struct ovsrec_controller *row, const char *delete_value)
9508
0
{
9509
0
    struct ovsdb_datum *datum;
9510
9511
0
    datum = xmalloc(sizeof *datum);
9512
0
    datum->n = 1;
9513
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9514
0
    datum->values = NULL;
9515
0
    datum->refcnt = NULL;
9516
9517
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
9518
9519
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9520
0
                                    &ovsrec_controller_col_local_gateway,
9521
0
                                    datum);
9522
0
}
9523
9524
/* Adds the value 'new_value' to the "local_ip" set column from the "Controller" table
9525
 * in 'row'.
9526
 *
9527
 */
9528
void
9529
ovsrec_controller_update_local_ip_addvalue(const struct ovsrec_controller *row, const char *new_value)
9530
0
{
9531
0
    struct ovsdb_datum *datum;
9532
9533
0
    datum = xmalloc(sizeof *datum);
9534
0
    datum->n = 1;
9535
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9536
0
    datum->values = NULL;
9537
0
    datum->refcnt = NULL;
9538
9539
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
9540
9541
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9542
0
                                    &ovsrec_controller_col_local_ip,
9543
0
                                    datum);
9544
0
}
9545
9546
/* Deletes the value 'delete_value' from the "local_ip" set column from the
9547
 * "Controller" table in 'row'.
9548
 *
9549
 */
9550
void
9551
ovsrec_controller_update_local_ip_delvalue(const struct ovsrec_controller *row, const char *delete_value)
9552
0
{
9553
0
    struct ovsdb_datum *datum;
9554
9555
0
    datum = xmalloc(sizeof *datum);
9556
0
    datum->n = 1;
9557
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9558
0
    datum->values = NULL;
9559
0
    datum->refcnt = NULL;
9560
9561
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
9562
9563
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9564
0
                                    &ovsrec_controller_col_local_ip,
9565
0
                                    datum);
9566
0
}
9567
9568
/* Adds the value 'new_value' to the "local_netmask" set column from the "Controller" table
9569
 * in 'row'.
9570
 *
9571
 */
9572
void
9573
ovsrec_controller_update_local_netmask_addvalue(const struct ovsrec_controller *row, const char *new_value)
9574
0
{
9575
0
    struct ovsdb_datum *datum;
9576
9577
0
    datum = xmalloc(sizeof *datum);
9578
0
    datum->n = 1;
9579
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9580
0
    datum->values = NULL;
9581
0
    datum->refcnt = NULL;
9582
9583
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
9584
9585
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9586
0
                                    &ovsrec_controller_col_local_netmask,
9587
0
                                    datum);
9588
0
}
9589
9590
/* Deletes the value 'delete_value' from the "local_netmask" set column from the
9591
 * "Controller" table in 'row'.
9592
 *
9593
 */
9594
void
9595
ovsrec_controller_update_local_netmask_delvalue(const struct ovsrec_controller *row, const char *delete_value)
9596
0
{
9597
0
    struct ovsdb_datum *datum;
9598
9599
0
    datum = xmalloc(sizeof *datum);
9600
0
    datum->n = 1;
9601
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9602
0
    datum->values = NULL;
9603
0
    datum->refcnt = NULL;
9604
9605
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
9606
9607
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9608
0
                                    &ovsrec_controller_col_local_netmask,
9609
0
                                    datum);
9610
0
}
9611
9612
/* Adds the value 'new_value' to the "max_backoff" set column from the "Controller" table
9613
 * in 'row'.
9614
 *
9615
 */
9616
void
9617
ovsrec_controller_update_max_backoff_addvalue(const struct ovsrec_controller *row, int64_t new_value)
9618
0
{
9619
0
    struct ovsdb_datum *datum;
9620
9621
0
    datum = xmalloc(sizeof *datum);
9622
0
    datum->n = 1;
9623
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9624
0
    datum->values = NULL;
9625
0
    datum->refcnt = NULL;
9626
9627
0
    datum->keys[0].integer = new_value;
9628
9629
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9630
0
                                    &ovsrec_controller_col_max_backoff,
9631
0
                                    datum);
9632
0
}
9633
9634
/* Deletes the value 'delete_value' from the "max_backoff" set column from the
9635
 * "Controller" table in 'row'.
9636
 *
9637
 */
9638
void
9639
ovsrec_controller_update_max_backoff_delvalue(const struct ovsrec_controller *row, int64_t delete_value)
9640
0
{
9641
0
    struct ovsdb_datum *datum;
9642
9643
0
    datum = xmalloc(sizeof *datum);
9644
0
    datum->n = 1;
9645
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9646
0
    datum->values = NULL;
9647
0
    datum->refcnt = NULL;
9648
9649
0
    datum->keys[0].integer = delete_value;
9650
9651
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9652
0
                                    &ovsrec_controller_col_max_backoff,
9653
0
                                    datum);
9654
0
}
9655
9656
/* Sets an element of the "other_config" map column from the "Controller" table in 'row'
9657
 * to 'new_value' given the key value 'new_key'.
9658
 *
9659
 */
9660
void
9661
ovsrec_controller_update_other_config_setkey(const struct ovsrec_controller *row, const char *new_key, const char *new_value)
9662
0
{
9663
0
    struct ovsdb_datum *datum;
9664
9665
0
    datum = xmalloc(sizeof *datum);
9666
0
    datum->n = 1;
9667
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
9668
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
9669
0
    datum->refcnt = NULL;
9670
9671
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
9672
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
9673
9674
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
9675
0
                                    &ovsrec_controller_col_other_config,
9676
0
                                    datum);
9677
0
}
9678
9679
/* Deletes an element of the "other_config" map column from the "Controller" table in 'row'
9680
 * given the key value 'delete_key'.
9681
 *
9682
 */
9683
void
9684
ovsrec_controller_update_other_config_delkey(const struct ovsrec_controller *row, const char *delete_key)
9685
0
{
9686
0
    struct ovsdb_datum *datum;
9687
9688
0
    datum = xmalloc(sizeof *datum);
9689
0
    datum->n = 1;
9690
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
9691
0
    datum->values = NULL;
9692
0
    datum->refcnt = NULL;
9693
9694
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
9695
9696
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
9697
0
                                    &ovsrec_controller_col_other_config,
9698
0
                                    datum);
9699
0
}
9700
9701
/* Adds the value 'new_value' to the "role" set column from the "Controller" table
9702
 * in 'row'.
9703
 *
9704
 */
9705
void
9706
ovsrec_controller_update_role_addvalue(const struct ovsrec_controller *row, const char *new_value)
9707
0
{
9708
0
    struct ovsdb_datum *datum;
9709
9710
0
    datum = xmalloc(sizeof *datum);
9711
0
    datum->n = 1;
9712
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9713
0
    datum->values = NULL;
9714
0
    datum->refcnt = NULL;
9715
9716
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
9717
9718
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9719
0
                                    &ovsrec_controller_col_role,
9720
0
                                    datum);
9721
0
}
9722
9723
/* Deletes the value 'delete_value' from the "role" set column from the
9724
 * "Controller" table in 'row'.
9725
 *
9726
 */
9727
void
9728
ovsrec_controller_update_role_delvalue(const struct ovsrec_controller *row, const char *delete_value)
9729
0
{
9730
0
    struct ovsdb_datum *datum;
9731
9732
0
    datum = xmalloc(sizeof *datum);
9733
0
    datum->n = 1;
9734
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9735
0
    datum->values = NULL;
9736
0
    datum->refcnt = NULL;
9737
9738
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
9739
9740
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9741
0
                                    &ovsrec_controller_col_role,
9742
0
                                    datum);
9743
0
}
9744
9745
/* Sets an element of the "status" map column from the "Controller" table in 'row'
9746
 * to 'new_value' given the key value 'new_key'.
9747
 *
9748
 */
9749
void
9750
ovsrec_controller_update_status_setkey(const struct ovsrec_controller *row, const char *new_key, const char *new_value)
9751
0
{
9752
0
    struct ovsdb_datum *datum;
9753
9754
0
    datum = xmalloc(sizeof *datum);
9755
0
    datum->n = 1;
9756
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
9757
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
9758
0
    datum->refcnt = NULL;
9759
9760
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
9761
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
9762
9763
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
9764
0
                                    &ovsrec_controller_col_status,
9765
0
                                    datum);
9766
0
}
9767
9768
/* Deletes an element of the "status" map column from the "Controller" table in 'row'
9769
 * given the key value 'delete_key'.
9770
 *
9771
 */
9772
void
9773
ovsrec_controller_update_status_delkey(const struct ovsrec_controller *row, const char *delete_key)
9774
0
{
9775
0
    struct ovsdb_datum *datum;
9776
9777
0
    datum = xmalloc(sizeof *datum);
9778
0
    datum->n = 1;
9779
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
9780
0
    datum->values = NULL;
9781
0
    datum->refcnt = NULL;
9782
9783
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
9784
9785
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
9786
0
                                    &ovsrec_controller_col_status,
9787
0
                                    datum);
9788
0
}
9789
9790
/* Adds the value 'new_value' to the "type" set column from the "Controller" table
9791
 * in 'row'.
9792
 *
9793
 */
9794
void
9795
ovsrec_controller_update_type_addvalue(const struct ovsrec_controller *row, const char *new_value)
9796
0
{
9797
0
    struct ovsdb_datum *datum;
9798
9799
0
    datum = xmalloc(sizeof *datum);
9800
0
    datum->n = 1;
9801
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9802
0
    datum->values = NULL;
9803
0
    datum->refcnt = NULL;
9804
9805
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
9806
9807
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
9808
0
                                    &ovsrec_controller_col_type,
9809
0
                                    datum);
9810
0
}
9811
9812
/* Deletes the value 'delete_value' from the "type" set column from the
9813
 * "Controller" table in 'row'.
9814
 *
9815
 */
9816
void
9817
ovsrec_controller_update_type_delvalue(const struct ovsrec_controller *row, const char *delete_value)
9818
0
{
9819
0
    struct ovsdb_datum *datum;
9820
9821
0
    datum = xmalloc(sizeof *datum);
9822
0
    datum->n = 1;
9823
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
9824
0
    datum->values = NULL;
9825
0
    datum->refcnt = NULL;
9826
9827
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
9828
9829
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
9830
0
                                    &ovsrec_controller_col_type,
9831
0
                                    datum);
9832
0
}
9833
9834
/* Sets the "connection_mode" column from the "Controller" table in 'row' to
9835
 * the 'connection_mode' set.
9836
 *
9837
 * If "connection_mode" is null, the column will be the empty set,
9838
 * otherwise it will contain the specified value.
9839
 *
9840
 * Argument constraints: either "in-band" or "out-of-band"
9841
 *
9842
 * The caller retains ownership of the arguments. */
9843
void
9844
ovsrec_controller_add_clause_connection_mode(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *connection_mode)
9845
0
{
9846
0
    struct ovsdb_datum datum;
9847
9848
0
    datum.refcnt = NULL;
9849
9850
0
    if (connection_mode) {
9851
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9852
0
        datum.n = 1;
9853
0
        datum.keys = key;
9854
0
        key->s = ovsdb_atom_string_create(connection_mode);
9855
0
    } else {
9856
0
        datum.n = 0;
9857
0
        datum.keys = NULL;
9858
0
    }
9859
0
    datum.values = NULL;
9860
0
    ovsdb_idl_condition_add_clause(cond,
9861
0
                          function,
9862
0
                          &ovsrec_controller_col_connection_mode,
9863
0
                          &datum);
9864
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_connection_mode.type);
9865
0
}
9866
9867
/* Sets the "controller_burst_limit" column from the "Controller" table in 'row' to
9868
 * the 'controller_burst_limit' set with 'n_controller_burst_limit' entries.
9869
 *
9870
 * 'n_controller_burst_limit' may be 0 or 1; if it is 0, then 'controller_burst_limit'
9871
 * may be NULL.
9872
 *
9873
 * Argument constraints: at least 25
9874
 *
9875
 * The caller retains ownership of the arguments. */
9876
void
9877
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)
9878
0
{
9879
0
    struct ovsdb_datum datum;
9880
9881
0
    datum.refcnt = NULL;
9882
9883
0
    if (n_controller_burst_limit) {
9884
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9885
0
        datum.n = 1;
9886
0
        datum.keys = key;
9887
0
        key->integer = *controller_burst_limit;
9888
0
    } else {
9889
0
        datum.n = 0;
9890
0
        datum.keys = NULL;
9891
0
    }
9892
0
    datum.values = NULL;
9893
0
    ovsdb_idl_condition_add_clause(cond,
9894
0
                          function,
9895
0
                          &ovsrec_controller_col_controller_burst_limit,
9896
0
                          &datum);
9897
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_controller_burst_limit.type);
9898
0
}
9899
9900
/* Sets the "controller_queue_size" column from the "Controller" table in 'row' to
9901
 * the 'controller_queue_size' set with 'n_controller_queue_size' entries.
9902
 *
9903
 * 'n_controller_queue_size' may be 0 or 1; if it is 0, then 'controller_queue_size'
9904
 * may be NULL.
9905
 *
9906
 * Argument constraints: in range 1 to 512
9907
 *
9908
 * The caller retains ownership of the arguments. */
9909
void
9910
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)
9911
0
{
9912
0
    struct ovsdb_datum datum;
9913
9914
0
    datum.refcnt = NULL;
9915
9916
0
    if (n_controller_queue_size) {
9917
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9918
0
        datum.n = 1;
9919
0
        datum.keys = key;
9920
0
        key->integer = *controller_queue_size;
9921
0
    } else {
9922
0
        datum.n = 0;
9923
0
        datum.keys = NULL;
9924
0
    }
9925
0
    datum.values = NULL;
9926
0
    ovsdb_idl_condition_add_clause(cond,
9927
0
                          function,
9928
0
                          &ovsrec_controller_col_controller_queue_size,
9929
0
                          &datum);
9930
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_controller_queue_size.type);
9931
0
}
9932
9933
/* Sets the "controller_rate_limit" column from the "Controller" table in 'row' to
9934
 * the 'controller_rate_limit' set with 'n_controller_rate_limit' entries.
9935
 *
9936
 * 'n_controller_rate_limit' may be 0 or 1; if it is 0, then 'controller_rate_limit'
9937
 * may be NULL.
9938
 *
9939
 * Argument constraints: at least 100
9940
 *
9941
 * The caller retains ownership of the arguments. */
9942
void
9943
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)
9944
0
{
9945
0
    struct ovsdb_datum datum;
9946
9947
0
    datum.refcnt = NULL;
9948
9949
0
    if (n_controller_rate_limit) {
9950
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9951
0
        datum.n = 1;
9952
0
        datum.keys = key;
9953
0
        key->integer = *controller_rate_limit;
9954
0
    } else {
9955
0
        datum.n = 0;
9956
0
        datum.keys = NULL;
9957
0
    }
9958
0
    datum.values = NULL;
9959
0
    ovsdb_idl_condition_add_clause(cond,
9960
0
                          function,
9961
0
                          &ovsrec_controller_col_controller_rate_limit,
9962
0
                          &datum);
9963
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_controller_rate_limit.type);
9964
0
}
9965
9966
/* Sets the "enable_async_messages" column from the "Controller" table in 'row' to
9967
 * the 'enable_async_messages' set with 'n_enable_async_messages' entries.
9968
 *
9969
 * 'n_enable_async_messages' may be 0 or 1; if it is 0, then 'enable_async_messages'
9970
 * may be NULL.
9971
 *
9972
 * The caller retains ownership of the arguments. */
9973
void
9974
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)
9975
0
{
9976
0
    struct ovsdb_datum datum;
9977
9978
0
    datum.refcnt = NULL;
9979
9980
0
    if (n_enable_async_messages) {
9981
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
9982
0
        datum.n = 1;
9983
0
        datum.keys = key;
9984
0
        key->boolean = *enable_async_messages;
9985
0
    } else {
9986
0
        datum.n = 0;
9987
0
        datum.keys = NULL;
9988
0
    }
9989
0
    datum.values = NULL;
9990
0
    ovsdb_idl_condition_add_clause(cond,
9991
0
                          function,
9992
0
                          &ovsrec_controller_col_enable_async_messages,
9993
0
                          &datum);
9994
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_enable_async_messages.type);
9995
0
}
9996
9997
/* Sets the "external_ids" column's value from the "Controller" table in 'row'
9998
 * to 'external_ids'.
9999
 *
10000
 * The caller retains ownership of 'external_ids' and everything in it. */
10001
void
10002
ovsrec_controller_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
10003
0
{
10004
0
    struct ovsdb_datum datum;
10005
10006
0
    if (external_ids) {
10007
0
        ovsdb_datum_from_smap(&datum, external_ids);
10008
0
    } else {
10009
0
        ovsdb_datum_init_empty(&datum);
10010
0
    }
10011
10012
0
    ovsdb_idl_condition_add_clause(cond,
10013
0
                                   function,
10014
0
                                   &ovsrec_controller_col_external_ids,
10015
0
                                   &datum);
10016
10017
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_external_ids.type);
10018
0
}
10019
10020
10021
/* Sets the "inactivity_probe" column from the "Controller" table in 'row' to
10022
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
10023
 *
10024
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
10025
 * may be NULL.
10026
 *
10027
 * The caller retains ownership of the arguments. */
10028
void
10029
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)
10030
0
{
10031
0
    struct ovsdb_datum datum;
10032
10033
0
    datum.refcnt = NULL;
10034
10035
0
    if (n_inactivity_probe) {
10036
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10037
0
        datum.n = 1;
10038
0
        datum.keys = key;
10039
0
        key->integer = *inactivity_probe;
10040
0
    } else {
10041
0
        datum.n = 0;
10042
0
        datum.keys = NULL;
10043
0
    }
10044
0
    datum.values = NULL;
10045
0
    ovsdb_idl_condition_add_clause(cond,
10046
0
                          function,
10047
0
                          &ovsrec_controller_col_inactivity_probe,
10048
0
                          &datum);
10049
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_inactivity_probe.type);
10050
0
}
10051
10052
/* Sets the "is_connected" column from the "Controller" table in 'row' to
10053
 * 'is_connected'.
10054
 *
10055
 * The caller retains ownership of the arguments. */
10056
void
10057
ovsrec_controller_add_clause_is_connected(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool is_connected)
10058
0
{
10059
0
    struct ovsdb_datum datum;
10060
10061
0
    datum.refcnt = NULL;
10062
10063
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
10064
10065
0
    datum.n = 1;
10066
0
    datum.keys = key;
10067
0
    key->boolean = is_connected;
10068
0
    datum.values = NULL;
10069
0
    ovsdb_idl_condition_add_clause(cond,
10070
0
                          function,
10071
0
                          &ovsrec_controller_col_is_connected,
10072
0
                          &datum);
10073
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_is_connected.type);
10074
0
}
10075
10076
/* Sets the "local_gateway" column from the "Controller" table in 'row' to
10077
 * the 'local_gateway' set.
10078
 *
10079
 * If "local_gateway" is null, the column will be the empty set,
10080
 * otherwise it will contain the specified value.
10081
 *
10082
 * The caller retains ownership of the arguments. */
10083
void
10084
ovsrec_controller_add_clause_local_gateway(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *local_gateway)
10085
0
{
10086
0
    struct ovsdb_datum datum;
10087
10088
0
    datum.refcnt = NULL;
10089
10090
0
    if (local_gateway) {
10091
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10092
0
        datum.n = 1;
10093
0
        datum.keys = key;
10094
0
        key->s = ovsdb_atom_string_create(local_gateway);
10095
0
    } else {
10096
0
        datum.n = 0;
10097
0
        datum.keys = NULL;
10098
0
    }
10099
0
    datum.values = NULL;
10100
0
    ovsdb_idl_condition_add_clause(cond,
10101
0
                          function,
10102
0
                          &ovsrec_controller_col_local_gateway,
10103
0
                          &datum);
10104
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_local_gateway.type);
10105
0
}
10106
10107
/* Sets the "local_ip" column from the "Controller" table in 'row' to
10108
 * the 'local_ip' set.
10109
 *
10110
 * If "local_ip" is null, the column will be the empty set,
10111
 * otherwise it will contain the specified value.
10112
 *
10113
 * The caller retains ownership of the arguments. */
10114
void
10115
ovsrec_controller_add_clause_local_ip(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *local_ip)
10116
0
{
10117
0
    struct ovsdb_datum datum;
10118
10119
0
    datum.refcnt = NULL;
10120
10121
0
    if (local_ip) {
10122
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10123
0
        datum.n = 1;
10124
0
        datum.keys = key;
10125
0
        key->s = ovsdb_atom_string_create(local_ip);
10126
0
    } else {
10127
0
        datum.n = 0;
10128
0
        datum.keys = NULL;
10129
0
    }
10130
0
    datum.values = NULL;
10131
0
    ovsdb_idl_condition_add_clause(cond,
10132
0
                          function,
10133
0
                          &ovsrec_controller_col_local_ip,
10134
0
                          &datum);
10135
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_local_ip.type);
10136
0
}
10137
10138
/* Sets the "local_netmask" column from the "Controller" table in 'row' to
10139
 * the 'local_netmask' set.
10140
 *
10141
 * If "local_netmask" is null, the column will be the empty set,
10142
 * otherwise it will contain the specified value.
10143
 *
10144
 * The caller retains ownership of the arguments. */
10145
void
10146
ovsrec_controller_add_clause_local_netmask(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *local_netmask)
10147
0
{
10148
0
    struct ovsdb_datum datum;
10149
10150
0
    datum.refcnt = NULL;
10151
10152
0
    if (local_netmask) {
10153
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10154
0
        datum.n = 1;
10155
0
        datum.keys = key;
10156
0
        key->s = ovsdb_atom_string_create(local_netmask);
10157
0
    } else {
10158
0
        datum.n = 0;
10159
0
        datum.keys = NULL;
10160
0
    }
10161
0
    datum.values = NULL;
10162
0
    ovsdb_idl_condition_add_clause(cond,
10163
0
                          function,
10164
0
                          &ovsrec_controller_col_local_netmask,
10165
0
                          &datum);
10166
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_local_netmask.type);
10167
0
}
10168
10169
/* Sets the "max_backoff" column from the "Controller" table in 'row' to
10170
 * the 'max_backoff' set with 'n_max_backoff' entries.
10171
 *
10172
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
10173
 * may be NULL.
10174
 *
10175
 * Argument constraints: at least 1,000
10176
 *
10177
 * The caller retains ownership of the arguments. */
10178
void
10179
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)
10180
0
{
10181
0
    struct ovsdb_datum datum;
10182
10183
0
    datum.refcnt = NULL;
10184
10185
0
    if (n_max_backoff) {
10186
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10187
0
        datum.n = 1;
10188
0
        datum.keys = key;
10189
0
        key->integer = *max_backoff;
10190
0
    } else {
10191
0
        datum.n = 0;
10192
0
        datum.keys = NULL;
10193
0
    }
10194
0
    datum.values = NULL;
10195
0
    ovsdb_idl_condition_add_clause(cond,
10196
0
                          function,
10197
0
                          &ovsrec_controller_col_max_backoff,
10198
0
                          &datum);
10199
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_max_backoff.type);
10200
0
}
10201
10202
/* Sets the "other_config" column's value from the "Controller" table in 'row'
10203
 * to 'other_config'.
10204
 *
10205
 * The caller retains ownership of 'other_config' and everything in it. */
10206
void
10207
ovsrec_controller_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
10208
0
{
10209
0
    struct ovsdb_datum datum;
10210
10211
0
    if (other_config) {
10212
0
        ovsdb_datum_from_smap(&datum, other_config);
10213
0
    } else {
10214
0
        ovsdb_datum_init_empty(&datum);
10215
0
    }
10216
10217
0
    ovsdb_idl_condition_add_clause(cond,
10218
0
                                   function,
10219
0
                                   &ovsrec_controller_col_other_config,
10220
0
                                   &datum);
10221
10222
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_other_config.type);
10223
0
}
10224
10225
10226
/* Sets the "role" column from the "Controller" table in 'row' to
10227
 * the 'role' set.
10228
 *
10229
 * If "role" is null, the column will be the empty set,
10230
 * otherwise it will contain the specified value.
10231
 *
10232
 * Argument constraints: one of "master", "other", or "slave"
10233
 *
10234
 * The caller retains ownership of the arguments. */
10235
void
10236
ovsrec_controller_add_clause_role(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *role)
10237
0
{
10238
0
    struct ovsdb_datum datum;
10239
10240
0
    datum.refcnt = NULL;
10241
10242
0
    if (role) {
10243
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10244
0
        datum.n = 1;
10245
0
        datum.keys = key;
10246
0
        key->s = ovsdb_atom_string_create(role);
10247
0
    } else {
10248
0
        datum.n = 0;
10249
0
        datum.keys = NULL;
10250
0
    }
10251
0
    datum.values = NULL;
10252
0
    ovsdb_idl_condition_add_clause(cond,
10253
0
                          function,
10254
0
                          &ovsrec_controller_col_role,
10255
0
                          &datum);
10256
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_role.type);
10257
0
}
10258
10259
/* Sets the "status" column's value from the "Controller" table in 'row'
10260
 * to 'status'.
10261
 *
10262
 * The caller retains ownership of 'status' and everything in it. */
10263
void
10264
ovsrec_controller_add_clause_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *status)
10265
0
{
10266
0
    struct ovsdb_datum datum;
10267
10268
0
    if (status) {
10269
0
        ovsdb_datum_from_smap(&datum, status);
10270
0
    } else {
10271
0
        ovsdb_datum_init_empty(&datum);
10272
0
    }
10273
10274
0
    ovsdb_idl_condition_add_clause(cond,
10275
0
                                   function,
10276
0
                                   &ovsrec_controller_col_status,
10277
0
                                   &datum);
10278
10279
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_status.type);
10280
0
}
10281
10282
10283
/* Sets the "target" column from the "Controller" table in 'row' to
10284
 * 'target'.
10285
 *
10286
 * The caller retains ownership of the arguments. */
10287
void
10288
ovsrec_controller_add_clause_target(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *target)
10289
0
{
10290
0
    struct ovsdb_datum datum;
10291
10292
0
    datum.refcnt = NULL;
10293
10294
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
10295
10296
0
    datum.n = 1;
10297
0
    datum.keys = key;
10298
0
    key->s = ovsdb_atom_string_create(target);
10299
0
    datum.values = NULL;
10300
0
    ovsdb_idl_condition_add_clause(cond,
10301
0
                          function,
10302
0
                          &ovsrec_controller_col_target,
10303
0
                          &datum);
10304
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_target.type);
10305
0
}
10306
10307
/* Sets the "type" column from the "Controller" table in 'row' to
10308
 * the 'type' set.
10309
 *
10310
 * If "type" is null, the column will be the empty set,
10311
 * otherwise it will contain the specified value.
10312
 *
10313
 * Argument constraints: either "primary" or "service"
10314
 *
10315
 * The caller retains ownership of the arguments. */
10316
void
10317
ovsrec_controller_add_clause_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *type)
10318
0
{
10319
0
    struct ovsdb_datum datum;
10320
10321
0
    datum.refcnt = NULL;
10322
10323
0
    if (type) {
10324
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
10325
0
        datum.n = 1;
10326
0
        datum.keys = key;
10327
0
        key->s = ovsdb_atom_string_create(type);
10328
0
    } else {
10329
0
        datum.n = 0;
10330
0
        datum.keys = NULL;
10331
0
    }
10332
0
    datum.values = NULL;
10333
0
    ovsdb_idl_condition_add_clause(cond,
10334
0
                          function,
10335
0
                          &ovsrec_controller_col_type,
10336
0
                          &datum);
10337
0
    ovsdb_datum_destroy(&datum, &ovsrec_controller_col_type.type);
10338
0
}
10339
10340
/* Destroy 'row' of kind "Controller". The row must have been
10341
 * created with ovsdb_idl_index_init_row.
10342
 */
10343
void
10344
ovsrec_controller_index_destroy_row(const struct ovsrec_controller *row)
10345
0
{
10346
0
    ovsdb_idl_index_destroy_row(&row->header_);
10347
0
}
10348
        
10349
10350
/* Creates a new row of kind "Controller". */
10351
struct ovsrec_controller *
10352
ovsrec_controller_index_init_row(struct ovsdb_idl_index *index)
10353
0
{
10354
0
    ovs_assert(index->table->class_ == &ovsrec_table_controller);
10355
0
    return ALIGNED_CAST(struct ovsrec_controller *, ovsdb_idl_index_init_row(index));
10356
0
}
10357
10358
struct ovsrec_controller *
10359
ovsrec_controller_index_find(struct ovsdb_idl_index *index, const struct ovsrec_controller *target)
10360
0
{
10361
0
    ovs_assert(index->table->class_ == &ovsrec_table_controller);
10362
0
    return ovsrec_controller_cast(ovsdb_idl_index_find(index, &target->header_));
10363
0
}
10364
10365
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
10366
int
10367
ovsrec_controller_index_compare(
10368
    struct ovsdb_idl_index *index, 
10369
    const struct ovsrec_controller *a, 
10370
    const struct ovsrec_controller *b)
10371
0
{
10372
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
10373
0
}
10374
10375
struct ovsdb_idl_cursor
10376
ovsrec_controller_cursor_first(struct ovsdb_idl_index *index)
10377
0
{
10378
0
    ovs_assert(index->table->class_ == &ovsrec_table_controller);
10379
0
    return ovsdb_idl_cursor_first(index);
10380
0
}
10381
10382
struct ovsdb_idl_cursor
10383
ovsrec_controller_cursor_first_eq(
10384
    struct ovsdb_idl_index *index, const struct ovsrec_controller *target)
10385
0
{
10386
0
    ovs_assert(index->table->class_ == &ovsrec_table_controller);
10387
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
10388
0
}
10389
10390
struct ovsdb_idl_cursor
10391
ovsrec_controller_cursor_first_ge(
10392
    struct ovsdb_idl_index *index, const struct ovsrec_controller *target)
10393
0
{
10394
0
    ovs_assert(index->table->class_ == &ovsrec_table_controller);
10395
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
10396
0
}
10397
10398
struct ovsrec_controller *
10399
ovsrec_controller_cursor_data(struct ovsdb_idl_cursor *cursor)
10400
0
{
10401
0
    return ovsrec_controller_cast(ovsdb_idl_cursor_data(cursor));
10402
0
}
10403
10404
10405
/* Sets the "connection_mode" column from the "Controller" table in 'row' to
10406
 * the 'connection_mode' set.
10407
 *
10408
 * If "connection_mode" is null, the column will be the empty set,
10409
 * otherwise it will contain the specified value.
10410
 *
10411
 * Argument constraints: either "in-band" or "out-of-band"
10412
 *
10413
 * The caller retains ownership of the arguments. */
10414
void
10415
ovsrec_controller_index_set_connection_mode(const struct ovsrec_controller *row, const char *connection_mode)
10416
0
{
10417
0
    struct ovsdb_datum datum;
10418
10419
0
    datum.refcnt = NULL;
10420
0
    union ovsdb_atom *key;
10421
10422
0
    if (connection_mode) {
10423
0
        key = xmalloc(sizeof (union ovsdb_atom));
10424
0
        datum.n = 1;
10425
0
        datum.keys = key;
10426
0
        key->s = ovsdb_atom_string_create(connection_mode);
10427
0
    } else {
10428
0
        datum.n = 0;
10429
0
        datum.keys = NULL;
10430
0
    }
10431
0
    datum.values = NULL;
10432
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]);
10433
0
}
10434
10435
/* Sets the "controller_burst_limit" column from the "Controller" table in 'row' to
10436
 * the 'controller_burst_limit' set with 'n_controller_burst_limit' entries.
10437
 *
10438
 * 'n_controller_burst_limit' may be 0 or 1; if it is 0, then 'controller_burst_limit'
10439
 * may be NULL.
10440
 *
10441
 * Argument constraints: at least 25
10442
 *
10443
 * The caller retains ownership of the arguments. */
10444
void
10445
ovsrec_controller_index_set_controller_burst_limit(const struct ovsrec_controller *row, const int64_t *controller_burst_limit, size_t n_controller_burst_limit)
10446
0
{
10447
0
    struct ovsdb_datum datum;
10448
10449
0
    datum.refcnt = NULL;
10450
0
    union ovsdb_atom *key;
10451
10452
0
    if (n_controller_burst_limit) {
10453
0
        key = xmalloc(sizeof(union ovsdb_atom));
10454
0
        datum.n = 1;
10455
0
        datum.keys = key;
10456
0
        key->integer = *controller_burst_limit;
10457
0
    } else {
10458
0
        datum.n = 0;
10459
0
        datum.keys = NULL;
10460
0
    }
10461
0
    datum.values = NULL;
10462
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]);
10463
0
}
10464
10465
/* Sets the "controller_queue_size" column from the "Controller" table in 'row' to
10466
 * the 'controller_queue_size' set with 'n_controller_queue_size' entries.
10467
 *
10468
 * 'n_controller_queue_size' may be 0 or 1; if it is 0, then 'controller_queue_size'
10469
 * may be NULL.
10470
 *
10471
 * Argument constraints: in range 1 to 512
10472
 *
10473
 * The caller retains ownership of the arguments. */
10474
void
10475
ovsrec_controller_index_set_controller_queue_size(const struct ovsrec_controller *row, const int64_t *controller_queue_size, size_t n_controller_queue_size)
10476
0
{
10477
0
    struct ovsdb_datum datum;
10478
10479
0
    datum.refcnt = NULL;
10480
0
    union ovsdb_atom *key;
10481
10482
0
    if (n_controller_queue_size) {
10483
0
        key = xmalloc(sizeof(union ovsdb_atom));
10484
0
        datum.n = 1;
10485
0
        datum.keys = key;
10486
0
        key->integer = *controller_queue_size;
10487
0
    } else {
10488
0
        datum.n = 0;
10489
0
        datum.keys = NULL;
10490
0
    }
10491
0
    datum.values = NULL;
10492
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]);
10493
0
}
10494
10495
/* Sets the "controller_rate_limit" column from the "Controller" table in 'row' to
10496
 * the 'controller_rate_limit' set with 'n_controller_rate_limit' entries.
10497
 *
10498
 * 'n_controller_rate_limit' may be 0 or 1; if it is 0, then 'controller_rate_limit'
10499
 * may be NULL.
10500
 *
10501
 * Argument constraints: at least 100
10502
 *
10503
 * The caller retains ownership of the arguments. */
10504
void
10505
ovsrec_controller_index_set_controller_rate_limit(const struct ovsrec_controller *row, const int64_t *controller_rate_limit, size_t n_controller_rate_limit)
10506
0
{
10507
0
    struct ovsdb_datum datum;
10508
10509
0
    datum.refcnt = NULL;
10510
0
    union ovsdb_atom *key;
10511
10512
0
    if (n_controller_rate_limit) {
10513
0
        key = xmalloc(sizeof(union ovsdb_atom));
10514
0
        datum.n = 1;
10515
0
        datum.keys = key;
10516
0
        key->integer = *controller_rate_limit;
10517
0
    } else {
10518
0
        datum.n = 0;
10519
0
        datum.keys = NULL;
10520
0
    }
10521
0
    datum.values = NULL;
10522
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]);
10523
0
}
10524
10525
/* Sets the "enable_async_messages" column from the "Controller" table in 'row' to
10526
 * the 'enable_async_messages' set with 'n_enable_async_messages' entries.
10527
 *
10528
 * 'n_enable_async_messages' may be 0 or 1; if it is 0, then 'enable_async_messages'
10529
 * may be NULL.
10530
 *
10531
 * The caller retains ownership of the arguments. */
10532
void
10533
ovsrec_controller_index_set_enable_async_messages(const struct ovsrec_controller *row, const bool *enable_async_messages, size_t n_enable_async_messages)
10534
0
{
10535
0
    struct ovsdb_datum datum;
10536
10537
0
    datum.refcnt = NULL;
10538
0
    union ovsdb_atom *key;
10539
10540
0
    if (n_enable_async_messages) {
10541
0
        key = xmalloc(sizeof(union ovsdb_atom));
10542
0
        datum.n = 1;
10543
0
        datum.keys = key;
10544
0
        key->boolean = *enable_async_messages;
10545
0
    } else {
10546
0
        datum.n = 0;
10547
0
        datum.keys = NULL;
10548
0
    }
10549
0
    datum.values = NULL;
10550
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]);
10551
0
}
10552
10553
/* Sets the "external_ids" column's value from the "Controller" table in 'row'
10554
 * to 'external_ids'.
10555
 *
10556
 * The caller retains ownership of 'external_ids' and everything in it. */
10557
void
10558
ovsrec_controller_index_set_external_ids(const struct ovsrec_controller *row, const struct smap *external_ids)
10559
0
{
10560
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
10561
10562
0
    if (external_ids) {
10563
0
        struct smap_node *node;
10564
0
        size_t i;
10565
10566
0
        datum->n = smap_count(external_ids);
10567
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
10568
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
10569
0
        datum->refcnt = NULL;
10570
10571
0
        i = 0;
10572
0
        SMAP_FOR_EACH (node, external_ids) {
10573
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
10574
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
10575
0
            i++;
10576
0
        }
10577
0
        ovsdb_datum_sort_unique(datum, &ovsrec_controller_col_external_ids.type);
10578
0
    } else {
10579
0
        ovsdb_datum_init_empty(datum);
10580
0
    }
10581
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
10582
0
                          &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_EXTERNAL_IDS],
10583
0
                          datum,
10584
0
                          &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
10585
0
    free(datum);
10586
0
}
10587
10588
10589
/* Sets the "inactivity_probe" column from the "Controller" table in 'row' to
10590
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
10591
 *
10592
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
10593
 * may be NULL.
10594
 *
10595
 * The caller retains ownership of the arguments. */
10596
void
10597
ovsrec_controller_index_set_inactivity_probe(const struct ovsrec_controller *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
10598
0
{
10599
0
    struct ovsdb_datum datum;
10600
10601
0
    datum.refcnt = NULL;
10602
0
    union ovsdb_atom *key;
10603
10604
0
    if (n_inactivity_probe) {
10605
0
        key = xmalloc(sizeof(union ovsdb_atom));
10606
0
        datum.n = 1;
10607
0
        datum.keys = key;
10608
0
        key->integer = *inactivity_probe;
10609
0
    } else {
10610
0
        datum.n = 0;
10611
0
        datum.keys = NULL;
10612
0
    }
10613
0
    datum.values = NULL;
10614
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]);
10615
0
}
10616
10617
/* Sets the "is_connected" column from the "Controller" table in 'row' to
10618
 * 'is_connected'.
10619
 *
10620
 * The caller retains ownership of the arguments. */
10621
void
10622
ovsrec_controller_index_set_is_connected(const struct ovsrec_controller *row, bool is_connected)
10623
0
{
10624
0
    struct ovsdb_datum datum;
10625
10626
0
    datum.refcnt = NULL;
10627
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
10628
10629
0
    datum.n = 1;
10630
0
    datum.keys = key;
10631
0
    key->boolean = is_connected;
10632
0
    datum.values = NULL;
10633
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]);
10634
0
}
10635
10636
/* Sets the "local_gateway" column from the "Controller" table in 'row' to
10637
 * the 'local_gateway' set.
10638
 *
10639
 * If "local_gateway" is null, the column will be the empty set,
10640
 * otherwise it will contain the specified value.
10641
 *
10642
 * The caller retains ownership of the arguments. */
10643
void
10644
ovsrec_controller_index_set_local_gateway(const struct ovsrec_controller *row, const char *local_gateway)
10645
0
{
10646
0
    struct ovsdb_datum datum;
10647
10648
0
    datum.refcnt = NULL;
10649
0
    union ovsdb_atom *key;
10650
10651
0
    if (local_gateway) {
10652
0
        key = xmalloc(sizeof (union ovsdb_atom));
10653
0
        datum.n = 1;
10654
0
        datum.keys = key;
10655
0
        key->s = ovsdb_atom_string_create(local_gateway);
10656
0
    } else {
10657
0
        datum.n = 0;
10658
0
        datum.keys = NULL;
10659
0
    }
10660
0
    datum.values = NULL;
10661
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]);
10662
0
}
10663
10664
/* Sets the "local_ip" column from the "Controller" table in 'row' to
10665
 * the 'local_ip' set.
10666
 *
10667
 * If "local_ip" is null, the column will be the empty set,
10668
 * otherwise it will contain the specified value.
10669
 *
10670
 * The caller retains ownership of the arguments. */
10671
void
10672
ovsrec_controller_index_set_local_ip(const struct ovsrec_controller *row, const char *local_ip)
10673
0
{
10674
0
    struct ovsdb_datum datum;
10675
10676
0
    datum.refcnt = NULL;
10677
0
    union ovsdb_atom *key;
10678
10679
0
    if (local_ip) {
10680
0
        key = xmalloc(sizeof (union ovsdb_atom));
10681
0
        datum.n = 1;
10682
0
        datum.keys = key;
10683
0
        key->s = ovsdb_atom_string_create(local_ip);
10684
0
    } else {
10685
0
        datum.n = 0;
10686
0
        datum.keys = NULL;
10687
0
    }
10688
0
    datum.values = NULL;
10689
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]);
10690
0
}
10691
10692
/* Sets the "local_netmask" column from the "Controller" table in 'row' to
10693
 * the 'local_netmask' set.
10694
 *
10695
 * If "local_netmask" is null, the column will be the empty set,
10696
 * otherwise it will contain the specified value.
10697
 *
10698
 * The caller retains ownership of the arguments. */
10699
void
10700
ovsrec_controller_index_set_local_netmask(const struct ovsrec_controller *row, const char *local_netmask)
10701
0
{
10702
0
    struct ovsdb_datum datum;
10703
10704
0
    datum.refcnt = NULL;
10705
0
    union ovsdb_atom *key;
10706
10707
0
    if (local_netmask) {
10708
0
        key = xmalloc(sizeof (union ovsdb_atom));
10709
0
        datum.n = 1;
10710
0
        datum.keys = key;
10711
0
        key->s = ovsdb_atom_string_create(local_netmask);
10712
0
    } else {
10713
0
        datum.n = 0;
10714
0
        datum.keys = NULL;
10715
0
    }
10716
0
    datum.values = NULL;
10717
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]);
10718
0
}
10719
10720
/* Sets the "max_backoff" column from the "Controller" table in 'row' to
10721
 * the 'max_backoff' set with 'n_max_backoff' entries.
10722
 *
10723
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
10724
 * may be NULL.
10725
 *
10726
 * Argument constraints: at least 1,000
10727
 *
10728
 * The caller retains ownership of the arguments. */
10729
void
10730
ovsrec_controller_index_set_max_backoff(const struct ovsrec_controller *row, const int64_t *max_backoff, size_t n_max_backoff)
10731
0
{
10732
0
    struct ovsdb_datum datum;
10733
10734
0
    datum.refcnt = NULL;
10735
0
    union ovsdb_atom *key;
10736
10737
0
    if (n_max_backoff) {
10738
0
        key = xmalloc(sizeof(union ovsdb_atom));
10739
0
        datum.n = 1;
10740
0
        datum.keys = key;
10741
0
        key->integer = *max_backoff;
10742
0
    } else {
10743
0
        datum.n = 0;
10744
0
        datum.keys = NULL;
10745
0
    }
10746
0
    datum.values = NULL;
10747
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]);
10748
0
}
10749
10750
/* Sets the "other_config" column's value from the "Controller" table in 'row'
10751
 * to 'other_config'.
10752
 *
10753
 * The caller retains ownership of 'other_config' and everything in it. */
10754
void
10755
ovsrec_controller_index_set_other_config(const struct ovsrec_controller *row, const struct smap *other_config)
10756
0
{
10757
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
10758
10759
0
    if (other_config) {
10760
0
        struct smap_node *node;
10761
0
        size_t i;
10762
10763
0
        datum->n = smap_count(other_config);
10764
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
10765
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
10766
0
        datum->refcnt = NULL;
10767
10768
0
        i = 0;
10769
0
        SMAP_FOR_EACH (node, other_config) {
10770
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
10771
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
10772
0
            i++;
10773
0
        }
10774
0
        ovsdb_datum_sort_unique(datum, &ovsrec_controller_col_other_config.type);
10775
0
    } else {
10776
0
        ovsdb_datum_init_empty(datum);
10777
0
    }
10778
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
10779
0
                          &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_OTHER_CONFIG],
10780
0
                          datum,
10781
0
                          &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
10782
0
    free(datum);
10783
0
}
10784
10785
10786
/* Sets the "role" column from the "Controller" table in 'row' to
10787
 * the 'role' set.
10788
 *
10789
 * If "role" is null, the column will be the empty set,
10790
 * otherwise it will contain the specified value.
10791
 *
10792
 * Argument constraints: one of "master", "other", or "slave"
10793
 *
10794
 * The caller retains ownership of the arguments. */
10795
void
10796
ovsrec_controller_index_set_role(const struct ovsrec_controller *row, const char *role)
10797
0
{
10798
0
    struct ovsdb_datum datum;
10799
10800
0
    datum.refcnt = NULL;
10801
0
    union ovsdb_atom *key;
10802
10803
0
    if (role) {
10804
0
        key = xmalloc(sizeof (union ovsdb_atom));
10805
0
        datum.n = 1;
10806
0
        datum.keys = key;
10807
0
        key->s = ovsdb_atom_string_create(role);
10808
0
    } else {
10809
0
        datum.n = 0;
10810
0
        datum.keys = NULL;
10811
0
    }
10812
0
    datum.values = NULL;
10813
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]);
10814
0
}
10815
10816
/* Sets the "status" column's value from the "Controller" table in 'row'
10817
 * to 'status'.
10818
 *
10819
 * The caller retains ownership of 'status' and everything in it. */
10820
void
10821
ovsrec_controller_index_set_status(const struct ovsrec_controller *row, const struct smap *status)
10822
0
{
10823
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
10824
10825
0
    if (status) {
10826
0
        struct smap_node *node;
10827
0
        size_t i;
10828
10829
0
        datum->n = smap_count(status);
10830
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
10831
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
10832
0
        datum->refcnt = NULL;
10833
10834
0
        i = 0;
10835
0
        SMAP_FOR_EACH (node, status) {
10836
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
10837
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
10838
0
            i++;
10839
0
        }
10840
0
        ovsdb_datum_sort_unique(datum, &ovsrec_controller_col_status.type);
10841
0
    } else {
10842
0
        ovsdb_datum_init_empty(datum);
10843
0
    }
10844
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
10845
0
                          &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_STATUS],
10846
0
                          datum,
10847
0
                          &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]);
10848
0
    free(datum);
10849
0
}
10850
10851
10852
/* Sets the "target" column from the "Controller" table in 'row' to
10853
 * 'target'.
10854
 *
10855
 * The caller retains ownership of the arguments. */
10856
void
10857
ovsrec_controller_index_set_target(const struct ovsrec_controller *row, const char *target)
10858
0
{
10859
0
    struct ovsdb_datum datum;
10860
10861
0
    datum.refcnt = NULL;
10862
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
10863
10864
0
    datum.n = 1;
10865
0
    datum.keys = key;
10866
0
    key->s = ovsdb_atom_string_create(target);
10867
0
    datum.values = NULL;
10868
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]);
10869
0
}
10870
10871
/* Sets the "type" column from the "Controller" table in 'row' to
10872
 * the 'type' set.
10873
 *
10874
 * If "type" is null, the column will be the empty set,
10875
 * otherwise it will contain the specified value.
10876
 *
10877
 * Argument constraints: either "primary" or "service"
10878
 *
10879
 * The caller retains ownership of the arguments. */
10880
void
10881
ovsrec_controller_index_set_type(const struct ovsrec_controller *row, const char *type)
10882
0
{
10883
0
    struct ovsdb_datum datum;
10884
10885
0
    datum.refcnt = NULL;
10886
0
    union ovsdb_atom *key;
10887
10888
0
    if (type) {
10889
0
        key = xmalloc(sizeof (union ovsdb_atom));
10890
0
        datum.n = 1;
10891
0
        datum.keys = key;
10892
0
        key->s = ovsdb_atom_string_create(type);
10893
0
    } else {
10894
0
        datum.n = 0;
10895
0
        datum.keys = NULL;
10896
0
    }
10897
0
    datum.values = NULL;
10898
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]);
10899
0
}
10900
10901
struct ovsdb_idl_column ovsrec_controller_columns[OVSREC_CONTROLLER_N_COLUMNS];
10902
10903
unsigned int
10904
ovsrec_controller_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
10905
0
{
10906
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_controller, condition);
10907
0
}
10908
static struct json Controller_col_connection_mode_key_enum_key_strings[2] = {
10909
    { .type = JSON_STRING, .string = "in-band", .count = 2 },
10910
    { .type = JSON_STRING, .string = "out-of-band", .count = 2 },
10911
};
10912
static union ovsdb_atom Controller_col_connection_mode_key_enum_keys[2] = {
10913
    { .s = &Controller_col_connection_mode_key_enum_key_strings[0] },
10914
    { .s = &Controller_col_connection_mode_key_enum_key_strings[1] },
10915
};
10916
static struct ovsdb_datum Controller_col_connection_mode_key_enum = {
10917
    .n = 2,
10918
    .keys = Controller_col_connection_mode_key_enum_keys,
10919
};
10920
static struct json Controller_col_role_key_enum_key_strings[3] = {
10921
    { .type = JSON_STRING, .string = "master", .count = 2 },
10922
    { .type = JSON_STRING, .string = "other", .count = 2 },
10923
    { .type = JSON_STRING, .string = "slave", .count = 2 },
10924
};
10925
static union ovsdb_atom Controller_col_role_key_enum_keys[3] = {
10926
    { .s = &Controller_col_role_key_enum_key_strings[0] },
10927
    { .s = &Controller_col_role_key_enum_key_strings[1] },
10928
    { .s = &Controller_col_role_key_enum_key_strings[2] },
10929
};
10930
static struct ovsdb_datum Controller_col_role_key_enum = {
10931
    .n = 3,
10932
    .keys = Controller_col_role_key_enum_keys,
10933
};
10934
static struct json Controller_col_type_key_enum_key_strings[2] = {
10935
    { .type = JSON_STRING, .string = "primary", .count = 2 },
10936
    { .type = JSON_STRING, .string = "service", .count = 2 },
10937
};
10938
static union ovsdb_atom Controller_col_type_key_enum_keys[2] = {
10939
    { .s = &Controller_col_type_key_enum_key_strings[0] },
10940
    { .s = &Controller_col_type_key_enum_key_strings[1] },
10941
};
10942
static struct ovsdb_datum Controller_col_type_key_enum = {
10943
    .n = 2,
10944
    .keys = Controller_col_type_key_enum_keys,
10945
};
10946
10947
struct ovsdb_idl_column ovsrec_controller_columns[OVSREC_CONTROLLER_N_COLUMNS] = {
10948
    [OVSREC_CONTROLLER_COL_CONNECTION_MODE] = {
10949
         .name = "connection_mode",
10950
         .type = {
10951
            .key = {
10952
               .type = OVSDB_TYPE_STRING,
10953
               .enum_ = &Controller_col_connection_mode_key_enum,
10954
               .string = { .minLen = 0, .maxLen = UINT_MAX },
10955
            },
10956
            .value = OVSDB_BASE_VOID_INIT,
10957
            .n_min = 0,
10958
            .n_max = 1,
10959
         },
10960
         .is_mutable = true,
10961
         .is_synthetic = false,
10962
         .parse = ovsrec_controller_parse_connection_mode,
10963
         .unparse = ovsrec_controller_unparse_connection_mode,
10964
    },
10965
10966
    [OVSREC_CONTROLLER_COL_CONTROLLER_BURST_LIMIT] = {
10967
         .name = "controller_burst_limit",
10968
         .type = {
10969
            .key = {
10970
               .type = OVSDB_TYPE_INTEGER,
10971
               .integer = { .min = INT64_C(25), .max = INT64_MAX },
10972
            },
10973
            .value = OVSDB_BASE_VOID_INIT,
10974
            .n_min = 0,
10975
            .n_max = 1,
10976
         },
10977
         .is_mutable = true,
10978
         .is_synthetic = false,
10979
         .parse = ovsrec_controller_parse_controller_burst_limit,
10980
         .unparse = ovsrec_controller_unparse_controller_burst_limit,
10981
    },
10982
10983
    [OVSREC_CONTROLLER_COL_CONTROLLER_QUEUE_SIZE] = {
10984
         .name = "controller_queue_size",
10985
         .type = {
10986
            .key = {
10987
               .type = OVSDB_TYPE_INTEGER,
10988
               .integer = { .min = INT64_C(1), .max = INT64_C(512) },
10989
            },
10990
            .value = OVSDB_BASE_VOID_INIT,
10991
            .n_min = 0,
10992
            .n_max = 1,
10993
         },
10994
         .is_mutable = true,
10995
         .is_synthetic = false,
10996
         .parse = ovsrec_controller_parse_controller_queue_size,
10997
         .unparse = ovsrec_controller_unparse_controller_queue_size,
10998
    },
10999
11000
    [OVSREC_CONTROLLER_COL_CONTROLLER_RATE_LIMIT] = {
11001
         .name = "controller_rate_limit",
11002
         .type = {
11003
            .key = {
11004
               .type = OVSDB_TYPE_INTEGER,
11005
               .integer = { .min = INT64_C(100), .max = INT64_MAX },
11006
            },
11007
            .value = OVSDB_BASE_VOID_INIT,
11008
            .n_min = 0,
11009
            .n_max = 1,
11010
         },
11011
         .is_mutable = true,
11012
         .is_synthetic = false,
11013
         .parse = ovsrec_controller_parse_controller_rate_limit,
11014
         .unparse = ovsrec_controller_unparse_controller_rate_limit,
11015
    },
11016
11017
    [OVSREC_CONTROLLER_COL_ENABLE_ASYNC_MESSAGES] = {
11018
         .name = "enable_async_messages",
11019
         .type = {
11020
            .key = {
11021
               .type = OVSDB_TYPE_BOOLEAN,
11022
            },
11023
            .value = OVSDB_BASE_VOID_INIT,
11024
            .n_min = 0,
11025
            .n_max = 1,
11026
         },
11027
         .is_mutable = true,
11028
         .is_synthetic = false,
11029
         .parse = ovsrec_controller_parse_enable_async_messages,
11030
         .unparse = ovsrec_controller_unparse_enable_async_messages,
11031
    },
11032
11033
    [OVSREC_CONTROLLER_COL_EXTERNAL_IDS] = {
11034
         .name = "external_ids",
11035
         .type = {
11036
            .key = {
11037
               .type = OVSDB_TYPE_STRING,
11038
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11039
            },
11040
            .value = {
11041
                .type = OVSDB_TYPE_STRING,
11042
                .string = { .minLen = 0, .maxLen = UINT_MAX },
11043
            },
11044
            .n_min = 0,
11045
            .n_max = UINT_MAX,
11046
         },
11047
         .is_mutable = true,
11048
         .is_synthetic = false,
11049
         .parse = ovsrec_controller_parse_external_ids,
11050
         .unparse = ovsrec_controller_unparse_external_ids,
11051
    },
11052
11053
    [OVSREC_CONTROLLER_COL_INACTIVITY_PROBE] = {
11054
         .name = "inactivity_probe",
11055
         .type = {
11056
            .key = {
11057
               .type = OVSDB_TYPE_INTEGER,
11058
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
11059
            },
11060
            .value = OVSDB_BASE_VOID_INIT,
11061
            .n_min = 0,
11062
            .n_max = 1,
11063
         },
11064
         .is_mutable = true,
11065
         .is_synthetic = false,
11066
         .parse = ovsrec_controller_parse_inactivity_probe,
11067
         .unparse = ovsrec_controller_unparse_inactivity_probe,
11068
    },
11069
11070
    [OVSREC_CONTROLLER_COL_IS_CONNECTED] = {
11071
         .name = "is_connected",
11072
         .type = {
11073
            .key = {
11074
               .type = OVSDB_TYPE_BOOLEAN,
11075
            },
11076
            .value = OVSDB_BASE_VOID_INIT,
11077
            .n_min = 1,
11078
            .n_max = 1,
11079
         },
11080
         .is_mutable = true,
11081
         .is_synthetic = false,
11082
         .parse = ovsrec_controller_parse_is_connected,
11083
         .unparse = ovsrec_controller_unparse_is_connected,
11084
    },
11085
11086
    [OVSREC_CONTROLLER_COL_LOCAL_GATEWAY] = {
11087
         .name = "local_gateway",
11088
         .type = {
11089
            .key = {
11090
               .type = OVSDB_TYPE_STRING,
11091
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11092
            },
11093
            .value = OVSDB_BASE_VOID_INIT,
11094
            .n_min = 0,
11095
            .n_max = 1,
11096
         },
11097
         .is_mutable = true,
11098
         .is_synthetic = false,
11099
         .parse = ovsrec_controller_parse_local_gateway,
11100
         .unparse = ovsrec_controller_unparse_local_gateway,
11101
    },
11102
11103
    [OVSREC_CONTROLLER_COL_LOCAL_IP] = {
11104
         .name = "local_ip",
11105
         .type = {
11106
            .key = {
11107
               .type = OVSDB_TYPE_STRING,
11108
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11109
            },
11110
            .value = OVSDB_BASE_VOID_INIT,
11111
            .n_min = 0,
11112
            .n_max = 1,
11113
         },
11114
         .is_mutable = true,
11115
         .is_synthetic = false,
11116
         .parse = ovsrec_controller_parse_local_ip,
11117
         .unparse = ovsrec_controller_unparse_local_ip,
11118
    },
11119
11120
    [OVSREC_CONTROLLER_COL_LOCAL_NETMASK] = {
11121
         .name = "local_netmask",
11122
         .type = {
11123
            .key = {
11124
               .type = OVSDB_TYPE_STRING,
11125
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11126
            },
11127
            .value = OVSDB_BASE_VOID_INIT,
11128
            .n_min = 0,
11129
            .n_max = 1,
11130
         },
11131
         .is_mutable = true,
11132
         .is_synthetic = false,
11133
         .parse = ovsrec_controller_parse_local_netmask,
11134
         .unparse = ovsrec_controller_unparse_local_netmask,
11135
    },
11136
11137
    [OVSREC_CONTROLLER_COL_MAX_BACKOFF] = {
11138
         .name = "max_backoff",
11139
         .type = {
11140
            .key = {
11141
               .type = OVSDB_TYPE_INTEGER,
11142
               .integer = { .min = INT64_C(1000), .max = INT64_MAX },
11143
            },
11144
            .value = OVSDB_BASE_VOID_INIT,
11145
            .n_min = 0,
11146
            .n_max = 1,
11147
         },
11148
         .is_mutable = true,
11149
         .is_synthetic = false,
11150
         .parse = ovsrec_controller_parse_max_backoff,
11151
         .unparse = ovsrec_controller_unparse_max_backoff,
11152
    },
11153
11154
    [OVSREC_CONTROLLER_COL_OTHER_CONFIG] = {
11155
         .name = "other_config",
11156
         .type = {
11157
            .key = {
11158
               .type = OVSDB_TYPE_STRING,
11159
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11160
            },
11161
            .value = {
11162
                .type = OVSDB_TYPE_STRING,
11163
                .string = { .minLen = 0, .maxLen = UINT_MAX },
11164
            },
11165
            .n_min = 0,
11166
            .n_max = UINT_MAX,
11167
         },
11168
         .is_mutable = true,
11169
         .is_synthetic = false,
11170
         .parse = ovsrec_controller_parse_other_config,
11171
         .unparse = ovsrec_controller_unparse_other_config,
11172
    },
11173
11174
    [OVSREC_CONTROLLER_COL_ROLE] = {
11175
         .name = "role",
11176
         .type = {
11177
            .key = {
11178
               .type = OVSDB_TYPE_STRING,
11179
               .enum_ = &Controller_col_role_key_enum,
11180
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11181
            },
11182
            .value = OVSDB_BASE_VOID_INIT,
11183
            .n_min = 0,
11184
            .n_max = 1,
11185
         },
11186
         .is_mutable = true,
11187
         .is_synthetic = false,
11188
         .parse = ovsrec_controller_parse_role,
11189
         .unparse = ovsrec_controller_unparse_role,
11190
    },
11191
11192
    [OVSREC_CONTROLLER_COL_STATUS] = {
11193
         .name = "status",
11194
         .type = {
11195
            .key = {
11196
               .type = OVSDB_TYPE_STRING,
11197
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11198
            },
11199
            .value = {
11200
                .type = OVSDB_TYPE_STRING,
11201
                .string = { .minLen = 0, .maxLen = UINT_MAX },
11202
            },
11203
            .n_min = 0,
11204
            .n_max = UINT_MAX,
11205
         },
11206
         .is_mutable = true,
11207
         .is_synthetic = false,
11208
         .parse = ovsrec_controller_parse_status,
11209
         .unparse = ovsrec_controller_unparse_status,
11210
    },
11211
11212
    [OVSREC_CONTROLLER_COL_TARGET] = {
11213
         .name = "target",
11214
         .type = {
11215
            .key = {
11216
               .type = OVSDB_TYPE_STRING,
11217
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11218
            },
11219
            .value = OVSDB_BASE_VOID_INIT,
11220
            .n_min = 1,
11221
            .n_max = 1,
11222
         },
11223
         .is_mutable = true,
11224
         .is_synthetic = false,
11225
         .parse = ovsrec_controller_parse_target,
11226
         .unparse = ovsrec_controller_unparse_target,
11227
    },
11228
11229
    [OVSREC_CONTROLLER_COL_TYPE] = {
11230
         .name = "type",
11231
         .type = {
11232
            .key = {
11233
               .type = OVSDB_TYPE_STRING,
11234
               .enum_ = &Controller_col_type_key_enum,
11235
               .string = { .minLen = 0, .maxLen = UINT_MAX },
11236
            },
11237
            .value = OVSDB_BASE_VOID_INIT,
11238
            .n_min = 0,
11239
            .n_max = 1,
11240
         },
11241
         .is_mutable = true,
11242
         .is_synthetic = false,
11243
         .parse = ovsrec_controller_parse_type,
11244
         .unparse = ovsrec_controller_unparse_type,
11245
    },
11246
11247
};
11248

11249
/* Datapath table. */
11250
11251
bool
11252
ovsrec_server_has_datapath_table_col_capabilities(const struct ovsdb_idl *idl)
11253
0
{
11254
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_datapath_col_capabilities);
11255
0
}
11256
11257
11258
bool
11259
ovsrec_server_has_datapath_table_col_ct_zones(const struct ovsdb_idl *idl)
11260
0
{
11261
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_datapath_col_ct_zones);
11262
0
}
11263
11264
11265
bool
11266
ovsrec_server_has_datapath_table_col_datapath_version(const struct ovsdb_idl *idl)
11267
0
{
11268
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_datapath_col_datapath_version);
11269
0
}
11270
11271
11272
bool
11273
ovsrec_server_has_datapath_table_col_external_ids(const struct ovsdb_idl *idl)
11274
0
{
11275
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_datapath_col_external_ids);
11276
0
}
11277
11278
11279
bool
11280
ovsrec_server_has_datapath_table(const struct ovsdb_idl *idl)
11281
0
{
11282
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_DATAPATH]);
11283
0
}
11284
11285
11286
const struct ovsrec_datapath_table *
11287
ovsrec_datapath_table_get(const struct ovsdb_idl *idl)
11288
0
{
11289
0
    return (const struct ovsrec_datapath_table *) idl;
11290
0
}
11291
11292
const struct ovsrec_datapath *
11293
ovsrec_datapath_table_first(const struct ovsrec_datapath_table *table)
11294
0
{
11295
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
11296
0
    return ovsrec_datapath_first(idl);
11297
0
}
11298
11299
11300
const struct ovsrec_datapath *
11301
ovsrec_datapath_table_track_get_first(const struct ovsrec_datapath_table *table)
11302
0
{
11303
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
11304
0
    return ovsrec_datapath_track_get_first(idl);
11305
0
}
11306
11307
11308
static void
11309
ovsrec_datapath_parse_capabilities(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
11310
0
{
11311
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11312
0
    smap_init(&row->capabilities);
11313
0
    for (size_t i = 0; i < datum->n; i++) {
11314
0
        smap_add(&row->capabilities,
11315
0
                 json_string(datum->keys[i].s),
11316
0
                 json_string(datum->values[i].s));
11317
0
    }
11318
0
}
11319
11320
static void
11321
ovsrec_datapath_parse_ct_zones(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
11322
0
{
11323
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11324
0
    row->key_ct_zones = NULL;
11325
0
    row->value_ct_zones = NULL;
11326
0
    row->n_ct_zones = 0;
11327
0
    for (size_t i = 0; i < datum->n; i++) {
11328
0
        struct ovsrec_ct_zone *valueRow = ovsrec_ct_zone_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_ct_zone, &datum->values[i].uuid));
11329
0
        if (!valueRow) {
11330
0
            continue;
11331
0
        }
11332
0
        if (!row->n_ct_zones) {
11333
0
            row->key_ct_zones = xmalloc(datum->n * sizeof *row->key_ct_zones);
11334
0
            row->value_ct_zones = xmalloc(datum->n * sizeof *row->value_ct_zones);
11335
0
        }
11336
0
        row->key_ct_zones[row->n_ct_zones] = datum->keys[i].integer;
11337
0
        row->value_ct_zones[row->n_ct_zones] = valueRow;
11338
0
        row->n_ct_zones++;
11339
0
    }
11340
0
}
11341
11342
static void
11343
ovsrec_datapath_parse_datapath_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
11344
0
{
11345
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11346
11347
0
    if (datum->n >= 1) {
11348
0
        row->datapath_version = datum->keys[0].s->string;
11349
0
    } else {
11350
0
        row->datapath_version = "";
11351
0
    }
11352
0
}
11353
11354
static void
11355
ovsrec_datapath_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
11356
0
{
11357
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11358
0
    smap_init(&row->external_ids);
11359
0
    for (size_t i = 0; i < datum->n; i++) {
11360
0
        smap_add(&row->external_ids,
11361
0
                 json_string(datum->keys[i].s),
11362
0
                 json_string(datum->values[i].s));
11363
0
    }
11364
0
}
11365
11366
static void
11367
ovsrec_datapath_unparse_capabilities(struct ovsdb_idl_row *row_)
11368
0
{
11369
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11370
0
    smap_destroy(&row->capabilities);
11371
0
}
11372
11373
static void
11374
ovsrec_datapath_unparse_ct_zones(struct ovsdb_idl_row *row_)
11375
0
{
11376
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11377
0
    free(row->key_ct_zones);
11378
0
    free(row->value_ct_zones);
11379
0
}
11380
11381
static void
11382
ovsrec_datapath_unparse_datapath_version(struct ovsdb_idl_row *row OVS_UNUSED)
11383
0
{
11384
    /* Nothing to do. */
11385
0
}
11386
11387
static void
11388
ovsrec_datapath_unparse_external_ids(struct ovsdb_idl_row *row_)
11389
0
{
11390
0
    struct ovsrec_datapath *row = ovsrec_datapath_cast(row_);
11391
0
    smap_destroy(&row->external_ids);
11392
0
}
11393
11394
static void
11395
ovsrec_datapath_init__(struct ovsdb_idl_row *row)
11396
0
{
11397
0
    ovsrec_datapath_init(ovsrec_datapath_cast(row));
11398
0
}
11399
11400
/* Clears the contents of 'row' in table "Datapath". */
11401
void
11402
ovsrec_datapath_init(struct ovsrec_datapath *row)
11403
0
{
11404
0
    memset(row, 0, sizeof *row); 
11405
0
    smap_init(&row->capabilities);
11406
0
    row->datapath_version = "";
11407
0
    smap_init(&row->external_ids);
11408
0
}
11409
11410
/* Searches table "Datapath" in 'idl' for a row with UUID 'uuid'.  Returns
11411
 * a pointer to the row if there is one, otherwise a null pointer.  */
11412
const struct ovsrec_datapath *
11413
ovsrec_datapath_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
11414
0
{
11415
0
    return ovsrec_datapath_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_datapath, uuid));
11416
0
}
11417
11418
/* Searches table "Datapath" for a row with UUID 'uuid'.  Returns
11419
 * a pointer to the row if there is one, otherwise a null pointer.  */
11420
const struct ovsrec_datapath *
11421
ovsrec_datapath_table_get_for_uuid(const struct ovsrec_datapath_table *table, const struct uuid *uuid)
11422
0
{
11423
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
11424
0
    return ovsrec_datapath_get_for_uuid(idl, uuid);
11425
0
}
11426
11427
/* Returns a row in table "Datapath" in 'idl', or a null pointer if that
11428
 * table is empty.
11429
 *
11430
 * Database tables are internally maintained as hash tables, so adding or
11431
 * removing rows while traversing the same table can cause some rows to be
11432
 * visited twice or not at apply. */
11433
const struct ovsrec_datapath *
11434
ovsrec_datapath_first(const struct ovsdb_idl *idl)
11435
0
{
11436
0
    return ovsrec_datapath_cast(ovsdb_idl_first_row(idl, &ovsrec_table_datapath));
11437
0
}
11438
11439
/* Returns a row following 'row' within its table, or a null pointer if 'row'
11440
 * is the last row in its table. */
11441
const struct ovsrec_datapath *
11442
ovsrec_datapath_next(const struct ovsrec_datapath *row)
11443
0
{
11444
0
    return ovsrec_datapath_cast(ovsdb_idl_next_row(&row->header_));
11445
0
}
11446
11447
unsigned int ovsrec_datapath_get_seqno(const struct ovsdb_idl *idl)
11448
0
{
11449
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_datapath);
11450
0
}
11451
11452
unsigned int ovsrec_datapath_row_get_seqno(const struct ovsrec_datapath *row, enum ovsdb_idl_change change)
11453
0
{
11454
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
11455
0
}
11456
11457
const struct ovsrec_datapath *
11458
ovsrec_datapath_track_get_first(const struct ovsdb_idl *idl)
11459
0
{
11460
0
    return ovsrec_datapath_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_datapath));
11461
0
}
11462
11463
const struct ovsrec_datapath
11464
*ovsrec_datapath_track_get_next(const struct ovsrec_datapath *row)
11465
0
{
11466
0
    return ovsrec_datapath_cast(ovsdb_idl_track_get_next(&row->header_));
11467
0
}
11468
11469
11470
/* Deletes 'row' from table "Datapath".  'row' may be freed, so it must not be
11471
 * accessed afterward.
11472
 *
11473
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
11474
void
11475
ovsrec_datapath_delete(const struct ovsrec_datapath *row)
11476
0
{
11477
0
    ovsdb_idl_txn_delete(&row->header_);
11478
0
}
11479
11480
/* Inserts and returns a new row in the table "Datapath" in the database
11481
 * with open transaction 'txn'.
11482
 *
11483
 * The new row is assigned a randomly generated provisional UUID.
11484
 * ovsdb-server will assign a different UUID when 'txn' is committed,
11485
 * but the IDL will replace any uses of the provisional UUID in the
11486
 * data to be to be committed by the UUID assigned by ovsdb-server. */
11487
struct ovsrec_datapath *
11488
ovsrec_datapath_insert(struct ovsdb_idl_txn *txn)
11489
0
{
11490
0
    return ovsrec_datapath_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_datapath, NULL));
11491
0
}
11492
11493
/* Inserts and returns a new row in the table "Datapath" in the database
11494
 * with open transaction 'txn'.
11495
 *
11496
 * The new row is assigned the UUID specified in the 'uuid' parameter
11497
 * (which cannot be null).  ovsdb-server will try to assign the same
11498
 * UUID when 'txn' is committed. */
11499
struct ovsrec_datapath *
11500
ovsrec_datapath_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
11501
0
{
11502
0
    return ovsrec_datapath_cast(ovsdb_idl_txn_insert_persist_uuid(
11503
0
        txn, &ovsrec_table_datapath, uuid));
11504
0
}
11505
11506
bool
11507
ovsrec_datapath_is_updated(const struct ovsrec_datapath *row, enum ovsrec_datapath_column_id column)
11508
0
{
11509
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_datapath_columns[column]);
11510
0
}
11511
11512
/* Causes the original contents of column "capabilities" in 'row' to be
11513
 * verified as a prerequisite to completing the transaction.  That is, if
11514
 * "capabilities" in 'row' changed (or if 'row' was deleted) between the
11515
 * time that the IDL originally read its contents and the time that the
11516
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
11517
 *
11518
 * The intention is that, to ensure that no transaction commits based on dirty
11519
 * reads, an application should call this function any time "capabilities" is
11520
 * read as part of a read-modify-write operation.
11521
 *
11522
 * In some cases this function reduces to a no-op, because the current value
11523
 * of "capabilities" is already known:
11524
 *
11525
 *   - If 'row' is a row created by the current transaction (returned by
11526
 *     ovsrec_datapath_insert()).
11527
 *
11528
 *   - If "capabilities" has already been modified (with
11529
 *     ovsrec_datapath_set_capabilities()) within the current transaction.
11530
 *
11531
 * Because of the latter property, always call this function *before*
11532
 * ovsrec_datapath_set_capabilities() for a given read-modify-write.
11533
 *
11534
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
11535
void
11536
ovsrec_datapath_verify_capabilities(const struct ovsrec_datapath *row)
11537
0
{
11538
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_datapath_col_capabilities);
11539
0
}
11540
11541
/* Causes the original contents of column "ct_zones" in 'row' to be
11542
 * verified as a prerequisite to completing the transaction.  That is, if
11543
 * "ct_zones" in 'row' changed (or if 'row' was deleted) between the
11544
 * time that the IDL originally read its contents and the time that the
11545
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
11546
 *
11547
 * The intention is that, to ensure that no transaction commits based on dirty
11548
 * reads, an application should call this function any time "ct_zones" is
11549
 * read as part of a read-modify-write operation.
11550
 *
11551
 * In some cases this function reduces to a no-op, because the current value
11552
 * of "ct_zones" is already known:
11553
 *
11554
 *   - If 'row' is a row created by the current transaction (returned by
11555
 *     ovsrec_datapath_insert()).
11556
 *
11557
 *   - If "ct_zones" has already been modified (with
11558
 *     ovsrec_datapath_set_ct_zones()) within the current transaction.
11559
 *
11560
 * Because of the latter property, always call this function *before*
11561
 * ovsrec_datapath_set_ct_zones() for a given read-modify-write.
11562
 *
11563
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
11564
void
11565
ovsrec_datapath_verify_ct_zones(const struct ovsrec_datapath *row)
11566
0
{
11567
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_datapath_col_ct_zones);
11568
0
}
11569
11570
/* Causes the original contents of column "datapath_version" in 'row' to be
11571
 * verified as a prerequisite to completing the transaction.  That is, if
11572
 * "datapath_version" in 'row' changed (or if 'row' was deleted) between the
11573
 * time that the IDL originally read its contents and the time that the
11574
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
11575
 *
11576
 * The intention is that, to ensure that no transaction commits based on dirty
11577
 * reads, an application should call this function any time "datapath_version" is
11578
 * read as part of a read-modify-write operation.
11579
 *
11580
 * In some cases this function reduces to a no-op, because the current value
11581
 * of "datapath_version" is already known:
11582
 *
11583
 *   - If 'row' is a row created by the current transaction (returned by
11584
 *     ovsrec_datapath_insert()).
11585
 *
11586
 *   - If "datapath_version" has already been modified (with
11587
 *     ovsrec_datapath_set_datapath_version()) within the current transaction.
11588
 *
11589
 * Because of the latter property, always call this function *before*
11590
 * ovsrec_datapath_set_datapath_version() for a given read-modify-write.
11591
 *
11592
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
11593
void
11594
ovsrec_datapath_verify_datapath_version(const struct ovsrec_datapath *row)
11595
0
{
11596
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_datapath_col_datapath_version);
11597
0
}
11598
11599
/* Causes the original contents of column "external_ids" in 'row' to be
11600
 * verified as a prerequisite to completing the transaction.  That is, if
11601
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
11602
 * time that the IDL originally read its contents and the time that the
11603
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
11604
 *
11605
 * The intention is that, to ensure that no transaction commits based on dirty
11606
 * reads, an application should call this function any time "external_ids" is
11607
 * read as part of a read-modify-write operation.
11608
 *
11609
 * In some cases this function reduces to a no-op, because the current value
11610
 * of "external_ids" is already known:
11611
 *
11612
 *   - If 'row' is a row created by the current transaction (returned by
11613
 *     ovsrec_datapath_insert()).
11614
 *
11615
 *   - If "external_ids" has already been modified (with
11616
 *     ovsrec_datapath_set_external_ids()) within the current transaction.
11617
 *
11618
 * Because of the latter property, always call this function *before*
11619
 * ovsrec_datapath_set_external_ids() for a given read-modify-write.
11620
 *
11621
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
11622
void
11623
ovsrec_datapath_verify_external_ids(const struct ovsrec_datapath *row)
11624
0
{
11625
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_datapath_col_external_ids);
11626
0
}
11627
11628
/* Returns the "capabilities" column's value from the "Datapath" table in 'row'
11629
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
11630
 * ovsdb_datum_find_key() is an easier and more efficient way to search
11631
 * for a given key than implementing the same operation on the "cooked"
11632
 * form in 'row'.
11633
 *
11634
 * 'key_type' must be OVSDB_TYPE_STRING.
11635
 * 'value_type' must be OVSDB_TYPE_STRING.
11636
 * (This helps to avoid silent bugs if someone changes capabilities's
11637
 * type without updating the caller.)
11638
 *
11639
 * The caller must not modify or free the returned value.
11640
 *
11641
 * Various kinds of changes can invalidate the returned value: modifying
11642
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11643
 * If the returned value is needed for a long time, it is best to make a copy
11644
 * of it with ovsdb_datum_clone().
11645
 *
11646
 * This function is rarely useful, since it is easier to access the value
11647
 * directly through the "capabilities" member in ovsrec_datapath. */
11648
const struct ovsdb_datum *
11649
ovsrec_datapath_get_capabilities(const struct ovsrec_datapath *row,
11650
  enum ovsdb_atomic_type key_type OVS_UNUSED,
11651
  enum ovsdb_atomic_type value_type OVS_UNUSED)
11652
0
{
11653
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11654
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
11655
0
    return ovsdb_idl_read(&row->header_, &ovsrec_datapath_col_capabilities);
11656
0
}
11657
11658
/* Returns the "ct_zones" column's value from the "Datapath" table in 'row'
11659
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
11660
 * ovsdb_datum_find_key() is an easier and more efficient way to search
11661
 * for a given key than implementing the same operation on the "cooked"
11662
 * form in 'row'.
11663
 *
11664
 * 'key_type' must be OVSDB_TYPE_INTEGER.
11665
 * 'value_type' must be OVSDB_TYPE_UUID.
11666
 * (This helps to avoid silent bugs if someone changes ct_zones's
11667
 * type without updating the caller.)
11668
 *
11669
 * The caller must not modify or free the returned value.
11670
 *
11671
 * Various kinds of changes can invalidate the returned value: modifying
11672
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11673
 * If the returned value is needed for a long time, it is best to make a copy
11674
 * of it with ovsdb_datum_clone().
11675
 *
11676
 * This function is rarely useful, since it is easier to access the value
11677
 * directly through the "ct_zones" member in ovsrec_datapath. */
11678
const struct ovsdb_datum *
11679
ovsrec_datapath_get_ct_zones(const struct ovsrec_datapath *row,
11680
  enum ovsdb_atomic_type key_type OVS_UNUSED,
11681
  enum ovsdb_atomic_type value_type OVS_UNUSED)
11682
0
{
11683
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
11684
0
    ovs_assert(value_type == OVSDB_TYPE_UUID);
11685
0
    return ovsdb_idl_read(&row->header_, &ovsrec_datapath_col_ct_zones);
11686
0
}
11687
11688
/* Returns the "datapath_version" column's value from the "Datapath" table in 'row'
11689
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
11690
 * ovsdb_datum_find_key() is an easier and more efficient way to search
11691
 * for a given key than implementing the same operation on the "cooked"
11692
 * form in 'row'.
11693
 *
11694
 * 'key_type' must be OVSDB_TYPE_STRING.
11695
 * (This helps to avoid silent bugs if someone changes datapath_version's
11696
 * type without updating the caller.)
11697
 *
11698
 * The caller must not modify or free the returned value.
11699
 *
11700
 * Various kinds of changes can invalidate the returned value: modifying
11701
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11702
 * If the returned value is needed for a long time, it is best to make a copy
11703
 * of it with ovsdb_datum_clone().
11704
 *
11705
 * This function is rarely useful, since it is easier to access the value
11706
 * directly through the "datapath_version" member in ovsrec_datapath. */
11707
const struct ovsdb_datum *
11708
ovsrec_datapath_get_datapath_version(const struct ovsrec_datapath *row,
11709
  enum ovsdb_atomic_type key_type OVS_UNUSED)
11710
0
{
11711
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11712
0
    return ovsdb_idl_read(&row->header_, &ovsrec_datapath_col_datapath_version);
11713
0
}
11714
11715
/* Returns the "external_ids" column's value from the "Datapath" table in 'row'
11716
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
11717
 * ovsdb_datum_find_key() is an easier and more efficient way to search
11718
 * for a given key than implementing the same operation on the "cooked"
11719
 * form in 'row'.
11720
 *
11721
 * 'key_type' must be OVSDB_TYPE_STRING.
11722
 * 'value_type' must be OVSDB_TYPE_STRING.
11723
 * (This helps to avoid silent bugs if someone changes external_ids's
11724
 * type without updating the caller.)
11725
 *
11726
 * The caller must not modify or free the returned value.
11727
 *
11728
 * Various kinds of changes can invalidate the returned value: modifying
11729
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11730
 * If the returned value is needed for a long time, it is best to make a copy
11731
 * of it with ovsdb_datum_clone().
11732
 *
11733
 * This function is rarely useful, since it is easier to access the value
11734
 * directly through the "external_ids" member in ovsrec_datapath. */
11735
const struct ovsdb_datum *
11736
ovsrec_datapath_get_external_ids(const struct ovsrec_datapath *row,
11737
  enum ovsdb_atomic_type key_type OVS_UNUSED,
11738
  enum ovsdb_atomic_type value_type OVS_UNUSED)
11739
0
{
11740
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11741
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
11742
0
    return ovsdb_idl_read(&row->header_, &ovsrec_datapath_col_external_ids);
11743
0
}
11744
11745
/* Sets the "capabilities" column's value from the "Datapath" table in 'row'
11746
 * to 'capabilities'.
11747
 *
11748
 * The caller retains ownership of 'capabilities' and everything in it. */
11749
void
11750
ovsrec_datapath_set_capabilities(const struct ovsrec_datapath *row, const struct smap *capabilities)
11751
0
{
11752
0
    struct ovsdb_datum datum;
11753
11754
0
    if (capabilities) {
11755
0
        ovsdb_datum_from_smap(&datum, capabilities);
11756
0
    } else {
11757
0
        ovsdb_datum_init_empty(&datum);
11758
0
    }
11759
0
    ovsdb_idl_txn_write(&row->header_,
11760
0
                        &ovsrec_datapath_col_capabilities,
11761
0
                        &datum);
11762
0
}
11763
11764
11765
/* Sets the "ct_zones" column from the "Datapath" table in 'row' to
11766
 * the map with keys 'key_ct_zones' and values 'value_ct_zones'
11767
 * with 'n_ct_zones' entries.
11768
 *
11769
 * Argument constraints: key in range 0 to 65,535
11770
 *
11771
 * The caller retains ownership of the arguments. */
11772
void
11773
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)
11774
0
{
11775
0
    struct ovsdb_datum datum;
11776
11777
0
    datum.refcnt = NULL;
11778
11779
0
    datum.n = n_ct_zones;
11780
0
    datum.keys = n_ct_zones ? xmalloc(n_ct_zones * sizeof *datum.keys) : NULL;
11781
0
    datum.values = xmalloc(n_ct_zones * sizeof *datum.values);
11782
0
    for (size_t i = 0; i < n_ct_zones; i++) {
11783
0
        datum.keys[i].integer = key_ct_zones[i];
11784
0
        datum.values[i].uuid = value_ct_zones[i]->header_.uuid;
11785
0
    }
11786
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_datapath_col_ct_zones, &datum);
11787
0
}
11788
11789
/* Sets the "datapath_version" column from the "Datapath" table in 'row' to
11790
 * 'datapath_version'.
11791
 *
11792
 * The caller retains ownership of the arguments. */
11793
void
11794
ovsrec_datapath_set_datapath_version(const struct ovsrec_datapath *row, const char *datapath_version)
11795
0
{
11796
0
    struct ovsdb_datum datum;
11797
11798
0
    datum.refcnt = NULL;
11799
11800
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
11801
11802
0
    datum.n = 1;
11803
0
    datum.keys = key;
11804
0
    key->s = ovsdb_atom_string_create(datapath_version);
11805
0
    datum.values = NULL;
11806
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_datapath_col_datapath_version, &datum);
11807
0
}
11808
11809
/* Sets the "external_ids" column's value from the "Datapath" table in 'row'
11810
 * to 'external_ids'.
11811
 *
11812
 * The caller retains ownership of 'external_ids' and everything in it. */
11813
void
11814
ovsrec_datapath_set_external_ids(const struct ovsrec_datapath *row, const struct smap *external_ids)
11815
0
{
11816
0
    struct ovsdb_datum datum;
11817
11818
0
    if (external_ids) {
11819
0
        ovsdb_datum_from_smap(&datum, external_ids);
11820
0
    } else {
11821
0
        ovsdb_datum_init_empty(&datum);
11822
0
    }
11823
0
    ovsdb_idl_txn_write(&row->header_,
11824
0
                        &ovsrec_datapath_col_external_ids,
11825
0
                        &datum);
11826
0
}
11827
11828
11829
/* Sets an element of the "capabilities" map column from the "Datapath" table in 'row'
11830
 * to 'new_value' given the key value 'new_key'.
11831
 *
11832
 */
11833
void
11834
ovsrec_datapath_update_capabilities_setkey(const struct ovsrec_datapath *row, const char *new_key, const char *new_value)
11835
0
{
11836
0
    struct ovsdb_datum *datum;
11837
11838
0
    datum = xmalloc(sizeof *datum);
11839
0
    datum->n = 1;
11840
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
11841
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
11842
0
    datum->refcnt = NULL;
11843
11844
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
11845
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
11846
11847
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
11848
0
                                    &ovsrec_datapath_col_capabilities,
11849
0
                                    datum);
11850
0
}
11851
11852
/* Deletes an element of the "capabilities" map column from the "Datapath" table in 'row'
11853
 * given the key value 'delete_key'.
11854
 *
11855
 */
11856
void
11857
ovsrec_datapath_update_capabilities_delkey(const struct ovsrec_datapath *row, const char *delete_key)
11858
0
{
11859
0
    struct ovsdb_datum *datum;
11860
11861
0
    datum = xmalloc(sizeof *datum);
11862
0
    datum->n = 1;
11863
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
11864
0
    datum->values = NULL;
11865
0
    datum->refcnt = NULL;
11866
11867
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
11868
11869
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
11870
0
                                    &ovsrec_datapath_col_capabilities,
11871
0
                                    datum);
11872
0
}
11873
11874
/* Sets an element of the "ct_zones" map column from the "Datapath" table in 'row'
11875
 * to 'new_value' given the key value 'new_key'.
11876
 *
11877
 */
11878
void
11879
ovsrec_datapath_update_ct_zones_setkey(const struct ovsrec_datapath *row, int64_t new_key, const struct ovsrec_ct_zone *new_value)
11880
0
{
11881
0
    struct ovsdb_datum *datum;
11882
11883
0
    datum = xmalloc(sizeof *datum);
11884
0
    datum->n = 1;
11885
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
11886
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
11887
0
    datum->refcnt = NULL;
11888
11889
0
    datum->keys[0].integer = new_key;
11890
0
    datum->values[0].uuid = new_value->header_.uuid;
11891
11892
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
11893
0
                                    &ovsrec_datapath_col_ct_zones,
11894
0
                                    datum);
11895
0
}
11896
11897
/* Deletes an element of the "ct_zones" map column from the "Datapath" table in 'row'
11898
 * given the key value 'delete_key'.
11899
 *
11900
 */
11901
void
11902
ovsrec_datapath_update_ct_zones_delkey(const struct ovsrec_datapath *row, int64_t delete_key)
11903
0
{
11904
0
    struct ovsdb_datum *datum;
11905
11906
0
    datum = xmalloc(sizeof *datum);
11907
0
    datum->n = 1;
11908
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
11909
0
    datum->values = NULL;
11910
0
    datum->refcnt = NULL;
11911
11912
0
    datum->keys[0].integer = delete_key;
11913
11914
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
11915
0
                                    &ovsrec_datapath_col_ct_zones,
11916
0
                                    datum);
11917
0
}
11918
11919
/* Sets an element of the "external_ids" map column from the "Datapath" table in 'row'
11920
 * to 'new_value' given the key value 'new_key'.
11921
 *
11922
 */
11923
void
11924
ovsrec_datapath_update_external_ids_setkey(const struct ovsrec_datapath *row, const char *new_key, const char *new_value)
11925
0
{
11926
0
    struct ovsdb_datum *datum;
11927
11928
0
    datum = xmalloc(sizeof *datum);
11929
0
    datum->n = 1;
11930
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
11931
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
11932
0
    datum->refcnt = NULL;
11933
11934
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
11935
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
11936
11937
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
11938
0
                                    &ovsrec_datapath_col_external_ids,
11939
0
                                    datum);
11940
0
}
11941
11942
/* Deletes an element of the "external_ids" map column from the "Datapath" table in 'row'
11943
 * given the key value 'delete_key'.
11944
 *
11945
 */
11946
void
11947
ovsrec_datapath_update_external_ids_delkey(const struct ovsrec_datapath *row, const char *delete_key)
11948
0
{
11949
0
    struct ovsdb_datum *datum;
11950
11951
0
    datum = xmalloc(sizeof *datum);
11952
0
    datum->n = 1;
11953
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
11954
0
    datum->values = NULL;
11955
0
    datum->refcnt = NULL;
11956
11957
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
11958
11959
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
11960
0
                                    &ovsrec_datapath_col_external_ids,
11961
0
                                    datum);
11962
0
}
11963
11964
/* Sets the "capabilities" column's value from the "Datapath" table in 'row'
11965
 * to 'capabilities'.
11966
 *
11967
 * The caller retains ownership of 'capabilities' and everything in it. */
11968
void
11969
ovsrec_datapath_add_clause_capabilities(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *capabilities)
11970
0
{
11971
0
    struct ovsdb_datum datum;
11972
11973
0
    if (capabilities) {
11974
0
        ovsdb_datum_from_smap(&datum, capabilities);
11975
0
    } else {
11976
0
        ovsdb_datum_init_empty(&datum);
11977
0
    }
11978
11979
0
    ovsdb_idl_condition_add_clause(cond,
11980
0
                                   function,
11981
0
                                   &ovsrec_datapath_col_capabilities,
11982
0
                                   &datum);
11983
11984
0
    ovsdb_datum_destroy(&datum, &ovsrec_datapath_col_capabilities.type);
11985
0
}
11986
11987
11988
/* Sets the "ct_zones" column from the "Datapath" table in 'row' to
11989
 * the map with keys 'key_ct_zones' and values 'value_ct_zones'
11990
 * with 'n_ct_zones' entries.
11991
 *
11992
 * Argument constraints: key in range 0 to 65,535
11993
 *
11994
 * The caller retains ownership of the arguments. */
11995
void
11996
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)
11997
0
{
11998
0
    struct ovsdb_datum datum;
11999
12000
0
    datum.refcnt = NULL;
12001
0
    datum.n = n_ct_zones;
12002
0
    datum.keys = n_ct_zones ? xmalloc(n_ct_zones * sizeof *datum.keys) : NULL;
12003
0
    datum.values = xmalloc(n_ct_zones * sizeof *datum.values);
12004
0
    for (size_t i = 0; i < n_ct_zones; i++) {
12005
0
        datum.keys[i].integer = key_ct_zones[i];
12006
0
        datum.values[i].uuid = *value_ct_zones[i];
12007
0
    }
12008
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_datapath_col_ct_zones.type);
12009
0
    ovsdb_idl_condition_add_clause(cond,
12010
0
                          function,
12011
0
                          &ovsrec_datapath_col_ct_zones,
12012
0
                          &datum);
12013
0
    ovsdb_datum_destroy(&datum, &ovsrec_datapath_col_ct_zones.type);
12014
0
}
12015
12016
/* Sets the "datapath_version" column from the "Datapath" table in 'row' to
12017
 * 'datapath_version'.
12018
 *
12019
 * The caller retains ownership of the arguments. */
12020
void
12021
ovsrec_datapath_add_clause_datapath_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *datapath_version)
12022
0
{
12023
0
    struct ovsdb_datum datum;
12024
12025
0
    datum.refcnt = NULL;
12026
12027
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
12028
12029
0
    datum.n = 1;
12030
0
    datum.keys = key;
12031
0
    key->s = ovsdb_atom_string_create(datapath_version);
12032
0
    datum.values = NULL;
12033
0
    ovsdb_idl_condition_add_clause(cond,
12034
0
                          function,
12035
0
                          &ovsrec_datapath_col_datapath_version,
12036
0
                          &datum);
12037
0
    ovsdb_datum_destroy(&datum, &ovsrec_datapath_col_datapath_version.type);
12038
0
}
12039
12040
/* Sets the "external_ids" column's value from the "Datapath" table in 'row'
12041
 * to 'external_ids'.
12042
 *
12043
 * The caller retains ownership of 'external_ids' and everything in it. */
12044
void
12045
ovsrec_datapath_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
12046
0
{
12047
0
    struct ovsdb_datum datum;
12048
12049
0
    if (external_ids) {
12050
0
        ovsdb_datum_from_smap(&datum, external_ids);
12051
0
    } else {
12052
0
        ovsdb_datum_init_empty(&datum);
12053
0
    }
12054
12055
0
    ovsdb_idl_condition_add_clause(cond,
12056
0
                                   function,
12057
0
                                   &ovsrec_datapath_col_external_ids,
12058
0
                                   &datum);
12059
12060
0
    ovsdb_datum_destroy(&datum, &ovsrec_datapath_col_external_ids.type);
12061
0
}
12062
12063
12064
/* Destroy 'row' of kind "Datapath". The row must have been
12065
 * created with ovsdb_idl_index_init_row.
12066
 */
12067
void
12068
ovsrec_datapath_index_destroy_row(const struct ovsrec_datapath *row)
12069
0
{
12070
0
    ovsdb_idl_index_destroy_row(&row->header_);
12071
0
}
12072
        
12073
12074
/* Creates a new row of kind "Datapath". */
12075
struct ovsrec_datapath *
12076
ovsrec_datapath_index_init_row(struct ovsdb_idl_index *index)
12077
0
{
12078
0
    ovs_assert(index->table->class_ == &ovsrec_table_datapath);
12079
0
    return ALIGNED_CAST(struct ovsrec_datapath *, ovsdb_idl_index_init_row(index));
12080
0
}
12081
12082
struct ovsrec_datapath *
12083
ovsrec_datapath_index_find(struct ovsdb_idl_index *index, const struct ovsrec_datapath *target)
12084
0
{
12085
0
    ovs_assert(index->table->class_ == &ovsrec_table_datapath);
12086
0
    return ovsrec_datapath_cast(ovsdb_idl_index_find(index, &target->header_));
12087
0
}
12088
12089
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
12090
int
12091
ovsrec_datapath_index_compare(
12092
    struct ovsdb_idl_index *index, 
12093
    const struct ovsrec_datapath *a, 
12094
    const struct ovsrec_datapath *b)
12095
0
{
12096
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
12097
0
}
12098
12099
struct ovsdb_idl_cursor
12100
ovsrec_datapath_cursor_first(struct ovsdb_idl_index *index)
12101
0
{
12102
0
    ovs_assert(index->table->class_ == &ovsrec_table_datapath);
12103
0
    return ovsdb_idl_cursor_first(index);
12104
0
}
12105
12106
struct ovsdb_idl_cursor
12107
ovsrec_datapath_cursor_first_eq(
12108
    struct ovsdb_idl_index *index, const struct ovsrec_datapath *target)
12109
0
{
12110
0
    ovs_assert(index->table->class_ == &ovsrec_table_datapath);
12111
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
12112
0
}
12113
12114
struct ovsdb_idl_cursor
12115
ovsrec_datapath_cursor_first_ge(
12116
    struct ovsdb_idl_index *index, const struct ovsrec_datapath *target)
12117
0
{
12118
0
    ovs_assert(index->table->class_ == &ovsrec_table_datapath);
12119
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
12120
0
}
12121
12122
struct ovsrec_datapath *
12123
ovsrec_datapath_cursor_data(struct ovsdb_idl_cursor *cursor)
12124
0
{
12125
0
    return ovsrec_datapath_cast(ovsdb_idl_cursor_data(cursor));
12126
0
}
12127
12128
12129
/* Sets the "capabilities" column's value from the "Datapath" table in 'row'
12130
 * to 'capabilities'.
12131
 *
12132
 * The caller retains ownership of 'capabilities' and everything in it. */
12133
void
12134
ovsrec_datapath_index_set_capabilities(const struct ovsrec_datapath *row, const struct smap *capabilities)
12135
0
{
12136
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
12137
12138
0
    if (capabilities) {
12139
0
        struct smap_node *node;
12140
0
        size_t i;
12141
12142
0
        datum->n = smap_count(capabilities);
12143
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12144
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
12145
0
        datum->refcnt = NULL;
12146
12147
0
        i = 0;
12148
0
        SMAP_FOR_EACH (node, capabilities) {
12149
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
12150
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
12151
0
            i++;
12152
0
        }
12153
0
        ovsdb_datum_sort_unique(datum, &ovsrec_datapath_col_capabilities.type);
12154
0
    } else {
12155
0
        ovsdb_datum_init_empty(datum);
12156
0
    }
12157
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
12158
0
                          &ovsrec_datapath_columns[OVSREC_DATAPATH_COL_CAPABILITIES],
12159
0
                          datum,
12160
0
                          &ovsrec_table_classes[OVSREC_TABLE_DATAPATH]);
12161
0
    free(datum);
12162
0
}
12163
12164
12165
/* Sets the "ct_zones" column from the "Datapath" table in 'row' to
12166
 * the map with keys 'key_ct_zones' and values 'value_ct_zones'
12167
 * with 'n_ct_zones' entries.
12168
 *
12169
 * Argument constraints: key in range 0 to 65,535
12170
 *
12171
 * The caller retains ownership of the arguments. */
12172
void
12173
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)
12174
0
{
12175
0
    struct ovsdb_datum datum;
12176
12177
0
    datum.refcnt = NULL;
12178
0
    size_t i;
12179
12180
0
    datum.n = n_ct_zones;
12181
0
    datum.keys = n_ct_zones ? xmalloc(n_ct_zones * sizeof *datum.keys) : NULL;
12182
0
    datum.values = xmalloc(n_ct_zones * sizeof *datum.values);
12183
0
    for (i = 0; i < n_ct_zones; i++) {
12184
0
        datum.keys[i].integer = key_ct_zones[i];
12185
0
        datum.values[i].uuid = value_ct_zones[i]->header_.uuid;
12186
0
    }
12187
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_datapath_col_ct_zones.type);
12188
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]);
12189
0
}
12190
12191
/* Sets the "datapath_version" column from the "Datapath" table in 'row' to
12192
 * 'datapath_version'.
12193
 *
12194
 * The caller retains ownership of the arguments. */
12195
void
12196
ovsrec_datapath_index_set_datapath_version(const struct ovsrec_datapath *row, const char *datapath_version)
12197
0
{
12198
0
    struct ovsdb_datum datum;
12199
12200
0
    datum.refcnt = NULL;
12201
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
12202
12203
0
    datum.n = 1;
12204
0
    datum.keys = key;
12205
0
    key->s = ovsdb_atom_string_create(datapath_version);
12206
0
    datum.values = NULL;
12207
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]);
12208
0
}
12209
12210
/* Sets the "external_ids" column's value from the "Datapath" table in 'row'
12211
 * to 'external_ids'.
12212
 *
12213
 * The caller retains ownership of 'external_ids' and everything in it. */
12214
void
12215
ovsrec_datapath_index_set_external_ids(const struct ovsrec_datapath *row, const struct smap *external_ids)
12216
0
{
12217
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
12218
12219
0
    if (external_ids) {
12220
0
        struct smap_node *node;
12221
0
        size_t i;
12222
12223
0
        datum->n = smap_count(external_ids);
12224
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12225
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
12226
0
        datum->refcnt = NULL;
12227
12228
0
        i = 0;
12229
0
        SMAP_FOR_EACH (node, external_ids) {
12230
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
12231
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
12232
0
            i++;
12233
0
        }
12234
0
        ovsdb_datum_sort_unique(datum, &ovsrec_datapath_col_external_ids.type);
12235
0
    } else {
12236
0
        ovsdb_datum_init_empty(datum);
12237
0
    }
12238
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
12239
0
                          &ovsrec_datapath_columns[OVSREC_DATAPATH_COL_EXTERNAL_IDS],
12240
0
                          datum,
12241
0
                          &ovsrec_table_classes[OVSREC_TABLE_DATAPATH]);
12242
0
    free(datum);
12243
0
}
12244
12245
12246
struct ovsdb_idl_column ovsrec_datapath_columns[OVSREC_DATAPATH_N_COLUMNS];
12247
12248
unsigned int
12249
ovsrec_datapath_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
12250
0
{
12251
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_datapath, condition);
12252
0
}
12253
12254
struct ovsdb_idl_column ovsrec_datapath_columns[OVSREC_DATAPATH_N_COLUMNS] = {
12255
    [OVSREC_DATAPATH_COL_CAPABILITIES] = {
12256
         .name = "capabilities",
12257
         .type = {
12258
            .key = {
12259
               .type = OVSDB_TYPE_STRING,
12260
               .string = { .minLen = 0, .maxLen = UINT_MAX },
12261
            },
12262
            .value = {
12263
                .type = OVSDB_TYPE_STRING,
12264
                .string = { .minLen = 0, .maxLen = UINT_MAX },
12265
            },
12266
            .n_min = 0,
12267
            .n_max = UINT_MAX,
12268
         },
12269
         .is_mutable = true,
12270
         .is_synthetic = false,
12271
         .parse = ovsrec_datapath_parse_capabilities,
12272
         .unparse = ovsrec_datapath_unparse_capabilities,
12273
    },
12274
12275
    [OVSREC_DATAPATH_COL_CT_ZONES] = {
12276
         .name = "ct_zones",
12277
         .type = {
12278
            .key = {
12279
               .type = OVSDB_TYPE_INTEGER,
12280
               .integer = { .min = INT64_C(0), .max = INT64_C(65535) },
12281
            },
12282
            .value = {
12283
                .type = OVSDB_TYPE_UUID,
12284
                .uuid = { .refTableName = "CT_Zone", .refType = OVSDB_REF_STRONG },
12285
            },
12286
            .n_min = 0,
12287
            .n_max = UINT_MAX,
12288
         },
12289
         .is_mutable = true,
12290
         .is_synthetic = false,
12291
         .parse = ovsrec_datapath_parse_ct_zones,
12292
         .unparse = ovsrec_datapath_unparse_ct_zones,
12293
    },
12294
12295
    [OVSREC_DATAPATH_COL_DATAPATH_VERSION] = {
12296
         .name = "datapath_version",
12297
         .type = {
12298
            .key = {
12299
               .type = OVSDB_TYPE_STRING,
12300
               .string = { .minLen = 0, .maxLen = UINT_MAX },
12301
            },
12302
            .value = OVSDB_BASE_VOID_INIT,
12303
            .n_min = 1,
12304
            .n_max = 1,
12305
         },
12306
         .is_mutable = true,
12307
         .is_synthetic = false,
12308
         .parse = ovsrec_datapath_parse_datapath_version,
12309
         .unparse = ovsrec_datapath_unparse_datapath_version,
12310
    },
12311
12312
    [OVSREC_DATAPATH_COL_EXTERNAL_IDS] = {
12313
         .name = "external_ids",
12314
         .type = {
12315
            .key = {
12316
               .type = OVSDB_TYPE_STRING,
12317
               .string = { .minLen = 0, .maxLen = UINT_MAX },
12318
            },
12319
            .value = {
12320
                .type = OVSDB_TYPE_STRING,
12321
                .string = { .minLen = 0, .maxLen = UINT_MAX },
12322
            },
12323
            .n_min = 0,
12324
            .n_max = UINT_MAX,
12325
         },
12326
         .is_mutable = true,
12327
         .is_synthetic = false,
12328
         .parse = ovsrec_datapath_parse_external_ids,
12329
         .unparse = ovsrec_datapath_unparse_external_ids,
12330
    },
12331
12332
};
12333

12334
/* Flow_Sample_Collector_Set table. */
12335
12336
bool
12337
ovsrec_server_has_flow_sample_collector_set_table_col_bridge(const struct ovsdb_idl *idl)
12338
0
{
12339
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_sample_collector_set_col_bridge);
12340
0
}
12341
12342
12343
bool
12344
ovsrec_server_has_flow_sample_collector_set_table_col_external_ids(const struct ovsdb_idl *idl)
12345
0
{
12346
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_sample_collector_set_col_external_ids);
12347
0
}
12348
12349
12350
bool
12351
ovsrec_server_has_flow_sample_collector_set_table_col_id(const struct ovsdb_idl *idl)
12352
0
{
12353
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_sample_collector_set_col_id);
12354
0
}
12355
12356
12357
bool
12358
ovsrec_server_has_flow_sample_collector_set_table_col_ipfix(const struct ovsdb_idl *idl)
12359
0
{
12360
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_sample_collector_set_col_ipfix);
12361
0
}
12362
12363
12364
bool
12365
ovsrec_server_has_flow_sample_collector_set_table(const struct ovsdb_idl *idl)
12366
0
{
12367
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET]);
12368
0
}
12369
12370
12371
const struct ovsrec_flow_sample_collector_set_table *
12372
ovsrec_flow_sample_collector_set_table_get(const struct ovsdb_idl *idl)
12373
0
{
12374
0
    return (const struct ovsrec_flow_sample_collector_set_table *) idl;
12375
0
}
12376
12377
const struct ovsrec_flow_sample_collector_set *
12378
ovsrec_flow_sample_collector_set_table_first(const struct ovsrec_flow_sample_collector_set_table *table)
12379
0
{
12380
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
12381
0
    return ovsrec_flow_sample_collector_set_first(idl);
12382
0
}
12383
12384
12385
const struct ovsrec_flow_sample_collector_set *
12386
ovsrec_flow_sample_collector_set_table_track_get_first(const struct ovsrec_flow_sample_collector_set_table *table)
12387
0
{
12388
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
12389
0
    return ovsrec_flow_sample_collector_set_track_get_first(idl);
12390
0
}
12391
12392
12393
static void
12394
ovsrec_flow_sample_collector_set_parse_bridge(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12395
0
{
12396
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
12397
12398
0
    if (datum->n >= 1) {
12399
0
        row->bridge = ovsrec_bridge_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_bridge, &datum->keys[0].uuid));
12400
0
    } else {
12401
0
        row->bridge = NULL;
12402
0
    }
12403
0
}
12404
12405
static void
12406
ovsrec_flow_sample_collector_set_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12407
0
{
12408
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
12409
0
    smap_init(&row->external_ids);
12410
0
    for (size_t i = 0; i < datum->n; i++) {
12411
0
        smap_add(&row->external_ids,
12412
0
                 json_string(datum->keys[i].s),
12413
0
                 json_string(datum->values[i].s));
12414
0
    }
12415
0
}
12416
12417
static void
12418
ovsrec_flow_sample_collector_set_parse_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12419
0
{
12420
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
12421
12422
0
    if (datum->n >= 1) {
12423
0
        row->id = datum->keys[0].integer;
12424
0
    } else {
12425
0
        row->id = 0;
12426
0
    }
12427
0
}
12428
12429
static void
12430
ovsrec_flow_sample_collector_set_parse_ipfix(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12431
0
{
12432
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
12433
12434
0
    if (datum->n >= 1) {
12435
0
        row->ipfix = ovsrec_ipfix_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_ipfix, &datum->keys[0].uuid));
12436
0
    } else {
12437
0
        row->ipfix = NULL;
12438
0
    }
12439
0
}
12440
12441
static void
12442
ovsrec_flow_sample_collector_set_unparse_bridge(struct ovsdb_idl_row *row OVS_UNUSED)
12443
0
{
12444
    /* Nothing to do. */
12445
0
}
12446
12447
static void
12448
ovsrec_flow_sample_collector_set_unparse_external_ids(struct ovsdb_idl_row *row_)
12449
0
{
12450
0
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
12451
0
    smap_destroy(&row->external_ids);
12452
0
}
12453
12454
static void
12455
ovsrec_flow_sample_collector_set_unparse_id(struct ovsdb_idl_row *row OVS_UNUSED)
12456
0
{
12457
    /* Nothing to do. */
12458
0
}
12459
12460
static void
12461
ovsrec_flow_sample_collector_set_unparse_ipfix(struct ovsdb_idl_row *row OVS_UNUSED)
12462
0
{
12463
    /* Nothing to do. */
12464
0
}
12465
12466
static void
12467
ovsrec_flow_sample_collector_set_init__(struct ovsdb_idl_row *row)
12468
0
{
12469
0
    ovsrec_flow_sample_collector_set_init(ovsrec_flow_sample_collector_set_cast(row));
12470
0
}
12471
12472
/* Clears the contents of 'row' in table "Flow_Sample_Collector_Set". */
12473
void
12474
ovsrec_flow_sample_collector_set_init(struct ovsrec_flow_sample_collector_set *row)
12475
0
{
12476
0
    memset(row, 0, sizeof *row); 
12477
0
    smap_init(&row->external_ids);
12478
0
}
12479
12480
/* Searches table "Flow_Sample_Collector_Set" in 'idl' for a row with UUID 'uuid'.  Returns
12481
 * a pointer to the row if there is one, otherwise a null pointer.  */
12482
const struct ovsrec_flow_sample_collector_set *
12483
ovsrec_flow_sample_collector_set_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
12484
0
{
12485
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_flow_sample_collector_set, uuid));
12486
0
}
12487
12488
/* Searches table "Flow_Sample_Collector_Set" for a row with UUID 'uuid'.  Returns
12489
 * a pointer to the row if there is one, otherwise a null pointer.  */
12490
const struct ovsrec_flow_sample_collector_set *
12491
ovsrec_flow_sample_collector_set_table_get_for_uuid(const struct ovsrec_flow_sample_collector_set_table *table, const struct uuid *uuid)
12492
0
{
12493
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
12494
0
    return ovsrec_flow_sample_collector_set_get_for_uuid(idl, uuid);
12495
0
}
12496
12497
/* Returns a row in table "Flow_Sample_Collector_Set" in 'idl', or a null pointer if that
12498
 * table is empty.
12499
 *
12500
 * Database tables are internally maintained as hash tables, so adding or
12501
 * removing rows while traversing the same table can cause some rows to be
12502
 * visited twice or not at apply. */
12503
const struct ovsrec_flow_sample_collector_set *
12504
ovsrec_flow_sample_collector_set_first(const struct ovsdb_idl *idl)
12505
0
{
12506
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_first_row(idl, &ovsrec_table_flow_sample_collector_set));
12507
0
}
12508
12509
/* Returns a row following 'row' within its table, or a null pointer if 'row'
12510
 * is the last row in its table. */
12511
const struct ovsrec_flow_sample_collector_set *
12512
ovsrec_flow_sample_collector_set_next(const struct ovsrec_flow_sample_collector_set *row)
12513
0
{
12514
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_next_row(&row->header_));
12515
0
}
12516
12517
unsigned int ovsrec_flow_sample_collector_set_get_seqno(const struct ovsdb_idl *idl)
12518
0
{
12519
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_flow_sample_collector_set);
12520
0
}
12521
12522
unsigned int ovsrec_flow_sample_collector_set_row_get_seqno(const struct ovsrec_flow_sample_collector_set *row, enum ovsdb_idl_change change)
12523
0
{
12524
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
12525
0
}
12526
12527
const struct ovsrec_flow_sample_collector_set *
12528
ovsrec_flow_sample_collector_set_track_get_first(const struct ovsdb_idl *idl)
12529
0
{
12530
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_flow_sample_collector_set));
12531
0
}
12532
12533
const struct ovsrec_flow_sample_collector_set
12534
*ovsrec_flow_sample_collector_set_track_get_next(const struct ovsrec_flow_sample_collector_set *row)
12535
0
{
12536
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_track_get_next(&row->header_));
12537
0
}
12538
12539
12540
/* Deletes 'row' from table "Flow_Sample_Collector_Set".  'row' may be freed, so it must not be
12541
 * accessed afterward.
12542
 *
12543
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12544
void
12545
ovsrec_flow_sample_collector_set_delete(const struct ovsrec_flow_sample_collector_set *row)
12546
0
{
12547
0
    ovsdb_idl_txn_delete(&row->header_);
12548
0
}
12549
12550
/* Inserts and returns a new row in the table "Flow_Sample_Collector_Set" in the database
12551
 * with open transaction 'txn'.
12552
 *
12553
 * The new row is assigned a randomly generated provisional UUID.
12554
 * ovsdb-server will assign a different UUID when 'txn' is committed,
12555
 * but the IDL will replace any uses of the provisional UUID in the
12556
 * data to be to be committed by the UUID assigned by ovsdb-server. */
12557
struct ovsrec_flow_sample_collector_set *
12558
ovsrec_flow_sample_collector_set_insert(struct ovsdb_idl_txn *txn)
12559
0
{
12560
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_flow_sample_collector_set, NULL));
12561
0
}
12562
12563
/* Inserts and returns a new row in the table "Flow_Sample_Collector_Set" in the database
12564
 * with open transaction 'txn'.
12565
 *
12566
 * The new row is assigned the UUID specified in the 'uuid' parameter
12567
 * (which cannot be null).  ovsdb-server will try to assign the same
12568
 * UUID when 'txn' is committed. */
12569
struct ovsrec_flow_sample_collector_set *
12570
ovsrec_flow_sample_collector_set_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
12571
0
{
12572
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_txn_insert_persist_uuid(
12573
0
        txn, &ovsrec_table_flow_sample_collector_set, uuid));
12574
0
}
12575
12576
bool
12577
ovsrec_flow_sample_collector_set_is_updated(const struct ovsrec_flow_sample_collector_set *row, enum ovsrec_flow_sample_collector_set_column_id column)
12578
0
{
12579
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_flow_sample_collector_set_columns[column]);
12580
0
}
12581
12582
/* Causes the original contents of column "bridge" in 'row' to be
12583
 * verified as a prerequisite to completing the transaction.  That is, if
12584
 * "bridge" in 'row' changed (or if 'row' was deleted) between the
12585
 * time that the IDL originally read its contents and the time that the
12586
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
12587
 *
12588
 * The intention is that, to ensure that no transaction commits based on dirty
12589
 * reads, an application should call this function any time "bridge" is
12590
 * read as part of a read-modify-write operation.
12591
 *
12592
 * In some cases this function reduces to a no-op, because the current value
12593
 * of "bridge" is already known:
12594
 *
12595
 *   - If 'row' is a row created by the current transaction (returned by
12596
 *     ovsrec_flow_sample_collector_set_insert()).
12597
 *
12598
 *   - If "bridge" has already been modified (with
12599
 *     ovsrec_flow_sample_collector_set_set_bridge()) within the current transaction.
12600
 *
12601
 * Because of the latter property, always call this function *before*
12602
 * ovsrec_flow_sample_collector_set_set_bridge() for a given read-modify-write.
12603
 *
12604
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12605
void
12606
ovsrec_flow_sample_collector_set_verify_bridge(const struct ovsrec_flow_sample_collector_set *row)
12607
0
{
12608
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_col_bridge);
12609
0
}
12610
12611
/* Causes the original contents of column "external_ids" in 'row' to be
12612
 * verified as a prerequisite to completing the transaction.  That is, if
12613
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
12614
 * time that the IDL originally read its contents and the time that the
12615
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
12616
 *
12617
 * The intention is that, to ensure that no transaction commits based on dirty
12618
 * reads, an application should call this function any time "external_ids" is
12619
 * read as part of a read-modify-write operation.
12620
 *
12621
 * In some cases this function reduces to a no-op, because the current value
12622
 * of "external_ids" is already known:
12623
 *
12624
 *   - If 'row' is a row created by the current transaction (returned by
12625
 *     ovsrec_flow_sample_collector_set_insert()).
12626
 *
12627
 *   - If "external_ids" has already been modified (with
12628
 *     ovsrec_flow_sample_collector_set_set_external_ids()) within the current transaction.
12629
 *
12630
 * Because of the latter property, always call this function *before*
12631
 * ovsrec_flow_sample_collector_set_set_external_ids() for a given read-modify-write.
12632
 *
12633
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12634
void
12635
ovsrec_flow_sample_collector_set_verify_external_ids(const struct ovsrec_flow_sample_collector_set *row)
12636
0
{
12637
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_col_external_ids);
12638
0
}
12639
12640
/* Causes the original contents of column "id" in 'row' to be
12641
 * verified as a prerequisite to completing the transaction.  That is, if
12642
 * "id" in 'row' changed (or if 'row' was deleted) between the
12643
 * time that the IDL originally read its contents and the time that the
12644
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
12645
 *
12646
 * The intention is that, to ensure that no transaction commits based on dirty
12647
 * reads, an application should call this function any time "id" is
12648
 * read as part of a read-modify-write operation.
12649
 *
12650
 * In some cases this function reduces to a no-op, because the current value
12651
 * of "id" is already known:
12652
 *
12653
 *   - If 'row' is a row created by the current transaction (returned by
12654
 *     ovsrec_flow_sample_collector_set_insert()).
12655
 *
12656
 *   - If "id" has already been modified (with
12657
 *     ovsrec_flow_sample_collector_set_set_id()) within the current transaction.
12658
 *
12659
 * Because of the latter property, always call this function *before*
12660
 * ovsrec_flow_sample_collector_set_set_id() for a given read-modify-write.
12661
 *
12662
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12663
void
12664
ovsrec_flow_sample_collector_set_verify_id(const struct ovsrec_flow_sample_collector_set *row)
12665
0
{
12666
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_col_id);
12667
0
}
12668
12669
/* Causes the original contents of column "ipfix" in 'row' to be
12670
 * verified as a prerequisite to completing the transaction.  That is, if
12671
 * "ipfix" in 'row' changed (or if 'row' was deleted) between the
12672
 * time that the IDL originally read its contents and the time that the
12673
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
12674
 *
12675
 * The intention is that, to ensure that no transaction commits based on dirty
12676
 * reads, an application should call this function any time "ipfix" is
12677
 * read as part of a read-modify-write operation.
12678
 *
12679
 * In some cases this function reduces to a no-op, because the current value
12680
 * of "ipfix" is already known:
12681
 *
12682
 *   - If 'row' is a row created by the current transaction (returned by
12683
 *     ovsrec_flow_sample_collector_set_insert()).
12684
 *
12685
 *   - If "ipfix" has already been modified (with
12686
 *     ovsrec_flow_sample_collector_set_set_ipfix()) within the current transaction.
12687
 *
12688
 * Because of the latter property, always call this function *before*
12689
 * ovsrec_flow_sample_collector_set_set_ipfix() for a given read-modify-write.
12690
 *
12691
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
12692
void
12693
ovsrec_flow_sample_collector_set_verify_ipfix(const struct ovsrec_flow_sample_collector_set *row)
12694
0
{
12695
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_col_ipfix);
12696
0
}
12697
12698
/* Returns the "bridge" column's value from the "Flow_Sample_Collector_Set" table in 'row'
12699
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
12700
 * ovsdb_datum_find_key() is an easier and more efficient way to search
12701
 * for a given key than implementing the same operation on the "cooked"
12702
 * form in 'row'.
12703
 *
12704
 * 'key_type' must be OVSDB_TYPE_UUID.
12705
 * (This helps to avoid silent bugs if someone changes bridge's
12706
 * type without updating the caller.)
12707
 *
12708
 * The caller must not modify or free the returned value.
12709
 *
12710
 * Various kinds of changes can invalidate the returned value: modifying
12711
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12712
 * If the returned value is needed for a long time, it is best to make a copy
12713
 * of it with ovsdb_datum_clone().
12714
 *
12715
 * This function is rarely useful, since it is easier to access the value
12716
 * directly through the "bridge" member in ovsrec_flow_sample_collector_set. */
12717
const struct ovsdb_datum *
12718
ovsrec_flow_sample_collector_set_get_bridge(const struct ovsrec_flow_sample_collector_set *row,
12719
  enum ovsdb_atomic_type key_type OVS_UNUSED)
12720
0
{
12721
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
12722
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_bridge);
12723
0
}
12724
12725
/* Returns the "external_ids" column's value from the "Flow_Sample_Collector_Set" table in 'row'
12726
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
12727
 * ovsdb_datum_find_key() is an easier and more efficient way to search
12728
 * for a given key than implementing the same operation on the "cooked"
12729
 * form in 'row'.
12730
 *
12731
 * 'key_type' must be OVSDB_TYPE_STRING.
12732
 * 'value_type' must be OVSDB_TYPE_STRING.
12733
 * (This helps to avoid silent bugs if someone changes external_ids's
12734
 * type without updating the caller.)
12735
 *
12736
 * The caller must not modify or free the returned value.
12737
 *
12738
 * Various kinds of changes can invalidate the returned value: modifying
12739
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12740
 * If the returned value is needed for a long time, it is best to make a copy
12741
 * of it with ovsdb_datum_clone().
12742
 *
12743
 * This function is rarely useful, since it is easier to access the value
12744
 * directly through the "external_ids" member in ovsrec_flow_sample_collector_set. */
12745
const struct ovsdb_datum *
12746
ovsrec_flow_sample_collector_set_get_external_ids(const struct ovsrec_flow_sample_collector_set *row,
12747
  enum ovsdb_atomic_type key_type OVS_UNUSED,
12748
  enum ovsdb_atomic_type value_type OVS_UNUSED)
12749
0
{
12750
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
12751
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
12752
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_external_ids);
12753
0
}
12754
12755
/* Returns the "id" column's value from the "Flow_Sample_Collector_Set" table in 'row'
12756
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
12757
 * ovsdb_datum_find_key() is an easier and more efficient way to search
12758
 * for a given key than implementing the same operation on the "cooked"
12759
 * form in 'row'.
12760
 *
12761
 * 'key_type' must be OVSDB_TYPE_INTEGER.
12762
 * (This helps to avoid silent bugs if someone changes id's
12763
 * type without updating the caller.)
12764
 *
12765
 * The caller must not modify or free the returned value.
12766
 *
12767
 * Various kinds of changes can invalidate the returned value: modifying
12768
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12769
 * If the returned value is needed for a long time, it is best to make a copy
12770
 * of it with ovsdb_datum_clone().
12771
 *
12772
 * This function is rarely useful, since it is easier to access the value
12773
 * directly through the "id" member in ovsrec_flow_sample_collector_set. */
12774
const struct ovsdb_datum *
12775
ovsrec_flow_sample_collector_set_get_id(const struct ovsrec_flow_sample_collector_set *row,
12776
  enum ovsdb_atomic_type key_type OVS_UNUSED)
12777
0
{
12778
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
12779
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_id);
12780
0
}
12781
12782
/* Returns the "ipfix" column's value from the "Flow_Sample_Collector_Set" table in 'row'
12783
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
12784
 * ovsdb_datum_find_key() is an easier and more efficient way to search
12785
 * for a given key than implementing the same operation on the "cooked"
12786
 * form in 'row'.
12787
 *
12788
 * 'key_type' must be OVSDB_TYPE_UUID.
12789
 * (This helps to avoid silent bugs if someone changes ipfix's
12790
 * type without updating the caller.)
12791
 *
12792
 * The caller must not modify or free the returned value.
12793
 *
12794
 * Various kinds of changes can invalidate the returned value: modifying
12795
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12796
 * If the returned value is needed for a long time, it is best to make a copy
12797
 * of it with ovsdb_datum_clone().
12798
 *
12799
 * This function is rarely useful, since it is easier to access the value
12800
 * directly through the "ipfix" member in ovsrec_flow_sample_collector_set. */
12801
const struct ovsdb_datum *
12802
ovsrec_flow_sample_collector_set_get_ipfix(const struct ovsrec_flow_sample_collector_set *row,
12803
  enum ovsdb_atomic_type key_type OVS_UNUSED)
12804
0
{
12805
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
12806
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_ipfix);
12807
0
}
12808
12809
/* Sets the "bridge" column from the "Flow_Sample_Collector_Set" table in 'row' to
12810
 * 'bridge'.
12811
 *
12812
 * The caller retains ownership of the arguments. */
12813
void
12814
ovsrec_flow_sample_collector_set_set_bridge(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_bridge *bridge)
12815
0
{
12816
0
    struct ovsdb_datum datum;
12817
12818
0
    datum.refcnt = NULL;
12819
12820
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
12821
12822
0
    datum.n = 1;
12823
0
    datum.keys = key;
12824
0
    key->uuid = bridge->header_.uuid;
12825
0
    datum.values = NULL;
12826
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_sample_collector_set_col_bridge, &datum);
12827
0
}
12828
12829
/* Sets the "external_ids" column's value from the "Flow_Sample_Collector_Set" table in 'row'
12830
 * to 'external_ids'.
12831
 *
12832
 * The caller retains ownership of 'external_ids' and everything in it. */
12833
void
12834
ovsrec_flow_sample_collector_set_set_external_ids(const struct ovsrec_flow_sample_collector_set *row, const struct smap *external_ids)
12835
0
{
12836
0
    struct ovsdb_datum datum;
12837
12838
0
    if (external_ids) {
12839
0
        ovsdb_datum_from_smap(&datum, external_ids);
12840
0
    } else {
12841
0
        ovsdb_datum_init_empty(&datum);
12842
0
    }
12843
0
    ovsdb_idl_txn_write(&row->header_,
12844
0
                        &ovsrec_flow_sample_collector_set_col_external_ids,
12845
0
                        &datum);
12846
0
}
12847
12848
12849
/* Sets the "id" column from the "Flow_Sample_Collector_Set" table in 'row' to
12850
 * 'id'.
12851
 *
12852
 * Argument constraints: in range 0 to 4,294,967,295
12853
 *
12854
 * The caller retains ownership of the arguments. */
12855
void
12856
ovsrec_flow_sample_collector_set_set_id(const struct ovsrec_flow_sample_collector_set *row, int64_t id)
12857
0
{
12858
0
    struct ovsdb_datum datum;
12859
12860
0
    datum.refcnt = NULL;
12861
12862
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
12863
12864
0
    datum.n = 1;
12865
0
    datum.keys = key;
12866
0
    key->integer = id;
12867
0
    datum.values = NULL;
12868
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_sample_collector_set_col_id, &datum);
12869
0
}
12870
12871
/* Sets the "ipfix" column from the "Flow_Sample_Collector_Set" table in 'row' to
12872
 * the 'ipfix' set.
12873
 *
12874
 * If "ipfix" is null, the column will be the empty set,
12875
 * otherwise it will contain the specified value.
12876
 *
12877
 * The caller retains ownership of the arguments. */
12878
void
12879
ovsrec_flow_sample_collector_set_set_ipfix(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_ipfix *ipfix)
12880
0
{
12881
0
    struct ovsdb_datum datum;
12882
12883
0
    datum.refcnt = NULL;
12884
12885
0
    if (ipfix) {
12886
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
12887
0
        datum.n = 1;
12888
0
        datum.keys = key;
12889
0
        key->uuid = ipfix->header_.uuid;
12890
0
    } else {
12891
0
        datum.n = 0;
12892
0
        datum.keys = NULL;
12893
0
    }
12894
0
    datum.values = NULL;
12895
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_sample_collector_set_col_ipfix, &datum);
12896
0
}
12897
12898
/* Sets an element of the "external_ids" map column from the "Flow_Sample_Collector_Set" table in 'row'
12899
 * to 'new_value' given the key value 'new_key'.
12900
 *
12901
 */
12902
void
12903
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)
12904
0
{
12905
0
    struct ovsdb_datum *datum;
12906
12907
0
    datum = xmalloc(sizeof *datum);
12908
0
    datum->n = 1;
12909
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12910
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
12911
0
    datum->refcnt = NULL;
12912
12913
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
12914
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
12915
12916
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
12917
0
                                    &ovsrec_flow_sample_collector_set_col_external_ids,
12918
0
                                    datum);
12919
0
}
12920
12921
/* Deletes an element of the "external_ids" map column from the "Flow_Sample_Collector_Set" table in 'row'
12922
 * given the key value 'delete_key'.
12923
 *
12924
 */
12925
void
12926
ovsrec_flow_sample_collector_set_update_external_ids_delkey(const struct ovsrec_flow_sample_collector_set *row, const char *delete_key)
12927
0
{
12928
0
    struct ovsdb_datum *datum;
12929
12930
0
    datum = xmalloc(sizeof *datum);
12931
0
    datum->n = 1;
12932
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
12933
0
    datum->values = NULL;
12934
0
    datum->refcnt = NULL;
12935
12936
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
12937
12938
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
12939
0
                                    &ovsrec_flow_sample_collector_set_col_external_ids,
12940
0
                                    datum);
12941
0
}
12942
12943
/* Adds the value 'new_value' to the "ipfix" set column from the "Flow_Sample_Collector_Set" table
12944
 * in 'row'.
12945
 *
12946
 */
12947
void
12948
ovsrec_flow_sample_collector_set_update_ipfix_addvalue(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_ipfix *new_value)
12949
0
{
12950
0
    struct ovsdb_datum *datum;
12951
12952
0
    datum = xmalloc(sizeof *datum);
12953
0
    datum->n = 1;
12954
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
12955
0
    datum->values = NULL;
12956
0
    datum->refcnt = NULL;
12957
12958
0
    datum->keys[0].uuid = new_value->header_.uuid;
12959
12960
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
12961
0
                                    &ovsrec_flow_sample_collector_set_col_ipfix,
12962
0
                                    datum);
12963
0
}
12964
12965
/* Deletes the value 'delete_value' from the "ipfix" set column from the
12966
 * "Flow_Sample_Collector_Set" table in 'row'.
12967
 *
12968
 */
12969
void
12970
ovsrec_flow_sample_collector_set_update_ipfix_delvalue(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_ipfix *delete_value)
12971
0
{
12972
0
    struct ovsdb_datum *datum;
12973
12974
0
    datum = xmalloc(sizeof *datum);
12975
0
    datum->n = 1;
12976
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
12977
0
    datum->values = NULL;
12978
0
    datum->refcnt = NULL;
12979
12980
0
    datum->keys[0].uuid = delete_value->header_.uuid;
12981
12982
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
12983
0
                                    &ovsrec_flow_sample_collector_set_col_ipfix,
12984
0
                                    datum);
12985
0
}
12986
12987
/* Sets the "bridge" column from the "Flow_Sample_Collector_Set" table in 'row' to
12988
 * 'bridge'.
12989
 *
12990
 * The caller retains ownership of the arguments. */
12991
void
12992
ovsrec_flow_sample_collector_set_add_clause_bridge(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *bridge)
12993
0
{
12994
0
    struct ovsdb_datum datum;
12995
12996
0
    datum.refcnt = NULL;
12997
12998
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
12999
13000
0
    datum.n = 1;
13001
0
    datum.keys = key;
13002
0
    key->uuid = *bridge;
13003
0
    datum.values = NULL;
13004
0
    ovsdb_idl_condition_add_clause(cond,
13005
0
                          function,
13006
0
                          &ovsrec_flow_sample_collector_set_col_bridge,
13007
0
                          &datum);
13008
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_sample_collector_set_col_bridge.type);
13009
0
}
13010
13011
/* Sets the "external_ids" column's value from the "Flow_Sample_Collector_Set" table in 'row'
13012
 * to 'external_ids'.
13013
 *
13014
 * The caller retains ownership of 'external_ids' and everything in it. */
13015
void
13016
ovsrec_flow_sample_collector_set_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
13017
0
{
13018
0
    struct ovsdb_datum datum;
13019
13020
0
    if (external_ids) {
13021
0
        ovsdb_datum_from_smap(&datum, external_ids);
13022
0
    } else {
13023
0
        ovsdb_datum_init_empty(&datum);
13024
0
    }
13025
13026
0
    ovsdb_idl_condition_add_clause(cond,
13027
0
                                   function,
13028
0
                                   &ovsrec_flow_sample_collector_set_col_external_ids,
13029
0
                                   &datum);
13030
13031
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_sample_collector_set_col_external_ids.type);
13032
0
}
13033
13034
13035
/* Sets the "id" column from the "Flow_Sample_Collector_Set" table in 'row' to
13036
 * 'id'.
13037
 *
13038
 * Argument constraints: in range 0 to 4,294,967,295
13039
 *
13040
 * The caller retains ownership of the arguments. */
13041
void
13042
ovsrec_flow_sample_collector_set_add_clause_id(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t id)
13043
0
{
13044
0
    struct ovsdb_datum datum;
13045
13046
0
    datum.refcnt = NULL;
13047
13048
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
13049
13050
0
    datum.n = 1;
13051
0
    datum.keys = key;
13052
0
    key->integer = id;
13053
0
    datum.values = NULL;
13054
0
    ovsdb_idl_condition_add_clause(cond,
13055
0
                          function,
13056
0
                          &ovsrec_flow_sample_collector_set_col_id,
13057
0
                          &datum);
13058
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_sample_collector_set_col_id.type);
13059
0
}
13060
13061
/* Sets the "ipfix" column from the "Flow_Sample_Collector_Set" table in 'row' to
13062
 * the 'ipfix' set.
13063
 *
13064
 * If "ipfix" is null, the column will be the empty set,
13065
 * otherwise it will contain the specified value.
13066
 *
13067
 * The caller retains ownership of the arguments. */
13068
void
13069
ovsrec_flow_sample_collector_set_add_clause_ipfix(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *ipfix)
13070
0
{
13071
0
    struct ovsdb_datum datum;
13072
13073
0
    datum.refcnt = NULL;
13074
13075
0
    if (ipfix) {
13076
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
13077
0
        datum.n = 1;
13078
0
        datum.keys = key;
13079
0
        key->uuid = *ipfix;
13080
0
    } else {
13081
0
        datum.n = 0;
13082
0
        datum.keys = NULL;
13083
0
    }
13084
0
    datum.values = NULL;
13085
0
    ovsdb_idl_condition_add_clause(cond,
13086
0
                          function,
13087
0
                          &ovsrec_flow_sample_collector_set_col_ipfix,
13088
0
                          &datum);
13089
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_sample_collector_set_col_ipfix.type);
13090
0
}
13091
13092
/* Destroy 'row' of kind "Flow_Sample_Collector_Set". The row must have been
13093
 * created with ovsdb_idl_index_init_row.
13094
 */
13095
void
13096
ovsrec_flow_sample_collector_set_index_destroy_row(const struct ovsrec_flow_sample_collector_set *row)
13097
0
{
13098
0
    ovsdb_idl_index_destroy_row(&row->header_);
13099
0
}
13100
        
13101
13102
/* Creates a new row of kind "Flow_Sample_Collector_Set". */
13103
struct ovsrec_flow_sample_collector_set *
13104
ovsrec_flow_sample_collector_set_index_init_row(struct ovsdb_idl_index *index)
13105
0
{
13106
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_sample_collector_set);
13107
0
    return ALIGNED_CAST(struct ovsrec_flow_sample_collector_set *, ovsdb_idl_index_init_row(index));
13108
0
}
13109
13110
struct ovsrec_flow_sample_collector_set *
13111
ovsrec_flow_sample_collector_set_index_find(struct ovsdb_idl_index *index, const struct ovsrec_flow_sample_collector_set *target)
13112
0
{
13113
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_sample_collector_set);
13114
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_index_find(index, &target->header_));
13115
0
}
13116
13117
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
13118
int
13119
ovsrec_flow_sample_collector_set_index_compare(
13120
    struct ovsdb_idl_index *index, 
13121
    const struct ovsrec_flow_sample_collector_set *a, 
13122
    const struct ovsrec_flow_sample_collector_set *b)
13123
0
{
13124
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
13125
0
}
13126
13127
struct ovsdb_idl_cursor
13128
ovsrec_flow_sample_collector_set_cursor_first(struct ovsdb_idl_index *index)
13129
0
{
13130
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_sample_collector_set);
13131
0
    return ovsdb_idl_cursor_first(index);
13132
0
}
13133
13134
struct ovsdb_idl_cursor
13135
ovsrec_flow_sample_collector_set_cursor_first_eq(
13136
    struct ovsdb_idl_index *index, const struct ovsrec_flow_sample_collector_set *target)
13137
0
{
13138
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_sample_collector_set);
13139
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
13140
0
}
13141
13142
struct ovsdb_idl_cursor
13143
ovsrec_flow_sample_collector_set_cursor_first_ge(
13144
    struct ovsdb_idl_index *index, const struct ovsrec_flow_sample_collector_set *target)
13145
0
{
13146
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_sample_collector_set);
13147
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
13148
0
}
13149
13150
struct ovsrec_flow_sample_collector_set *
13151
ovsrec_flow_sample_collector_set_cursor_data(struct ovsdb_idl_cursor *cursor)
13152
0
{
13153
0
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_cursor_data(cursor));
13154
0
}
13155
13156
13157
/* Sets the "bridge" column from the "Flow_Sample_Collector_Set" table in 'row' to
13158
 * 'bridge'.
13159
 *
13160
 * The caller retains ownership of the arguments. */
13161
void
13162
ovsrec_flow_sample_collector_set_index_set_bridge(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_bridge *bridge)
13163
0
{
13164
0
    struct ovsdb_datum datum;
13165
13166
0
    datum.refcnt = NULL;
13167
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
13168
13169
0
    datum.n = 1;
13170
0
    datum.keys = key;
13171
0
    key->uuid = bridge->header_.uuid;
13172
0
    datum.values = NULL;
13173
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]);
13174
0
}
13175
13176
/* Sets the "external_ids" column's value from the "Flow_Sample_Collector_Set" table in 'row'
13177
 * to 'external_ids'.
13178
 *
13179
 * The caller retains ownership of 'external_ids' and everything in it. */
13180
void
13181
ovsrec_flow_sample_collector_set_index_set_external_ids(const struct ovsrec_flow_sample_collector_set *row, const struct smap *external_ids)
13182
0
{
13183
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
13184
13185
0
    if (external_ids) {
13186
0
        struct smap_node *node;
13187
0
        size_t i;
13188
13189
0
        datum->n = smap_count(external_ids);
13190
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
13191
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
13192
0
        datum->refcnt = NULL;
13193
13194
0
        i = 0;
13195
0
        SMAP_FOR_EACH (node, external_ids) {
13196
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
13197
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
13198
0
            i++;
13199
0
        }
13200
0
        ovsdb_datum_sort_unique(datum, &ovsrec_flow_sample_collector_set_col_external_ids.type);
13201
0
    } else {
13202
0
        ovsdb_datum_init_empty(datum);
13203
0
    }
13204
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
13205
0
                          &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_EXTERNAL_IDS],
13206
0
                          datum,
13207
0
                          &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET]);
13208
0
    free(datum);
13209
0
}
13210
13211
13212
/* Sets the "id" column from the "Flow_Sample_Collector_Set" table in 'row' to
13213
 * 'id'.
13214
 *
13215
 * Argument constraints: in range 0 to 4,294,967,295
13216
 *
13217
 * The caller retains ownership of the arguments. */
13218
void
13219
ovsrec_flow_sample_collector_set_index_set_id(const struct ovsrec_flow_sample_collector_set *row, int64_t id)
13220
0
{
13221
0
    struct ovsdb_datum datum;
13222
13223
0
    datum.refcnt = NULL;
13224
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
13225
13226
0
    datum.n = 1;
13227
0
    datum.keys = key;
13228
0
    key->integer = id;
13229
0
    datum.values = NULL;
13230
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]);
13231
0
}
13232
13233
/* Sets the "ipfix" column from the "Flow_Sample_Collector_Set" table in 'row' to
13234
 * the 'ipfix' set.
13235
 *
13236
 * If "ipfix" is null, the column will be the empty set,
13237
 * otherwise it will contain the specified value.
13238
 *
13239
 * The caller retains ownership of the arguments. */
13240
void
13241
ovsrec_flow_sample_collector_set_index_set_ipfix(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_ipfix *ipfix)
13242
0
{
13243
0
    struct ovsdb_datum datum;
13244
13245
0
    datum.refcnt = NULL;
13246
0
    union ovsdb_atom *key;
13247
13248
0
    if (ipfix) {
13249
0
        key = xmalloc(sizeof (union ovsdb_atom));
13250
0
        datum.n = 1;
13251
0
        datum.keys = key;
13252
0
        key->uuid = ipfix->header_.uuid;
13253
0
    } else {
13254
0
        datum.n = 0;
13255
0
        datum.keys = NULL;
13256
0
    }
13257
0
    datum.values = NULL;
13258
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]);
13259
0
}
13260
13261
struct ovsdb_idl_column ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_N_COLUMNS];
13262
13263
unsigned int
13264
ovsrec_flow_sample_collector_set_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
13265
0
{
13266
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_flow_sample_collector_set, condition);
13267
0
}
13268
13269
struct ovsdb_idl_column ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_N_COLUMNS] = {
13270
    [OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_BRIDGE] = {
13271
         .name = "bridge",
13272
         .type = {
13273
            .key = {
13274
               .type = OVSDB_TYPE_UUID,
13275
               .uuid = { .refTableName = "Bridge", .refType = OVSDB_REF_STRONG },
13276
            },
13277
            .value = OVSDB_BASE_VOID_INIT,
13278
            .n_min = 1,
13279
            .n_max = 1,
13280
         },
13281
         .is_mutable = true,
13282
         .is_synthetic = false,
13283
         .parse = ovsrec_flow_sample_collector_set_parse_bridge,
13284
         .unparse = ovsrec_flow_sample_collector_set_unparse_bridge,
13285
    },
13286
13287
    [OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_EXTERNAL_IDS] = {
13288
         .name = "external_ids",
13289
         .type = {
13290
            .key = {
13291
               .type = OVSDB_TYPE_STRING,
13292
               .string = { .minLen = 0, .maxLen = UINT_MAX },
13293
            },
13294
            .value = {
13295
                .type = OVSDB_TYPE_STRING,
13296
                .string = { .minLen = 0, .maxLen = UINT_MAX },
13297
            },
13298
            .n_min = 0,
13299
            .n_max = UINT_MAX,
13300
         },
13301
         .is_mutable = true,
13302
         .is_synthetic = false,
13303
         .parse = ovsrec_flow_sample_collector_set_parse_external_ids,
13304
         .unparse = ovsrec_flow_sample_collector_set_unparse_external_ids,
13305
    },
13306
13307
    [OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_ID] = {
13308
         .name = "id",
13309
         .type = {
13310
            .key = {
13311
               .type = OVSDB_TYPE_INTEGER,
13312
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
13313
            },
13314
            .value = OVSDB_BASE_VOID_INIT,
13315
            .n_min = 1,
13316
            .n_max = 1,
13317
         },
13318
         .is_mutable = true,
13319
         .is_synthetic = false,
13320
         .parse = ovsrec_flow_sample_collector_set_parse_id,
13321
         .unparse = ovsrec_flow_sample_collector_set_unparse_id,
13322
    },
13323
13324
    [OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_IPFIX] = {
13325
         .name = "ipfix",
13326
         .type = {
13327
            .key = {
13328
               .type = OVSDB_TYPE_UUID,
13329
               .uuid = { .refTableName = "IPFIX", .refType = OVSDB_REF_STRONG },
13330
            },
13331
            .value = OVSDB_BASE_VOID_INIT,
13332
            .n_min = 0,
13333
            .n_max = 1,
13334
         },
13335
         .is_mutable = true,
13336
         .is_synthetic = false,
13337
         .parse = ovsrec_flow_sample_collector_set_parse_ipfix,
13338
         .unparse = ovsrec_flow_sample_collector_set_unparse_ipfix,
13339
    },
13340
13341
};
13342

13343
/* Flow_Table table. */
13344
13345
bool
13346
ovsrec_server_has_flow_table_table_col_external_ids(const struct ovsdb_idl *idl)
13347
0
{
13348
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_external_ids);
13349
0
}
13350
13351
13352
bool
13353
ovsrec_server_has_flow_table_table_col_flow_limit(const struct ovsdb_idl *idl)
13354
0
{
13355
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_flow_limit);
13356
0
}
13357
13358
13359
bool
13360
ovsrec_server_has_flow_table_table_col_groups(const struct ovsdb_idl *idl)
13361
0
{
13362
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_groups);
13363
0
}
13364
13365
13366
bool
13367
ovsrec_server_has_flow_table_table_col_name(const struct ovsdb_idl *idl)
13368
0
{
13369
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_name);
13370
0
}
13371
13372
13373
bool
13374
ovsrec_server_has_flow_table_table_col_overflow_policy(const struct ovsdb_idl *idl)
13375
0
{
13376
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_overflow_policy);
13377
0
}
13378
13379
13380
bool
13381
ovsrec_server_has_flow_table_table_col_prefixes(const struct ovsdb_idl *idl)
13382
0
{
13383
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_flow_table_col_prefixes);
13384
0
}
13385
13386
13387
bool
13388
ovsrec_server_has_flow_table_table(const struct ovsdb_idl *idl)
13389
0
{
13390
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]);
13391
0
}
13392
13393
13394
const struct ovsrec_flow_table_table *
13395
ovsrec_flow_table_table_get(const struct ovsdb_idl *idl)
13396
0
{
13397
0
    return (const struct ovsrec_flow_table_table *) idl;
13398
0
}
13399
13400
const struct ovsrec_flow_table *
13401
ovsrec_flow_table_table_first(const struct ovsrec_flow_table_table *table)
13402
0
{
13403
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
13404
0
    return ovsrec_flow_table_first(idl);
13405
0
}
13406
13407
13408
const struct ovsrec_flow_table *
13409
ovsrec_flow_table_table_track_get_first(const struct ovsrec_flow_table_table *table)
13410
0
{
13411
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
13412
0
    return ovsrec_flow_table_track_get_first(idl);
13413
0
}
13414
13415
13416
static void
13417
ovsrec_flow_table_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13418
0
{
13419
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
13420
0
    smap_init(&row->external_ids);
13421
0
    for (size_t i = 0; i < datum->n; i++) {
13422
0
        smap_add(&row->external_ids,
13423
0
                 json_string(datum->keys[i].s),
13424
0
                 json_string(datum->values[i].s));
13425
0
    }
13426
0
}
13427
13428
static void
13429
ovsrec_flow_table_parse_flow_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13430
0
{
13431
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
13432
0
    size_t n = MIN(1, datum->n);
13433
0
    row->flow_limit = NULL;
13434
0
    row->n_flow_limit = 0;
13435
0
    for (size_t i = 0; i < n; i++) {
13436
0
        if (!row->n_flow_limit) {
13437
0
            row->flow_limit = xmalloc(n * sizeof *row->flow_limit);
13438
0
        }
13439
0
        row->flow_limit[row->n_flow_limit] = datum->keys[i].integer;
13440
0
        row->n_flow_limit++;
13441
0
    }
13442
0
}
13443
13444
static void
13445
ovsrec_flow_table_parse_groups(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13446
0
{
13447
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
13448
0
    row->groups = NULL;
13449
0
    row->n_groups = 0;
13450
0
    for (size_t i = 0; i < datum->n; i++) {
13451
0
        if (!row->n_groups) {
13452
0
            row->groups = xmalloc(datum->n * sizeof *row->groups);
13453
0
        }
13454
0
        row->groups[row->n_groups] = datum->keys[i].s->string;
13455
0
        row->n_groups++;
13456
0
    }
13457
0
}
13458
13459
static void
13460
ovsrec_flow_table_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13461
0
{
13462
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
13463
13464
0
    if (datum->n >= 1) {
13465
0
        row->name = datum->keys[0].s->string;
13466
0
    } else {
13467
0
        row->name = NULL;
13468
0
    }
13469
0
}
13470
13471
static void
13472
ovsrec_flow_table_parse_overflow_policy(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13473
0
{
13474
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
13475
13476
0
    if (datum->n >= 1) {
13477
0
        row->overflow_policy = datum->keys[0].s->string;
13478
0
    } else {
13479
0
        row->overflow_policy = NULL;
13480
0
    }
13481
0
}
13482
13483
static void
13484
ovsrec_flow_table_parse_prefixes(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13485
0
{
13486
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
13487
0
    size_t n = MIN(3, datum->n);
13488
0
    row->prefixes = NULL;
13489
0
    row->n_prefixes = 0;
13490
0
    for (size_t i = 0; i < n; i++) {
13491
0
        if (!row->n_prefixes) {
13492
0
            row->prefixes = xmalloc(n * sizeof *row->prefixes);
13493
0
        }
13494
0
        row->prefixes[row->n_prefixes] = datum->keys[i].s->string;
13495
0
        row->n_prefixes++;
13496
0
    }
13497
0
}
13498
13499
static void
13500
ovsrec_flow_table_unparse_external_ids(struct ovsdb_idl_row *row_)
13501
0
{
13502
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
13503
0
    smap_destroy(&row->external_ids);
13504
0
}
13505
13506
static void
13507
ovsrec_flow_table_unparse_flow_limit(struct ovsdb_idl_row *row_)
13508
0
{
13509
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
13510
0
    free(row->flow_limit);
13511
0
}
13512
13513
static void
13514
ovsrec_flow_table_unparse_groups(struct ovsdb_idl_row *row_)
13515
0
{
13516
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
13517
0
    free(row->groups);
13518
0
}
13519
13520
static void
13521
ovsrec_flow_table_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
13522
0
{
13523
    /* Nothing to do. */
13524
0
}
13525
13526
static void
13527
ovsrec_flow_table_unparse_overflow_policy(struct ovsdb_idl_row *row OVS_UNUSED)
13528
0
{
13529
    /* Nothing to do. */
13530
0
}
13531
13532
static void
13533
ovsrec_flow_table_unparse_prefixes(struct ovsdb_idl_row *row_)
13534
0
{
13535
0
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
13536
0
    free(row->prefixes);
13537
0
}
13538
13539
static void
13540
ovsrec_flow_table_init__(struct ovsdb_idl_row *row)
13541
0
{
13542
0
    ovsrec_flow_table_init(ovsrec_flow_table_cast(row));
13543
0
}
13544
13545
/* Clears the contents of 'row' in table "Flow_Table". */
13546
void
13547
ovsrec_flow_table_init(struct ovsrec_flow_table *row)
13548
0
{
13549
0
    memset(row, 0, sizeof *row); 
13550
0
    smap_init(&row->external_ids);
13551
0
}
13552
13553
/* Searches table "Flow_Table" in 'idl' for a row with UUID 'uuid'.  Returns
13554
 * a pointer to the row if there is one, otherwise a null pointer.  */
13555
const struct ovsrec_flow_table *
13556
ovsrec_flow_table_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
13557
0
{
13558
0
    return ovsrec_flow_table_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_flow_table, uuid));
13559
0
}
13560
13561
/* Searches table "Flow_Table" for a row with UUID 'uuid'.  Returns
13562
 * a pointer to the row if there is one, otherwise a null pointer.  */
13563
const struct ovsrec_flow_table *
13564
ovsrec_flow_table_table_get_for_uuid(const struct ovsrec_flow_table_table *table, const struct uuid *uuid)
13565
0
{
13566
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
13567
0
    return ovsrec_flow_table_get_for_uuid(idl, uuid);
13568
0
}
13569
13570
/* Returns a row in table "Flow_Table" in 'idl', or a null pointer if that
13571
 * table is empty.
13572
 *
13573
 * Database tables are internally maintained as hash tables, so adding or
13574
 * removing rows while traversing the same table can cause some rows to be
13575
 * visited twice or not at apply. */
13576
const struct ovsrec_flow_table *
13577
ovsrec_flow_table_first(const struct ovsdb_idl *idl)
13578
0
{
13579
0
    return ovsrec_flow_table_cast(ovsdb_idl_first_row(idl, &ovsrec_table_flow_table));
13580
0
}
13581
13582
/* Returns a row following 'row' within its table, or a null pointer if 'row'
13583
 * is the last row in its table. */
13584
const struct ovsrec_flow_table *
13585
ovsrec_flow_table_next(const struct ovsrec_flow_table *row)
13586
0
{
13587
0
    return ovsrec_flow_table_cast(ovsdb_idl_next_row(&row->header_));
13588
0
}
13589
13590
unsigned int ovsrec_flow_table_get_seqno(const struct ovsdb_idl *idl)
13591
0
{
13592
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_flow_table);
13593
0
}
13594
13595
unsigned int ovsrec_flow_table_row_get_seqno(const struct ovsrec_flow_table *row, enum ovsdb_idl_change change)
13596
0
{
13597
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
13598
0
}
13599
13600
const struct ovsrec_flow_table *
13601
ovsrec_flow_table_track_get_first(const struct ovsdb_idl *idl)
13602
0
{
13603
0
    return ovsrec_flow_table_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_flow_table));
13604
0
}
13605
13606
const struct ovsrec_flow_table
13607
*ovsrec_flow_table_track_get_next(const struct ovsrec_flow_table *row)
13608
0
{
13609
0
    return ovsrec_flow_table_cast(ovsdb_idl_track_get_next(&row->header_));
13610
0
}
13611
13612
13613
/* Deletes 'row' from table "Flow_Table".  'row' may be freed, so it must not be
13614
 * accessed afterward.
13615
 *
13616
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13617
void
13618
ovsrec_flow_table_delete(const struct ovsrec_flow_table *row)
13619
0
{
13620
0
    ovsdb_idl_txn_delete(&row->header_);
13621
0
}
13622
13623
/* Inserts and returns a new row in the table "Flow_Table" in the database
13624
 * with open transaction 'txn'.
13625
 *
13626
 * The new row is assigned a randomly generated provisional UUID.
13627
 * ovsdb-server will assign a different UUID when 'txn' is committed,
13628
 * but the IDL will replace any uses of the provisional UUID in the
13629
 * data to be to be committed by the UUID assigned by ovsdb-server. */
13630
struct ovsrec_flow_table *
13631
ovsrec_flow_table_insert(struct ovsdb_idl_txn *txn)
13632
0
{
13633
0
    return ovsrec_flow_table_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_flow_table, NULL));
13634
0
}
13635
13636
/* Inserts and returns a new row in the table "Flow_Table" in the database
13637
 * with open transaction 'txn'.
13638
 *
13639
 * The new row is assigned the UUID specified in the 'uuid' parameter
13640
 * (which cannot be null).  ovsdb-server will try to assign the same
13641
 * UUID when 'txn' is committed. */
13642
struct ovsrec_flow_table *
13643
ovsrec_flow_table_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
13644
0
{
13645
0
    return ovsrec_flow_table_cast(ovsdb_idl_txn_insert_persist_uuid(
13646
0
        txn, &ovsrec_table_flow_table, uuid));
13647
0
}
13648
13649
bool
13650
ovsrec_flow_table_is_updated(const struct ovsrec_flow_table *row, enum ovsrec_flow_table_column_id column)
13651
0
{
13652
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_flow_table_columns[column]);
13653
0
}
13654
13655
/* Causes the original contents of column "external_ids" in 'row' to be
13656
 * verified as a prerequisite to completing the transaction.  That is, if
13657
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
13658
 * time that the IDL originally read its contents and the time that the
13659
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13660
 *
13661
 * The intention is that, to ensure that no transaction commits based on dirty
13662
 * reads, an application should call this function any time "external_ids" is
13663
 * read as part of a read-modify-write operation.
13664
 *
13665
 * In some cases this function reduces to a no-op, because the current value
13666
 * of "external_ids" is already known:
13667
 *
13668
 *   - If 'row' is a row created by the current transaction (returned by
13669
 *     ovsrec_flow_table_insert()).
13670
 *
13671
 *   - If "external_ids" has already been modified (with
13672
 *     ovsrec_flow_table_set_external_ids()) within the current transaction.
13673
 *
13674
 * Because of the latter property, always call this function *before*
13675
 * ovsrec_flow_table_set_external_ids() for a given read-modify-write.
13676
 *
13677
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13678
void
13679
ovsrec_flow_table_verify_external_ids(const struct ovsrec_flow_table *row)
13680
0
{
13681
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_external_ids);
13682
0
}
13683
13684
/* Causes the original contents of column "flow_limit" in 'row' to be
13685
 * verified as a prerequisite to completing the transaction.  That is, if
13686
 * "flow_limit" in 'row' changed (or if 'row' was deleted) between the
13687
 * time that the IDL originally read its contents and the time that the
13688
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13689
 *
13690
 * The intention is that, to ensure that no transaction commits based on dirty
13691
 * reads, an application should call this function any time "flow_limit" is
13692
 * read as part of a read-modify-write operation.
13693
 *
13694
 * In some cases this function reduces to a no-op, because the current value
13695
 * of "flow_limit" is already known:
13696
 *
13697
 *   - If 'row' is a row created by the current transaction (returned by
13698
 *     ovsrec_flow_table_insert()).
13699
 *
13700
 *   - If "flow_limit" has already been modified (with
13701
 *     ovsrec_flow_table_set_flow_limit()) within the current transaction.
13702
 *
13703
 * Because of the latter property, always call this function *before*
13704
 * ovsrec_flow_table_set_flow_limit() for a given read-modify-write.
13705
 *
13706
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13707
void
13708
ovsrec_flow_table_verify_flow_limit(const struct ovsrec_flow_table *row)
13709
0
{
13710
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_flow_limit);
13711
0
}
13712
13713
/* Causes the original contents of column "groups" in 'row' to be
13714
 * verified as a prerequisite to completing the transaction.  That is, if
13715
 * "groups" in 'row' changed (or if 'row' was deleted) between the
13716
 * time that the IDL originally read its contents and the time that the
13717
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13718
 *
13719
 * The intention is that, to ensure that no transaction commits based on dirty
13720
 * reads, an application should call this function any time "groups" is
13721
 * read as part of a read-modify-write operation.
13722
 *
13723
 * In some cases this function reduces to a no-op, because the current value
13724
 * of "groups" is already known:
13725
 *
13726
 *   - If 'row' is a row created by the current transaction (returned by
13727
 *     ovsrec_flow_table_insert()).
13728
 *
13729
 *   - If "groups" has already been modified (with
13730
 *     ovsrec_flow_table_set_groups()) within the current transaction.
13731
 *
13732
 * Because of the latter property, always call this function *before*
13733
 * ovsrec_flow_table_set_groups() for a given read-modify-write.
13734
 *
13735
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13736
void
13737
ovsrec_flow_table_verify_groups(const struct ovsrec_flow_table *row)
13738
0
{
13739
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_groups);
13740
0
}
13741
13742
/* Causes the original contents of column "name" in 'row' to be
13743
 * verified as a prerequisite to completing the transaction.  That is, if
13744
 * "name" in 'row' changed (or if 'row' was deleted) between the
13745
 * time that the IDL originally read its contents and the time that the
13746
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13747
 *
13748
 * The intention is that, to ensure that no transaction commits based on dirty
13749
 * reads, an application should call this function any time "name" is
13750
 * read as part of a read-modify-write operation.
13751
 *
13752
 * In some cases this function reduces to a no-op, because the current value
13753
 * of "name" is already known:
13754
 *
13755
 *   - If 'row' is a row created by the current transaction (returned by
13756
 *     ovsrec_flow_table_insert()).
13757
 *
13758
 *   - If "name" has already been modified (with
13759
 *     ovsrec_flow_table_set_name()) within the current transaction.
13760
 *
13761
 * Because of the latter property, always call this function *before*
13762
 * ovsrec_flow_table_set_name() for a given read-modify-write.
13763
 *
13764
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13765
void
13766
ovsrec_flow_table_verify_name(const struct ovsrec_flow_table *row)
13767
0
{
13768
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_name);
13769
0
}
13770
13771
/* Causes the original contents of column "overflow_policy" in 'row' to be
13772
 * verified as a prerequisite to completing the transaction.  That is, if
13773
 * "overflow_policy" in 'row' changed (or if 'row' was deleted) between the
13774
 * time that the IDL originally read its contents and the time that the
13775
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13776
 *
13777
 * The intention is that, to ensure that no transaction commits based on dirty
13778
 * reads, an application should call this function any time "overflow_policy" is
13779
 * read as part of a read-modify-write operation.
13780
 *
13781
 * In some cases this function reduces to a no-op, because the current value
13782
 * of "overflow_policy" is already known:
13783
 *
13784
 *   - If 'row' is a row created by the current transaction (returned by
13785
 *     ovsrec_flow_table_insert()).
13786
 *
13787
 *   - If "overflow_policy" has already been modified (with
13788
 *     ovsrec_flow_table_set_overflow_policy()) within the current transaction.
13789
 *
13790
 * Because of the latter property, always call this function *before*
13791
 * ovsrec_flow_table_set_overflow_policy() for a given read-modify-write.
13792
 *
13793
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13794
void
13795
ovsrec_flow_table_verify_overflow_policy(const struct ovsrec_flow_table *row)
13796
0
{
13797
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_overflow_policy);
13798
0
}
13799
13800
/* Causes the original contents of column "prefixes" in 'row' to be
13801
 * verified as a prerequisite to completing the transaction.  That is, if
13802
 * "prefixes" in 'row' changed (or if 'row' was deleted) between the
13803
 * time that the IDL originally read its contents and the time that the
13804
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
13805
 *
13806
 * The intention is that, to ensure that no transaction commits based on dirty
13807
 * reads, an application should call this function any time "prefixes" is
13808
 * read as part of a read-modify-write operation.
13809
 *
13810
 * In some cases this function reduces to a no-op, because the current value
13811
 * of "prefixes" is already known:
13812
 *
13813
 *   - If 'row' is a row created by the current transaction (returned by
13814
 *     ovsrec_flow_table_insert()).
13815
 *
13816
 *   - If "prefixes" has already been modified (with
13817
 *     ovsrec_flow_table_set_prefixes()) within the current transaction.
13818
 *
13819
 * Because of the latter property, always call this function *before*
13820
 * ovsrec_flow_table_set_prefixes() for a given read-modify-write.
13821
 *
13822
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
13823
void
13824
ovsrec_flow_table_verify_prefixes(const struct ovsrec_flow_table *row)
13825
0
{
13826
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_col_prefixes);
13827
0
}
13828
13829
/* Returns the "external_ids" column's value from the "Flow_Table" table in 'row'
13830
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13831
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13832
 * for a given key than implementing the same operation on the "cooked"
13833
 * form in 'row'.
13834
 *
13835
 * 'key_type' must be OVSDB_TYPE_STRING.
13836
 * 'value_type' must be OVSDB_TYPE_STRING.
13837
 * (This helps to avoid silent bugs if someone changes external_ids's
13838
 * type without updating the caller.)
13839
 *
13840
 * The caller must not modify or free the returned value.
13841
 *
13842
 * Various kinds of changes can invalidate the returned value: modifying
13843
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13844
 * If the returned value is needed for a long time, it is best to make a copy
13845
 * of it with ovsdb_datum_clone().
13846
 *
13847
 * This function is rarely useful, since it is easier to access the value
13848
 * directly through the "external_ids" member in ovsrec_flow_table. */
13849
const struct ovsdb_datum *
13850
ovsrec_flow_table_get_external_ids(const struct ovsrec_flow_table *row,
13851
  enum ovsdb_atomic_type key_type OVS_UNUSED,
13852
  enum ovsdb_atomic_type value_type OVS_UNUSED)
13853
0
{
13854
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13855
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
13856
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_external_ids);
13857
0
}
13858
13859
/* Returns the "flow_limit" column's value from the "Flow_Table" table in 'row'
13860
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13861
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13862
 * for a given key than implementing the same operation on the "cooked"
13863
 * form in 'row'.
13864
 *
13865
 * 'key_type' must be OVSDB_TYPE_INTEGER.
13866
 * (This helps to avoid silent bugs if someone changes flow_limit's
13867
 * type without updating the caller.)
13868
 *
13869
 * The caller must not modify or free the returned value.
13870
 *
13871
 * Various kinds of changes can invalidate the returned value: modifying
13872
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13873
 * If the returned value is needed for a long time, it is best to make a copy
13874
 * of it with ovsdb_datum_clone().
13875
 *
13876
 * This function is rarely useful, since it is easier to access the value
13877
 * directly through the "flow_limit" member in ovsrec_flow_table. */
13878
const struct ovsdb_datum *
13879
ovsrec_flow_table_get_flow_limit(const struct ovsrec_flow_table *row,
13880
  enum ovsdb_atomic_type key_type OVS_UNUSED)
13881
0
{
13882
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13883
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_flow_limit);
13884
0
}
13885
13886
/* Returns the "groups" column's value from the "Flow_Table" table in 'row'
13887
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13888
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13889
 * for a given key than implementing the same operation on the "cooked"
13890
 * form in 'row'.
13891
 *
13892
 * 'key_type' must be OVSDB_TYPE_STRING.
13893
 * (This helps to avoid silent bugs if someone changes groups's
13894
 * type without updating the caller.)
13895
 *
13896
 * The caller must not modify or free the returned value.
13897
 *
13898
 * Various kinds of changes can invalidate the returned value: modifying
13899
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13900
 * If the returned value is needed for a long time, it is best to make a copy
13901
 * of it with ovsdb_datum_clone().
13902
 *
13903
 * This function is rarely useful, since it is easier to access the value
13904
 * directly through the "groups" member in ovsrec_flow_table. */
13905
const struct ovsdb_datum *
13906
ovsrec_flow_table_get_groups(const struct ovsrec_flow_table *row,
13907
  enum ovsdb_atomic_type key_type OVS_UNUSED)
13908
0
{
13909
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13910
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_groups);
13911
0
}
13912
13913
/* Returns the "name" column's value from the "Flow_Table" table in 'row'
13914
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13915
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13916
 * for a given key than implementing the same operation on the "cooked"
13917
 * form in 'row'.
13918
 *
13919
 * 'key_type' must be OVSDB_TYPE_STRING.
13920
 * (This helps to avoid silent bugs if someone changes name's
13921
 * type without updating the caller.)
13922
 *
13923
 * The caller must not modify or free the returned value.
13924
 *
13925
 * Various kinds of changes can invalidate the returned value: modifying
13926
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13927
 * If the returned value is needed for a long time, it is best to make a copy
13928
 * of it with ovsdb_datum_clone().
13929
 *
13930
 * This function is rarely useful, since it is easier to access the value
13931
 * directly through the "name" member in ovsrec_flow_table. */
13932
const struct ovsdb_datum *
13933
ovsrec_flow_table_get_name(const struct ovsrec_flow_table *row,
13934
  enum ovsdb_atomic_type key_type OVS_UNUSED)
13935
0
{
13936
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13937
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_name);
13938
0
}
13939
13940
/* Returns the "overflow_policy" column's value from the "Flow_Table" table in 'row'
13941
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13942
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13943
 * for a given key than implementing the same operation on the "cooked"
13944
 * form in 'row'.
13945
 *
13946
 * 'key_type' must be OVSDB_TYPE_STRING.
13947
 * (This helps to avoid silent bugs if someone changes overflow_policy's
13948
 * type without updating the caller.)
13949
 *
13950
 * The caller must not modify or free the returned value.
13951
 *
13952
 * Various kinds of changes can invalidate the returned value: modifying
13953
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13954
 * If the returned value is needed for a long time, it is best to make a copy
13955
 * of it with ovsdb_datum_clone().
13956
 *
13957
 * This function is rarely useful, since it is easier to access the value
13958
 * directly through the "overflow_policy" member in ovsrec_flow_table. */
13959
const struct ovsdb_datum *
13960
ovsrec_flow_table_get_overflow_policy(const struct ovsrec_flow_table *row,
13961
  enum ovsdb_atomic_type key_type OVS_UNUSED)
13962
0
{
13963
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13964
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_overflow_policy);
13965
0
}
13966
13967
/* Returns the "prefixes" column's value from the "Flow_Table" table in 'row'
13968
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
13969
 * ovsdb_datum_find_key() is an easier and more efficient way to search
13970
 * for a given key than implementing the same operation on the "cooked"
13971
 * form in 'row'.
13972
 *
13973
 * 'key_type' must be OVSDB_TYPE_STRING.
13974
 * (This helps to avoid silent bugs if someone changes prefixes's
13975
 * type without updating the caller.)
13976
 *
13977
 * The caller must not modify or free the returned value.
13978
 *
13979
 * Various kinds of changes can invalidate the returned value: modifying
13980
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13981
 * If the returned value is needed for a long time, it is best to make a copy
13982
 * of it with ovsdb_datum_clone().
13983
 *
13984
 * This function is rarely useful, since it is easier to access the value
13985
 * directly through the "prefixes" member in ovsrec_flow_table. */
13986
const struct ovsdb_datum *
13987
ovsrec_flow_table_get_prefixes(const struct ovsrec_flow_table *row,
13988
  enum ovsdb_atomic_type key_type OVS_UNUSED)
13989
0
{
13990
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13991
0
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_prefixes);
13992
0
}
13993
13994
/* Sets the "external_ids" column's value from the "Flow_Table" table in 'row'
13995
 * to 'external_ids'.
13996
 *
13997
 * The caller retains ownership of 'external_ids' and everything in it. */
13998
void
13999
ovsrec_flow_table_set_external_ids(const struct ovsrec_flow_table *row, const struct smap *external_ids)
14000
0
{
14001
0
    struct ovsdb_datum datum;
14002
14003
0
    if (external_ids) {
14004
0
        ovsdb_datum_from_smap(&datum, external_ids);
14005
0
    } else {
14006
0
        ovsdb_datum_init_empty(&datum);
14007
0
    }
14008
0
    ovsdb_idl_txn_write(&row->header_,
14009
0
                        &ovsrec_flow_table_col_external_ids,
14010
0
                        &datum);
14011
0
}
14012
14013
14014
/* Sets the "flow_limit" column from the "Flow_Table" table in 'row' to
14015
 * the 'flow_limit' set with 'n_flow_limit' entries.
14016
 *
14017
 * 'n_flow_limit' may be 0 or 1; if it is 0, then 'flow_limit'
14018
 * may be NULL.
14019
 *
14020
 * Argument constraints: at least 0
14021
 *
14022
 * The caller retains ownership of the arguments. */
14023
void
14024
ovsrec_flow_table_set_flow_limit(const struct ovsrec_flow_table *row, const int64_t *flow_limit, size_t n_flow_limit)
14025
0
{
14026
0
    struct ovsdb_datum datum;
14027
14028
0
    datum.refcnt = NULL;
14029
14030
0
    if (n_flow_limit) {
14031
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
14032
0
        datum.n = 1;
14033
0
        datum.keys = key;
14034
0
        key->integer = *flow_limit;
14035
0
    } else {
14036
0
        datum.n = 0;
14037
0
        datum.keys = NULL;
14038
0
    }
14039
0
    datum.values = NULL;
14040
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_col_flow_limit, &datum);
14041
0
}
14042
14043
/* Sets the "groups" column from the "Flow_Table" table in 'row' to
14044
 * the 'groups' set with 'n_groups' entries.
14045
 *
14046
 * The caller retains ownership of the arguments. */
14047
void
14048
ovsrec_flow_table_set_groups(const struct ovsrec_flow_table *row, const char **groups, size_t n_groups)
14049
0
{
14050
0
    struct ovsdb_datum datum;
14051
14052
0
    datum.refcnt = NULL;
14053
14054
0
    datum.n = n_groups;
14055
0
    datum.keys = n_groups ? xmalloc(n_groups * sizeof *datum.keys) : NULL;
14056
0
    datum.values = NULL;
14057
0
    for (size_t i = 0; i < n_groups; i++) {
14058
0
        datum.keys[i].s = ovsdb_atom_string_create(groups[i]);
14059
0
    }
14060
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_col_groups, &datum);
14061
0
}
14062
14063
/* Sets the "name" column from the "Flow_Table" table in 'row' to
14064
 * the 'name' set.
14065
 *
14066
 * If "name" is null, the column will be the empty set,
14067
 * otherwise it will contain the specified value.
14068
 *
14069
 * The caller retains ownership of the arguments. */
14070
void
14071
ovsrec_flow_table_set_name(const struct ovsrec_flow_table *row, const char *name)
14072
0
{
14073
0
    struct ovsdb_datum datum;
14074
14075
0
    datum.refcnt = NULL;
14076
14077
0
    if (name) {
14078
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
14079
0
        datum.n = 1;
14080
0
        datum.keys = key;
14081
0
        key->s = ovsdb_atom_string_create(name);
14082
0
    } else {
14083
0
        datum.n = 0;
14084
0
        datum.keys = NULL;
14085
0
    }
14086
0
    datum.values = NULL;
14087
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_col_name, &datum);
14088
0
}
14089
14090
/* Sets the "overflow_policy" column from the "Flow_Table" table in 'row' to
14091
 * the 'overflow_policy' set.
14092
 *
14093
 * If "overflow_policy" is null, the column will be the empty set,
14094
 * otherwise it will contain the specified value.
14095
 *
14096
 * Argument constraints: either "evict" or "refuse"
14097
 *
14098
 * The caller retains ownership of the arguments. */
14099
void
14100
ovsrec_flow_table_set_overflow_policy(const struct ovsrec_flow_table *row, const char *overflow_policy)
14101
0
{
14102
0
    struct ovsdb_datum datum;
14103
14104
0
    datum.refcnt = NULL;
14105
14106
0
    if (overflow_policy) {
14107
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
14108
0
        datum.n = 1;
14109
0
        datum.keys = key;
14110
0
        key->s = ovsdb_atom_string_create(overflow_policy);
14111
0
    } else {
14112
0
        datum.n = 0;
14113
0
        datum.keys = NULL;
14114
0
    }
14115
0
    datum.values = NULL;
14116
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_col_overflow_policy, &datum);
14117
0
}
14118
14119
/* Sets the "prefixes" column from the "Flow_Table" table in 'row' to
14120
 * the 'prefixes' set with 'n_prefixes' entries.
14121
 *
14122
 * The caller retains ownership of the arguments. */
14123
void
14124
ovsrec_flow_table_set_prefixes(const struct ovsrec_flow_table *row, const char **prefixes, size_t n_prefixes)
14125
0
{
14126
0
    struct ovsdb_datum datum;
14127
14128
0
    datum.refcnt = NULL;
14129
14130
0
    datum.n = n_prefixes;
14131
0
    datum.keys = n_prefixes ? xmalloc(n_prefixes * sizeof *datum.keys) : NULL;
14132
0
    datum.values = NULL;
14133
0
    for (size_t i = 0; i < n_prefixes; i++) {
14134
0
        datum.keys[i].s = ovsdb_atom_string_create(prefixes[i]);
14135
0
    }
14136
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_col_prefixes, &datum);
14137
0
}
14138
14139
/* Sets an element of the "external_ids" map column from the "Flow_Table" table in 'row'
14140
 * to 'new_value' given the key value 'new_key'.
14141
 *
14142
 */
14143
void
14144
ovsrec_flow_table_update_external_ids_setkey(const struct ovsrec_flow_table *row, const char *new_key, const char *new_value)
14145
0
{
14146
0
    struct ovsdb_datum *datum;
14147
14148
0
    datum = xmalloc(sizeof *datum);
14149
0
    datum->n = 1;
14150
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
14151
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
14152
0
    datum->refcnt = NULL;
14153
14154
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
14155
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
14156
14157
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
14158
0
                                    &ovsrec_flow_table_col_external_ids,
14159
0
                                    datum);
14160
0
}
14161
14162
/* Deletes an element of the "external_ids" map column from the "Flow_Table" table in 'row'
14163
 * given the key value 'delete_key'.
14164
 *
14165
 */
14166
void
14167
ovsrec_flow_table_update_external_ids_delkey(const struct ovsrec_flow_table *row, const char *delete_key)
14168
0
{
14169
0
    struct ovsdb_datum *datum;
14170
14171
0
    datum = xmalloc(sizeof *datum);
14172
0
    datum->n = 1;
14173
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
14174
0
    datum->values = NULL;
14175
0
    datum->refcnt = NULL;
14176
14177
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
14178
14179
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
14180
0
                                    &ovsrec_flow_table_col_external_ids,
14181
0
                                    datum);
14182
0
}
14183
14184
/* Adds the value 'new_value' to the "flow_limit" set column from the "Flow_Table" table
14185
 * in 'row'.
14186
 *
14187
 */
14188
void
14189
ovsrec_flow_table_update_flow_limit_addvalue(const struct ovsrec_flow_table *row, int64_t new_value)
14190
0
{
14191
0
    struct ovsdb_datum *datum;
14192
14193
0
    datum = xmalloc(sizeof *datum);
14194
0
    datum->n = 1;
14195
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
14196
0
    datum->values = NULL;
14197
0
    datum->refcnt = NULL;
14198
14199
0
    datum->keys[0].integer = new_value;
14200
14201
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
14202
0
                                    &ovsrec_flow_table_col_flow_limit,
14203
0
                                    datum);
14204
0
}
14205
14206
/* Deletes the value 'delete_value' from the "flow_limit" set column from the
14207
 * "Flow_Table" table in 'row'.
14208
 *
14209
 */
14210
void
14211
ovsrec_flow_table_update_flow_limit_delvalue(const struct ovsrec_flow_table *row, int64_t delete_value)
14212
0
{
14213
0
    struct ovsdb_datum *datum;
14214
14215
0
    datum = xmalloc(sizeof *datum);
14216
0
    datum->n = 1;
14217
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
14218
0
    datum->values = NULL;
14219
0
    datum->refcnt = NULL;
14220
14221
0
    datum->keys[0].integer = delete_value;
14222
14223
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
14224
0
                                    &ovsrec_flow_table_col_flow_limit,
14225
0
                                    datum);
14226
0
}
14227
14228
/* Adds the value 'new_value' to the "groups" set column from the "Flow_Table" table
14229
 * in 'row'.
14230
 *
14231
 */
14232
void
14233
ovsrec_flow_table_update_groups_addvalue(const struct ovsrec_flow_table *row, const char *new_value)
14234
0
{
14235
0
    struct ovsdb_datum *datum;
14236
14237
0
    datum = xmalloc(sizeof *datum);
14238
0
    datum->n = 1;
14239
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
14240
0
    datum->values = NULL;
14241
0
    datum->refcnt = NULL;
14242
14243
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
14244
14245
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
14246
0
                                    &ovsrec_flow_table_col_groups,
14247
0
                                    datum);
14248
0
}
14249
14250
/* Deletes the value 'delete_value' from the "groups" set column from the
14251
 * "Flow_Table" table in 'row'.
14252
 *
14253
 */
14254
void
14255
ovsrec_flow_table_update_groups_delvalue(const struct ovsrec_flow_table *row, const char *delete_value)
14256
0
{
14257
0
    struct ovsdb_datum *datum;
14258
14259
0
    datum = xmalloc(sizeof *datum);
14260
0
    datum->n = 1;
14261
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
14262
0
    datum->values = NULL;
14263
0
    datum->refcnt = NULL;
14264
14265
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
14266
14267
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
14268
0
                                    &ovsrec_flow_table_col_groups,
14269
0
                                    datum);
14270
0
}
14271
14272
/* Adds the value 'new_value' to the "name" set column from the "Flow_Table" table
14273
 * in 'row'.
14274
 *
14275
 */
14276
void
14277
ovsrec_flow_table_update_name_addvalue(const struct ovsrec_flow_table *row, const char *new_value)
14278
0
{
14279
0
    struct ovsdb_datum *datum;
14280
14281
0
    datum = xmalloc(sizeof *datum);
14282
0
    datum->n = 1;
14283
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
14284
0
    datum->values = NULL;
14285
0
    datum->refcnt = NULL;
14286
14287
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
14288
14289
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
14290
0
                                    &ovsrec_flow_table_col_name,
14291
0
                                    datum);
14292
0
}
14293
14294
/* Deletes the value 'delete_value' from the "name" set column from the
14295
 * "Flow_Table" table in 'row'.
14296
 *
14297
 */
14298
void
14299
ovsrec_flow_table_update_name_delvalue(const struct ovsrec_flow_table *row, const char *delete_value)
14300
0
{
14301
0
    struct ovsdb_datum *datum;
14302
14303
0
    datum = xmalloc(sizeof *datum);
14304
0
    datum->n = 1;
14305
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
14306
0
    datum->values = NULL;
14307
0
    datum->refcnt = NULL;
14308
14309
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
14310
14311
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
14312
0
                                    &ovsrec_flow_table_col_name,
14313
0
                                    datum);
14314
0
}
14315
14316
/* Adds the value 'new_value' to the "overflow_policy" set column from the "Flow_Table" table
14317
 * in 'row'.
14318
 *
14319
 */
14320
void
14321
ovsrec_flow_table_update_overflow_policy_addvalue(const struct ovsrec_flow_table *row, const char *new_value)
14322
0
{
14323
0
    struct ovsdb_datum *datum;
14324
14325
0
    datum = xmalloc(sizeof *datum);
14326
0
    datum->n = 1;
14327
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
14328
0
    datum->values = NULL;
14329
0
    datum->refcnt = NULL;
14330
14331
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
14332
14333
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
14334
0
                                    &ovsrec_flow_table_col_overflow_policy,
14335
0
                                    datum);
14336
0
}
14337
14338
/* Deletes the value 'delete_value' from the "overflow_policy" set column from the
14339
 * "Flow_Table" table in 'row'.
14340
 *
14341
 */
14342
void
14343
ovsrec_flow_table_update_overflow_policy_delvalue(const struct ovsrec_flow_table *row, const char *delete_value)
14344
0
{
14345
0
    struct ovsdb_datum *datum;
14346
14347
0
    datum = xmalloc(sizeof *datum);
14348
0
    datum->n = 1;
14349
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
14350
0
    datum->values = NULL;
14351
0
    datum->refcnt = NULL;
14352
14353
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
14354
14355
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
14356
0
                                    &ovsrec_flow_table_col_overflow_policy,
14357
0
                                    datum);
14358
0
}
14359
14360
/* Adds the value 'new_value' to the "prefixes" set column from the "Flow_Table" table
14361
 * in 'row'.
14362
 *
14363
 */
14364
void
14365
ovsrec_flow_table_update_prefixes_addvalue(const struct ovsrec_flow_table *row, const char *new_value)
14366
0
{
14367
0
    struct ovsdb_datum *datum;
14368
14369
0
    datum = xmalloc(sizeof *datum);
14370
0
    datum->n = 1;
14371
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
14372
0
    datum->values = NULL;
14373
0
    datum->refcnt = NULL;
14374
14375
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
14376
14377
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
14378
0
                                    &ovsrec_flow_table_col_prefixes,
14379
0
                                    datum);
14380
0
}
14381
14382
/* Deletes the value 'delete_value' from the "prefixes" set column from the
14383
 * "Flow_Table" table in 'row'.
14384
 *
14385
 */
14386
void
14387
ovsrec_flow_table_update_prefixes_delvalue(const struct ovsrec_flow_table *row, const char *delete_value)
14388
0
{
14389
0
    struct ovsdb_datum *datum;
14390
14391
0
    datum = xmalloc(sizeof *datum);
14392
0
    datum->n = 1;
14393
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
14394
0
    datum->values = NULL;
14395
0
    datum->refcnt = NULL;
14396
14397
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
14398
14399
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
14400
0
                                    &ovsrec_flow_table_col_prefixes,
14401
0
                                    datum);
14402
0
}
14403
14404
/* Sets the "external_ids" column's value from the "Flow_Table" table in 'row'
14405
 * to 'external_ids'.
14406
 *
14407
 * The caller retains ownership of 'external_ids' and everything in it. */
14408
void
14409
ovsrec_flow_table_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
14410
0
{
14411
0
    struct ovsdb_datum datum;
14412
14413
0
    if (external_ids) {
14414
0
        ovsdb_datum_from_smap(&datum, external_ids);
14415
0
    } else {
14416
0
        ovsdb_datum_init_empty(&datum);
14417
0
    }
14418
14419
0
    ovsdb_idl_condition_add_clause(cond,
14420
0
                                   function,
14421
0
                                   &ovsrec_flow_table_col_external_ids,
14422
0
                                   &datum);
14423
14424
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_external_ids.type);
14425
0
}
14426
14427
14428
/* Sets the "flow_limit" column from the "Flow_Table" table in 'row' to
14429
 * the 'flow_limit' set with 'n_flow_limit' entries.
14430
 *
14431
 * 'n_flow_limit' may be 0 or 1; if it is 0, then 'flow_limit'
14432
 * may be NULL.
14433
 *
14434
 * Argument constraints: at least 0
14435
 *
14436
 * The caller retains ownership of the arguments. */
14437
void
14438
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)
14439
0
{
14440
0
    struct ovsdb_datum datum;
14441
14442
0
    datum.refcnt = NULL;
14443
14444
0
    if (n_flow_limit) {
14445
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
14446
0
        datum.n = 1;
14447
0
        datum.keys = key;
14448
0
        key->integer = *flow_limit;
14449
0
    } else {
14450
0
        datum.n = 0;
14451
0
        datum.keys = NULL;
14452
0
    }
14453
0
    datum.values = NULL;
14454
0
    ovsdb_idl_condition_add_clause(cond,
14455
0
                          function,
14456
0
                          &ovsrec_flow_table_col_flow_limit,
14457
0
                          &datum);
14458
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_flow_limit.type);
14459
0
}
14460
14461
/* Sets the "groups" column from the "Flow_Table" table in 'row' to
14462
 * the 'groups' set with 'n_groups' entries.
14463
 *
14464
 * The caller retains ownership of the arguments. */
14465
void
14466
ovsrec_flow_table_add_clause_groups(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **groups, size_t n_groups)
14467
0
{
14468
0
    struct ovsdb_datum datum;
14469
14470
0
    datum.refcnt = NULL;
14471
0
    datum.n = n_groups;
14472
0
    datum.keys = n_groups ? xmalloc(n_groups * sizeof *datum.keys) : NULL;
14473
0
    datum.values = NULL;
14474
0
    for (size_t i = 0; i < n_groups; i++) {
14475
0
        datum.keys[i].s = ovsdb_atom_string_create(groups[i]);
14476
0
    }
14477
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_flow_table_col_groups.type);
14478
0
    ovsdb_idl_condition_add_clause(cond,
14479
0
                          function,
14480
0
                          &ovsrec_flow_table_col_groups,
14481
0
                          &datum);
14482
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_groups.type);
14483
0
}
14484
14485
/* Sets the "name" column from the "Flow_Table" table in 'row' to
14486
 * the 'name' set.
14487
 *
14488
 * If "name" is null, the column will be the empty set,
14489
 * otherwise it will contain the specified value.
14490
 *
14491
 * The caller retains ownership of the arguments. */
14492
void
14493
ovsrec_flow_table_add_clause_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *name)
14494
0
{
14495
0
    struct ovsdb_datum datum;
14496
14497
0
    datum.refcnt = NULL;
14498
14499
0
    if (name) {
14500
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
14501
0
        datum.n = 1;
14502
0
        datum.keys = key;
14503
0
        key->s = ovsdb_atom_string_create(name);
14504
0
    } else {
14505
0
        datum.n = 0;
14506
0
        datum.keys = NULL;
14507
0
    }
14508
0
    datum.values = NULL;
14509
0
    ovsdb_idl_condition_add_clause(cond,
14510
0
                          function,
14511
0
                          &ovsrec_flow_table_col_name,
14512
0
                          &datum);
14513
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_name.type);
14514
0
}
14515
14516
/* Sets the "overflow_policy" column from the "Flow_Table" table in 'row' to
14517
 * the 'overflow_policy' set.
14518
 *
14519
 * If "overflow_policy" is null, the column will be the empty set,
14520
 * otherwise it will contain the specified value.
14521
 *
14522
 * Argument constraints: either "evict" or "refuse"
14523
 *
14524
 * The caller retains ownership of the arguments. */
14525
void
14526
ovsrec_flow_table_add_clause_overflow_policy(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *overflow_policy)
14527
0
{
14528
0
    struct ovsdb_datum datum;
14529
14530
0
    datum.refcnt = NULL;
14531
14532
0
    if (overflow_policy) {
14533
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
14534
0
        datum.n = 1;
14535
0
        datum.keys = key;
14536
0
        key->s = ovsdb_atom_string_create(overflow_policy);
14537
0
    } else {
14538
0
        datum.n = 0;
14539
0
        datum.keys = NULL;
14540
0
    }
14541
0
    datum.values = NULL;
14542
0
    ovsdb_idl_condition_add_clause(cond,
14543
0
                          function,
14544
0
                          &ovsrec_flow_table_col_overflow_policy,
14545
0
                          &datum);
14546
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_overflow_policy.type);
14547
0
}
14548
14549
/* Sets the "prefixes" column from the "Flow_Table" table in 'row' to
14550
 * the 'prefixes' set with 'n_prefixes' entries.
14551
 *
14552
 * The caller retains ownership of the arguments. */
14553
void
14554
ovsrec_flow_table_add_clause_prefixes(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **prefixes, size_t n_prefixes)
14555
0
{
14556
0
    struct ovsdb_datum datum;
14557
14558
0
    datum.refcnt = NULL;
14559
0
    datum.n = n_prefixes;
14560
0
    datum.keys = n_prefixes ? xmalloc(n_prefixes * sizeof *datum.keys) : NULL;
14561
0
    datum.values = NULL;
14562
0
    for (size_t i = 0; i < n_prefixes; i++) {
14563
0
        datum.keys[i].s = ovsdb_atom_string_create(prefixes[i]);
14564
0
    }
14565
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_flow_table_col_prefixes.type);
14566
0
    ovsdb_idl_condition_add_clause(cond,
14567
0
                          function,
14568
0
                          &ovsrec_flow_table_col_prefixes,
14569
0
                          &datum);
14570
0
    ovsdb_datum_destroy(&datum, &ovsrec_flow_table_col_prefixes.type);
14571
0
}
14572
14573
/* Destroy 'row' of kind "Flow_Table". The row must have been
14574
 * created with ovsdb_idl_index_init_row.
14575
 */
14576
void
14577
ovsrec_flow_table_index_destroy_row(const struct ovsrec_flow_table *row)
14578
0
{
14579
0
    ovsdb_idl_index_destroy_row(&row->header_);
14580
0
}
14581
        
14582
14583
/* Creates a new row of kind "Flow_Table". */
14584
struct ovsrec_flow_table *
14585
ovsrec_flow_table_index_init_row(struct ovsdb_idl_index *index)
14586
0
{
14587
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_table);
14588
0
    return ALIGNED_CAST(struct ovsrec_flow_table *, ovsdb_idl_index_init_row(index));
14589
0
}
14590
14591
struct ovsrec_flow_table *
14592
ovsrec_flow_table_index_find(struct ovsdb_idl_index *index, const struct ovsrec_flow_table *target)
14593
0
{
14594
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_table);
14595
0
    return ovsrec_flow_table_cast(ovsdb_idl_index_find(index, &target->header_));
14596
0
}
14597
14598
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
14599
int
14600
ovsrec_flow_table_index_compare(
14601
    struct ovsdb_idl_index *index, 
14602
    const struct ovsrec_flow_table *a, 
14603
    const struct ovsrec_flow_table *b)
14604
0
{
14605
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
14606
0
}
14607
14608
struct ovsdb_idl_cursor
14609
ovsrec_flow_table_cursor_first(struct ovsdb_idl_index *index)
14610
0
{
14611
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_table);
14612
0
    return ovsdb_idl_cursor_first(index);
14613
0
}
14614
14615
struct ovsdb_idl_cursor
14616
ovsrec_flow_table_cursor_first_eq(
14617
    struct ovsdb_idl_index *index, const struct ovsrec_flow_table *target)
14618
0
{
14619
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_table);
14620
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
14621
0
}
14622
14623
struct ovsdb_idl_cursor
14624
ovsrec_flow_table_cursor_first_ge(
14625
    struct ovsdb_idl_index *index, const struct ovsrec_flow_table *target)
14626
0
{
14627
0
    ovs_assert(index->table->class_ == &ovsrec_table_flow_table);
14628
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
14629
0
}
14630
14631
struct ovsrec_flow_table *
14632
ovsrec_flow_table_cursor_data(struct ovsdb_idl_cursor *cursor)
14633
0
{
14634
0
    return ovsrec_flow_table_cast(ovsdb_idl_cursor_data(cursor));
14635
0
}
14636
14637
14638
/* Sets the "external_ids" column's value from the "Flow_Table" table in 'row'
14639
 * to 'external_ids'.
14640
 *
14641
 * The caller retains ownership of 'external_ids' and everything in it. */
14642
void
14643
ovsrec_flow_table_index_set_external_ids(const struct ovsrec_flow_table *row, const struct smap *external_ids)
14644
0
{
14645
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
14646
14647
0
    if (external_ids) {
14648
0
        struct smap_node *node;
14649
0
        size_t i;
14650
14651
0
        datum->n = smap_count(external_ids);
14652
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
14653
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
14654
0
        datum->refcnt = NULL;
14655
14656
0
        i = 0;
14657
0
        SMAP_FOR_EACH (node, external_ids) {
14658
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
14659
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
14660
0
            i++;
14661
0
        }
14662
0
        ovsdb_datum_sort_unique(datum, &ovsrec_flow_table_col_external_ids.type);
14663
0
    } else {
14664
0
        ovsdb_datum_init_empty(datum);
14665
0
    }
14666
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
14667
0
                          &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_EXTERNAL_IDS],
14668
0
                          datum,
14669
0
                          &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]);
14670
0
    free(datum);
14671
0
}
14672
14673
14674
/* Sets the "flow_limit" column from the "Flow_Table" table in 'row' to
14675
 * the 'flow_limit' set with 'n_flow_limit' entries.
14676
 *
14677
 * 'n_flow_limit' may be 0 or 1; if it is 0, then 'flow_limit'
14678
 * may be NULL.
14679
 *
14680
 * Argument constraints: at least 0
14681
 *
14682
 * The caller retains ownership of the arguments. */
14683
void
14684
ovsrec_flow_table_index_set_flow_limit(const struct ovsrec_flow_table *row, const int64_t *flow_limit, size_t n_flow_limit)
14685
0
{
14686
0
    struct ovsdb_datum datum;
14687
14688
0
    datum.refcnt = NULL;
14689
0
    union ovsdb_atom *key;
14690
14691
0
    if (n_flow_limit) {
14692
0
        key = xmalloc(sizeof(union ovsdb_atom));
14693
0
        datum.n = 1;
14694
0
        datum.keys = key;
14695
0
        key->integer = *flow_limit;
14696
0
    } else {
14697
0
        datum.n = 0;
14698
0
        datum.keys = NULL;
14699
0
    }
14700
0
    datum.values = NULL;
14701
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]);
14702
0
}
14703
14704
/* Sets the "groups" column from the "Flow_Table" table in 'row' to
14705
 * the 'groups' set with 'n_groups' entries.
14706
 *
14707
 * The caller retains ownership of the arguments. */
14708
void
14709
ovsrec_flow_table_index_set_groups(const struct ovsrec_flow_table *row, const char **groups, size_t n_groups)
14710
0
{
14711
0
    struct ovsdb_datum datum;
14712
14713
0
    datum.refcnt = NULL;
14714
0
    size_t i;
14715
14716
0
    datum.n = n_groups;
14717
0
    datum.keys = n_groups ? xmalloc(n_groups * sizeof *datum.keys) : NULL;
14718
0
    datum.values = NULL;
14719
0
    for (i = 0; i < n_groups; i++) {
14720
0
        datum.keys[i].s = ovsdb_atom_string_create(groups[i]);
14721
0
    }
14722
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_flow_table_col_groups.type);
14723
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]);
14724
0
}
14725
14726
/* Sets the "name" column from the "Flow_Table" table in 'row' to
14727
 * the 'name' set.
14728
 *
14729
 * If "name" is null, the column will be the empty set,
14730
 * otherwise it will contain the specified value.
14731
 *
14732
 * The caller retains ownership of the arguments. */
14733
void
14734
ovsrec_flow_table_index_set_name(const struct ovsrec_flow_table *row, const char *name)
14735
0
{
14736
0
    struct ovsdb_datum datum;
14737
14738
0
    datum.refcnt = NULL;
14739
0
    union ovsdb_atom *key;
14740
14741
0
    if (name) {
14742
0
        key = xmalloc(sizeof (union ovsdb_atom));
14743
0
        datum.n = 1;
14744
0
        datum.keys = key;
14745
0
        key->s = ovsdb_atom_string_create(name);
14746
0
    } else {
14747
0
        datum.n = 0;
14748
0
        datum.keys = NULL;
14749
0
    }
14750
0
    datum.values = NULL;
14751
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]);
14752
0
}
14753
14754
/* Sets the "overflow_policy" column from the "Flow_Table" table in 'row' to
14755
 * the 'overflow_policy' set.
14756
 *
14757
 * If "overflow_policy" is null, the column will be the empty set,
14758
 * otherwise it will contain the specified value.
14759
 *
14760
 * Argument constraints: either "evict" or "refuse"
14761
 *
14762
 * The caller retains ownership of the arguments. */
14763
void
14764
ovsrec_flow_table_index_set_overflow_policy(const struct ovsrec_flow_table *row, const char *overflow_policy)
14765
0
{
14766
0
    struct ovsdb_datum datum;
14767
14768
0
    datum.refcnt = NULL;
14769
0
    union ovsdb_atom *key;
14770
14771
0
    if (overflow_policy) {
14772
0
        key = xmalloc(sizeof (union ovsdb_atom));
14773
0
        datum.n = 1;
14774
0
        datum.keys = key;
14775
0
        key->s = ovsdb_atom_string_create(overflow_policy);
14776
0
    } else {
14777
0
        datum.n = 0;
14778
0
        datum.keys = NULL;
14779
0
    }
14780
0
    datum.values = NULL;
14781
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]);
14782
0
}
14783
14784
/* Sets the "prefixes" column from the "Flow_Table" table in 'row' to
14785
 * the 'prefixes' set with 'n_prefixes' entries.
14786
 *
14787
 * The caller retains ownership of the arguments. */
14788
void
14789
ovsrec_flow_table_index_set_prefixes(const struct ovsrec_flow_table *row, const char **prefixes, size_t n_prefixes)
14790
0
{
14791
0
    struct ovsdb_datum datum;
14792
14793
0
    datum.refcnt = NULL;
14794
0
    size_t i;
14795
14796
0
    datum.n = n_prefixes;
14797
0
    datum.keys = n_prefixes ? xmalloc(n_prefixes * sizeof *datum.keys) : NULL;
14798
0
    datum.values = NULL;
14799
0
    for (i = 0; i < n_prefixes; i++) {
14800
0
        datum.keys[i].s = ovsdb_atom_string_create(prefixes[i]);
14801
0
    }
14802
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_flow_table_col_prefixes.type);
14803
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]);
14804
0
}
14805
14806
struct ovsdb_idl_column ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_N_COLUMNS];
14807
14808
unsigned int
14809
ovsrec_flow_table_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
14810
0
{
14811
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_flow_table, condition);
14812
0
}
14813
static struct json Flow_Table_col_overflow_policy_key_enum_key_strings[2] = {
14814
    { .type = JSON_STRING, .string = "evict", .count = 2 },
14815
    { .type = JSON_STRING, .string = "refuse", .count = 2 },
14816
};
14817
static union ovsdb_atom Flow_Table_col_overflow_policy_key_enum_keys[2] = {
14818
    { .s = &Flow_Table_col_overflow_policy_key_enum_key_strings[0] },
14819
    { .s = &Flow_Table_col_overflow_policy_key_enum_key_strings[1] },
14820
};
14821
static struct ovsdb_datum Flow_Table_col_overflow_policy_key_enum = {
14822
    .n = 2,
14823
    .keys = Flow_Table_col_overflow_policy_key_enum_keys,
14824
};
14825
14826
struct ovsdb_idl_column ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_N_COLUMNS] = {
14827
    [OVSREC_FLOW_TABLE_COL_EXTERNAL_IDS] = {
14828
         .name = "external_ids",
14829
         .type = {
14830
            .key = {
14831
               .type = OVSDB_TYPE_STRING,
14832
               .string = { .minLen = 0, .maxLen = UINT_MAX },
14833
            },
14834
            .value = {
14835
                .type = OVSDB_TYPE_STRING,
14836
                .string = { .minLen = 0, .maxLen = UINT_MAX },
14837
            },
14838
            .n_min = 0,
14839
            .n_max = UINT_MAX,
14840
         },
14841
         .is_mutable = true,
14842
         .is_synthetic = false,
14843
         .parse = ovsrec_flow_table_parse_external_ids,
14844
         .unparse = ovsrec_flow_table_unparse_external_ids,
14845
    },
14846
14847
    [OVSREC_FLOW_TABLE_COL_FLOW_LIMIT] = {
14848
         .name = "flow_limit",
14849
         .type = {
14850
            .key = {
14851
               .type = OVSDB_TYPE_INTEGER,
14852
               .integer = { .min = INT64_C(0), .max = INT64_MAX },
14853
            },
14854
            .value = OVSDB_BASE_VOID_INIT,
14855
            .n_min = 0,
14856
            .n_max = 1,
14857
         },
14858
         .is_mutable = true,
14859
         .is_synthetic = false,
14860
         .parse = ovsrec_flow_table_parse_flow_limit,
14861
         .unparse = ovsrec_flow_table_unparse_flow_limit,
14862
    },
14863
14864
    [OVSREC_FLOW_TABLE_COL_GROUPS] = {
14865
         .name = "groups",
14866
         .type = {
14867
            .key = {
14868
               .type = OVSDB_TYPE_STRING,
14869
               .string = { .minLen = 0, .maxLen = UINT_MAX },
14870
            },
14871
            .value = OVSDB_BASE_VOID_INIT,
14872
            .n_min = 0,
14873
            .n_max = UINT_MAX,
14874
         },
14875
         .is_mutable = true,
14876
         .is_synthetic = false,
14877
         .parse = ovsrec_flow_table_parse_groups,
14878
         .unparse = ovsrec_flow_table_unparse_groups,
14879
    },
14880
14881
    [OVSREC_FLOW_TABLE_COL_NAME] = {
14882
         .name = "name",
14883
         .type = {
14884
            .key = {
14885
               .type = OVSDB_TYPE_STRING,
14886
               .string = { .minLen = 0, .maxLen = UINT_MAX },
14887
            },
14888
            .value = OVSDB_BASE_VOID_INIT,
14889
            .n_min = 0,
14890
            .n_max = 1,
14891
         },
14892
         .is_mutable = true,
14893
         .is_synthetic = false,
14894
         .parse = ovsrec_flow_table_parse_name,
14895
         .unparse = ovsrec_flow_table_unparse_name,
14896
    },
14897
14898
    [OVSREC_FLOW_TABLE_COL_OVERFLOW_POLICY] = {
14899
         .name = "overflow_policy",
14900
         .type = {
14901
            .key = {
14902
               .type = OVSDB_TYPE_STRING,
14903
               .enum_ = &Flow_Table_col_overflow_policy_key_enum,
14904
               .string = { .minLen = 0, .maxLen = UINT_MAX },
14905
            },
14906
            .value = OVSDB_BASE_VOID_INIT,
14907
            .n_min = 0,
14908
            .n_max = 1,
14909
         },
14910
         .is_mutable = true,
14911
         .is_synthetic = false,
14912
         .parse = ovsrec_flow_table_parse_overflow_policy,
14913
         .unparse = ovsrec_flow_table_unparse_overflow_policy,
14914
    },
14915
14916
    [OVSREC_FLOW_TABLE_COL_PREFIXES] = {
14917
         .name = "prefixes",
14918
         .type = {
14919
            .key = {
14920
               .type = OVSDB_TYPE_STRING,
14921
               .string = { .minLen = 0, .maxLen = UINT_MAX },
14922
            },
14923
            .value = OVSDB_BASE_VOID_INIT,
14924
            .n_min = 0,
14925
            .n_max = 3,
14926
         },
14927
         .is_mutable = true,
14928
         .is_synthetic = false,
14929
         .parse = ovsrec_flow_table_parse_prefixes,
14930
         .unparse = ovsrec_flow_table_unparse_prefixes,
14931
    },
14932
14933
};
14934

14935
/* IPFIX table. */
14936
14937
bool
14938
ovsrec_server_has_ipfix_table_col_cache_active_timeout(const struct ovsdb_idl *idl)
14939
0
{
14940
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_cache_active_timeout);
14941
0
}
14942
14943
14944
bool
14945
ovsrec_server_has_ipfix_table_col_cache_max_flows(const struct ovsdb_idl *idl)
14946
0
{
14947
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_cache_max_flows);
14948
0
}
14949
14950
14951
bool
14952
ovsrec_server_has_ipfix_table_col_external_ids(const struct ovsdb_idl *idl)
14953
0
{
14954
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_external_ids);
14955
0
}
14956
14957
14958
bool
14959
ovsrec_server_has_ipfix_table_col_obs_domain_id(const struct ovsdb_idl *idl)
14960
0
{
14961
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_obs_domain_id);
14962
0
}
14963
14964
14965
bool
14966
ovsrec_server_has_ipfix_table_col_obs_point_id(const struct ovsdb_idl *idl)
14967
0
{
14968
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_obs_point_id);
14969
0
}
14970
14971
14972
bool
14973
ovsrec_server_has_ipfix_table_col_other_config(const struct ovsdb_idl *idl)
14974
0
{
14975
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_other_config);
14976
0
}
14977
14978
14979
bool
14980
ovsrec_server_has_ipfix_table_col_sampling(const struct ovsdb_idl *idl)
14981
0
{
14982
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_sampling);
14983
0
}
14984
14985
14986
bool
14987
ovsrec_server_has_ipfix_table_col_stats_interval(const struct ovsdb_idl *idl)
14988
0
{
14989
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_stats_interval);
14990
0
}
14991
14992
14993
bool
14994
ovsrec_server_has_ipfix_table_col_targets(const struct ovsdb_idl *idl)
14995
0
{
14996
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_targets);
14997
0
}
14998
14999
15000
bool
15001
ovsrec_server_has_ipfix_table_col_template_interval(const struct ovsdb_idl *idl)
15002
0
{
15003
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ipfix_col_template_interval);
15004
0
}
15005
15006
15007
bool
15008
ovsrec_server_has_ipfix_table(const struct ovsdb_idl *idl)
15009
0
{
15010
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
15011
0
}
15012
15013
15014
const struct ovsrec_ipfix_table *
15015
ovsrec_ipfix_table_get(const struct ovsdb_idl *idl)
15016
0
{
15017
0
    return (const struct ovsrec_ipfix_table *) idl;
15018
0
}
15019
15020
const struct ovsrec_ipfix *
15021
ovsrec_ipfix_table_first(const struct ovsrec_ipfix_table *table)
15022
0
{
15023
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
15024
0
    return ovsrec_ipfix_first(idl);
15025
0
}
15026
15027
15028
const struct ovsrec_ipfix *
15029
ovsrec_ipfix_table_track_get_first(const struct ovsrec_ipfix_table *table)
15030
0
{
15031
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
15032
0
    return ovsrec_ipfix_track_get_first(idl);
15033
0
}
15034
15035
15036
static void
15037
ovsrec_ipfix_parse_cache_active_timeout(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
15038
0
{
15039
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15040
0
    size_t n = MIN(1, datum->n);
15041
0
    row->cache_active_timeout = NULL;
15042
0
    row->n_cache_active_timeout = 0;
15043
0
    for (size_t i = 0; i < n; i++) {
15044
0
        if (!row->n_cache_active_timeout) {
15045
0
            row->cache_active_timeout = xmalloc(n * sizeof *row->cache_active_timeout);
15046
0
        }
15047
0
        row->cache_active_timeout[row->n_cache_active_timeout] = datum->keys[i].integer;
15048
0
        row->n_cache_active_timeout++;
15049
0
    }
15050
0
}
15051
15052
static void
15053
ovsrec_ipfix_parse_cache_max_flows(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
15054
0
{
15055
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15056
0
    size_t n = MIN(1, datum->n);
15057
0
    row->cache_max_flows = NULL;
15058
0
    row->n_cache_max_flows = 0;
15059
0
    for (size_t i = 0; i < n; i++) {
15060
0
        if (!row->n_cache_max_flows) {
15061
0
            row->cache_max_flows = xmalloc(n * sizeof *row->cache_max_flows);
15062
0
        }
15063
0
        row->cache_max_flows[row->n_cache_max_flows] = datum->keys[i].integer;
15064
0
        row->n_cache_max_flows++;
15065
0
    }
15066
0
}
15067
15068
static void
15069
ovsrec_ipfix_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
15070
0
{
15071
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15072
0
    smap_init(&row->external_ids);
15073
0
    for (size_t i = 0; i < datum->n; i++) {
15074
0
        smap_add(&row->external_ids,
15075
0
                 json_string(datum->keys[i].s),
15076
0
                 json_string(datum->values[i].s));
15077
0
    }
15078
0
}
15079
15080
static void
15081
ovsrec_ipfix_parse_obs_domain_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
15082
0
{
15083
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15084
0
    size_t n = MIN(1, datum->n);
15085
0
    row->obs_domain_id = NULL;
15086
0
    row->n_obs_domain_id = 0;
15087
0
    for (size_t i = 0; i < n; i++) {
15088
0
        if (!row->n_obs_domain_id) {
15089
0
            row->obs_domain_id = xmalloc(n * sizeof *row->obs_domain_id);
15090
0
        }
15091
0
        row->obs_domain_id[row->n_obs_domain_id] = datum->keys[i].integer;
15092
0
        row->n_obs_domain_id++;
15093
0
    }
15094
0
}
15095
15096
static void
15097
ovsrec_ipfix_parse_obs_point_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
15098
0
{
15099
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15100
0
    size_t n = MIN(1, datum->n);
15101
0
    row->obs_point_id = NULL;
15102
0
    row->n_obs_point_id = 0;
15103
0
    for (size_t i = 0; i < n; i++) {
15104
0
        if (!row->n_obs_point_id) {
15105
0
            row->obs_point_id = xmalloc(n * sizeof *row->obs_point_id);
15106
0
        }
15107
0
        row->obs_point_id[row->n_obs_point_id] = datum->keys[i].integer;
15108
0
        row->n_obs_point_id++;
15109
0
    }
15110
0
}
15111
15112
static void
15113
ovsrec_ipfix_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
15114
0
{
15115
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15116
0
    smap_init(&row->other_config);
15117
0
    for (size_t i = 0; i < datum->n; i++) {
15118
0
        smap_add(&row->other_config,
15119
0
                 json_string(datum->keys[i].s),
15120
0
                 json_string(datum->values[i].s));
15121
0
    }
15122
0
}
15123
15124
static void
15125
ovsrec_ipfix_parse_sampling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
15126
0
{
15127
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15128
0
    size_t n = MIN(1, datum->n);
15129
0
    row->sampling = NULL;
15130
0
    row->n_sampling = 0;
15131
0
    for (size_t i = 0; i < n; i++) {
15132
0
        if (!row->n_sampling) {
15133
0
            row->sampling = xmalloc(n * sizeof *row->sampling);
15134
0
        }
15135
0
        row->sampling[row->n_sampling] = datum->keys[i].integer;
15136
0
        row->n_sampling++;
15137
0
    }
15138
0
}
15139
15140
static void
15141
ovsrec_ipfix_parse_stats_interval(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
15142
0
{
15143
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15144
0
    size_t n = MIN(1, datum->n);
15145
0
    row->stats_interval = NULL;
15146
0
    row->n_stats_interval = 0;
15147
0
    for (size_t i = 0; i < n; i++) {
15148
0
        if (!row->n_stats_interval) {
15149
0
            row->stats_interval = xmalloc(n * sizeof *row->stats_interval);
15150
0
        }
15151
0
        row->stats_interval[row->n_stats_interval] = datum->keys[i].integer;
15152
0
        row->n_stats_interval++;
15153
0
    }
15154
0
}
15155
15156
static void
15157
ovsrec_ipfix_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
15158
0
{
15159
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15160
0
    row->targets = NULL;
15161
0
    row->n_targets = 0;
15162
0
    for (size_t i = 0; i < datum->n; i++) {
15163
0
        if (!row->n_targets) {
15164
0
            row->targets = xmalloc(datum->n * sizeof *row->targets);
15165
0
        }
15166
0
        row->targets[row->n_targets] = datum->keys[i].s->string;
15167
0
        row->n_targets++;
15168
0
    }
15169
0
}
15170
15171
static void
15172
ovsrec_ipfix_parse_template_interval(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
15173
0
{
15174
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15175
0
    size_t n = MIN(1, datum->n);
15176
0
    row->template_interval = NULL;
15177
0
    row->n_template_interval = 0;
15178
0
    for (size_t i = 0; i < n; i++) {
15179
0
        if (!row->n_template_interval) {
15180
0
            row->template_interval = xmalloc(n * sizeof *row->template_interval);
15181
0
        }
15182
0
        row->template_interval[row->n_template_interval] = datum->keys[i].integer;
15183
0
        row->n_template_interval++;
15184
0
    }
15185
0
}
15186
15187
static void
15188
ovsrec_ipfix_unparse_cache_active_timeout(struct ovsdb_idl_row *row_)
15189
0
{
15190
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15191
0
    free(row->cache_active_timeout);
15192
0
}
15193
15194
static void
15195
ovsrec_ipfix_unparse_cache_max_flows(struct ovsdb_idl_row *row_)
15196
0
{
15197
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15198
0
    free(row->cache_max_flows);
15199
0
}
15200
15201
static void
15202
ovsrec_ipfix_unparse_external_ids(struct ovsdb_idl_row *row_)
15203
0
{
15204
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15205
0
    smap_destroy(&row->external_ids);
15206
0
}
15207
15208
static void
15209
ovsrec_ipfix_unparse_obs_domain_id(struct ovsdb_idl_row *row_)
15210
0
{
15211
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15212
0
    free(row->obs_domain_id);
15213
0
}
15214
15215
static void
15216
ovsrec_ipfix_unparse_obs_point_id(struct ovsdb_idl_row *row_)
15217
0
{
15218
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15219
0
    free(row->obs_point_id);
15220
0
}
15221
15222
static void
15223
ovsrec_ipfix_unparse_other_config(struct ovsdb_idl_row *row_)
15224
0
{
15225
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15226
0
    smap_destroy(&row->other_config);
15227
0
}
15228
15229
static void
15230
ovsrec_ipfix_unparse_sampling(struct ovsdb_idl_row *row_)
15231
0
{
15232
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15233
0
    free(row->sampling);
15234
0
}
15235
15236
static void
15237
ovsrec_ipfix_unparse_stats_interval(struct ovsdb_idl_row *row_)
15238
0
{
15239
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15240
0
    free(row->stats_interval);
15241
0
}
15242
15243
static void
15244
ovsrec_ipfix_unparse_targets(struct ovsdb_idl_row *row_)
15245
0
{
15246
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15247
0
    free(row->targets);
15248
0
}
15249
15250
static void
15251
ovsrec_ipfix_unparse_template_interval(struct ovsdb_idl_row *row_)
15252
0
{
15253
0
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
15254
0
    free(row->template_interval);
15255
0
}
15256
15257
static void
15258
ovsrec_ipfix_init__(struct ovsdb_idl_row *row)
15259
0
{
15260
0
    ovsrec_ipfix_init(ovsrec_ipfix_cast(row));
15261
0
}
15262
15263
/* Clears the contents of 'row' in table "IPFIX". */
15264
void
15265
ovsrec_ipfix_init(struct ovsrec_ipfix *row)
15266
0
{
15267
0
    memset(row, 0, sizeof *row); 
15268
0
    smap_init(&row->external_ids);
15269
0
    smap_init(&row->other_config);
15270
0
}
15271
15272
/* Searches table "IPFIX" in 'idl' for a row with UUID 'uuid'.  Returns
15273
 * a pointer to the row if there is one, otherwise a null pointer.  */
15274
const struct ovsrec_ipfix *
15275
ovsrec_ipfix_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
15276
0
{
15277
0
    return ovsrec_ipfix_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_ipfix, uuid));
15278
0
}
15279
15280
/* Searches table "IPFIX" for a row with UUID 'uuid'.  Returns
15281
 * a pointer to the row if there is one, otherwise a null pointer.  */
15282
const struct ovsrec_ipfix *
15283
ovsrec_ipfix_table_get_for_uuid(const struct ovsrec_ipfix_table *table, const struct uuid *uuid)
15284
0
{
15285
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
15286
0
    return ovsrec_ipfix_get_for_uuid(idl, uuid);
15287
0
}
15288
15289
/* Returns a row in table "IPFIX" in 'idl', or a null pointer if that
15290
 * table is empty.
15291
 *
15292
 * Database tables are internally maintained as hash tables, so adding or
15293
 * removing rows while traversing the same table can cause some rows to be
15294
 * visited twice or not at apply. */
15295
const struct ovsrec_ipfix *
15296
ovsrec_ipfix_first(const struct ovsdb_idl *idl)
15297
0
{
15298
0
    return ovsrec_ipfix_cast(ovsdb_idl_first_row(idl, &ovsrec_table_ipfix));
15299
0
}
15300
15301
/* Returns a row following 'row' within its table, or a null pointer if 'row'
15302
 * is the last row in its table. */
15303
const struct ovsrec_ipfix *
15304
ovsrec_ipfix_next(const struct ovsrec_ipfix *row)
15305
0
{
15306
0
    return ovsrec_ipfix_cast(ovsdb_idl_next_row(&row->header_));
15307
0
}
15308
15309
unsigned int ovsrec_ipfix_get_seqno(const struct ovsdb_idl *idl)
15310
0
{
15311
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_ipfix);
15312
0
}
15313
15314
unsigned int ovsrec_ipfix_row_get_seqno(const struct ovsrec_ipfix *row, enum ovsdb_idl_change change)
15315
0
{
15316
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
15317
0
}
15318
15319
const struct ovsrec_ipfix *
15320
ovsrec_ipfix_track_get_first(const struct ovsdb_idl *idl)
15321
0
{
15322
0
    return ovsrec_ipfix_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_ipfix));
15323
0
}
15324
15325
const struct ovsrec_ipfix
15326
*ovsrec_ipfix_track_get_next(const struct ovsrec_ipfix *row)
15327
0
{
15328
0
    return ovsrec_ipfix_cast(ovsdb_idl_track_get_next(&row->header_));
15329
0
}
15330
15331
15332
/* Deletes 'row' from table "IPFIX".  'row' may be freed, so it must not be
15333
 * accessed afterward.
15334
 *
15335
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15336
void
15337
ovsrec_ipfix_delete(const struct ovsrec_ipfix *row)
15338
0
{
15339
0
    ovsdb_idl_txn_delete(&row->header_);
15340
0
}
15341
15342
/* Inserts and returns a new row in the table "IPFIX" in the database
15343
 * with open transaction 'txn'.
15344
 *
15345
 * The new row is assigned a randomly generated provisional UUID.
15346
 * ovsdb-server will assign a different UUID when 'txn' is committed,
15347
 * but the IDL will replace any uses of the provisional UUID in the
15348
 * data to be to be committed by the UUID assigned by ovsdb-server. */
15349
struct ovsrec_ipfix *
15350
ovsrec_ipfix_insert(struct ovsdb_idl_txn *txn)
15351
0
{
15352
0
    return ovsrec_ipfix_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_ipfix, NULL));
15353
0
}
15354
15355
/* Inserts and returns a new row in the table "IPFIX" in the database
15356
 * with open transaction 'txn'.
15357
 *
15358
 * The new row is assigned the UUID specified in the 'uuid' parameter
15359
 * (which cannot be null).  ovsdb-server will try to assign the same
15360
 * UUID when 'txn' is committed. */
15361
struct ovsrec_ipfix *
15362
ovsrec_ipfix_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
15363
0
{
15364
0
    return ovsrec_ipfix_cast(ovsdb_idl_txn_insert_persist_uuid(
15365
0
        txn, &ovsrec_table_ipfix, uuid));
15366
0
}
15367
15368
bool
15369
ovsrec_ipfix_is_updated(const struct ovsrec_ipfix *row, enum ovsrec_ipfix_column_id column)
15370
0
{
15371
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_ipfix_columns[column]);
15372
0
}
15373
15374
/* Causes the original contents of column "cache_active_timeout" in 'row' to be
15375
 * verified as a prerequisite to completing the transaction.  That is, if
15376
 * "cache_active_timeout" in 'row' changed (or if 'row' was deleted) between the
15377
 * time that the IDL originally read its contents and the time that the
15378
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
15379
 *
15380
 * The intention is that, to ensure that no transaction commits based on dirty
15381
 * reads, an application should call this function any time "cache_active_timeout" is
15382
 * read as part of a read-modify-write operation.
15383
 *
15384
 * In some cases this function reduces to a no-op, because the current value
15385
 * of "cache_active_timeout" is already known:
15386
 *
15387
 *   - If 'row' is a row created by the current transaction (returned by
15388
 *     ovsrec_ipfix_insert()).
15389
 *
15390
 *   - If "cache_active_timeout" has already been modified (with
15391
 *     ovsrec_ipfix_set_cache_active_timeout()) within the current transaction.
15392
 *
15393
 * Because of the latter property, always call this function *before*
15394
 * ovsrec_ipfix_set_cache_active_timeout() for a given read-modify-write.
15395
 *
15396
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15397
void
15398
ovsrec_ipfix_verify_cache_active_timeout(const struct ovsrec_ipfix *row)
15399
0
{
15400
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_cache_active_timeout);
15401
0
}
15402
15403
/* Causes the original contents of column "cache_max_flows" in 'row' to be
15404
 * verified as a prerequisite to completing the transaction.  That is, if
15405
 * "cache_max_flows" in 'row' changed (or if 'row' was deleted) between the
15406
 * time that the IDL originally read its contents and the time that the
15407
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
15408
 *
15409
 * The intention is that, to ensure that no transaction commits based on dirty
15410
 * reads, an application should call this function any time "cache_max_flows" is
15411
 * read as part of a read-modify-write operation.
15412
 *
15413
 * In some cases this function reduces to a no-op, because the current value
15414
 * of "cache_max_flows" is already known:
15415
 *
15416
 *   - If 'row' is a row created by the current transaction (returned by
15417
 *     ovsrec_ipfix_insert()).
15418
 *
15419
 *   - If "cache_max_flows" has already been modified (with
15420
 *     ovsrec_ipfix_set_cache_max_flows()) within the current transaction.
15421
 *
15422
 * Because of the latter property, always call this function *before*
15423
 * ovsrec_ipfix_set_cache_max_flows() for a given read-modify-write.
15424
 *
15425
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15426
void
15427
ovsrec_ipfix_verify_cache_max_flows(const struct ovsrec_ipfix *row)
15428
0
{
15429
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_cache_max_flows);
15430
0
}
15431
15432
/* Causes the original contents of column "external_ids" in 'row' to be
15433
 * verified as a prerequisite to completing the transaction.  That is, if
15434
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
15435
 * time that the IDL originally read its contents and the time that the
15436
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
15437
 *
15438
 * The intention is that, to ensure that no transaction commits based on dirty
15439
 * reads, an application should call this function any time "external_ids" is
15440
 * read as part of a read-modify-write operation.
15441
 *
15442
 * In some cases this function reduces to a no-op, because the current value
15443
 * of "external_ids" is already known:
15444
 *
15445
 *   - If 'row' is a row created by the current transaction (returned by
15446
 *     ovsrec_ipfix_insert()).
15447
 *
15448
 *   - If "external_ids" has already been modified (with
15449
 *     ovsrec_ipfix_set_external_ids()) within the current transaction.
15450
 *
15451
 * Because of the latter property, always call this function *before*
15452
 * ovsrec_ipfix_set_external_ids() for a given read-modify-write.
15453
 *
15454
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15455
void
15456
ovsrec_ipfix_verify_external_ids(const struct ovsrec_ipfix *row)
15457
0
{
15458
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_external_ids);
15459
0
}
15460
15461
/* Causes the original contents of column "obs_domain_id" in 'row' to be
15462
 * verified as a prerequisite to completing the transaction.  That is, if
15463
 * "obs_domain_id" in 'row' changed (or if 'row' was deleted) between the
15464
 * time that the IDL originally read its contents and the time that the
15465
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
15466
 *
15467
 * The intention is that, to ensure that no transaction commits based on dirty
15468
 * reads, an application should call this function any time "obs_domain_id" is
15469
 * read as part of a read-modify-write operation.
15470
 *
15471
 * In some cases this function reduces to a no-op, because the current value
15472
 * of "obs_domain_id" is already known:
15473
 *
15474
 *   - If 'row' is a row created by the current transaction (returned by
15475
 *     ovsrec_ipfix_insert()).
15476
 *
15477
 *   - If "obs_domain_id" has already been modified (with
15478
 *     ovsrec_ipfix_set_obs_domain_id()) within the current transaction.
15479
 *
15480
 * Because of the latter property, always call this function *before*
15481
 * ovsrec_ipfix_set_obs_domain_id() for a given read-modify-write.
15482
 *
15483
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15484
void
15485
ovsrec_ipfix_verify_obs_domain_id(const struct ovsrec_ipfix *row)
15486
0
{
15487
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_obs_domain_id);
15488
0
}
15489
15490
/* Causes the original contents of column "obs_point_id" in 'row' to be
15491
 * verified as a prerequisite to completing the transaction.  That is, if
15492
 * "obs_point_id" in 'row' changed (or if 'row' was deleted) between the
15493
 * time that the IDL originally read its contents and the time that the
15494
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
15495
 *
15496
 * The intention is that, to ensure that no transaction commits based on dirty
15497
 * reads, an application should call this function any time "obs_point_id" is
15498
 * read as part of a read-modify-write operation.
15499
 *
15500
 * In some cases this function reduces to a no-op, because the current value
15501
 * of "obs_point_id" is already known:
15502
 *
15503
 *   - If 'row' is a row created by the current transaction (returned by
15504
 *     ovsrec_ipfix_insert()).
15505
 *
15506
 *   - If "obs_point_id" has already been modified (with
15507
 *     ovsrec_ipfix_set_obs_point_id()) within the current transaction.
15508
 *
15509
 * Because of the latter property, always call this function *before*
15510
 * ovsrec_ipfix_set_obs_point_id() for a given read-modify-write.
15511
 *
15512
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15513
void
15514
ovsrec_ipfix_verify_obs_point_id(const struct ovsrec_ipfix *row)
15515
0
{
15516
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_obs_point_id);
15517
0
}
15518
15519
/* Causes the original contents of column "other_config" in 'row' to be
15520
 * verified as a prerequisite to completing the transaction.  That is, if
15521
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
15522
 * time that the IDL originally read its contents and the time that the
15523
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
15524
 *
15525
 * The intention is that, to ensure that no transaction commits based on dirty
15526
 * reads, an application should call this function any time "other_config" is
15527
 * read as part of a read-modify-write operation.
15528
 *
15529
 * In some cases this function reduces to a no-op, because the current value
15530
 * of "other_config" is already known:
15531
 *
15532
 *   - If 'row' is a row created by the current transaction (returned by
15533
 *     ovsrec_ipfix_insert()).
15534
 *
15535
 *   - If "other_config" has already been modified (with
15536
 *     ovsrec_ipfix_set_other_config()) within the current transaction.
15537
 *
15538
 * Because of the latter property, always call this function *before*
15539
 * ovsrec_ipfix_set_other_config() for a given read-modify-write.
15540
 *
15541
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15542
void
15543
ovsrec_ipfix_verify_other_config(const struct ovsrec_ipfix *row)
15544
0
{
15545
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_other_config);
15546
0
}
15547
15548
/* Causes the original contents of column "sampling" in 'row' to be
15549
 * verified as a prerequisite to completing the transaction.  That is, if
15550
 * "sampling" in 'row' changed (or if 'row' was deleted) between the
15551
 * time that the IDL originally read its contents and the time that the
15552
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
15553
 *
15554
 * The intention is that, to ensure that no transaction commits based on dirty
15555
 * reads, an application should call this function any time "sampling" is
15556
 * read as part of a read-modify-write operation.
15557
 *
15558
 * In some cases this function reduces to a no-op, because the current value
15559
 * of "sampling" is already known:
15560
 *
15561
 *   - If 'row' is a row created by the current transaction (returned by
15562
 *     ovsrec_ipfix_insert()).
15563
 *
15564
 *   - If "sampling" has already been modified (with
15565
 *     ovsrec_ipfix_set_sampling()) within the current transaction.
15566
 *
15567
 * Because of the latter property, always call this function *before*
15568
 * ovsrec_ipfix_set_sampling() for a given read-modify-write.
15569
 *
15570
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15571
void
15572
ovsrec_ipfix_verify_sampling(const struct ovsrec_ipfix *row)
15573
0
{
15574
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_sampling);
15575
0
}
15576
15577
/* Causes the original contents of column "stats_interval" in 'row' to be
15578
 * verified as a prerequisite to completing the transaction.  That is, if
15579
 * "stats_interval" in 'row' changed (or if 'row' was deleted) between the
15580
 * time that the IDL originally read its contents and the time that the
15581
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
15582
 *
15583
 * The intention is that, to ensure that no transaction commits based on dirty
15584
 * reads, an application should call this function any time "stats_interval" is
15585
 * read as part of a read-modify-write operation.
15586
 *
15587
 * In some cases this function reduces to a no-op, because the current value
15588
 * of "stats_interval" is already known:
15589
 *
15590
 *   - If 'row' is a row created by the current transaction (returned by
15591
 *     ovsrec_ipfix_insert()).
15592
 *
15593
 *   - If "stats_interval" has already been modified (with
15594
 *     ovsrec_ipfix_set_stats_interval()) within the current transaction.
15595
 *
15596
 * Because of the latter property, always call this function *before*
15597
 * ovsrec_ipfix_set_stats_interval() for a given read-modify-write.
15598
 *
15599
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15600
void
15601
ovsrec_ipfix_verify_stats_interval(const struct ovsrec_ipfix *row)
15602
0
{
15603
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_stats_interval);
15604
0
}
15605
15606
/* Causes the original contents of column "targets" in 'row' to be
15607
 * verified as a prerequisite to completing the transaction.  That is, if
15608
 * "targets" in 'row' changed (or if 'row' was deleted) between the
15609
 * time that the IDL originally read its contents and the time that the
15610
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
15611
 *
15612
 * The intention is that, to ensure that no transaction commits based on dirty
15613
 * reads, an application should call this function any time "targets" is
15614
 * read as part of a read-modify-write operation.
15615
 *
15616
 * In some cases this function reduces to a no-op, because the current value
15617
 * of "targets" is already known:
15618
 *
15619
 *   - If 'row' is a row created by the current transaction (returned by
15620
 *     ovsrec_ipfix_insert()).
15621
 *
15622
 *   - If "targets" has already been modified (with
15623
 *     ovsrec_ipfix_set_targets()) within the current transaction.
15624
 *
15625
 * Because of the latter property, always call this function *before*
15626
 * ovsrec_ipfix_set_targets() for a given read-modify-write.
15627
 *
15628
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15629
void
15630
ovsrec_ipfix_verify_targets(const struct ovsrec_ipfix *row)
15631
0
{
15632
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_targets);
15633
0
}
15634
15635
/* Causes the original contents of column "template_interval" in 'row' to be
15636
 * verified as a prerequisite to completing the transaction.  That is, if
15637
 * "template_interval" in 'row' changed (or if 'row' was deleted) between the
15638
 * time that the IDL originally read its contents and the time that the
15639
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
15640
 *
15641
 * The intention is that, to ensure that no transaction commits based on dirty
15642
 * reads, an application should call this function any time "template_interval" is
15643
 * read as part of a read-modify-write operation.
15644
 *
15645
 * In some cases this function reduces to a no-op, because the current value
15646
 * of "template_interval" is already known:
15647
 *
15648
 *   - If 'row' is a row created by the current transaction (returned by
15649
 *     ovsrec_ipfix_insert()).
15650
 *
15651
 *   - If "template_interval" has already been modified (with
15652
 *     ovsrec_ipfix_set_template_interval()) within the current transaction.
15653
 *
15654
 * Because of the latter property, always call this function *before*
15655
 * ovsrec_ipfix_set_template_interval() for a given read-modify-write.
15656
 *
15657
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
15658
void
15659
ovsrec_ipfix_verify_template_interval(const struct ovsrec_ipfix *row)
15660
0
{
15661
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_col_template_interval);
15662
0
}
15663
15664
/* Returns the "cache_active_timeout" column's value from the "IPFIX" table in 'row'
15665
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15666
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15667
 * for a given key than implementing the same operation on the "cooked"
15668
 * form in 'row'.
15669
 *
15670
 * 'key_type' must be OVSDB_TYPE_INTEGER.
15671
 * (This helps to avoid silent bugs if someone changes cache_active_timeout's
15672
 * type without updating the caller.)
15673
 *
15674
 * The caller must not modify or free the returned value.
15675
 *
15676
 * Various kinds of changes can invalidate the returned value: modifying
15677
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15678
 * If the returned value is needed for a long time, it is best to make a copy
15679
 * of it with ovsdb_datum_clone().
15680
 *
15681
 * This function is rarely useful, since it is easier to access the value
15682
 * directly through the "cache_active_timeout" member in ovsrec_ipfix. */
15683
const struct ovsdb_datum *
15684
ovsrec_ipfix_get_cache_active_timeout(const struct ovsrec_ipfix *row,
15685
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15686
0
{
15687
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
15688
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_cache_active_timeout);
15689
0
}
15690
15691
/* Returns the "cache_max_flows" column's value from the "IPFIX" table in 'row'
15692
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15693
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15694
 * for a given key than implementing the same operation on the "cooked"
15695
 * form in 'row'.
15696
 *
15697
 * 'key_type' must be OVSDB_TYPE_INTEGER.
15698
 * (This helps to avoid silent bugs if someone changes cache_max_flows's
15699
 * type without updating the caller.)
15700
 *
15701
 * The caller must not modify or free the returned value.
15702
 *
15703
 * Various kinds of changes can invalidate the returned value: modifying
15704
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15705
 * If the returned value is needed for a long time, it is best to make a copy
15706
 * of it with ovsdb_datum_clone().
15707
 *
15708
 * This function is rarely useful, since it is easier to access the value
15709
 * directly through the "cache_max_flows" member in ovsrec_ipfix. */
15710
const struct ovsdb_datum *
15711
ovsrec_ipfix_get_cache_max_flows(const struct ovsrec_ipfix *row,
15712
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15713
0
{
15714
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
15715
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_cache_max_flows);
15716
0
}
15717
15718
/* Returns the "external_ids" column's value from the "IPFIX" table in 'row'
15719
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15720
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15721
 * for a given key than implementing the same operation on the "cooked"
15722
 * form in 'row'.
15723
 *
15724
 * 'key_type' must be OVSDB_TYPE_STRING.
15725
 * 'value_type' must be OVSDB_TYPE_STRING.
15726
 * (This helps to avoid silent bugs if someone changes external_ids's
15727
 * type without updating the caller.)
15728
 *
15729
 * The caller must not modify or free the returned value.
15730
 *
15731
 * Various kinds of changes can invalidate the returned value: modifying
15732
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15733
 * If the returned value is needed for a long time, it is best to make a copy
15734
 * of it with ovsdb_datum_clone().
15735
 *
15736
 * This function is rarely useful, since it is easier to access the value
15737
 * directly through the "external_ids" member in ovsrec_ipfix. */
15738
const struct ovsdb_datum *
15739
ovsrec_ipfix_get_external_ids(const struct ovsrec_ipfix *row,
15740
  enum ovsdb_atomic_type key_type OVS_UNUSED,
15741
  enum ovsdb_atomic_type value_type OVS_UNUSED)
15742
0
{
15743
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
15744
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
15745
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_external_ids);
15746
0
}
15747
15748
/* Returns the "obs_domain_id" column's value from the "IPFIX" table in 'row'
15749
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15750
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15751
 * for a given key than implementing the same operation on the "cooked"
15752
 * form in 'row'.
15753
 *
15754
 * 'key_type' must be OVSDB_TYPE_INTEGER.
15755
 * (This helps to avoid silent bugs if someone changes obs_domain_id's
15756
 * type without updating the caller.)
15757
 *
15758
 * The caller must not modify or free the returned value.
15759
 *
15760
 * Various kinds of changes can invalidate the returned value: modifying
15761
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15762
 * If the returned value is needed for a long time, it is best to make a copy
15763
 * of it with ovsdb_datum_clone().
15764
 *
15765
 * This function is rarely useful, since it is easier to access the value
15766
 * directly through the "obs_domain_id" member in ovsrec_ipfix. */
15767
const struct ovsdb_datum *
15768
ovsrec_ipfix_get_obs_domain_id(const struct ovsrec_ipfix *row,
15769
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15770
0
{
15771
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
15772
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_obs_domain_id);
15773
0
}
15774
15775
/* Returns the "obs_point_id" column's value from the "IPFIX" table in 'row'
15776
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15777
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15778
 * for a given key than implementing the same operation on the "cooked"
15779
 * form in 'row'.
15780
 *
15781
 * 'key_type' must be OVSDB_TYPE_INTEGER.
15782
 * (This helps to avoid silent bugs if someone changes obs_point_id's
15783
 * type without updating the caller.)
15784
 *
15785
 * The caller must not modify or free the returned value.
15786
 *
15787
 * Various kinds of changes can invalidate the returned value: modifying
15788
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15789
 * If the returned value is needed for a long time, it is best to make a copy
15790
 * of it with ovsdb_datum_clone().
15791
 *
15792
 * This function is rarely useful, since it is easier to access the value
15793
 * directly through the "obs_point_id" member in ovsrec_ipfix. */
15794
const struct ovsdb_datum *
15795
ovsrec_ipfix_get_obs_point_id(const struct ovsrec_ipfix *row,
15796
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15797
0
{
15798
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
15799
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_obs_point_id);
15800
0
}
15801
15802
/* Returns the "other_config" column's value from the "IPFIX" table in 'row'
15803
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15804
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15805
 * for a given key than implementing the same operation on the "cooked"
15806
 * form in 'row'.
15807
 *
15808
 * 'key_type' must be OVSDB_TYPE_STRING.
15809
 * 'value_type' must be OVSDB_TYPE_STRING.
15810
 * (This helps to avoid silent bugs if someone changes other_config's
15811
 * type without updating the caller.)
15812
 *
15813
 * The caller must not modify or free the returned value.
15814
 *
15815
 * Various kinds of changes can invalidate the returned value: modifying
15816
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15817
 * If the returned value is needed for a long time, it is best to make a copy
15818
 * of it with ovsdb_datum_clone().
15819
 *
15820
 * This function is rarely useful, since it is easier to access the value
15821
 * directly through the "other_config" member in ovsrec_ipfix. */
15822
const struct ovsdb_datum *
15823
ovsrec_ipfix_get_other_config(const struct ovsrec_ipfix *row,
15824
  enum ovsdb_atomic_type key_type OVS_UNUSED,
15825
  enum ovsdb_atomic_type value_type OVS_UNUSED)
15826
0
{
15827
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
15828
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
15829
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_other_config);
15830
0
}
15831
15832
/* Returns the "sampling" column's value from the "IPFIX" table in 'row'
15833
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15834
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15835
 * for a given key than implementing the same operation on the "cooked"
15836
 * form in 'row'.
15837
 *
15838
 * 'key_type' must be OVSDB_TYPE_INTEGER.
15839
 * (This helps to avoid silent bugs if someone changes sampling's
15840
 * type without updating the caller.)
15841
 *
15842
 * The caller must not modify or free the returned value.
15843
 *
15844
 * Various kinds of changes can invalidate the returned value: modifying
15845
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15846
 * If the returned value is needed for a long time, it is best to make a copy
15847
 * of it with ovsdb_datum_clone().
15848
 *
15849
 * This function is rarely useful, since it is easier to access the value
15850
 * directly through the "sampling" member in ovsrec_ipfix. */
15851
const struct ovsdb_datum *
15852
ovsrec_ipfix_get_sampling(const struct ovsrec_ipfix *row,
15853
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15854
0
{
15855
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
15856
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_sampling);
15857
0
}
15858
15859
/* Returns the "stats_interval" column's value from the "IPFIX" table in 'row'
15860
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15861
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15862
 * for a given key than implementing the same operation on the "cooked"
15863
 * form in 'row'.
15864
 *
15865
 * 'key_type' must be OVSDB_TYPE_INTEGER.
15866
 * (This helps to avoid silent bugs if someone changes stats_interval's
15867
 * type without updating the caller.)
15868
 *
15869
 * The caller must not modify or free the returned value.
15870
 *
15871
 * Various kinds of changes can invalidate the returned value: modifying
15872
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15873
 * If the returned value is needed for a long time, it is best to make a copy
15874
 * of it with ovsdb_datum_clone().
15875
 *
15876
 * This function is rarely useful, since it is easier to access the value
15877
 * directly through the "stats_interval" member in ovsrec_ipfix. */
15878
const struct ovsdb_datum *
15879
ovsrec_ipfix_get_stats_interval(const struct ovsrec_ipfix *row,
15880
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15881
0
{
15882
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
15883
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_stats_interval);
15884
0
}
15885
15886
/* Returns the "targets" column's value from the "IPFIX" table in 'row'
15887
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15888
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15889
 * for a given key than implementing the same operation on the "cooked"
15890
 * form in 'row'.
15891
 *
15892
 * 'key_type' must be OVSDB_TYPE_STRING.
15893
 * (This helps to avoid silent bugs if someone changes targets's
15894
 * type without updating the caller.)
15895
 *
15896
 * The caller must not modify or free the returned value.
15897
 *
15898
 * Various kinds of changes can invalidate the returned value: modifying
15899
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15900
 * If the returned value is needed for a long time, it is best to make a copy
15901
 * of it with ovsdb_datum_clone().
15902
 *
15903
 * This function is rarely useful, since it is easier to access the value
15904
 * directly through the "targets" member in ovsrec_ipfix. */
15905
const struct ovsdb_datum *
15906
ovsrec_ipfix_get_targets(const struct ovsrec_ipfix *row,
15907
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15908
0
{
15909
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
15910
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_targets);
15911
0
}
15912
15913
/* Returns the "template_interval" column's value from the "IPFIX" table in 'row'
15914
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
15915
 * ovsdb_datum_find_key() is an easier and more efficient way to search
15916
 * for a given key than implementing the same operation on the "cooked"
15917
 * form in 'row'.
15918
 *
15919
 * 'key_type' must be OVSDB_TYPE_INTEGER.
15920
 * (This helps to avoid silent bugs if someone changes template_interval's
15921
 * type without updating the caller.)
15922
 *
15923
 * The caller must not modify or free the returned value.
15924
 *
15925
 * Various kinds of changes can invalidate the returned value: modifying
15926
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
15927
 * If the returned value is needed for a long time, it is best to make a copy
15928
 * of it with ovsdb_datum_clone().
15929
 *
15930
 * This function is rarely useful, since it is easier to access the value
15931
 * directly through the "template_interval" member in ovsrec_ipfix. */
15932
const struct ovsdb_datum *
15933
ovsrec_ipfix_get_template_interval(const struct ovsrec_ipfix *row,
15934
  enum ovsdb_atomic_type key_type OVS_UNUSED)
15935
0
{
15936
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
15937
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_template_interval);
15938
0
}
15939
15940
/* Sets the "cache_active_timeout" column from the "IPFIX" table in 'row' to
15941
 * the 'cache_active_timeout' set with 'n_cache_active_timeout' entries.
15942
 *
15943
 * 'n_cache_active_timeout' may be 0 or 1; if it is 0, then 'cache_active_timeout'
15944
 * may be NULL.
15945
 *
15946
 * Argument constraints: in range 0 to 4,200
15947
 *
15948
 * The caller retains ownership of the arguments. */
15949
void
15950
ovsrec_ipfix_set_cache_active_timeout(const struct ovsrec_ipfix *row, const int64_t *cache_active_timeout, size_t n_cache_active_timeout)
15951
0
{
15952
0
    struct ovsdb_datum datum;
15953
15954
0
    datum.refcnt = NULL;
15955
15956
0
    if (n_cache_active_timeout) {
15957
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
15958
0
        datum.n = 1;
15959
0
        datum.keys = key;
15960
0
        key->integer = *cache_active_timeout;
15961
0
    } else {
15962
0
        datum.n = 0;
15963
0
        datum.keys = NULL;
15964
0
    }
15965
0
    datum.values = NULL;
15966
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_cache_active_timeout, &datum);
15967
0
}
15968
15969
/* Sets the "cache_max_flows" column from the "IPFIX" table in 'row' to
15970
 * the 'cache_max_flows' set with 'n_cache_max_flows' entries.
15971
 *
15972
 * 'n_cache_max_flows' may be 0 or 1; if it is 0, then 'cache_max_flows'
15973
 * may be NULL.
15974
 *
15975
 * Argument constraints: in range 0 to 4,294,967,295
15976
 *
15977
 * The caller retains ownership of the arguments. */
15978
void
15979
ovsrec_ipfix_set_cache_max_flows(const struct ovsrec_ipfix *row, const int64_t *cache_max_flows, size_t n_cache_max_flows)
15980
0
{
15981
0
    struct ovsdb_datum datum;
15982
15983
0
    datum.refcnt = NULL;
15984
15985
0
    if (n_cache_max_flows) {
15986
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
15987
0
        datum.n = 1;
15988
0
        datum.keys = key;
15989
0
        key->integer = *cache_max_flows;
15990
0
    } else {
15991
0
        datum.n = 0;
15992
0
        datum.keys = NULL;
15993
0
    }
15994
0
    datum.values = NULL;
15995
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_cache_max_flows, &datum);
15996
0
}
15997
15998
/* Sets the "external_ids" column's value from the "IPFIX" table in 'row'
15999
 * to 'external_ids'.
16000
 *
16001
 * The caller retains ownership of 'external_ids' and everything in it. */
16002
void
16003
ovsrec_ipfix_set_external_ids(const struct ovsrec_ipfix *row, const struct smap *external_ids)
16004
0
{
16005
0
    struct ovsdb_datum datum;
16006
16007
0
    if (external_ids) {
16008
0
        ovsdb_datum_from_smap(&datum, external_ids);
16009
0
    } else {
16010
0
        ovsdb_datum_init_empty(&datum);
16011
0
    }
16012
0
    ovsdb_idl_txn_write(&row->header_,
16013
0
                        &ovsrec_ipfix_col_external_ids,
16014
0
                        &datum);
16015
0
}
16016
16017
16018
/* Sets the "obs_domain_id" column from the "IPFIX" table in 'row' to
16019
 * the 'obs_domain_id' set with 'n_obs_domain_id' entries.
16020
 *
16021
 * 'n_obs_domain_id' may be 0 or 1; if it is 0, then 'obs_domain_id'
16022
 * may be NULL.
16023
 *
16024
 * Argument constraints: in range 0 to 4,294,967,295
16025
 *
16026
 * The caller retains ownership of the arguments. */
16027
void
16028
ovsrec_ipfix_set_obs_domain_id(const struct ovsrec_ipfix *row, const int64_t *obs_domain_id, size_t n_obs_domain_id)
16029
0
{
16030
0
    struct ovsdb_datum datum;
16031
16032
0
    datum.refcnt = NULL;
16033
16034
0
    if (n_obs_domain_id) {
16035
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16036
0
        datum.n = 1;
16037
0
        datum.keys = key;
16038
0
        key->integer = *obs_domain_id;
16039
0
    } else {
16040
0
        datum.n = 0;
16041
0
        datum.keys = NULL;
16042
0
    }
16043
0
    datum.values = NULL;
16044
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_obs_domain_id, &datum);
16045
0
}
16046
16047
/* Sets the "obs_point_id" column from the "IPFIX" table in 'row' to
16048
 * the 'obs_point_id' set with 'n_obs_point_id' entries.
16049
 *
16050
 * 'n_obs_point_id' may be 0 or 1; if it is 0, then 'obs_point_id'
16051
 * may be NULL.
16052
 *
16053
 * Argument constraints: in range 0 to 4,294,967,295
16054
 *
16055
 * The caller retains ownership of the arguments. */
16056
void
16057
ovsrec_ipfix_set_obs_point_id(const struct ovsrec_ipfix *row, const int64_t *obs_point_id, size_t n_obs_point_id)
16058
0
{
16059
0
    struct ovsdb_datum datum;
16060
16061
0
    datum.refcnt = NULL;
16062
16063
0
    if (n_obs_point_id) {
16064
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16065
0
        datum.n = 1;
16066
0
        datum.keys = key;
16067
0
        key->integer = *obs_point_id;
16068
0
    } else {
16069
0
        datum.n = 0;
16070
0
        datum.keys = NULL;
16071
0
    }
16072
0
    datum.values = NULL;
16073
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_obs_point_id, &datum);
16074
0
}
16075
16076
/* Sets the "other_config" column's value from the "IPFIX" table in 'row'
16077
 * to 'other_config'.
16078
 *
16079
 * The caller retains ownership of 'other_config' and everything in it. */
16080
void
16081
ovsrec_ipfix_set_other_config(const struct ovsrec_ipfix *row, const struct smap *other_config)
16082
0
{
16083
0
    struct ovsdb_datum datum;
16084
16085
0
    if (other_config) {
16086
0
        ovsdb_datum_from_smap(&datum, other_config);
16087
0
    } else {
16088
0
        ovsdb_datum_init_empty(&datum);
16089
0
    }
16090
0
    ovsdb_idl_txn_write(&row->header_,
16091
0
                        &ovsrec_ipfix_col_other_config,
16092
0
                        &datum);
16093
0
}
16094
16095
16096
/* Sets the "sampling" column from the "IPFIX" table in 'row' to
16097
 * the 'sampling' set with 'n_sampling' entries.
16098
 *
16099
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
16100
 * may be NULL.
16101
 *
16102
 * Argument constraints: in range 1 to 4,294,967,295
16103
 *
16104
 * The caller retains ownership of the arguments. */
16105
void
16106
ovsrec_ipfix_set_sampling(const struct ovsrec_ipfix *row, const int64_t *sampling, size_t n_sampling)
16107
0
{
16108
0
    struct ovsdb_datum datum;
16109
16110
0
    datum.refcnt = NULL;
16111
16112
0
    if (n_sampling) {
16113
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16114
0
        datum.n = 1;
16115
0
        datum.keys = key;
16116
0
        key->integer = *sampling;
16117
0
    } else {
16118
0
        datum.n = 0;
16119
0
        datum.keys = NULL;
16120
0
    }
16121
0
    datum.values = NULL;
16122
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_sampling, &datum);
16123
0
}
16124
16125
/* Sets the "stats_interval" column from the "IPFIX" table in 'row' to
16126
 * the 'stats_interval' set with 'n_stats_interval' entries.
16127
 *
16128
 * 'n_stats_interval' may be 0 or 1; if it is 0, then 'stats_interval'
16129
 * may be NULL.
16130
 *
16131
 * Argument constraints: in range 1 to 3,600
16132
 *
16133
 * The caller retains ownership of the arguments. */
16134
void
16135
ovsrec_ipfix_set_stats_interval(const struct ovsrec_ipfix *row, const int64_t *stats_interval, size_t n_stats_interval)
16136
0
{
16137
0
    struct ovsdb_datum datum;
16138
16139
0
    datum.refcnt = NULL;
16140
16141
0
    if (n_stats_interval) {
16142
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16143
0
        datum.n = 1;
16144
0
        datum.keys = key;
16145
0
        key->integer = *stats_interval;
16146
0
    } else {
16147
0
        datum.n = 0;
16148
0
        datum.keys = NULL;
16149
0
    }
16150
0
    datum.values = NULL;
16151
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_stats_interval, &datum);
16152
0
}
16153
16154
/* Sets the "targets" column from the "IPFIX" table in 'row' to
16155
 * the 'targets' set with 'n_targets' entries.
16156
 *
16157
 * The caller retains ownership of the arguments. */
16158
void
16159
ovsrec_ipfix_set_targets(const struct ovsrec_ipfix *row, const char **targets, size_t n_targets)
16160
0
{
16161
0
    struct ovsdb_datum datum;
16162
16163
0
    datum.refcnt = NULL;
16164
16165
0
    datum.n = n_targets;
16166
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
16167
0
    datum.values = NULL;
16168
0
    for (size_t i = 0; i < n_targets; i++) {
16169
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
16170
0
    }
16171
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_targets, &datum);
16172
0
}
16173
16174
/* Sets the "template_interval" column from the "IPFIX" table in 'row' to
16175
 * the 'template_interval' set with 'n_template_interval' entries.
16176
 *
16177
 * 'n_template_interval' may be 0 or 1; if it is 0, then 'template_interval'
16178
 * may be NULL.
16179
 *
16180
 * Argument constraints: in range 1 to 3,600
16181
 *
16182
 * The caller retains ownership of the arguments. */
16183
void
16184
ovsrec_ipfix_set_template_interval(const struct ovsrec_ipfix *row, const int64_t *template_interval, size_t n_template_interval)
16185
0
{
16186
0
    struct ovsdb_datum datum;
16187
16188
0
    datum.refcnt = NULL;
16189
16190
0
    if (n_template_interval) {
16191
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16192
0
        datum.n = 1;
16193
0
        datum.keys = key;
16194
0
        key->integer = *template_interval;
16195
0
    } else {
16196
0
        datum.n = 0;
16197
0
        datum.keys = NULL;
16198
0
    }
16199
0
    datum.values = NULL;
16200
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_col_template_interval, &datum);
16201
0
}
16202
16203
/* Adds the value 'new_value' to the "cache_active_timeout" set column from the "IPFIX" table
16204
 * in 'row'.
16205
 *
16206
 */
16207
void
16208
ovsrec_ipfix_update_cache_active_timeout_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
16209
0
{
16210
0
    struct ovsdb_datum *datum;
16211
16212
0
    datum = xmalloc(sizeof *datum);
16213
0
    datum->n = 1;
16214
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16215
0
    datum->values = NULL;
16216
0
    datum->refcnt = NULL;
16217
16218
0
    datum->keys[0].integer = new_value;
16219
16220
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
16221
0
                                    &ovsrec_ipfix_col_cache_active_timeout,
16222
0
                                    datum);
16223
0
}
16224
16225
/* Deletes the value 'delete_value' from the "cache_active_timeout" set column from the
16226
 * "IPFIX" table in 'row'.
16227
 *
16228
 */
16229
void
16230
ovsrec_ipfix_update_cache_active_timeout_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
16231
0
{
16232
0
    struct ovsdb_datum *datum;
16233
16234
0
    datum = xmalloc(sizeof *datum);
16235
0
    datum->n = 1;
16236
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16237
0
    datum->values = NULL;
16238
0
    datum->refcnt = NULL;
16239
16240
0
    datum->keys[0].integer = delete_value;
16241
16242
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
16243
0
                                    &ovsrec_ipfix_col_cache_active_timeout,
16244
0
                                    datum);
16245
0
}
16246
16247
/* Adds the value 'new_value' to the "cache_max_flows" set column from the "IPFIX" table
16248
 * in 'row'.
16249
 *
16250
 */
16251
void
16252
ovsrec_ipfix_update_cache_max_flows_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
16253
0
{
16254
0
    struct ovsdb_datum *datum;
16255
16256
0
    datum = xmalloc(sizeof *datum);
16257
0
    datum->n = 1;
16258
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16259
0
    datum->values = NULL;
16260
0
    datum->refcnt = NULL;
16261
16262
0
    datum->keys[0].integer = new_value;
16263
16264
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
16265
0
                                    &ovsrec_ipfix_col_cache_max_flows,
16266
0
                                    datum);
16267
0
}
16268
16269
/* Deletes the value 'delete_value' from the "cache_max_flows" set column from the
16270
 * "IPFIX" table in 'row'.
16271
 *
16272
 */
16273
void
16274
ovsrec_ipfix_update_cache_max_flows_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
16275
0
{
16276
0
    struct ovsdb_datum *datum;
16277
16278
0
    datum = xmalloc(sizeof *datum);
16279
0
    datum->n = 1;
16280
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16281
0
    datum->values = NULL;
16282
0
    datum->refcnt = NULL;
16283
16284
0
    datum->keys[0].integer = delete_value;
16285
16286
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
16287
0
                                    &ovsrec_ipfix_col_cache_max_flows,
16288
0
                                    datum);
16289
0
}
16290
16291
/* Sets an element of the "external_ids" map column from the "IPFIX" table in 'row'
16292
 * to 'new_value' given the key value 'new_key'.
16293
 *
16294
 */
16295
void
16296
ovsrec_ipfix_update_external_ids_setkey(const struct ovsrec_ipfix *row, const char *new_key, const char *new_value)
16297
0
{
16298
0
    struct ovsdb_datum *datum;
16299
16300
0
    datum = xmalloc(sizeof *datum);
16301
0
    datum->n = 1;
16302
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
16303
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
16304
0
    datum->refcnt = NULL;
16305
16306
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
16307
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
16308
16309
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
16310
0
                                    &ovsrec_ipfix_col_external_ids,
16311
0
                                    datum);
16312
0
}
16313
16314
/* Deletes an element of the "external_ids" map column from the "IPFIX" table in 'row'
16315
 * given the key value 'delete_key'.
16316
 *
16317
 */
16318
void
16319
ovsrec_ipfix_update_external_ids_delkey(const struct ovsrec_ipfix *row, const char *delete_key)
16320
0
{
16321
0
    struct ovsdb_datum *datum;
16322
16323
0
    datum = xmalloc(sizeof *datum);
16324
0
    datum->n = 1;
16325
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
16326
0
    datum->values = NULL;
16327
0
    datum->refcnt = NULL;
16328
16329
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
16330
16331
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
16332
0
                                    &ovsrec_ipfix_col_external_ids,
16333
0
                                    datum);
16334
0
}
16335
16336
/* Adds the value 'new_value' to the "obs_domain_id" set column from the "IPFIX" table
16337
 * in 'row'.
16338
 *
16339
 */
16340
void
16341
ovsrec_ipfix_update_obs_domain_id_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
16342
0
{
16343
0
    struct ovsdb_datum *datum;
16344
16345
0
    datum = xmalloc(sizeof *datum);
16346
0
    datum->n = 1;
16347
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16348
0
    datum->values = NULL;
16349
0
    datum->refcnt = NULL;
16350
16351
0
    datum->keys[0].integer = new_value;
16352
16353
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
16354
0
                                    &ovsrec_ipfix_col_obs_domain_id,
16355
0
                                    datum);
16356
0
}
16357
16358
/* Deletes the value 'delete_value' from the "obs_domain_id" set column from the
16359
 * "IPFIX" table in 'row'.
16360
 *
16361
 */
16362
void
16363
ovsrec_ipfix_update_obs_domain_id_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
16364
0
{
16365
0
    struct ovsdb_datum *datum;
16366
16367
0
    datum = xmalloc(sizeof *datum);
16368
0
    datum->n = 1;
16369
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16370
0
    datum->values = NULL;
16371
0
    datum->refcnt = NULL;
16372
16373
0
    datum->keys[0].integer = delete_value;
16374
16375
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
16376
0
                                    &ovsrec_ipfix_col_obs_domain_id,
16377
0
                                    datum);
16378
0
}
16379
16380
/* Adds the value 'new_value' to the "obs_point_id" set column from the "IPFIX" table
16381
 * in 'row'.
16382
 *
16383
 */
16384
void
16385
ovsrec_ipfix_update_obs_point_id_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
16386
0
{
16387
0
    struct ovsdb_datum *datum;
16388
16389
0
    datum = xmalloc(sizeof *datum);
16390
0
    datum->n = 1;
16391
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16392
0
    datum->values = NULL;
16393
0
    datum->refcnt = NULL;
16394
16395
0
    datum->keys[0].integer = new_value;
16396
16397
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
16398
0
                                    &ovsrec_ipfix_col_obs_point_id,
16399
0
                                    datum);
16400
0
}
16401
16402
/* Deletes the value 'delete_value' from the "obs_point_id" set column from the
16403
 * "IPFIX" table in 'row'.
16404
 *
16405
 */
16406
void
16407
ovsrec_ipfix_update_obs_point_id_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
16408
0
{
16409
0
    struct ovsdb_datum *datum;
16410
16411
0
    datum = xmalloc(sizeof *datum);
16412
0
    datum->n = 1;
16413
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16414
0
    datum->values = NULL;
16415
0
    datum->refcnt = NULL;
16416
16417
0
    datum->keys[0].integer = delete_value;
16418
16419
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
16420
0
                                    &ovsrec_ipfix_col_obs_point_id,
16421
0
                                    datum);
16422
0
}
16423
16424
/* Sets an element of the "other_config" map column from the "IPFIX" table in 'row'
16425
 * to 'new_value' given the key value 'new_key'.
16426
 *
16427
 */
16428
void
16429
ovsrec_ipfix_update_other_config_setkey(const struct ovsrec_ipfix *row, const char *new_key, const char *new_value)
16430
0
{
16431
0
    struct ovsdb_datum *datum;
16432
16433
0
    datum = xmalloc(sizeof *datum);
16434
0
    datum->n = 1;
16435
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
16436
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
16437
0
    datum->refcnt = NULL;
16438
16439
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
16440
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
16441
16442
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
16443
0
                                    &ovsrec_ipfix_col_other_config,
16444
0
                                    datum);
16445
0
}
16446
16447
/* Deletes an element of the "other_config" map column from the "IPFIX" table in 'row'
16448
 * given the key value 'delete_key'.
16449
 *
16450
 */
16451
void
16452
ovsrec_ipfix_update_other_config_delkey(const struct ovsrec_ipfix *row, const char *delete_key)
16453
0
{
16454
0
    struct ovsdb_datum *datum;
16455
16456
0
    datum = xmalloc(sizeof *datum);
16457
0
    datum->n = 1;
16458
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
16459
0
    datum->values = NULL;
16460
0
    datum->refcnt = NULL;
16461
16462
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
16463
16464
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
16465
0
                                    &ovsrec_ipfix_col_other_config,
16466
0
                                    datum);
16467
0
}
16468
16469
/* Adds the value 'new_value' to the "sampling" set column from the "IPFIX" table
16470
 * in 'row'.
16471
 *
16472
 */
16473
void
16474
ovsrec_ipfix_update_sampling_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
16475
0
{
16476
0
    struct ovsdb_datum *datum;
16477
16478
0
    datum = xmalloc(sizeof *datum);
16479
0
    datum->n = 1;
16480
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16481
0
    datum->values = NULL;
16482
0
    datum->refcnt = NULL;
16483
16484
0
    datum->keys[0].integer = new_value;
16485
16486
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
16487
0
                                    &ovsrec_ipfix_col_sampling,
16488
0
                                    datum);
16489
0
}
16490
16491
/* Deletes the value 'delete_value' from the "sampling" set column from the
16492
 * "IPFIX" table in 'row'.
16493
 *
16494
 */
16495
void
16496
ovsrec_ipfix_update_sampling_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
16497
0
{
16498
0
    struct ovsdb_datum *datum;
16499
16500
0
    datum = xmalloc(sizeof *datum);
16501
0
    datum->n = 1;
16502
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16503
0
    datum->values = NULL;
16504
0
    datum->refcnt = NULL;
16505
16506
0
    datum->keys[0].integer = delete_value;
16507
16508
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
16509
0
                                    &ovsrec_ipfix_col_sampling,
16510
0
                                    datum);
16511
0
}
16512
16513
/* Adds the value 'new_value' to the "stats_interval" set column from the "IPFIX" table
16514
 * in 'row'.
16515
 *
16516
 */
16517
void
16518
ovsrec_ipfix_update_stats_interval_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
16519
0
{
16520
0
    struct ovsdb_datum *datum;
16521
16522
0
    datum = xmalloc(sizeof *datum);
16523
0
    datum->n = 1;
16524
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16525
0
    datum->values = NULL;
16526
0
    datum->refcnt = NULL;
16527
16528
0
    datum->keys[0].integer = new_value;
16529
16530
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
16531
0
                                    &ovsrec_ipfix_col_stats_interval,
16532
0
                                    datum);
16533
0
}
16534
16535
/* Deletes the value 'delete_value' from the "stats_interval" set column from the
16536
 * "IPFIX" table in 'row'.
16537
 *
16538
 */
16539
void
16540
ovsrec_ipfix_update_stats_interval_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
16541
0
{
16542
0
    struct ovsdb_datum *datum;
16543
16544
0
    datum = xmalloc(sizeof *datum);
16545
0
    datum->n = 1;
16546
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16547
0
    datum->values = NULL;
16548
0
    datum->refcnt = NULL;
16549
16550
0
    datum->keys[0].integer = delete_value;
16551
16552
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
16553
0
                                    &ovsrec_ipfix_col_stats_interval,
16554
0
                                    datum);
16555
0
}
16556
16557
/* Adds the value 'new_value' to the "targets" set column from the "IPFIX" table
16558
 * in 'row'.
16559
 *
16560
 */
16561
void
16562
ovsrec_ipfix_update_targets_addvalue(const struct ovsrec_ipfix *row, const char *new_value)
16563
0
{
16564
0
    struct ovsdb_datum *datum;
16565
16566
0
    datum = xmalloc(sizeof *datum);
16567
0
    datum->n = 1;
16568
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16569
0
    datum->values = NULL;
16570
0
    datum->refcnt = NULL;
16571
16572
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
16573
16574
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
16575
0
                                    &ovsrec_ipfix_col_targets,
16576
0
                                    datum);
16577
0
}
16578
16579
/* Deletes the value 'delete_value' from the "targets" set column from the
16580
 * "IPFIX" table in 'row'.
16581
 *
16582
 */
16583
void
16584
ovsrec_ipfix_update_targets_delvalue(const struct ovsrec_ipfix *row, const char *delete_value)
16585
0
{
16586
0
    struct ovsdb_datum *datum;
16587
16588
0
    datum = xmalloc(sizeof *datum);
16589
0
    datum->n = 1;
16590
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16591
0
    datum->values = NULL;
16592
0
    datum->refcnt = NULL;
16593
16594
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
16595
16596
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
16597
0
                                    &ovsrec_ipfix_col_targets,
16598
0
                                    datum);
16599
0
}
16600
16601
/* Adds the value 'new_value' to the "template_interval" set column from the "IPFIX" table
16602
 * in 'row'.
16603
 *
16604
 */
16605
void
16606
ovsrec_ipfix_update_template_interval_addvalue(const struct ovsrec_ipfix *row, int64_t new_value)
16607
0
{
16608
0
    struct ovsdb_datum *datum;
16609
16610
0
    datum = xmalloc(sizeof *datum);
16611
0
    datum->n = 1;
16612
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16613
0
    datum->values = NULL;
16614
0
    datum->refcnt = NULL;
16615
16616
0
    datum->keys[0].integer = new_value;
16617
16618
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
16619
0
                                    &ovsrec_ipfix_col_template_interval,
16620
0
                                    datum);
16621
0
}
16622
16623
/* Deletes the value 'delete_value' from the "template_interval" set column from the
16624
 * "IPFIX" table in 'row'.
16625
 *
16626
 */
16627
void
16628
ovsrec_ipfix_update_template_interval_delvalue(const struct ovsrec_ipfix *row, int64_t delete_value)
16629
0
{
16630
0
    struct ovsdb_datum *datum;
16631
16632
0
    datum = xmalloc(sizeof *datum);
16633
0
    datum->n = 1;
16634
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
16635
0
    datum->values = NULL;
16636
0
    datum->refcnt = NULL;
16637
16638
0
    datum->keys[0].integer = delete_value;
16639
16640
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
16641
0
                                    &ovsrec_ipfix_col_template_interval,
16642
0
                                    datum);
16643
0
}
16644
16645
/* Sets the "cache_active_timeout" column from the "IPFIX" table in 'row' to
16646
 * the 'cache_active_timeout' set with 'n_cache_active_timeout' entries.
16647
 *
16648
 * 'n_cache_active_timeout' may be 0 or 1; if it is 0, then 'cache_active_timeout'
16649
 * may be NULL.
16650
 *
16651
 * Argument constraints: in range 0 to 4,200
16652
 *
16653
 * The caller retains ownership of the arguments. */
16654
void
16655
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)
16656
0
{
16657
0
    struct ovsdb_datum datum;
16658
16659
0
    datum.refcnt = NULL;
16660
16661
0
    if (n_cache_active_timeout) {
16662
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16663
0
        datum.n = 1;
16664
0
        datum.keys = key;
16665
0
        key->integer = *cache_active_timeout;
16666
0
    } else {
16667
0
        datum.n = 0;
16668
0
        datum.keys = NULL;
16669
0
    }
16670
0
    datum.values = NULL;
16671
0
    ovsdb_idl_condition_add_clause(cond,
16672
0
                          function,
16673
0
                          &ovsrec_ipfix_col_cache_active_timeout,
16674
0
                          &datum);
16675
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_cache_active_timeout.type);
16676
0
}
16677
16678
/* Sets the "cache_max_flows" column from the "IPFIX" table in 'row' to
16679
 * the 'cache_max_flows' set with 'n_cache_max_flows' entries.
16680
 *
16681
 * 'n_cache_max_flows' may be 0 or 1; if it is 0, then 'cache_max_flows'
16682
 * may be NULL.
16683
 *
16684
 * Argument constraints: in range 0 to 4,294,967,295
16685
 *
16686
 * The caller retains ownership of the arguments. */
16687
void
16688
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)
16689
0
{
16690
0
    struct ovsdb_datum datum;
16691
16692
0
    datum.refcnt = NULL;
16693
16694
0
    if (n_cache_max_flows) {
16695
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16696
0
        datum.n = 1;
16697
0
        datum.keys = key;
16698
0
        key->integer = *cache_max_flows;
16699
0
    } else {
16700
0
        datum.n = 0;
16701
0
        datum.keys = NULL;
16702
0
    }
16703
0
    datum.values = NULL;
16704
0
    ovsdb_idl_condition_add_clause(cond,
16705
0
                          function,
16706
0
                          &ovsrec_ipfix_col_cache_max_flows,
16707
0
                          &datum);
16708
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_cache_max_flows.type);
16709
0
}
16710
16711
/* Sets the "external_ids" column's value from the "IPFIX" table in 'row'
16712
 * to 'external_ids'.
16713
 *
16714
 * The caller retains ownership of 'external_ids' and everything in it. */
16715
void
16716
ovsrec_ipfix_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
16717
0
{
16718
0
    struct ovsdb_datum datum;
16719
16720
0
    if (external_ids) {
16721
0
        ovsdb_datum_from_smap(&datum, external_ids);
16722
0
    } else {
16723
0
        ovsdb_datum_init_empty(&datum);
16724
0
    }
16725
16726
0
    ovsdb_idl_condition_add_clause(cond,
16727
0
                                   function,
16728
0
                                   &ovsrec_ipfix_col_external_ids,
16729
0
                                   &datum);
16730
16731
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_external_ids.type);
16732
0
}
16733
16734
16735
/* Sets the "obs_domain_id" column from the "IPFIX" table in 'row' to
16736
 * the 'obs_domain_id' set with 'n_obs_domain_id' entries.
16737
 *
16738
 * 'n_obs_domain_id' may be 0 or 1; if it is 0, then 'obs_domain_id'
16739
 * may be NULL.
16740
 *
16741
 * Argument constraints: in range 0 to 4,294,967,295
16742
 *
16743
 * The caller retains ownership of the arguments. */
16744
void
16745
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)
16746
0
{
16747
0
    struct ovsdb_datum datum;
16748
16749
0
    datum.refcnt = NULL;
16750
16751
0
    if (n_obs_domain_id) {
16752
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16753
0
        datum.n = 1;
16754
0
        datum.keys = key;
16755
0
        key->integer = *obs_domain_id;
16756
0
    } else {
16757
0
        datum.n = 0;
16758
0
        datum.keys = NULL;
16759
0
    }
16760
0
    datum.values = NULL;
16761
0
    ovsdb_idl_condition_add_clause(cond,
16762
0
                          function,
16763
0
                          &ovsrec_ipfix_col_obs_domain_id,
16764
0
                          &datum);
16765
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_obs_domain_id.type);
16766
0
}
16767
16768
/* Sets the "obs_point_id" column from the "IPFIX" table in 'row' to
16769
 * the 'obs_point_id' set with 'n_obs_point_id' entries.
16770
 *
16771
 * 'n_obs_point_id' may be 0 or 1; if it is 0, then 'obs_point_id'
16772
 * may be NULL.
16773
 *
16774
 * Argument constraints: in range 0 to 4,294,967,295
16775
 *
16776
 * The caller retains ownership of the arguments. */
16777
void
16778
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)
16779
0
{
16780
0
    struct ovsdb_datum datum;
16781
16782
0
    datum.refcnt = NULL;
16783
16784
0
    if (n_obs_point_id) {
16785
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16786
0
        datum.n = 1;
16787
0
        datum.keys = key;
16788
0
        key->integer = *obs_point_id;
16789
0
    } else {
16790
0
        datum.n = 0;
16791
0
        datum.keys = NULL;
16792
0
    }
16793
0
    datum.values = NULL;
16794
0
    ovsdb_idl_condition_add_clause(cond,
16795
0
                          function,
16796
0
                          &ovsrec_ipfix_col_obs_point_id,
16797
0
                          &datum);
16798
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_obs_point_id.type);
16799
0
}
16800
16801
/* Sets the "other_config" column's value from the "IPFIX" table in 'row'
16802
 * to 'other_config'.
16803
 *
16804
 * The caller retains ownership of 'other_config' and everything in it. */
16805
void
16806
ovsrec_ipfix_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
16807
0
{
16808
0
    struct ovsdb_datum datum;
16809
16810
0
    if (other_config) {
16811
0
        ovsdb_datum_from_smap(&datum, other_config);
16812
0
    } else {
16813
0
        ovsdb_datum_init_empty(&datum);
16814
0
    }
16815
16816
0
    ovsdb_idl_condition_add_clause(cond,
16817
0
                                   function,
16818
0
                                   &ovsrec_ipfix_col_other_config,
16819
0
                                   &datum);
16820
16821
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_other_config.type);
16822
0
}
16823
16824
16825
/* Sets the "sampling" column from the "IPFIX" table in 'row' to
16826
 * the 'sampling' set with 'n_sampling' entries.
16827
 *
16828
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
16829
 * may be NULL.
16830
 *
16831
 * Argument constraints: in range 1 to 4,294,967,295
16832
 *
16833
 * The caller retains ownership of the arguments. */
16834
void
16835
ovsrec_ipfix_add_clause_sampling(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *sampling, size_t n_sampling)
16836
0
{
16837
0
    struct ovsdb_datum datum;
16838
16839
0
    datum.refcnt = NULL;
16840
16841
0
    if (n_sampling) {
16842
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16843
0
        datum.n = 1;
16844
0
        datum.keys = key;
16845
0
        key->integer = *sampling;
16846
0
    } else {
16847
0
        datum.n = 0;
16848
0
        datum.keys = NULL;
16849
0
    }
16850
0
    datum.values = NULL;
16851
0
    ovsdb_idl_condition_add_clause(cond,
16852
0
                          function,
16853
0
                          &ovsrec_ipfix_col_sampling,
16854
0
                          &datum);
16855
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_sampling.type);
16856
0
}
16857
16858
/* Sets the "stats_interval" column from the "IPFIX" table in 'row' to
16859
 * the 'stats_interval' set with 'n_stats_interval' entries.
16860
 *
16861
 * 'n_stats_interval' may be 0 or 1; if it is 0, then 'stats_interval'
16862
 * may be NULL.
16863
 *
16864
 * Argument constraints: in range 1 to 3,600
16865
 *
16866
 * The caller retains ownership of the arguments. */
16867
void
16868
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)
16869
0
{
16870
0
    struct ovsdb_datum datum;
16871
16872
0
    datum.refcnt = NULL;
16873
16874
0
    if (n_stats_interval) {
16875
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16876
0
        datum.n = 1;
16877
0
        datum.keys = key;
16878
0
        key->integer = *stats_interval;
16879
0
    } else {
16880
0
        datum.n = 0;
16881
0
        datum.keys = NULL;
16882
0
    }
16883
0
    datum.values = NULL;
16884
0
    ovsdb_idl_condition_add_clause(cond,
16885
0
                          function,
16886
0
                          &ovsrec_ipfix_col_stats_interval,
16887
0
                          &datum);
16888
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_stats_interval.type);
16889
0
}
16890
16891
/* Sets the "targets" column from the "IPFIX" table in 'row' to
16892
 * the 'targets' set with 'n_targets' entries.
16893
 *
16894
 * The caller retains ownership of the arguments. */
16895
void
16896
ovsrec_ipfix_add_clause_targets(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **targets, size_t n_targets)
16897
0
{
16898
0
    struct ovsdb_datum datum;
16899
16900
0
    datum.refcnt = NULL;
16901
0
    datum.n = n_targets;
16902
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
16903
0
    datum.values = NULL;
16904
0
    for (size_t i = 0; i < n_targets; i++) {
16905
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
16906
0
    }
16907
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_ipfix_col_targets.type);
16908
0
    ovsdb_idl_condition_add_clause(cond,
16909
0
                          function,
16910
0
                          &ovsrec_ipfix_col_targets,
16911
0
                          &datum);
16912
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_targets.type);
16913
0
}
16914
16915
/* Sets the "template_interval" column from the "IPFIX" table in 'row' to
16916
 * the 'template_interval' set with 'n_template_interval' entries.
16917
 *
16918
 * 'n_template_interval' may be 0 or 1; if it is 0, then 'template_interval'
16919
 * may be NULL.
16920
 *
16921
 * Argument constraints: in range 1 to 3,600
16922
 *
16923
 * The caller retains ownership of the arguments. */
16924
void
16925
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)
16926
0
{
16927
0
    struct ovsdb_datum datum;
16928
16929
0
    datum.refcnt = NULL;
16930
16931
0
    if (n_template_interval) {
16932
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
16933
0
        datum.n = 1;
16934
0
        datum.keys = key;
16935
0
        key->integer = *template_interval;
16936
0
    } else {
16937
0
        datum.n = 0;
16938
0
        datum.keys = NULL;
16939
0
    }
16940
0
    datum.values = NULL;
16941
0
    ovsdb_idl_condition_add_clause(cond,
16942
0
                          function,
16943
0
                          &ovsrec_ipfix_col_template_interval,
16944
0
                          &datum);
16945
0
    ovsdb_datum_destroy(&datum, &ovsrec_ipfix_col_template_interval.type);
16946
0
}
16947
16948
/* Destroy 'row' of kind "IPFIX". The row must have been
16949
 * created with ovsdb_idl_index_init_row.
16950
 */
16951
void
16952
ovsrec_ipfix_index_destroy_row(const struct ovsrec_ipfix *row)
16953
0
{
16954
0
    ovsdb_idl_index_destroy_row(&row->header_);
16955
0
}
16956
        
16957
16958
/* Creates a new row of kind "IPFIX". */
16959
struct ovsrec_ipfix *
16960
ovsrec_ipfix_index_init_row(struct ovsdb_idl_index *index)
16961
0
{
16962
0
    ovs_assert(index->table->class_ == &ovsrec_table_ipfix);
16963
0
    return ALIGNED_CAST(struct ovsrec_ipfix *, ovsdb_idl_index_init_row(index));
16964
0
}
16965
16966
struct ovsrec_ipfix *
16967
ovsrec_ipfix_index_find(struct ovsdb_idl_index *index, const struct ovsrec_ipfix *target)
16968
0
{
16969
0
    ovs_assert(index->table->class_ == &ovsrec_table_ipfix);
16970
0
    return ovsrec_ipfix_cast(ovsdb_idl_index_find(index, &target->header_));
16971
0
}
16972
16973
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
16974
int
16975
ovsrec_ipfix_index_compare(
16976
    struct ovsdb_idl_index *index, 
16977
    const struct ovsrec_ipfix *a, 
16978
    const struct ovsrec_ipfix *b)
16979
0
{
16980
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
16981
0
}
16982
16983
struct ovsdb_idl_cursor
16984
ovsrec_ipfix_cursor_first(struct ovsdb_idl_index *index)
16985
0
{
16986
0
    ovs_assert(index->table->class_ == &ovsrec_table_ipfix);
16987
0
    return ovsdb_idl_cursor_first(index);
16988
0
}
16989
16990
struct ovsdb_idl_cursor
16991
ovsrec_ipfix_cursor_first_eq(
16992
    struct ovsdb_idl_index *index, const struct ovsrec_ipfix *target)
16993
0
{
16994
0
    ovs_assert(index->table->class_ == &ovsrec_table_ipfix);
16995
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
16996
0
}
16997
16998
struct ovsdb_idl_cursor
16999
ovsrec_ipfix_cursor_first_ge(
17000
    struct ovsdb_idl_index *index, const struct ovsrec_ipfix *target)
17001
0
{
17002
0
    ovs_assert(index->table->class_ == &ovsrec_table_ipfix);
17003
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
17004
0
}
17005
17006
struct ovsrec_ipfix *
17007
ovsrec_ipfix_cursor_data(struct ovsdb_idl_cursor *cursor)
17008
0
{
17009
0
    return ovsrec_ipfix_cast(ovsdb_idl_cursor_data(cursor));
17010
0
}
17011
17012
17013
/* Sets the "cache_active_timeout" column from the "IPFIX" table in 'row' to
17014
 * the 'cache_active_timeout' set with 'n_cache_active_timeout' entries.
17015
 *
17016
 * 'n_cache_active_timeout' may be 0 or 1; if it is 0, then 'cache_active_timeout'
17017
 * may be NULL.
17018
 *
17019
 * Argument constraints: in range 0 to 4,200
17020
 *
17021
 * The caller retains ownership of the arguments. */
17022
void
17023
ovsrec_ipfix_index_set_cache_active_timeout(const struct ovsrec_ipfix *row, const int64_t *cache_active_timeout, size_t n_cache_active_timeout)
17024
0
{
17025
0
    struct ovsdb_datum datum;
17026
17027
0
    datum.refcnt = NULL;
17028
0
    union ovsdb_atom *key;
17029
17030
0
    if (n_cache_active_timeout) {
17031
0
        key = xmalloc(sizeof(union ovsdb_atom));
17032
0
        datum.n = 1;
17033
0
        datum.keys = key;
17034
0
        key->integer = *cache_active_timeout;
17035
0
    } else {
17036
0
        datum.n = 0;
17037
0
        datum.keys = NULL;
17038
0
    }
17039
0
    datum.values = NULL;
17040
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]);
17041
0
}
17042
17043
/* Sets the "cache_max_flows" column from the "IPFIX" table in 'row' to
17044
 * the 'cache_max_flows' set with 'n_cache_max_flows' entries.
17045
 *
17046
 * 'n_cache_max_flows' may be 0 or 1; if it is 0, then 'cache_max_flows'
17047
 * may be NULL.
17048
 *
17049
 * Argument constraints: in range 0 to 4,294,967,295
17050
 *
17051
 * The caller retains ownership of the arguments. */
17052
void
17053
ovsrec_ipfix_index_set_cache_max_flows(const struct ovsrec_ipfix *row, const int64_t *cache_max_flows, size_t n_cache_max_flows)
17054
0
{
17055
0
    struct ovsdb_datum datum;
17056
17057
0
    datum.refcnt = NULL;
17058
0
    union ovsdb_atom *key;
17059
17060
0
    if (n_cache_max_flows) {
17061
0
        key = xmalloc(sizeof(union ovsdb_atom));
17062
0
        datum.n = 1;
17063
0
        datum.keys = key;
17064
0
        key->integer = *cache_max_flows;
17065
0
    } else {
17066
0
        datum.n = 0;
17067
0
        datum.keys = NULL;
17068
0
    }
17069
0
    datum.values = NULL;
17070
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]);
17071
0
}
17072
17073
/* Sets the "external_ids" column's value from the "IPFIX" table in 'row'
17074
 * to 'external_ids'.
17075
 *
17076
 * The caller retains ownership of 'external_ids' and everything in it. */
17077
void
17078
ovsrec_ipfix_index_set_external_ids(const struct ovsrec_ipfix *row, const struct smap *external_ids)
17079
0
{
17080
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
17081
17082
0
    if (external_ids) {
17083
0
        struct smap_node *node;
17084
0
        size_t i;
17085
17086
0
        datum->n = smap_count(external_ids);
17087
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
17088
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
17089
0
        datum->refcnt = NULL;
17090
17091
0
        i = 0;
17092
0
        SMAP_FOR_EACH (node, external_ids) {
17093
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
17094
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
17095
0
            i++;
17096
0
        }
17097
0
        ovsdb_datum_sort_unique(datum, &ovsrec_ipfix_col_external_ids.type);
17098
0
    } else {
17099
0
        ovsdb_datum_init_empty(datum);
17100
0
    }
17101
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
17102
0
                          &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_EXTERNAL_IDS],
17103
0
                          datum,
17104
0
                          &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
17105
0
    free(datum);
17106
0
}
17107
17108
17109
/* Sets the "obs_domain_id" column from the "IPFIX" table in 'row' to
17110
 * the 'obs_domain_id' set with 'n_obs_domain_id' entries.
17111
 *
17112
 * 'n_obs_domain_id' may be 0 or 1; if it is 0, then 'obs_domain_id'
17113
 * may be NULL.
17114
 *
17115
 * Argument constraints: in range 0 to 4,294,967,295
17116
 *
17117
 * The caller retains ownership of the arguments. */
17118
void
17119
ovsrec_ipfix_index_set_obs_domain_id(const struct ovsrec_ipfix *row, const int64_t *obs_domain_id, size_t n_obs_domain_id)
17120
0
{
17121
0
    struct ovsdb_datum datum;
17122
17123
0
    datum.refcnt = NULL;
17124
0
    union ovsdb_atom *key;
17125
17126
0
    if (n_obs_domain_id) {
17127
0
        key = xmalloc(sizeof(union ovsdb_atom));
17128
0
        datum.n = 1;
17129
0
        datum.keys = key;
17130
0
        key->integer = *obs_domain_id;
17131
0
    } else {
17132
0
        datum.n = 0;
17133
0
        datum.keys = NULL;
17134
0
    }
17135
0
    datum.values = NULL;
17136
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]);
17137
0
}
17138
17139
/* Sets the "obs_point_id" column from the "IPFIX" table in 'row' to
17140
 * the 'obs_point_id' set with 'n_obs_point_id' entries.
17141
 *
17142
 * 'n_obs_point_id' may be 0 or 1; if it is 0, then 'obs_point_id'
17143
 * may be NULL.
17144
 *
17145
 * Argument constraints: in range 0 to 4,294,967,295
17146
 *
17147
 * The caller retains ownership of the arguments. */
17148
void
17149
ovsrec_ipfix_index_set_obs_point_id(const struct ovsrec_ipfix *row, const int64_t *obs_point_id, size_t n_obs_point_id)
17150
0
{
17151
0
    struct ovsdb_datum datum;
17152
17153
0
    datum.refcnt = NULL;
17154
0
    union ovsdb_atom *key;
17155
17156
0
    if (n_obs_point_id) {
17157
0
        key = xmalloc(sizeof(union ovsdb_atom));
17158
0
        datum.n = 1;
17159
0
        datum.keys = key;
17160
0
        key->integer = *obs_point_id;
17161
0
    } else {
17162
0
        datum.n = 0;
17163
0
        datum.keys = NULL;
17164
0
    }
17165
0
    datum.values = NULL;
17166
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]);
17167
0
}
17168
17169
/* Sets the "other_config" column's value from the "IPFIX" table in 'row'
17170
 * to 'other_config'.
17171
 *
17172
 * The caller retains ownership of 'other_config' and everything in it. */
17173
void
17174
ovsrec_ipfix_index_set_other_config(const struct ovsrec_ipfix *row, const struct smap *other_config)
17175
0
{
17176
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
17177
17178
0
    if (other_config) {
17179
0
        struct smap_node *node;
17180
0
        size_t i;
17181
17182
0
        datum->n = smap_count(other_config);
17183
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
17184
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
17185
0
        datum->refcnt = NULL;
17186
17187
0
        i = 0;
17188
0
        SMAP_FOR_EACH (node, other_config) {
17189
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
17190
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
17191
0
            i++;
17192
0
        }
17193
0
        ovsdb_datum_sort_unique(datum, &ovsrec_ipfix_col_other_config.type);
17194
0
    } else {
17195
0
        ovsdb_datum_init_empty(datum);
17196
0
    }
17197
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
17198
0
                          &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_OTHER_CONFIG],
17199
0
                          datum,
17200
0
                          &ovsrec_table_classes[OVSREC_TABLE_IPFIX]);
17201
0
    free(datum);
17202
0
}
17203
17204
17205
/* Sets the "sampling" column from the "IPFIX" table in 'row' to
17206
 * the 'sampling' set with 'n_sampling' entries.
17207
 *
17208
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
17209
 * may be NULL.
17210
 *
17211
 * Argument constraints: in range 1 to 4,294,967,295
17212
 *
17213
 * The caller retains ownership of the arguments. */
17214
void
17215
ovsrec_ipfix_index_set_sampling(const struct ovsrec_ipfix *row, const int64_t *sampling, size_t n_sampling)
17216
0
{
17217
0
    struct ovsdb_datum datum;
17218
17219
0
    datum.refcnt = NULL;
17220
0
    union ovsdb_atom *key;
17221
17222
0
    if (n_sampling) {
17223
0
        key = xmalloc(sizeof(union ovsdb_atom));
17224
0
        datum.n = 1;
17225
0
        datum.keys = key;
17226
0
        key->integer = *sampling;
17227
0
    } else {
17228
0
        datum.n = 0;
17229
0
        datum.keys = NULL;
17230
0
    }
17231
0
    datum.values = NULL;
17232
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]);
17233
0
}
17234
17235
/* Sets the "stats_interval" column from the "IPFIX" table in 'row' to
17236
 * the 'stats_interval' set with 'n_stats_interval' entries.
17237
 *
17238
 * 'n_stats_interval' may be 0 or 1; if it is 0, then 'stats_interval'
17239
 * may be NULL.
17240
 *
17241
 * Argument constraints: in range 1 to 3,600
17242
 *
17243
 * The caller retains ownership of the arguments. */
17244
void
17245
ovsrec_ipfix_index_set_stats_interval(const struct ovsrec_ipfix *row, const int64_t *stats_interval, size_t n_stats_interval)
17246
0
{
17247
0
    struct ovsdb_datum datum;
17248
17249
0
    datum.refcnt = NULL;
17250
0
    union ovsdb_atom *key;
17251
17252
0
    if (n_stats_interval) {
17253
0
        key = xmalloc(sizeof(union ovsdb_atom));
17254
0
        datum.n = 1;
17255
0
        datum.keys = key;
17256
0
        key->integer = *stats_interval;
17257
0
    } else {
17258
0
        datum.n = 0;
17259
0
        datum.keys = NULL;
17260
0
    }
17261
0
    datum.values = NULL;
17262
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]);
17263
0
}
17264
17265
/* Sets the "targets" column from the "IPFIX" table in 'row' to
17266
 * the 'targets' set with 'n_targets' entries.
17267
 *
17268
 * The caller retains ownership of the arguments. */
17269
void
17270
ovsrec_ipfix_index_set_targets(const struct ovsrec_ipfix *row, const char **targets, size_t n_targets)
17271
0
{
17272
0
    struct ovsdb_datum datum;
17273
17274
0
    datum.refcnt = NULL;
17275
0
    size_t i;
17276
17277
0
    datum.n = n_targets;
17278
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
17279
0
    datum.values = NULL;
17280
0
    for (i = 0; i < n_targets; i++) {
17281
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
17282
0
    }
17283
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_ipfix_col_targets.type);
17284
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]);
17285
0
}
17286
17287
/* Sets the "template_interval" column from the "IPFIX" table in 'row' to
17288
 * the 'template_interval' set with 'n_template_interval' entries.
17289
 *
17290
 * 'n_template_interval' may be 0 or 1; if it is 0, then 'template_interval'
17291
 * may be NULL.
17292
 *
17293
 * Argument constraints: in range 1 to 3,600
17294
 *
17295
 * The caller retains ownership of the arguments. */
17296
void
17297
ovsrec_ipfix_index_set_template_interval(const struct ovsrec_ipfix *row, const int64_t *template_interval, size_t n_template_interval)
17298
0
{
17299
0
    struct ovsdb_datum datum;
17300
17301
0
    datum.refcnt = NULL;
17302
0
    union ovsdb_atom *key;
17303
17304
0
    if (n_template_interval) {
17305
0
        key = xmalloc(sizeof(union ovsdb_atom));
17306
0
        datum.n = 1;
17307
0
        datum.keys = key;
17308
0
        key->integer = *template_interval;
17309
0
    } else {
17310
0
        datum.n = 0;
17311
0
        datum.keys = NULL;
17312
0
    }
17313
0
    datum.values = NULL;
17314
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]);
17315
0
}
17316
17317
struct ovsdb_idl_column ovsrec_ipfix_columns[OVSREC_IPFIX_N_COLUMNS];
17318
17319
unsigned int
17320
ovsrec_ipfix_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
17321
0
{
17322
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_ipfix, condition);
17323
0
}
17324
17325
struct ovsdb_idl_column ovsrec_ipfix_columns[OVSREC_IPFIX_N_COLUMNS] = {
17326
    [OVSREC_IPFIX_COL_CACHE_ACTIVE_TIMEOUT] = {
17327
         .name = "cache_active_timeout",
17328
         .type = {
17329
            .key = {
17330
               .type = OVSDB_TYPE_INTEGER,
17331
               .integer = { .min = INT64_C(0), .max = INT64_C(4200) },
17332
            },
17333
            .value = OVSDB_BASE_VOID_INIT,
17334
            .n_min = 0,
17335
            .n_max = 1,
17336
         },
17337
         .is_mutable = true,
17338
         .is_synthetic = false,
17339
         .parse = ovsrec_ipfix_parse_cache_active_timeout,
17340
         .unparse = ovsrec_ipfix_unparse_cache_active_timeout,
17341
    },
17342
17343
    [OVSREC_IPFIX_COL_CACHE_MAX_FLOWS] = {
17344
         .name = "cache_max_flows",
17345
         .type = {
17346
            .key = {
17347
               .type = OVSDB_TYPE_INTEGER,
17348
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
17349
            },
17350
            .value = OVSDB_BASE_VOID_INIT,
17351
            .n_min = 0,
17352
            .n_max = 1,
17353
         },
17354
         .is_mutable = true,
17355
         .is_synthetic = false,
17356
         .parse = ovsrec_ipfix_parse_cache_max_flows,
17357
         .unparse = ovsrec_ipfix_unparse_cache_max_flows,
17358
    },
17359
17360
    [OVSREC_IPFIX_COL_EXTERNAL_IDS] = {
17361
         .name = "external_ids",
17362
         .type = {
17363
            .key = {
17364
               .type = OVSDB_TYPE_STRING,
17365
               .string = { .minLen = 0, .maxLen = UINT_MAX },
17366
            },
17367
            .value = {
17368
                .type = OVSDB_TYPE_STRING,
17369
                .string = { .minLen = 0, .maxLen = UINT_MAX },
17370
            },
17371
            .n_min = 0,
17372
            .n_max = UINT_MAX,
17373
         },
17374
         .is_mutable = true,
17375
         .is_synthetic = false,
17376
         .parse = ovsrec_ipfix_parse_external_ids,
17377
         .unparse = ovsrec_ipfix_unparse_external_ids,
17378
    },
17379
17380
    [OVSREC_IPFIX_COL_OBS_DOMAIN_ID] = {
17381
         .name = "obs_domain_id",
17382
         .type = {
17383
            .key = {
17384
               .type = OVSDB_TYPE_INTEGER,
17385
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
17386
            },
17387
            .value = OVSDB_BASE_VOID_INIT,
17388
            .n_min = 0,
17389
            .n_max = 1,
17390
         },
17391
         .is_mutable = true,
17392
         .is_synthetic = false,
17393
         .parse = ovsrec_ipfix_parse_obs_domain_id,
17394
         .unparse = ovsrec_ipfix_unparse_obs_domain_id,
17395
    },
17396
17397
    [OVSREC_IPFIX_COL_OBS_POINT_ID] = {
17398
         .name = "obs_point_id",
17399
         .type = {
17400
            .key = {
17401
               .type = OVSDB_TYPE_INTEGER,
17402
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
17403
            },
17404
            .value = OVSDB_BASE_VOID_INIT,
17405
            .n_min = 0,
17406
            .n_max = 1,
17407
         },
17408
         .is_mutable = true,
17409
         .is_synthetic = false,
17410
         .parse = ovsrec_ipfix_parse_obs_point_id,
17411
         .unparse = ovsrec_ipfix_unparse_obs_point_id,
17412
    },
17413
17414
    [OVSREC_IPFIX_COL_OTHER_CONFIG] = {
17415
         .name = "other_config",
17416
         .type = {
17417
            .key = {
17418
               .type = OVSDB_TYPE_STRING,
17419
               .string = { .minLen = 0, .maxLen = UINT_MAX },
17420
            },
17421
            .value = {
17422
                .type = OVSDB_TYPE_STRING,
17423
                .string = { .minLen = 0, .maxLen = UINT_MAX },
17424
            },
17425
            .n_min = 0,
17426
            .n_max = UINT_MAX,
17427
         },
17428
         .is_mutable = true,
17429
         .is_synthetic = false,
17430
         .parse = ovsrec_ipfix_parse_other_config,
17431
         .unparse = ovsrec_ipfix_unparse_other_config,
17432
    },
17433
17434
    [OVSREC_IPFIX_COL_SAMPLING] = {
17435
         .name = "sampling",
17436
         .type = {
17437
            .key = {
17438
               .type = OVSDB_TYPE_INTEGER,
17439
               .integer = { .min = INT64_C(1), .max = INT64_C(4294967295) },
17440
            },
17441
            .value = OVSDB_BASE_VOID_INIT,
17442
            .n_min = 0,
17443
            .n_max = 1,
17444
         },
17445
         .is_mutable = true,
17446
         .is_synthetic = false,
17447
         .parse = ovsrec_ipfix_parse_sampling,
17448
         .unparse = ovsrec_ipfix_unparse_sampling,
17449
    },
17450
17451
    [OVSREC_IPFIX_COL_STATS_INTERVAL] = {
17452
         .name = "stats_interval",
17453
         .type = {
17454
            .key = {
17455
               .type = OVSDB_TYPE_INTEGER,
17456
               .integer = { .min = INT64_C(1), .max = INT64_C(3600) },
17457
            },
17458
            .value = OVSDB_BASE_VOID_INIT,
17459
            .n_min = 0,
17460
            .n_max = 1,
17461
         },
17462
         .is_mutable = true,
17463
         .is_synthetic = false,
17464
         .parse = ovsrec_ipfix_parse_stats_interval,
17465
         .unparse = ovsrec_ipfix_unparse_stats_interval,
17466
    },
17467
17468
    [OVSREC_IPFIX_COL_TARGETS] = {
17469
         .name = "targets",
17470
         .type = {
17471
            .key = {
17472
               .type = OVSDB_TYPE_STRING,
17473
               .string = { .minLen = 0, .maxLen = UINT_MAX },
17474
            },
17475
            .value = OVSDB_BASE_VOID_INIT,
17476
            .n_min = 0,
17477
            .n_max = UINT_MAX,
17478
         },
17479
         .is_mutable = true,
17480
         .is_synthetic = false,
17481
         .parse = ovsrec_ipfix_parse_targets,
17482
         .unparse = ovsrec_ipfix_unparse_targets,
17483
    },
17484
17485
    [OVSREC_IPFIX_COL_TEMPLATE_INTERVAL] = {
17486
         .name = "template_interval",
17487
         .type = {
17488
            .key = {
17489
               .type = OVSDB_TYPE_INTEGER,
17490
               .integer = { .min = INT64_C(1), .max = INT64_C(3600) },
17491
            },
17492
            .value = OVSDB_BASE_VOID_INIT,
17493
            .n_min = 0,
17494
            .n_max = 1,
17495
         },
17496
         .is_mutable = true,
17497
         .is_synthetic = false,
17498
         .parse = ovsrec_ipfix_parse_template_interval,
17499
         .unparse = ovsrec_ipfix_unparse_template_interval,
17500
    },
17501
17502
};
17503

17504
/* Interface table. */
17505
17506
bool
17507
ovsrec_server_has_interface_table_col_admin_state(const struct ovsdb_idl *idl)
17508
0
{
17509
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_admin_state);
17510
0
}
17511
17512
17513
bool
17514
ovsrec_server_has_interface_table_col_bfd(const struct ovsdb_idl *idl)
17515
0
{
17516
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_bfd);
17517
0
}
17518
17519
17520
bool
17521
ovsrec_server_has_interface_table_col_bfd_status(const struct ovsdb_idl *idl)
17522
0
{
17523
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_bfd_status);
17524
0
}
17525
17526
17527
bool
17528
ovsrec_server_has_interface_table_col_cfm_fault(const struct ovsdb_idl *idl)
17529
0
{
17530
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_fault);
17531
0
}
17532
17533
17534
bool
17535
ovsrec_server_has_interface_table_col_cfm_fault_status(const struct ovsdb_idl *idl)
17536
0
{
17537
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_fault_status);
17538
0
}
17539
17540
17541
bool
17542
ovsrec_server_has_interface_table_col_cfm_flap_count(const struct ovsdb_idl *idl)
17543
0
{
17544
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_flap_count);
17545
0
}
17546
17547
17548
bool
17549
ovsrec_server_has_interface_table_col_cfm_health(const struct ovsdb_idl *idl)
17550
0
{
17551
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_health);
17552
0
}
17553
17554
17555
bool
17556
ovsrec_server_has_interface_table_col_cfm_mpid(const struct ovsdb_idl *idl)
17557
0
{
17558
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_mpid);
17559
0
}
17560
17561
17562
bool
17563
ovsrec_server_has_interface_table_col_cfm_remote_mpids(const struct ovsdb_idl *idl)
17564
0
{
17565
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_remote_mpids);
17566
0
}
17567
17568
17569
bool
17570
ovsrec_server_has_interface_table_col_cfm_remote_opstate(const struct ovsdb_idl *idl)
17571
0
{
17572
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_cfm_remote_opstate);
17573
0
}
17574
17575
17576
bool
17577
ovsrec_server_has_interface_table_col_duplex(const struct ovsdb_idl *idl)
17578
0
{
17579
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_duplex);
17580
0
}
17581
17582
17583
bool
17584
ovsrec_server_has_interface_table_col_error(const struct ovsdb_idl *idl)
17585
0
{
17586
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_error);
17587
0
}
17588
17589
17590
bool
17591
ovsrec_server_has_interface_table_col_external_ids(const struct ovsdb_idl *idl)
17592
0
{
17593
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_external_ids);
17594
0
}
17595
17596
17597
bool
17598
ovsrec_server_has_interface_table_col_ifindex(const struct ovsdb_idl *idl)
17599
0
{
17600
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ifindex);
17601
0
}
17602
17603
17604
bool
17605
ovsrec_server_has_interface_table_col_ingress_policing_burst(const struct ovsdb_idl *idl)
17606
0
{
17607
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ingress_policing_burst);
17608
0
}
17609
17610
17611
bool
17612
ovsrec_server_has_interface_table_col_ingress_policing_kpkts_burst(const struct ovsdb_idl *idl)
17613
0
{
17614
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ingress_policing_kpkts_burst);
17615
0
}
17616
17617
17618
bool
17619
ovsrec_server_has_interface_table_col_ingress_policing_kpkts_rate(const struct ovsdb_idl *idl)
17620
0
{
17621
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ingress_policing_kpkts_rate);
17622
0
}
17623
17624
17625
bool
17626
ovsrec_server_has_interface_table_col_ingress_policing_rate(const struct ovsdb_idl *idl)
17627
0
{
17628
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ingress_policing_rate);
17629
0
}
17630
17631
17632
bool
17633
ovsrec_server_has_interface_table_col_lacp_current(const struct ovsdb_idl *idl)
17634
0
{
17635
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_lacp_current);
17636
0
}
17637
17638
17639
bool
17640
ovsrec_server_has_interface_table_col_link_resets(const struct ovsdb_idl *idl)
17641
0
{
17642
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_link_resets);
17643
0
}
17644
17645
17646
bool
17647
ovsrec_server_has_interface_table_col_link_speed(const struct ovsdb_idl *idl)
17648
0
{
17649
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_link_speed);
17650
0
}
17651
17652
17653
bool
17654
ovsrec_server_has_interface_table_col_link_state(const struct ovsdb_idl *idl)
17655
0
{
17656
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_link_state);
17657
0
}
17658
17659
17660
bool
17661
ovsrec_server_has_interface_table_col_lldp(const struct ovsdb_idl *idl)
17662
0
{
17663
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_lldp);
17664
0
}
17665
17666
17667
bool
17668
ovsrec_server_has_interface_table_col_mac(const struct ovsdb_idl *idl)
17669
0
{
17670
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_mac);
17671
0
}
17672
17673
17674
bool
17675
ovsrec_server_has_interface_table_col_mac_in_use(const struct ovsdb_idl *idl)
17676
0
{
17677
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_mac_in_use);
17678
0
}
17679
17680
17681
bool
17682
ovsrec_server_has_interface_table_col_mtu(const struct ovsdb_idl *idl)
17683
0
{
17684
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_mtu);
17685
0
}
17686
17687
17688
bool
17689
ovsrec_server_has_interface_table_col_mtu_request(const struct ovsdb_idl *idl)
17690
0
{
17691
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_mtu_request);
17692
0
}
17693
17694
17695
bool
17696
ovsrec_server_has_interface_table_col_name(const struct ovsdb_idl *idl)
17697
0
{
17698
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_name);
17699
0
}
17700
17701
17702
bool
17703
ovsrec_server_has_interface_table_col_ofport(const struct ovsdb_idl *idl)
17704
0
{
17705
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ofport);
17706
0
}
17707
17708
17709
bool
17710
ovsrec_server_has_interface_table_col_ofport_request(const struct ovsdb_idl *idl)
17711
0
{
17712
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_ofport_request);
17713
0
}
17714
17715
17716
bool
17717
ovsrec_server_has_interface_table_col_options(const struct ovsdb_idl *idl)
17718
0
{
17719
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_options);
17720
0
}
17721
17722
17723
bool
17724
ovsrec_server_has_interface_table_col_other_config(const struct ovsdb_idl *idl)
17725
0
{
17726
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_other_config);
17727
0
}
17728
17729
17730
bool
17731
ovsrec_server_has_interface_table_col_statistics(const struct ovsdb_idl *idl)
17732
0
{
17733
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_statistics);
17734
0
}
17735
17736
17737
bool
17738
ovsrec_server_has_interface_table_col_status(const struct ovsdb_idl *idl)
17739
0
{
17740
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_status);
17741
0
}
17742
17743
17744
bool
17745
ovsrec_server_has_interface_table_col_type(const struct ovsdb_idl *idl)
17746
0
{
17747
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_interface_col_type);
17748
0
}
17749
17750
17751
bool
17752
ovsrec_server_has_interface_table(const struct ovsdb_idl *idl)
17753
0
{
17754
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
17755
0
}
17756
17757
17758
const struct ovsrec_interface_table *
17759
ovsrec_interface_table_get(const struct ovsdb_idl *idl)
17760
0
{
17761
0
    return (const struct ovsrec_interface_table *) idl;
17762
0
}
17763
17764
const struct ovsrec_interface *
17765
ovsrec_interface_table_first(const struct ovsrec_interface_table *table)
17766
0
{
17767
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
17768
0
    return ovsrec_interface_first(idl);
17769
0
}
17770
17771
17772
const struct ovsrec_interface *
17773
ovsrec_interface_table_track_get_first(const struct ovsrec_interface_table *table)
17774
0
{
17775
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
17776
0
    return ovsrec_interface_track_get_first(idl);
17777
0
}
17778
17779
17780
static void
17781
ovsrec_interface_parse_admin_state(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17782
0
{
17783
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17784
17785
0
    if (datum->n >= 1) {
17786
0
        row->admin_state = datum->keys[0].s->string;
17787
0
    } else {
17788
0
        row->admin_state = NULL;
17789
0
    }
17790
0
}
17791
17792
static void
17793
ovsrec_interface_parse_bfd(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17794
0
{
17795
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17796
0
    smap_init(&row->bfd);
17797
0
    for (size_t i = 0; i < datum->n; i++) {
17798
0
        smap_add(&row->bfd,
17799
0
                 json_string(datum->keys[i].s),
17800
0
                 json_string(datum->values[i].s));
17801
0
    }
17802
0
}
17803
17804
static void
17805
ovsrec_interface_parse_bfd_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17806
0
{
17807
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17808
0
    smap_init(&row->bfd_status);
17809
0
    for (size_t i = 0; i < datum->n; i++) {
17810
0
        smap_add(&row->bfd_status,
17811
0
                 json_string(datum->keys[i].s),
17812
0
                 json_string(datum->values[i].s));
17813
0
    }
17814
0
}
17815
17816
static void
17817
ovsrec_interface_parse_cfm_fault(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17818
0
{
17819
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17820
0
    size_t n = MIN(1, datum->n);
17821
0
    row->cfm_fault = NULL;
17822
0
    row->n_cfm_fault = 0;
17823
0
    for (size_t i = 0; i < n; i++) {
17824
0
        if (!row->n_cfm_fault) {
17825
0
            row->cfm_fault = xmalloc(n * sizeof *row->cfm_fault);
17826
0
        }
17827
0
        row->cfm_fault[row->n_cfm_fault] = datum->keys[i].boolean;
17828
0
        row->n_cfm_fault++;
17829
0
    }
17830
0
}
17831
17832
static void
17833
ovsrec_interface_parse_cfm_fault_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17834
0
{
17835
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17836
0
    row->cfm_fault_status = NULL;
17837
0
    row->n_cfm_fault_status = 0;
17838
0
    for (size_t i = 0; i < datum->n; i++) {
17839
0
        if (!row->n_cfm_fault_status) {
17840
0
            row->cfm_fault_status = xmalloc(datum->n * sizeof *row->cfm_fault_status);
17841
0
        }
17842
0
        row->cfm_fault_status[row->n_cfm_fault_status] = datum->keys[i].s->string;
17843
0
        row->n_cfm_fault_status++;
17844
0
    }
17845
0
}
17846
17847
static void
17848
ovsrec_interface_parse_cfm_flap_count(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17849
0
{
17850
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17851
0
    size_t n = MIN(1, datum->n);
17852
0
    row->cfm_flap_count = NULL;
17853
0
    row->n_cfm_flap_count = 0;
17854
0
    for (size_t i = 0; i < n; i++) {
17855
0
        if (!row->n_cfm_flap_count) {
17856
0
            row->cfm_flap_count = xmalloc(n * sizeof *row->cfm_flap_count);
17857
0
        }
17858
0
        row->cfm_flap_count[row->n_cfm_flap_count] = datum->keys[i].integer;
17859
0
        row->n_cfm_flap_count++;
17860
0
    }
17861
0
}
17862
17863
static void
17864
ovsrec_interface_parse_cfm_health(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17865
0
{
17866
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17867
0
    size_t n = MIN(1, datum->n);
17868
0
    row->cfm_health = NULL;
17869
0
    row->n_cfm_health = 0;
17870
0
    for (size_t i = 0; i < n; i++) {
17871
0
        if (!row->n_cfm_health) {
17872
0
            row->cfm_health = xmalloc(n * sizeof *row->cfm_health);
17873
0
        }
17874
0
        row->cfm_health[row->n_cfm_health] = datum->keys[i].integer;
17875
0
        row->n_cfm_health++;
17876
0
    }
17877
0
}
17878
17879
static void
17880
ovsrec_interface_parse_cfm_mpid(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17881
0
{
17882
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17883
0
    size_t n = MIN(1, datum->n);
17884
0
    row->cfm_mpid = NULL;
17885
0
    row->n_cfm_mpid = 0;
17886
0
    for (size_t i = 0; i < n; i++) {
17887
0
        if (!row->n_cfm_mpid) {
17888
0
            row->cfm_mpid = xmalloc(n * sizeof *row->cfm_mpid);
17889
0
        }
17890
0
        row->cfm_mpid[row->n_cfm_mpid] = datum->keys[i].integer;
17891
0
        row->n_cfm_mpid++;
17892
0
    }
17893
0
}
17894
17895
static void
17896
ovsrec_interface_parse_cfm_remote_mpids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17897
0
{
17898
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17899
0
    row->cfm_remote_mpids = NULL;
17900
0
    row->n_cfm_remote_mpids = 0;
17901
0
    for (size_t i = 0; i < datum->n; i++) {
17902
0
        if (!row->n_cfm_remote_mpids) {
17903
0
            row->cfm_remote_mpids = xmalloc(datum->n * sizeof *row->cfm_remote_mpids);
17904
0
        }
17905
0
        row->cfm_remote_mpids[row->n_cfm_remote_mpids] = datum->keys[i].integer;
17906
0
        row->n_cfm_remote_mpids++;
17907
0
    }
17908
0
}
17909
17910
static void
17911
ovsrec_interface_parse_cfm_remote_opstate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17912
0
{
17913
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17914
17915
0
    if (datum->n >= 1) {
17916
0
        row->cfm_remote_opstate = datum->keys[0].s->string;
17917
0
    } else {
17918
0
        row->cfm_remote_opstate = NULL;
17919
0
    }
17920
0
}
17921
17922
static void
17923
ovsrec_interface_parse_duplex(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17924
0
{
17925
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17926
17927
0
    if (datum->n >= 1) {
17928
0
        row->duplex = datum->keys[0].s->string;
17929
0
    } else {
17930
0
        row->duplex = NULL;
17931
0
    }
17932
0
}
17933
17934
static void
17935
ovsrec_interface_parse_error(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17936
0
{
17937
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17938
17939
0
    if (datum->n >= 1) {
17940
0
        row->error = datum->keys[0].s->string;
17941
0
    } else {
17942
0
        row->error = NULL;
17943
0
    }
17944
0
}
17945
17946
static void
17947
ovsrec_interface_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17948
0
{
17949
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17950
0
    smap_init(&row->external_ids);
17951
0
    for (size_t i = 0; i < datum->n; i++) {
17952
0
        smap_add(&row->external_ids,
17953
0
                 json_string(datum->keys[i].s),
17954
0
                 json_string(datum->values[i].s));
17955
0
    }
17956
0
}
17957
17958
static void
17959
ovsrec_interface_parse_ifindex(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17960
0
{
17961
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17962
0
    size_t n = MIN(1, datum->n);
17963
0
    row->ifindex = NULL;
17964
0
    row->n_ifindex = 0;
17965
0
    for (size_t i = 0; i < n; i++) {
17966
0
        if (!row->n_ifindex) {
17967
0
            row->ifindex = xmalloc(n * sizeof *row->ifindex);
17968
0
        }
17969
0
        row->ifindex[row->n_ifindex] = datum->keys[i].integer;
17970
0
        row->n_ifindex++;
17971
0
    }
17972
0
}
17973
17974
static void
17975
ovsrec_interface_parse_ingress_policing_burst(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17976
0
{
17977
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17978
17979
0
    if (datum->n >= 1) {
17980
0
        row->ingress_policing_burst = datum->keys[0].integer;
17981
0
    } else {
17982
0
        row->ingress_policing_burst = 0;
17983
0
    }
17984
0
}
17985
17986
static void
17987
ovsrec_interface_parse_ingress_policing_kpkts_burst(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
17988
0
{
17989
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
17990
17991
0
    if (datum->n >= 1) {
17992
0
        row->ingress_policing_kpkts_burst = datum->keys[0].integer;
17993
0
    } else {
17994
0
        row->ingress_policing_kpkts_burst = 0;
17995
0
    }
17996
0
}
17997
17998
static void
17999
ovsrec_interface_parse_ingress_policing_kpkts_rate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18000
0
{
18001
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18002
18003
0
    if (datum->n >= 1) {
18004
0
        row->ingress_policing_kpkts_rate = datum->keys[0].integer;
18005
0
    } else {
18006
0
        row->ingress_policing_kpkts_rate = 0;
18007
0
    }
18008
0
}
18009
18010
static void
18011
ovsrec_interface_parse_ingress_policing_rate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18012
0
{
18013
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18014
18015
0
    if (datum->n >= 1) {
18016
0
        row->ingress_policing_rate = datum->keys[0].integer;
18017
0
    } else {
18018
0
        row->ingress_policing_rate = 0;
18019
0
    }
18020
0
}
18021
18022
static void
18023
ovsrec_interface_parse_lacp_current(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18024
0
{
18025
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18026
0
    size_t n = MIN(1, datum->n);
18027
0
    row->lacp_current = NULL;
18028
0
    row->n_lacp_current = 0;
18029
0
    for (size_t i = 0; i < n; i++) {
18030
0
        if (!row->n_lacp_current) {
18031
0
            row->lacp_current = xmalloc(n * sizeof *row->lacp_current);
18032
0
        }
18033
0
        row->lacp_current[row->n_lacp_current] = datum->keys[i].boolean;
18034
0
        row->n_lacp_current++;
18035
0
    }
18036
0
}
18037
18038
static void
18039
ovsrec_interface_parse_link_resets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18040
0
{
18041
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18042
0
    size_t n = MIN(1, datum->n);
18043
0
    row->link_resets = NULL;
18044
0
    row->n_link_resets = 0;
18045
0
    for (size_t i = 0; i < n; i++) {
18046
0
        if (!row->n_link_resets) {
18047
0
            row->link_resets = xmalloc(n * sizeof *row->link_resets);
18048
0
        }
18049
0
        row->link_resets[row->n_link_resets] = datum->keys[i].integer;
18050
0
        row->n_link_resets++;
18051
0
    }
18052
0
}
18053
18054
static void
18055
ovsrec_interface_parse_link_speed(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18056
0
{
18057
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18058
0
    size_t n = MIN(1, datum->n);
18059
0
    row->link_speed = NULL;
18060
0
    row->n_link_speed = 0;
18061
0
    for (size_t i = 0; i < n; i++) {
18062
0
        if (!row->n_link_speed) {
18063
0
            row->link_speed = xmalloc(n * sizeof *row->link_speed);
18064
0
        }
18065
0
        row->link_speed[row->n_link_speed] = datum->keys[i].integer;
18066
0
        row->n_link_speed++;
18067
0
    }
18068
0
}
18069
18070
static void
18071
ovsrec_interface_parse_link_state(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18072
0
{
18073
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18074
18075
0
    if (datum->n >= 1) {
18076
0
        row->link_state = datum->keys[0].s->string;
18077
0
    } else {
18078
0
        row->link_state = NULL;
18079
0
    }
18080
0
}
18081
18082
static void
18083
ovsrec_interface_parse_lldp(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18084
0
{
18085
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18086
0
    smap_init(&row->lldp);
18087
0
    for (size_t i = 0; i < datum->n; i++) {
18088
0
        smap_add(&row->lldp,
18089
0
                 json_string(datum->keys[i].s),
18090
0
                 json_string(datum->values[i].s));
18091
0
    }
18092
0
}
18093
18094
static void
18095
ovsrec_interface_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18096
0
{
18097
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18098
18099
0
    if (datum->n >= 1) {
18100
0
        row->mac = datum->keys[0].s->string;
18101
0
    } else {
18102
0
        row->mac = NULL;
18103
0
    }
18104
0
}
18105
18106
static void
18107
ovsrec_interface_parse_mac_in_use(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18108
0
{
18109
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18110
18111
0
    if (datum->n >= 1) {
18112
0
        row->mac_in_use = datum->keys[0].s->string;
18113
0
    } else {
18114
0
        row->mac_in_use = NULL;
18115
0
    }
18116
0
}
18117
18118
static void
18119
ovsrec_interface_parse_mtu(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18120
0
{
18121
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18122
0
    size_t n = MIN(1, datum->n);
18123
0
    row->mtu = NULL;
18124
0
    row->n_mtu = 0;
18125
0
    for (size_t i = 0; i < n; i++) {
18126
0
        if (!row->n_mtu) {
18127
0
            row->mtu = xmalloc(n * sizeof *row->mtu);
18128
0
        }
18129
0
        row->mtu[row->n_mtu] = datum->keys[i].integer;
18130
0
        row->n_mtu++;
18131
0
    }
18132
0
}
18133
18134
static void
18135
ovsrec_interface_parse_mtu_request(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18136
0
{
18137
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18138
0
    size_t n = MIN(1, datum->n);
18139
0
    row->mtu_request = NULL;
18140
0
    row->n_mtu_request = 0;
18141
0
    for (size_t i = 0; i < n; i++) {
18142
0
        if (!row->n_mtu_request) {
18143
0
            row->mtu_request = xmalloc(n * sizeof *row->mtu_request);
18144
0
        }
18145
0
        row->mtu_request[row->n_mtu_request] = datum->keys[i].integer;
18146
0
        row->n_mtu_request++;
18147
0
    }
18148
0
}
18149
18150
static void
18151
ovsrec_interface_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18152
0
{
18153
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18154
18155
0
    if (datum->n >= 1) {
18156
0
        row->name = datum->keys[0].s->string;
18157
0
    } else {
18158
0
        row->name = "";
18159
0
    }
18160
0
}
18161
18162
static void
18163
ovsrec_interface_parse_ofport(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18164
0
{
18165
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18166
0
    size_t n = MIN(1, datum->n);
18167
0
    row->ofport = NULL;
18168
0
    row->n_ofport = 0;
18169
0
    for (size_t i = 0; i < n; i++) {
18170
0
        if (!row->n_ofport) {
18171
0
            row->ofport = xmalloc(n * sizeof *row->ofport);
18172
0
        }
18173
0
        row->ofport[row->n_ofport] = datum->keys[i].integer;
18174
0
        row->n_ofport++;
18175
0
    }
18176
0
}
18177
18178
static void
18179
ovsrec_interface_parse_ofport_request(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18180
0
{
18181
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18182
0
    size_t n = MIN(1, datum->n);
18183
0
    row->ofport_request = NULL;
18184
0
    row->n_ofport_request = 0;
18185
0
    for (size_t i = 0; i < n; i++) {
18186
0
        if (!row->n_ofport_request) {
18187
0
            row->ofport_request = xmalloc(n * sizeof *row->ofport_request);
18188
0
        }
18189
0
        row->ofport_request[row->n_ofport_request] = datum->keys[i].integer;
18190
0
        row->n_ofport_request++;
18191
0
    }
18192
0
}
18193
18194
static void
18195
ovsrec_interface_parse_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18196
0
{
18197
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18198
0
    smap_init(&row->options);
18199
0
    for (size_t i = 0; i < datum->n; i++) {
18200
0
        smap_add(&row->options,
18201
0
                 json_string(datum->keys[i].s),
18202
0
                 json_string(datum->values[i].s));
18203
0
    }
18204
0
}
18205
18206
static void
18207
ovsrec_interface_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18208
0
{
18209
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18210
0
    smap_init(&row->other_config);
18211
0
    for (size_t i = 0; i < datum->n; i++) {
18212
0
        smap_add(&row->other_config,
18213
0
                 json_string(datum->keys[i].s),
18214
0
                 json_string(datum->values[i].s));
18215
0
    }
18216
0
}
18217
18218
static void
18219
ovsrec_interface_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18220
0
{
18221
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18222
0
    row->key_statistics = NULL;
18223
0
    row->value_statistics = NULL;
18224
0
    row->n_statistics = 0;
18225
0
    for (size_t i = 0; i < datum->n; i++) {
18226
0
        if (!row->n_statistics) {
18227
0
            row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
18228
0
            row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
18229
0
        }
18230
0
        row->key_statistics[row->n_statistics] = datum->keys[i].s->string;
18231
0
        row->value_statistics[row->n_statistics] = datum->values[i].integer;
18232
0
        row->n_statistics++;
18233
0
    }
18234
0
}
18235
18236
static void
18237
ovsrec_interface_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18238
0
{
18239
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18240
0
    smap_init(&row->status);
18241
0
    for (size_t i = 0; i < datum->n; i++) {
18242
0
        smap_add(&row->status,
18243
0
                 json_string(datum->keys[i].s),
18244
0
                 json_string(datum->values[i].s));
18245
0
    }
18246
0
}
18247
18248
static void
18249
ovsrec_interface_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
18250
0
{
18251
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18252
18253
0
    if (datum->n >= 1) {
18254
0
        row->type = datum->keys[0].s->string;
18255
0
    } else {
18256
0
        row->type = "";
18257
0
    }
18258
0
}
18259
18260
static void
18261
ovsrec_interface_unparse_admin_state(struct ovsdb_idl_row *row OVS_UNUSED)
18262
0
{
18263
    /* Nothing to do. */
18264
0
}
18265
18266
static void
18267
ovsrec_interface_unparse_bfd(struct ovsdb_idl_row *row_)
18268
0
{
18269
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18270
0
    smap_destroy(&row->bfd);
18271
0
}
18272
18273
static void
18274
ovsrec_interface_unparse_bfd_status(struct ovsdb_idl_row *row_)
18275
0
{
18276
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18277
0
    smap_destroy(&row->bfd_status);
18278
0
}
18279
18280
static void
18281
ovsrec_interface_unparse_cfm_fault(struct ovsdb_idl_row *row_)
18282
0
{
18283
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18284
0
    free(row->cfm_fault);
18285
0
}
18286
18287
static void
18288
ovsrec_interface_unparse_cfm_fault_status(struct ovsdb_idl_row *row_)
18289
0
{
18290
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18291
0
    free(row->cfm_fault_status);
18292
0
}
18293
18294
static void
18295
ovsrec_interface_unparse_cfm_flap_count(struct ovsdb_idl_row *row_)
18296
0
{
18297
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18298
0
    free(row->cfm_flap_count);
18299
0
}
18300
18301
static void
18302
ovsrec_interface_unparse_cfm_health(struct ovsdb_idl_row *row_)
18303
0
{
18304
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18305
0
    free(row->cfm_health);
18306
0
}
18307
18308
static void
18309
ovsrec_interface_unparse_cfm_mpid(struct ovsdb_idl_row *row_)
18310
0
{
18311
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18312
0
    free(row->cfm_mpid);
18313
0
}
18314
18315
static void
18316
ovsrec_interface_unparse_cfm_remote_mpids(struct ovsdb_idl_row *row_)
18317
0
{
18318
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18319
0
    free(row->cfm_remote_mpids);
18320
0
}
18321
18322
static void
18323
ovsrec_interface_unparse_cfm_remote_opstate(struct ovsdb_idl_row *row OVS_UNUSED)
18324
0
{
18325
    /* Nothing to do. */
18326
0
}
18327
18328
static void
18329
ovsrec_interface_unparse_duplex(struct ovsdb_idl_row *row OVS_UNUSED)
18330
0
{
18331
    /* Nothing to do. */
18332
0
}
18333
18334
static void
18335
ovsrec_interface_unparse_error(struct ovsdb_idl_row *row OVS_UNUSED)
18336
0
{
18337
    /* Nothing to do. */
18338
0
}
18339
18340
static void
18341
ovsrec_interface_unparse_external_ids(struct ovsdb_idl_row *row_)
18342
0
{
18343
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18344
0
    smap_destroy(&row->external_ids);
18345
0
}
18346
18347
static void
18348
ovsrec_interface_unparse_ifindex(struct ovsdb_idl_row *row_)
18349
0
{
18350
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18351
0
    free(row->ifindex);
18352
0
}
18353
18354
static void
18355
ovsrec_interface_unparse_ingress_policing_burst(struct ovsdb_idl_row *row OVS_UNUSED)
18356
0
{
18357
    /* Nothing to do. */
18358
0
}
18359
18360
static void
18361
ovsrec_interface_unparse_ingress_policing_kpkts_burst(struct ovsdb_idl_row *row OVS_UNUSED)
18362
0
{
18363
    /* Nothing to do. */
18364
0
}
18365
18366
static void
18367
ovsrec_interface_unparse_ingress_policing_kpkts_rate(struct ovsdb_idl_row *row OVS_UNUSED)
18368
0
{
18369
    /* Nothing to do. */
18370
0
}
18371
18372
static void
18373
ovsrec_interface_unparse_ingress_policing_rate(struct ovsdb_idl_row *row OVS_UNUSED)
18374
0
{
18375
    /* Nothing to do. */
18376
0
}
18377
18378
static void
18379
ovsrec_interface_unparse_lacp_current(struct ovsdb_idl_row *row_)
18380
0
{
18381
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18382
0
    free(row->lacp_current);
18383
0
}
18384
18385
static void
18386
ovsrec_interface_unparse_link_resets(struct ovsdb_idl_row *row_)
18387
0
{
18388
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18389
0
    free(row->link_resets);
18390
0
}
18391
18392
static void
18393
ovsrec_interface_unparse_link_speed(struct ovsdb_idl_row *row_)
18394
0
{
18395
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18396
0
    free(row->link_speed);
18397
0
}
18398
18399
static void
18400
ovsrec_interface_unparse_link_state(struct ovsdb_idl_row *row OVS_UNUSED)
18401
0
{
18402
    /* Nothing to do. */
18403
0
}
18404
18405
static void
18406
ovsrec_interface_unparse_lldp(struct ovsdb_idl_row *row_)
18407
0
{
18408
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18409
0
    smap_destroy(&row->lldp);
18410
0
}
18411
18412
static void
18413
ovsrec_interface_unparse_mac(struct ovsdb_idl_row *row OVS_UNUSED)
18414
0
{
18415
    /* Nothing to do. */
18416
0
}
18417
18418
static void
18419
ovsrec_interface_unparse_mac_in_use(struct ovsdb_idl_row *row OVS_UNUSED)
18420
0
{
18421
    /* Nothing to do. */
18422
0
}
18423
18424
static void
18425
ovsrec_interface_unparse_mtu(struct ovsdb_idl_row *row_)
18426
0
{
18427
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18428
0
    free(row->mtu);
18429
0
}
18430
18431
static void
18432
ovsrec_interface_unparse_mtu_request(struct ovsdb_idl_row *row_)
18433
0
{
18434
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18435
0
    free(row->mtu_request);
18436
0
}
18437
18438
static void
18439
ovsrec_interface_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
18440
0
{
18441
    /* Nothing to do. */
18442
0
}
18443
18444
static void
18445
ovsrec_interface_unparse_ofport(struct ovsdb_idl_row *row_)
18446
0
{
18447
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18448
0
    free(row->ofport);
18449
0
}
18450
18451
static void
18452
ovsrec_interface_unparse_ofport_request(struct ovsdb_idl_row *row_)
18453
0
{
18454
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18455
0
    free(row->ofport_request);
18456
0
}
18457
18458
static void
18459
ovsrec_interface_unparse_options(struct ovsdb_idl_row *row_)
18460
0
{
18461
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18462
0
    smap_destroy(&row->options);
18463
0
}
18464
18465
static void
18466
ovsrec_interface_unparse_other_config(struct ovsdb_idl_row *row_)
18467
0
{
18468
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18469
0
    smap_destroy(&row->other_config);
18470
0
}
18471
18472
static void
18473
ovsrec_interface_unparse_statistics(struct ovsdb_idl_row *row_)
18474
0
{
18475
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18476
0
    free(row->key_statistics);
18477
0
    free(row->value_statistics);
18478
0
}
18479
18480
static void
18481
ovsrec_interface_unparse_status(struct ovsdb_idl_row *row_)
18482
0
{
18483
0
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
18484
0
    smap_destroy(&row->status);
18485
0
}
18486
18487
static void
18488
ovsrec_interface_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
18489
0
{
18490
    /* Nothing to do. */
18491
0
}
18492
18493
static void
18494
ovsrec_interface_init__(struct ovsdb_idl_row *row)
18495
0
{
18496
0
    ovsrec_interface_init(ovsrec_interface_cast(row));
18497
0
}
18498
18499
/* Clears the contents of 'row' in table "Interface". */
18500
void
18501
ovsrec_interface_init(struct ovsrec_interface *row)
18502
0
{
18503
0
    memset(row, 0, sizeof *row); 
18504
0
    smap_init(&row->bfd);
18505
0
    smap_init(&row->bfd_status);
18506
0
    smap_init(&row->external_ids);
18507
0
    smap_init(&row->lldp);
18508
0
    row->name = "";
18509
0
    smap_init(&row->options);
18510
0
    smap_init(&row->other_config);
18511
0
    smap_init(&row->status);
18512
0
    row->type = "";
18513
0
}
18514
18515
/* Searches table "Interface" in 'idl' for a row with UUID 'uuid'.  Returns
18516
 * a pointer to the row if there is one, otherwise a null pointer.  */
18517
const struct ovsrec_interface *
18518
ovsrec_interface_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
18519
0
{
18520
0
    return ovsrec_interface_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_interface, uuid));
18521
0
}
18522
18523
/* Searches table "Interface" for a row with UUID 'uuid'.  Returns
18524
 * a pointer to the row if there is one, otherwise a null pointer.  */
18525
const struct ovsrec_interface *
18526
ovsrec_interface_table_get_for_uuid(const struct ovsrec_interface_table *table, const struct uuid *uuid)
18527
0
{
18528
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
18529
0
    return ovsrec_interface_get_for_uuid(idl, uuid);
18530
0
}
18531
18532
/* Returns a row in table "Interface" in 'idl', or a null pointer if that
18533
 * table is empty.
18534
 *
18535
 * Database tables are internally maintained as hash tables, so adding or
18536
 * removing rows while traversing the same table can cause some rows to be
18537
 * visited twice or not at apply. */
18538
const struct ovsrec_interface *
18539
ovsrec_interface_first(const struct ovsdb_idl *idl)
18540
0
{
18541
0
    return ovsrec_interface_cast(ovsdb_idl_first_row(idl, &ovsrec_table_interface));
18542
0
}
18543
18544
/* Returns a row following 'row' within its table, or a null pointer if 'row'
18545
 * is the last row in its table. */
18546
const struct ovsrec_interface *
18547
ovsrec_interface_next(const struct ovsrec_interface *row)
18548
0
{
18549
0
    return ovsrec_interface_cast(ovsdb_idl_next_row(&row->header_));
18550
0
}
18551
18552
unsigned int ovsrec_interface_get_seqno(const struct ovsdb_idl *idl)
18553
0
{
18554
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_interface);
18555
0
}
18556
18557
unsigned int ovsrec_interface_row_get_seqno(const struct ovsrec_interface *row, enum ovsdb_idl_change change)
18558
0
{
18559
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
18560
0
}
18561
18562
const struct ovsrec_interface *
18563
ovsrec_interface_track_get_first(const struct ovsdb_idl *idl)
18564
0
{
18565
0
    return ovsrec_interface_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_interface));
18566
0
}
18567
18568
const struct ovsrec_interface
18569
*ovsrec_interface_track_get_next(const struct ovsrec_interface *row)
18570
0
{
18571
0
    return ovsrec_interface_cast(ovsdb_idl_track_get_next(&row->header_));
18572
0
}
18573
18574
18575
/* Deletes 'row' from table "Interface".  'row' may be freed, so it must not be
18576
 * accessed afterward.
18577
 *
18578
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18579
void
18580
ovsrec_interface_delete(const struct ovsrec_interface *row)
18581
0
{
18582
0
    ovsdb_idl_txn_delete(&row->header_);
18583
0
}
18584
18585
/* Inserts and returns a new row in the table "Interface" in the database
18586
 * with open transaction 'txn'.
18587
 *
18588
 * The new row is assigned a randomly generated provisional UUID.
18589
 * ovsdb-server will assign a different UUID when 'txn' is committed,
18590
 * but the IDL will replace any uses of the provisional UUID in the
18591
 * data to be to be committed by the UUID assigned by ovsdb-server. */
18592
struct ovsrec_interface *
18593
ovsrec_interface_insert(struct ovsdb_idl_txn *txn)
18594
0
{
18595
0
    return ovsrec_interface_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_interface, NULL));
18596
0
}
18597
18598
/* Inserts and returns a new row in the table "Interface" in the database
18599
 * with open transaction 'txn'.
18600
 *
18601
 * The new row is assigned the UUID specified in the 'uuid' parameter
18602
 * (which cannot be null).  ovsdb-server will try to assign the same
18603
 * UUID when 'txn' is committed. */
18604
struct ovsrec_interface *
18605
ovsrec_interface_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
18606
0
{
18607
0
    return ovsrec_interface_cast(ovsdb_idl_txn_insert_persist_uuid(
18608
0
        txn, &ovsrec_table_interface, uuid));
18609
0
}
18610
18611
bool
18612
ovsrec_interface_is_updated(const struct ovsrec_interface *row, enum ovsrec_interface_column_id column)
18613
0
{
18614
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_interface_columns[column]);
18615
0
}
18616
18617
/* Causes the original contents of column "admin_state" in 'row' to be
18618
 * verified as a prerequisite to completing the transaction.  That is, if
18619
 * "admin_state" in 'row' changed (or if 'row' was deleted) between the
18620
 * time that the IDL originally read its contents and the time that the
18621
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18622
 *
18623
 * The intention is that, to ensure that no transaction commits based on dirty
18624
 * reads, an application should call this function any time "admin_state" is
18625
 * read as part of a read-modify-write operation.
18626
 *
18627
 * In some cases this function reduces to a no-op, because the current value
18628
 * of "admin_state" is already known:
18629
 *
18630
 *   - If 'row' is a row created by the current transaction (returned by
18631
 *     ovsrec_interface_insert()).
18632
 *
18633
 *   - If "admin_state" has already been modified (with
18634
 *     ovsrec_interface_set_admin_state()) within the current transaction.
18635
 *
18636
 * Because of the latter property, always call this function *before*
18637
 * ovsrec_interface_set_admin_state() for a given read-modify-write.
18638
 *
18639
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18640
void
18641
ovsrec_interface_verify_admin_state(const struct ovsrec_interface *row)
18642
0
{
18643
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_admin_state);
18644
0
}
18645
18646
/* Causes the original contents of column "bfd" in 'row' to be
18647
 * verified as a prerequisite to completing the transaction.  That is, if
18648
 * "bfd" in 'row' changed (or if 'row' was deleted) between the
18649
 * time that the IDL originally read its contents and the time that the
18650
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18651
 *
18652
 * The intention is that, to ensure that no transaction commits based on dirty
18653
 * reads, an application should call this function any time "bfd" is
18654
 * read as part of a read-modify-write operation.
18655
 *
18656
 * In some cases this function reduces to a no-op, because the current value
18657
 * of "bfd" is already known:
18658
 *
18659
 *   - If 'row' is a row created by the current transaction (returned by
18660
 *     ovsrec_interface_insert()).
18661
 *
18662
 *   - If "bfd" has already been modified (with
18663
 *     ovsrec_interface_set_bfd()) within the current transaction.
18664
 *
18665
 * Because of the latter property, always call this function *before*
18666
 * ovsrec_interface_set_bfd() for a given read-modify-write.
18667
 *
18668
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18669
void
18670
ovsrec_interface_verify_bfd(const struct ovsrec_interface *row)
18671
0
{
18672
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_bfd);
18673
0
}
18674
18675
/* Causes the original contents of column "bfd_status" in 'row' to be
18676
 * verified as a prerequisite to completing the transaction.  That is, if
18677
 * "bfd_status" in 'row' changed (or if 'row' was deleted) between the
18678
 * time that the IDL originally read its contents and the time that the
18679
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18680
 *
18681
 * The intention is that, to ensure that no transaction commits based on dirty
18682
 * reads, an application should call this function any time "bfd_status" is
18683
 * read as part of a read-modify-write operation.
18684
 *
18685
 * In some cases this function reduces to a no-op, because the current value
18686
 * of "bfd_status" is already known:
18687
 *
18688
 *   - If 'row' is a row created by the current transaction (returned by
18689
 *     ovsrec_interface_insert()).
18690
 *
18691
 *   - If "bfd_status" has already been modified (with
18692
 *     ovsrec_interface_set_bfd_status()) within the current transaction.
18693
 *
18694
 * Because of the latter property, always call this function *before*
18695
 * ovsrec_interface_set_bfd_status() for a given read-modify-write.
18696
 *
18697
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18698
void
18699
ovsrec_interface_verify_bfd_status(const struct ovsrec_interface *row)
18700
0
{
18701
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_bfd_status);
18702
0
}
18703
18704
/* Causes the original contents of column "cfm_fault" in 'row' to be
18705
 * verified as a prerequisite to completing the transaction.  That is, if
18706
 * "cfm_fault" in 'row' changed (or if 'row' was deleted) between the
18707
 * time that the IDL originally read its contents and the time that the
18708
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18709
 *
18710
 * The intention is that, to ensure that no transaction commits based on dirty
18711
 * reads, an application should call this function any time "cfm_fault" is
18712
 * read as part of a read-modify-write operation.
18713
 *
18714
 * In some cases this function reduces to a no-op, because the current value
18715
 * of "cfm_fault" is already known:
18716
 *
18717
 *   - If 'row' is a row created by the current transaction (returned by
18718
 *     ovsrec_interface_insert()).
18719
 *
18720
 *   - If "cfm_fault" has already been modified (with
18721
 *     ovsrec_interface_set_cfm_fault()) within the current transaction.
18722
 *
18723
 * Because of the latter property, always call this function *before*
18724
 * ovsrec_interface_set_cfm_fault() for a given read-modify-write.
18725
 *
18726
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18727
void
18728
ovsrec_interface_verify_cfm_fault(const struct ovsrec_interface *row)
18729
0
{
18730
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_fault);
18731
0
}
18732
18733
/* Causes the original contents of column "cfm_fault_status" in 'row' to be
18734
 * verified as a prerequisite to completing the transaction.  That is, if
18735
 * "cfm_fault_status" in 'row' changed (or if 'row' was deleted) between the
18736
 * time that the IDL originally read its contents and the time that the
18737
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18738
 *
18739
 * The intention is that, to ensure that no transaction commits based on dirty
18740
 * reads, an application should call this function any time "cfm_fault_status" is
18741
 * read as part of a read-modify-write operation.
18742
 *
18743
 * In some cases this function reduces to a no-op, because the current value
18744
 * of "cfm_fault_status" is already known:
18745
 *
18746
 *   - If 'row' is a row created by the current transaction (returned by
18747
 *     ovsrec_interface_insert()).
18748
 *
18749
 *   - If "cfm_fault_status" has already been modified (with
18750
 *     ovsrec_interface_set_cfm_fault_status()) within the current transaction.
18751
 *
18752
 * Because of the latter property, always call this function *before*
18753
 * ovsrec_interface_set_cfm_fault_status() for a given read-modify-write.
18754
 *
18755
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18756
void
18757
ovsrec_interface_verify_cfm_fault_status(const struct ovsrec_interface *row)
18758
0
{
18759
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_fault_status);
18760
0
}
18761
18762
/* Causes the original contents of column "cfm_flap_count" in 'row' to be
18763
 * verified as a prerequisite to completing the transaction.  That is, if
18764
 * "cfm_flap_count" in 'row' changed (or if 'row' was deleted) between the
18765
 * time that the IDL originally read its contents and the time that the
18766
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18767
 *
18768
 * The intention is that, to ensure that no transaction commits based on dirty
18769
 * reads, an application should call this function any time "cfm_flap_count" is
18770
 * read as part of a read-modify-write operation.
18771
 *
18772
 * In some cases this function reduces to a no-op, because the current value
18773
 * of "cfm_flap_count" is already known:
18774
 *
18775
 *   - If 'row' is a row created by the current transaction (returned by
18776
 *     ovsrec_interface_insert()).
18777
 *
18778
 *   - If "cfm_flap_count" has already been modified (with
18779
 *     ovsrec_interface_set_cfm_flap_count()) within the current transaction.
18780
 *
18781
 * Because of the latter property, always call this function *before*
18782
 * ovsrec_interface_set_cfm_flap_count() for a given read-modify-write.
18783
 *
18784
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18785
void
18786
ovsrec_interface_verify_cfm_flap_count(const struct ovsrec_interface *row)
18787
0
{
18788
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_flap_count);
18789
0
}
18790
18791
/* Causes the original contents of column "cfm_health" in 'row' to be
18792
 * verified as a prerequisite to completing the transaction.  That is, if
18793
 * "cfm_health" in 'row' changed (or if 'row' was deleted) between the
18794
 * time that the IDL originally read its contents and the time that the
18795
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18796
 *
18797
 * The intention is that, to ensure that no transaction commits based on dirty
18798
 * reads, an application should call this function any time "cfm_health" is
18799
 * read as part of a read-modify-write operation.
18800
 *
18801
 * In some cases this function reduces to a no-op, because the current value
18802
 * of "cfm_health" is already known:
18803
 *
18804
 *   - If 'row' is a row created by the current transaction (returned by
18805
 *     ovsrec_interface_insert()).
18806
 *
18807
 *   - If "cfm_health" has already been modified (with
18808
 *     ovsrec_interface_set_cfm_health()) within the current transaction.
18809
 *
18810
 * Because of the latter property, always call this function *before*
18811
 * ovsrec_interface_set_cfm_health() for a given read-modify-write.
18812
 *
18813
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18814
void
18815
ovsrec_interface_verify_cfm_health(const struct ovsrec_interface *row)
18816
0
{
18817
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_health);
18818
0
}
18819
18820
/* Causes the original contents of column "cfm_mpid" in 'row' to be
18821
 * verified as a prerequisite to completing the transaction.  That is, if
18822
 * "cfm_mpid" in 'row' changed (or if 'row' was deleted) between the
18823
 * time that the IDL originally read its contents and the time that the
18824
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18825
 *
18826
 * The intention is that, to ensure that no transaction commits based on dirty
18827
 * reads, an application should call this function any time "cfm_mpid" is
18828
 * read as part of a read-modify-write operation.
18829
 *
18830
 * In some cases this function reduces to a no-op, because the current value
18831
 * of "cfm_mpid" is already known:
18832
 *
18833
 *   - If 'row' is a row created by the current transaction (returned by
18834
 *     ovsrec_interface_insert()).
18835
 *
18836
 *   - If "cfm_mpid" has already been modified (with
18837
 *     ovsrec_interface_set_cfm_mpid()) within the current transaction.
18838
 *
18839
 * Because of the latter property, always call this function *before*
18840
 * ovsrec_interface_set_cfm_mpid() for a given read-modify-write.
18841
 *
18842
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18843
void
18844
ovsrec_interface_verify_cfm_mpid(const struct ovsrec_interface *row)
18845
0
{
18846
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_mpid);
18847
0
}
18848
18849
/* Causes the original contents of column "cfm_remote_mpids" in 'row' to be
18850
 * verified as a prerequisite to completing the transaction.  That is, if
18851
 * "cfm_remote_mpids" in 'row' changed (or if 'row' was deleted) between the
18852
 * time that the IDL originally read its contents and the time that the
18853
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18854
 *
18855
 * The intention is that, to ensure that no transaction commits based on dirty
18856
 * reads, an application should call this function any time "cfm_remote_mpids" is
18857
 * read as part of a read-modify-write operation.
18858
 *
18859
 * In some cases this function reduces to a no-op, because the current value
18860
 * of "cfm_remote_mpids" is already known:
18861
 *
18862
 *   - If 'row' is a row created by the current transaction (returned by
18863
 *     ovsrec_interface_insert()).
18864
 *
18865
 *   - If "cfm_remote_mpids" has already been modified (with
18866
 *     ovsrec_interface_set_cfm_remote_mpids()) within the current transaction.
18867
 *
18868
 * Because of the latter property, always call this function *before*
18869
 * ovsrec_interface_set_cfm_remote_mpids() for a given read-modify-write.
18870
 *
18871
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18872
void
18873
ovsrec_interface_verify_cfm_remote_mpids(const struct ovsrec_interface *row)
18874
0
{
18875
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_remote_mpids);
18876
0
}
18877
18878
/* Causes the original contents of column "cfm_remote_opstate" in 'row' to be
18879
 * verified as a prerequisite to completing the transaction.  That is, if
18880
 * "cfm_remote_opstate" in 'row' changed (or if 'row' was deleted) between the
18881
 * time that the IDL originally read its contents and the time that the
18882
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18883
 *
18884
 * The intention is that, to ensure that no transaction commits based on dirty
18885
 * reads, an application should call this function any time "cfm_remote_opstate" is
18886
 * read as part of a read-modify-write operation.
18887
 *
18888
 * In some cases this function reduces to a no-op, because the current value
18889
 * of "cfm_remote_opstate" is already known:
18890
 *
18891
 *   - If 'row' is a row created by the current transaction (returned by
18892
 *     ovsrec_interface_insert()).
18893
 *
18894
 *   - If "cfm_remote_opstate" has already been modified (with
18895
 *     ovsrec_interface_set_cfm_remote_opstate()) within the current transaction.
18896
 *
18897
 * Because of the latter property, always call this function *before*
18898
 * ovsrec_interface_set_cfm_remote_opstate() for a given read-modify-write.
18899
 *
18900
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18901
void
18902
ovsrec_interface_verify_cfm_remote_opstate(const struct ovsrec_interface *row)
18903
0
{
18904
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_cfm_remote_opstate);
18905
0
}
18906
18907
/* Causes the original contents of column "duplex" in 'row' to be
18908
 * verified as a prerequisite to completing the transaction.  That is, if
18909
 * "duplex" in 'row' changed (or if 'row' was deleted) between the
18910
 * time that the IDL originally read its contents and the time that the
18911
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18912
 *
18913
 * The intention is that, to ensure that no transaction commits based on dirty
18914
 * reads, an application should call this function any time "duplex" is
18915
 * read as part of a read-modify-write operation.
18916
 *
18917
 * In some cases this function reduces to a no-op, because the current value
18918
 * of "duplex" is already known:
18919
 *
18920
 *   - If 'row' is a row created by the current transaction (returned by
18921
 *     ovsrec_interface_insert()).
18922
 *
18923
 *   - If "duplex" has already been modified (with
18924
 *     ovsrec_interface_set_duplex()) within the current transaction.
18925
 *
18926
 * Because of the latter property, always call this function *before*
18927
 * ovsrec_interface_set_duplex() for a given read-modify-write.
18928
 *
18929
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18930
void
18931
ovsrec_interface_verify_duplex(const struct ovsrec_interface *row)
18932
0
{
18933
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_duplex);
18934
0
}
18935
18936
/* Causes the original contents of column "error" in 'row' to be
18937
 * verified as a prerequisite to completing the transaction.  That is, if
18938
 * "error" in 'row' changed (or if 'row' was deleted) between the
18939
 * time that the IDL originally read its contents and the time that the
18940
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18941
 *
18942
 * The intention is that, to ensure that no transaction commits based on dirty
18943
 * reads, an application should call this function any time "error" is
18944
 * read as part of a read-modify-write operation.
18945
 *
18946
 * In some cases this function reduces to a no-op, because the current value
18947
 * of "error" is already known:
18948
 *
18949
 *   - If 'row' is a row created by the current transaction (returned by
18950
 *     ovsrec_interface_insert()).
18951
 *
18952
 *   - If "error" has already been modified (with
18953
 *     ovsrec_interface_set_error()) within the current transaction.
18954
 *
18955
 * Because of the latter property, always call this function *before*
18956
 * ovsrec_interface_set_error() for a given read-modify-write.
18957
 *
18958
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18959
void
18960
ovsrec_interface_verify_error(const struct ovsrec_interface *row)
18961
0
{
18962
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_error);
18963
0
}
18964
18965
/* Causes the original contents of column "external_ids" in 'row' to be
18966
 * verified as a prerequisite to completing the transaction.  That is, if
18967
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
18968
 * time that the IDL originally read its contents and the time that the
18969
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18970
 *
18971
 * The intention is that, to ensure that no transaction commits based on dirty
18972
 * reads, an application should call this function any time "external_ids" is
18973
 * read as part of a read-modify-write operation.
18974
 *
18975
 * In some cases this function reduces to a no-op, because the current value
18976
 * of "external_ids" is already known:
18977
 *
18978
 *   - If 'row' is a row created by the current transaction (returned by
18979
 *     ovsrec_interface_insert()).
18980
 *
18981
 *   - If "external_ids" has already been modified (with
18982
 *     ovsrec_interface_set_external_ids()) within the current transaction.
18983
 *
18984
 * Because of the latter property, always call this function *before*
18985
 * ovsrec_interface_set_external_ids() for a given read-modify-write.
18986
 *
18987
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
18988
void
18989
ovsrec_interface_verify_external_ids(const struct ovsrec_interface *row)
18990
0
{
18991
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_external_ids);
18992
0
}
18993
18994
/* Causes the original contents of column "ifindex" in 'row' to be
18995
 * verified as a prerequisite to completing the transaction.  That is, if
18996
 * "ifindex" in 'row' changed (or if 'row' was deleted) between the
18997
 * time that the IDL originally read its contents and the time that the
18998
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
18999
 *
19000
 * The intention is that, to ensure that no transaction commits based on dirty
19001
 * reads, an application should call this function any time "ifindex" is
19002
 * read as part of a read-modify-write operation.
19003
 *
19004
 * In some cases this function reduces to a no-op, because the current value
19005
 * of "ifindex" is already known:
19006
 *
19007
 *   - If 'row' is a row created by the current transaction (returned by
19008
 *     ovsrec_interface_insert()).
19009
 *
19010
 *   - If "ifindex" has already been modified (with
19011
 *     ovsrec_interface_set_ifindex()) within the current transaction.
19012
 *
19013
 * Because of the latter property, always call this function *before*
19014
 * ovsrec_interface_set_ifindex() for a given read-modify-write.
19015
 *
19016
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19017
void
19018
ovsrec_interface_verify_ifindex(const struct ovsrec_interface *row)
19019
0
{
19020
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ifindex);
19021
0
}
19022
19023
/* Causes the original contents of column "ingress_policing_burst" in 'row' to be
19024
 * verified as a prerequisite to completing the transaction.  That is, if
19025
 * "ingress_policing_burst" in 'row' changed (or if 'row' was deleted) between the
19026
 * time that the IDL originally read its contents and the time that the
19027
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19028
 *
19029
 * The intention is that, to ensure that no transaction commits based on dirty
19030
 * reads, an application should call this function any time "ingress_policing_burst" is
19031
 * read as part of a read-modify-write operation.
19032
 *
19033
 * In some cases this function reduces to a no-op, because the current value
19034
 * of "ingress_policing_burst" is already known:
19035
 *
19036
 *   - If 'row' is a row created by the current transaction (returned by
19037
 *     ovsrec_interface_insert()).
19038
 *
19039
 *   - If "ingress_policing_burst" has already been modified (with
19040
 *     ovsrec_interface_set_ingress_policing_burst()) within the current transaction.
19041
 *
19042
 * Because of the latter property, always call this function *before*
19043
 * ovsrec_interface_set_ingress_policing_burst() for a given read-modify-write.
19044
 *
19045
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19046
void
19047
ovsrec_interface_verify_ingress_policing_burst(const struct ovsrec_interface *row)
19048
0
{
19049
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ingress_policing_burst);
19050
0
}
19051
19052
/* Causes the original contents of column "ingress_policing_kpkts_burst" in 'row' to be
19053
 * verified as a prerequisite to completing the transaction.  That is, if
19054
 * "ingress_policing_kpkts_burst" in 'row' changed (or if 'row' was deleted) between the
19055
 * time that the IDL originally read its contents and the time that the
19056
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19057
 *
19058
 * The intention is that, to ensure that no transaction commits based on dirty
19059
 * reads, an application should call this function any time "ingress_policing_kpkts_burst" is
19060
 * read as part of a read-modify-write operation.
19061
 *
19062
 * In some cases this function reduces to a no-op, because the current value
19063
 * of "ingress_policing_kpkts_burst" is already known:
19064
 *
19065
 *   - If 'row' is a row created by the current transaction (returned by
19066
 *     ovsrec_interface_insert()).
19067
 *
19068
 *   - If "ingress_policing_kpkts_burst" has already been modified (with
19069
 *     ovsrec_interface_set_ingress_policing_kpkts_burst()) within the current transaction.
19070
 *
19071
 * Because of the latter property, always call this function *before*
19072
 * ovsrec_interface_set_ingress_policing_kpkts_burst() for a given read-modify-write.
19073
 *
19074
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19075
void
19076
ovsrec_interface_verify_ingress_policing_kpkts_burst(const struct ovsrec_interface *row)
19077
0
{
19078
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_burst);
19079
0
}
19080
19081
/* Causes the original contents of column "ingress_policing_kpkts_rate" in 'row' to be
19082
 * verified as a prerequisite to completing the transaction.  That is, if
19083
 * "ingress_policing_kpkts_rate" in 'row' changed (or if 'row' was deleted) between the
19084
 * time that the IDL originally read its contents and the time that the
19085
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19086
 *
19087
 * The intention is that, to ensure that no transaction commits based on dirty
19088
 * reads, an application should call this function any time "ingress_policing_kpkts_rate" is
19089
 * read as part of a read-modify-write operation.
19090
 *
19091
 * In some cases this function reduces to a no-op, because the current value
19092
 * of "ingress_policing_kpkts_rate" is already known:
19093
 *
19094
 *   - If 'row' is a row created by the current transaction (returned by
19095
 *     ovsrec_interface_insert()).
19096
 *
19097
 *   - If "ingress_policing_kpkts_rate" has already been modified (with
19098
 *     ovsrec_interface_set_ingress_policing_kpkts_rate()) within the current transaction.
19099
 *
19100
 * Because of the latter property, always call this function *before*
19101
 * ovsrec_interface_set_ingress_policing_kpkts_rate() for a given read-modify-write.
19102
 *
19103
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19104
void
19105
ovsrec_interface_verify_ingress_policing_kpkts_rate(const struct ovsrec_interface *row)
19106
0
{
19107
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_rate);
19108
0
}
19109
19110
/* Causes the original contents of column "ingress_policing_rate" in 'row' to be
19111
 * verified as a prerequisite to completing the transaction.  That is, if
19112
 * "ingress_policing_rate" in 'row' changed (or if 'row' was deleted) between the
19113
 * time that the IDL originally read its contents and the time that the
19114
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19115
 *
19116
 * The intention is that, to ensure that no transaction commits based on dirty
19117
 * reads, an application should call this function any time "ingress_policing_rate" is
19118
 * read as part of a read-modify-write operation.
19119
 *
19120
 * In some cases this function reduces to a no-op, because the current value
19121
 * of "ingress_policing_rate" is already known:
19122
 *
19123
 *   - If 'row' is a row created by the current transaction (returned by
19124
 *     ovsrec_interface_insert()).
19125
 *
19126
 *   - If "ingress_policing_rate" has already been modified (with
19127
 *     ovsrec_interface_set_ingress_policing_rate()) within the current transaction.
19128
 *
19129
 * Because of the latter property, always call this function *before*
19130
 * ovsrec_interface_set_ingress_policing_rate() for a given read-modify-write.
19131
 *
19132
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19133
void
19134
ovsrec_interface_verify_ingress_policing_rate(const struct ovsrec_interface *row)
19135
0
{
19136
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ingress_policing_rate);
19137
0
}
19138
19139
/* Causes the original contents of column "lacp_current" in 'row' to be
19140
 * verified as a prerequisite to completing the transaction.  That is, if
19141
 * "lacp_current" in 'row' changed (or if 'row' was deleted) between the
19142
 * time that the IDL originally read its contents and the time that the
19143
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19144
 *
19145
 * The intention is that, to ensure that no transaction commits based on dirty
19146
 * reads, an application should call this function any time "lacp_current" is
19147
 * read as part of a read-modify-write operation.
19148
 *
19149
 * In some cases this function reduces to a no-op, because the current value
19150
 * of "lacp_current" is already known:
19151
 *
19152
 *   - If 'row' is a row created by the current transaction (returned by
19153
 *     ovsrec_interface_insert()).
19154
 *
19155
 *   - If "lacp_current" has already been modified (with
19156
 *     ovsrec_interface_set_lacp_current()) within the current transaction.
19157
 *
19158
 * Because of the latter property, always call this function *before*
19159
 * ovsrec_interface_set_lacp_current() for a given read-modify-write.
19160
 *
19161
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19162
void
19163
ovsrec_interface_verify_lacp_current(const struct ovsrec_interface *row)
19164
0
{
19165
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_lacp_current);
19166
0
}
19167
19168
/* Causes the original contents of column "link_resets" in 'row' to be
19169
 * verified as a prerequisite to completing the transaction.  That is, if
19170
 * "link_resets" in 'row' changed (or if 'row' was deleted) between the
19171
 * time that the IDL originally read its contents and the time that the
19172
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19173
 *
19174
 * The intention is that, to ensure that no transaction commits based on dirty
19175
 * reads, an application should call this function any time "link_resets" is
19176
 * read as part of a read-modify-write operation.
19177
 *
19178
 * In some cases this function reduces to a no-op, because the current value
19179
 * of "link_resets" is already known:
19180
 *
19181
 *   - If 'row' is a row created by the current transaction (returned by
19182
 *     ovsrec_interface_insert()).
19183
 *
19184
 *   - If "link_resets" has already been modified (with
19185
 *     ovsrec_interface_set_link_resets()) within the current transaction.
19186
 *
19187
 * Because of the latter property, always call this function *before*
19188
 * ovsrec_interface_set_link_resets() for a given read-modify-write.
19189
 *
19190
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19191
void
19192
ovsrec_interface_verify_link_resets(const struct ovsrec_interface *row)
19193
0
{
19194
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_link_resets);
19195
0
}
19196
19197
/* Causes the original contents of column "link_speed" in 'row' to be
19198
 * verified as a prerequisite to completing the transaction.  That is, if
19199
 * "link_speed" in 'row' changed (or if 'row' was deleted) between the
19200
 * time that the IDL originally read its contents and the time that the
19201
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19202
 *
19203
 * The intention is that, to ensure that no transaction commits based on dirty
19204
 * reads, an application should call this function any time "link_speed" is
19205
 * read as part of a read-modify-write operation.
19206
 *
19207
 * In some cases this function reduces to a no-op, because the current value
19208
 * of "link_speed" is already known:
19209
 *
19210
 *   - If 'row' is a row created by the current transaction (returned by
19211
 *     ovsrec_interface_insert()).
19212
 *
19213
 *   - If "link_speed" has already been modified (with
19214
 *     ovsrec_interface_set_link_speed()) within the current transaction.
19215
 *
19216
 * Because of the latter property, always call this function *before*
19217
 * ovsrec_interface_set_link_speed() for a given read-modify-write.
19218
 *
19219
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19220
void
19221
ovsrec_interface_verify_link_speed(const struct ovsrec_interface *row)
19222
0
{
19223
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_link_speed);
19224
0
}
19225
19226
/* Causes the original contents of column "link_state" in 'row' to be
19227
 * verified as a prerequisite to completing the transaction.  That is, if
19228
 * "link_state" in 'row' changed (or if 'row' was deleted) between the
19229
 * time that the IDL originally read its contents and the time that the
19230
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19231
 *
19232
 * The intention is that, to ensure that no transaction commits based on dirty
19233
 * reads, an application should call this function any time "link_state" is
19234
 * read as part of a read-modify-write operation.
19235
 *
19236
 * In some cases this function reduces to a no-op, because the current value
19237
 * of "link_state" is already known:
19238
 *
19239
 *   - If 'row' is a row created by the current transaction (returned by
19240
 *     ovsrec_interface_insert()).
19241
 *
19242
 *   - If "link_state" has already been modified (with
19243
 *     ovsrec_interface_set_link_state()) within the current transaction.
19244
 *
19245
 * Because of the latter property, always call this function *before*
19246
 * ovsrec_interface_set_link_state() for a given read-modify-write.
19247
 *
19248
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19249
void
19250
ovsrec_interface_verify_link_state(const struct ovsrec_interface *row)
19251
0
{
19252
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_link_state);
19253
0
}
19254
19255
/* Causes the original contents of column "lldp" in 'row' to be
19256
 * verified as a prerequisite to completing the transaction.  That is, if
19257
 * "lldp" in 'row' changed (or if 'row' was deleted) between the
19258
 * time that the IDL originally read its contents and the time that the
19259
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19260
 *
19261
 * The intention is that, to ensure that no transaction commits based on dirty
19262
 * reads, an application should call this function any time "lldp" is
19263
 * read as part of a read-modify-write operation.
19264
 *
19265
 * In some cases this function reduces to a no-op, because the current value
19266
 * of "lldp" is already known:
19267
 *
19268
 *   - If 'row' is a row created by the current transaction (returned by
19269
 *     ovsrec_interface_insert()).
19270
 *
19271
 *   - If "lldp" has already been modified (with
19272
 *     ovsrec_interface_set_lldp()) within the current transaction.
19273
 *
19274
 * Because of the latter property, always call this function *before*
19275
 * ovsrec_interface_set_lldp() for a given read-modify-write.
19276
 *
19277
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19278
void
19279
ovsrec_interface_verify_lldp(const struct ovsrec_interface *row)
19280
0
{
19281
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_lldp);
19282
0
}
19283
19284
/* Causes the original contents of column "mac" in 'row' to be
19285
 * verified as a prerequisite to completing the transaction.  That is, if
19286
 * "mac" in 'row' changed (or if 'row' was deleted) between the
19287
 * time that the IDL originally read its contents and the time that the
19288
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19289
 *
19290
 * The intention is that, to ensure that no transaction commits based on dirty
19291
 * reads, an application should call this function any time "mac" is
19292
 * read as part of a read-modify-write operation.
19293
 *
19294
 * In some cases this function reduces to a no-op, because the current value
19295
 * of "mac" is already known:
19296
 *
19297
 *   - If 'row' is a row created by the current transaction (returned by
19298
 *     ovsrec_interface_insert()).
19299
 *
19300
 *   - If "mac" has already been modified (with
19301
 *     ovsrec_interface_set_mac()) within the current transaction.
19302
 *
19303
 * Because of the latter property, always call this function *before*
19304
 * ovsrec_interface_set_mac() for a given read-modify-write.
19305
 *
19306
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19307
void
19308
ovsrec_interface_verify_mac(const struct ovsrec_interface *row)
19309
0
{
19310
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_mac);
19311
0
}
19312
19313
/* Causes the original contents of column "mac_in_use" in 'row' to be
19314
 * verified as a prerequisite to completing the transaction.  That is, if
19315
 * "mac_in_use" in 'row' changed (or if 'row' was deleted) between the
19316
 * time that the IDL originally read its contents and the time that the
19317
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19318
 *
19319
 * The intention is that, to ensure that no transaction commits based on dirty
19320
 * reads, an application should call this function any time "mac_in_use" is
19321
 * read as part of a read-modify-write operation.
19322
 *
19323
 * In some cases this function reduces to a no-op, because the current value
19324
 * of "mac_in_use" is already known:
19325
 *
19326
 *   - If 'row' is a row created by the current transaction (returned by
19327
 *     ovsrec_interface_insert()).
19328
 *
19329
 *   - If "mac_in_use" has already been modified (with
19330
 *     ovsrec_interface_set_mac_in_use()) within the current transaction.
19331
 *
19332
 * Because of the latter property, always call this function *before*
19333
 * ovsrec_interface_set_mac_in_use() for a given read-modify-write.
19334
 *
19335
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19336
void
19337
ovsrec_interface_verify_mac_in_use(const struct ovsrec_interface *row)
19338
0
{
19339
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_mac_in_use);
19340
0
}
19341
19342
/* Causes the original contents of column "mtu" in 'row' to be
19343
 * verified as a prerequisite to completing the transaction.  That is, if
19344
 * "mtu" in 'row' changed (or if 'row' was deleted) between the
19345
 * time that the IDL originally read its contents and the time that the
19346
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19347
 *
19348
 * The intention is that, to ensure that no transaction commits based on dirty
19349
 * reads, an application should call this function any time "mtu" is
19350
 * read as part of a read-modify-write operation.
19351
 *
19352
 * In some cases this function reduces to a no-op, because the current value
19353
 * of "mtu" is already known:
19354
 *
19355
 *   - If 'row' is a row created by the current transaction (returned by
19356
 *     ovsrec_interface_insert()).
19357
 *
19358
 *   - If "mtu" has already been modified (with
19359
 *     ovsrec_interface_set_mtu()) within the current transaction.
19360
 *
19361
 * Because of the latter property, always call this function *before*
19362
 * ovsrec_interface_set_mtu() for a given read-modify-write.
19363
 *
19364
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19365
void
19366
ovsrec_interface_verify_mtu(const struct ovsrec_interface *row)
19367
0
{
19368
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_mtu);
19369
0
}
19370
19371
/* Causes the original contents of column "mtu_request" in 'row' to be
19372
 * verified as a prerequisite to completing the transaction.  That is, if
19373
 * "mtu_request" in 'row' changed (or if 'row' was deleted) between the
19374
 * time that the IDL originally read its contents and the time that the
19375
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19376
 *
19377
 * The intention is that, to ensure that no transaction commits based on dirty
19378
 * reads, an application should call this function any time "mtu_request" is
19379
 * read as part of a read-modify-write operation.
19380
 *
19381
 * In some cases this function reduces to a no-op, because the current value
19382
 * of "mtu_request" is already known:
19383
 *
19384
 *   - If 'row' is a row created by the current transaction (returned by
19385
 *     ovsrec_interface_insert()).
19386
 *
19387
 *   - If "mtu_request" has already been modified (with
19388
 *     ovsrec_interface_set_mtu_request()) within the current transaction.
19389
 *
19390
 * Because of the latter property, always call this function *before*
19391
 * ovsrec_interface_set_mtu_request() for a given read-modify-write.
19392
 *
19393
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19394
void
19395
ovsrec_interface_verify_mtu_request(const struct ovsrec_interface *row)
19396
0
{
19397
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_mtu_request);
19398
0
}
19399
19400
/* Causes the original contents of column "name" in 'row' to be
19401
 * verified as a prerequisite to completing the transaction.  That is, if
19402
 * "name" in 'row' changed (or if 'row' was deleted) between the
19403
 * time that the IDL originally read its contents and the time that the
19404
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19405
 *
19406
 * The intention is that, to ensure that no transaction commits based on dirty
19407
 * reads, an application should call this function any time "name" is
19408
 * read as part of a read-modify-write operation.
19409
 *
19410
 * In some cases this function reduces to a no-op, because the current value
19411
 * of "name" is already known:
19412
 *
19413
 *   - If 'row' is a row created by the current transaction (returned by
19414
 *     ovsrec_interface_insert()).
19415
 *
19416
 *   - If "name" has already been modified (with
19417
 *     ovsrec_interface_set_name()) within the current transaction.
19418
 *
19419
 * Because of the latter property, always call this function *before*
19420
 * ovsrec_interface_set_name() for a given read-modify-write.
19421
 *
19422
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19423
void
19424
ovsrec_interface_verify_name(const struct ovsrec_interface *row)
19425
0
{
19426
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_name);
19427
0
}
19428
19429
/* Causes the original contents of column "ofport" in 'row' to be
19430
 * verified as a prerequisite to completing the transaction.  That is, if
19431
 * "ofport" in 'row' changed (or if 'row' was deleted) between the
19432
 * time that the IDL originally read its contents and the time that the
19433
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19434
 *
19435
 * The intention is that, to ensure that no transaction commits based on dirty
19436
 * reads, an application should call this function any time "ofport" is
19437
 * read as part of a read-modify-write operation.
19438
 *
19439
 * In some cases this function reduces to a no-op, because the current value
19440
 * of "ofport" is already known:
19441
 *
19442
 *   - If 'row' is a row created by the current transaction (returned by
19443
 *     ovsrec_interface_insert()).
19444
 *
19445
 *   - If "ofport" has already been modified (with
19446
 *     ovsrec_interface_set_ofport()) within the current transaction.
19447
 *
19448
 * Because of the latter property, always call this function *before*
19449
 * ovsrec_interface_set_ofport() for a given read-modify-write.
19450
 *
19451
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19452
void
19453
ovsrec_interface_verify_ofport(const struct ovsrec_interface *row)
19454
0
{
19455
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ofport);
19456
0
}
19457
19458
/* Causes the original contents of column "ofport_request" in 'row' to be
19459
 * verified as a prerequisite to completing the transaction.  That is, if
19460
 * "ofport_request" in 'row' changed (or if 'row' was deleted) between the
19461
 * time that the IDL originally read its contents and the time that the
19462
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19463
 *
19464
 * The intention is that, to ensure that no transaction commits based on dirty
19465
 * reads, an application should call this function any time "ofport_request" is
19466
 * read as part of a read-modify-write operation.
19467
 *
19468
 * In some cases this function reduces to a no-op, because the current value
19469
 * of "ofport_request" is already known:
19470
 *
19471
 *   - If 'row' is a row created by the current transaction (returned by
19472
 *     ovsrec_interface_insert()).
19473
 *
19474
 *   - If "ofport_request" has already been modified (with
19475
 *     ovsrec_interface_set_ofport_request()) within the current transaction.
19476
 *
19477
 * Because of the latter property, always call this function *before*
19478
 * ovsrec_interface_set_ofport_request() for a given read-modify-write.
19479
 *
19480
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19481
void
19482
ovsrec_interface_verify_ofport_request(const struct ovsrec_interface *row)
19483
0
{
19484
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_ofport_request);
19485
0
}
19486
19487
/* Causes the original contents of column "options" in 'row' to be
19488
 * verified as a prerequisite to completing the transaction.  That is, if
19489
 * "options" in 'row' changed (or if 'row' was deleted) between the
19490
 * time that the IDL originally read its contents and the time that the
19491
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19492
 *
19493
 * The intention is that, to ensure that no transaction commits based on dirty
19494
 * reads, an application should call this function any time "options" is
19495
 * read as part of a read-modify-write operation.
19496
 *
19497
 * In some cases this function reduces to a no-op, because the current value
19498
 * of "options" is already known:
19499
 *
19500
 *   - If 'row' is a row created by the current transaction (returned by
19501
 *     ovsrec_interface_insert()).
19502
 *
19503
 *   - If "options" has already been modified (with
19504
 *     ovsrec_interface_set_options()) within the current transaction.
19505
 *
19506
 * Because of the latter property, always call this function *before*
19507
 * ovsrec_interface_set_options() for a given read-modify-write.
19508
 *
19509
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19510
void
19511
ovsrec_interface_verify_options(const struct ovsrec_interface *row)
19512
0
{
19513
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_options);
19514
0
}
19515
19516
/* Causes the original contents of column "other_config" in 'row' to be
19517
 * verified as a prerequisite to completing the transaction.  That is, if
19518
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
19519
 * time that the IDL originally read its contents and the time that the
19520
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19521
 *
19522
 * The intention is that, to ensure that no transaction commits based on dirty
19523
 * reads, an application should call this function any time "other_config" is
19524
 * read as part of a read-modify-write operation.
19525
 *
19526
 * In some cases this function reduces to a no-op, because the current value
19527
 * of "other_config" is already known:
19528
 *
19529
 *   - If 'row' is a row created by the current transaction (returned by
19530
 *     ovsrec_interface_insert()).
19531
 *
19532
 *   - If "other_config" has already been modified (with
19533
 *     ovsrec_interface_set_other_config()) within the current transaction.
19534
 *
19535
 * Because of the latter property, always call this function *before*
19536
 * ovsrec_interface_set_other_config() for a given read-modify-write.
19537
 *
19538
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19539
void
19540
ovsrec_interface_verify_other_config(const struct ovsrec_interface *row)
19541
0
{
19542
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_other_config);
19543
0
}
19544
19545
/* Causes the original contents of column "statistics" in 'row' to be
19546
 * verified as a prerequisite to completing the transaction.  That is, if
19547
 * "statistics" in 'row' changed (or if 'row' was deleted) between the
19548
 * time that the IDL originally read its contents and the time that the
19549
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19550
 *
19551
 * The intention is that, to ensure that no transaction commits based on dirty
19552
 * reads, an application should call this function any time "statistics" is
19553
 * read as part of a read-modify-write operation.
19554
 *
19555
 * In some cases this function reduces to a no-op, because the current value
19556
 * of "statistics" is already known:
19557
 *
19558
 *   - If 'row' is a row created by the current transaction (returned by
19559
 *     ovsrec_interface_insert()).
19560
 *
19561
 *   - If "statistics" has already been modified (with
19562
 *     ovsrec_interface_set_statistics()) within the current transaction.
19563
 *
19564
 * Because of the latter property, always call this function *before*
19565
 * ovsrec_interface_set_statistics() for a given read-modify-write.
19566
 *
19567
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19568
void
19569
ovsrec_interface_verify_statistics(const struct ovsrec_interface *row)
19570
0
{
19571
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_statistics);
19572
0
}
19573
19574
/* Causes the original contents of column "status" in 'row' to be
19575
 * verified as a prerequisite to completing the transaction.  That is, if
19576
 * "status" in 'row' changed (or if 'row' was deleted) between the
19577
 * time that the IDL originally read its contents and the time that the
19578
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19579
 *
19580
 * The intention is that, to ensure that no transaction commits based on dirty
19581
 * reads, an application should call this function any time "status" is
19582
 * read as part of a read-modify-write operation.
19583
 *
19584
 * In some cases this function reduces to a no-op, because the current value
19585
 * of "status" is already known:
19586
 *
19587
 *   - If 'row' is a row created by the current transaction (returned by
19588
 *     ovsrec_interface_insert()).
19589
 *
19590
 *   - If "status" has already been modified (with
19591
 *     ovsrec_interface_set_status()) within the current transaction.
19592
 *
19593
 * Because of the latter property, always call this function *before*
19594
 * ovsrec_interface_set_status() for a given read-modify-write.
19595
 *
19596
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19597
void
19598
ovsrec_interface_verify_status(const struct ovsrec_interface *row)
19599
0
{
19600
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_status);
19601
0
}
19602
19603
/* Causes the original contents of column "type" in 'row' to be
19604
 * verified as a prerequisite to completing the transaction.  That is, if
19605
 * "type" in 'row' changed (or if 'row' was deleted) between the
19606
 * time that the IDL originally read its contents and the time that the
19607
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
19608
 *
19609
 * The intention is that, to ensure that no transaction commits based on dirty
19610
 * reads, an application should call this function any time "type" is
19611
 * read as part of a read-modify-write operation.
19612
 *
19613
 * In some cases this function reduces to a no-op, because the current value
19614
 * of "type" is already known:
19615
 *
19616
 *   - If 'row' is a row created by the current transaction (returned by
19617
 *     ovsrec_interface_insert()).
19618
 *
19619
 *   - If "type" has already been modified (with
19620
 *     ovsrec_interface_set_type()) within the current transaction.
19621
 *
19622
 * Because of the latter property, always call this function *before*
19623
 * ovsrec_interface_set_type() for a given read-modify-write.
19624
 *
19625
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
19626
void
19627
ovsrec_interface_verify_type(const struct ovsrec_interface *row)
19628
0
{
19629
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_col_type);
19630
0
}
19631
19632
/* Returns the "admin_state" column's value from the "Interface" table in 'row'
19633
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19634
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19635
 * for a given key than implementing the same operation on the "cooked"
19636
 * form in 'row'.
19637
 *
19638
 * 'key_type' must be OVSDB_TYPE_STRING.
19639
 * (This helps to avoid silent bugs if someone changes admin_state's
19640
 * type without updating the caller.)
19641
 *
19642
 * The caller must not modify or free the returned value.
19643
 *
19644
 * Various kinds of changes can invalidate the returned value: modifying
19645
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19646
 * If the returned value is needed for a long time, it is best to make a copy
19647
 * of it with ovsdb_datum_clone().
19648
 *
19649
 * This function is rarely useful, since it is easier to access the value
19650
 * directly through the "admin_state" member in ovsrec_interface. */
19651
const struct ovsdb_datum *
19652
ovsrec_interface_get_admin_state(const struct ovsrec_interface *row,
19653
  enum ovsdb_atomic_type key_type OVS_UNUSED)
19654
0
{
19655
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
19656
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_admin_state);
19657
0
}
19658
19659
/* Returns the "bfd" column's value from the "Interface" table in 'row'
19660
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19661
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19662
 * for a given key than implementing the same operation on the "cooked"
19663
 * form in 'row'.
19664
 *
19665
 * 'key_type' must be OVSDB_TYPE_STRING.
19666
 * 'value_type' must be OVSDB_TYPE_STRING.
19667
 * (This helps to avoid silent bugs if someone changes bfd's
19668
 * type without updating the caller.)
19669
 *
19670
 * The caller must not modify or free the returned value.
19671
 *
19672
 * Various kinds of changes can invalidate the returned value: modifying
19673
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19674
 * If the returned value is needed for a long time, it is best to make a copy
19675
 * of it with ovsdb_datum_clone().
19676
 *
19677
 * This function is rarely useful, since it is easier to access the value
19678
 * directly through the "bfd" member in ovsrec_interface. */
19679
const struct ovsdb_datum *
19680
ovsrec_interface_get_bfd(const struct ovsrec_interface *row,
19681
  enum ovsdb_atomic_type key_type OVS_UNUSED,
19682
  enum ovsdb_atomic_type value_type OVS_UNUSED)
19683
0
{
19684
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
19685
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
19686
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_bfd);
19687
0
}
19688
19689
/* Returns the "bfd_status" column's value from the "Interface" table in 'row'
19690
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19691
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19692
 * for a given key than implementing the same operation on the "cooked"
19693
 * form in 'row'.
19694
 *
19695
 * 'key_type' must be OVSDB_TYPE_STRING.
19696
 * 'value_type' must be OVSDB_TYPE_STRING.
19697
 * (This helps to avoid silent bugs if someone changes bfd_status's
19698
 * type without updating the caller.)
19699
 *
19700
 * The caller must not modify or free the returned value.
19701
 *
19702
 * Various kinds of changes can invalidate the returned value: modifying
19703
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19704
 * If the returned value is needed for a long time, it is best to make a copy
19705
 * of it with ovsdb_datum_clone().
19706
 *
19707
 * This function is rarely useful, since it is easier to access the value
19708
 * directly through the "bfd_status" member in ovsrec_interface. */
19709
const struct ovsdb_datum *
19710
ovsrec_interface_get_bfd_status(const struct ovsrec_interface *row,
19711
  enum ovsdb_atomic_type key_type OVS_UNUSED,
19712
  enum ovsdb_atomic_type value_type OVS_UNUSED)
19713
0
{
19714
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
19715
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
19716
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_bfd_status);
19717
0
}
19718
19719
/* Returns the "cfm_fault" column's value from the "Interface" table in 'row'
19720
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19721
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19722
 * for a given key than implementing the same operation on the "cooked"
19723
 * form in 'row'.
19724
 *
19725
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
19726
 * (This helps to avoid silent bugs if someone changes cfm_fault's
19727
 * type without updating the caller.)
19728
 *
19729
 * The caller must not modify or free the returned value.
19730
 *
19731
 * Various kinds of changes can invalidate the returned value: modifying
19732
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19733
 * If the returned value is needed for a long time, it is best to make a copy
19734
 * of it with ovsdb_datum_clone().
19735
 *
19736
 * This function is rarely useful, since it is easier to access the value
19737
 * directly through the "cfm_fault" member in ovsrec_interface. */
19738
const struct ovsdb_datum *
19739
ovsrec_interface_get_cfm_fault(const struct ovsrec_interface *row,
19740
  enum ovsdb_atomic_type key_type OVS_UNUSED)
19741
0
{
19742
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
19743
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_fault);
19744
0
}
19745
19746
/* Returns the "cfm_fault_status" column's value from the "Interface" table in 'row'
19747
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19748
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19749
 * for a given key than implementing the same operation on the "cooked"
19750
 * form in 'row'.
19751
 *
19752
 * 'key_type' must be OVSDB_TYPE_STRING.
19753
 * (This helps to avoid silent bugs if someone changes cfm_fault_status's
19754
 * type without updating the caller.)
19755
 *
19756
 * The caller must not modify or free the returned value.
19757
 *
19758
 * Various kinds of changes can invalidate the returned value: modifying
19759
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19760
 * If the returned value is needed for a long time, it is best to make a copy
19761
 * of it with ovsdb_datum_clone().
19762
 *
19763
 * This function is rarely useful, since it is easier to access the value
19764
 * directly through the "cfm_fault_status" member in ovsrec_interface. */
19765
const struct ovsdb_datum *
19766
ovsrec_interface_get_cfm_fault_status(const struct ovsrec_interface *row,
19767
  enum ovsdb_atomic_type key_type OVS_UNUSED)
19768
0
{
19769
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
19770
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_fault_status);
19771
0
}
19772
19773
/* Returns the "cfm_flap_count" column's value from the "Interface" table in 'row'
19774
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19775
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19776
 * for a given key than implementing the same operation on the "cooked"
19777
 * form in 'row'.
19778
 *
19779
 * 'key_type' must be OVSDB_TYPE_INTEGER.
19780
 * (This helps to avoid silent bugs if someone changes cfm_flap_count's
19781
 * type without updating the caller.)
19782
 *
19783
 * The caller must not modify or free the returned value.
19784
 *
19785
 * Various kinds of changes can invalidate the returned value: modifying
19786
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19787
 * If the returned value is needed for a long time, it is best to make a copy
19788
 * of it with ovsdb_datum_clone().
19789
 *
19790
 * This function is rarely useful, since it is easier to access the value
19791
 * directly through the "cfm_flap_count" member in ovsrec_interface. */
19792
const struct ovsdb_datum *
19793
ovsrec_interface_get_cfm_flap_count(const struct ovsrec_interface *row,
19794
  enum ovsdb_atomic_type key_type OVS_UNUSED)
19795
0
{
19796
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
19797
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_flap_count);
19798
0
}
19799
19800
/* Returns the "cfm_health" column's value from the "Interface" table in 'row'
19801
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19802
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19803
 * for a given key than implementing the same operation on the "cooked"
19804
 * form in 'row'.
19805
 *
19806
 * 'key_type' must be OVSDB_TYPE_INTEGER.
19807
 * (This helps to avoid silent bugs if someone changes cfm_health's
19808
 * type without updating the caller.)
19809
 *
19810
 * The caller must not modify or free the returned value.
19811
 *
19812
 * Various kinds of changes can invalidate the returned value: modifying
19813
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19814
 * If the returned value is needed for a long time, it is best to make a copy
19815
 * of it with ovsdb_datum_clone().
19816
 *
19817
 * This function is rarely useful, since it is easier to access the value
19818
 * directly through the "cfm_health" member in ovsrec_interface. */
19819
const struct ovsdb_datum *
19820
ovsrec_interface_get_cfm_health(const struct ovsrec_interface *row,
19821
  enum ovsdb_atomic_type key_type OVS_UNUSED)
19822
0
{
19823
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
19824
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_health);
19825
0
}
19826
19827
/* Returns the "cfm_mpid" column's value from the "Interface" table in 'row'
19828
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19829
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19830
 * for a given key than implementing the same operation on the "cooked"
19831
 * form in 'row'.
19832
 *
19833
 * 'key_type' must be OVSDB_TYPE_INTEGER.
19834
 * (This helps to avoid silent bugs if someone changes cfm_mpid's
19835
 * type without updating the caller.)
19836
 *
19837
 * The caller must not modify or free the returned value.
19838
 *
19839
 * Various kinds of changes can invalidate the returned value: modifying
19840
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19841
 * If the returned value is needed for a long time, it is best to make a copy
19842
 * of it with ovsdb_datum_clone().
19843
 *
19844
 * This function is rarely useful, since it is easier to access the value
19845
 * directly through the "cfm_mpid" member in ovsrec_interface. */
19846
const struct ovsdb_datum *
19847
ovsrec_interface_get_cfm_mpid(const struct ovsrec_interface *row,
19848
  enum ovsdb_atomic_type key_type OVS_UNUSED)
19849
0
{
19850
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
19851
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_mpid);
19852
0
}
19853
19854
/* Returns the "cfm_remote_mpids" column's value from the "Interface" table in 'row'
19855
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19856
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19857
 * for a given key than implementing the same operation on the "cooked"
19858
 * form in 'row'.
19859
 *
19860
 * 'key_type' must be OVSDB_TYPE_INTEGER.
19861
 * (This helps to avoid silent bugs if someone changes cfm_remote_mpids's
19862
 * type without updating the caller.)
19863
 *
19864
 * The caller must not modify or free the returned value.
19865
 *
19866
 * Various kinds of changes can invalidate the returned value: modifying
19867
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19868
 * If the returned value is needed for a long time, it is best to make a copy
19869
 * of it with ovsdb_datum_clone().
19870
 *
19871
 * This function is rarely useful, since it is easier to access the value
19872
 * directly through the "cfm_remote_mpids" member in ovsrec_interface. */
19873
const struct ovsdb_datum *
19874
ovsrec_interface_get_cfm_remote_mpids(const struct ovsrec_interface *row,
19875
  enum ovsdb_atomic_type key_type OVS_UNUSED)
19876
0
{
19877
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
19878
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_remote_mpids);
19879
0
}
19880
19881
/* Returns the "cfm_remote_opstate" column's value from the "Interface" table in 'row'
19882
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19883
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19884
 * for a given key than implementing the same operation on the "cooked"
19885
 * form in 'row'.
19886
 *
19887
 * 'key_type' must be OVSDB_TYPE_STRING.
19888
 * (This helps to avoid silent bugs if someone changes cfm_remote_opstate's
19889
 * type without updating the caller.)
19890
 *
19891
 * The caller must not modify or free the returned value.
19892
 *
19893
 * Various kinds of changes can invalidate the returned value: modifying
19894
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19895
 * If the returned value is needed for a long time, it is best to make a copy
19896
 * of it with ovsdb_datum_clone().
19897
 *
19898
 * This function is rarely useful, since it is easier to access the value
19899
 * directly through the "cfm_remote_opstate" member in ovsrec_interface. */
19900
const struct ovsdb_datum *
19901
ovsrec_interface_get_cfm_remote_opstate(const struct ovsrec_interface *row,
19902
  enum ovsdb_atomic_type key_type OVS_UNUSED)
19903
0
{
19904
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
19905
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_remote_opstate);
19906
0
}
19907
19908
/* Returns the "duplex" column's value from the "Interface" table in 'row'
19909
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19910
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19911
 * for a given key than implementing the same operation on the "cooked"
19912
 * form in 'row'.
19913
 *
19914
 * 'key_type' must be OVSDB_TYPE_STRING.
19915
 * (This helps to avoid silent bugs if someone changes duplex's
19916
 * type without updating the caller.)
19917
 *
19918
 * The caller must not modify or free the returned value.
19919
 *
19920
 * Various kinds of changes can invalidate the returned value: modifying
19921
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19922
 * If the returned value is needed for a long time, it is best to make a copy
19923
 * of it with ovsdb_datum_clone().
19924
 *
19925
 * This function is rarely useful, since it is easier to access the value
19926
 * directly through the "duplex" member in ovsrec_interface. */
19927
const struct ovsdb_datum *
19928
ovsrec_interface_get_duplex(const struct ovsrec_interface *row,
19929
  enum ovsdb_atomic_type key_type OVS_UNUSED)
19930
0
{
19931
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
19932
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_duplex);
19933
0
}
19934
19935
/* Returns the "error" column's value from the "Interface" table in 'row'
19936
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19937
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19938
 * for a given key than implementing the same operation on the "cooked"
19939
 * form in 'row'.
19940
 *
19941
 * 'key_type' must be OVSDB_TYPE_STRING.
19942
 * (This helps to avoid silent bugs if someone changes error's
19943
 * type without updating the caller.)
19944
 *
19945
 * The caller must not modify or free the returned value.
19946
 *
19947
 * Various kinds of changes can invalidate the returned value: modifying
19948
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19949
 * If the returned value is needed for a long time, it is best to make a copy
19950
 * of it with ovsdb_datum_clone().
19951
 *
19952
 * This function is rarely useful, since it is easier to access the value
19953
 * directly through the "error" member in ovsrec_interface. */
19954
const struct ovsdb_datum *
19955
ovsrec_interface_get_error(const struct ovsrec_interface *row,
19956
  enum ovsdb_atomic_type key_type OVS_UNUSED)
19957
0
{
19958
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
19959
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_error);
19960
0
}
19961
19962
/* Returns the "external_ids" column's value from the "Interface" table in 'row'
19963
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19964
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19965
 * for a given key than implementing the same operation on the "cooked"
19966
 * form in 'row'.
19967
 *
19968
 * 'key_type' must be OVSDB_TYPE_STRING.
19969
 * 'value_type' must be OVSDB_TYPE_STRING.
19970
 * (This helps to avoid silent bugs if someone changes external_ids's
19971
 * type without updating the caller.)
19972
 *
19973
 * The caller must not modify or free the returned value.
19974
 *
19975
 * Various kinds of changes can invalidate the returned value: modifying
19976
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
19977
 * If the returned value is needed for a long time, it is best to make a copy
19978
 * of it with ovsdb_datum_clone().
19979
 *
19980
 * This function is rarely useful, since it is easier to access the value
19981
 * directly through the "external_ids" member in ovsrec_interface. */
19982
const struct ovsdb_datum *
19983
ovsrec_interface_get_external_ids(const struct ovsrec_interface *row,
19984
  enum ovsdb_atomic_type key_type OVS_UNUSED,
19985
  enum ovsdb_atomic_type value_type OVS_UNUSED)
19986
0
{
19987
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
19988
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
19989
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_external_ids);
19990
0
}
19991
19992
/* Returns the "ifindex" column's value from the "Interface" table in 'row'
19993
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
19994
 * ovsdb_datum_find_key() is an easier and more efficient way to search
19995
 * for a given key than implementing the same operation on the "cooked"
19996
 * form in 'row'.
19997
 *
19998
 * 'key_type' must be OVSDB_TYPE_INTEGER.
19999
 * (This helps to avoid silent bugs if someone changes ifindex's
20000
 * type without updating the caller.)
20001
 *
20002
 * The caller must not modify or free the returned value.
20003
 *
20004
 * Various kinds of changes can invalidate the returned value: modifying
20005
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20006
 * If the returned value is needed for a long time, it is best to make a copy
20007
 * of it with ovsdb_datum_clone().
20008
 *
20009
 * This function is rarely useful, since it is easier to access the value
20010
 * directly through the "ifindex" member in ovsrec_interface. */
20011
const struct ovsdb_datum *
20012
ovsrec_interface_get_ifindex(const struct ovsrec_interface *row,
20013
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20014
0
{
20015
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20016
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ifindex);
20017
0
}
20018
20019
/* Returns the "ingress_policing_burst" column's value from the "Interface" table in 'row'
20020
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20021
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20022
 * for a given key than implementing the same operation on the "cooked"
20023
 * form in 'row'.
20024
 *
20025
 * 'key_type' must be OVSDB_TYPE_INTEGER.
20026
 * (This helps to avoid silent bugs if someone changes ingress_policing_burst's
20027
 * type without updating the caller.)
20028
 *
20029
 * The caller must not modify or free the returned value.
20030
 *
20031
 * Various kinds of changes can invalidate the returned value: modifying
20032
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20033
 * If the returned value is needed for a long time, it is best to make a copy
20034
 * of it with ovsdb_datum_clone().
20035
 *
20036
 * This function is rarely useful, since it is easier to access the value
20037
 * directly through the "ingress_policing_burst" member in ovsrec_interface. */
20038
const struct ovsdb_datum *
20039
ovsrec_interface_get_ingress_policing_burst(const struct ovsrec_interface *row,
20040
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20041
0
{
20042
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20043
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_burst);
20044
0
}
20045
20046
/* Returns the "ingress_policing_kpkts_burst" column's value from the "Interface" table in 'row'
20047
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20048
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20049
 * for a given key than implementing the same operation on the "cooked"
20050
 * form in 'row'.
20051
 *
20052
 * 'key_type' must be OVSDB_TYPE_INTEGER.
20053
 * (This helps to avoid silent bugs if someone changes ingress_policing_kpkts_burst's
20054
 * type without updating the caller.)
20055
 *
20056
 * The caller must not modify or free the returned value.
20057
 *
20058
 * Various kinds of changes can invalidate the returned value: modifying
20059
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20060
 * If the returned value is needed for a long time, it is best to make a copy
20061
 * of it with ovsdb_datum_clone().
20062
 *
20063
 * This function is rarely useful, since it is easier to access the value
20064
 * directly through the "ingress_policing_kpkts_burst" member in ovsrec_interface. */
20065
const struct ovsdb_datum *
20066
ovsrec_interface_get_ingress_policing_kpkts_burst(const struct ovsrec_interface *row,
20067
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20068
0
{
20069
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20070
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_burst);
20071
0
}
20072
20073
/* Returns the "ingress_policing_kpkts_rate" column's value from the "Interface" table in 'row'
20074
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20075
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20076
 * for a given key than implementing the same operation on the "cooked"
20077
 * form in 'row'.
20078
 *
20079
 * 'key_type' must be OVSDB_TYPE_INTEGER.
20080
 * (This helps to avoid silent bugs if someone changes ingress_policing_kpkts_rate's
20081
 * type without updating the caller.)
20082
 *
20083
 * The caller must not modify or free the returned value.
20084
 *
20085
 * Various kinds of changes can invalidate the returned value: modifying
20086
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20087
 * If the returned value is needed for a long time, it is best to make a copy
20088
 * of it with ovsdb_datum_clone().
20089
 *
20090
 * This function is rarely useful, since it is easier to access the value
20091
 * directly through the "ingress_policing_kpkts_rate" member in ovsrec_interface. */
20092
const struct ovsdb_datum *
20093
ovsrec_interface_get_ingress_policing_kpkts_rate(const struct ovsrec_interface *row,
20094
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20095
0
{
20096
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20097
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_rate);
20098
0
}
20099
20100
/* Returns the "ingress_policing_rate" column's value from the "Interface" table in 'row'
20101
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20102
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20103
 * for a given key than implementing the same operation on the "cooked"
20104
 * form in 'row'.
20105
 *
20106
 * 'key_type' must be OVSDB_TYPE_INTEGER.
20107
 * (This helps to avoid silent bugs if someone changes ingress_policing_rate's
20108
 * type without updating the caller.)
20109
 *
20110
 * The caller must not modify or free the returned value.
20111
 *
20112
 * Various kinds of changes can invalidate the returned value: modifying
20113
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20114
 * If the returned value is needed for a long time, it is best to make a copy
20115
 * of it with ovsdb_datum_clone().
20116
 *
20117
 * This function is rarely useful, since it is easier to access the value
20118
 * directly through the "ingress_policing_rate" member in ovsrec_interface. */
20119
const struct ovsdb_datum *
20120
ovsrec_interface_get_ingress_policing_rate(const struct ovsrec_interface *row,
20121
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20122
0
{
20123
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20124
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_rate);
20125
0
}
20126
20127
/* Returns the "lacp_current" column's value from the "Interface" table in 'row'
20128
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20129
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20130
 * for a given key than implementing the same operation on the "cooked"
20131
 * form in 'row'.
20132
 *
20133
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
20134
 * (This helps to avoid silent bugs if someone changes lacp_current's
20135
 * type without updating the caller.)
20136
 *
20137
 * The caller must not modify or free the returned value.
20138
 *
20139
 * Various kinds of changes can invalidate the returned value: modifying
20140
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20141
 * If the returned value is needed for a long time, it is best to make a copy
20142
 * of it with ovsdb_datum_clone().
20143
 *
20144
 * This function is rarely useful, since it is easier to access the value
20145
 * directly through the "lacp_current" member in ovsrec_interface. */
20146
const struct ovsdb_datum *
20147
ovsrec_interface_get_lacp_current(const struct ovsrec_interface *row,
20148
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20149
0
{
20150
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
20151
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_lacp_current);
20152
0
}
20153
20154
/* Returns the "link_resets" column's value from the "Interface" table in 'row'
20155
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20156
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20157
 * for a given key than implementing the same operation on the "cooked"
20158
 * form in 'row'.
20159
 *
20160
 * 'key_type' must be OVSDB_TYPE_INTEGER.
20161
 * (This helps to avoid silent bugs if someone changes link_resets's
20162
 * type without updating the caller.)
20163
 *
20164
 * The caller must not modify or free the returned value.
20165
 *
20166
 * Various kinds of changes can invalidate the returned value: modifying
20167
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20168
 * If the returned value is needed for a long time, it is best to make a copy
20169
 * of it with ovsdb_datum_clone().
20170
 *
20171
 * This function is rarely useful, since it is easier to access the value
20172
 * directly through the "link_resets" member in ovsrec_interface. */
20173
const struct ovsdb_datum *
20174
ovsrec_interface_get_link_resets(const struct ovsrec_interface *row,
20175
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20176
0
{
20177
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20178
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_resets);
20179
0
}
20180
20181
/* Returns the "link_speed" column's value from the "Interface" table in 'row'
20182
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20183
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20184
 * for a given key than implementing the same operation on the "cooked"
20185
 * form in 'row'.
20186
 *
20187
 * 'key_type' must be OVSDB_TYPE_INTEGER.
20188
 * (This helps to avoid silent bugs if someone changes link_speed's
20189
 * type without updating the caller.)
20190
 *
20191
 * The caller must not modify or free the returned value.
20192
 *
20193
 * Various kinds of changes can invalidate the returned value: modifying
20194
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20195
 * If the returned value is needed for a long time, it is best to make a copy
20196
 * of it with ovsdb_datum_clone().
20197
 *
20198
 * This function is rarely useful, since it is easier to access the value
20199
 * directly through the "link_speed" member in ovsrec_interface. */
20200
const struct ovsdb_datum *
20201
ovsrec_interface_get_link_speed(const struct ovsrec_interface *row,
20202
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20203
0
{
20204
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20205
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_speed);
20206
0
}
20207
20208
/* Returns the "link_state" column's value from the "Interface" table in 'row'
20209
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20210
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20211
 * for a given key than implementing the same operation on the "cooked"
20212
 * form in 'row'.
20213
 *
20214
 * 'key_type' must be OVSDB_TYPE_STRING.
20215
 * (This helps to avoid silent bugs if someone changes link_state's
20216
 * type without updating the caller.)
20217
 *
20218
 * The caller must not modify or free the returned value.
20219
 *
20220
 * Various kinds of changes can invalidate the returned value: modifying
20221
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20222
 * If the returned value is needed for a long time, it is best to make a copy
20223
 * of it with ovsdb_datum_clone().
20224
 *
20225
 * This function is rarely useful, since it is easier to access the value
20226
 * directly through the "link_state" member in ovsrec_interface. */
20227
const struct ovsdb_datum *
20228
ovsrec_interface_get_link_state(const struct ovsrec_interface *row,
20229
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20230
0
{
20231
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
20232
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_state);
20233
0
}
20234
20235
/* Returns the "lldp" column's value from the "Interface" table in 'row'
20236
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20237
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20238
 * for a given key than implementing the same operation on the "cooked"
20239
 * form in 'row'.
20240
 *
20241
 * 'key_type' must be OVSDB_TYPE_STRING.
20242
 * 'value_type' must be OVSDB_TYPE_STRING.
20243
 * (This helps to avoid silent bugs if someone changes lldp's
20244
 * type without updating the caller.)
20245
 *
20246
 * The caller must not modify or free the returned value.
20247
 *
20248
 * Various kinds of changes can invalidate the returned value: modifying
20249
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20250
 * If the returned value is needed for a long time, it is best to make a copy
20251
 * of it with ovsdb_datum_clone().
20252
 *
20253
 * This function is rarely useful, since it is easier to access the value
20254
 * directly through the "lldp" member in ovsrec_interface. */
20255
const struct ovsdb_datum *
20256
ovsrec_interface_get_lldp(const struct ovsrec_interface *row,
20257
  enum ovsdb_atomic_type key_type OVS_UNUSED,
20258
  enum ovsdb_atomic_type value_type OVS_UNUSED)
20259
0
{
20260
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
20261
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
20262
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_lldp);
20263
0
}
20264
20265
/* Returns the "mac" column's value from the "Interface" table in 'row'
20266
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20267
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20268
 * for a given key than implementing the same operation on the "cooked"
20269
 * form in 'row'.
20270
 *
20271
 * 'key_type' must be OVSDB_TYPE_STRING.
20272
 * (This helps to avoid silent bugs if someone changes mac's
20273
 * type without updating the caller.)
20274
 *
20275
 * The caller must not modify or free the returned value.
20276
 *
20277
 * Various kinds of changes can invalidate the returned value: modifying
20278
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20279
 * If the returned value is needed for a long time, it is best to make a copy
20280
 * of it with ovsdb_datum_clone().
20281
 *
20282
 * This function is rarely useful, since it is easier to access the value
20283
 * directly through the "mac" member in ovsrec_interface. */
20284
const struct ovsdb_datum *
20285
ovsrec_interface_get_mac(const struct ovsrec_interface *row,
20286
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20287
0
{
20288
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
20289
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mac);
20290
0
}
20291
20292
/* Returns the "mac_in_use" column's value from the "Interface" table in 'row'
20293
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20294
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20295
 * for a given key than implementing the same operation on the "cooked"
20296
 * form in 'row'.
20297
 *
20298
 * 'key_type' must be OVSDB_TYPE_STRING.
20299
 * (This helps to avoid silent bugs if someone changes mac_in_use's
20300
 * type without updating the caller.)
20301
 *
20302
 * The caller must not modify or free the returned value.
20303
 *
20304
 * Various kinds of changes can invalidate the returned value: modifying
20305
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20306
 * If the returned value is needed for a long time, it is best to make a copy
20307
 * of it with ovsdb_datum_clone().
20308
 *
20309
 * This function is rarely useful, since it is easier to access the value
20310
 * directly through the "mac_in_use" member in ovsrec_interface. */
20311
const struct ovsdb_datum *
20312
ovsrec_interface_get_mac_in_use(const struct ovsrec_interface *row,
20313
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20314
0
{
20315
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
20316
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mac_in_use);
20317
0
}
20318
20319
/* Returns the "mtu" column's value from the "Interface" table in 'row'
20320
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20321
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20322
 * for a given key than implementing the same operation on the "cooked"
20323
 * form in 'row'.
20324
 *
20325
 * 'key_type' must be OVSDB_TYPE_INTEGER.
20326
 * (This helps to avoid silent bugs if someone changes mtu's
20327
 * type without updating the caller.)
20328
 *
20329
 * The caller must not modify or free the returned value.
20330
 *
20331
 * Various kinds of changes can invalidate the returned value: modifying
20332
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20333
 * If the returned value is needed for a long time, it is best to make a copy
20334
 * of it with ovsdb_datum_clone().
20335
 *
20336
 * This function is rarely useful, since it is easier to access the value
20337
 * directly through the "mtu" member in ovsrec_interface. */
20338
const struct ovsdb_datum *
20339
ovsrec_interface_get_mtu(const struct ovsrec_interface *row,
20340
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20341
0
{
20342
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20343
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mtu);
20344
0
}
20345
20346
/* Returns the "mtu_request" column's value from the "Interface" table in 'row'
20347
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20348
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20349
 * for a given key than implementing the same operation on the "cooked"
20350
 * form in 'row'.
20351
 *
20352
 * 'key_type' must be OVSDB_TYPE_INTEGER.
20353
 * (This helps to avoid silent bugs if someone changes mtu_request's
20354
 * type without updating the caller.)
20355
 *
20356
 * The caller must not modify or free the returned value.
20357
 *
20358
 * Various kinds of changes can invalidate the returned value: modifying
20359
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20360
 * If the returned value is needed for a long time, it is best to make a copy
20361
 * of it with ovsdb_datum_clone().
20362
 *
20363
 * This function is rarely useful, since it is easier to access the value
20364
 * directly through the "mtu_request" member in ovsrec_interface. */
20365
const struct ovsdb_datum *
20366
ovsrec_interface_get_mtu_request(const struct ovsrec_interface *row,
20367
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20368
0
{
20369
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20370
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mtu_request);
20371
0
}
20372
20373
/* Returns the "name" column's value from the "Interface" table in 'row'
20374
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20375
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20376
 * for a given key than implementing the same operation on the "cooked"
20377
 * form in 'row'.
20378
 *
20379
 * 'key_type' must be OVSDB_TYPE_STRING.
20380
 * (This helps to avoid silent bugs if someone changes name's
20381
 * type without updating the caller.)
20382
 *
20383
 * The caller must not modify or free the returned value.
20384
 *
20385
 * Various kinds of changes can invalidate the returned value: modifying
20386
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20387
 * If the returned value is needed for a long time, it is best to make a copy
20388
 * of it with ovsdb_datum_clone().
20389
 *
20390
 * This function is rarely useful, since it is easier to access the value
20391
 * directly through the "name" member in ovsrec_interface. */
20392
const struct ovsdb_datum *
20393
ovsrec_interface_get_name(const struct ovsrec_interface *row,
20394
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20395
0
{
20396
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
20397
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_name);
20398
0
}
20399
20400
/* Returns the "ofport" column's value from the "Interface" table in 'row'
20401
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20402
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20403
 * for a given key than implementing the same operation on the "cooked"
20404
 * form in 'row'.
20405
 *
20406
 * 'key_type' must be OVSDB_TYPE_INTEGER.
20407
 * (This helps to avoid silent bugs if someone changes ofport's
20408
 * type without updating the caller.)
20409
 *
20410
 * The caller must not modify or free the returned value.
20411
 *
20412
 * Various kinds of changes can invalidate the returned value: modifying
20413
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20414
 * If the returned value is needed for a long time, it is best to make a copy
20415
 * of it with ovsdb_datum_clone().
20416
 *
20417
 * This function is rarely useful, since it is easier to access the value
20418
 * directly through the "ofport" member in ovsrec_interface. */
20419
const struct ovsdb_datum *
20420
ovsrec_interface_get_ofport(const struct ovsrec_interface *row,
20421
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20422
0
{
20423
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20424
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ofport);
20425
0
}
20426
20427
/* Returns the "ofport_request" column's value from the "Interface" table in 'row'
20428
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20429
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20430
 * for a given key than implementing the same operation on the "cooked"
20431
 * form in 'row'.
20432
 *
20433
 * 'key_type' must be OVSDB_TYPE_INTEGER.
20434
 * (This helps to avoid silent bugs if someone changes ofport_request's
20435
 * type without updating the caller.)
20436
 *
20437
 * The caller must not modify or free the returned value.
20438
 *
20439
 * Various kinds of changes can invalidate the returned value: modifying
20440
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20441
 * If the returned value is needed for a long time, it is best to make a copy
20442
 * of it with ovsdb_datum_clone().
20443
 *
20444
 * This function is rarely useful, since it is easier to access the value
20445
 * directly through the "ofport_request" member in ovsrec_interface. */
20446
const struct ovsdb_datum *
20447
ovsrec_interface_get_ofport_request(const struct ovsrec_interface *row,
20448
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20449
0
{
20450
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
20451
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ofport_request);
20452
0
}
20453
20454
/* Returns the "options" column's value from the "Interface" table in 'row'
20455
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20456
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20457
 * for a given key than implementing the same operation on the "cooked"
20458
 * form in 'row'.
20459
 *
20460
 * 'key_type' must be OVSDB_TYPE_STRING.
20461
 * 'value_type' must be OVSDB_TYPE_STRING.
20462
 * (This helps to avoid silent bugs if someone changes options's
20463
 * type without updating the caller.)
20464
 *
20465
 * The caller must not modify or free the returned value.
20466
 *
20467
 * Various kinds of changes can invalidate the returned value: modifying
20468
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20469
 * If the returned value is needed for a long time, it is best to make a copy
20470
 * of it with ovsdb_datum_clone().
20471
 *
20472
 * This function is rarely useful, since it is easier to access the value
20473
 * directly through the "options" member in ovsrec_interface. */
20474
const struct ovsdb_datum *
20475
ovsrec_interface_get_options(const struct ovsrec_interface *row,
20476
  enum ovsdb_atomic_type key_type OVS_UNUSED,
20477
  enum ovsdb_atomic_type value_type OVS_UNUSED)
20478
0
{
20479
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
20480
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
20481
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_options);
20482
0
}
20483
20484
/* Returns the "other_config" column's value from the "Interface" table in 'row'
20485
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20486
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20487
 * for a given key than implementing the same operation on the "cooked"
20488
 * form in 'row'.
20489
 *
20490
 * 'key_type' must be OVSDB_TYPE_STRING.
20491
 * 'value_type' must be OVSDB_TYPE_STRING.
20492
 * (This helps to avoid silent bugs if someone changes other_config's
20493
 * type without updating the caller.)
20494
 *
20495
 * The caller must not modify or free the returned value.
20496
 *
20497
 * Various kinds of changes can invalidate the returned value: modifying
20498
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20499
 * If the returned value is needed for a long time, it is best to make a copy
20500
 * of it with ovsdb_datum_clone().
20501
 *
20502
 * This function is rarely useful, since it is easier to access the value
20503
 * directly through the "other_config" member in ovsrec_interface. */
20504
const struct ovsdb_datum *
20505
ovsrec_interface_get_other_config(const struct ovsrec_interface *row,
20506
  enum ovsdb_atomic_type key_type OVS_UNUSED,
20507
  enum ovsdb_atomic_type value_type OVS_UNUSED)
20508
0
{
20509
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
20510
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
20511
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_other_config);
20512
0
}
20513
20514
/* Returns the "statistics" column's value from the "Interface" table in 'row'
20515
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20516
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20517
 * for a given key than implementing the same operation on the "cooked"
20518
 * form in 'row'.
20519
 *
20520
 * 'key_type' must be OVSDB_TYPE_STRING.
20521
 * 'value_type' must be OVSDB_TYPE_INTEGER.
20522
 * (This helps to avoid silent bugs if someone changes statistics's
20523
 * type without updating the caller.)
20524
 *
20525
 * The caller must not modify or free the returned value.
20526
 *
20527
 * Various kinds of changes can invalidate the returned value: modifying
20528
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20529
 * If the returned value is needed for a long time, it is best to make a copy
20530
 * of it with ovsdb_datum_clone().
20531
 *
20532
 * This function is rarely useful, since it is easier to access the value
20533
 * directly through the "statistics" member in ovsrec_interface. */
20534
const struct ovsdb_datum *
20535
ovsrec_interface_get_statistics(const struct ovsrec_interface *row,
20536
  enum ovsdb_atomic_type key_type OVS_UNUSED,
20537
  enum ovsdb_atomic_type value_type OVS_UNUSED)
20538
0
{
20539
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
20540
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
20541
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_statistics);
20542
0
}
20543
20544
/* Returns the "status" column's value from the "Interface" table in 'row'
20545
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20546
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20547
 * for a given key than implementing the same operation on the "cooked"
20548
 * form in 'row'.
20549
 *
20550
 * 'key_type' must be OVSDB_TYPE_STRING.
20551
 * 'value_type' must be OVSDB_TYPE_STRING.
20552
 * (This helps to avoid silent bugs if someone changes status's
20553
 * type without updating the caller.)
20554
 *
20555
 * The caller must not modify or free the returned value.
20556
 *
20557
 * Various kinds of changes can invalidate the returned value: modifying
20558
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20559
 * If the returned value is needed for a long time, it is best to make a copy
20560
 * of it with ovsdb_datum_clone().
20561
 *
20562
 * This function is rarely useful, since it is easier to access the value
20563
 * directly through the "status" member in ovsrec_interface. */
20564
const struct ovsdb_datum *
20565
ovsrec_interface_get_status(const struct ovsrec_interface *row,
20566
  enum ovsdb_atomic_type key_type OVS_UNUSED,
20567
  enum ovsdb_atomic_type value_type OVS_UNUSED)
20568
0
{
20569
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
20570
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
20571
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_status);
20572
0
}
20573
20574
/* Returns the "type" column's value from the "Interface" table in 'row'
20575
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
20576
 * ovsdb_datum_find_key() is an easier and more efficient way to search
20577
 * for a given key than implementing the same operation on the "cooked"
20578
 * form in 'row'.
20579
 *
20580
 * 'key_type' must be OVSDB_TYPE_STRING.
20581
 * (This helps to avoid silent bugs if someone changes type's
20582
 * type without updating the caller.)
20583
 *
20584
 * The caller must not modify or free the returned value.
20585
 *
20586
 * Various kinds of changes can invalidate the returned value: modifying
20587
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
20588
 * If the returned value is needed for a long time, it is best to make a copy
20589
 * of it with ovsdb_datum_clone().
20590
 *
20591
 * This function is rarely useful, since it is easier to access the value
20592
 * directly through the "type" member in ovsrec_interface. */
20593
const struct ovsdb_datum *
20594
ovsrec_interface_get_type(const struct ovsrec_interface *row,
20595
  enum ovsdb_atomic_type key_type OVS_UNUSED)
20596
0
{
20597
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
20598
0
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_type);
20599
0
}
20600
20601
/* Sets the "admin_state" column from the "Interface" table in 'row' to
20602
 * the 'admin_state' set.
20603
 *
20604
 * If "admin_state" is null, the column will be the empty set,
20605
 * otherwise it will contain the specified value.
20606
 *
20607
 * Argument constraints: either "down" or "up"
20608
 *
20609
 * The caller retains ownership of the arguments. */
20610
void
20611
ovsrec_interface_set_admin_state(const struct ovsrec_interface *row, const char *admin_state)
20612
0
{
20613
0
    struct ovsdb_datum datum;
20614
20615
0
    datum.refcnt = NULL;
20616
20617
0
    if (admin_state) {
20618
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
20619
0
        datum.n = 1;
20620
0
        datum.keys = key;
20621
0
        key->s = ovsdb_atom_string_create(admin_state);
20622
0
    } else {
20623
0
        datum.n = 0;
20624
0
        datum.keys = NULL;
20625
0
    }
20626
0
    datum.values = NULL;
20627
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_admin_state, &datum);
20628
0
}
20629
20630
/* Sets the "bfd" column's value from the "Interface" table in 'row'
20631
 * to 'bfd'.
20632
 *
20633
 * The caller retains ownership of 'bfd' and everything in it. */
20634
void
20635
ovsrec_interface_set_bfd(const struct ovsrec_interface *row, const struct smap *bfd)
20636
0
{
20637
0
    struct ovsdb_datum datum;
20638
20639
0
    if (bfd) {
20640
0
        ovsdb_datum_from_smap(&datum, bfd);
20641
0
    } else {
20642
0
        ovsdb_datum_init_empty(&datum);
20643
0
    }
20644
0
    ovsdb_idl_txn_write(&row->header_,
20645
0
                        &ovsrec_interface_col_bfd,
20646
0
                        &datum);
20647
0
}
20648
20649
20650
/* Sets the "bfd_status" column's value from the "Interface" table in 'row'
20651
 * to 'bfd_status'.
20652
 *
20653
 * The caller retains ownership of 'bfd_status' and everything in it. */
20654
void
20655
ovsrec_interface_set_bfd_status(const struct ovsrec_interface *row, const struct smap *bfd_status)
20656
0
{
20657
0
    struct ovsdb_datum datum;
20658
20659
0
    if (bfd_status) {
20660
0
        ovsdb_datum_from_smap(&datum, bfd_status);
20661
0
    } else {
20662
0
        ovsdb_datum_init_empty(&datum);
20663
0
    }
20664
0
    ovsdb_idl_txn_write(&row->header_,
20665
0
                        &ovsrec_interface_col_bfd_status,
20666
0
                        &datum);
20667
0
}
20668
20669
20670
/* Sets the "cfm_fault" column from the "Interface" table in 'row' to
20671
 * the 'cfm_fault' set with 'n_cfm_fault' entries.
20672
 *
20673
 * 'n_cfm_fault' may be 0 or 1; if it is 0, then 'cfm_fault'
20674
 * may be NULL.
20675
 *
20676
 * The caller retains ownership of the arguments. */
20677
void
20678
ovsrec_interface_set_cfm_fault(const struct ovsrec_interface *row, const bool *cfm_fault, size_t n_cfm_fault)
20679
0
{
20680
0
    struct ovsdb_datum datum;
20681
20682
0
    datum.refcnt = NULL;
20683
20684
0
    if (n_cfm_fault) {
20685
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
20686
0
        datum.n = 1;
20687
0
        datum.keys = key;
20688
0
        key->boolean = *cfm_fault;
20689
0
    } else {
20690
0
        datum.n = 0;
20691
0
        datum.keys = NULL;
20692
0
    }
20693
0
    datum.values = NULL;
20694
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_fault, &datum);
20695
0
}
20696
20697
/* Sets the "cfm_fault_status" column from the "Interface" table in 'row' to
20698
 * the 'cfm_fault_status' set with 'n_cfm_fault_status' entries.
20699
 *
20700
 * The caller retains ownership of the arguments. */
20701
void
20702
ovsrec_interface_set_cfm_fault_status(const struct ovsrec_interface *row, const char **cfm_fault_status, size_t n_cfm_fault_status)
20703
0
{
20704
0
    struct ovsdb_datum datum;
20705
20706
0
    datum.refcnt = NULL;
20707
20708
0
    datum.n = n_cfm_fault_status;
20709
0
    datum.keys = n_cfm_fault_status ? xmalloc(n_cfm_fault_status * sizeof *datum.keys) : NULL;
20710
0
    datum.values = NULL;
20711
0
    for (size_t i = 0; i < n_cfm_fault_status; i++) {
20712
0
        datum.keys[i].s = ovsdb_atom_string_create(cfm_fault_status[i]);
20713
0
    }
20714
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_fault_status, &datum);
20715
0
}
20716
20717
/* Sets the "cfm_flap_count" column from the "Interface" table in 'row' to
20718
 * the 'cfm_flap_count' set with 'n_cfm_flap_count' entries.
20719
 *
20720
 * 'n_cfm_flap_count' may be 0 or 1; if it is 0, then 'cfm_flap_count'
20721
 * may be NULL.
20722
 *
20723
 * The caller retains ownership of the arguments. */
20724
void
20725
ovsrec_interface_set_cfm_flap_count(const struct ovsrec_interface *row, const int64_t *cfm_flap_count, size_t n_cfm_flap_count)
20726
0
{
20727
0
    struct ovsdb_datum datum;
20728
20729
0
    datum.refcnt = NULL;
20730
20731
0
    if (n_cfm_flap_count) {
20732
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
20733
0
        datum.n = 1;
20734
0
        datum.keys = key;
20735
0
        key->integer = *cfm_flap_count;
20736
0
    } else {
20737
0
        datum.n = 0;
20738
0
        datum.keys = NULL;
20739
0
    }
20740
0
    datum.values = NULL;
20741
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_flap_count, &datum);
20742
0
}
20743
20744
/* Sets the "cfm_health" column from the "Interface" table in 'row' to
20745
 * the 'cfm_health' set with 'n_cfm_health' entries.
20746
 *
20747
 * 'n_cfm_health' may be 0 or 1; if it is 0, then 'cfm_health'
20748
 * may be NULL.
20749
 *
20750
 * Argument constraints: in range 0 to 100
20751
 *
20752
 * The caller retains ownership of the arguments. */
20753
void
20754
ovsrec_interface_set_cfm_health(const struct ovsrec_interface *row, const int64_t *cfm_health, size_t n_cfm_health)
20755
0
{
20756
0
    struct ovsdb_datum datum;
20757
20758
0
    datum.refcnt = NULL;
20759
20760
0
    if (n_cfm_health) {
20761
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
20762
0
        datum.n = 1;
20763
0
        datum.keys = key;
20764
0
        key->integer = *cfm_health;
20765
0
    } else {
20766
0
        datum.n = 0;
20767
0
        datum.keys = NULL;
20768
0
    }
20769
0
    datum.values = NULL;
20770
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_health, &datum);
20771
0
}
20772
20773
/* Sets the "cfm_mpid" column from the "Interface" table in 'row' to
20774
 * the 'cfm_mpid' set with 'n_cfm_mpid' entries.
20775
 *
20776
 * 'n_cfm_mpid' may be 0 or 1; if it is 0, then 'cfm_mpid'
20777
 * may be NULL.
20778
 *
20779
 * The caller retains ownership of the arguments. */
20780
void
20781
ovsrec_interface_set_cfm_mpid(const struct ovsrec_interface *row, const int64_t *cfm_mpid, size_t n_cfm_mpid)
20782
0
{
20783
0
    struct ovsdb_datum datum;
20784
20785
0
    datum.refcnt = NULL;
20786
20787
0
    if (n_cfm_mpid) {
20788
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
20789
0
        datum.n = 1;
20790
0
        datum.keys = key;
20791
0
        key->integer = *cfm_mpid;
20792
0
    } else {
20793
0
        datum.n = 0;
20794
0
        datum.keys = NULL;
20795
0
    }
20796
0
    datum.values = NULL;
20797
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_mpid, &datum);
20798
0
}
20799
20800
/* Sets the "cfm_remote_mpids" column from the "Interface" table in 'row' to
20801
 * the 'cfm_remote_mpids' set with 'n_cfm_remote_mpids' entries.
20802
 *
20803
 * The caller retains ownership of the arguments. */
20804
void
20805
ovsrec_interface_set_cfm_remote_mpids(const struct ovsrec_interface *row, const int64_t *cfm_remote_mpids, size_t n_cfm_remote_mpids)
20806
0
{
20807
0
    struct ovsdb_datum datum;
20808
20809
0
    datum.refcnt = NULL;
20810
20811
0
    datum.n = n_cfm_remote_mpids;
20812
0
    datum.keys = n_cfm_remote_mpids ? xmalloc(n_cfm_remote_mpids * sizeof *datum.keys) : NULL;
20813
0
    datum.values = NULL;
20814
0
    for (size_t i = 0; i < n_cfm_remote_mpids; i++) {
20815
0
        datum.keys[i].integer = cfm_remote_mpids[i];
20816
0
    }
20817
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_remote_mpids, &datum);
20818
0
}
20819
20820
/* Sets the "cfm_remote_opstate" column from the "Interface" table in 'row' to
20821
 * the 'cfm_remote_opstate' set.
20822
 *
20823
 * If "cfm_remote_opstate" is null, the column will be the empty set,
20824
 * otherwise it will contain the specified value.
20825
 *
20826
 * Argument constraints: either "down" or "up"
20827
 *
20828
 * The caller retains ownership of the arguments. */
20829
void
20830
ovsrec_interface_set_cfm_remote_opstate(const struct ovsrec_interface *row, const char *cfm_remote_opstate)
20831
0
{
20832
0
    struct ovsdb_datum datum;
20833
20834
0
    datum.refcnt = NULL;
20835
20836
0
    if (cfm_remote_opstate) {
20837
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
20838
0
        datum.n = 1;
20839
0
        datum.keys = key;
20840
0
        key->s = ovsdb_atom_string_create(cfm_remote_opstate);
20841
0
    } else {
20842
0
        datum.n = 0;
20843
0
        datum.keys = NULL;
20844
0
    }
20845
0
    datum.values = NULL;
20846
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_cfm_remote_opstate, &datum);
20847
0
}
20848
20849
/* Sets the "duplex" column from the "Interface" table in 'row' to
20850
 * the 'duplex' set.
20851
 *
20852
 * If "duplex" is null, the column will be the empty set,
20853
 * otherwise it will contain the specified value.
20854
 *
20855
 * Argument constraints: either "full" or "half"
20856
 *
20857
 * The caller retains ownership of the arguments. */
20858
void
20859
ovsrec_interface_set_duplex(const struct ovsrec_interface *row, const char *duplex)
20860
0
{
20861
0
    struct ovsdb_datum datum;
20862
20863
0
    datum.refcnt = NULL;
20864
20865
0
    if (duplex) {
20866
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
20867
0
        datum.n = 1;
20868
0
        datum.keys = key;
20869
0
        key->s = ovsdb_atom_string_create(duplex);
20870
0
    } else {
20871
0
        datum.n = 0;
20872
0
        datum.keys = NULL;
20873
0
    }
20874
0
    datum.values = NULL;
20875
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_duplex, &datum);
20876
0
}
20877
20878
/* Sets the "error" column from the "Interface" table in 'row' to
20879
 * the 'error' set.
20880
 *
20881
 * If "error" is null, the column will be the empty set,
20882
 * otherwise it will contain the specified value.
20883
 *
20884
 * The caller retains ownership of the arguments. */
20885
void
20886
ovsrec_interface_set_error(const struct ovsrec_interface *row, const char *error)
20887
0
{
20888
0
    struct ovsdb_datum datum;
20889
20890
0
    datum.refcnt = NULL;
20891
20892
0
    if (error) {
20893
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
20894
0
        datum.n = 1;
20895
0
        datum.keys = key;
20896
0
        key->s = ovsdb_atom_string_create(error);
20897
0
    } else {
20898
0
        datum.n = 0;
20899
0
        datum.keys = NULL;
20900
0
    }
20901
0
    datum.values = NULL;
20902
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_error, &datum);
20903
0
}
20904
20905
/* Sets the "external_ids" column's value from the "Interface" table in 'row'
20906
 * to 'external_ids'.
20907
 *
20908
 * The caller retains ownership of 'external_ids' and everything in it. */
20909
void
20910
ovsrec_interface_set_external_ids(const struct ovsrec_interface *row, const struct smap *external_ids)
20911
0
{
20912
0
    struct ovsdb_datum datum;
20913
20914
0
    if (external_ids) {
20915
0
        ovsdb_datum_from_smap(&datum, external_ids);
20916
0
    } else {
20917
0
        ovsdb_datum_init_empty(&datum);
20918
0
    }
20919
0
    ovsdb_idl_txn_write(&row->header_,
20920
0
                        &ovsrec_interface_col_external_ids,
20921
0
                        &datum);
20922
0
}
20923
20924
20925
/* Sets the "ifindex" column from the "Interface" table in 'row' to
20926
 * the 'ifindex' set with 'n_ifindex' entries.
20927
 *
20928
 * 'n_ifindex' may be 0 or 1; if it is 0, then 'ifindex'
20929
 * may be NULL.
20930
 *
20931
 * Argument constraints: in range 0 to 4,294,967,295
20932
 *
20933
 * The caller retains ownership of the arguments. */
20934
void
20935
ovsrec_interface_set_ifindex(const struct ovsrec_interface *row, const int64_t *ifindex, size_t n_ifindex)
20936
0
{
20937
0
    struct ovsdb_datum datum;
20938
20939
0
    datum.refcnt = NULL;
20940
20941
0
    if (n_ifindex) {
20942
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
20943
0
        datum.n = 1;
20944
0
        datum.keys = key;
20945
0
        key->integer = *ifindex;
20946
0
    } else {
20947
0
        datum.n = 0;
20948
0
        datum.keys = NULL;
20949
0
    }
20950
0
    datum.values = NULL;
20951
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ifindex, &datum);
20952
0
}
20953
20954
/* Sets the "ingress_policing_burst" column from the "Interface" table in 'row' to
20955
 * 'ingress_policing_burst'.
20956
 *
20957
 * Argument constraints: at least 0
20958
 *
20959
 * The caller retains ownership of the arguments. */
20960
void
20961
ovsrec_interface_set_ingress_policing_burst(const struct ovsrec_interface *row, int64_t ingress_policing_burst)
20962
0
{
20963
0
    struct ovsdb_datum datum;
20964
20965
0
    datum.refcnt = NULL;
20966
20967
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
20968
20969
0
    datum.n = 1;
20970
0
    datum.keys = key;
20971
0
    key->integer = ingress_policing_burst;
20972
0
    datum.values = NULL;
20973
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ingress_policing_burst, &datum);
20974
0
}
20975
20976
/* Sets the "ingress_policing_kpkts_burst" column from the "Interface" table in 'row' to
20977
 * 'ingress_policing_kpkts_burst'.
20978
 *
20979
 * Argument constraints: at least 0
20980
 *
20981
 * The caller retains ownership of the arguments. */
20982
void
20983
ovsrec_interface_set_ingress_policing_kpkts_burst(const struct ovsrec_interface *row, int64_t ingress_policing_kpkts_burst)
20984
0
{
20985
0
    struct ovsdb_datum datum;
20986
20987
0
    datum.refcnt = NULL;
20988
20989
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
20990
20991
0
    datum.n = 1;
20992
0
    datum.keys = key;
20993
0
    key->integer = ingress_policing_kpkts_burst;
20994
0
    datum.values = NULL;
20995
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_burst, &datum);
20996
0
}
20997
20998
/* Sets the "ingress_policing_kpkts_rate" column from the "Interface" table in 'row' to
20999
 * 'ingress_policing_kpkts_rate'.
21000
 *
21001
 * Argument constraints: at least 0
21002
 *
21003
 * The caller retains ownership of the arguments. */
21004
void
21005
ovsrec_interface_set_ingress_policing_kpkts_rate(const struct ovsrec_interface *row, int64_t ingress_policing_kpkts_rate)
21006
0
{
21007
0
    struct ovsdb_datum datum;
21008
21009
0
    datum.refcnt = NULL;
21010
21011
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
21012
21013
0
    datum.n = 1;
21014
0
    datum.keys = key;
21015
0
    key->integer = ingress_policing_kpkts_rate;
21016
0
    datum.values = NULL;
21017
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ingress_policing_kpkts_rate, &datum);
21018
0
}
21019
21020
/* Sets the "ingress_policing_rate" column from the "Interface" table in 'row' to
21021
 * 'ingress_policing_rate'.
21022
 *
21023
 * Argument constraints: at least 0
21024
 *
21025
 * The caller retains ownership of the arguments. */
21026
void
21027
ovsrec_interface_set_ingress_policing_rate(const struct ovsrec_interface *row, int64_t ingress_policing_rate)
21028
0
{
21029
0
    struct ovsdb_datum datum;
21030
21031
0
    datum.refcnt = NULL;
21032
21033
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
21034
21035
0
    datum.n = 1;
21036
0
    datum.keys = key;
21037
0
    key->integer = ingress_policing_rate;
21038
0
    datum.values = NULL;
21039
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ingress_policing_rate, &datum);
21040
0
}
21041
21042
/* Sets the "lacp_current" column from the "Interface" table in 'row' to
21043
 * the 'lacp_current' set with 'n_lacp_current' entries.
21044
 *
21045
 * 'n_lacp_current' may be 0 or 1; if it is 0, then 'lacp_current'
21046
 * may be NULL.
21047
 *
21048
 * The caller retains ownership of the arguments. */
21049
void
21050
ovsrec_interface_set_lacp_current(const struct ovsrec_interface *row, const bool *lacp_current, size_t n_lacp_current)
21051
0
{
21052
0
    struct ovsdb_datum datum;
21053
21054
0
    datum.refcnt = NULL;
21055
21056
0
    if (n_lacp_current) {
21057
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21058
0
        datum.n = 1;
21059
0
        datum.keys = key;
21060
0
        key->boolean = *lacp_current;
21061
0
    } else {
21062
0
        datum.n = 0;
21063
0
        datum.keys = NULL;
21064
0
    }
21065
0
    datum.values = NULL;
21066
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_lacp_current, &datum);
21067
0
}
21068
21069
/* Sets the "link_resets" column from the "Interface" table in 'row' to
21070
 * the 'link_resets' set with 'n_link_resets' entries.
21071
 *
21072
 * 'n_link_resets' may be 0 or 1; if it is 0, then 'link_resets'
21073
 * may be NULL.
21074
 *
21075
 * The caller retains ownership of the arguments. */
21076
void
21077
ovsrec_interface_set_link_resets(const struct ovsrec_interface *row, const int64_t *link_resets, size_t n_link_resets)
21078
0
{
21079
0
    struct ovsdb_datum datum;
21080
21081
0
    datum.refcnt = NULL;
21082
21083
0
    if (n_link_resets) {
21084
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21085
0
        datum.n = 1;
21086
0
        datum.keys = key;
21087
0
        key->integer = *link_resets;
21088
0
    } else {
21089
0
        datum.n = 0;
21090
0
        datum.keys = NULL;
21091
0
    }
21092
0
    datum.values = NULL;
21093
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_link_resets, &datum);
21094
0
}
21095
21096
/* Sets the "link_speed" column from the "Interface" table in 'row' to
21097
 * the 'link_speed' set with 'n_link_speed' entries.
21098
 *
21099
 * 'n_link_speed' may be 0 or 1; if it is 0, then 'link_speed'
21100
 * may be NULL.
21101
 *
21102
 * The caller retains ownership of the arguments. */
21103
void
21104
ovsrec_interface_set_link_speed(const struct ovsrec_interface *row, const int64_t *link_speed, size_t n_link_speed)
21105
0
{
21106
0
    struct ovsdb_datum datum;
21107
21108
0
    datum.refcnt = NULL;
21109
21110
0
    if (n_link_speed) {
21111
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21112
0
        datum.n = 1;
21113
0
        datum.keys = key;
21114
0
        key->integer = *link_speed;
21115
0
    } else {
21116
0
        datum.n = 0;
21117
0
        datum.keys = NULL;
21118
0
    }
21119
0
    datum.values = NULL;
21120
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_link_speed, &datum);
21121
0
}
21122
21123
/* Sets the "link_state" column from the "Interface" table in 'row' to
21124
 * the 'link_state' set.
21125
 *
21126
 * If "link_state" is null, the column will be the empty set,
21127
 * otherwise it will contain the specified value.
21128
 *
21129
 * Argument constraints: either "down" or "up"
21130
 *
21131
 * The caller retains ownership of the arguments. */
21132
void
21133
ovsrec_interface_set_link_state(const struct ovsrec_interface *row, const char *link_state)
21134
0
{
21135
0
    struct ovsdb_datum datum;
21136
21137
0
    datum.refcnt = NULL;
21138
21139
0
    if (link_state) {
21140
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21141
0
        datum.n = 1;
21142
0
        datum.keys = key;
21143
0
        key->s = ovsdb_atom_string_create(link_state);
21144
0
    } else {
21145
0
        datum.n = 0;
21146
0
        datum.keys = NULL;
21147
0
    }
21148
0
    datum.values = NULL;
21149
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_link_state, &datum);
21150
0
}
21151
21152
/* Sets the "lldp" column's value from the "Interface" table in 'row'
21153
 * to 'lldp'.
21154
 *
21155
 * The caller retains ownership of 'lldp' and everything in it. */
21156
void
21157
ovsrec_interface_set_lldp(const struct ovsrec_interface *row, const struct smap *lldp)
21158
0
{
21159
0
    struct ovsdb_datum datum;
21160
21161
0
    if (lldp) {
21162
0
        ovsdb_datum_from_smap(&datum, lldp);
21163
0
    } else {
21164
0
        ovsdb_datum_init_empty(&datum);
21165
0
    }
21166
0
    ovsdb_idl_txn_write(&row->header_,
21167
0
                        &ovsrec_interface_col_lldp,
21168
0
                        &datum);
21169
0
}
21170
21171
21172
/* Sets the "mac" column from the "Interface" table in 'row' to
21173
 * the 'mac' set.
21174
 *
21175
 * If "mac" is null, the column will be the empty set,
21176
 * otherwise it will contain the specified value.
21177
 *
21178
 * The caller retains ownership of the arguments. */
21179
void
21180
ovsrec_interface_set_mac(const struct ovsrec_interface *row, const char *mac)
21181
0
{
21182
0
    struct ovsdb_datum datum;
21183
21184
0
    datum.refcnt = NULL;
21185
21186
0
    if (mac) {
21187
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21188
0
        datum.n = 1;
21189
0
        datum.keys = key;
21190
0
        key->s = ovsdb_atom_string_create(mac);
21191
0
    } else {
21192
0
        datum.n = 0;
21193
0
        datum.keys = NULL;
21194
0
    }
21195
0
    datum.values = NULL;
21196
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_mac, &datum);
21197
0
}
21198
21199
/* Sets the "mac_in_use" column from the "Interface" table in 'row' to
21200
 * the 'mac_in_use' set.
21201
 *
21202
 * If "mac_in_use" is null, the column will be the empty set,
21203
 * otherwise it will contain the specified value.
21204
 *
21205
 * The caller retains ownership of the arguments. */
21206
void
21207
ovsrec_interface_set_mac_in_use(const struct ovsrec_interface *row, const char *mac_in_use)
21208
0
{
21209
0
    struct ovsdb_datum datum;
21210
21211
0
    datum.refcnt = NULL;
21212
21213
0
    if (mac_in_use) {
21214
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21215
0
        datum.n = 1;
21216
0
        datum.keys = key;
21217
0
        key->s = ovsdb_atom_string_create(mac_in_use);
21218
0
    } else {
21219
0
        datum.n = 0;
21220
0
        datum.keys = NULL;
21221
0
    }
21222
0
    datum.values = NULL;
21223
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_mac_in_use, &datum);
21224
0
}
21225
21226
/* Sets the "mtu" column from the "Interface" table in 'row' to
21227
 * the 'mtu' set with 'n_mtu' entries.
21228
 *
21229
 * 'n_mtu' may be 0 or 1; if it is 0, then 'mtu'
21230
 * may be NULL.
21231
 *
21232
 * The caller retains ownership of the arguments. */
21233
void
21234
ovsrec_interface_set_mtu(const struct ovsrec_interface *row, const int64_t *mtu, size_t n_mtu)
21235
0
{
21236
0
    struct ovsdb_datum datum;
21237
21238
0
    datum.refcnt = NULL;
21239
21240
0
    if (n_mtu) {
21241
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21242
0
        datum.n = 1;
21243
0
        datum.keys = key;
21244
0
        key->integer = *mtu;
21245
0
    } else {
21246
0
        datum.n = 0;
21247
0
        datum.keys = NULL;
21248
0
    }
21249
0
    datum.values = NULL;
21250
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_mtu, &datum);
21251
0
}
21252
21253
/* Sets the "mtu_request" column from the "Interface" table in 'row' to
21254
 * the 'mtu_request' set with 'n_mtu_request' entries.
21255
 *
21256
 * 'n_mtu_request' may be 0 or 1; if it is 0, then 'mtu_request'
21257
 * may be NULL.
21258
 *
21259
 * Argument constraints: at least 1
21260
 *
21261
 * The caller retains ownership of the arguments. */
21262
void
21263
ovsrec_interface_set_mtu_request(const struct ovsrec_interface *row, const int64_t *mtu_request, size_t n_mtu_request)
21264
0
{
21265
0
    struct ovsdb_datum datum;
21266
21267
0
    datum.refcnt = NULL;
21268
21269
0
    if (n_mtu_request) {
21270
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21271
0
        datum.n = 1;
21272
0
        datum.keys = key;
21273
0
        key->integer = *mtu_request;
21274
0
    } else {
21275
0
        datum.n = 0;
21276
0
        datum.keys = NULL;
21277
0
    }
21278
0
    datum.values = NULL;
21279
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_mtu_request, &datum);
21280
0
}
21281
21282
/* Sets the "name" column from the "Interface" table in 'row' to
21283
 * 'name'.
21284
 *
21285
 * The caller retains ownership of the arguments. */
21286
void
21287
ovsrec_interface_set_name(const struct ovsrec_interface *row, const char *name)
21288
0
{
21289
0
    struct ovsdb_datum datum;
21290
21291
0
    datum.refcnt = NULL;
21292
21293
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
21294
21295
0
    datum.n = 1;
21296
0
    datum.keys = key;
21297
0
    key->s = ovsdb_atom_string_create(name);
21298
0
    datum.values = NULL;
21299
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_name, &datum);
21300
0
}
21301
21302
/* Sets the "ofport" column from the "Interface" table in 'row' to
21303
 * the 'ofport' set with 'n_ofport' entries.
21304
 *
21305
 * 'n_ofport' may be 0 or 1; if it is 0, then 'ofport'
21306
 * may be NULL.
21307
 *
21308
 * The caller retains ownership of the arguments. */
21309
void
21310
ovsrec_interface_set_ofport(const struct ovsrec_interface *row, const int64_t *ofport, size_t n_ofport)
21311
0
{
21312
0
    struct ovsdb_datum datum;
21313
21314
0
    datum.refcnt = NULL;
21315
21316
0
    if (n_ofport) {
21317
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21318
0
        datum.n = 1;
21319
0
        datum.keys = key;
21320
0
        key->integer = *ofport;
21321
0
    } else {
21322
0
        datum.n = 0;
21323
0
        datum.keys = NULL;
21324
0
    }
21325
0
    datum.values = NULL;
21326
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ofport, &datum);
21327
0
}
21328
21329
/* Sets the "ofport_request" column from the "Interface" table in 'row' to
21330
 * the 'ofport_request' set with 'n_ofport_request' entries.
21331
 *
21332
 * 'n_ofport_request' may be 0 or 1; if it is 0, then 'ofport_request'
21333
 * may be NULL.
21334
 *
21335
 * Argument constraints: in range 1 to 65,279
21336
 *
21337
 * The caller retains ownership of the arguments. */
21338
void
21339
ovsrec_interface_set_ofport_request(const struct ovsrec_interface *row, const int64_t *ofport_request, size_t n_ofport_request)
21340
0
{
21341
0
    struct ovsdb_datum datum;
21342
21343
0
    datum.refcnt = NULL;
21344
21345
0
    if (n_ofport_request) {
21346
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
21347
0
        datum.n = 1;
21348
0
        datum.keys = key;
21349
0
        key->integer = *ofport_request;
21350
0
    } else {
21351
0
        datum.n = 0;
21352
0
        datum.keys = NULL;
21353
0
    }
21354
0
    datum.values = NULL;
21355
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_ofport_request, &datum);
21356
0
}
21357
21358
/* Sets the "options" column's value from the "Interface" table in 'row'
21359
 * to 'options'.
21360
 *
21361
 * The caller retains ownership of 'options' and everything in it. */
21362
void
21363
ovsrec_interface_set_options(const struct ovsrec_interface *row, const struct smap *options)
21364
0
{
21365
0
    struct ovsdb_datum datum;
21366
21367
0
    if (options) {
21368
0
        ovsdb_datum_from_smap(&datum, options);
21369
0
    } else {
21370
0
        ovsdb_datum_init_empty(&datum);
21371
0
    }
21372
0
    ovsdb_idl_txn_write(&row->header_,
21373
0
                        &ovsrec_interface_col_options,
21374
0
                        &datum);
21375
0
}
21376
21377
21378
/* Sets the "other_config" column's value from the "Interface" table in 'row'
21379
 * to 'other_config'.
21380
 *
21381
 * The caller retains ownership of 'other_config' and everything in it. */
21382
void
21383
ovsrec_interface_set_other_config(const struct ovsrec_interface *row, const struct smap *other_config)
21384
0
{
21385
0
    struct ovsdb_datum datum;
21386
21387
0
    if (other_config) {
21388
0
        ovsdb_datum_from_smap(&datum, other_config);
21389
0
    } else {
21390
0
        ovsdb_datum_init_empty(&datum);
21391
0
    }
21392
0
    ovsdb_idl_txn_write(&row->header_,
21393
0
                        &ovsrec_interface_col_other_config,
21394
0
                        &datum);
21395
0
}
21396
21397
21398
/* Sets the "statistics" column from the "Interface" table in 'row' to
21399
 * the map with keys 'key_statistics' and values 'value_statistics'
21400
 * with 'n_statistics' entries.
21401
 *
21402
 * The caller retains ownership of the arguments. */
21403
void
21404
ovsrec_interface_set_statistics(const struct ovsrec_interface *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
21405
0
{
21406
0
    struct ovsdb_datum datum;
21407
21408
0
    datum.refcnt = NULL;
21409
21410
0
    datum.n = n_statistics;
21411
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
21412
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
21413
0
    for (size_t i = 0; i < n_statistics; i++) {
21414
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
21415
0
        datum.values[i].integer = value_statistics[i];
21416
0
    }
21417
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_statistics, &datum);
21418
0
}
21419
21420
/* Sets the "status" column's value from the "Interface" table in 'row'
21421
 * to 'status'.
21422
 *
21423
 * The caller retains ownership of 'status' and everything in it. */
21424
void
21425
ovsrec_interface_set_status(const struct ovsrec_interface *row, const struct smap *status)
21426
0
{
21427
0
    struct ovsdb_datum datum;
21428
21429
0
    if (status) {
21430
0
        ovsdb_datum_from_smap(&datum, status);
21431
0
    } else {
21432
0
        ovsdb_datum_init_empty(&datum);
21433
0
    }
21434
0
    ovsdb_idl_txn_write(&row->header_,
21435
0
                        &ovsrec_interface_col_status,
21436
0
                        &datum);
21437
0
}
21438
21439
21440
/* Sets the "type" column from the "Interface" table in 'row' to
21441
 * 'type'.
21442
 *
21443
 * The caller retains ownership of the arguments. */
21444
void
21445
ovsrec_interface_set_type(const struct ovsrec_interface *row, const char *type)
21446
0
{
21447
0
    struct ovsdb_datum datum;
21448
21449
0
    datum.refcnt = NULL;
21450
21451
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
21452
21453
0
    datum.n = 1;
21454
0
    datum.keys = key;
21455
0
    key->s = ovsdb_atom_string_create(type);
21456
0
    datum.values = NULL;
21457
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_col_type, &datum);
21458
0
}
21459
21460
/* Adds the value 'new_value' to the "admin_state" set column from the "Interface" table
21461
 * in 'row'.
21462
 *
21463
 */
21464
void
21465
ovsrec_interface_update_admin_state_addvalue(const struct ovsrec_interface *row, const char *new_value)
21466
0
{
21467
0
    struct ovsdb_datum *datum;
21468
21469
0
    datum = xmalloc(sizeof *datum);
21470
0
    datum->n = 1;
21471
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21472
0
    datum->values = NULL;
21473
0
    datum->refcnt = NULL;
21474
21475
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
21476
21477
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
21478
0
                                    &ovsrec_interface_col_admin_state,
21479
0
                                    datum);
21480
0
}
21481
21482
/* Deletes the value 'delete_value' from the "admin_state" set column from the
21483
 * "Interface" table in 'row'.
21484
 *
21485
 */
21486
void
21487
ovsrec_interface_update_admin_state_delvalue(const struct ovsrec_interface *row, const char *delete_value)
21488
0
{
21489
0
    struct ovsdb_datum *datum;
21490
21491
0
    datum = xmalloc(sizeof *datum);
21492
0
    datum->n = 1;
21493
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21494
0
    datum->values = NULL;
21495
0
    datum->refcnt = NULL;
21496
21497
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
21498
21499
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
21500
0
                                    &ovsrec_interface_col_admin_state,
21501
0
                                    datum);
21502
0
}
21503
21504
/* Sets an element of the "bfd" map column from the "Interface" table in 'row'
21505
 * to 'new_value' given the key value 'new_key'.
21506
 *
21507
 */
21508
void
21509
ovsrec_interface_update_bfd_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
21510
0
{
21511
0
    struct ovsdb_datum *datum;
21512
21513
0
    datum = xmalloc(sizeof *datum);
21514
0
    datum->n = 1;
21515
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
21516
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
21517
0
    datum->refcnt = NULL;
21518
21519
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
21520
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
21521
21522
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
21523
0
                                    &ovsrec_interface_col_bfd,
21524
0
                                    datum);
21525
0
}
21526
21527
/* Deletes an element of the "bfd" map column from the "Interface" table in 'row'
21528
 * given the key value 'delete_key'.
21529
 *
21530
 */
21531
void
21532
ovsrec_interface_update_bfd_delkey(const struct ovsrec_interface *row, const char *delete_key)
21533
0
{
21534
0
    struct ovsdb_datum *datum;
21535
21536
0
    datum = xmalloc(sizeof *datum);
21537
0
    datum->n = 1;
21538
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
21539
0
    datum->values = NULL;
21540
0
    datum->refcnt = NULL;
21541
21542
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
21543
21544
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
21545
0
                                    &ovsrec_interface_col_bfd,
21546
0
                                    datum);
21547
0
}
21548
21549
/* Sets an element of the "bfd_status" map column from the "Interface" table in 'row'
21550
 * to 'new_value' given the key value 'new_key'.
21551
 *
21552
 */
21553
void
21554
ovsrec_interface_update_bfd_status_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
21555
0
{
21556
0
    struct ovsdb_datum *datum;
21557
21558
0
    datum = xmalloc(sizeof *datum);
21559
0
    datum->n = 1;
21560
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
21561
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
21562
0
    datum->refcnt = NULL;
21563
21564
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
21565
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
21566
21567
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
21568
0
                                    &ovsrec_interface_col_bfd_status,
21569
0
                                    datum);
21570
0
}
21571
21572
/* Deletes an element of the "bfd_status" map column from the "Interface" table in 'row'
21573
 * given the key value 'delete_key'.
21574
 *
21575
 */
21576
void
21577
ovsrec_interface_update_bfd_status_delkey(const struct ovsrec_interface *row, const char *delete_key)
21578
0
{
21579
0
    struct ovsdb_datum *datum;
21580
21581
0
    datum = xmalloc(sizeof *datum);
21582
0
    datum->n = 1;
21583
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
21584
0
    datum->values = NULL;
21585
0
    datum->refcnt = NULL;
21586
21587
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
21588
21589
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
21590
0
                                    &ovsrec_interface_col_bfd_status,
21591
0
                                    datum);
21592
0
}
21593
21594
/* Adds the value 'new_value' to the "cfm_fault" set column from the "Interface" table
21595
 * in 'row'.
21596
 *
21597
 */
21598
void
21599
ovsrec_interface_update_cfm_fault_addvalue(const struct ovsrec_interface *row, bool new_value)
21600
0
{
21601
0
    struct ovsdb_datum *datum;
21602
21603
0
    datum = xmalloc(sizeof *datum);
21604
0
    datum->n = 1;
21605
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21606
0
    datum->values = NULL;
21607
0
    datum->refcnt = NULL;
21608
21609
0
    datum->keys[0].boolean = new_value;
21610
21611
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
21612
0
                                    &ovsrec_interface_col_cfm_fault,
21613
0
                                    datum);
21614
0
}
21615
21616
/* Deletes the value 'delete_value' from the "cfm_fault" set column from the
21617
 * "Interface" table in 'row'.
21618
 *
21619
 */
21620
void
21621
ovsrec_interface_update_cfm_fault_delvalue(const struct ovsrec_interface *row, bool delete_value)
21622
0
{
21623
0
    struct ovsdb_datum *datum;
21624
21625
0
    datum = xmalloc(sizeof *datum);
21626
0
    datum->n = 1;
21627
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21628
0
    datum->values = NULL;
21629
0
    datum->refcnt = NULL;
21630
21631
0
    datum->keys[0].boolean = delete_value;
21632
21633
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
21634
0
                                    &ovsrec_interface_col_cfm_fault,
21635
0
                                    datum);
21636
0
}
21637
21638
/* Adds the value 'new_value' to the "cfm_fault_status" set column from the "Interface" table
21639
 * in 'row'.
21640
 *
21641
 */
21642
void
21643
ovsrec_interface_update_cfm_fault_status_addvalue(const struct ovsrec_interface *row, const char *new_value)
21644
0
{
21645
0
    struct ovsdb_datum *datum;
21646
21647
0
    datum = xmalloc(sizeof *datum);
21648
0
    datum->n = 1;
21649
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21650
0
    datum->values = NULL;
21651
0
    datum->refcnt = NULL;
21652
21653
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
21654
21655
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
21656
0
                                    &ovsrec_interface_col_cfm_fault_status,
21657
0
                                    datum);
21658
0
}
21659
21660
/* Deletes the value 'delete_value' from the "cfm_fault_status" set column from the
21661
 * "Interface" table in 'row'.
21662
 *
21663
 */
21664
void
21665
ovsrec_interface_update_cfm_fault_status_delvalue(const struct ovsrec_interface *row, const char *delete_value)
21666
0
{
21667
0
    struct ovsdb_datum *datum;
21668
21669
0
    datum = xmalloc(sizeof *datum);
21670
0
    datum->n = 1;
21671
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21672
0
    datum->values = NULL;
21673
0
    datum->refcnt = NULL;
21674
21675
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
21676
21677
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
21678
0
                                    &ovsrec_interface_col_cfm_fault_status,
21679
0
                                    datum);
21680
0
}
21681
21682
/* Adds the value 'new_value' to the "cfm_flap_count" set column from the "Interface" table
21683
 * in 'row'.
21684
 *
21685
 */
21686
void
21687
ovsrec_interface_update_cfm_flap_count_addvalue(const struct ovsrec_interface *row, int64_t new_value)
21688
0
{
21689
0
    struct ovsdb_datum *datum;
21690
21691
0
    datum = xmalloc(sizeof *datum);
21692
0
    datum->n = 1;
21693
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21694
0
    datum->values = NULL;
21695
0
    datum->refcnt = NULL;
21696
21697
0
    datum->keys[0].integer = new_value;
21698
21699
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
21700
0
                                    &ovsrec_interface_col_cfm_flap_count,
21701
0
                                    datum);
21702
0
}
21703
21704
/* Deletes the value 'delete_value' from the "cfm_flap_count" set column from the
21705
 * "Interface" table in 'row'.
21706
 *
21707
 */
21708
void
21709
ovsrec_interface_update_cfm_flap_count_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
21710
0
{
21711
0
    struct ovsdb_datum *datum;
21712
21713
0
    datum = xmalloc(sizeof *datum);
21714
0
    datum->n = 1;
21715
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21716
0
    datum->values = NULL;
21717
0
    datum->refcnt = NULL;
21718
21719
0
    datum->keys[0].integer = delete_value;
21720
21721
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
21722
0
                                    &ovsrec_interface_col_cfm_flap_count,
21723
0
                                    datum);
21724
0
}
21725
21726
/* Adds the value 'new_value' to the "cfm_health" set column from the "Interface" table
21727
 * in 'row'.
21728
 *
21729
 */
21730
void
21731
ovsrec_interface_update_cfm_health_addvalue(const struct ovsrec_interface *row, int64_t new_value)
21732
0
{
21733
0
    struct ovsdb_datum *datum;
21734
21735
0
    datum = xmalloc(sizeof *datum);
21736
0
    datum->n = 1;
21737
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21738
0
    datum->values = NULL;
21739
0
    datum->refcnt = NULL;
21740
21741
0
    datum->keys[0].integer = new_value;
21742
21743
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
21744
0
                                    &ovsrec_interface_col_cfm_health,
21745
0
                                    datum);
21746
0
}
21747
21748
/* Deletes the value 'delete_value' from the "cfm_health" set column from the
21749
 * "Interface" table in 'row'.
21750
 *
21751
 */
21752
void
21753
ovsrec_interface_update_cfm_health_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
21754
0
{
21755
0
    struct ovsdb_datum *datum;
21756
21757
0
    datum = xmalloc(sizeof *datum);
21758
0
    datum->n = 1;
21759
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21760
0
    datum->values = NULL;
21761
0
    datum->refcnt = NULL;
21762
21763
0
    datum->keys[0].integer = delete_value;
21764
21765
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
21766
0
                                    &ovsrec_interface_col_cfm_health,
21767
0
                                    datum);
21768
0
}
21769
21770
/* Adds the value 'new_value' to the "cfm_mpid" set column from the "Interface" table
21771
 * in 'row'.
21772
 *
21773
 */
21774
void
21775
ovsrec_interface_update_cfm_mpid_addvalue(const struct ovsrec_interface *row, int64_t new_value)
21776
0
{
21777
0
    struct ovsdb_datum *datum;
21778
21779
0
    datum = xmalloc(sizeof *datum);
21780
0
    datum->n = 1;
21781
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21782
0
    datum->values = NULL;
21783
0
    datum->refcnt = NULL;
21784
21785
0
    datum->keys[0].integer = new_value;
21786
21787
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
21788
0
                                    &ovsrec_interface_col_cfm_mpid,
21789
0
                                    datum);
21790
0
}
21791
21792
/* Deletes the value 'delete_value' from the "cfm_mpid" set column from the
21793
 * "Interface" table in 'row'.
21794
 *
21795
 */
21796
void
21797
ovsrec_interface_update_cfm_mpid_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
21798
0
{
21799
0
    struct ovsdb_datum *datum;
21800
21801
0
    datum = xmalloc(sizeof *datum);
21802
0
    datum->n = 1;
21803
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21804
0
    datum->values = NULL;
21805
0
    datum->refcnt = NULL;
21806
21807
0
    datum->keys[0].integer = delete_value;
21808
21809
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
21810
0
                                    &ovsrec_interface_col_cfm_mpid,
21811
0
                                    datum);
21812
0
}
21813
21814
/* Adds the value 'new_value' to the "cfm_remote_mpids" set column from the "Interface" table
21815
 * in 'row'.
21816
 *
21817
 */
21818
void
21819
ovsrec_interface_update_cfm_remote_mpids_addvalue(const struct ovsrec_interface *row, int64_t new_value)
21820
0
{
21821
0
    struct ovsdb_datum *datum;
21822
21823
0
    datum = xmalloc(sizeof *datum);
21824
0
    datum->n = 1;
21825
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21826
0
    datum->values = NULL;
21827
0
    datum->refcnt = NULL;
21828
21829
0
    datum->keys[0].integer = new_value;
21830
21831
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
21832
0
                                    &ovsrec_interface_col_cfm_remote_mpids,
21833
0
                                    datum);
21834
0
}
21835
21836
/* Deletes the value 'delete_value' from the "cfm_remote_mpids" set column from the
21837
 * "Interface" table in 'row'.
21838
 *
21839
 */
21840
void
21841
ovsrec_interface_update_cfm_remote_mpids_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
21842
0
{
21843
0
    struct ovsdb_datum *datum;
21844
21845
0
    datum = xmalloc(sizeof *datum);
21846
0
    datum->n = 1;
21847
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21848
0
    datum->values = NULL;
21849
0
    datum->refcnt = NULL;
21850
21851
0
    datum->keys[0].integer = delete_value;
21852
21853
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
21854
0
                                    &ovsrec_interface_col_cfm_remote_mpids,
21855
0
                                    datum);
21856
0
}
21857
21858
/* Adds the value 'new_value' to the "cfm_remote_opstate" set column from the "Interface" table
21859
 * in 'row'.
21860
 *
21861
 */
21862
void
21863
ovsrec_interface_update_cfm_remote_opstate_addvalue(const struct ovsrec_interface *row, const char *new_value)
21864
0
{
21865
0
    struct ovsdb_datum *datum;
21866
21867
0
    datum = xmalloc(sizeof *datum);
21868
0
    datum->n = 1;
21869
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21870
0
    datum->values = NULL;
21871
0
    datum->refcnt = NULL;
21872
21873
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
21874
21875
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
21876
0
                                    &ovsrec_interface_col_cfm_remote_opstate,
21877
0
                                    datum);
21878
0
}
21879
21880
/* Deletes the value 'delete_value' from the "cfm_remote_opstate" set column from the
21881
 * "Interface" table in 'row'.
21882
 *
21883
 */
21884
void
21885
ovsrec_interface_update_cfm_remote_opstate_delvalue(const struct ovsrec_interface *row, const char *delete_value)
21886
0
{
21887
0
    struct ovsdb_datum *datum;
21888
21889
0
    datum = xmalloc(sizeof *datum);
21890
0
    datum->n = 1;
21891
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21892
0
    datum->values = NULL;
21893
0
    datum->refcnt = NULL;
21894
21895
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
21896
21897
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
21898
0
                                    &ovsrec_interface_col_cfm_remote_opstate,
21899
0
                                    datum);
21900
0
}
21901
21902
/* Adds the value 'new_value' to the "duplex" set column from the "Interface" table
21903
 * in 'row'.
21904
 *
21905
 */
21906
void
21907
ovsrec_interface_update_duplex_addvalue(const struct ovsrec_interface *row, const char *new_value)
21908
0
{
21909
0
    struct ovsdb_datum *datum;
21910
21911
0
    datum = xmalloc(sizeof *datum);
21912
0
    datum->n = 1;
21913
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21914
0
    datum->values = NULL;
21915
0
    datum->refcnt = NULL;
21916
21917
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
21918
21919
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
21920
0
                                    &ovsrec_interface_col_duplex,
21921
0
                                    datum);
21922
0
}
21923
21924
/* Deletes the value 'delete_value' from the "duplex" set column from the
21925
 * "Interface" table in 'row'.
21926
 *
21927
 */
21928
void
21929
ovsrec_interface_update_duplex_delvalue(const struct ovsrec_interface *row, const char *delete_value)
21930
0
{
21931
0
    struct ovsdb_datum *datum;
21932
21933
0
    datum = xmalloc(sizeof *datum);
21934
0
    datum->n = 1;
21935
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21936
0
    datum->values = NULL;
21937
0
    datum->refcnt = NULL;
21938
21939
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
21940
21941
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
21942
0
                                    &ovsrec_interface_col_duplex,
21943
0
                                    datum);
21944
0
}
21945
21946
/* Adds the value 'new_value' to the "error" set column from the "Interface" table
21947
 * in 'row'.
21948
 *
21949
 */
21950
void
21951
ovsrec_interface_update_error_addvalue(const struct ovsrec_interface *row, const char *new_value)
21952
0
{
21953
0
    struct ovsdb_datum *datum;
21954
21955
0
    datum = xmalloc(sizeof *datum);
21956
0
    datum->n = 1;
21957
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21958
0
    datum->values = NULL;
21959
0
    datum->refcnt = NULL;
21960
21961
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
21962
21963
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
21964
0
                                    &ovsrec_interface_col_error,
21965
0
                                    datum);
21966
0
}
21967
21968
/* Deletes the value 'delete_value' from the "error" set column from the
21969
 * "Interface" table in 'row'.
21970
 *
21971
 */
21972
void
21973
ovsrec_interface_update_error_delvalue(const struct ovsrec_interface *row, const char *delete_value)
21974
0
{
21975
0
    struct ovsdb_datum *datum;
21976
21977
0
    datum = xmalloc(sizeof *datum);
21978
0
    datum->n = 1;
21979
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
21980
0
    datum->values = NULL;
21981
0
    datum->refcnt = NULL;
21982
21983
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
21984
21985
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
21986
0
                                    &ovsrec_interface_col_error,
21987
0
                                    datum);
21988
0
}
21989
21990
/* Sets an element of the "external_ids" map column from the "Interface" table in 'row'
21991
 * to 'new_value' given the key value 'new_key'.
21992
 *
21993
 */
21994
void
21995
ovsrec_interface_update_external_ids_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
21996
0
{
21997
0
    struct ovsdb_datum *datum;
21998
21999
0
    datum = xmalloc(sizeof *datum);
22000
0
    datum->n = 1;
22001
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22002
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
22003
0
    datum->refcnt = NULL;
22004
22005
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
22006
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
22007
22008
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
22009
0
                                    &ovsrec_interface_col_external_ids,
22010
0
                                    datum);
22011
0
}
22012
22013
/* Deletes an element of the "external_ids" map column from the "Interface" table in 'row'
22014
 * given the key value 'delete_key'.
22015
 *
22016
 */
22017
void
22018
ovsrec_interface_update_external_ids_delkey(const struct ovsrec_interface *row, const char *delete_key)
22019
0
{
22020
0
    struct ovsdb_datum *datum;
22021
22022
0
    datum = xmalloc(sizeof *datum);
22023
0
    datum->n = 1;
22024
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22025
0
    datum->values = NULL;
22026
0
    datum->refcnt = NULL;
22027
22028
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
22029
22030
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
22031
0
                                    &ovsrec_interface_col_external_ids,
22032
0
                                    datum);
22033
0
}
22034
22035
/* Adds the value 'new_value' to the "ifindex" set column from the "Interface" table
22036
 * in 'row'.
22037
 *
22038
 */
22039
void
22040
ovsrec_interface_update_ifindex_addvalue(const struct ovsrec_interface *row, int64_t new_value)
22041
0
{
22042
0
    struct ovsdb_datum *datum;
22043
22044
0
    datum = xmalloc(sizeof *datum);
22045
0
    datum->n = 1;
22046
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22047
0
    datum->values = NULL;
22048
0
    datum->refcnt = NULL;
22049
22050
0
    datum->keys[0].integer = new_value;
22051
22052
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22053
0
                                    &ovsrec_interface_col_ifindex,
22054
0
                                    datum);
22055
0
}
22056
22057
/* Deletes the value 'delete_value' from the "ifindex" set column from the
22058
 * "Interface" table in 'row'.
22059
 *
22060
 */
22061
void
22062
ovsrec_interface_update_ifindex_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
22063
0
{
22064
0
    struct ovsdb_datum *datum;
22065
22066
0
    datum = xmalloc(sizeof *datum);
22067
0
    datum->n = 1;
22068
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22069
0
    datum->values = NULL;
22070
0
    datum->refcnt = NULL;
22071
22072
0
    datum->keys[0].integer = delete_value;
22073
22074
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22075
0
                                    &ovsrec_interface_col_ifindex,
22076
0
                                    datum);
22077
0
}
22078
22079
/* Adds the value 'new_value' to the "lacp_current" set column from the "Interface" table
22080
 * in 'row'.
22081
 *
22082
 */
22083
void
22084
ovsrec_interface_update_lacp_current_addvalue(const struct ovsrec_interface *row, bool new_value)
22085
0
{
22086
0
    struct ovsdb_datum *datum;
22087
22088
0
    datum = xmalloc(sizeof *datum);
22089
0
    datum->n = 1;
22090
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22091
0
    datum->values = NULL;
22092
0
    datum->refcnt = NULL;
22093
22094
0
    datum->keys[0].boolean = new_value;
22095
22096
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22097
0
                                    &ovsrec_interface_col_lacp_current,
22098
0
                                    datum);
22099
0
}
22100
22101
/* Deletes the value 'delete_value' from the "lacp_current" set column from the
22102
 * "Interface" table in 'row'.
22103
 *
22104
 */
22105
void
22106
ovsrec_interface_update_lacp_current_delvalue(const struct ovsrec_interface *row, bool delete_value)
22107
0
{
22108
0
    struct ovsdb_datum *datum;
22109
22110
0
    datum = xmalloc(sizeof *datum);
22111
0
    datum->n = 1;
22112
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22113
0
    datum->values = NULL;
22114
0
    datum->refcnt = NULL;
22115
22116
0
    datum->keys[0].boolean = delete_value;
22117
22118
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22119
0
                                    &ovsrec_interface_col_lacp_current,
22120
0
                                    datum);
22121
0
}
22122
22123
/* Adds the value 'new_value' to the "link_resets" set column from the "Interface" table
22124
 * in 'row'.
22125
 *
22126
 */
22127
void
22128
ovsrec_interface_update_link_resets_addvalue(const struct ovsrec_interface *row, int64_t new_value)
22129
0
{
22130
0
    struct ovsdb_datum *datum;
22131
22132
0
    datum = xmalloc(sizeof *datum);
22133
0
    datum->n = 1;
22134
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22135
0
    datum->values = NULL;
22136
0
    datum->refcnt = NULL;
22137
22138
0
    datum->keys[0].integer = new_value;
22139
22140
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22141
0
                                    &ovsrec_interface_col_link_resets,
22142
0
                                    datum);
22143
0
}
22144
22145
/* Deletes the value 'delete_value' from the "link_resets" set column from the
22146
 * "Interface" table in 'row'.
22147
 *
22148
 */
22149
void
22150
ovsrec_interface_update_link_resets_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
22151
0
{
22152
0
    struct ovsdb_datum *datum;
22153
22154
0
    datum = xmalloc(sizeof *datum);
22155
0
    datum->n = 1;
22156
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22157
0
    datum->values = NULL;
22158
0
    datum->refcnt = NULL;
22159
22160
0
    datum->keys[0].integer = delete_value;
22161
22162
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22163
0
                                    &ovsrec_interface_col_link_resets,
22164
0
                                    datum);
22165
0
}
22166
22167
/* Adds the value 'new_value' to the "link_speed" set column from the "Interface" table
22168
 * in 'row'.
22169
 *
22170
 */
22171
void
22172
ovsrec_interface_update_link_speed_addvalue(const struct ovsrec_interface *row, int64_t new_value)
22173
0
{
22174
0
    struct ovsdb_datum *datum;
22175
22176
0
    datum = xmalloc(sizeof *datum);
22177
0
    datum->n = 1;
22178
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22179
0
    datum->values = NULL;
22180
0
    datum->refcnt = NULL;
22181
22182
0
    datum->keys[0].integer = new_value;
22183
22184
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22185
0
                                    &ovsrec_interface_col_link_speed,
22186
0
                                    datum);
22187
0
}
22188
22189
/* Deletes the value 'delete_value' from the "link_speed" set column from the
22190
 * "Interface" table in 'row'.
22191
 *
22192
 */
22193
void
22194
ovsrec_interface_update_link_speed_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
22195
0
{
22196
0
    struct ovsdb_datum *datum;
22197
22198
0
    datum = xmalloc(sizeof *datum);
22199
0
    datum->n = 1;
22200
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22201
0
    datum->values = NULL;
22202
0
    datum->refcnt = NULL;
22203
22204
0
    datum->keys[0].integer = delete_value;
22205
22206
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22207
0
                                    &ovsrec_interface_col_link_speed,
22208
0
                                    datum);
22209
0
}
22210
22211
/* Adds the value 'new_value' to the "link_state" set column from the "Interface" table
22212
 * in 'row'.
22213
 *
22214
 */
22215
void
22216
ovsrec_interface_update_link_state_addvalue(const struct ovsrec_interface *row, const char *new_value)
22217
0
{
22218
0
    struct ovsdb_datum *datum;
22219
22220
0
    datum = xmalloc(sizeof *datum);
22221
0
    datum->n = 1;
22222
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22223
0
    datum->values = NULL;
22224
0
    datum->refcnt = NULL;
22225
22226
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
22227
22228
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22229
0
                                    &ovsrec_interface_col_link_state,
22230
0
                                    datum);
22231
0
}
22232
22233
/* Deletes the value 'delete_value' from the "link_state" set column from the
22234
 * "Interface" table in 'row'.
22235
 *
22236
 */
22237
void
22238
ovsrec_interface_update_link_state_delvalue(const struct ovsrec_interface *row, const char *delete_value)
22239
0
{
22240
0
    struct ovsdb_datum *datum;
22241
22242
0
    datum = xmalloc(sizeof *datum);
22243
0
    datum->n = 1;
22244
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22245
0
    datum->values = NULL;
22246
0
    datum->refcnt = NULL;
22247
22248
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
22249
22250
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22251
0
                                    &ovsrec_interface_col_link_state,
22252
0
                                    datum);
22253
0
}
22254
22255
/* Sets an element of the "lldp" map column from the "Interface" table in 'row'
22256
 * to 'new_value' given the key value 'new_key'.
22257
 *
22258
 */
22259
void
22260
ovsrec_interface_update_lldp_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
22261
0
{
22262
0
    struct ovsdb_datum *datum;
22263
22264
0
    datum = xmalloc(sizeof *datum);
22265
0
    datum->n = 1;
22266
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22267
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
22268
0
    datum->refcnt = NULL;
22269
22270
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
22271
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
22272
22273
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
22274
0
                                    &ovsrec_interface_col_lldp,
22275
0
                                    datum);
22276
0
}
22277
22278
/* Deletes an element of the "lldp" map column from the "Interface" table in 'row'
22279
 * given the key value 'delete_key'.
22280
 *
22281
 */
22282
void
22283
ovsrec_interface_update_lldp_delkey(const struct ovsrec_interface *row, const char *delete_key)
22284
0
{
22285
0
    struct ovsdb_datum *datum;
22286
22287
0
    datum = xmalloc(sizeof *datum);
22288
0
    datum->n = 1;
22289
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22290
0
    datum->values = NULL;
22291
0
    datum->refcnt = NULL;
22292
22293
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
22294
22295
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
22296
0
                                    &ovsrec_interface_col_lldp,
22297
0
                                    datum);
22298
0
}
22299
22300
/* Adds the value 'new_value' to the "mac" set column from the "Interface" table
22301
 * in 'row'.
22302
 *
22303
 */
22304
void
22305
ovsrec_interface_update_mac_addvalue(const struct ovsrec_interface *row, const char *new_value)
22306
0
{
22307
0
    struct ovsdb_datum *datum;
22308
22309
0
    datum = xmalloc(sizeof *datum);
22310
0
    datum->n = 1;
22311
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22312
0
    datum->values = NULL;
22313
0
    datum->refcnt = NULL;
22314
22315
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
22316
22317
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22318
0
                                    &ovsrec_interface_col_mac,
22319
0
                                    datum);
22320
0
}
22321
22322
/* Deletes the value 'delete_value' from the "mac" set column from the
22323
 * "Interface" table in 'row'.
22324
 *
22325
 */
22326
void
22327
ovsrec_interface_update_mac_delvalue(const struct ovsrec_interface *row, const char *delete_value)
22328
0
{
22329
0
    struct ovsdb_datum *datum;
22330
22331
0
    datum = xmalloc(sizeof *datum);
22332
0
    datum->n = 1;
22333
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22334
0
    datum->values = NULL;
22335
0
    datum->refcnt = NULL;
22336
22337
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
22338
22339
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22340
0
                                    &ovsrec_interface_col_mac,
22341
0
                                    datum);
22342
0
}
22343
22344
/* Adds the value 'new_value' to the "mac_in_use" set column from the "Interface" table
22345
 * in 'row'.
22346
 *
22347
 */
22348
void
22349
ovsrec_interface_update_mac_in_use_addvalue(const struct ovsrec_interface *row, const char *new_value)
22350
0
{
22351
0
    struct ovsdb_datum *datum;
22352
22353
0
    datum = xmalloc(sizeof *datum);
22354
0
    datum->n = 1;
22355
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22356
0
    datum->values = NULL;
22357
0
    datum->refcnt = NULL;
22358
22359
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
22360
22361
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22362
0
                                    &ovsrec_interface_col_mac_in_use,
22363
0
                                    datum);
22364
0
}
22365
22366
/* Deletes the value 'delete_value' from the "mac_in_use" set column from the
22367
 * "Interface" table in 'row'.
22368
 *
22369
 */
22370
void
22371
ovsrec_interface_update_mac_in_use_delvalue(const struct ovsrec_interface *row, const char *delete_value)
22372
0
{
22373
0
    struct ovsdb_datum *datum;
22374
22375
0
    datum = xmalloc(sizeof *datum);
22376
0
    datum->n = 1;
22377
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22378
0
    datum->values = NULL;
22379
0
    datum->refcnt = NULL;
22380
22381
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
22382
22383
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22384
0
                                    &ovsrec_interface_col_mac_in_use,
22385
0
                                    datum);
22386
0
}
22387
22388
/* Adds the value 'new_value' to the "mtu" set column from the "Interface" table
22389
 * in 'row'.
22390
 *
22391
 */
22392
void
22393
ovsrec_interface_update_mtu_addvalue(const struct ovsrec_interface *row, int64_t new_value)
22394
0
{
22395
0
    struct ovsdb_datum *datum;
22396
22397
0
    datum = xmalloc(sizeof *datum);
22398
0
    datum->n = 1;
22399
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22400
0
    datum->values = NULL;
22401
0
    datum->refcnt = NULL;
22402
22403
0
    datum->keys[0].integer = new_value;
22404
22405
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22406
0
                                    &ovsrec_interface_col_mtu,
22407
0
                                    datum);
22408
0
}
22409
22410
/* Deletes the value 'delete_value' from the "mtu" set column from the
22411
 * "Interface" table in 'row'.
22412
 *
22413
 */
22414
void
22415
ovsrec_interface_update_mtu_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
22416
0
{
22417
0
    struct ovsdb_datum *datum;
22418
22419
0
    datum = xmalloc(sizeof *datum);
22420
0
    datum->n = 1;
22421
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22422
0
    datum->values = NULL;
22423
0
    datum->refcnt = NULL;
22424
22425
0
    datum->keys[0].integer = delete_value;
22426
22427
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22428
0
                                    &ovsrec_interface_col_mtu,
22429
0
                                    datum);
22430
0
}
22431
22432
/* Adds the value 'new_value' to the "mtu_request" set column from the "Interface" table
22433
 * in 'row'.
22434
 *
22435
 */
22436
void
22437
ovsrec_interface_update_mtu_request_addvalue(const struct ovsrec_interface *row, int64_t new_value)
22438
0
{
22439
0
    struct ovsdb_datum *datum;
22440
22441
0
    datum = xmalloc(sizeof *datum);
22442
0
    datum->n = 1;
22443
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22444
0
    datum->values = NULL;
22445
0
    datum->refcnt = NULL;
22446
22447
0
    datum->keys[0].integer = new_value;
22448
22449
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22450
0
                                    &ovsrec_interface_col_mtu_request,
22451
0
                                    datum);
22452
0
}
22453
22454
/* Deletes the value 'delete_value' from the "mtu_request" set column from the
22455
 * "Interface" table in 'row'.
22456
 *
22457
 */
22458
void
22459
ovsrec_interface_update_mtu_request_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
22460
0
{
22461
0
    struct ovsdb_datum *datum;
22462
22463
0
    datum = xmalloc(sizeof *datum);
22464
0
    datum->n = 1;
22465
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22466
0
    datum->values = NULL;
22467
0
    datum->refcnt = NULL;
22468
22469
0
    datum->keys[0].integer = delete_value;
22470
22471
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22472
0
                                    &ovsrec_interface_col_mtu_request,
22473
0
                                    datum);
22474
0
}
22475
22476
/* Adds the value 'new_value' to the "ofport" set column from the "Interface" table
22477
 * in 'row'.
22478
 *
22479
 */
22480
void
22481
ovsrec_interface_update_ofport_addvalue(const struct ovsrec_interface *row, int64_t new_value)
22482
0
{
22483
0
    struct ovsdb_datum *datum;
22484
22485
0
    datum = xmalloc(sizeof *datum);
22486
0
    datum->n = 1;
22487
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22488
0
    datum->values = NULL;
22489
0
    datum->refcnt = NULL;
22490
22491
0
    datum->keys[0].integer = new_value;
22492
22493
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22494
0
                                    &ovsrec_interface_col_ofport,
22495
0
                                    datum);
22496
0
}
22497
22498
/* Deletes the value 'delete_value' from the "ofport" set column from the
22499
 * "Interface" table in 'row'.
22500
 *
22501
 */
22502
void
22503
ovsrec_interface_update_ofport_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
22504
0
{
22505
0
    struct ovsdb_datum *datum;
22506
22507
0
    datum = xmalloc(sizeof *datum);
22508
0
    datum->n = 1;
22509
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22510
0
    datum->values = NULL;
22511
0
    datum->refcnt = NULL;
22512
22513
0
    datum->keys[0].integer = delete_value;
22514
22515
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22516
0
                                    &ovsrec_interface_col_ofport,
22517
0
                                    datum);
22518
0
}
22519
22520
/* Adds the value 'new_value' to the "ofport_request" set column from the "Interface" table
22521
 * in 'row'.
22522
 *
22523
 */
22524
void
22525
ovsrec_interface_update_ofport_request_addvalue(const struct ovsrec_interface *row, int64_t new_value)
22526
0
{
22527
0
    struct ovsdb_datum *datum;
22528
22529
0
    datum = xmalloc(sizeof *datum);
22530
0
    datum->n = 1;
22531
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22532
0
    datum->values = NULL;
22533
0
    datum->refcnt = NULL;
22534
22535
0
    datum->keys[0].integer = new_value;
22536
22537
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
22538
0
                                    &ovsrec_interface_col_ofport_request,
22539
0
                                    datum);
22540
0
}
22541
22542
/* Deletes the value 'delete_value' from the "ofport_request" set column from the
22543
 * "Interface" table in 'row'.
22544
 *
22545
 */
22546
void
22547
ovsrec_interface_update_ofport_request_delvalue(const struct ovsrec_interface *row, int64_t delete_value)
22548
0
{
22549
0
    struct ovsdb_datum *datum;
22550
22551
0
    datum = xmalloc(sizeof *datum);
22552
0
    datum->n = 1;
22553
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
22554
0
    datum->values = NULL;
22555
0
    datum->refcnt = NULL;
22556
22557
0
    datum->keys[0].integer = delete_value;
22558
22559
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
22560
0
                                    &ovsrec_interface_col_ofport_request,
22561
0
                                    datum);
22562
0
}
22563
22564
/* Sets an element of the "options" map column from the "Interface" table in 'row'
22565
 * to 'new_value' given the key value 'new_key'.
22566
 *
22567
 */
22568
void
22569
ovsrec_interface_update_options_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
22570
0
{
22571
0
    struct ovsdb_datum *datum;
22572
22573
0
    datum = xmalloc(sizeof *datum);
22574
0
    datum->n = 1;
22575
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22576
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
22577
0
    datum->refcnt = NULL;
22578
22579
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
22580
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
22581
22582
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
22583
0
                                    &ovsrec_interface_col_options,
22584
0
                                    datum);
22585
0
}
22586
22587
/* Deletes an element of the "options" map column from the "Interface" table in 'row'
22588
 * given the key value 'delete_key'.
22589
 *
22590
 */
22591
void
22592
ovsrec_interface_update_options_delkey(const struct ovsrec_interface *row, const char *delete_key)
22593
0
{
22594
0
    struct ovsdb_datum *datum;
22595
22596
0
    datum = xmalloc(sizeof *datum);
22597
0
    datum->n = 1;
22598
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22599
0
    datum->values = NULL;
22600
0
    datum->refcnt = NULL;
22601
22602
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
22603
22604
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
22605
0
                                    &ovsrec_interface_col_options,
22606
0
                                    datum);
22607
0
}
22608
22609
/* Sets an element of the "other_config" map column from the "Interface" table in 'row'
22610
 * to 'new_value' given the key value 'new_key'.
22611
 *
22612
 */
22613
void
22614
ovsrec_interface_update_other_config_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
22615
0
{
22616
0
    struct ovsdb_datum *datum;
22617
22618
0
    datum = xmalloc(sizeof *datum);
22619
0
    datum->n = 1;
22620
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22621
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
22622
0
    datum->refcnt = NULL;
22623
22624
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
22625
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
22626
22627
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
22628
0
                                    &ovsrec_interface_col_other_config,
22629
0
                                    datum);
22630
0
}
22631
22632
/* Deletes an element of the "other_config" map column from the "Interface" table in 'row'
22633
 * given the key value 'delete_key'.
22634
 *
22635
 */
22636
void
22637
ovsrec_interface_update_other_config_delkey(const struct ovsrec_interface *row, const char *delete_key)
22638
0
{
22639
0
    struct ovsdb_datum *datum;
22640
22641
0
    datum = xmalloc(sizeof *datum);
22642
0
    datum->n = 1;
22643
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22644
0
    datum->values = NULL;
22645
0
    datum->refcnt = NULL;
22646
22647
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
22648
22649
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
22650
0
                                    &ovsrec_interface_col_other_config,
22651
0
                                    datum);
22652
0
}
22653
22654
/* Sets an element of the "statistics" map column from the "Interface" table in 'row'
22655
 * to 'new_value' given the key value 'new_key'.
22656
 *
22657
 */
22658
void
22659
ovsrec_interface_update_statistics_setkey(const struct ovsrec_interface *row, const char *new_key, int64_t new_value)
22660
0
{
22661
0
    struct ovsdb_datum *datum;
22662
22663
0
    datum = xmalloc(sizeof *datum);
22664
0
    datum->n = 1;
22665
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22666
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
22667
0
    datum->refcnt = NULL;
22668
22669
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
22670
0
    datum->values[0].integer = new_value;
22671
22672
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
22673
0
                                    &ovsrec_interface_col_statistics,
22674
0
                                    datum);
22675
0
}
22676
22677
/* Deletes an element of the "statistics" map column from the "Interface" table in 'row'
22678
 * given the key value 'delete_key'.
22679
 *
22680
 */
22681
void
22682
ovsrec_interface_update_statistics_delkey(const struct ovsrec_interface *row, const char *delete_key)
22683
0
{
22684
0
    struct ovsdb_datum *datum;
22685
22686
0
    datum = xmalloc(sizeof *datum);
22687
0
    datum->n = 1;
22688
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22689
0
    datum->values = NULL;
22690
0
    datum->refcnt = NULL;
22691
22692
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
22693
22694
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
22695
0
                                    &ovsrec_interface_col_statistics,
22696
0
                                    datum);
22697
0
}
22698
22699
/* Sets an element of the "status" map column from the "Interface" table in 'row'
22700
 * to 'new_value' given the key value 'new_key'.
22701
 *
22702
 */
22703
void
22704
ovsrec_interface_update_status_setkey(const struct ovsrec_interface *row, const char *new_key, const char *new_value)
22705
0
{
22706
0
    struct ovsdb_datum *datum;
22707
22708
0
    datum = xmalloc(sizeof *datum);
22709
0
    datum->n = 1;
22710
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22711
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
22712
0
    datum->refcnt = NULL;
22713
22714
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
22715
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
22716
22717
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
22718
0
                                    &ovsrec_interface_col_status,
22719
0
                                    datum);
22720
0
}
22721
22722
/* Deletes an element of the "status" map column from the "Interface" table in 'row'
22723
 * given the key value 'delete_key'.
22724
 *
22725
 */
22726
void
22727
ovsrec_interface_update_status_delkey(const struct ovsrec_interface *row, const char *delete_key)
22728
0
{
22729
0
    struct ovsdb_datum *datum;
22730
22731
0
    datum = xmalloc(sizeof *datum);
22732
0
    datum->n = 1;
22733
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
22734
0
    datum->values = NULL;
22735
0
    datum->refcnt = NULL;
22736
22737
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
22738
22739
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
22740
0
                                    &ovsrec_interface_col_status,
22741
0
                                    datum);
22742
0
}
22743
22744
/* Sets the "admin_state" column from the "Interface" table in 'row' to
22745
 * the 'admin_state' set.
22746
 *
22747
 * If "admin_state" is null, the column will be the empty set,
22748
 * otherwise it will contain the specified value.
22749
 *
22750
 * Argument constraints: either "down" or "up"
22751
 *
22752
 * The caller retains ownership of the arguments. */
22753
void
22754
ovsrec_interface_add_clause_admin_state(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *admin_state)
22755
0
{
22756
0
    struct ovsdb_datum datum;
22757
22758
0
    datum.refcnt = NULL;
22759
22760
0
    if (admin_state) {
22761
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22762
0
        datum.n = 1;
22763
0
        datum.keys = key;
22764
0
        key->s = ovsdb_atom_string_create(admin_state);
22765
0
    } else {
22766
0
        datum.n = 0;
22767
0
        datum.keys = NULL;
22768
0
    }
22769
0
    datum.values = NULL;
22770
0
    ovsdb_idl_condition_add_clause(cond,
22771
0
                          function,
22772
0
                          &ovsrec_interface_col_admin_state,
22773
0
                          &datum);
22774
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_admin_state.type);
22775
0
}
22776
22777
/* Sets the "bfd" column's value from the "Interface" table in 'row'
22778
 * to 'bfd'.
22779
 *
22780
 * The caller retains ownership of 'bfd' and everything in it. */
22781
void
22782
ovsrec_interface_add_clause_bfd(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *bfd)
22783
0
{
22784
0
    struct ovsdb_datum datum;
22785
22786
0
    if (bfd) {
22787
0
        ovsdb_datum_from_smap(&datum, bfd);
22788
0
    } else {
22789
0
        ovsdb_datum_init_empty(&datum);
22790
0
    }
22791
22792
0
    ovsdb_idl_condition_add_clause(cond,
22793
0
                                   function,
22794
0
                                   &ovsrec_interface_col_bfd,
22795
0
                                   &datum);
22796
22797
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_bfd.type);
22798
0
}
22799
22800
22801
/* Sets the "bfd_status" column's value from the "Interface" table in 'row'
22802
 * to 'bfd_status'.
22803
 *
22804
 * The caller retains ownership of 'bfd_status' and everything in it. */
22805
void
22806
ovsrec_interface_add_clause_bfd_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *bfd_status)
22807
0
{
22808
0
    struct ovsdb_datum datum;
22809
22810
0
    if (bfd_status) {
22811
0
        ovsdb_datum_from_smap(&datum, bfd_status);
22812
0
    } else {
22813
0
        ovsdb_datum_init_empty(&datum);
22814
0
    }
22815
22816
0
    ovsdb_idl_condition_add_clause(cond,
22817
0
                                   function,
22818
0
                                   &ovsrec_interface_col_bfd_status,
22819
0
                                   &datum);
22820
22821
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_bfd_status.type);
22822
0
}
22823
22824
22825
/* Sets the "cfm_fault" column from the "Interface" table in 'row' to
22826
 * the 'cfm_fault' set with 'n_cfm_fault' entries.
22827
 *
22828
 * 'n_cfm_fault' may be 0 or 1; if it is 0, then 'cfm_fault'
22829
 * may be NULL.
22830
 *
22831
 * The caller retains ownership of the arguments. */
22832
void
22833
ovsrec_interface_add_clause_cfm_fault(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const bool *cfm_fault, size_t n_cfm_fault)
22834
0
{
22835
0
    struct ovsdb_datum datum;
22836
22837
0
    datum.refcnt = NULL;
22838
22839
0
    if (n_cfm_fault) {
22840
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22841
0
        datum.n = 1;
22842
0
        datum.keys = key;
22843
0
        key->boolean = *cfm_fault;
22844
0
    } else {
22845
0
        datum.n = 0;
22846
0
        datum.keys = NULL;
22847
0
    }
22848
0
    datum.values = NULL;
22849
0
    ovsdb_idl_condition_add_clause(cond,
22850
0
                          function,
22851
0
                          &ovsrec_interface_col_cfm_fault,
22852
0
                          &datum);
22853
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_fault.type);
22854
0
}
22855
22856
/* Sets the "cfm_fault_status" column from the "Interface" table in 'row' to
22857
 * the 'cfm_fault_status' set with 'n_cfm_fault_status' entries.
22858
 *
22859
 * The caller retains ownership of the arguments. */
22860
void
22861
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)
22862
0
{
22863
0
    struct ovsdb_datum datum;
22864
22865
0
    datum.refcnt = NULL;
22866
0
    datum.n = n_cfm_fault_status;
22867
0
    datum.keys = n_cfm_fault_status ? xmalloc(n_cfm_fault_status * sizeof *datum.keys) : NULL;
22868
0
    datum.values = NULL;
22869
0
    for (size_t i = 0; i < n_cfm_fault_status; i++) {
22870
0
        datum.keys[i].s = ovsdb_atom_string_create(cfm_fault_status[i]);
22871
0
    }
22872
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_cfm_fault_status.type);
22873
0
    ovsdb_idl_condition_add_clause(cond,
22874
0
                          function,
22875
0
                          &ovsrec_interface_col_cfm_fault_status,
22876
0
                          &datum);
22877
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_fault_status.type);
22878
0
}
22879
22880
/* Sets the "cfm_flap_count" column from the "Interface" table in 'row' to
22881
 * the 'cfm_flap_count' set with 'n_cfm_flap_count' entries.
22882
 *
22883
 * 'n_cfm_flap_count' may be 0 or 1; if it is 0, then 'cfm_flap_count'
22884
 * may be NULL.
22885
 *
22886
 * The caller retains ownership of the arguments. */
22887
void
22888
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)
22889
0
{
22890
0
    struct ovsdb_datum datum;
22891
22892
0
    datum.refcnt = NULL;
22893
22894
0
    if (n_cfm_flap_count) {
22895
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22896
0
        datum.n = 1;
22897
0
        datum.keys = key;
22898
0
        key->integer = *cfm_flap_count;
22899
0
    } else {
22900
0
        datum.n = 0;
22901
0
        datum.keys = NULL;
22902
0
    }
22903
0
    datum.values = NULL;
22904
0
    ovsdb_idl_condition_add_clause(cond,
22905
0
                          function,
22906
0
                          &ovsrec_interface_col_cfm_flap_count,
22907
0
                          &datum);
22908
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_flap_count.type);
22909
0
}
22910
22911
/* Sets the "cfm_health" column from the "Interface" table in 'row' to
22912
 * the 'cfm_health' set with 'n_cfm_health' entries.
22913
 *
22914
 * 'n_cfm_health' may be 0 or 1; if it is 0, then 'cfm_health'
22915
 * may be NULL.
22916
 *
22917
 * Argument constraints: in range 0 to 100
22918
 *
22919
 * The caller retains ownership of the arguments. */
22920
void
22921
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)
22922
0
{
22923
0
    struct ovsdb_datum datum;
22924
22925
0
    datum.refcnt = NULL;
22926
22927
0
    if (n_cfm_health) {
22928
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22929
0
        datum.n = 1;
22930
0
        datum.keys = key;
22931
0
        key->integer = *cfm_health;
22932
0
    } else {
22933
0
        datum.n = 0;
22934
0
        datum.keys = NULL;
22935
0
    }
22936
0
    datum.values = NULL;
22937
0
    ovsdb_idl_condition_add_clause(cond,
22938
0
                          function,
22939
0
                          &ovsrec_interface_col_cfm_health,
22940
0
                          &datum);
22941
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_health.type);
22942
0
}
22943
22944
/* Sets the "cfm_mpid" column from the "Interface" table in 'row' to
22945
 * the 'cfm_mpid' set with 'n_cfm_mpid' entries.
22946
 *
22947
 * 'n_cfm_mpid' may be 0 or 1; if it is 0, then 'cfm_mpid'
22948
 * may be NULL.
22949
 *
22950
 * The caller retains ownership of the arguments. */
22951
void
22952
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)
22953
0
{
22954
0
    struct ovsdb_datum datum;
22955
22956
0
    datum.refcnt = NULL;
22957
22958
0
    if (n_cfm_mpid) {
22959
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
22960
0
        datum.n = 1;
22961
0
        datum.keys = key;
22962
0
        key->integer = *cfm_mpid;
22963
0
    } else {
22964
0
        datum.n = 0;
22965
0
        datum.keys = NULL;
22966
0
    }
22967
0
    datum.values = NULL;
22968
0
    ovsdb_idl_condition_add_clause(cond,
22969
0
                          function,
22970
0
                          &ovsrec_interface_col_cfm_mpid,
22971
0
                          &datum);
22972
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_mpid.type);
22973
0
}
22974
22975
/* Sets the "cfm_remote_mpids" column from the "Interface" table in 'row' to
22976
 * the 'cfm_remote_mpids' set with 'n_cfm_remote_mpids' entries.
22977
 *
22978
 * The caller retains ownership of the arguments. */
22979
void
22980
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)
22981
0
{
22982
0
    struct ovsdb_datum datum;
22983
22984
0
    datum.refcnt = NULL;
22985
0
    datum.n = n_cfm_remote_mpids;
22986
0
    datum.keys = n_cfm_remote_mpids ? xmalloc(n_cfm_remote_mpids * sizeof *datum.keys) : NULL;
22987
0
    datum.values = NULL;
22988
0
    for (size_t i = 0; i < n_cfm_remote_mpids; i++) {
22989
0
        datum.keys[i].integer = cfm_remote_mpids[i];
22990
0
    }
22991
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_cfm_remote_mpids.type);
22992
0
    ovsdb_idl_condition_add_clause(cond,
22993
0
                          function,
22994
0
                          &ovsrec_interface_col_cfm_remote_mpids,
22995
0
                          &datum);
22996
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_remote_mpids.type);
22997
0
}
22998
22999
/* Sets the "cfm_remote_opstate" column from the "Interface" table in 'row' to
23000
 * the 'cfm_remote_opstate' set.
23001
 *
23002
 * If "cfm_remote_opstate" is null, the column will be the empty set,
23003
 * otherwise it will contain the specified value.
23004
 *
23005
 * Argument constraints: either "down" or "up"
23006
 *
23007
 * The caller retains ownership of the arguments. */
23008
void
23009
ovsrec_interface_add_clause_cfm_remote_opstate(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *cfm_remote_opstate)
23010
0
{
23011
0
    struct ovsdb_datum datum;
23012
23013
0
    datum.refcnt = NULL;
23014
23015
0
    if (cfm_remote_opstate) {
23016
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23017
0
        datum.n = 1;
23018
0
        datum.keys = key;
23019
0
        key->s = ovsdb_atom_string_create(cfm_remote_opstate);
23020
0
    } else {
23021
0
        datum.n = 0;
23022
0
        datum.keys = NULL;
23023
0
    }
23024
0
    datum.values = NULL;
23025
0
    ovsdb_idl_condition_add_clause(cond,
23026
0
                          function,
23027
0
                          &ovsrec_interface_col_cfm_remote_opstate,
23028
0
                          &datum);
23029
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_cfm_remote_opstate.type);
23030
0
}
23031
23032
/* Sets the "duplex" column from the "Interface" table in 'row' to
23033
 * the 'duplex' set.
23034
 *
23035
 * If "duplex" is null, the column will be the empty set,
23036
 * otherwise it will contain the specified value.
23037
 *
23038
 * Argument constraints: either "full" or "half"
23039
 *
23040
 * The caller retains ownership of the arguments. */
23041
void
23042
ovsrec_interface_add_clause_duplex(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *duplex)
23043
0
{
23044
0
    struct ovsdb_datum datum;
23045
23046
0
    datum.refcnt = NULL;
23047
23048
0
    if (duplex) {
23049
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23050
0
        datum.n = 1;
23051
0
        datum.keys = key;
23052
0
        key->s = ovsdb_atom_string_create(duplex);
23053
0
    } else {
23054
0
        datum.n = 0;
23055
0
        datum.keys = NULL;
23056
0
    }
23057
0
    datum.values = NULL;
23058
0
    ovsdb_idl_condition_add_clause(cond,
23059
0
                          function,
23060
0
                          &ovsrec_interface_col_duplex,
23061
0
                          &datum);
23062
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_duplex.type);
23063
0
}
23064
23065
/* Sets the "error" column from the "Interface" table in 'row' to
23066
 * the 'error' set.
23067
 *
23068
 * If "error" is null, the column will be the empty set,
23069
 * otherwise it will contain the specified value.
23070
 *
23071
 * The caller retains ownership of the arguments. */
23072
void
23073
ovsrec_interface_add_clause_error(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *error)
23074
0
{
23075
0
    struct ovsdb_datum datum;
23076
23077
0
    datum.refcnt = NULL;
23078
23079
0
    if (error) {
23080
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23081
0
        datum.n = 1;
23082
0
        datum.keys = key;
23083
0
        key->s = ovsdb_atom_string_create(error);
23084
0
    } else {
23085
0
        datum.n = 0;
23086
0
        datum.keys = NULL;
23087
0
    }
23088
0
    datum.values = NULL;
23089
0
    ovsdb_idl_condition_add_clause(cond,
23090
0
                          function,
23091
0
                          &ovsrec_interface_col_error,
23092
0
                          &datum);
23093
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_error.type);
23094
0
}
23095
23096
/* Sets the "external_ids" column's value from the "Interface" table in 'row'
23097
 * to 'external_ids'.
23098
 *
23099
 * The caller retains ownership of 'external_ids' and everything in it. */
23100
void
23101
ovsrec_interface_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
23102
0
{
23103
0
    struct ovsdb_datum datum;
23104
23105
0
    if (external_ids) {
23106
0
        ovsdb_datum_from_smap(&datum, external_ids);
23107
0
    } else {
23108
0
        ovsdb_datum_init_empty(&datum);
23109
0
    }
23110
23111
0
    ovsdb_idl_condition_add_clause(cond,
23112
0
                                   function,
23113
0
                                   &ovsrec_interface_col_external_ids,
23114
0
                                   &datum);
23115
23116
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_external_ids.type);
23117
0
}
23118
23119
23120
/* Sets the "ifindex" column from the "Interface" table in 'row' to
23121
 * the 'ifindex' set with 'n_ifindex' entries.
23122
 *
23123
 * 'n_ifindex' may be 0 or 1; if it is 0, then 'ifindex'
23124
 * may be NULL.
23125
 *
23126
 * Argument constraints: in range 0 to 4,294,967,295
23127
 *
23128
 * The caller retains ownership of the arguments. */
23129
void
23130
ovsrec_interface_add_clause_ifindex(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *ifindex, size_t n_ifindex)
23131
0
{
23132
0
    struct ovsdb_datum datum;
23133
23134
0
    datum.refcnt = NULL;
23135
23136
0
    if (n_ifindex) {
23137
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23138
0
        datum.n = 1;
23139
0
        datum.keys = key;
23140
0
        key->integer = *ifindex;
23141
0
    } else {
23142
0
        datum.n = 0;
23143
0
        datum.keys = NULL;
23144
0
    }
23145
0
    datum.values = NULL;
23146
0
    ovsdb_idl_condition_add_clause(cond,
23147
0
                          function,
23148
0
                          &ovsrec_interface_col_ifindex,
23149
0
                          &datum);
23150
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ifindex.type);
23151
0
}
23152
23153
/* Sets the "ingress_policing_burst" column from the "Interface" table in 'row' to
23154
 * 'ingress_policing_burst'.
23155
 *
23156
 * Argument constraints: at least 0
23157
 *
23158
 * The caller retains ownership of the arguments. */
23159
void
23160
ovsrec_interface_add_clause_ingress_policing_burst(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t ingress_policing_burst)
23161
0
{
23162
0
    struct ovsdb_datum datum;
23163
23164
0
    datum.refcnt = NULL;
23165
23166
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
23167
23168
0
    datum.n = 1;
23169
0
    datum.keys = key;
23170
0
    key->integer = ingress_policing_burst;
23171
0
    datum.values = NULL;
23172
0
    ovsdb_idl_condition_add_clause(cond,
23173
0
                          function,
23174
0
                          &ovsrec_interface_col_ingress_policing_burst,
23175
0
                          &datum);
23176
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ingress_policing_burst.type);
23177
0
}
23178
23179
/* Sets the "ingress_policing_kpkts_burst" column from the "Interface" table in 'row' to
23180
 * 'ingress_policing_kpkts_burst'.
23181
 *
23182
 * Argument constraints: at least 0
23183
 *
23184
 * The caller retains ownership of the arguments. */
23185
void
23186
ovsrec_interface_add_clause_ingress_policing_kpkts_burst(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t ingress_policing_kpkts_burst)
23187
0
{
23188
0
    struct ovsdb_datum datum;
23189
23190
0
    datum.refcnt = NULL;
23191
23192
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
23193
23194
0
    datum.n = 1;
23195
0
    datum.keys = key;
23196
0
    key->integer = ingress_policing_kpkts_burst;
23197
0
    datum.values = NULL;
23198
0
    ovsdb_idl_condition_add_clause(cond,
23199
0
                          function,
23200
0
                          &ovsrec_interface_col_ingress_policing_kpkts_burst,
23201
0
                          &datum);
23202
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ingress_policing_kpkts_burst.type);
23203
0
}
23204
23205
/* Sets the "ingress_policing_kpkts_rate" column from the "Interface" table in 'row' to
23206
 * 'ingress_policing_kpkts_rate'.
23207
 *
23208
 * Argument constraints: at least 0
23209
 *
23210
 * The caller retains ownership of the arguments. */
23211
void
23212
ovsrec_interface_add_clause_ingress_policing_kpkts_rate(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t ingress_policing_kpkts_rate)
23213
0
{
23214
0
    struct ovsdb_datum datum;
23215
23216
0
    datum.refcnt = NULL;
23217
23218
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
23219
23220
0
    datum.n = 1;
23221
0
    datum.keys = key;
23222
0
    key->integer = ingress_policing_kpkts_rate;
23223
0
    datum.values = NULL;
23224
0
    ovsdb_idl_condition_add_clause(cond,
23225
0
                          function,
23226
0
                          &ovsrec_interface_col_ingress_policing_kpkts_rate,
23227
0
                          &datum);
23228
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ingress_policing_kpkts_rate.type);
23229
0
}
23230
23231
/* Sets the "ingress_policing_rate" column from the "Interface" table in 'row' to
23232
 * 'ingress_policing_rate'.
23233
 *
23234
 * Argument constraints: at least 0
23235
 *
23236
 * The caller retains ownership of the arguments. */
23237
void
23238
ovsrec_interface_add_clause_ingress_policing_rate(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t ingress_policing_rate)
23239
0
{
23240
0
    struct ovsdb_datum datum;
23241
23242
0
    datum.refcnt = NULL;
23243
23244
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
23245
23246
0
    datum.n = 1;
23247
0
    datum.keys = key;
23248
0
    key->integer = ingress_policing_rate;
23249
0
    datum.values = NULL;
23250
0
    ovsdb_idl_condition_add_clause(cond,
23251
0
                          function,
23252
0
                          &ovsrec_interface_col_ingress_policing_rate,
23253
0
                          &datum);
23254
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ingress_policing_rate.type);
23255
0
}
23256
23257
/* Sets the "lacp_current" column from the "Interface" table in 'row' to
23258
 * the 'lacp_current' set with 'n_lacp_current' entries.
23259
 *
23260
 * 'n_lacp_current' may be 0 or 1; if it is 0, then 'lacp_current'
23261
 * may be NULL.
23262
 *
23263
 * The caller retains ownership of the arguments. */
23264
void
23265
ovsrec_interface_add_clause_lacp_current(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const bool *lacp_current, size_t n_lacp_current)
23266
0
{
23267
0
    struct ovsdb_datum datum;
23268
23269
0
    datum.refcnt = NULL;
23270
23271
0
    if (n_lacp_current) {
23272
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23273
0
        datum.n = 1;
23274
0
        datum.keys = key;
23275
0
        key->boolean = *lacp_current;
23276
0
    } else {
23277
0
        datum.n = 0;
23278
0
        datum.keys = NULL;
23279
0
    }
23280
0
    datum.values = NULL;
23281
0
    ovsdb_idl_condition_add_clause(cond,
23282
0
                          function,
23283
0
                          &ovsrec_interface_col_lacp_current,
23284
0
                          &datum);
23285
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_lacp_current.type);
23286
0
}
23287
23288
/* Sets the "link_resets" column from the "Interface" table in 'row' to
23289
 * the 'link_resets' set with 'n_link_resets' entries.
23290
 *
23291
 * 'n_link_resets' may be 0 or 1; if it is 0, then 'link_resets'
23292
 * may be NULL.
23293
 *
23294
 * The caller retains ownership of the arguments. */
23295
void
23296
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)
23297
0
{
23298
0
    struct ovsdb_datum datum;
23299
23300
0
    datum.refcnt = NULL;
23301
23302
0
    if (n_link_resets) {
23303
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23304
0
        datum.n = 1;
23305
0
        datum.keys = key;
23306
0
        key->integer = *link_resets;
23307
0
    } else {
23308
0
        datum.n = 0;
23309
0
        datum.keys = NULL;
23310
0
    }
23311
0
    datum.values = NULL;
23312
0
    ovsdb_idl_condition_add_clause(cond,
23313
0
                          function,
23314
0
                          &ovsrec_interface_col_link_resets,
23315
0
                          &datum);
23316
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_link_resets.type);
23317
0
}
23318
23319
/* Sets the "link_speed" column from the "Interface" table in 'row' to
23320
 * the 'link_speed' set with 'n_link_speed' entries.
23321
 *
23322
 * 'n_link_speed' may be 0 or 1; if it is 0, then 'link_speed'
23323
 * may be NULL.
23324
 *
23325
 * The caller retains ownership of the arguments. */
23326
void
23327
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)
23328
0
{
23329
0
    struct ovsdb_datum datum;
23330
23331
0
    datum.refcnt = NULL;
23332
23333
0
    if (n_link_speed) {
23334
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23335
0
        datum.n = 1;
23336
0
        datum.keys = key;
23337
0
        key->integer = *link_speed;
23338
0
    } else {
23339
0
        datum.n = 0;
23340
0
        datum.keys = NULL;
23341
0
    }
23342
0
    datum.values = NULL;
23343
0
    ovsdb_idl_condition_add_clause(cond,
23344
0
                          function,
23345
0
                          &ovsrec_interface_col_link_speed,
23346
0
                          &datum);
23347
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_link_speed.type);
23348
0
}
23349
23350
/* Sets the "link_state" column from the "Interface" table in 'row' to
23351
 * the 'link_state' set.
23352
 *
23353
 * If "link_state" is null, the column will be the empty set,
23354
 * otherwise it will contain the specified value.
23355
 *
23356
 * Argument constraints: either "down" or "up"
23357
 *
23358
 * The caller retains ownership of the arguments. */
23359
void
23360
ovsrec_interface_add_clause_link_state(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *link_state)
23361
0
{
23362
0
    struct ovsdb_datum datum;
23363
23364
0
    datum.refcnt = NULL;
23365
23366
0
    if (link_state) {
23367
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23368
0
        datum.n = 1;
23369
0
        datum.keys = key;
23370
0
        key->s = ovsdb_atom_string_create(link_state);
23371
0
    } else {
23372
0
        datum.n = 0;
23373
0
        datum.keys = NULL;
23374
0
    }
23375
0
    datum.values = NULL;
23376
0
    ovsdb_idl_condition_add_clause(cond,
23377
0
                          function,
23378
0
                          &ovsrec_interface_col_link_state,
23379
0
                          &datum);
23380
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_link_state.type);
23381
0
}
23382
23383
/* Sets the "lldp" column's value from the "Interface" table in 'row'
23384
 * to 'lldp'.
23385
 *
23386
 * The caller retains ownership of 'lldp' and everything in it. */
23387
void
23388
ovsrec_interface_add_clause_lldp(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *lldp)
23389
0
{
23390
0
    struct ovsdb_datum datum;
23391
23392
0
    if (lldp) {
23393
0
        ovsdb_datum_from_smap(&datum, lldp);
23394
0
    } else {
23395
0
        ovsdb_datum_init_empty(&datum);
23396
0
    }
23397
23398
0
    ovsdb_idl_condition_add_clause(cond,
23399
0
                                   function,
23400
0
                                   &ovsrec_interface_col_lldp,
23401
0
                                   &datum);
23402
23403
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_lldp.type);
23404
0
}
23405
23406
23407
/* Sets the "mac" column from the "Interface" table in 'row' to
23408
 * the 'mac' set.
23409
 *
23410
 * If "mac" is null, the column will be the empty set,
23411
 * otherwise it will contain the specified value.
23412
 *
23413
 * The caller retains ownership of the arguments. */
23414
void
23415
ovsrec_interface_add_clause_mac(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *mac)
23416
0
{
23417
0
    struct ovsdb_datum datum;
23418
23419
0
    datum.refcnt = NULL;
23420
23421
0
    if (mac) {
23422
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23423
0
        datum.n = 1;
23424
0
        datum.keys = key;
23425
0
        key->s = ovsdb_atom_string_create(mac);
23426
0
    } else {
23427
0
        datum.n = 0;
23428
0
        datum.keys = NULL;
23429
0
    }
23430
0
    datum.values = NULL;
23431
0
    ovsdb_idl_condition_add_clause(cond,
23432
0
                          function,
23433
0
                          &ovsrec_interface_col_mac,
23434
0
                          &datum);
23435
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_mac.type);
23436
0
}
23437
23438
/* Sets the "mac_in_use" column from the "Interface" table in 'row' to
23439
 * the 'mac_in_use' set.
23440
 *
23441
 * If "mac_in_use" is null, the column will be the empty set,
23442
 * otherwise it will contain the specified value.
23443
 *
23444
 * The caller retains ownership of the arguments. */
23445
void
23446
ovsrec_interface_add_clause_mac_in_use(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *mac_in_use)
23447
0
{
23448
0
    struct ovsdb_datum datum;
23449
23450
0
    datum.refcnt = NULL;
23451
23452
0
    if (mac_in_use) {
23453
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23454
0
        datum.n = 1;
23455
0
        datum.keys = key;
23456
0
        key->s = ovsdb_atom_string_create(mac_in_use);
23457
0
    } else {
23458
0
        datum.n = 0;
23459
0
        datum.keys = NULL;
23460
0
    }
23461
0
    datum.values = NULL;
23462
0
    ovsdb_idl_condition_add_clause(cond,
23463
0
                          function,
23464
0
                          &ovsrec_interface_col_mac_in_use,
23465
0
                          &datum);
23466
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_mac_in_use.type);
23467
0
}
23468
23469
/* Sets the "mtu" column from the "Interface" table in 'row' to
23470
 * the 'mtu' set with 'n_mtu' entries.
23471
 *
23472
 * 'n_mtu' may be 0 or 1; if it is 0, then 'mtu'
23473
 * may be NULL.
23474
 *
23475
 * The caller retains ownership of the arguments. */
23476
void
23477
ovsrec_interface_add_clause_mtu(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *mtu, size_t n_mtu)
23478
0
{
23479
0
    struct ovsdb_datum datum;
23480
23481
0
    datum.refcnt = NULL;
23482
23483
0
    if (n_mtu) {
23484
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23485
0
        datum.n = 1;
23486
0
        datum.keys = key;
23487
0
        key->integer = *mtu;
23488
0
    } else {
23489
0
        datum.n = 0;
23490
0
        datum.keys = NULL;
23491
0
    }
23492
0
    datum.values = NULL;
23493
0
    ovsdb_idl_condition_add_clause(cond,
23494
0
                          function,
23495
0
                          &ovsrec_interface_col_mtu,
23496
0
                          &datum);
23497
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_mtu.type);
23498
0
}
23499
23500
/* Sets the "mtu_request" column from the "Interface" table in 'row' to
23501
 * the 'mtu_request' set with 'n_mtu_request' entries.
23502
 *
23503
 * 'n_mtu_request' may be 0 or 1; if it is 0, then 'mtu_request'
23504
 * may be NULL.
23505
 *
23506
 * Argument constraints: at least 1
23507
 *
23508
 * The caller retains ownership of the arguments. */
23509
void
23510
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)
23511
0
{
23512
0
    struct ovsdb_datum datum;
23513
23514
0
    datum.refcnt = NULL;
23515
23516
0
    if (n_mtu_request) {
23517
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23518
0
        datum.n = 1;
23519
0
        datum.keys = key;
23520
0
        key->integer = *mtu_request;
23521
0
    } else {
23522
0
        datum.n = 0;
23523
0
        datum.keys = NULL;
23524
0
    }
23525
0
    datum.values = NULL;
23526
0
    ovsdb_idl_condition_add_clause(cond,
23527
0
                          function,
23528
0
                          &ovsrec_interface_col_mtu_request,
23529
0
                          &datum);
23530
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_mtu_request.type);
23531
0
}
23532
23533
/* Sets the "name" column from the "Interface" table in 'row' to
23534
 * 'name'.
23535
 *
23536
 * The caller retains ownership of the arguments. */
23537
void
23538
ovsrec_interface_add_clause_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *name)
23539
0
{
23540
0
    struct ovsdb_datum datum;
23541
23542
0
    datum.refcnt = NULL;
23543
23544
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
23545
23546
0
    datum.n = 1;
23547
0
    datum.keys = key;
23548
0
    key->s = ovsdb_atom_string_create(name);
23549
0
    datum.values = NULL;
23550
0
    ovsdb_idl_condition_add_clause(cond,
23551
0
                          function,
23552
0
                          &ovsrec_interface_col_name,
23553
0
                          &datum);
23554
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_name.type);
23555
0
}
23556
23557
/* Sets the "ofport" column from the "Interface" table in 'row' to
23558
 * the 'ofport' set with 'n_ofport' entries.
23559
 *
23560
 * 'n_ofport' may be 0 or 1; if it is 0, then 'ofport'
23561
 * may be NULL.
23562
 *
23563
 * The caller retains ownership of the arguments. */
23564
void
23565
ovsrec_interface_add_clause_ofport(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *ofport, size_t n_ofport)
23566
0
{
23567
0
    struct ovsdb_datum datum;
23568
23569
0
    datum.refcnt = NULL;
23570
23571
0
    if (n_ofport) {
23572
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23573
0
        datum.n = 1;
23574
0
        datum.keys = key;
23575
0
        key->integer = *ofport;
23576
0
    } else {
23577
0
        datum.n = 0;
23578
0
        datum.keys = NULL;
23579
0
    }
23580
0
    datum.values = NULL;
23581
0
    ovsdb_idl_condition_add_clause(cond,
23582
0
                          function,
23583
0
                          &ovsrec_interface_col_ofport,
23584
0
                          &datum);
23585
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ofport.type);
23586
0
}
23587
23588
/* Sets the "ofport_request" column from the "Interface" table in 'row' to
23589
 * the 'ofport_request' set with 'n_ofport_request' entries.
23590
 *
23591
 * 'n_ofport_request' may be 0 or 1; if it is 0, then 'ofport_request'
23592
 * may be NULL.
23593
 *
23594
 * Argument constraints: in range 1 to 65,279
23595
 *
23596
 * The caller retains ownership of the arguments. */
23597
void
23598
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)
23599
0
{
23600
0
    struct ovsdb_datum datum;
23601
23602
0
    datum.refcnt = NULL;
23603
23604
0
    if (n_ofport_request) {
23605
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
23606
0
        datum.n = 1;
23607
0
        datum.keys = key;
23608
0
        key->integer = *ofport_request;
23609
0
    } else {
23610
0
        datum.n = 0;
23611
0
        datum.keys = NULL;
23612
0
    }
23613
0
    datum.values = NULL;
23614
0
    ovsdb_idl_condition_add_clause(cond,
23615
0
                          function,
23616
0
                          &ovsrec_interface_col_ofport_request,
23617
0
                          &datum);
23618
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_ofport_request.type);
23619
0
}
23620
23621
/* Sets the "options" column's value from the "Interface" table in 'row'
23622
 * to 'options'.
23623
 *
23624
 * The caller retains ownership of 'options' and everything in it. */
23625
void
23626
ovsrec_interface_add_clause_options(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *options)
23627
0
{
23628
0
    struct ovsdb_datum datum;
23629
23630
0
    if (options) {
23631
0
        ovsdb_datum_from_smap(&datum, options);
23632
0
    } else {
23633
0
        ovsdb_datum_init_empty(&datum);
23634
0
    }
23635
23636
0
    ovsdb_idl_condition_add_clause(cond,
23637
0
                                   function,
23638
0
                                   &ovsrec_interface_col_options,
23639
0
                                   &datum);
23640
23641
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_options.type);
23642
0
}
23643
23644
23645
/* Sets the "other_config" column's value from the "Interface" table in 'row'
23646
 * to 'other_config'.
23647
 *
23648
 * The caller retains ownership of 'other_config' and everything in it. */
23649
void
23650
ovsrec_interface_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
23651
0
{
23652
0
    struct ovsdb_datum datum;
23653
23654
0
    if (other_config) {
23655
0
        ovsdb_datum_from_smap(&datum, other_config);
23656
0
    } else {
23657
0
        ovsdb_datum_init_empty(&datum);
23658
0
    }
23659
23660
0
    ovsdb_idl_condition_add_clause(cond,
23661
0
                                   function,
23662
0
                                   &ovsrec_interface_col_other_config,
23663
0
                                   &datum);
23664
23665
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_other_config.type);
23666
0
}
23667
23668
23669
/* Sets the "statistics" column from the "Interface" table in 'row' to
23670
 * the map with keys 'key_statistics' and values 'value_statistics'
23671
 * with 'n_statistics' entries.
23672
 *
23673
 * The caller retains ownership of the arguments. */
23674
void
23675
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)
23676
0
{
23677
0
    struct ovsdb_datum datum;
23678
23679
0
    datum.refcnt = NULL;
23680
0
    datum.n = n_statistics;
23681
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
23682
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
23683
0
    for (size_t i = 0; i < n_statistics; i++) {
23684
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
23685
0
        datum.values[i].integer = value_statistics[i];
23686
0
    }
23687
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_statistics.type);
23688
0
    ovsdb_idl_condition_add_clause(cond,
23689
0
                          function,
23690
0
                          &ovsrec_interface_col_statistics,
23691
0
                          &datum);
23692
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_statistics.type);
23693
0
}
23694
23695
/* Sets the "status" column's value from the "Interface" table in 'row'
23696
 * to 'status'.
23697
 *
23698
 * The caller retains ownership of 'status' and everything in it. */
23699
void
23700
ovsrec_interface_add_clause_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *status)
23701
0
{
23702
0
    struct ovsdb_datum datum;
23703
23704
0
    if (status) {
23705
0
        ovsdb_datum_from_smap(&datum, status);
23706
0
    } else {
23707
0
        ovsdb_datum_init_empty(&datum);
23708
0
    }
23709
23710
0
    ovsdb_idl_condition_add_clause(cond,
23711
0
                                   function,
23712
0
                                   &ovsrec_interface_col_status,
23713
0
                                   &datum);
23714
23715
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_status.type);
23716
0
}
23717
23718
23719
/* Sets the "type" column from the "Interface" table in 'row' to
23720
 * 'type'.
23721
 *
23722
 * The caller retains ownership of the arguments. */
23723
void
23724
ovsrec_interface_add_clause_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *type)
23725
0
{
23726
0
    struct ovsdb_datum datum;
23727
23728
0
    datum.refcnt = NULL;
23729
23730
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
23731
23732
0
    datum.n = 1;
23733
0
    datum.keys = key;
23734
0
    key->s = ovsdb_atom_string_create(type);
23735
0
    datum.values = NULL;
23736
0
    ovsdb_idl_condition_add_clause(cond,
23737
0
                          function,
23738
0
                          &ovsrec_interface_col_type,
23739
0
                          &datum);
23740
0
    ovsdb_datum_destroy(&datum, &ovsrec_interface_col_type.type);
23741
0
}
23742
23743
/* Destroy 'row' of kind "Interface". The row must have been
23744
 * created with ovsdb_idl_index_init_row.
23745
 */
23746
void
23747
ovsrec_interface_index_destroy_row(const struct ovsrec_interface *row)
23748
0
{
23749
0
    ovsdb_idl_index_destroy_row(&row->header_);
23750
0
}
23751
        
23752
23753
/* Creates a new row of kind "Interface". */
23754
struct ovsrec_interface *
23755
ovsrec_interface_index_init_row(struct ovsdb_idl_index *index)
23756
0
{
23757
0
    ovs_assert(index->table->class_ == &ovsrec_table_interface);
23758
0
    return ALIGNED_CAST(struct ovsrec_interface *, ovsdb_idl_index_init_row(index));
23759
0
}
23760
23761
struct ovsrec_interface *
23762
ovsrec_interface_index_find(struct ovsdb_idl_index *index, const struct ovsrec_interface *target)
23763
0
{
23764
0
    ovs_assert(index->table->class_ == &ovsrec_table_interface);
23765
0
    return ovsrec_interface_cast(ovsdb_idl_index_find(index, &target->header_));
23766
0
}
23767
23768
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
23769
int
23770
ovsrec_interface_index_compare(
23771
    struct ovsdb_idl_index *index, 
23772
    const struct ovsrec_interface *a, 
23773
    const struct ovsrec_interface *b)
23774
0
{
23775
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
23776
0
}
23777
23778
struct ovsdb_idl_cursor
23779
ovsrec_interface_cursor_first(struct ovsdb_idl_index *index)
23780
0
{
23781
0
    ovs_assert(index->table->class_ == &ovsrec_table_interface);
23782
0
    return ovsdb_idl_cursor_first(index);
23783
0
}
23784
23785
struct ovsdb_idl_cursor
23786
ovsrec_interface_cursor_first_eq(
23787
    struct ovsdb_idl_index *index, const struct ovsrec_interface *target)
23788
0
{
23789
0
    ovs_assert(index->table->class_ == &ovsrec_table_interface);
23790
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
23791
0
}
23792
23793
struct ovsdb_idl_cursor
23794
ovsrec_interface_cursor_first_ge(
23795
    struct ovsdb_idl_index *index, const struct ovsrec_interface *target)
23796
0
{
23797
0
    ovs_assert(index->table->class_ == &ovsrec_table_interface);
23798
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
23799
0
}
23800
23801
struct ovsrec_interface *
23802
ovsrec_interface_cursor_data(struct ovsdb_idl_cursor *cursor)
23803
0
{
23804
0
    return ovsrec_interface_cast(ovsdb_idl_cursor_data(cursor));
23805
0
}
23806
23807
23808
/* Sets the "admin_state" column from the "Interface" table in 'row' to
23809
 * the 'admin_state' set.
23810
 *
23811
 * If "admin_state" is null, the column will be the empty set,
23812
 * otherwise it will contain the specified value.
23813
 *
23814
 * Argument constraints: either "down" or "up"
23815
 *
23816
 * The caller retains ownership of the arguments. */
23817
void
23818
ovsrec_interface_index_set_admin_state(const struct ovsrec_interface *row, const char *admin_state)
23819
0
{
23820
0
    struct ovsdb_datum datum;
23821
23822
0
    datum.refcnt = NULL;
23823
0
    union ovsdb_atom *key;
23824
23825
0
    if (admin_state) {
23826
0
        key = xmalloc(sizeof (union ovsdb_atom));
23827
0
        datum.n = 1;
23828
0
        datum.keys = key;
23829
0
        key->s = ovsdb_atom_string_create(admin_state);
23830
0
    } else {
23831
0
        datum.n = 0;
23832
0
        datum.keys = NULL;
23833
0
    }
23834
0
    datum.values = NULL;
23835
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]);
23836
0
}
23837
23838
/* Sets the "bfd" column's value from the "Interface" table in 'row'
23839
 * to 'bfd'.
23840
 *
23841
 * The caller retains ownership of 'bfd' and everything in it. */
23842
void
23843
ovsrec_interface_index_set_bfd(const struct ovsrec_interface *row, const struct smap *bfd)
23844
0
{
23845
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
23846
23847
0
    if (bfd) {
23848
0
        struct smap_node *node;
23849
0
        size_t i;
23850
23851
0
        datum->n = smap_count(bfd);
23852
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
23853
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
23854
0
        datum->refcnt = NULL;
23855
23856
0
        i = 0;
23857
0
        SMAP_FOR_EACH (node, bfd) {
23858
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
23859
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
23860
0
            i++;
23861
0
        }
23862
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_bfd.type);
23863
0
    } else {
23864
0
        ovsdb_datum_init_empty(datum);
23865
0
    }
23866
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
23867
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD],
23868
0
                          datum,
23869
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
23870
0
    free(datum);
23871
0
}
23872
23873
23874
/* Sets the "bfd_status" column's value from the "Interface" table in 'row'
23875
 * to 'bfd_status'.
23876
 *
23877
 * The caller retains ownership of 'bfd_status' and everything in it. */
23878
void
23879
ovsrec_interface_index_set_bfd_status(const struct ovsrec_interface *row, const struct smap *bfd_status)
23880
0
{
23881
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
23882
23883
0
    if (bfd_status) {
23884
0
        struct smap_node *node;
23885
0
        size_t i;
23886
23887
0
        datum->n = smap_count(bfd_status);
23888
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
23889
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
23890
0
        datum->refcnt = NULL;
23891
23892
0
        i = 0;
23893
0
        SMAP_FOR_EACH (node, bfd_status) {
23894
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
23895
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
23896
0
            i++;
23897
0
        }
23898
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_bfd_status.type);
23899
0
    } else {
23900
0
        ovsdb_datum_init_empty(datum);
23901
0
    }
23902
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
23903
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD_STATUS],
23904
0
                          datum,
23905
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
23906
0
    free(datum);
23907
0
}
23908
23909
23910
/* Sets the "cfm_fault" column from the "Interface" table in 'row' to
23911
 * the 'cfm_fault' set with 'n_cfm_fault' entries.
23912
 *
23913
 * 'n_cfm_fault' may be 0 or 1; if it is 0, then 'cfm_fault'
23914
 * may be NULL.
23915
 *
23916
 * The caller retains ownership of the arguments. */
23917
void
23918
ovsrec_interface_index_set_cfm_fault(const struct ovsrec_interface *row, const bool *cfm_fault, size_t n_cfm_fault)
23919
0
{
23920
0
    struct ovsdb_datum datum;
23921
23922
0
    datum.refcnt = NULL;
23923
0
    union ovsdb_atom *key;
23924
23925
0
    if (n_cfm_fault) {
23926
0
        key = xmalloc(sizeof(union ovsdb_atom));
23927
0
        datum.n = 1;
23928
0
        datum.keys = key;
23929
0
        key->boolean = *cfm_fault;
23930
0
    } else {
23931
0
        datum.n = 0;
23932
0
        datum.keys = NULL;
23933
0
    }
23934
0
    datum.values = NULL;
23935
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]);
23936
0
}
23937
23938
/* Sets the "cfm_fault_status" column from the "Interface" table in 'row' to
23939
 * the 'cfm_fault_status' set with 'n_cfm_fault_status' entries.
23940
 *
23941
 * The caller retains ownership of the arguments. */
23942
void
23943
ovsrec_interface_index_set_cfm_fault_status(const struct ovsrec_interface *row, const char **cfm_fault_status, size_t n_cfm_fault_status)
23944
0
{
23945
0
    struct ovsdb_datum datum;
23946
23947
0
    datum.refcnt = NULL;
23948
0
    size_t i;
23949
23950
0
    datum.n = n_cfm_fault_status;
23951
0
    datum.keys = n_cfm_fault_status ? xmalloc(n_cfm_fault_status * sizeof *datum.keys) : NULL;
23952
0
    datum.values = NULL;
23953
0
    for (i = 0; i < n_cfm_fault_status; i++) {
23954
0
        datum.keys[i].s = ovsdb_atom_string_create(cfm_fault_status[i]);
23955
0
    }
23956
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_cfm_fault_status.type);
23957
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]);
23958
0
}
23959
23960
/* Sets the "cfm_flap_count" column from the "Interface" table in 'row' to
23961
 * the 'cfm_flap_count' set with 'n_cfm_flap_count' entries.
23962
 *
23963
 * 'n_cfm_flap_count' may be 0 or 1; if it is 0, then 'cfm_flap_count'
23964
 * may be NULL.
23965
 *
23966
 * The caller retains ownership of the arguments. */
23967
void
23968
ovsrec_interface_index_set_cfm_flap_count(const struct ovsrec_interface *row, const int64_t *cfm_flap_count, size_t n_cfm_flap_count)
23969
0
{
23970
0
    struct ovsdb_datum datum;
23971
23972
0
    datum.refcnt = NULL;
23973
0
    union ovsdb_atom *key;
23974
23975
0
    if (n_cfm_flap_count) {
23976
0
        key = xmalloc(sizeof(union ovsdb_atom));
23977
0
        datum.n = 1;
23978
0
        datum.keys = key;
23979
0
        key->integer = *cfm_flap_count;
23980
0
    } else {
23981
0
        datum.n = 0;
23982
0
        datum.keys = NULL;
23983
0
    }
23984
0
    datum.values = NULL;
23985
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]);
23986
0
}
23987
23988
/* Sets the "cfm_health" column from the "Interface" table in 'row' to
23989
 * the 'cfm_health' set with 'n_cfm_health' entries.
23990
 *
23991
 * 'n_cfm_health' may be 0 or 1; if it is 0, then 'cfm_health'
23992
 * may be NULL.
23993
 *
23994
 * Argument constraints: in range 0 to 100
23995
 *
23996
 * The caller retains ownership of the arguments. */
23997
void
23998
ovsrec_interface_index_set_cfm_health(const struct ovsrec_interface *row, const int64_t *cfm_health, size_t n_cfm_health)
23999
0
{
24000
0
    struct ovsdb_datum datum;
24001
24002
0
    datum.refcnt = NULL;
24003
0
    union ovsdb_atom *key;
24004
24005
0
    if (n_cfm_health) {
24006
0
        key = xmalloc(sizeof(union ovsdb_atom));
24007
0
        datum.n = 1;
24008
0
        datum.keys = key;
24009
0
        key->integer = *cfm_health;
24010
0
    } else {
24011
0
        datum.n = 0;
24012
0
        datum.keys = NULL;
24013
0
    }
24014
0
    datum.values = NULL;
24015
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]);
24016
0
}
24017
24018
/* Sets the "cfm_mpid" column from the "Interface" table in 'row' to
24019
 * the 'cfm_mpid' set with 'n_cfm_mpid' entries.
24020
 *
24021
 * 'n_cfm_mpid' may be 0 or 1; if it is 0, then 'cfm_mpid'
24022
 * may be NULL.
24023
 *
24024
 * The caller retains ownership of the arguments. */
24025
void
24026
ovsrec_interface_index_set_cfm_mpid(const struct ovsrec_interface *row, const int64_t *cfm_mpid, size_t n_cfm_mpid)
24027
0
{
24028
0
    struct ovsdb_datum datum;
24029
24030
0
    datum.refcnt = NULL;
24031
0
    union ovsdb_atom *key;
24032
24033
0
    if (n_cfm_mpid) {
24034
0
        key = xmalloc(sizeof(union ovsdb_atom));
24035
0
        datum.n = 1;
24036
0
        datum.keys = key;
24037
0
        key->integer = *cfm_mpid;
24038
0
    } else {
24039
0
        datum.n = 0;
24040
0
        datum.keys = NULL;
24041
0
    }
24042
0
    datum.values = NULL;
24043
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]);
24044
0
}
24045
24046
/* Sets the "cfm_remote_mpids" column from the "Interface" table in 'row' to
24047
 * the 'cfm_remote_mpids' set with 'n_cfm_remote_mpids' entries.
24048
 *
24049
 * The caller retains ownership of the arguments. */
24050
void
24051
ovsrec_interface_index_set_cfm_remote_mpids(const struct ovsrec_interface *row, const int64_t *cfm_remote_mpids, size_t n_cfm_remote_mpids)
24052
0
{
24053
0
    struct ovsdb_datum datum;
24054
24055
0
    datum.refcnt = NULL;
24056
0
    size_t i;
24057
24058
0
    datum.n = n_cfm_remote_mpids;
24059
0
    datum.keys = n_cfm_remote_mpids ? xmalloc(n_cfm_remote_mpids * sizeof *datum.keys) : NULL;
24060
0
    datum.values = NULL;
24061
0
    for (i = 0; i < n_cfm_remote_mpids; i++) {
24062
0
        datum.keys[i].integer = cfm_remote_mpids[i];
24063
0
    }
24064
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_cfm_remote_mpids.type);
24065
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]);
24066
0
}
24067
24068
/* Sets the "cfm_remote_opstate" column from the "Interface" table in 'row' to
24069
 * the 'cfm_remote_opstate' set.
24070
 *
24071
 * If "cfm_remote_opstate" is null, the column will be the empty set,
24072
 * otherwise it will contain the specified value.
24073
 *
24074
 * Argument constraints: either "down" or "up"
24075
 *
24076
 * The caller retains ownership of the arguments. */
24077
void
24078
ovsrec_interface_index_set_cfm_remote_opstate(const struct ovsrec_interface *row, const char *cfm_remote_opstate)
24079
0
{
24080
0
    struct ovsdb_datum datum;
24081
24082
0
    datum.refcnt = NULL;
24083
0
    union ovsdb_atom *key;
24084
24085
0
    if (cfm_remote_opstate) {
24086
0
        key = xmalloc(sizeof (union ovsdb_atom));
24087
0
        datum.n = 1;
24088
0
        datum.keys = key;
24089
0
        key->s = ovsdb_atom_string_create(cfm_remote_opstate);
24090
0
    } else {
24091
0
        datum.n = 0;
24092
0
        datum.keys = NULL;
24093
0
    }
24094
0
    datum.values = NULL;
24095
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]);
24096
0
}
24097
24098
/* Sets the "duplex" column from the "Interface" table in 'row' to
24099
 * the 'duplex' set.
24100
 *
24101
 * If "duplex" is null, the column will be the empty set,
24102
 * otherwise it will contain the specified value.
24103
 *
24104
 * Argument constraints: either "full" or "half"
24105
 *
24106
 * The caller retains ownership of the arguments. */
24107
void
24108
ovsrec_interface_index_set_duplex(const struct ovsrec_interface *row, const char *duplex)
24109
0
{
24110
0
    struct ovsdb_datum datum;
24111
24112
0
    datum.refcnt = NULL;
24113
0
    union ovsdb_atom *key;
24114
24115
0
    if (duplex) {
24116
0
        key = xmalloc(sizeof (union ovsdb_atom));
24117
0
        datum.n = 1;
24118
0
        datum.keys = key;
24119
0
        key->s = ovsdb_atom_string_create(duplex);
24120
0
    } else {
24121
0
        datum.n = 0;
24122
0
        datum.keys = NULL;
24123
0
    }
24124
0
    datum.values = NULL;
24125
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]);
24126
0
}
24127
24128
/* Sets the "error" column from the "Interface" table in 'row' to
24129
 * the 'error' set.
24130
 *
24131
 * If "error" is null, the column will be the empty set,
24132
 * otherwise it will contain the specified value.
24133
 *
24134
 * The caller retains ownership of the arguments. */
24135
void
24136
ovsrec_interface_index_set_error(const struct ovsrec_interface *row, const char *error)
24137
0
{
24138
0
    struct ovsdb_datum datum;
24139
24140
0
    datum.refcnt = NULL;
24141
0
    union ovsdb_atom *key;
24142
24143
0
    if (error) {
24144
0
        key = xmalloc(sizeof (union ovsdb_atom));
24145
0
        datum.n = 1;
24146
0
        datum.keys = key;
24147
0
        key->s = ovsdb_atom_string_create(error);
24148
0
    } else {
24149
0
        datum.n = 0;
24150
0
        datum.keys = NULL;
24151
0
    }
24152
0
    datum.values = NULL;
24153
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]);
24154
0
}
24155
24156
/* Sets the "external_ids" column's value from the "Interface" table in 'row'
24157
 * to 'external_ids'.
24158
 *
24159
 * The caller retains ownership of 'external_ids' and everything in it. */
24160
void
24161
ovsrec_interface_index_set_external_ids(const struct ovsrec_interface *row, const struct smap *external_ids)
24162
0
{
24163
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
24164
24165
0
    if (external_ids) {
24166
0
        struct smap_node *node;
24167
0
        size_t i;
24168
24169
0
        datum->n = smap_count(external_ids);
24170
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
24171
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
24172
0
        datum->refcnt = NULL;
24173
24174
0
        i = 0;
24175
0
        SMAP_FOR_EACH (node, external_ids) {
24176
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
24177
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
24178
0
            i++;
24179
0
        }
24180
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_external_ids.type);
24181
0
    } else {
24182
0
        ovsdb_datum_init_empty(datum);
24183
0
    }
24184
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
24185
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_EXTERNAL_IDS],
24186
0
                          datum,
24187
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
24188
0
    free(datum);
24189
0
}
24190
24191
24192
/* Sets the "ifindex" column from the "Interface" table in 'row' to
24193
 * the 'ifindex' set with 'n_ifindex' entries.
24194
 *
24195
 * 'n_ifindex' may be 0 or 1; if it is 0, then 'ifindex'
24196
 * may be NULL.
24197
 *
24198
 * Argument constraints: in range 0 to 4,294,967,295
24199
 *
24200
 * The caller retains ownership of the arguments. */
24201
void
24202
ovsrec_interface_index_set_ifindex(const struct ovsrec_interface *row, const int64_t *ifindex, size_t n_ifindex)
24203
0
{
24204
0
    struct ovsdb_datum datum;
24205
24206
0
    datum.refcnt = NULL;
24207
0
    union ovsdb_atom *key;
24208
24209
0
    if (n_ifindex) {
24210
0
        key = xmalloc(sizeof(union ovsdb_atom));
24211
0
        datum.n = 1;
24212
0
        datum.keys = key;
24213
0
        key->integer = *ifindex;
24214
0
    } else {
24215
0
        datum.n = 0;
24216
0
        datum.keys = NULL;
24217
0
    }
24218
0
    datum.values = NULL;
24219
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]);
24220
0
}
24221
24222
/* Sets the "ingress_policing_burst" column from the "Interface" table in 'row' to
24223
 * 'ingress_policing_burst'.
24224
 *
24225
 * Argument constraints: at least 0
24226
 *
24227
 * The caller retains ownership of the arguments. */
24228
void
24229
ovsrec_interface_index_set_ingress_policing_burst(const struct ovsrec_interface *row, int64_t ingress_policing_burst)
24230
0
{
24231
0
    struct ovsdb_datum datum;
24232
24233
0
    datum.refcnt = NULL;
24234
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
24235
24236
0
    datum.n = 1;
24237
0
    datum.keys = key;
24238
0
    key->integer = ingress_policing_burst;
24239
0
    datum.values = NULL;
24240
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]);
24241
0
}
24242
24243
/* Sets the "ingress_policing_kpkts_burst" column from the "Interface" table in 'row' to
24244
 * 'ingress_policing_kpkts_burst'.
24245
 *
24246
 * Argument constraints: at least 0
24247
 *
24248
 * The caller retains ownership of the arguments. */
24249
void
24250
ovsrec_interface_index_set_ingress_policing_kpkts_burst(const struct ovsrec_interface *row, int64_t ingress_policing_kpkts_burst)
24251
0
{
24252
0
    struct ovsdb_datum datum;
24253
24254
0
    datum.refcnt = NULL;
24255
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
24256
24257
0
    datum.n = 1;
24258
0
    datum.keys = key;
24259
0
    key->integer = ingress_policing_kpkts_burst;
24260
0
    datum.values = NULL;
24261
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]);
24262
0
}
24263
24264
/* Sets the "ingress_policing_kpkts_rate" column from the "Interface" table in 'row' to
24265
 * 'ingress_policing_kpkts_rate'.
24266
 *
24267
 * Argument constraints: at least 0
24268
 *
24269
 * The caller retains ownership of the arguments. */
24270
void
24271
ovsrec_interface_index_set_ingress_policing_kpkts_rate(const struct ovsrec_interface *row, int64_t ingress_policing_kpkts_rate)
24272
0
{
24273
0
    struct ovsdb_datum datum;
24274
24275
0
    datum.refcnt = NULL;
24276
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
24277
24278
0
    datum.n = 1;
24279
0
    datum.keys = key;
24280
0
    key->integer = ingress_policing_kpkts_rate;
24281
0
    datum.values = NULL;
24282
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]);
24283
0
}
24284
24285
/* Sets the "ingress_policing_rate" column from the "Interface" table in 'row' to
24286
 * 'ingress_policing_rate'.
24287
 *
24288
 * Argument constraints: at least 0
24289
 *
24290
 * The caller retains ownership of the arguments. */
24291
void
24292
ovsrec_interface_index_set_ingress_policing_rate(const struct ovsrec_interface *row, int64_t ingress_policing_rate)
24293
0
{
24294
0
    struct ovsdb_datum datum;
24295
24296
0
    datum.refcnt = NULL;
24297
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
24298
24299
0
    datum.n = 1;
24300
0
    datum.keys = key;
24301
0
    key->integer = ingress_policing_rate;
24302
0
    datum.values = NULL;
24303
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]);
24304
0
}
24305
24306
/* Sets the "lacp_current" column from the "Interface" table in 'row' to
24307
 * the 'lacp_current' set with 'n_lacp_current' entries.
24308
 *
24309
 * 'n_lacp_current' may be 0 or 1; if it is 0, then 'lacp_current'
24310
 * may be NULL.
24311
 *
24312
 * The caller retains ownership of the arguments. */
24313
void
24314
ovsrec_interface_index_set_lacp_current(const struct ovsrec_interface *row, const bool *lacp_current, size_t n_lacp_current)
24315
0
{
24316
0
    struct ovsdb_datum datum;
24317
24318
0
    datum.refcnt = NULL;
24319
0
    union ovsdb_atom *key;
24320
24321
0
    if (n_lacp_current) {
24322
0
        key = xmalloc(sizeof(union ovsdb_atom));
24323
0
        datum.n = 1;
24324
0
        datum.keys = key;
24325
0
        key->boolean = *lacp_current;
24326
0
    } else {
24327
0
        datum.n = 0;
24328
0
        datum.keys = NULL;
24329
0
    }
24330
0
    datum.values = NULL;
24331
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]);
24332
0
}
24333
24334
/* Sets the "link_resets" column from the "Interface" table in 'row' to
24335
 * the 'link_resets' set with 'n_link_resets' entries.
24336
 *
24337
 * 'n_link_resets' may be 0 or 1; if it is 0, then 'link_resets'
24338
 * may be NULL.
24339
 *
24340
 * The caller retains ownership of the arguments. */
24341
void
24342
ovsrec_interface_index_set_link_resets(const struct ovsrec_interface *row, const int64_t *link_resets, size_t n_link_resets)
24343
0
{
24344
0
    struct ovsdb_datum datum;
24345
24346
0
    datum.refcnt = NULL;
24347
0
    union ovsdb_atom *key;
24348
24349
0
    if (n_link_resets) {
24350
0
        key = xmalloc(sizeof(union ovsdb_atom));
24351
0
        datum.n = 1;
24352
0
        datum.keys = key;
24353
0
        key->integer = *link_resets;
24354
0
    } else {
24355
0
        datum.n = 0;
24356
0
        datum.keys = NULL;
24357
0
    }
24358
0
    datum.values = NULL;
24359
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]);
24360
0
}
24361
24362
/* Sets the "link_speed" column from the "Interface" table in 'row' to
24363
 * the 'link_speed' set with 'n_link_speed' entries.
24364
 *
24365
 * 'n_link_speed' may be 0 or 1; if it is 0, then 'link_speed'
24366
 * may be NULL.
24367
 *
24368
 * The caller retains ownership of the arguments. */
24369
void
24370
ovsrec_interface_index_set_link_speed(const struct ovsrec_interface *row, const int64_t *link_speed, size_t n_link_speed)
24371
0
{
24372
0
    struct ovsdb_datum datum;
24373
24374
0
    datum.refcnt = NULL;
24375
0
    union ovsdb_atom *key;
24376
24377
0
    if (n_link_speed) {
24378
0
        key = xmalloc(sizeof(union ovsdb_atom));
24379
0
        datum.n = 1;
24380
0
        datum.keys = key;
24381
0
        key->integer = *link_speed;
24382
0
    } else {
24383
0
        datum.n = 0;
24384
0
        datum.keys = NULL;
24385
0
    }
24386
0
    datum.values = NULL;
24387
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]);
24388
0
}
24389
24390
/* Sets the "link_state" column from the "Interface" table in 'row' to
24391
 * the 'link_state' set.
24392
 *
24393
 * If "link_state" is null, the column will be the empty set,
24394
 * otherwise it will contain the specified value.
24395
 *
24396
 * Argument constraints: either "down" or "up"
24397
 *
24398
 * The caller retains ownership of the arguments. */
24399
void
24400
ovsrec_interface_index_set_link_state(const struct ovsrec_interface *row, const char *link_state)
24401
0
{
24402
0
    struct ovsdb_datum datum;
24403
24404
0
    datum.refcnt = NULL;
24405
0
    union ovsdb_atom *key;
24406
24407
0
    if (link_state) {
24408
0
        key = xmalloc(sizeof (union ovsdb_atom));
24409
0
        datum.n = 1;
24410
0
        datum.keys = key;
24411
0
        key->s = ovsdb_atom_string_create(link_state);
24412
0
    } else {
24413
0
        datum.n = 0;
24414
0
        datum.keys = NULL;
24415
0
    }
24416
0
    datum.values = NULL;
24417
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]);
24418
0
}
24419
24420
/* Sets the "lldp" column's value from the "Interface" table in 'row'
24421
 * to 'lldp'.
24422
 *
24423
 * The caller retains ownership of 'lldp' and everything in it. */
24424
void
24425
ovsrec_interface_index_set_lldp(const struct ovsrec_interface *row, const struct smap *lldp)
24426
0
{
24427
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
24428
24429
0
    if (lldp) {
24430
0
        struct smap_node *node;
24431
0
        size_t i;
24432
24433
0
        datum->n = smap_count(lldp);
24434
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
24435
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
24436
0
        datum->refcnt = NULL;
24437
24438
0
        i = 0;
24439
0
        SMAP_FOR_EACH (node, lldp) {
24440
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
24441
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
24442
0
            i++;
24443
0
        }
24444
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_lldp.type);
24445
0
    } else {
24446
0
        ovsdb_datum_init_empty(datum);
24447
0
    }
24448
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
24449
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LLDP],
24450
0
                          datum,
24451
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
24452
0
    free(datum);
24453
0
}
24454
24455
24456
/* Sets the "mac" column from the "Interface" table in 'row' to
24457
 * the 'mac' set.
24458
 *
24459
 * If "mac" is null, the column will be the empty set,
24460
 * otherwise it will contain the specified value.
24461
 *
24462
 * The caller retains ownership of the arguments. */
24463
void
24464
ovsrec_interface_index_set_mac(const struct ovsrec_interface *row, const char *mac)
24465
0
{
24466
0
    struct ovsdb_datum datum;
24467
24468
0
    datum.refcnt = NULL;
24469
0
    union ovsdb_atom *key;
24470
24471
0
    if (mac) {
24472
0
        key = xmalloc(sizeof (union ovsdb_atom));
24473
0
        datum.n = 1;
24474
0
        datum.keys = key;
24475
0
        key->s = ovsdb_atom_string_create(mac);
24476
0
    } else {
24477
0
        datum.n = 0;
24478
0
        datum.keys = NULL;
24479
0
    }
24480
0
    datum.values = NULL;
24481
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]);
24482
0
}
24483
24484
/* Sets the "mac_in_use" column from the "Interface" table in 'row' to
24485
 * the 'mac_in_use' set.
24486
 *
24487
 * If "mac_in_use" is null, the column will be the empty set,
24488
 * otherwise it will contain the specified value.
24489
 *
24490
 * The caller retains ownership of the arguments. */
24491
void
24492
ovsrec_interface_index_set_mac_in_use(const struct ovsrec_interface *row, const char *mac_in_use)
24493
0
{
24494
0
    struct ovsdb_datum datum;
24495
24496
0
    datum.refcnt = NULL;
24497
0
    union ovsdb_atom *key;
24498
24499
0
    if (mac_in_use) {
24500
0
        key = xmalloc(sizeof (union ovsdb_atom));
24501
0
        datum.n = 1;
24502
0
        datum.keys = key;
24503
0
        key->s = ovsdb_atom_string_create(mac_in_use);
24504
0
    } else {
24505
0
        datum.n = 0;
24506
0
        datum.keys = NULL;
24507
0
    }
24508
0
    datum.values = NULL;
24509
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]);
24510
0
}
24511
24512
/* Sets the "mtu" column from the "Interface" table in 'row' to
24513
 * the 'mtu' set with 'n_mtu' entries.
24514
 *
24515
 * 'n_mtu' may be 0 or 1; if it is 0, then 'mtu'
24516
 * may be NULL.
24517
 *
24518
 * The caller retains ownership of the arguments. */
24519
void
24520
ovsrec_interface_index_set_mtu(const struct ovsrec_interface *row, const int64_t *mtu, size_t n_mtu)
24521
0
{
24522
0
    struct ovsdb_datum datum;
24523
24524
0
    datum.refcnt = NULL;
24525
0
    union ovsdb_atom *key;
24526
24527
0
    if (n_mtu) {
24528
0
        key = xmalloc(sizeof(union ovsdb_atom));
24529
0
        datum.n = 1;
24530
0
        datum.keys = key;
24531
0
        key->integer = *mtu;
24532
0
    } else {
24533
0
        datum.n = 0;
24534
0
        datum.keys = NULL;
24535
0
    }
24536
0
    datum.values = NULL;
24537
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]);
24538
0
}
24539
24540
/* Sets the "mtu_request" column from the "Interface" table in 'row' to
24541
 * the 'mtu_request' set with 'n_mtu_request' entries.
24542
 *
24543
 * 'n_mtu_request' may be 0 or 1; if it is 0, then 'mtu_request'
24544
 * may be NULL.
24545
 *
24546
 * Argument constraints: at least 1
24547
 *
24548
 * The caller retains ownership of the arguments. */
24549
void
24550
ovsrec_interface_index_set_mtu_request(const struct ovsrec_interface *row, const int64_t *mtu_request, size_t n_mtu_request)
24551
0
{
24552
0
    struct ovsdb_datum datum;
24553
24554
0
    datum.refcnt = NULL;
24555
0
    union ovsdb_atom *key;
24556
24557
0
    if (n_mtu_request) {
24558
0
        key = xmalloc(sizeof(union ovsdb_atom));
24559
0
        datum.n = 1;
24560
0
        datum.keys = key;
24561
0
        key->integer = *mtu_request;
24562
0
    } else {
24563
0
        datum.n = 0;
24564
0
        datum.keys = NULL;
24565
0
    }
24566
0
    datum.values = NULL;
24567
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]);
24568
0
}
24569
24570
/* Sets the "name" column from the "Interface" table in 'row' to
24571
 * 'name'.
24572
 *
24573
 * The caller retains ownership of the arguments. */
24574
void
24575
ovsrec_interface_index_set_name(const struct ovsrec_interface *row, const char *name)
24576
0
{
24577
0
    struct ovsdb_datum datum;
24578
24579
0
    datum.refcnt = NULL;
24580
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
24581
24582
0
    datum.n = 1;
24583
0
    datum.keys = key;
24584
0
    key->s = ovsdb_atom_string_create(name);
24585
0
    datum.values = NULL;
24586
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]);
24587
0
}
24588
24589
/* Sets the "ofport" column from the "Interface" table in 'row' to
24590
 * the 'ofport' set with 'n_ofport' entries.
24591
 *
24592
 * 'n_ofport' may be 0 or 1; if it is 0, then 'ofport'
24593
 * may be NULL.
24594
 *
24595
 * The caller retains ownership of the arguments. */
24596
void
24597
ovsrec_interface_index_set_ofport(const struct ovsrec_interface *row, const int64_t *ofport, size_t n_ofport)
24598
0
{
24599
0
    struct ovsdb_datum datum;
24600
24601
0
    datum.refcnt = NULL;
24602
0
    union ovsdb_atom *key;
24603
24604
0
    if (n_ofport) {
24605
0
        key = xmalloc(sizeof(union ovsdb_atom));
24606
0
        datum.n = 1;
24607
0
        datum.keys = key;
24608
0
        key->integer = *ofport;
24609
0
    } else {
24610
0
        datum.n = 0;
24611
0
        datum.keys = NULL;
24612
0
    }
24613
0
    datum.values = NULL;
24614
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]);
24615
0
}
24616
24617
/* Sets the "ofport_request" column from the "Interface" table in 'row' to
24618
 * the 'ofport_request' set with 'n_ofport_request' entries.
24619
 *
24620
 * 'n_ofport_request' may be 0 or 1; if it is 0, then 'ofport_request'
24621
 * may be NULL.
24622
 *
24623
 * Argument constraints: in range 1 to 65,279
24624
 *
24625
 * The caller retains ownership of the arguments. */
24626
void
24627
ovsrec_interface_index_set_ofport_request(const struct ovsrec_interface *row, const int64_t *ofport_request, size_t n_ofport_request)
24628
0
{
24629
0
    struct ovsdb_datum datum;
24630
24631
0
    datum.refcnt = NULL;
24632
0
    union ovsdb_atom *key;
24633
24634
0
    if (n_ofport_request) {
24635
0
        key = xmalloc(sizeof(union ovsdb_atom));
24636
0
        datum.n = 1;
24637
0
        datum.keys = key;
24638
0
        key->integer = *ofport_request;
24639
0
    } else {
24640
0
        datum.n = 0;
24641
0
        datum.keys = NULL;
24642
0
    }
24643
0
    datum.values = NULL;
24644
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]);
24645
0
}
24646
24647
/* Sets the "options" column's value from the "Interface" table in 'row'
24648
 * to 'options'.
24649
 *
24650
 * The caller retains ownership of 'options' and everything in it. */
24651
void
24652
ovsrec_interface_index_set_options(const struct ovsrec_interface *row, const struct smap *options)
24653
0
{
24654
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
24655
24656
0
    if (options) {
24657
0
        struct smap_node *node;
24658
0
        size_t i;
24659
24660
0
        datum->n = smap_count(options);
24661
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
24662
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
24663
0
        datum->refcnt = NULL;
24664
24665
0
        i = 0;
24666
0
        SMAP_FOR_EACH (node, options) {
24667
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
24668
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
24669
0
            i++;
24670
0
        }
24671
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_options.type);
24672
0
    } else {
24673
0
        ovsdb_datum_init_empty(datum);
24674
0
    }
24675
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
24676
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OPTIONS],
24677
0
                          datum,
24678
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
24679
0
    free(datum);
24680
0
}
24681
24682
24683
/* Sets the "other_config" column's value from the "Interface" table in 'row'
24684
 * to 'other_config'.
24685
 *
24686
 * The caller retains ownership of 'other_config' and everything in it. */
24687
void
24688
ovsrec_interface_index_set_other_config(const struct ovsrec_interface *row, const struct smap *other_config)
24689
0
{
24690
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
24691
24692
0
    if (other_config) {
24693
0
        struct smap_node *node;
24694
0
        size_t i;
24695
24696
0
        datum->n = smap_count(other_config);
24697
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
24698
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
24699
0
        datum->refcnt = NULL;
24700
24701
0
        i = 0;
24702
0
        SMAP_FOR_EACH (node, other_config) {
24703
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
24704
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
24705
0
            i++;
24706
0
        }
24707
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_other_config.type);
24708
0
    } else {
24709
0
        ovsdb_datum_init_empty(datum);
24710
0
    }
24711
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
24712
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OTHER_CONFIG],
24713
0
                          datum,
24714
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
24715
0
    free(datum);
24716
0
}
24717
24718
24719
/* Sets the "statistics" column from the "Interface" table in 'row' to
24720
 * the map with keys 'key_statistics' and values 'value_statistics'
24721
 * with 'n_statistics' entries.
24722
 *
24723
 * The caller retains ownership of the arguments. */
24724
void
24725
ovsrec_interface_index_set_statistics(const struct ovsrec_interface *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
24726
0
{
24727
0
    struct ovsdb_datum datum;
24728
24729
0
    datum.refcnt = NULL;
24730
0
    size_t i;
24731
24732
0
    datum.n = n_statistics;
24733
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
24734
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
24735
0
    for (i = 0; i < n_statistics; i++) {
24736
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
24737
0
        datum.values[i].integer = value_statistics[i];
24738
0
    }
24739
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_interface_col_statistics.type);
24740
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]);
24741
0
}
24742
24743
/* Sets the "status" column's value from the "Interface" table in 'row'
24744
 * to 'status'.
24745
 *
24746
 * The caller retains ownership of 'status' and everything in it. */
24747
void
24748
ovsrec_interface_index_set_status(const struct ovsrec_interface *row, const struct smap *status)
24749
0
{
24750
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
24751
24752
0
    if (status) {
24753
0
        struct smap_node *node;
24754
0
        size_t i;
24755
24756
0
        datum->n = smap_count(status);
24757
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
24758
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
24759
0
        datum->refcnt = NULL;
24760
24761
0
        i = 0;
24762
0
        SMAP_FOR_EACH (node, status) {
24763
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
24764
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
24765
0
            i++;
24766
0
        }
24767
0
        ovsdb_datum_sort_unique(datum, &ovsrec_interface_col_status.type);
24768
0
    } else {
24769
0
        ovsdb_datum_init_empty(datum);
24770
0
    }
24771
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
24772
0
                          &ovsrec_interface_columns[OVSREC_INTERFACE_COL_STATUS],
24773
0
                          datum,
24774
0
                          &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]);
24775
0
    free(datum);
24776
0
}
24777
24778
24779
/* Sets the "type" column from the "Interface" table in 'row' to
24780
 * 'type'.
24781
 *
24782
 * The caller retains ownership of the arguments. */
24783
void
24784
ovsrec_interface_index_set_type(const struct ovsrec_interface *row, const char *type)
24785
0
{
24786
0
    struct ovsdb_datum datum;
24787
24788
0
    datum.refcnt = NULL;
24789
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
24790
24791
0
    datum.n = 1;
24792
0
    datum.keys = key;
24793
0
    key->s = ovsdb_atom_string_create(type);
24794
0
    datum.values = NULL;
24795
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]);
24796
0
}
24797
24798
struct ovsdb_idl_column ovsrec_interface_columns[OVSREC_INTERFACE_N_COLUMNS];
24799
24800
unsigned int
24801
ovsrec_interface_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
24802
0
{
24803
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_interface, condition);
24804
0
}
24805
static struct json Interface_col_admin_state_key_enum_key_strings[2] = {
24806
    { .type = JSON_STRING, .string = "down", .count = 2 },
24807
    { .type = JSON_STRING, .string = "up", .count = 2 },
24808
};
24809
static union ovsdb_atom Interface_col_admin_state_key_enum_keys[2] = {
24810
    { .s = &Interface_col_admin_state_key_enum_key_strings[0] },
24811
    { .s = &Interface_col_admin_state_key_enum_key_strings[1] },
24812
};
24813
static struct ovsdb_datum Interface_col_admin_state_key_enum = {
24814
    .n = 2,
24815
    .keys = Interface_col_admin_state_key_enum_keys,
24816
};
24817
static struct json Interface_col_cfm_remote_opstate_key_enum_key_strings[2] = {
24818
    { .type = JSON_STRING, .string = "down", .count = 2 },
24819
    { .type = JSON_STRING, .string = "up", .count = 2 },
24820
};
24821
static union ovsdb_atom Interface_col_cfm_remote_opstate_key_enum_keys[2] = {
24822
    { .s = &Interface_col_cfm_remote_opstate_key_enum_key_strings[0] },
24823
    { .s = &Interface_col_cfm_remote_opstate_key_enum_key_strings[1] },
24824
};
24825
static struct ovsdb_datum Interface_col_cfm_remote_opstate_key_enum = {
24826
    .n = 2,
24827
    .keys = Interface_col_cfm_remote_opstate_key_enum_keys,
24828
};
24829
static struct json Interface_col_duplex_key_enum_key_strings[2] = {
24830
    { .type = JSON_STRING, .string = "full", .count = 2 },
24831
    { .type = JSON_STRING, .string = "half", .count = 2 },
24832
};
24833
static union ovsdb_atom Interface_col_duplex_key_enum_keys[2] = {
24834
    { .s = &Interface_col_duplex_key_enum_key_strings[0] },
24835
    { .s = &Interface_col_duplex_key_enum_key_strings[1] },
24836
};
24837
static struct ovsdb_datum Interface_col_duplex_key_enum = {
24838
    .n = 2,
24839
    .keys = Interface_col_duplex_key_enum_keys,
24840
};
24841
static struct json Interface_col_link_state_key_enum_key_strings[2] = {
24842
    { .type = JSON_STRING, .string = "down", .count = 2 },
24843
    { .type = JSON_STRING, .string = "up", .count = 2 },
24844
};
24845
static union ovsdb_atom Interface_col_link_state_key_enum_keys[2] = {
24846
    { .s = &Interface_col_link_state_key_enum_key_strings[0] },
24847
    { .s = &Interface_col_link_state_key_enum_key_strings[1] },
24848
};
24849
static struct ovsdb_datum Interface_col_link_state_key_enum = {
24850
    .n = 2,
24851
    .keys = Interface_col_link_state_key_enum_keys,
24852
};
24853
24854
struct ovsdb_idl_column ovsrec_interface_columns[OVSREC_INTERFACE_N_COLUMNS] = {
24855
    [OVSREC_INTERFACE_COL_ADMIN_STATE] = {
24856
         .name = "admin_state",
24857
         .type = {
24858
            .key = {
24859
               .type = OVSDB_TYPE_STRING,
24860
               .enum_ = &Interface_col_admin_state_key_enum,
24861
               .string = { .minLen = 0, .maxLen = UINT_MAX },
24862
            },
24863
            .value = OVSDB_BASE_VOID_INIT,
24864
            .n_min = 0,
24865
            .n_max = 1,
24866
         },
24867
         .is_mutable = true,
24868
         .is_synthetic = false,
24869
         .parse = ovsrec_interface_parse_admin_state,
24870
         .unparse = ovsrec_interface_unparse_admin_state,
24871
    },
24872
24873
    [OVSREC_INTERFACE_COL_BFD] = {
24874
         .name = "bfd",
24875
         .type = {
24876
            .key = {
24877
               .type = OVSDB_TYPE_STRING,
24878
               .string = { .minLen = 0, .maxLen = UINT_MAX },
24879
            },
24880
            .value = {
24881
                .type = OVSDB_TYPE_STRING,
24882
                .string = { .minLen = 0, .maxLen = UINT_MAX },
24883
            },
24884
            .n_min = 0,
24885
            .n_max = UINT_MAX,
24886
         },
24887
         .is_mutable = true,
24888
         .is_synthetic = false,
24889
         .parse = ovsrec_interface_parse_bfd,
24890
         .unparse = ovsrec_interface_unparse_bfd,
24891
    },
24892
24893
    [OVSREC_INTERFACE_COL_BFD_STATUS] = {
24894
         .name = "bfd_status",
24895
         .type = {
24896
            .key = {
24897
               .type = OVSDB_TYPE_STRING,
24898
               .string = { .minLen = 0, .maxLen = UINT_MAX },
24899
            },
24900
            .value = {
24901
                .type = OVSDB_TYPE_STRING,
24902
                .string = { .minLen = 0, .maxLen = UINT_MAX },
24903
            },
24904
            .n_min = 0,
24905
            .n_max = UINT_MAX,
24906
         },
24907
         .is_mutable = true,
24908
         .is_synthetic = false,
24909
         .parse = ovsrec_interface_parse_bfd_status,
24910
         .unparse = ovsrec_interface_unparse_bfd_status,
24911
    },
24912
24913
    [OVSREC_INTERFACE_COL_CFM_FAULT] = {
24914
         .name = "cfm_fault",
24915
         .type = {
24916
            .key = {
24917
               .type = OVSDB_TYPE_BOOLEAN,
24918
            },
24919
            .value = OVSDB_BASE_VOID_INIT,
24920
            .n_min = 0,
24921
            .n_max = 1,
24922
         },
24923
         .is_mutable = true,
24924
         .is_synthetic = false,
24925
         .parse = ovsrec_interface_parse_cfm_fault,
24926
         .unparse = ovsrec_interface_unparse_cfm_fault,
24927
    },
24928
24929
    [OVSREC_INTERFACE_COL_CFM_FAULT_STATUS] = {
24930
         .name = "cfm_fault_status",
24931
         .type = {
24932
            .key = {
24933
               .type = OVSDB_TYPE_STRING,
24934
               .string = { .minLen = 0, .maxLen = UINT_MAX },
24935
            },
24936
            .value = OVSDB_BASE_VOID_INIT,
24937
            .n_min = 0,
24938
            .n_max = UINT_MAX,
24939
         },
24940
         .is_mutable = true,
24941
         .is_synthetic = false,
24942
         .parse = ovsrec_interface_parse_cfm_fault_status,
24943
         .unparse = ovsrec_interface_unparse_cfm_fault_status,
24944
    },
24945
24946
    [OVSREC_INTERFACE_COL_CFM_FLAP_COUNT] = {
24947
         .name = "cfm_flap_count",
24948
         .type = {
24949
            .key = {
24950
               .type = OVSDB_TYPE_INTEGER,
24951
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
24952
            },
24953
            .value = OVSDB_BASE_VOID_INIT,
24954
            .n_min = 0,
24955
            .n_max = 1,
24956
         },
24957
         .is_mutable = true,
24958
         .is_synthetic = false,
24959
         .parse = ovsrec_interface_parse_cfm_flap_count,
24960
         .unparse = ovsrec_interface_unparse_cfm_flap_count,
24961
    },
24962
24963
    [OVSREC_INTERFACE_COL_CFM_HEALTH] = {
24964
         .name = "cfm_health",
24965
         .type = {
24966
            .key = {
24967
               .type = OVSDB_TYPE_INTEGER,
24968
               .integer = { .min = INT64_C(0), .max = INT64_C(100) },
24969
            },
24970
            .value = OVSDB_BASE_VOID_INIT,
24971
            .n_min = 0,
24972
            .n_max = 1,
24973
         },
24974
         .is_mutable = true,
24975
         .is_synthetic = false,
24976
         .parse = ovsrec_interface_parse_cfm_health,
24977
         .unparse = ovsrec_interface_unparse_cfm_health,
24978
    },
24979
24980
    [OVSREC_INTERFACE_COL_CFM_MPID] = {
24981
         .name = "cfm_mpid",
24982
         .type = {
24983
            .key = {
24984
               .type = OVSDB_TYPE_INTEGER,
24985
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
24986
            },
24987
            .value = OVSDB_BASE_VOID_INIT,
24988
            .n_min = 0,
24989
            .n_max = 1,
24990
         },
24991
         .is_mutable = true,
24992
         .is_synthetic = false,
24993
         .parse = ovsrec_interface_parse_cfm_mpid,
24994
         .unparse = ovsrec_interface_unparse_cfm_mpid,
24995
    },
24996
24997
    [OVSREC_INTERFACE_COL_CFM_REMOTE_MPIDS] = {
24998
         .name = "cfm_remote_mpids",
24999
         .type = {
25000
            .key = {
25001
               .type = OVSDB_TYPE_INTEGER,
25002
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
25003
            },
25004
            .value = OVSDB_BASE_VOID_INIT,
25005
            .n_min = 0,
25006
            .n_max = UINT_MAX,
25007
         },
25008
         .is_mutable = true,
25009
         .is_synthetic = false,
25010
         .parse = ovsrec_interface_parse_cfm_remote_mpids,
25011
         .unparse = ovsrec_interface_unparse_cfm_remote_mpids,
25012
    },
25013
25014
    [OVSREC_INTERFACE_COL_CFM_REMOTE_OPSTATE] = {
25015
         .name = "cfm_remote_opstate",
25016
         .type = {
25017
            .key = {
25018
               .type = OVSDB_TYPE_STRING,
25019
               .enum_ = &Interface_col_cfm_remote_opstate_key_enum,
25020
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25021
            },
25022
            .value = OVSDB_BASE_VOID_INIT,
25023
            .n_min = 0,
25024
            .n_max = 1,
25025
         },
25026
         .is_mutable = true,
25027
         .is_synthetic = false,
25028
         .parse = ovsrec_interface_parse_cfm_remote_opstate,
25029
         .unparse = ovsrec_interface_unparse_cfm_remote_opstate,
25030
    },
25031
25032
    [OVSREC_INTERFACE_COL_DUPLEX] = {
25033
         .name = "duplex",
25034
         .type = {
25035
            .key = {
25036
               .type = OVSDB_TYPE_STRING,
25037
               .enum_ = &Interface_col_duplex_key_enum,
25038
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25039
            },
25040
            .value = OVSDB_BASE_VOID_INIT,
25041
            .n_min = 0,
25042
            .n_max = 1,
25043
         },
25044
         .is_mutable = true,
25045
         .is_synthetic = false,
25046
         .parse = ovsrec_interface_parse_duplex,
25047
         .unparse = ovsrec_interface_unparse_duplex,
25048
    },
25049
25050
    [OVSREC_INTERFACE_COL_ERROR] = {
25051
         .name = "error",
25052
         .type = {
25053
            .key = {
25054
               .type = OVSDB_TYPE_STRING,
25055
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25056
            },
25057
            .value = OVSDB_BASE_VOID_INIT,
25058
            .n_min = 0,
25059
            .n_max = 1,
25060
         },
25061
         .is_mutable = true,
25062
         .is_synthetic = false,
25063
         .parse = ovsrec_interface_parse_error,
25064
         .unparse = ovsrec_interface_unparse_error,
25065
    },
25066
25067
    [OVSREC_INTERFACE_COL_EXTERNAL_IDS] = {
25068
         .name = "external_ids",
25069
         .type = {
25070
            .key = {
25071
               .type = OVSDB_TYPE_STRING,
25072
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25073
            },
25074
            .value = {
25075
                .type = OVSDB_TYPE_STRING,
25076
                .string = { .minLen = 0, .maxLen = UINT_MAX },
25077
            },
25078
            .n_min = 0,
25079
            .n_max = UINT_MAX,
25080
         },
25081
         .is_mutable = true,
25082
         .is_synthetic = false,
25083
         .parse = ovsrec_interface_parse_external_ids,
25084
         .unparse = ovsrec_interface_unparse_external_ids,
25085
    },
25086
25087
    [OVSREC_INTERFACE_COL_IFINDEX] = {
25088
         .name = "ifindex",
25089
         .type = {
25090
            .key = {
25091
               .type = OVSDB_TYPE_INTEGER,
25092
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
25093
            },
25094
            .value = OVSDB_BASE_VOID_INIT,
25095
            .n_min = 0,
25096
            .n_max = 1,
25097
         },
25098
         .is_mutable = true,
25099
         .is_synthetic = false,
25100
         .parse = ovsrec_interface_parse_ifindex,
25101
         .unparse = ovsrec_interface_unparse_ifindex,
25102
    },
25103
25104
    [OVSREC_INTERFACE_COL_INGRESS_POLICING_BURST] = {
25105
         .name = "ingress_policing_burst",
25106
         .type = {
25107
            .key = {
25108
               .type = OVSDB_TYPE_INTEGER,
25109
               .integer = { .min = INT64_C(0), .max = INT64_MAX },
25110
            },
25111
            .value = OVSDB_BASE_VOID_INIT,
25112
            .n_min = 1,
25113
            .n_max = 1,
25114
         },
25115
         .is_mutable = true,
25116
         .is_synthetic = false,
25117
         .parse = ovsrec_interface_parse_ingress_policing_burst,
25118
         .unparse = ovsrec_interface_unparse_ingress_policing_burst,
25119
    },
25120
25121
    [OVSREC_INTERFACE_COL_INGRESS_POLICING_KPKTS_BURST] = {
25122
         .name = "ingress_policing_kpkts_burst",
25123
         .type = {
25124
            .key = {
25125
               .type = OVSDB_TYPE_INTEGER,
25126
               .integer = { .min = INT64_C(0), .max = INT64_MAX },
25127
            },
25128
            .value = OVSDB_BASE_VOID_INIT,
25129
            .n_min = 1,
25130
            .n_max = 1,
25131
         },
25132
         .is_mutable = true,
25133
         .is_synthetic = false,
25134
         .parse = ovsrec_interface_parse_ingress_policing_kpkts_burst,
25135
         .unparse = ovsrec_interface_unparse_ingress_policing_kpkts_burst,
25136
    },
25137
25138
    [OVSREC_INTERFACE_COL_INGRESS_POLICING_KPKTS_RATE] = {
25139
         .name = "ingress_policing_kpkts_rate",
25140
         .type = {
25141
            .key = {
25142
               .type = OVSDB_TYPE_INTEGER,
25143
               .integer = { .min = INT64_C(0), .max = INT64_MAX },
25144
            },
25145
            .value = OVSDB_BASE_VOID_INIT,
25146
            .n_min = 1,
25147
            .n_max = 1,
25148
         },
25149
         .is_mutable = true,
25150
         .is_synthetic = false,
25151
         .parse = ovsrec_interface_parse_ingress_policing_kpkts_rate,
25152
         .unparse = ovsrec_interface_unparse_ingress_policing_kpkts_rate,
25153
    },
25154
25155
    [OVSREC_INTERFACE_COL_INGRESS_POLICING_RATE] = {
25156
         .name = "ingress_policing_rate",
25157
         .type = {
25158
            .key = {
25159
               .type = OVSDB_TYPE_INTEGER,
25160
               .integer = { .min = INT64_C(0), .max = INT64_MAX },
25161
            },
25162
            .value = OVSDB_BASE_VOID_INIT,
25163
            .n_min = 1,
25164
            .n_max = 1,
25165
         },
25166
         .is_mutable = true,
25167
         .is_synthetic = false,
25168
         .parse = ovsrec_interface_parse_ingress_policing_rate,
25169
         .unparse = ovsrec_interface_unparse_ingress_policing_rate,
25170
    },
25171
25172
    [OVSREC_INTERFACE_COL_LACP_CURRENT] = {
25173
         .name = "lacp_current",
25174
         .type = {
25175
            .key = {
25176
               .type = OVSDB_TYPE_BOOLEAN,
25177
            },
25178
            .value = OVSDB_BASE_VOID_INIT,
25179
            .n_min = 0,
25180
            .n_max = 1,
25181
         },
25182
         .is_mutable = true,
25183
         .is_synthetic = false,
25184
         .parse = ovsrec_interface_parse_lacp_current,
25185
         .unparse = ovsrec_interface_unparse_lacp_current,
25186
    },
25187
25188
    [OVSREC_INTERFACE_COL_LINK_RESETS] = {
25189
         .name = "link_resets",
25190
         .type = {
25191
            .key = {
25192
               .type = OVSDB_TYPE_INTEGER,
25193
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
25194
            },
25195
            .value = OVSDB_BASE_VOID_INIT,
25196
            .n_min = 0,
25197
            .n_max = 1,
25198
         },
25199
         .is_mutable = true,
25200
         .is_synthetic = false,
25201
         .parse = ovsrec_interface_parse_link_resets,
25202
         .unparse = ovsrec_interface_unparse_link_resets,
25203
    },
25204
25205
    [OVSREC_INTERFACE_COL_LINK_SPEED] = {
25206
         .name = "link_speed",
25207
         .type = {
25208
            .key = {
25209
               .type = OVSDB_TYPE_INTEGER,
25210
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
25211
            },
25212
            .value = OVSDB_BASE_VOID_INIT,
25213
            .n_min = 0,
25214
            .n_max = 1,
25215
         },
25216
         .is_mutable = true,
25217
         .is_synthetic = false,
25218
         .parse = ovsrec_interface_parse_link_speed,
25219
         .unparse = ovsrec_interface_unparse_link_speed,
25220
    },
25221
25222
    [OVSREC_INTERFACE_COL_LINK_STATE] = {
25223
         .name = "link_state",
25224
         .type = {
25225
            .key = {
25226
               .type = OVSDB_TYPE_STRING,
25227
               .enum_ = &Interface_col_link_state_key_enum,
25228
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25229
            },
25230
            .value = OVSDB_BASE_VOID_INIT,
25231
            .n_min = 0,
25232
            .n_max = 1,
25233
         },
25234
         .is_mutable = true,
25235
         .is_synthetic = false,
25236
         .parse = ovsrec_interface_parse_link_state,
25237
         .unparse = ovsrec_interface_unparse_link_state,
25238
    },
25239
25240
    [OVSREC_INTERFACE_COL_LLDP] = {
25241
         .name = "lldp",
25242
         .type = {
25243
            .key = {
25244
               .type = OVSDB_TYPE_STRING,
25245
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25246
            },
25247
            .value = {
25248
                .type = OVSDB_TYPE_STRING,
25249
                .string = { .minLen = 0, .maxLen = UINT_MAX },
25250
            },
25251
            .n_min = 0,
25252
            .n_max = UINT_MAX,
25253
         },
25254
         .is_mutable = true,
25255
         .is_synthetic = false,
25256
         .parse = ovsrec_interface_parse_lldp,
25257
         .unparse = ovsrec_interface_unparse_lldp,
25258
    },
25259
25260
    [OVSREC_INTERFACE_COL_MAC] = {
25261
         .name = "mac",
25262
         .type = {
25263
            .key = {
25264
               .type = OVSDB_TYPE_STRING,
25265
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25266
            },
25267
            .value = OVSDB_BASE_VOID_INIT,
25268
            .n_min = 0,
25269
            .n_max = 1,
25270
         },
25271
         .is_mutable = true,
25272
         .is_synthetic = false,
25273
         .parse = ovsrec_interface_parse_mac,
25274
         .unparse = ovsrec_interface_unparse_mac,
25275
    },
25276
25277
    [OVSREC_INTERFACE_COL_MAC_IN_USE] = {
25278
         .name = "mac_in_use",
25279
         .type = {
25280
            .key = {
25281
               .type = OVSDB_TYPE_STRING,
25282
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25283
            },
25284
            .value = OVSDB_BASE_VOID_INIT,
25285
            .n_min = 0,
25286
            .n_max = 1,
25287
         },
25288
         .is_mutable = true,
25289
         .is_synthetic = false,
25290
         .parse = ovsrec_interface_parse_mac_in_use,
25291
         .unparse = ovsrec_interface_unparse_mac_in_use,
25292
    },
25293
25294
    [OVSREC_INTERFACE_COL_MTU] = {
25295
         .name = "mtu",
25296
         .type = {
25297
            .key = {
25298
               .type = OVSDB_TYPE_INTEGER,
25299
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
25300
            },
25301
            .value = OVSDB_BASE_VOID_INIT,
25302
            .n_min = 0,
25303
            .n_max = 1,
25304
         },
25305
         .is_mutable = true,
25306
         .is_synthetic = false,
25307
         .parse = ovsrec_interface_parse_mtu,
25308
         .unparse = ovsrec_interface_unparse_mtu,
25309
    },
25310
25311
    [OVSREC_INTERFACE_COL_MTU_REQUEST] = {
25312
         .name = "mtu_request",
25313
         .type = {
25314
            .key = {
25315
               .type = OVSDB_TYPE_INTEGER,
25316
               .integer = { .min = INT64_C(1), .max = INT64_MAX },
25317
            },
25318
            .value = OVSDB_BASE_VOID_INIT,
25319
            .n_min = 0,
25320
            .n_max = 1,
25321
         },
25322
         .is_mutable = true,
25323
         .is_synthetic = false,
25324
         .parse = ovsrec_interface_parse_mtu_request,
25325
         .unparse = ovsrec_interface_unparse_mtu_request,
25326
    },
25327
25328
    [OVSREC_INTERFACE_COL_NAME] = {
25329
         .name = "name",
25330
         .type = {
25331
            .key = {
25332
               .type = OVSDB_TYPE_STRING,
25333
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25334
            },
25335
            .value = OVSDB_BASE_VOID_INIT,
25336
            .n_min = 1,
25337
            .n_max = 1,
25338
         },
25339
         .is_mutable = false,
25340
         .is_synthetic = false,
25341
         .parse = ovsrec_interface_parse_name,
25342
         .unparse = ovsrec_interface_unparse_name,
25343
    },
25344
25345
    [OVSREC_INTERFACE_COL_OFPORT] = {
25346
         .name = "ofport",
25347
         .type = {
25348
            .key = {
25349
               .type = OVSDB_TYPE_INTEGER,
25350
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
25351
            },
25352
            .value = OVSDB_BASE_VOID_INIT,
25353
            .n_min = 0,
25354
            .n_max = 1,
25355
         },
25356
         .is_mutable = true,
25357
         .is_synthetic = false,
25358
         .parse = ovsrec_interface_parse_ofport,
25359
         .unparse = ovsrec_interface_unparse_ofport,
25360
    },
25361
25362
    [OVSREC_INTERFACE_COL_OFPORT_REQUEST] = {
25363
         .name = "ofport_request",
25364
         .type = {
25365
            .key = {
25366
               .type = OVSDB_TYPE_INTEGER,
25367
               .integer = { .min = INT64_C(1), .max = INT64_C(65279) },
25368
            },
25369
            .value = OVSDB_BASE_VOID_INIT,
25370
            .n_min = 0,
25371
            .n_max = 1,
25372
         },
25373
         .is_mutable = true,
25374
         .is_synthetic = false,
25375
         .parse = ovsrec_interface_parse_ofport_request,
25376
         .unparse = ovsrec_interface_unparse_ofport_request,
25377
    },
25378
25379
    [OVSREC_INTERFACE_COL_OPTIONS] = {
25380
         .name = "options",
25381
         .type = {
25382
            .key = {
25383
               .type = OVSDB_TYPE_STRING,
25384
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25385
            },
25386
            .value = {
25387
                .type = OVSDB_TYPE_STRING,
25388
                .string = { .minLen = 0, .maxLen = UINT_MAX },
25389
            },
25390
            .n_min = 0,
25391
            .n_max = UINT_MAX,
25392
         },
25393
         .is_mutable = true,
25394
         .is_synthetic = false,
25395
         .parse = ovsrec_interface_parse_options,
25396
         .unparse = ovsrec_interface_unparse_options,
25397
    },
25398
25399
    [OVSREC_INTERFACE_COL_OTHER_CONFIG] = {
25400
         .name = "other_config",
25401
         .type = {
25402
            .key = {
25403
               .type = OVSDB_TYPE_STRING,
25404
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25405
            },
25406
            .value = {
25407
                .type = OVSDB_TYPE_STRING,
25408
                .string = { .minLen = 0, .maxLen = UINT_MAX },
25409
            },
25410
            .n_min = 0,
25411
            .n_max = UINT_MAX,
25412
         },
25413
         .is_mutable = true,
25414
         .is_synthetic = false,
25415
         .parse = ovsrec_interface_parse_other_config,
25416
         .unparse = ovsrec_interface_unparse_other_config,
25417
    },
25418
25419
    [OVSREC_INTERFACE_COL_STATISTICS] = {
25420
         .name = "statistics",
25421
         .type = {
25422
            .key = {
25423
               .type = OVSDB_TYPE_STRING,
25424
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25425
            },
25426
            .value = {
25427
                .type = OVSDB_TYPE_INTEGER,
25428
                .integer = { .min = INT64_MIN, .max = INT64_MAX },
25429
            },
25430
            .n_min = 0,
25431
            .n_max = UINT_MAX,
25432
         },
25433
         .is_mutable = true,
25434
         .is_synthetic = false,
25435
         .parse = ovsrec_interface_parse_statistics,
25436
         .unparse = ovsrec_interface_unparse_statistics,
25437
    },
25438
25439
    [OVSREC_INTERFACE_COL_STATUS] = {
25440
         .name = "status",
25441
         .type = {
25442
            .key = {
25443
               .type = OVSDB_TYPE_STRING,
25444
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25445
            },
25446
            .value = {
25447
                .type = OVSDB_TYPE_STRING,
25448
                .string = { .minLen = 0, .maxLen = UINT_MAX },
25449
            },
25450
            .n_min = 0,
25451
            .n_max = UINT_MAX,
25452
         },
25453
         .is_mutable = true,
25454
         .is_synthetic = false,
25455
         .parse = ovsrec_interface_parse_status,
25456
         .unparse = ovsrec_interface_unparse_status,
25457
    },
25458
25459
    [OVSREC_INTERFACE_COL_TYPE] = {
25460
         .name = "type",
25461
         .type = {
25462
            .key = {
25463
               .type = OVSDB_TYPE_STRING,
25464
               .string = { .minLen = 0, .maxLen = UINT_MAX },
25465
            },
25466
            .value = OVSDB_BASE_VOID_INIT,
25467
            .n_min = 1,
25468
            .n_max = 1,
25469
         },
25470
         .is_mutable = true,
25471
         .is_synthetic = false,
25472
         .parse = ovsrec_interface_parse_type,
25473
         .unparse = ovsrec_interface_unparse_type,
25474
    },
25475
25476
};
25477

25478
/* Manager table. */
25479
25480
bool
25481
ovsrec_server_has_manager_table_col_connection_mode(const struct ovsdb_idl *idl)
25482
0
{
25483
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_connection_mode);
25484
0
}
25485
25486
25487
bool
25488
ovsrec_server_has_manager_table_col_external_ids(const struct ovsdb_idl *idl)
25489
0
{
25490
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_external_ids);
25491
0
}
25492
25493
25494
bool
25495
ovsrec_server_has_manager_table_col_inactivity_probe(const struct ovsdb_idl *idl)
25496
0
{
25497
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_inactivity_probe);
25498
0
}
25499
25500
25501
bool
25502
ovsrec_server_has_manager_table_col_is_connected(const struct ovsdb_idl *idl)
25503
0
{
25504
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_is_connected);
25505
0
}
25506
25507
25508
bool
25509
ovsrec_server_has_manager_table_col_max_backoff(const struct ovsdb_idl *idl)
25510
0
{
25511
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_max_backoff);
25512
0
}
25513
25514
25515
bool
25516
ovsrec_server_has_manager_table_col_other_config(const struct ovsdb_idl *idl)
25517
0
{
25518
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_other_config);
25519
0
}
25520
25521
25522
bool
25523
ovsrec_server_has_manager_table_col_status(const struct ovsdb_idl *idl)
25524
0
{
25525
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_status);
25526
0
}
25527
25528
25529
bool
25530
ovsrec_server_has_manager_table_col_target(const struct ovsdb_idl *idl)
25531
0
{
25532
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_manager_col_target);
25533
0
}
25534
25535
25536
bool
25537
ovsrec_server_has_manager_table(const struct ovsdb_idl *idl)
25538
0
{
25539
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
25540
0
}
25541
25542
25543
const struct ovsrec_manager_table *
25544
ovsrec_manager_table_get(const struct ovsdb_idl *idl)
25545
0
{
25546
0
    return (const struct ovsrec_manager_table *) idl;
25547
0
}
25548
25549
const struct ovsrec_manager *
25550
ovsrec_manager_table_first(const struct ovsrec_manager_table *table)
25551
0
{
25552
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
25553
0
    return ovsrec_manager_first(idl);
25554
0
}
25555
25556
25557
const struct ovsrec_manager *
25558
ovsrec_manager_table_track_get_first(const struct ovsrec_manager_table *table)
25559
0
{
25560
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
25561
0
    return ovsrec_manager_track_get_first(idl);
25562
0
}
25563
25564
25565
static void
25566
ovsrec_manager_parse_connection_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
25567
0
{
25568
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25569
25570
0
    if (datum->n >= 1) {
25571
0
        row->connection_mode = datum->keys[0].s->string;
25572
0
    } else {
25573
0
        row->connection_mode = NULL;
25574
0
    }
25575
0
}
25576
25577
static void
25578
ovsrec_manager_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
25579
0
{
25580
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25581
0
    smap_init(&row->external_ids);
25582
0
    for (size_t i = 0; i < datum->n; i++) {
25583
0
        smap_add(&row->external_ids,
25584
0
                 json_string(datum->keys[i].s),
25585
0
                 json_string(datum->values[i].s));
25586
0
    }
25587
0
}
25588
25589
static void
25590
ovsrec_manager_parse_inactivity_probe(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
25591
0
{
25592
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25593
0
    size_t n = MIN(1, datum->n);
25594
0
    row->inactivity_probe = NULL;
25595
0
    row->n_inactivity_probe = 0;
25596
0
    for (size_t i = 0; i < n; i++) {
25597
0
        if (!row->n_inactivity_probe) {
25598
0
            row->inactivity_probe = xmalloc(n * sizeof *row->inactivity_probe);
25599
0
        }
25600
0
        row->inactivity_probe[row->n_inactivity_probe] = datum->keys[i].integer;
25601
0
        row->n_inactivity_probe++;
25602
0
    }
25603
0
}
25604
25605
static void
25606
ovsrec_manager_parse_is_connected(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
25607
0
{
25608
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25609
25610
0
    if (datum->n >= 1) {
25611
0
        row->is_connected = datum->keys[0].boolean;
25612
0
    } else {
25613
0
        row->is_connected = false;
25614
0
    }
25615
0
}
25616
25617
static void
25618
ovsrec_manager_parse_max_backoff(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
25619
0
{
25620
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25621
0
    size_t n = MIN(1, datum->n);
25622
0
    row->max_backoff = NULL;
25623
0
    row->n_max_backoff = 0;
25624
0
    for (size_t i = 0; i < n; i++) {
25625
0
        if (!row->n_max_backoff) {
25626
0
            row->max_backoff = xmalloc(n * sizeof *row->max_backoff);
25627
0
        }
25628
0
        row->max_backoff[row->n_max_backoff] = datum->keys[i].integer;
25629
0
        row->n_max_backoff++;
25630
0
    }
25631
0
}
25632
25633
static void
25634
ovsrec_manager_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
25635
0
{
25636
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25637
0
    smap_init(&row->other_config);
25638
0
    for (size_t i = 0; i < datum->n; i++) {
25639
0
        smap_add(&row->other_config,
25640
0
                 json_string(datum->keys[i].s),
25641
0
                 json_string(datum->values[i].s));
25642
0
    }
25643
0
}
25644
25645
static void
25646
ovsrec_manager_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
25647
0
{
25648
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25649
0
    smap_init(&row->status);
25650
0
    for (size_t i = 0; i < datum->n; i++) {
25651
0
        smap_add(&row->status,
25652
0
                 json_string(datum->keys[i].s),
25653
0
                 json_string(datum->values[i].s));
25654
0
    }
25655
0
}
25656
25657
static void
25658
ovsrec_manager_parse_target(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
25659
0
{
25660
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25661
25662
0
    if (datum->n >= 1) {
25663
0
        row->target = datum->keys[0].s->string;
25664
0
    } else {
25665
0
        row->target = "";
25666
0
    }
25667
0
}
25668
25669
static void
25670
ovsrec_manager_unparse_connection_mode(struct ovsdb_idl_row *row OVS_UNUSED)
25671
0
{
25672
    /* Nothing to do. */
25673
0
}
25674
25675
static void
25676
ovsrec_manager_unparse_external_ids(struct ovsdb_idl_row *row_)
25677
0
{
25678
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25679
0
    smap_destroy(&row->external_ids);
25680
0
}
25681
25682
static void
25683
ovsrec_manager_unparse_inactivity_probe(struct ovsdb_idl_row *row_)
25684
0
{
25685
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25686
0
    free(row->inactivity_probe);
25687
0
}
25688
25689
static void
25690
ovsrec_manager_unparse_is_connected(struct ovsdb_idl_row *row OVS_UNUSED)
25691
0
{
25692
    /* Nothing to do. */
25693
0
}
25694
25695
static void
25696
ovsrec_manager_unparse_max_backoff(struct ovsdb_idl_row *row_)
25697
0
{
25698
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25699
0
    free(row->max_backoff);
25700
0
}
25701
25702
static void
25703
ovsrec_manager_unparse_other_config(struct ovsdb_idl_row *row_)
25704
0
{
25705
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25706
0
    smap_destroy(&row->other_config);
25707
0
}
25708
25709
static void
25710
ovsrec_manager_unparse_status(struct ovsdb_idl_row *row_)
25711
0
{
25712
0
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
25713
0
    smap_destroy(&row->status);
25714
0
}
25715
25716
static void
25717
ovsrec_manager_unparse_target(struct ovsdb_idl_row *row OVS_UNUSED)
25718
0
{
25719
    /* Nothing to do. */
25720
0
}
25721
25722
static void
25723
ovsrec_manager_init__(struct ovsdb_idl_row *row)
25724
0
{
25725
0
    ovsrec_manager_init(ovsrec_manager_cast(row));
25726
0
}
25727
25728
/* Clears the contents of 'row' in table "Manager". */
25729
void
25730
ovsrec_manager_init(struct ovsrec_manager *row)
25731
0
{
25732
0
    memset(row, 0, sizeof *row); 
25733
0
    smap_init(&row->external_ids);
25734
0
    smap_init(&row->other_config);
25735
0
    smap_init(&row->status);
25736
0
    row->target = "";
25737
0
}
25738
25739
/* Searches table "Manager" in 'idl' for a row with UUID 'uuid'.  Returns
25740
 * a pointer to the row if there is one, otherwise a null pointer.  */
25741
const struct ovsrec_manager *
25742
ovsrec_manager_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
25743
0
{
25744
0
    return ovsrec_manager_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_manager, uuid));
25745
0
}
25746
25747
/* Searches table "Manager" for a row with UUID 'uuid'.  Returns
25748
 * a pointer to the row if there is one, otherwise a null pointer.  */
25749
const struct ovsrec_manager *
25750
ovsrec_manager_table_get_for_uuid(const struct ovsrec_manager_table *table, const struct uuid *uuid)
25751
0
{
25752
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
25753
0
    return ovsrec_manager_get_for_uuid(idl, uuid);
25754
0
}
25755
25756
/* Returns a row in table "Manager" in 'idl', or a null pointer if that
25757
 * table is empty.
25758
 *
25759
 * Database tables are internally maintained as hash tables, so adding or
25760
 * removing rows while traversing the same table can cause some rows to be
25761
 * visited twice or not at apply. */
25762
const struct ovsrec_manager *
25763
ovsrec_manager_first(const struct ovsdb_idl *idl)
25764
0
{
25765
0
    return ovsrec_manager_cast(ovsdb_idl_first_row(idl, &ovsrec_table_manager));
25766
0
}
25767
25768
/* Returns a row following 'row' within its table, or a null pointer if 'row'
25769
 * is the last row in its table. */
25770
const struct ovsrec_manager *
25771
ovsrec_manager_next(const struct ovsrec_manager *row)
25772
0
{
25773
0
    return ovsrec_manager_cast(ovsdb_idl_next_row(&row->header_));
25774
0
}
25775
25776
unsigned int ovsrec_manager_get_seqno(const struct ovsdb_idl *idl)
25777
0
{
25778
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_manager);
25779
0
}
25780
25781
unsigned int ovsrec_manager_row_get_seqno(const struct ovsrec_manager *row, enum ovsdb_idl_change change)
25782
0
{
25783
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
25784
0
}
25785
25786
const struct ovsrec_manager *
25787
ovsrec_manager_track_get_first(const struct ovsdb_idl *idl)
25788
0
{
25789
0
    return ovsrec_manager_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_manager));
25790
0
}
25791
25792
const struct ovsrec_manager
25793
*ovsrec_manager_track_get_next(const struct ovsrec_manager *row)
25794
0
{
25795
0
    return ovsrec_manager_cast(ovsdb_idl_track_get_next(&row->header_));
25796
0
}
25797
25798
25799
/* Deletes 'row' from table "Manager".  'row' may be freed, so it must not be
25800
 * accessed afterward.
25801
 *
25802
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
25803
void
25804
ovsrec_manager_delete(const struct ovsrec_manager *row)
25805
0
{
25806
0
    ovsdb_idl_txn_delete(&row->header_);
25807
0
}
25808
25809
/* Inserts and returns a new row in the table "Manager" in the database
25810
 * with open transaction 'txn'.
25811
 *
25812
 * The new row is assigned a randomly generated provisional UUID.
25813
 * ovsdb-server will assign a different UUID when 'txn' is committed,
25814
 * but the IDL will replace any uses of the provisional UUID in the
25815
 * data to be to be committed by the UUID assigned by ovsdb-server. */
25816
struct ovsrec_manager *
25817
ovsrec_manager_insert(struct ovsdb_idl_txn *txn)
25818
0
{
25819
0
    return ovsrec_manager_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_manager, NULL));
25820
0
}
25821
25822
/* Inserts and returns a new row in the table "Manager" in the database
25823
 * with open transaction 'txn'.
25824
 *
25825
 * The new row is assigned the UUID specified in the 'uuid' parameter
25826
 * (which cannot be null).  ovsdb-server will try to assign the same
25827
 * UUID when 'txn' is committed. */
25828
struct ovsrec_manager *
25829
ovsrec_manager_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
25830
0
{
25831
0
    return ovsrec_manager_cast(ovsdb_idl_txn_insert_persist_uuid(
25832
0
        txn, &ovsrec_table_manager, uuid));
25833
0
}
25834
25835
bool
25836
ovsrec_manager_is_updated(const struct ovsrec_manager *row, enum ovsrec_manager_column_id column)
25837
0
{
25838
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_manager_columns[column]);
25839
0
}
25840
25841
/* Causes the original contents of column "connection_mode" in 'row' to be
25842
 * verified as a prerequisite to completing the transaction.  That is, if
25843
 * "connection_mode" in 'row' changed (or if 'row' was deleted) between the
25844
 * time that the IDL originally read its contents and the time that the
25845
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
25846
 *
25847
 * The intention is that, to ensure that no transaction commits based on dirty
25848
 * reads, an application should call this function any time "connection_mode" is
25849
 * read as part of a read-modify-write operation.
25850
 *
25851
 * In some cases this function reduces to a no-op, because the current value
25852
 * of "connection_mode" is already known:
25853
 *
25854
 *   - If 'row' is a row created by the current transaction (returned by
25855
 *     ovsrec_manager_insert()).
25856
 *
25857
 *   - If "connection_mode" has already been modified (with
25858
 *     ovsrec_manager_set_connection_mode()) within the current transaction.
25859
 *
25860
 * Because of the latter property, always call this function *before*
25861
 * ovsrec_manager_set_connection_mode() for a given read-modify-write.
25862
 *
25863
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
25864
void
25865
ovsrec_manager_verify_connection_mode(const struct ovsrec_manager *row)
25866
0
{
25867
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_connection_mode);
25868
0
}
25869
25870
/* Causes the original contents of column "external_ids" in 'row' to be
25871
 * verified as a prerequisite to completing the transaction.  That is, if
25872
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
25873
 * time that the IDL originally read its contents and the time that the
25874
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
25875
 *
25876
 * The intention is that, to ensure that no transaction commits based on dirty
25877
 * reads, an application should call this function any time "external_ids" is
25878
 * read as part of a read-modify-write operation.
25879
 *
25880
 * In some cases this function reduces to a no-op, because the current value
25881
 * of "external_ids" is already known:
25882
 *
25883
 *   - If 'row' is a row created by the current transaction (returned by
25884
 *     ovsrec_manager_insert()).
25885
 *
25886
 *   - If "external_ids" has already been modified (with
25887
 *     ovsrec_manager_set_external_ids()) within the current transaction.
25888
 *
25889
 * Because of the latter property, always call this function *before*
25890
 * ovsrec_manager_set_external_ids() for a given read-modify-write.
25891
 *
25892
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
25893
void
25894
ovsrec_manager_verify_external_ids(const struct ovsrec_manager *row)
25895
0
{
25896
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_external_ids);
25897
0
}
25898
25899
/* Causes the original contents of column "inactivity_probe" in 'row' to be
25900
 * verified as a prerequisite to completing the transaction.  That is, if
25901
 * "inactivity_probe" in 'row' changed (or if 'row' was deleted) between the
25902
 * time that the IDL originally read its contents and the time that the
25903
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
25904
 *
25905
 * The intention is that, to ensure that no transaction commits based on dirty
25906
 * reads, an application should call this function any time "inactivity_probe" is
25907
 * read as part of a read-modify-write operation.
25908
 *
25909
 * In some cases this function reduces to a no-op, because the current value
25910
 * of "inactivity_probe" is already known:
25911
 *
25912
 *   - If 'row' is a row created by the current transaction (returned by
25913
 *     ovsrec_manager_insert()).
25914
 *
25915
 *   - If "inactivity_probe" has already been modified (with
25916
 *     ovsrec_manager_set_inactivity_probe()) within the current transaction.
25917
 *
25918
 * Because of the latter property, always call this function *before*
25919
 * ovsrec_manager_set_inactivity_probe() for a given read-modify-write.
25920
 *
25921
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
25922
void
25923
ovsrec_manager_verify_inactivity_probe(const struct ovsrec_manager *row)
25924
0
{
25925
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_inactivity_probe);
25926
0
}
25927
25928
/* Causes the original contents of column "is_connected" in 'row' to be
25929
 * verified as a prerequisite to completing the transaction.  That is, if
25930
 * "is_connected" in 'row' changed (or if 'row' was deleted) between the
25931
 * time that the IDL originally read its contents and the time that the
25932
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
25933
 *
25934
 * The intention is that, to ensure that no transaction commits based on dirty
25935
 * reads, an application should call this function any time "is_connected" is
25936
 * read as part of a read-modify-write operation.
25937
 *
25938
 * In some cases this function reduces to a no-op, because the current value
25939
 * of "is_connected" is already known:
25940
 *
25941
 *   - If 'row' is a row created by the current transaction (returned by
25942
 *     ovsrec_manager_insert()).
25943
 *
25944
 *   - If "is_connected" has already been modified (with
25945
 *     ovsrec_manager_set_is_connected()) within the current transaction.
25946
 *
25947
 * Because of the latter property, always call this function *before*
25948
 * ovsrec_manager_set_is_connected() for a given read-modify-write.
25949
 *
25950
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
25951
void
25952
ovsrec_manager_verify_is_connected(const struct ovsrec_manager *row)
25953
0
{
25954
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_is_connected);
25955
0
}
25956
25957
/* Causes the original contents of column "max_backoff" in 'row' to be
25958
 * verified as a prerequisite to completing the transaction.  That is, if
25959
 * "max_backoff" in 'row' changed (or if 'row' was deleted) between the
25960
 * time that the IDL originally read its contents and the time that the
25961
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
25962
 *
25963
 * The intention is that, to ensure that no transaction commits based on dirty
25964
 * reads, an application should call this function any time "max_backoff" is
25965
 * read as part of a read-modify-write operation.
25966
 *
25967
 * In some cases this function reduces to a no-op, because the current value
25968
 * of "max_backoff" is already known:
25969
 *
25970
 *   - If 'row' is a row created by the current transaction (returned by
25971
 *     ovsrec_manager_insert()).
25972
 *
25973
 *   - If "max_backoff" has already been modified (with
25974
 *     ovsrec_manager_set_max_backoff()) within the current transaction.
25975
 *
25976
 * Because of the latter property, always call this function *before*
25977
 * ovsrec_manager_set_max_backoff() for a given read-modify-write.
25978
 *
25979
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
25980
void
25981
ovsrec_manager_verify_max_backoff(const struct ovsrec_manager *row)
25982
0
{
25983
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_max_backoff);
25984
0
}
25985
25986
/* Causes the original contents of column "other_config" in 'row' to be
25987
 * verified as a prerequisite to completing the transaction.  That is, if
25988
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
25989
 * time that the IDL originally read its contents and the time that the
25990
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
25991
 *
25992
 * The intention is that, to ensure that no transaction commits based on dirty
25993
 * reads, an application should call this function any time "other_config" is
25994
 * read as part of a read-modify-write operation.
25995
 *
25996
 * In some cases this function reduces to a no-op, because the current value
25997
 * of "other_config" is already known:
25998
 *
25999
 *   - If 'row' is a row created by the current transaction (returned by
26000
 *     ovsrec_manager_insert()).
26001
 *
26002
 *   - If "other_config" has already been modified (with
26003
 *     ovsrec_manager_set_other_config()) within the current transaction.
26004
 *
26005
 * Because of the latter property, always call this function *before*
26006
 * ovsrec_manager_set_other_config() for a given read-modify-write.
26007
 *
26008
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
26009
void
26010
ovsrec_manager_verify_other_config(const struct ovsrec_manager *row)
26011
0
{
26012
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_other_config);
26013
0
}
26014
26015
/* Causes the original contents of column "status" in 'row' to be
26016
 * verified as a prerequisite to completing the transaction.  That is, if
26017
 * "status" in 'row' changed (or if 'row' was deleted) between the
26018
 * time that the IDL originally read its contents and the time that the
26019
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
26020
 *
26021
 * The intention is that, to ensure that no transaction commits based on dirty
26022
 * reads, an application should call this function any time "status" is
26023
 * read as part of a read-modify-write operation.
26024
 *
26025
 * In some cases this function reduces to a no-op, because the current value
26026
 * of "status" is already known:
26027
 *
26028
 *   - If 'row' is a row created by the current transaction (returned by
26029
 *     ovsrec_manager_insert()).
26030
 *
26031
 *   - If "status" has already been modified (with
26032
 *     ovsrec_manager_set_status()) within the current transaction.
26033
 *
26034
 * Because of the latter property, always call this function *before*
26035
 * ovsrec_manager_set_status() for a given read-modify-write.
26036
 *
26037
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
26038
void
26039
ovsrec_manager_verify_status(const struct ovsrec_manager *row)
26040
0
{
26041
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_status);
26042
0
}
26043
26044
/* Causes the original contents of column "target" in 'row' to be
26045
 * verified as a prerequisite to completing the transaction.  That is, if
26046
 * "target" in 'row' changed (or if 'row' was deleted) between the
26047
 * time that the IDL originally read its contents and the time that the
26048
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
26049
 *
26050
 * The intention is that, to ensure that no transaction commits based on dirty
26051
 * reads, an application should call this function any time "target" is
26052
 * read as part of a read-modify-write operation.
26053
 *
26054
 * In some cases this function reduces to a no-op, because the current value
26055
 * of "target" is already known:
26056
 *
26057
 *   - If 'row' is a row created by the current transaction (returned by
26058
 *     ovsrec_manager_insert()).
26059
 *
26060
 *   - If "target" has already been modified (with
26061
 *     ovsrec_manager_set_target()) within the current transaction.
26062
 *
26063
 * Because of the latter property, always call this function *before*
26064
 * ovsrec_manager_set_target() for a given read-modify-write.
26065
 *
26066
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
26067
void
26068
ovsrec_manager_verify_target(const struct ovsrec_manager *row)
26069
0
{
26070
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_col_target);
26071
0
}
26072
26073
/* Returns the "connection_mode" column's value from the "Manager" table in 'row'
26074
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
26075
 * ovsdb_datum_find_key() is an easier and more efficient way to search
26076
 * for a given key than implementing the same operation on the "cooked"
26077
 * form in 'row'.
26078
 *
26079
 * 'key_type' must be OVSDB_TYPE_STRING.
26080
 * (This helps to avoid silent bugs if someone changes connection_mode's
26081
 * type without updating the caller.)
26082
 *
26083
 * The caller must not modify or free the returned value.
26084
 *
26085
 * Various kinds of changes can invalidate the returned value: modifying
26086
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
26087
 * If the returned value is needed for a long time, it is best to make a copy
26088
 * of it with ovsdb_datum_clone().
26089
 *
26090
 * This function is rarely useful, since it is easier to access the value
26091
 * directly through the "connection_mode" member in ovsrec_manager. */
26092
const struct ovsdb_datum *
26093
ovsrec_manager_get_connection_mode(const struct ovsrec_manager *row,
26094
  enum ovsdb_atomic_type key_type OVS_UNUSED)
26095
0
{
26096
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
26097
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_connection_mode);
26098
0
}
26099
26100
/* Returns the "external_ids" column's value from the "Manager" table in 'row'
26101
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
26102
 * ovsdb_datum_find_key() is an easier and more efficient way to search
26103
 * for a given key than implementing the same operation on the "cooked"
26104
 * form in 'row'.
26105
 *
26106
 * 'key_type' must be OVSDB_TYPE_STRING.
26107
 * 'value_type' must be OVSDB_TYPE_STRING.
26108
 * (This helps to avoid silent bugs if someone changes external_ids's
26109
 * type without updating the caller.)
26110
 *
26111
 * The caller must not modify or free the returned value.
26112
 *
26113
 * Various kinds of changes can invalidate the returned value: modifying
26114
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
26115
 * If the returned value is needed for a long time, it is best to make a copy
26116
 * of it with ovsdb_datum_clone().
26117
 *
26118
 * This function is rarely useful, since it is easier to access the value
26119
 * directly through the "external_ids" member in ovsrec_manager. */
26120
const struct ovsdb_datum *
26121
ovsrec_manager_get_external_ids(const struct ovsrec_manager *row,
26122
  enum ovsdb_atomic_type key_type OVS_UNUSED,
26123
  enum ovsdb_atomic_type value_type OVS_UNUSED)
26124
0
{
26125
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
26126
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
26127
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_external_ids);
26128
0
}
26129
26130
/* Returns the "inactivity_probe" column's value from the "Manager" table in 'row'
26131
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
26132
 * ovsdb_datum_find_key() is an easier and more efficient way to search
26133
 * for a given key than implementing the same operation on the "cooked"
26134
 * form in 'row'.
26135
 *
26136
 * 'key_type' must be OVSDB_TYPE_INTEGER.
26137
 * (This helps to avoid silent bugs if someone changes inactivity_probe's
26138
 * type without updating the caller.)
26139
 *
26140
 * The caller must not modify or free the returned value.
26141
 *
26142
 * Various kinds of changes can invalidate the returned value: modifying
26143
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
26144
 * If the returned value is needed for a long time, it is best to make a copy
26145
 * of it with ovsdb_datum_clone().
26146
 *
26147
 * This function is rarely useful, since it is easier to access the value
26148
 * directly through the "inactivity_probe" member in ovsrec_manager. */
26149
const struct ovsdb_datum *
26150
ovsrec_manager_get_inactivity_probe(const struct ovsrec_manager *row,
26151
  enum ovsdb_atomic_type key_type OVS_UNUSED)
26152
0
{
26153
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
26154
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_inactivity_probe);
26155
0
}
26156
26157
/* Returns the "is_connected" column's value from the "Manager" table in 'row'
26158
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
26159
 * ovsdb_datum_find_key() is an easier and more efficient way to search
26160
 * for a given key than implementing the same operation on the "cooked"
26161
 * form in 'row'.
26162
 *
26163
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
26164
 * (This helps to avoid silent bugs if someone changes is_connected's
26165
 * type without updating the caller.)
26166
 *
26167
 * The caller must not modify or free the returned value.
26168
 *
26169
 * Various kinds of changes can invalidate the returned value: modifying
26170
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
26171
 * If the returned value is needed for a long time, it is best to make a copy
26172
 * of it with ovsdb_datum_clone().
26173
 *
26174
 * This function is rarely useful, since it is easier to access the value
26175
 * directly through the "is_connected" member in ovsrec_manager. */
26176
const struct ovsdb_datum *
26177
ovsrec_manager_get_is_connected(const struct ovsrec_manager *row,
26178
  enum ovsdb_atomic_type key_type OVS_UNUSED)
26179
0
{
26180
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
26181
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_is_connected);
26182
0
}
26183
26184
/* Returns the "max_backoff" column's value from the "Manager" table in 'row'
26185
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
26186
 * ovsdb_datum_find_key() is an easier and more efficient way to search
26187
 * for a given key than implementing the same operation on the "cooked"
26188
 * form in 'row'.
26189
 *
26190
 * 'key_type' must be OVSDB_TYPE_INTEGER.
26191
 * (This helps to avoid silent bugs if someone changes max_backoff's
26192
 * type without updating the caller.)
26193
 *
26194
 * The caller must not modify or free the returned value.
26195
 *
26196
 * Various kinds of changes can invalidate the returned value: modifying
26197
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
26198
 * If the returned value is needed for a long time, it is best to make a copy
26199
 * of it with ovsdb_datum_clone().
26200
 *
26201
 * This function is rarely useful, since it is easier to access the value
26202
 * directly through the "max_backoff" member in ovsrec_manager. */
26203
const struct ovsdb_datum *
26204
ovsrec_manager_get_max_backoff(const struct ovsrec_manager *row,
26205
  enum ovsdb_atomic_type key_type OVS_UNUSED)
26206
0
{
26207
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
26208
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_max_backoff);
26209
0
}
26210
26211
/* Returns the "other_config" column's value from the "Manager" table in 'row'
26212
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
26213
 * ovsdb_datum_find_key() is an easier and more efficient way to search
26214
 * for a given key than implementing the same operation on the "cooked"
26215
 * form in 'row'.
26216
 *
26217
 * 'key_type' must be OVSDB_TYPE_STRING.
26218
 * 'value_type' must be OVSDB_TYPE_STRING.
26219
 * (This helps to avoid silent bugs if someone changes other_config's
26220
 * type without updating the caller.)
26221
 *
26222
 * The caller must not modify or free the returned value.
26223
 *
26224
 * Various kinds of changes can invalidate the returned value: modifying
26225
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
26226
 * If the returned value is needed for a long time, it is best to make a copy
26227
 * of it with ovsdb_datum_clone().
26228
 *
26229
 * This function is rarely useful, since it is easier to access the value
26230
 * directly through the "other_config" member in ovsrec_manager. */
26231
const struct ovsdb_datum *
26232
ovsrec_manager_get_other_config(const struct ovsrec_manager *row,
26233
  enum ovsdb_atomic_type key_type OVS_UNUSED,
26234
  enum ovsdb_atomic_type value_type OVS_UNUSED)
26235
0
{
26236
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
26237
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
26238
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_other_config);
26239
0
}
26240
26241
/* Returns the "status" column's value from the "Manager" table in 'row'
26242
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
26243
 * ovsdb_datum_find_key() is an easier and more efficient way to search
26244
 * for a given key than implementing the same operation on the "cooked"
26245
 * form in 'row'.
26246
 *
26247
 * 'key_type' must be OVSDB_TYPE_STRING.
26248
 * 'value_type' must be OVSDB_TYPE_STRING.
26249
 * (This helps to avoid silent bugs if someone changes status's
26250
 * type without updating the caller.)
26251
 *
26252
 * The caller must not modify or free the returned value.
26253
 *
26254
 * Various kinds of changes can invalidate the returned value: modifying
26255
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
26256
 * If the returned value is needed for a long time, it is best to make a copy
26257
 * of it with ovsdb_datum_clone().
26258
 *
26259
 * This function is rarely useful, since it is easier to access the value
26260
 * directly through the "status" member in ovsrec_manager. */
26261
const struct ovsdb_datum *
26262
ovsrec_manager_get_status(const struct ovsrec_manager *row,
26263
  enum ovsdb_atomic_type key_type OVS_UNUSED,
26264
  enum ovsdb_atomic_type value_type OVS_UNUSED)
26265
0
{
26266
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
26267
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
26268
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_status);
26269
0
}
26270
26271
/* Returns the "target" column's value from the "Manager" table in 'row'
26272
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
26273
 * ovsdb_datum_find_key() is an easier and more efficient way to search
26274
 * for a given key than implementing the same operation on the "cooked"
26275
 * form in 'row'.
26276
 *
26277
 * 'key_type' must be OVSDB_TYPE_STRING.
26278
 * (This helps to avoid silent bugs if someone changes target's
26279
 * type without updating the caller.)
26280
 *
26281
 * The caller must not modify or free the returned value.
26282
 *
26283
 * Various kinds of changes can invalidate the returned value: modifying
26284
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
26285
 * If the returned value is needed for a long time, it is best to make a copy
26286
 * of it with ovsdb_datum_clone().
26287
 *
26288
 * This function is rarely useful, since it is easier to access the value
26289
 * directly through the "target" member in ovsrec_manager. */
26290
const struct ovsdb_datum *
26291
ovsrec_manager_get_target(const struct ovsrec_manager *row,
26292
  enum ovsdb_atomic_type key_type OVS_UNUSED)
26293
0
{
26294
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
26295
0
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_target);
26296
0
}
26297
26298
/* Sets the "connection_mode" column from the "Manager" table in 'row' to
26299
 * the 'connection_mode' set.
26300
 *
26301
 * If "connection_mode" is null, the column will be the empty set,
26302
 * otherwise it will contain the specified value.
26303
 *
26304
 * Argument constraints: either "in-band" or "out-of-band"
26305
 *
26306
 * The caller retains ownership of the arguments. */
26307
void
26308
ovsrec_manager_set_connection_mode(const struct ovsrec_manager *row, const char *connection_mode)
26309
0
{
26310
0
    struct ovsdb_datum datum;
26311
26312
0
    datum.refcnt = NULL;
26313
26314
0
    if (connection_mode) {
26315
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
26316
0
        datum.n = 1;
26317
0
        datum.keys = key;
26318
0
        key->s = ovsdb_atom_string_create(connection_mode);
26319
0
    } else {
26320
0
        datum.n = 0;
26321
0
        datum.keys = NULL;
26322
0
    }
26323
0
    datum.values = NULL;
26324
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_manager_col_connection_mode, &datum);
26325
0
}
26326
26327
/* Sets the "external_ids" column's value from the "Manager" table in 'row'
26328
 * to 'external_ids'.
26329
 *
26330
 * The caller retains ownership of 'external_ids' and everything in it. */
26331
void
26332
ovsrec_manager_set_external_ids(const struct ovsrec_manager *row, const struct smap *external_ids)
26333
0
{
26334
0
    struct ovsdb_datum datum;
26335
26336
0
    if (external_ids) {
26337
0
        ovsdb_datum_from_smap(&datum, external_ids);
26338
0
    } else {
26339
0
        ovsdb_datum_init_empty(&datum);
26340
0
    }
26341
0
    ovsdb_idl_txn_write(&row->header_,
26342
0
                        &ovsrec_manager_col_external_ids,
26343
0
                        &datum);
26344
0
}
26345
26346
26347
/* Sets the "inactivity_probe" column from the "Manager" table in 'row' to
26348
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
26349
 *
26350
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
26351
 * may be NULL.
26352
 *
26353
 * The caller retains ownership of the arguments. */
26354
void
26355
ovsrec_manager_set_inactivity_probe(const struct ovsrec_manager *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
26356
0
{
26357
0
    struct ovsdb_datum datum;
26358
26359
0
    datum.refcnt = NULL;
26360
26361
0
    if (n_inactivity_probe) {
26362
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
26363
0
        datum.n = 1;
26364
0
        datum.keys = key;
26365
0
        key->integer = *inactivity_probe;
26366
0
    } else {
26367
0
        datum.n = 0;
26368
0
        datum.keys = NULL;
26369
0
    }
26370
0
    datum.values = NULL;
26371
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_manager_col_inactivity_probe, &datum);
26372
0
}
26373
26374
/* Sets the "is_connected" column from the "Manager" table in 'row' to
26375
 * 'is_connected'.
26376
 *
26377
 * The caller retains ownership of the arguments. */
26378
void
26379
ovsrec_manager_set_is_connected(const struct ovsrec_manager *row, bool is_connected)
26380
0
{
26381
0
    struct ovsdb_datum datum;
26382
26383
0
    datum.refcnt = NULL;
26384
26385
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
26386
26387
0
    datum.n = 1;
26388
0
    datum.keys = key;
26389
0
    key->boolean = is_connected;
26390
0
    datum.values = NULL;
26391
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_manager_col_is_connected, &datum);
26392
0
}
26393
26394
/* Sets the "max_backoff" column from the "Manager" table in 'row' to
26395
 * the 'max_backoff' set with 'n_max_backoff' entries.
26396
 *
26397
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
26398
 * may be NULL.
26399
 *
26400
 * Argument constraints: at least 1,000
26401
 *
26402
 * The caller retains ownership of the arguments. */
26403
void
26404
ovsrec_manager_set_max_backoff(const struct ovsrec_manager *row, const int64_t *max_backoff, size_t n_max_backoff)
26405
0
{
26406
0
    struct ovsdb_datum datum;
26407
26408
0
    datum.refcnt = NULL;
26409
26410
0
    if (n_max_backoff) {
26411
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
26412
0
        datum.n = 1;
26413
0
        datum.keys = key;
26414
0
        key->integer = *max_backoff;
26415
0
    } else {
26416
0
        datum.n = 0;
26417
0
        datum.keys = NULL;
26418
0
    }
26419
0
    datum.values = NULL;
26420
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_manager_col_max_backoff, &datum);
26421
0
}
26422
26423
/* Sets the "other_config" column's value from the "Manager" table in 'row'
26424
 * to 'other_config'.
26425
 *
26426
 * The caller retains ownership of 'other_config' and everything in it. */
26427
void
26428
ovsrec_manager_set_other_config(const struct ovsrec_manager *row, const struct smap *other_config)
26429
0
{
26430
0
    struct ovsdb_datum datum;
26431
26432
0
    if (other_config) {
26433
0
        ovsdb_datum_from_smap(&datum, other_config);
26434
0
    } else {
26435
0
        ovsdb_datum_init_empty(&datum);
26436
0
    }
26437
0
    ovsdb_idl_txn_write(&row->header_,
26438
0
                        &ovsrec_manager_col_other_config,
26439
0
                        &datum);
26440
0
}
26441
26442
26443
/* Sets the "status" column's value from the "Manager" table in 'row'
26444
 * to 'status'.
26445
 *
26446
 * The caller retains ownership of 'status' and everything in it. */
26447
void
26448
ovsrec_manager_set_status(const struct ovsrec_manager *row, const struct smap *status)
26449
0
{
26450
0
    struct ovsdb_datum datum;
26451
26452
0
    if (status) {
26453
0
        ovsdb_datum_from_smap(&datum, status);
26454
0
    } else {
26455
0
        ovsdb_datum_init_empty(&datum);
26456
0
    }
26457
0
    ovsdb_idl_txn_write(&row->header_,
26458
0
                        &ovsrec_manager_col_status,
26459
0
                        &datum);
26460
0
}
26461
26462
26463
/* Sets the "target" column from the "Manager" table in 'row' to
26464
 * 'target'.
26465
 *
26466
 * The caller retains ownership of the arguments. */
26467
void
26468
ovsrec_manager_set_target(const struct ovsrec_manager *row, const char *target)
26469
0
{
26470
0
    struct ovsdb_datum datum;
26471
26472
0
    datum.refcnt = NULL;
26473
26474
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
26475
26476
0
    datum.n = 1;
26477
0
    datum.keys = key;
26478
0
    key->s = ovsdb_atom_string_create(target);
26479
0
    datum.values = NULL;
26480
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_manager_col_target, &datum);
26481
0
}
26482
26483
/* Adds the value 'new_value' to the "connection_mode" set column from the "Manager" table
26484
 * in 'row'.
26485
 *
26486
 */
26487
void
26488
ovsrec_manager_update_connection_mode_addvalue(const struct ovsrec_manager *row, const char *new_value)
26489
0
{
26490
0
    struct ovsdb_datum *datum;
26491
26492
0
    datum = xmalloc(sizeof *datum);
26493
0
    datum->n = 1;
26494
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
26495
0
    datum->values = NULL;
26496
0
    datum->refcnt = NULL;
26497
26498
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
26499
26500
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
26501
0
                                    &ovsrec_manager_col_connection_mode,
26502
0
                                    datum);
26503
0
}
26504
26505
/* Deletes the value 'delete_value' from the "connection_mode" set column from the
26506
 * "Manager" table in 'row'.
26507
 *
26508
 */
26509
void
26510
ovsrec_manager_update_connection_mode_delvalue(const struct ovsrec_manager *row, const char *delete_value)
26511
0
{
26512
0
    struct ovsdb_datum *datum;
26513
26514
0
    datum = xmalloc(sizeof *datum);
26515
0
    datum->n = 1;
26516
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
26517
0
    datum->values = NULL;
26518
0
    datum->refcnt = NULL;
26519
26520
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
26521
26522
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
26523
0
                                    &ovsrec_manager_col_connection_mode,
26524
0
                                    datum);
26525
0
}
26526
26527
/* Sets an element of the "external_ids" map column from the "Manager" table in 'row'
26528
 * to 'new_value' given the key value 'new_key'.
26529
 *
26530
 */
26531
void
26532
ovsrec_manager_update_external_ids_setkey(const struct ovsrec_manager *row, const char *new_key, const char *new_value)
26533
0
{
26534
0
    struct ovsdb_datum *datum;
26535
26536
0
    datum = xmalloc(sizeof *datum);
26537
0
    datum->n = 1;
26538
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
26539
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
26540
0
    datum->refcnt = NULL;
26541
26542
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
26543
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
26544
26545
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
26546
0
                                    &ovsrec_manager_col_external_ids,
26547
0
                                    datum);
26548
0
}
26549
26550
/* Deletes an element of the "external_ids" map column from the "Manager" table in 'row'
26551
 * given the key value 'delete_key'.
26552
 *
26553
 */
26554
void
26555
ovsrec_manager_update_external_ids_delkey(const struct ovsrec_manager *row, const char *delete_key)
26556
0
{
26557
0
    struct ovsdb_datum *datum;
26558
26559
0
    datum = xmalloc(sizeof *datum);
26560
0
    datum->n = 1;
26561
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
26562
0
    datum->values = NULL;
26563
0
    datum->refcnt = NULL;
26564
26565
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
26566
26567
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
26568
0
                                    &ovsrec_manager_col_external_ids,
26569
0
                                    datum);
26570
0
}
26571
26572
/* Adds the value 'new_value' to the "inactivity_probe" set column from the "Manager" table
26573
 * in 'row'.
26574
 *
26575
 */
26576
void
26577
ovsrec_manager_update_inactivity_probe_addvalue(const struct ovsrec_manager *row, int64_t new_value)
26578
0
{
26579
0
    struct ovsdb_datum *datum;
26580
26581
0
    datum = xmalloc(sizeof *datum);
26582
0
    datum->n = 1;
26583
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
26584
0
    datum->values = NULL;
26585
0
    datum->refcnt = NULL;
26586
26587
0
    datum->keys[0].integer = new_value;
26588
26589
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
26590
0
                                    &ovsrec_manager_col_inactivity_probe,
26591
0
                                    datum);
26592
0
}
26593
26594
/* Deletes the value 'delete_value' from the "inactivity_probe" set column from the
26595
 * "Manager" table in 'row'.
26596
 *
26597
 */
26598
void
26599
ovsrec_manager_update_inactivity_probe_delvalue(const struct ovsrec_manager *row, int64_t delete_value)
26600
0
{
26601
0
    struct ovsdb_datum *datum;
26602
26603
0
    datum = xmalloc(sizeof *datum);
26604
0
    datum->n = 1;
26605
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
26606
0
    datum->values = NULL;
26607
0
    datum->refcnt = NULL;
26608
26609
0
    datum->keys[0].integer = delete_value;
26610
26611
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
26612
0
                                    &ovsrec_manager_col_inactivity_probe,
26613
0
                                    datum);
26614
0
}
26615
26616
/* Adds the value 'new_value' to the "max_backoff" set column from the "Manager" table
26617
 * in 'row'.
26618
 *
26619
 */
26620
void
26621
ovsrec_manager_update_max_backoff_addvalue(const struct ovsrec_manager *row, int64_t new_value)
26622
0
{
26623
0
    struct ovsdb_datum *datum;
26624
26625
0
    datum = xmalloc(sizeof *datum);
26626
0
    datum->n = 1;
26627
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
26628
0
    datum->values = NULL;
26629
0
    datum->refcnt = NULL;
26630
26631
0
    datum->keys[0].integer = new_value;
26632
26633
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
26634
0
                                    &ovsrec_manager_col_max_backoff,
26635
0
                                    datum);
26636
0
}
26637
26638
/* Deletes the value 'delete_value' from the "max_backoff" set column from the
26639
 * "Manager" table in 'row'.
26640
 *
26641
 */
26642
void
26643
ovsrec_manager_update_max_backoff_delvalue(const struct ovsrec_manager *row, int64_t delete_value)
26644
0
{
26645
0
    struct ovsdb_datum *datum;
26646
26647
0
    datum = xmalloc(sizeof *datum);
26648
0
    datum->n = 1;
26649
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
26650
0
    datum->values = NULL;
26651
0
    datum->refcnt = NULL;
26652
26653
0
    datum->keys[0].integer = delete_value;
26654
26655
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
26656
0
                                    &ovsrec_manager_col_max_backoff,
26657
0
                                    datum);
26658
0
}
26659
26660
/* Sets an element of the "other_config" map column from the "Manager" table in 'row'
26661
 * to 'new_value' given the key value 'new_key'.
26662
 *
26663
 */
26664
void
26665
ovsrec_manager_update_other_config_setkey(const struct ovsrec_manager *row, const char *new_key, const char *new_value)
26666
0
{
26667
0
    struct ovsdb_datum *datum;
26668
26669
0
    datum = xmalloc(sizeof *datum);
26670
0
    datum->n = 1;
26671
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
26672
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
26673
0
    datum->refcnt = NULL;
26674
26675
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
26676
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
26677
26678
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
26679
0
                                    &ovsrec_manager_col_other_config,
26680
0
                                    datum);
26681
0
}
26682
26683
/* Deletes an element of the "other_config" map column from the "Manager" table in 'row'
26684
 * given the key value 'delete_key'.
26685
 *
26686
 */
26687
void
26688
ovsrec_manager_update_other_config_delkey(const struct ovsrec_manager *row, const char *delete_key)
26689
0
{
26690
0
    struct ovsdb_datum *datum;
26691
26692
0
    datum = xmalloc(sizeof *datum);
26693
0
    datum->n = 1;
26694
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
26695
0
    datum->values = NULL;
26696
0
    datum->refcnt = NULL;
26697
26698
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
26699
26700
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
26701
0
                                    &ovsrec_manager_col_other_config,
26702
0
                                    datum);
26703
0
}
26704
26705
/* Sets an element of the "status" map column from the "Manager" table in 'row'
26706
 * to 'new_value' given the key value 'new_key'.
26707
 *
26708
 */
26709
void
26710
ovsrec_manager_update_status_setkey(const struct ovsrec_manager *row, const char *new_key, const char *new_value)
26711
0
{
26712
0
    struct ovsdb_datum *datum;
26713
26714
0
    datum = xmalloc(sizeof *datum);
26715
0
    datum->n = 1;
26716
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
26717
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
26718
0
    datum->refcnt = NULL;
26719
26720
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
26721
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
26722
26723
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
26724
0
                                    &ovsrec_manager_col_status,
26725
0
                                    datum);
26726
0
}
26727
26728
/* Deletes an element of the "status" map column from the "Manager" table in 'row'
26729
 * given the key value 'delete_key'.
26730
 *
26731
 */
26732
void
26733
ovsrec_manager_update_status_delkey(const struct ovsrec_manager *row, const char *delete_key)
26734
0
{
26735
0
    struct ovsdb_datum *datum;
26736
26737
0
    datum = xmalloc(sizeof *datum);
26738
0
    datum->n = 1;
26739
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
26740
0
    datum->values = NULL;
26741
0
    datum->refcnt = NULL;
26742
26743
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
26744
26745
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
26746
0
                                    &ovsrec_manager_col_status,
26747
0
                                    datum);
26748
0
}
26749
26750
/* Sets the "connection_mode" column from the "Manager" table in 'row' to
26751
 * the 'connection_mode' set.
26752
 *
26753
 * If "connection_mode" is null, the column will be the empty set,
26754
 * otherwise it will contain the specified value.
26755
 *
26756
 * Argument constraints: either "in-band" or "out-of-band"
26757
 *
26758
 * The caller retains ownership of the arguments. */
26759
void
26760
ovsrec_manager_add_clause_connection_mode(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *connection_mode)
26761
0
{
26762
0
    struct ovsdb_datum datum;
26763
26764
0
    datum.refcnt = NULL;
26765
26766
0
    if (connection_mode) {
26767
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
26768
0
        datum.n = 1;
26769
0
        datum.keys = key;
26770
0
        key->s = ovsdb_atom_string_create(connection_mode);
26771
0
    } else {
26772
0
        datum.n = 0;
26773
0
        datum.keys = NULL;
26774
0
    }
26775
0
    datum.values = NULL;
26776
0
    ovsdb_idl_condition_add_clause(cond,
26777
0
                          function,
26778
0
                          &ovsrec_manager_col_connection_mode,
26779
0
                          &datum);
26780
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_connection_mode.type);
26781
0
}
26782
26783
/* Sets the "external_ids" column's value from the "Manager" table in 'row'
26784
 * to 'external_ids'.
26785
 *
26786
 * The caller retains ownership of 'external_ids' and everything in it. */
26787
void
26788
ovsrec_manager_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
26789
0
{
26790
0
    struct ovsdb_datum datum;
26791
26792
0
    if (external_ids) {
26793
0
        ovsdb_datum_from_smap(&datum, external_ids);
26794
0
    } else {
26795
0
        ovsdb_datum_init_empty(&datum);
26796
0
    }
26797
26798
0
    ovsdb_idl_condition_add_clause(cond,
26799
0
                                   function,
26800
0
                                   &ovsrec_manager_col_external_ids,
26801
0
                                   &datum);
26802
26803
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_external_ids.type);
26804
0
}
26805
26806
26807
/* Sets the "inactivity_probe" column from the "Manager" table in 'row' to
26808
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
26809
 *
26810
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
26811
 * may be NULL.
26812
 *
26813
 * The caller retains ownership of the arguments. */
26814
void
26815
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)
26816
0
{
26817
0
    struct ovsdb_datum datum;
26818
26819
0
    datum.refcnt = NULL;
26820
26821
0
    if (n_inactivity_probe) {
26822
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
26823
0
        datum.n = 1;
26824
0
        datum.keys = key;
26825
0
        key->integer = *inactivity_probe;
26826
0
    } else {
26827
0
        datum.n = 0;
26828
0
        datum.keys = NULL;
26829
0
    }
26830
0
    datum.values = NULL;
26831
0
    ovsdb_idl_condition_add_clause(cond,
26832
0
                          function,
26833
0
                          &ovsrec_manager_col_inactivity_probe,
26834
0
                          &datum);
26835
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_inactivity_probe.type);
26836
0
}
26837
26838
/* Sets the "is_connected" column from the "Manager" table in 'row' to
26839
 * 'is_connected'.
26840
 *
26841
 * The caller retains ownership of the arguments. */
26842
void
26843
ovsrec_manager_add_clause_is_connected(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool is_connected)
26844
0
{
26845
0
    struct ovsdb_datum datum;
26846
26847
0
    datum.refcnt = NULL;
26848
26849
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
26850
26851
0
    datum.n = 1;
26852
0
    datum.keys = key;
26853
0
    key->boolean = is_connected;
26854
0
    datum.values = NULL;
26855
0
    ovsdb_idl_condition_add_clause(cond,
26856
0
                          function,
26857
0
                          &ovsrec_manager_col_is_connected,
26858
0
                          &datum);
26859
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_is_connected.type);
26860
0
}
26861
26862
/* Sets the "max_backoff" column from the "Manager" table in 'row' to
26863
 * the 'max_backoff' set with 'n_max_backoff' entries.
26864
 *
26865
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
26866
 * may be NULL.
26867
 *
26868
 * Argument constraints: at least 1,000
26869
 *
26870
 * The caller retains ownership of the arguments. */
26871
void
26872
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)
26873
0
{
26874
0
    struct ovsdb_datum datum;
26875
26876
0
    datum.refcnt = NULL;
26877
26878
0
    if (n_max_backoff) {
26879
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
26880
0
        datum.n = 1;
26881
0
        datum.keys = key;
26882
0
        key->integer = *max_backoff;
26883
0
    } else {
26884
0
        datum.n = 0;
26885
0
        datum.keys = NULL;
26886
0
    }
26887
0
    datum.values = NULL;
26888
0
    ovsdb_idl_condition_add_clause(cond,
26889
0
                          function,
26890
0
                          &ovsrec_manager_col_max_backoff,
26891
0
                          &datum);
26892
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_max_backoff.type);
26893
0
}
26894
26895
/* Sets the "other_config" column's value from the "Manager" table in 'row'
26896
 * to 'other_config'.
26897
 *
26898
 * The caller retains ownership of 'other_config' and everything in it. */
26899
void
26900
ovsrec_manager_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
26901
0
{
26902
0
    struct ovsdb_datum datum;
26903
26904
0
    if (other_config) {
26905
0
        ovsdb_datum_from_smap(&datum, other_config);
26906
0
    } else {
26907
0
        ovsdb_datum_init_empty(&datum);
26908
0
    }
26909
26910
0
    ovsdb_idl_condition_add_clause(cond,
26911
0
                                   function,
26912
0
                                   &ovsrec_manager_col_other_config,
26913
0
                                   &datum);
26914
26915
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_other_config.type);
26916
0
}
26917
26918
26919
/* Sets the "status" column's value from the "Manager" table in 'row'
26920
 * to 'status'.
26921
 *
26922
 * The caller retains ownership of 'status' and everything in it. */
26923
void
26924
ovsrec_manager_add_clause_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *status)
26925
0
{
26926
0
    struct ovsdb_datum datum;
26927
26928
0
    if (status) {
26929
0
        ovsdb_datum_from_smap(&datum, status);
26930
0
    } else {
26931
0
        ovsdb_datum_init_empty(&datum);
26932
0
    }
26933
26934
0
    ovsdb_idl_condition_add_clause(cond,
26935
0
                                   function,
26936
0
                                   &ovsrec_manager_col_status,
26937
0
                                   &datum);
26938
26939
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_status.type);
26940
0
}
26941
26942
26943
/* Sets the "target" column from the "Manager" table in 'row' to
26944
 * 'target'.
26945
 *
26946
 * The caller retains ownership of the arguments. */
26947
void
26948
ovsrec_manager_add_clause_target(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *target)
26949
0
{
26950
0
    struct ovsdb_datum datum;
26951
26952
0
    datum.refcnt = NULL;
26953
26954
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
26955
26956
0
    datum.n = 1;
26957
0
    datum.keys = key;
26958
0
    key->s = ovsdb_atom_string_create(target);
26959
0
    datum.values = NULL;
26960
0
    ovsdb_idl_condition_add_clause(cond,
26961
0
                          function,
26962
0
                          &ovsrec_manager_col_target,
26963
0
                          &datum);
26964
0
    ovsdb_datum_destroy(&datum, &ovsrec_manager_col_target.type);
26965
0
}
26966
26967
/* Destroy 'row' of kind "Manager". The row must have been
26968
 * created with ovsdb_idl_index_init_row.
26969
 */
26970
void
26971
ovsrec_manager_index_destroy_row(const struct ovsrec_manager *row)
26972
0
{
26973
0
    ovsdb_idl_index_destroy_row(&row->header_);
26974
0
}
26975
        
26976
26977
/* Creates a new row of kind "Manager". */
26978
struct ovsrec_manager *
26979
ovsrec_manager_index_init_row(struct ovsdb_idl_index *index)
26980
0
{
26981
0
    ovs_assert(index->table->class_ == &ovsrec_table_manager);
26982
0
    return ALIGNED_CAST(struct ovsrec_manager *, ovsdb_idl_index_init_row(index));
26983
0
}
26984
26985
struct ovsrec_manager *
26986
ovsrec_manager_index_find(struct ovsdb_idl_index *index, const struct ovsrec_manager *target)
26987
0
{
26988
0
    ovs_assert(index->table->class_ == &ovsrec_table_manager);
26989
0
    return ovsrec_manager_cast(ovsdb_idl_index_find(index, &target->header_));
26990
0
}
26991
26992
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
26993
int
26994
ovsrec_manager_index_compare(
26995
    struct ovsdb_idl_index *index, 
26996
    const struct ovsrec_manager *a, 
26997
    const struct ovsrec_manager *b)
26998
0
{
26999
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
27000
0
}
27001
27002
struct ovsdb_idl_cursor
27003
ovsrec_manager_cursor_first(struct ovsdb_idl_index *index)
27004
0
{
27005
0
    ovs_assert(index->table->class_ == &ovsrec_table_manager);
27006
0
    return ovsdb_idl_cursor_first(index);
27007
0
}
27008
27009
struct ovsdb_idl_cursor
27010
ovsrec_manager_cursor_first_eq(
27011
    struct ovsdb_idl_index *index, const struct ovsrec_manager *target)
27012
0
{
27013
0
    ovs_assert(index->table->class_ == &ovsrec_table_manager);
27014
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
27015
0
}
27016
27017
struct ovsdb_idl_cursor
27018
ovsrec_manager_cursor_first_ge(
27019
    struct ovsdb_idl_index *index, const struct ovsrec_manager *target)
27020
0
{
27021
0
    ovs_assert(index->table->class_ == &ovsrec_table_manager);
27022
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
27023
0
}
27024
27025
struct ovsrec_manager *
27026
ovsrec_manager_cursor_data(struct ovsdb_idl_cursor *cursor)
27027
0
{
27028
0
    return ovsrec_manager_cast(ovsdb_idl_cursor_data(cursor));
27029
0
}
27030
27031
27032
/* Sets the "connection_mode" column from the "Manager" table in 'row' to
27033
 * the 'connection_mode' set.
27034
 *
27035
 * If "connection_mode" is null, the column will be the empty set,
27036
 * otherwise it will contain the specified value.
27037
 *
27038
 * Argument constraints: either "in-band" or "out-of-band"
27039
 *
27040
 * The caller retains ownership of the arguments. */
27041
void
27042
ovsrec_manager_index_set_connection_mode(const struct ovsrec_manager *row, const char *connection_mode)
27043
0
{
27044
0
    struct ovsdb_datum datum;
27045
27046
0
    datum.refcnt = NULL;
27047
0
    union ovsdb_atom *key;
27048
27049
0
    if (connection_mode) {
27050
0
        key = xmalloc(sizeof (union ovsdb_atom));
27051
0
        datum.n = 1;
27052
0
        datum.keys = key;
27053
0
        key->s = ovsdb_atom_string_create(connection_mode);
27054
0
    } else {
27055
0
        datum.n = 0;
27056
0
        datum.keys = NULL;
27057
0
    }
27058
0
    datum.values = NULL;
27059
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]);
27060
0
}
27061
27062
/* Sets the "external_ids" column's value from the "Manager" table in 'row'
27063
 * to 'external_ids'.
27064
 *
27065
 * The caller retains ownership of 'external_ids' and everything in it. */
27066
void
27067
ovsrec_manager_index_set_external_ids(const struct ovsrec_manager *row, const struct smap *external_ids)
27068
0
{
27069
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
27070
27071
0
    if (external_ids) {
27072
0
        struct smap_node *node;
27073
0
        size_t i;
27074
27075
0
        datum->n = smap_count(external_ids);
27076
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
27077
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
27078
0
        datum->refcnt = NULL;
27079
27080
0
        i = 0;
27081
0
        SMAP_FOR_EACH (node, external_ids) {
27082
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
27083
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
27084
0
            i++;
27085
0
        }
27086
0
        ovsdb_datum_sort_unique(datum, &ovsrec_manager_col_external_ids.type);
27087
0
    } else {
27088
0
        ovsdb_datum_init_empty(datum);
27089
0
    }
27090
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
27091
0
                          &ovsrec_manager_columns[OVSREC_MANAGER_COL_EXTERNAL_IDS],
27092
0
                          datum,
27093
0
                          &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
27094
0
    free(datum);
27095
0
}
27096
27097
27098
/* Sets the "inactivity_probe" column from the "Manager" table in 'row' to
27099
 * the 'inactivity_probe' set with 'n_inactivity_probe' entries.
27100
 *
27101
 * 'n_inactivity_probe' may be 0 or 1; if it is 0, then 'inactivity_probe'
27102
 * may be NULL.
27103
 *
27104
 * The caller retains ownership of the arguments. */
27105
void
27106
ovsrec_manager_index_set_inactivity_probe(const struct ovsrec_manager *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
27107
0
{
27108
0
    struct ovsdb_datum datum;
27109
27110
0
    datum.refcnt = NULL;
27111
0
    union ovsdb_atom *key;
27112
27113
0
    if (n_inactivity_probe) {
27114
0
        key = xmalloc(sizeof(union ovsdb_atom));
27115
0
        datum.n = 1;
27116
0
        datum.keys = key;
27117
0
        key->integer = *inactivity_probe;
27118
0
    } else {
27119
0
        datum.n = 0;
27120
0
        datum.keys = NULL;
27121
0
    }
27122
0
    datum.values = NULL;
27123
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]);
27124
0
}
27125
27126
/* Sets the "is_connected" column from the "Manager" table in 'row' to
27127
 * 'is_connected'.
27128
 *
27129
 * The caller retains ownership of the arguments. */
27130
void
27131
ovsrec_manager_index_set_is_connected(const struct ovsrec_manager *row, bool is_connected)
27132
0
{
27133
0
    struct ovsdb_datum datum;
27134
27135
0
    datum.refcnt = NULL;
27136
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
27137
27138
0
    datum.n = 1;
27139
0
    datum.keys = key;
27140
0
    key->boolean = is_connected;
27141
0
    datum.values = NULL;
27142
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]);
27143
0
}
27144
27145
/* Sets the "max_backoff" column from the "Manager" table in 'row' to
27146
 * the 'max_backoff' set with 'n_max_backoff' entries.
27147
 *
27148
 * 'n_max_backoff' may be 0 or 1; if it is 0, then 'max_backoff'
27149
 * may be NULL.
27150
 *
27151
 * Argument constraints: at least 1,000
27152
 *
27153
 * The caller retains ownership of the arguments. */
27154
void
27155
ovsrec_manager_index_set_max_backoff(const struct ovsrec_manager *row, const int64_t *max_backoff, size_t n_max_backoff)
27156
0
{
27157
0
    struct ovsdb_datum datum;
27158
27159
0
    datum.refcnt = NULL;
27160
0
    union ovsdb_atom *key;
27161
27162
0
    if (n_max_backoff) {
27163
0
        key = xmalloc(sizeof(union ovsdb_atom));
27164
0
        datum.n = 1;
27165
0
        datum.keys = key;
27166
0
        key->integer = *max_backoff;
27167
0
    } else {
27168
0
        datum.n = 0;
27169
0
        datum.keys = NULL;
27170
0
    }
27171
0
    datum.values = NULL;
27172
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]);
27173
0
}
27174
27175
/* Sets the "other_config" column's value from the "Manager" table in 'row'
27176
 * to 'other_config'.
27177
 *
27178
 * The caller retains ownership of 'other_config' and everything in it. */
27179
void
27180
ovsrec_manager_index_set_other_config(const struct ovsrec_manager *row, const struct smap *other_config)
27181
0
{
27182
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
27183
27184
0
    if (other_config) {
27185
0
        struct smap_node *node;
27186
0
        size_t i;
27187
27188
0
        datum->n = smap_count(other_config);
27189
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
27190
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
27191
0
        datum->refcnt = NULL;
27192
27193
0
        i = 0;
27194
0
        SMAP_FOR_EACH (node, other_config) {
27195
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
27196
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
27197
0
            i++;
27198
0
        }
27199
0
        ovsdb_datum_sort_unique(datum, &ovsrec_manager_col_other_config.type);
27200
0
    } else {
27201
0
        ovsdb_datum_init_empty(datum);
27202
0
    }
27203
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
27204
0
                          &ovsrec_manager_columns[OVSREC_MANAGER_COL_OTHER_CONFIG],
27205
0
                          datum,
27206
0
                          &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
27207
0
    free(datum);
27208
0
}
27209
27210
27211
/* Sets the "status" column's value from the "Manager" table in 'row'
27212
 * to 'status'.
27213
 *
27214
 * The caller retains ownership of 'status' and everything in it. */
27215
void
27216
ovsrec_manager_index_set_status(const struct ovsrec_manager *row, const struct smap *status)
27217
0
{
27218
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
27219
27220
0
    if (status) {
27221
0
        struct smap_node *node;
27222
0
        size_t i;
27223
27224
0
        datum->n = smap_count(status);
27225
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
27226
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
27227
0
        datum->refcnt = NULL;
27228
27229
0
        i = 0;
27230
0
        SMAP_FOR_EACH (node, status) {
27231
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
27232
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
27233
0
            i++;
27234
0
        }
27235
0
        ovsdb_datum_sort_unique(datum, &ovsrec_manager_col_status.type);
27236
0
    } else {
27237
0
        ovsdb_datum_init_empty(datum);
27238
0
    }
27239
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
27240
0
                          &ovsrec_manager_columns[OVSREC_MANAGER_COL_STATUS],
27241
0
                          datum,
27242
0
                          &ovsrec_table_classes[OVSREC_TABLE_MANAGER]);
27243
0
    free(datum);
27244
0
}
27245
27246
27247
/* Sets the "target" column from the "Manager" table in 'row' to
27248
 * 'target'.
27249
 *
27250
 * The caller retains ownership of the arguments. */
27251
void
27252
ovsrec_manager_index_set_target(const struct ovsrec_manager *row, const char *target)
27253
0
{
27254
0
    struct ovsdb_datum datum;
27255
27256
0
    datum.refcnt = NULL;
27257
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
27258
27259
0
    datum.n = 1;
27260
0
    datum.keys = key;
27261
0
    key->s = ovsdb_atom_string_create(target);
27262
0
    datum.values = NULL;
27263
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]);
27264
0
}
27265
27266
struct ovsdb_idl_column ovsrec_manager_columns[OVSREC_MANAGER_N_COLUMNS];
27267
27268
unsigned int
27269
ovsrec_manager_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
27270
0
{
27271
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_manager, condition);
27272
0
}
27273
static struct json Manager_col_connection_mode_key_enum_key_strings[2] = {
27274
    { .type = JSON_STRING, .string = "in-band", .count = 2 },
27275
    { .type = JSON_STRING, .string = "out-of-band", .count = 2 },
27276
};
27277
static union ovsdb_atom Manager_col_connection_mode_key_enum_keys[2] = {
27278
    { .s = &Manager_col_connection_mode_key_enum_key_strings[0] },
27279
    { .s = &Manager_col_connection_mode_key_enum_key_strings[1] },
27280
};
27281
static struct ovsdb_datum Manager_col_connection_mode_key_enum = {
27282
    .n = 2,
27283
    .keys = Manager_col_connection_mode_key_enum_keys,
27284
};
27285
27286
struct ovsdb_idl_column ovsrec_manager_columns[OVSREC_MANAGER_N_COLUMNS] = {
27287
    [OVSREC_MANAGER_COL_CONNECTION_MODE] = {
27288
         .name = "connection_mode",
27289
         .type = {
27290
            .key = {
27291
               .type = OVSDB_TYPE_STRING,
27292
               .enum_ = &Manager_col_connection_mode_key_enum,
27293
               .string = { .minLen = 0, .maxLen = UINT_MAX },
27294
            },
27295
            .value = OVSDB_BASE_VOID_INIT,
27296
            .n_min = 0,
27297
            .n_max = 1,
27298
         },
27299
         .is_mutable = true,
27300
         .is_synthetic = false,
27301
         .parse = ovsrec_manager_parse_connection_mode,
27302
         .unparse = ovsrec_manager_unparse_connection_mode,
27303
    },
27304
27305
    [OVSREC_MANAGER_COL_EXTERNAL_IDS] = {
27306
         .name = "external_ids",
27307
         .type = {
27308
            .key = {
27309
               .type = OVSDB_TYPE_STRING,
27310
               .string = { .minLen = 0, .maxLen = UINT_MAX },
27311
            },
27312
            .value = {
27313
                .type = OVSDB_TYPE_STRING,
27314
                .string = { .minLen = 0, .maxLen = UINT_MAX },
27315
            },
27316
            .n_min = 0,
27317
            .n_max = UINT_MAX,
27318
         },
27319
         .is_mutable = true,
27320
         .is_synthetic = false,
27321
         .parse = ovsrec_manager_parse_external_ids,
27322
         .unparse = ovsrec_manager_unparse_external_ids,
27323
    },
27324
27325
    [OVSREC_MANAGER_COL_INACTIVITY_PROBE] = {
27326
         .name = "inactivity_probe",
27327
         .type = {
27328
            .key = {
27329
               .type = OVSDB_TYPE_INTEGER,
27330
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
27331
            },
27332
            .value = OVSDB_BASE_VOID_INIT,
27333
            .n_min = 0,
27334
            .n_max = 1,
27335
         },
27336
         .is_mutable = true,
27337
         .is_synthetic = false,
27338
         .parse = ovsrec_manager_parse_inactivity_probe,
27339
         .unparse = ovsrec_manager_unparse_inactivity_probe,
27340
    },
27341
27342
    [OVSREC_MANAGER_COL_IS_CONNECTED] = {
27343
         .name = "is_connected",
27344
         .type = {
27345
            .key = {
27346
               .type = OVSDB_TYPE_BOOLEAN,
27347
            },
27348
            .value = OVSDB_BASE_VOID_INIT,
27349
            .n_min = 1,
27350
            .n_max = 1,
27351
         },
27352
         .is_mutable = true,
27353
         .is_synthetic = false,
27354
         .parse = ovsrec_manager_parse_is_connected,
27355
         .unparse = ovsrec_manager_unparse_is_connected,
27356
    },
27357
27358
    [OVSREC_MANAGER_COL_MAX_BACKOFF] = {
27359
         .name = "max_backoff",
27360
         .type = {
27361
            .key = {
27362
               .type = OVSDB_TYPE_INTEGER,
27363
               .integer = { .min = INT64_C(1000), .max = INT64_MAX },
27364
            },
27365
            .value = OVSDB_BASE_VOID_INIT,
27366
            .n_min = 0,
27367
            .n_max = 1,
27368
         },
27369
         .is_mutable = true,
27370
         .is_synthetic = false,
27371
         .parse = ovsrec_manager_parse_max_backoff,
27372
         .unparse = ovsrec_manager_unparse_max_backoff,
27373
    },
27374
27375
    [OVSREC_MANAGER_COL_OTHER_CONFIG] = {
27376
         .name = "other_config",
27377
         .type = {
27378
            .key = {
27379
               .type = OVSDB_TYPE_STRING,
27380
               .string = { .minLen = 0, .maxLen = UINT_MAX },
27381
            },
27382
            .value = {
27383
                .type = OVSDB_TYPE_STRING,
27384
                .string = { .minLen = 0, .maxLen = UINT_MAX },
27385
            },
27386
            .n_min = 0,
27387
            .n_max = UINT_MAX,
27388
         },
27389
         .is_mutable = true,
27390
         .is_synthetic = false,
27391
         .parse = ovsrec_manager_parse_other_config,
27392
         .unparse = ovsrec_manager_unparse_other_config,
27393
    },
27394
27395
    [OVSREC_MANAGER_COL_STATUS] = {
27396
         .name = "status",
27397
         .type = {
27398
            .key = {
27399
               .type = OVSDB_TYPE_STRING,
27400
               .string = { .minLen = 0, .maxLen = UINT_MAX },
27401
            },
27402
            .value = {
27403
                .type = OVSDB_TYPE_STRING,
27404
                .string = { .minLen = 0, .maxLen = UINT_MAX },
27405
            },
27406
            .n_min = 0,
27407
            .n_max = UINT_MAX,
27408
         },
27409
         .is_mutable = true,
27410
         .is_synthetic = false,
27411
         .parse = ovsrec_manager_parse_status,
27412
         .unparse = ovsrec_manager_unparse_status,
27413
    },
27414
27415
    [OVSREC_MANAGER_COL_TARGET] = {
27416
         .name = "target",
27417
         .type = {
27418
            .key = {
27419
               .type = OVSDB_TYPE_STRING,
27420
               .string = { .minLen = 0, .maxLen = UINT_MAX },
27421
            },
27422
            .value = OVSDB_BASE_VOID_INIT,
27423
            .n_min = 1,
27424
            .n_max = 1,
27425
         },
27426
         .is_mutable = true,
27427
         .is_synthetic = false,
27428
         .parse = ovsrec_manager_parse_target,
27429
         .unparse = ovsrec_manager_unparse_target,
27430
    },
27431
27432
};
27433

27434
/* Mirror table. */
27435
27436
bool
27437
ovsrec_server_has_mirror_table_col_external_ids(const struct ovsdb_idl *idl)
27438
0
{
27439
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_external_ids);
27440
0
}
27441
27442
27443
bool
27444
ovsrec_server_has_mirror_table_col_name(const struct ovsdb_idl *idl)
27445
0
{
27446
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_name);
27447
0
}
27448
27449
27450
bool
27451
ovsrec_server_has_mirror_table_col_output_port(const struct ovsdb_idl *idl)
27452
0
{
27453
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_output_port);
27454
0
}
27455
27456
27457
bool
27458
ovsrec_server_has_mirror_table_col_output_vlan(const struct ovsdb_idl *idl)
27459
0
{
27460
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_output_vlan);
27461
0
}
27462
27463
27464
bool
27465
ovsrec_server_has_mirror_table_col_select_all(const struct ovsdb_idl *idl)
27466
0
{
27467
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_select_all);
27468
0
}
27469
27470
27471
bool
27472
ovsrec_server_has_mirror_table_col_select_dst_port(const struct ovsdb_idl *idl)
27473
0
{
27474
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_select_dst_port);
27475
0
}
27476
27477
27478
bool
27479
ovsrec_server_has_mirror_table_col_select_src_port(const struct ovsdb_idl *idl)
27480
0
{
27481
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_select_src_port);
27482
0
}
27483
27484
27485
bool
27486
ovsrec_server_has_mirror_table_col_select_vlan(const struct ovsdb_idl *idl)
27487
0
{
27488
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_select_vlan);
27489
0
}
27490
27491
27492
bool
27493
ovsrec_server_has_mirror_table_col_snaplen(const struct ovsdb_idl *idl)
27494
0
{
27495
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_snaplen);
27496
0
}
27497
27498
27499
bool
27500
ovsrec_server_has_mirror_table_col_statistics(const struct ovsdb_idl *idl)
27501
0
{
27502
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_mirror_col_statistics);
27503
0
}
27504
27505
27506
bool
27507
ovsrec_server_has_mirror_table(const struct ovsdb_idl *idl)
27508
0
{
27509
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
27510
0
}
27511
27512
27513
const struct ovsrec_mirror_table *
27514
ovsrec_mirror_table_get(const struct ovsdb_idl *idl)
27515
0
{
27516
0
    return (const struct ovsrec_mirror_table *) idl;
27517
0
}
27518
27519
const struct ovsrec_mirror *
27520
ovsrec_mirror_table_first(const struct ovsrec_mirror_table *table)
27521
0
{
27522
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
27523
0
    return ovsrec_mirror_first(idl);
27524
0
}
27525
27526
27527
const struct ovsrec_mirror *
27528
ovsrec_mirror_table_track_get_first(const struct ovsrec_mirror_table *table)
27529
0
{
27530
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
27531
0
    return ovsrec_mirror_track_get_first(idl);
27532
0
}
27533
27534
27535
static void
27536
ovsrec_mirror_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27537
0
{
27538
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27539
0
    smap_init(&row->external_ids);
27540
0
    for (size_t i = 0; i < datum->n; i++) {
27541
0
        smap_add(&row->external_ids,
27542
0
                 json_string(datum->keys[i].s),
27543
0
                 json_string(datum->values[i].s));
27544
0
    }
27545
0
}
27546
27547
static void
27548
ovsrec_mirror_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27549
0
{
27550
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27551
27552
0
    if (datum->n >= 1) {
27553
0
        row->name = datum->keys[0].s->string;
27554
0
    } else {
27555
0
        row->name = "";
27556
0
    }
27557
0
}
27558
27559
static void
27560
ovsrec_mirror_parse_output_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27561
0
{
27562
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27563
27564
0
    if (datum->n >= 1) {
27565
0
        row->output_port = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_port, &datum->keys[0].uuid));
27566
0
    } else {
27567
0
        row->output_port = NULL;
27568
0
    }
27569
0
}
27570
27571
static void
27572
ovsrec_mirror_parse_output_vlan(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27573
0
{
27574
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27575
0
    size_t n = MIN(1, datum->n);
27576
0
    row->output_vlan = NULL;
27577
0
    row->n_output_vlan = 0;
27578
0
    for (size_t i = 0; i < n; i++) {
27579
0
        if (!row->n_output_vlan) {
27580
0
            row->output_vlan = xmalloc(n * sizeof *row->output_vlan);
27581
0
        }
27582
0
        row->output_vlan[row->n_output_vlan] = datum->keys[i].integer;
27583
0
        row->n_output_vlan++;
27584
0
    }
27585
0
}
27586
27587
static void
27588
ovsrec_mirror_parse_select_all(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27589
0
{
27590
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27591
27592
0
    if (datum->n >= 1) {
27593
0
        row->select_all = datum->keys[0].boolean;
27594
0
    } else {
27595
0
        row->select_all = false;
27596
0
    }
27597
0
}
27598
27599
static void
27600
ovsrec_mirror_parse_select_dst_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27601
0
{
27602
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27603
0
    row->select_dst_port = NULL;
27604
0
    row->n_select_dst_port = 0;
27605
0
    for (size_t i = 0; i < datum->n; i++) {
27606
0
        struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_port, &datum->keys[i].uuid));
27607
0
        if (!keyRow) {
27608
0
            continue;
27609
0
        }
27610
0
        if (!row->n_select_dst_port) {
27611
0
            row->select_dst_port = xmalloc(datum->n * sizeof *row->select_dst_port);
27612
0
        }
27613
0
        row->select_dst_port[row->n_select_dst_port] = keyRow;
27614
0
        row->n_select_dst_port++;
27615
0
    }
27616
0
}
27617
27618
static void
27619
ovsrec_mirror_parse_select_src_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27620
0
{
27621
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27622
0
    row->select_src_port = NULL;
27623
0
    row->n_select_src_port = 0;
27624
0
    for (size_t i = 0; i < datum->n; i++) {
27625
0
        struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_port, &datum->keys[i].uuid));
27626
0
        if (!keyRow) {
27627
0
            continue;
27628
0
        }
27629
0
        if (!row->n_select_src_port) {
27630
0
            row->select_src_port = xmalloc(datum->n * sizeof *row->select_src_port);
27631
0
        }
27632
0
        row->select_src_port[row->n_select_src_port] = keyRow;
27633
0
        row->n_select_src_port++;
27634
0
    }
27635
0
}
27636
27637
static void
27638
ovsrec_mirror_parse_select_vlan(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27639
0
{
27640
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27641
0
    size_t n = MIN(4096, datum->n);
27642
0
    row->select_vlan = NULL;
27643
0
    row->n_select_vlan = 0;
27644
0
    for (size_t i = 0; i < n; i++) {
27645
0
        if (!row->n_select_vlan) {
27646
0
            row->select_vlan = xmalloc(n * sizeof *row->select_vlan);
27647
0
        }
27648
0
        row->select_vlan[row->n_select_vlan] = datum->keys[i].integer;
27649
0
        row->n_select_vlan++;
27650
0
    }
27651
0
}
27652
27653
static void
27654
ovsrec_mirror_parse_snaplen(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27655
0
{
27656
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27657
0
    size_t n = MIN(1, datum->n);
27658
0
    row->snaplen = NULL;
27659
0
    row->n_snaplen = 0;
27660
0
    for (size_t i = 0; i < n; i++) {
27661
0
        if (!row->n_snaplen) {
27662
0
            row->snaplen = xmalloc(n * sizeof *row->snaplen);
27663
0
        }
27664
0
        row->snaplen[row->n_snaplen] = datum->keys[i].integer;
27665
0
        row->n_snaplen++;
27666
0
    }
27667
0
}
27668
27669
static void
27670
ovsrec_mirror_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
27671
0
{
27672
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27673
0
    row->key_statistics = NULL;
27674
0
    row->value_statistics = NULL;
27675
0
    row->n_statistics = 0;
27676
0
    for (size_t i = 0; i < datum->n; i++) {
27677
0
        if (!row->n_statistics) {
27678
0
            row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
27679
0
            row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
27680
0
        }
27681
0
        row->key_statistics[row->n_statistics] = datum->keys[i].s->string;
27682
0
        row->value_statistics[row->n_statistics] = datum->values[i].integer;
27683
0
        row->n_statistics++;
27684
0
    }
27685
0
}
27686
27687
static void
27688
ovsrec_mirror_unparse_external_ids(struct ovsdb_idl_row *row_)
27689
0
{
27690
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27691
0
    smap_destroy(&row->external_ids);
27692
0
}
27693
27694
static void
27695
ovsrec_mirror_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
27696
0
{
27697
    /* Nothing to do. */
27698
0
}
27699
27700
static void
27701
ovsrec_mirror_unparse_output_port(struct ovsdb_idl_row *row OVS_UNUSED)
27702
0
{
27703
    /* Nothing to do. */
27704
0
}
27705
27706
static void
27707
ovsrec_mirror_unparse_output_vlan(struct ovsdb_idl_row *row_)
27708
0
{
27709
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27710
0
    free(row->output_vlan);
27711
0
}
27712
27713
static void
27714
ovsrec_mirror_unparse_select_all(struct ovsdb_idl_row *row OVS_UNUSED)
27715
0
{
27716
    /* Nothing to do. */
27717
0
}
27718
27719
static void
27720
ovsrec_mirror_unparse_select_dst_port(struct ovsdb_idl_row *row_)
27721
0
{
27722
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27723
0
    free(row->select_dst_port);
27724
0
}
27725
27726
static void
27727
ovsrec_mirror_unparse_select_src_port(struct ovsdb_idl_row *row_)
27728
0
{
27729
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27730
0
    free(row->select_src_port);
27731
0
}
27732
27733
static void
27734
ovsrec_mirror_unparse_select_vlan(struct ovsdb_idl_row *row_)
27735
0
{
27736
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27737
0
    free(row->select_vlan);
27738
0
}
27739
27740
static void
27741
ovsrec_mirror_unparse_snaplen(struct ovsdb_idl_row *row_)
27742
0
{
27743
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27744
0
    free(row->snaplen);
27745
0
}
27746
27747
static void
27748
ovsrec_mirror_unparse_statistics(struct ovsdb_idl_row *row_)
27749
0
{
27750
0
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
27751
0
    free(row->key_statistics);
27752
0
    free(row->value_statistics);
27753
0
}
27754
27755
static void
27756
ovsrec_mirror_init__(struct ovsdb_idl_row *row)
27757
0
{
27758
0
    ovsrec_mirror_init(ovsrec_mirror_cast(row));
27759
0
}
27760
27761
/* Clears the contents of 'row' in table "Mirror". */
27762
void
27763
ovsrec_mirror_init(struct ovsrec_mirror *row)
27764
0
{
27765
0
    memset(row, 0, sizeof *row); 
27766
0
    smap_init(&row->external_ids);
27767
0
    row->name = "";
27768
0
}
27769
27770
/* Searches table "Mirror" in 'idl' for a row with UUID 'uuid'.  Returns
27771
 * a pointer to the row if there is one, otherwise a null pointer.  */
27772
const struct ovsrec_mirror *
27773
ovsrec_mirror_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
27774
0
{
27775
0
    return ovsrec_mirror_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_mirror, uuid));
27776
0
}
27777
27778
/* Searches table "Mirror" for a row with UUID 'uuid'.  Returns
27779
 * a pointer to the row if there is one, otherwise a null pointer.  */
27780
const struct ovsrec_mirror *
27781
ovsrec_mirror_table_get_for_uuid(const struct ovsrec_mirror_table *table, const struct uuid *uuid)
27782
0
{
27783
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
27784
0
    return ovsrec_mirror_get_for_uuid(idl, uuid);
27785
0
}
27786
27787
/* Returns a row in table "Mirror" in 'idl', or a null pointer if that
27788
 * table is empty.
27789
 *
27790
 * Database tables are internally maintained as hash tables, so adding or
27791
 * removing rows while traversing the same table can cause some rows to be
27792
 * visited twice or not at apply. */
27793
const struct ovsrec_mirror *
27794
ovsrec_mirror_first(const struct ovsdb_idl *idl)
27795
0
{
27796
0
    return ovsrec_mirror_cast(ovsdb_idl_first_row(idl, &ovsrec_table_mirror));
27797
0
}
27798
27799
/* Returns a row following 'row' within its table, or a null pointer if 'row'
27800
 * is the last row in its table. */
27801
const struct ovsrec_mirror *
27802
ovsrec_mirror_next(const struct ovsrec_mirror *row)
27803
0
{
27804
0
    return ovsrec_mirror_cast(ovsdb_idl_next_row(&row->header_));
27805
0
}
27806
27807
unsigned int ovsrec_mirror_get_seqno(const struct ovsdb_idl *idl)
27808
0
{
27809
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_mirror);
27810
0
}
27811
27812
unsigned int ovsrec_mirror_row_get_seqno(const struct ovsrec_mirror *row, enum ovsdb_idl_change change)
27813
0
{
27814
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
27815
0
}
27816
27817
const struct ovsrec_mirror *
27818
ovsrec_mirror_track_get_first(const struct ovsdb_idl *idl)
27819
0
{
27820
0
    return ovsrec_mirror_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_mirror));
27821
0
}
27822
27823
const struct ovsrec_mirror
27824
*ovsrec_mirror_track_get_next(const struct ovsrec_mirror *row)
27825
0
{
27826
0
    return ovsrec_mirror_cast(ovsdb_idl_track_get_next(&row->header_));
27827
0
}
27828
27829
27830
/* Deletes 'row' from table "Mirror".  'row' may be freed, so it must not be
27831
 * accessed afterward.
27832
 *
27833
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27834
void
27835
ovsrec_mirror_delete(const struct ovsrec_mirror *row)
27836
0
{
27837
0
    ovsdb_idl_txn_delete(&row->header_);
27838
0
}
27839
27840
/* Inserts and returns a new row in the table "Mirror" in the database
27841
 * with open transaction 'txn'.
27842
 *
27843
 * The new row is assigned a randomly generated provisional UUID.
27844
 * ovsdb-server will assign a different UUID when 'txn' is committed,
27845
 * but the IDL will replace any uses of the provisional UUID in the
27846
 * data to be to be committed by the UUID assigned by ovsdb-server. */
27847
struct ovsrec_mirror *
27848
ovsrec_mirror_insert(struct ovsdb_idl_txn *txn)
27849
0
{
27850
0
    return ovsrec_mirror_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_mirror, NULL));
27851
0
}
27852
27853
/* Inserts and returns a new row in the table "Mirror" in the database
27854
 * with open transaction 'txn'.
27855
 *
27856
 * The new row is assigned the UUID specified in the 'uuid' parameter
27857
 * (which cannot be null).  ovsdb-server will try to assign the same
27858
 * UUID when 'txn' is committed. */
27859
struct ovsrec_mirror *
27860
ovsrec_mirror_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
27861
0
{
27862
0
    return ovsrec_mirror_cast(ovsdb_idl_txn_insert_persist_uuid(
27863
0
        txn, &ovsrec_table_mirror, uuid));
27864
0
}
27865
27866
bool
27867
ovsrec_mirror_is_updated(const struct ovsrec_mirror *row, enum ovsrec_mirror_column_id column)
27868
0
{
27869
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_mirror_columns[column]);
27870
0
}
27871
27872
/* Causes the original contents of column "external_ids" in 'row' to be
27873
 * verified as a prerequisite to completing the transaction.  That is, if
27874
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
27875
 * time that the IDL originally read its contents and the time that the
27876
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27877
 *
27878
 * The intention is that, to ensure that no transaction commits based on dirty
27879
 * reads, an application should call this function any time "external_ids" is
27880
 * read as part of a read-modify-write operation.
27881
 *
27882
 * In some cases this function reduces to a no-op, because the current value
27883
 * of "external_ids" is already known:
27884
 *
27885
 *   - If 'row' is a row created by the current transaction (returned by
27886
 *     ovsrec_mirror_insert()).
27887
 *
27888
 *   - If "external_ids" has already been modified (with
27889
 *     ovsrec_mirror_set_external_ids()) within the current transaction.
27890
 *
27891
 * Because of the latter property, always call this function *before*
27892
 * ovsrec_mirror_set_external_ids() for a given read-modify-write.
27893
 *
27894
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27895
void
27896
ovsrec_mirror_verify_external_ids(const struct ovsrec_mirror *row)
27897
0
{
27898
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_external_ids);
27899
0
}
27900
27901
/* Causes the original contents of column "name" in 'row' to be
27902
 * verified as a prerequisite to completing the transaction.  That is, if
27903
 * "name" in 'row' changed (or if 'row' was deleted) between the
27904
 * time that the IDL originally read its contents and the time that the
27905
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27906
 *
27907
 * The intention is that, to ensure that no transaction commits based on dirty
27908
 * reads, an application should call this function any time "name" is
27909
 * read as part of a read-modify-write operation.
27910
 *
27911
 * In some cases this function reduces to a no-op, because the current value
27912
 * of "name" is already known:
27913
 *
27914
 *   - If 'row' is a row created by the current transaction (returned by
27915
 *     ovsrec_mirror_insert()).
27916
 *
27917
 *   - If "name" has already been modified (with
27918
 *     ovsrec_mirror_set_name()) within the current transaction.
27919
 *
27920
 * Because of the latter property, always call this function *before*
27921
 * ovsrec_mirror_set_name() for a given read-modify-write.
27922
 *
27923
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27924
void
27925
ovsrec_mirror_verify_name(const struct ovsrec_mirror *row)
27926
0
{
27927
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_name);
27928
0
}
27929
27930
/* Causes the original contents of column "output_port" in 'row' to be
27931
 * verified as a prerequisite to completing the transaction.  That is, if
27932
 * "output_port" in 'row' changed (or if 'row' was deleted) between the
27933
 * time that the IDL originally read its contents and the time that the
27934
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27935
 *
27936
 * The intention is that, to ensure that no transaction commits based on dirty
27937
 * reads, an application should call this function any time "output_port" is
27938
 * read as part of a read-modify-write operation.
27939
 *
27940
 * In some cases this function reduces to a no-op, because the current value
27941
 * of "output_port" is already known:
27942
 *
27943
 *   - If 'row' is a row created by the current transaction (returned by
27944
 *     ovsrec_mirror_insert()).
27945
 *
27946
 *   - If "output_port" has already been modified (with
27947
 *     ovsrec_mirror_set_output_port()) within the current transaction.
27948
 *
27949
 * Because of the latter property, always call this function *before*
27950
 * ovsrec_mirror_set_output_port() for a given read-modify-write.
27951
 *
27952
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27953
void
27954
ovsrec_mirror_verify_output_port(const struct ovsrec_mirror *row)
27955
0
{
27956
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_output_port);
27957
0
}
27958
27959
/* Causes the original contents of column "output_vlan" in 'row' to be
27960
 * verified as a prerequisite to completing the transaction.  That is, if
27961
 * "output_vlan" in 'row' changed (or if 'row' was deleted) between the
27962
 * time that the IDL originally read its contents and the time that the
27963
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27964
 *
27965
 * The intention is that, to ensure that no transaction commits based on dirty
27966
 * reads, an application should call this function any time "output_vlan" is
27967
 * read as part of a read-modify-write operation.
27968
 *
27969
 * In some cases this function reduces to a no-op, because the current value
27970
 * of "output_vlan" is already known:
27971
 *
27972
 *   - If 'row' is a row created by the current transaction (returned by
27973
 *     ovsrec_mirror_insert()).
27974
 *
27975
 *   - If "output_vlan" has already been modified (with
27976
 *     ovsrec_mirror_set_output_vlan()) within the current transaction.
27977
 *
27978
 * Because of the latter property, always call this function *before*
27979
 * ovsrec_mirror_set_output_vlan() for a given read-modify-write.
27980
 *
27981
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
27982
void
27983
ovsrec_mirror_verify_output_vlan(const struct ovsrec_mirror *row)
27984
0
{
27985
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_output_vlan);
27986
0
}
27987
27988
/* Causes the original contents of column "select_all" in 'row' to be
27989
 * verified as a prerequisite to completing the transaction.  That is, if
27990
 * "select_all" in 'row' changed (or if 'row' was deleted) between the
27991
 * time that the IDL originally read its contents and the time that the
27992
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
27993
 *
27994
 * The intention is that, to ensure that no transaction commits based on dirty
27995
 * reads, an application should call this function any time "select_all" is
27996
 * read as part of a read-modify-write operation.
27997
 *
27998
 * In some cases this function reduces to a no-op, because the current value
27999
 * of "select_all" is already known:
28000
 *
28001
 *   - If 'row' is a row created by the current transaction (returned by
28002
 *     ovsrec_mirror_insert()).
28003
 *
28004
 *   - If "select_all" has already been modified (with
28005
 *     ovsrec_mirror_set_select_all()) within the current transaction.
28006
 *
28007
 * Because of the latter property, always call this function *before*
28008
 * ovsrec_mirror_set_select_all() for a given read-modify-write.
28009
 *
28010
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
28011
void
28012
ovsrec_mirror_verify_select_all(const struct ovsrec_mirror *row)
28013
0
{
28014
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_select_all);
28015
0
}
28016
28017
/* Causes the original contents of column "select_dst_port" in 'row' to be
28018
 * verified as a prerequisite to completing the transaction.  That is, if
28019
 * "select_dst_port" in 'row' changed (or if 'row' was deleted) between the
28020
 * time that the IDL originally read its contents and the time that the
28021
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
28022
 *
28023
 * The intention is that, to ensure that no transaction commits based on dirty
28024
 * reads, an application should call this function any time "select_dst_port" is
28025
 * read as part of a read-modify-write operation.
28026
 *
28027
 * In some cases this function reduces to a no-op, because the current value
28028
 * of "select_dst_port" is already known:
28029
 *
28030
 *   - If 'row' is a row created by the current transaction (returned by
28031
 *     ovsrec_mirror_insert()).
28032
 *
28033
 *   - If "select_dst_port" has already been modified (with
28034
 *     ovsrec_mirror_set_select_dst_port()) within the current transaction.
28035
 *
28036
 * Because of the latter property, always call this function *before*
28037
 * ovsrec_mirror_set_select_dst_port() for a given read-modify-write.
28038
 *
28039
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
28040
void
28041
ovsrec_mirror_verify_select_dst_port(const struct ovsrec_mirror *row)
28042
0
{
28043
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_select_dst_port);
28044
0
}
28045
28046
/* Causes the original contents of column "select_src_port" in 'row' to be
28047
 * verified as a prerequisite to completing the transaction.  That is, if
28048
 * "select_src_port" in 'row' changed (or if 'row' was deleted) between the
28049
 * time that the IDL originally read its contents and the time that the
28050
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
28051
 *
28052
 * The intention is that, to ensure that no transaction commits based on dirty
28053
 * reads, an application should call this function any time "select_src_port" is
28054
 * read as part of a read-modify-write operation.
28055
 *
28056
 * In some cases this function reduces to a no-op, because the current value
28057
 * of "select_src_port" is already known:
28058
 *
28059
 *   - If 'row' is a row created by the current transaction (returned by
28060
 *     ovsrec_mirror_insert()).
28061
 *
28062
 *   - If "select_src_port" has already been modified (with
28063
 *     ovsrec_mirror_set_select_src_port()) within the current transaction.
28064
 *
28065
 * Because of the latter property, always call this function *before*
28066
 * ovsrec_mirror_set_select_src_port() for a given read-modify-write.
28067
 *
28068
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
28069
void
28070
ovsrec_mirror_verify_select_src_port(const struct ovsrec_mirror *row)
28071
0
{
28072
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_select_src_port);
28073
0
}
28074
28075
/* Causes the original contents of column "select_vlan" in 'row' to be
28076
 * verified as a prerequisite to completing the transaction.  That is, if
28077
 * "select_vlan" in 'row' changed (or if 'row' was deleted) between the
28078
 * time that the IDL originally read its contents and the time that the
28079
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
28080
 *
28081
 * The intention is that, to ensure that no transaction commits based on dirty
28082
 * reads, an application should call this function any time "select_vlan" is
28083
 * read as part of a read-modify-write operation.
28084
 *
28085
 * In some cases this function reduces to a no-op, because the current value
28086
 * of "select_vlan" is already known:
28087
 *
28088
 *   - If 'row' is a row created by the current transaction (returned by
28089
 *     ovsrec_mirror_insert()).
28090
 *
28091
 *   - If "select_vlan" has already been modified (with
28092
 *     ovsrec_mirror_set_select_vlan()) within the current transaction.
28093
 *
28094
 * Because of the latter property, always call this function *before*
28095
 * ovsrec_mirror_set_select_vlan() for a given read-modify-write.
28096
 *
28097
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
28098
void
28099
ovsrec_mirror_verify_select_vlan(const struct ovsrec_mirror *row)
28100
0
{
28101
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_select_vlan);
28102
0
}
28103
28104
/* Causes the original contents of column "snaplen" in 'row' to be
28105
 * verified as a prerequisite to completing the transaction.  That is, if
28106
 * "snaplen" in 'row' changed (or if 'row' was deleted) between the
28107
 * time that the IDL originally read its contents and the time that the
28108
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
28109
 *
28110
 * The intention is that, to ensure that no transaction commits based on dirty
28111
 * reads, an application should call this function any time "snaplen" is
28112
 * read as part of a read-modify-write operation.
28113
 *
28114
 * In some cases this function reduces to a no-op, because the current value
28115
 * of "snaplen" is already known:
28116
 *
28117
 *   - If 'row' is a row created by the current transaction (returned by
28118
 *     ovsrec_mirror_insert()).
28119
 *
28120
 *   - If "snaplen" has already been modified (with
28121
 *     ovsrec_mirror_set_snaplen()) within the current transaction.
28122
 *
28123
 * Because of the latter property, always call this function *before*
28124
 * ovsrec_mirror_set_snaplen() for a given read-modify-write.
28125
 *
28126
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
28127
void
28128
ovsrec_mirror_verify_snaplen(const struct ovsrec_mirror *row)
28129
0
{
28130
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_snaplen);
28131
0
}
28132
28133
/* Causes the original contents of column "statistics" in 'row' to be
28134
 * verified as a prerequisite to completing the transaction.  That is, if
28135
 * "statistics" in 'row' changed (or if 'row' was deleted) between the
28136
 * time that the IDL originally read its contents and the time that the
28137
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
28138
 *
28139
 * The intention is that, to ensure that no transaction commits based on dirty
28140
 * reads, an application should call this function any time "statistics" is
28141
 * read as part of a read-modify-write operation.
28142
 *
28143
 * In some cases this function reduces to a no-op, because the current value
28144
 * of "statistics" is already known:
28145
 *
28146
 *   - If 'row' is a row created by the current transaction (returned by
28147
 *     ovsrec_mirror_insert()).
28148
 *
28149
 *   - If "statistics" has already been modified (with
28150
 *     ovsrec_mirror_set_statistics()) within the current transaction.
28151
 *
28152
 * Because of the latter property, always call this function *before*
28153
 * ovsrec_mirror_set_statistics() for a given read-modify-write.
28154
 *
28155
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
28156
void
28157
ovsrec_mirror_verify_statistics(const struct ovsrec_mirror *row)
28158
0
{
28159
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_col_statistics);
28160
0
}
28161
28162
/* Returns the "external_ids" column's value from the "Mirror" table in 'row'
28163
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
28164
 * ovsdb_datum_find_key() is an easier and more efficient way to search
28165
 * for a given key than implementing the same operation on the "cooked"
28166
 * form in 'row'.
28167
 *
28168
 * 'key_type' must be OVSDB_TYPE_STRING.
28169
 * 'value_type' must be OVSDB_TYPE_STRING.
28170
 * (This helps to avoid silent bugs if someone changes external_ids's
28171
 * type without updating the caller.)
28172
 *
28173
 * The caller must not modify or free the returned value.
28174
 *
28175
 * Various kinds of changes can invalidate the returned value: modifying
28176
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
28177
 * If the returned value is needed for a long time, it is best to make a copy
28178
 * of it with ovsdb_datum_clone().
28179
 *
28180
 * This function is rarely useful, since it is easier to access the value
28181
 * directly through the "external_ids" member in ovsrec_mirror. */
28182
const struct ovsdb_datum *
28183
ovsrec_mirror_get_external_ids(const struct ovsrec_mirror *row,
28184
  enum ovsdb_atomic_type key_type OVS_UNUSED,
28185
  enum ovsdb_atomic_type value_type OVS_UNUSED)
28186
0
{
28187
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
28188
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
28189
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_external_ids);
28190
0
}
28191
28192
/* Returns the "name" column's value from the "Mirror" table in 'row'
28193
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
28194
 * ovsdb_datum_find_key() is an easier and more efficient way to search
28195
 * for a given key than implementing the same operation on the "cooked"
28196
 * form in 'row'.
28197
 *
28198
 * 'key_type' must be OVSDB_TYPE_STRING.
28199
 * (This helps to avoid silent bugs if someone changes name's
28200
 * type without updating the caller.)
28201
 *
28202
 * The caller must not modify or free the returned value.
28203
 *
28204
 * Various kinds of changes can invalidate the returned value: modifying
28205
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
28206
 * If the returned value is needed for a long time, it is best to make a copy
28207
 * of it with ovsdb_datum_clone().
28208
 *
28209
 * This function is rarely useful, since it is easier to access the value
28210
 * directly through the "name" member in ovsrec_mirror. */
28211
const struct ovsdb_datum *
28212
ovsrec_mirror_get_name(const struct ovsrec_mirror *row,
28213
  enum ovsdb_atomic_type key_type OVS_UNUSED)
28214
0
{
28215
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
28216
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_name);
28217
0
}
28218
28219
/* Returns the "output_port" column's value from the "Mirror" table in 'row'
28220
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
28221
 * ovsdb_datum_find_key() is an easier and more efficient way to search
28222
 * for a given key than implementing the same operation on the "cooked"
28223
 * form in 'row'.
28224
 *
28225
 * 'key_type' must be OVSDB_TYPE_UUID.
28226
 * (This helps to avoid silent bugs if someone changes output_port's
28227
 * type without updating the caller.)
28228
 *
28229
 * The caller must not modify or free the returned value.
28230
 *
28231
 * Various kinds of changes can invalidate the returned value: modifying
28232
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
28233
 * If the returned value is needed for a long time, it is best to make a copy
28234
 * of it with ovsdb_datum_clone().
28235
 *
28236
 * This function is rarely useful, since it is easier to access the value
28237
 * directly through the "output_port" member in ovsrec_mirror. */
28238
const struct ovsdb_datum *
28239
ovsrec_mirror_get_output_port(const struct ovsrec_mirror *row,
28240
  enum ovsdb_atomic_type key_type OVS_UNUSED)
28241
0
{
28242
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
28243
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_output_port);
28244
0
}
28245
28246
/* Returns the "output_vlan" column's value from the "Mirror" table in 'row'
28247
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
28248
 * ovsdb_datum_find_key() is an easier and more efficient way to search
28249
 * for a given key than implementing the same operation on the "cooked"
28250
 * form in 'row'.
28251
 *
28252
 * 'key_type' must be OVSDB_TYPE_INTEGER.
28253
 * (This helps to avoid silent bugs if someone changes output_vlan's
28254
 * type without updating the caller.)
28255
 *
28256
 * The caller must not modify or free the returned value.
28257
 *
28258
 * Various kinds of changes can invalidate the returned value: modifying
28259
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
28260
 * If the returned value is needed for a long time, it is best to make a copy
28261
 * of it with ovsdb_datum_clone().
28262
 *
28263
 * This function is rarely useful, since it is easier to access the value
28264
 * directly through the "output_vlan" member in ovsrec_mirror. */
28265
const struct ovsdb_datum *
28266
ovsrec_mirror_get_output_vlan(const struct ovsrec_mirror *row,
28267
  enum ovsdb_atomic_type key_type OVS_UNUSED)
28268
0
{
28269
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
28270
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_output_vlan);
28271
0
}
28272
28273
/* Returns the "select_all" column's value from the "Mirror" table in 'row'
28274
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
28275
 * ovsdb_datum_find_key() is an easier and more efficient way to search
28276
 * for a given key than implementing the same operation on the "cooked"
28277
 * form in 'row'.
28278
 *
28279
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
28280
 * (This helps to avoid silent bugs if someone changes select_all's
28281
 * type without updating the caller.)
28282
 *
28283
 * The caller must not modify or free the returned value.
28284
 *
28285
 * Various kinds of changes can invalidate the returned value: modifying
28286
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
28287
 * If the returned value is needed for a long time, it is best to make a copy
28288
 * of it with ovsdb_datum_clone().
28289
 *
28290
 * This function is rarely useful, since it is easier to access the value
28291
 * directly through the "select_all" member in ovsrec_mirror. */
28292
const struct ovsdb_datum *
28293
ovsrec_mirror_get_select_all(const struct ovsrec_mirror *row,
28294
  enum ovsdb_atomic_type key_type OVS_UNUSED)
28295
0
{
28296
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
28297
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_all);
28298
0
}
28299
28300
/* Returns the "select_dst_port" column's value from the "Mirror" table in 'row'
28301
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
28302
 * ovsdb_datum_find_key() is an easier and more efficient way to search
28303
 * for a given key than implementing the same operation on the "cooked"
28304
 * form in 'row'.
28305
 *
28306
 * 'key_type' must be OVSDB_TYPE_UUID.
28307
 * (This helps to avoid silent bugs if someone changes select_dst_port's
28308
 * type without updating the caller.)
28309
 *
28310
 * The caller must not modify or free the returned value.
28311
 *
28312
 * Various kinds of changes can invalidate the returned value: modifying
28313
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
28314
 * If the returned value is needed for a long time, it is best to make a copy
28315
 * of it with ovsdb_datum_clone().
28316
 *
28317
 * This function is rarely useful, since it is easier to access the value
28318
 * directly through the "select_dst_port" member in ovsrec_mirror. */
28319
const struct ovsdb_datum *
28320
ovsrec_mirror_get_select_dst_port(const struct ovsrec_mirror *row,
28321
  enum ovsdb_atomic_type key_type OVS_UNUSED)
28322
0
{
28323
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
28324
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_dst_port);
28325
0
}
28326
28327
/* Returns the "select_src_port" column's value from the "Mirror" table in 'row'
28328
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
28329
 * ovsdb_datum_find_key() is an easier and more efficient way to search
28330
 * for a given key than implementing the same operation on the "cooked"
28331
 * form in 'row'.
28332
 *
28333
 * 'key_type' must be OVSDB_TYPE_UUID.
28334
 * (This helps to avoid silent bugs if someone changes select_src_port's
28335
 * type without updating the caller.)
28336
 *
28337
 * The caller must not modify or free the returned value.
28338
 *
28339
 * Various kinds of changes can invalidate the returned value: modifying
28340
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
28341
 * If the returned value is needed for a long time, it is best to make a copy
28342
 * of it with ovsdb_datum_clone().
28343
 *
28344
 * This function is rarely useful, since it is easier to access the value
28345
 * directly through the "select_src_port" member in ovsrec_mirror. */
28346
const struct ovsdb_datum *
28347
ovsrec_mirror_get_select_src_port(const struct ovsrec_mirror *row,
28348
  enum ovsdb_atomic_type key_type OVS_UNUSED)
28349
0
{
28350
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
28351
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_src_port);
28352
0
}
28353
28354
/* Returns the "select_vlan" column's value from the "Mirror" table in 'row'
28355
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
28356
 * ovsdb_datum_find_key() is an easier and more efficient way to search
28357
 * for a given key than implementing the same operation on the "cooked"
28358
 * form in 'row'.
28359
 *
28360
 * 'key_type' must be OVSDB_TYPE_INTEGER.
28361
 * (This helps to avoid silent bugs if someone changes select_vlan's
28362
 * type without updating the caller.)
28363
 *
28364
 * The caller must not modify or free the returned value.
28365
 *
28366
 * Various kinds of changes can invalidate the returned value: modifying
28367
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
28368
 * If the returned value is needed for a long time, it is best to make a copy
28369
 * of it with ovsdb_datum_clone().
28370
 *
28371
 * This function is rarely useful, since it is easier to access the value
28372
 * directly through the "select_vlan" member in ovsrec_mirror. */
28373
const struct ovsdb_datum *
28374
ovsrec_mirror_get_select_vlan(const struct ovsrec_mirror *row,
28375
  enum ovsdb_atomic_type key_type OVS_UNUSED)
28376
0
{
28377
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
28378
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_vlan);
28379
0
}
28380
28381
/* Returns the "snaplen" column's value from the "Mirror" table in 'row'
28382
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
28383
 * ovsdb_datum_find_key() is an easier and more efficient way to search
28384
 * for a given key than implementing the same operation on the "cooked"
28385
 * form in 'row'.
28386
 *
28387
 * 'key_type' must be OVSDB_TYPE_INTEGER.
28388
 * (This helps to avoid silent bugs if someone changes snaplen's
28389
 * type without updating the caller.)
28390
 *
28391
 * The caller must not modify or free the returned value.
28392
 *
28393
 * Various kinds of changes can invalidate the returned value: modifying
28394
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
28395
 * If the returned value is needed for a long time, it is best to make a copy
28396
 * of it with ovsdb_datum_clone().
28397
 *
28398
 * This function is rarely useful, since it is easier to access the value
28399
 * directly through the "snaplen" member in ovsrec_mirror. */
28400
const struct ovsdb_datum *
28401
ovsrec_mirror_get_snaplen(const struct ovsrec_mirror *row,
28402
  enum ovsdb_atomic_type key_type OVS_UNUSED)
28403
0
{
28404
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
28405
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_snaplen);
28406
0
}
28407
28408
/* Returns the "statistics" column's value from the "Mirror" table in 'row'
28409
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
28410
 * ovsdb_datum_find_key() is an easier and more efficient way to search
28411
 * for a given key than implementing the same operation on the "cooked"
28412
 * form in 'row'.
28413
 *
28414
 * 'key_type' must be OVSDB_TYPE_STRING.
28415
 * 'value_type' must be OVSDB_TYPE_INTEGER.
28416
 * (This helps to avoid silent bugs if someone changes statistics's
28417
 * type without updating the caller.)
28418
 *
28419
 * The caller must not modify or free the returned value.
28420
 *
28421
 * Various kinds of changes can invalidate the returned value: modifying
28422
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
28423
 * If the returned value is needed for a long time, it is best to make a copy
28424
 * of it with ovsdb_datum_clone().
28425
 *
28426
 * This function is rarely useful, since it is easier to access the value
28427
 * directly through the "statistics" member in ovsrec_mirror. */
28428
const struct ovsdb_datum *
28429
ovsrec_mirror_get_statistics(const struct ovsrec_mirror *row,
28430
  enum ovsdb_atomic_type key_type OVS_UNUSED,
28431
  enum ovsdb_atomic_type value_type OVS_UNUSED)
28432
0
{
28433
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
28434
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
28435
0
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_statistics);
28436
0
}
28437
28438
/* Sets the "external_ids" column's value from the "Mirror" table in 'row'
28439
 * to 'external_ids'.
28440
 *
28441
 * The caller retains ownership of 'external_ids' and everything in it. */
28442
void
28443
ovsrec_mirror_set_external_ids(const struct ovsrec_mirror *row, const struct smap *external_ids)
28444
0
{
28445
0
    struct ovsdb_datum datum;
28446
28447
0
    if (external_ids) {
28448
0
        ovsdb_datum_from_smap(&datum, external_ids);
28449
0
    } else {
28450
0
        ovsdb_datum_init_empty(&datum);
28451
0
    }
28452
0
    ovsdb_idl_txn_write(&row->header_,
28453
0
                        &ovsrec_mirror_col_external_ids,
28454
0
                        &datum);
28455
0
}
28456
28457
28458
/* Sets the "name" column from the "Mirror" table in 'row' to
28459
 * 'name'.
28460
 *
28461
 * The caller retains ownership of the arguments. */
28462
void
28463
ovsrec_mirror_set_name(const struct ovsrec_mirror *row, const char *name)
28464
0
{
28465
0
    struct ovsdb_datum datum;
28466
28467
0
    datum.refcnt = NULL;
28468
28469
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
28470
28471
0
    datum.n = 1;
28472
0
    datum.keys = key;
28473
0
    key->s = ovsdb_atom_string_create(name);
28474
0
    datum.values = NULL;
28475
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_name, &datum);
28476
0
}
28477
28478
/* Sets the "output_port" column from the "Mirror" table in 'row' to
28479
 * the 'output_port' set.
28480
 *
28481
 * If "output_port" is null, the column will be the empty set,
28482
 * otherwise it will contain the specified value.
28483
 *
28484
 * The caller retains ownership of the arguments. */
28485
void
28486
ovsrec_mirror_set_output_port(const struct ovsrec_mirror *row, const struct ovsrec_port *output_port)
28487
0
{
28488
0
    struct ovsdb_datum datum;
28489
28490
0
    datum.refcnt = NULL;
28491
28492
0
    if (output_port) {
28493
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
28494
0
        datum.n = 1;
28495
0
        datum.keys = key;
28496
0
        key->uuid = output_port->header_.uuid;
28497
0
    } else {
28498
0
        datum.n = 0;
28499
0
        datum.keys = NULL;
28500
0
    }
28501
0
    datum.values = NULL;
28502
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_output_port, &datum);
28503
0
}
28504
28505
/* Sets the "output_vlan" column from the "Mirror" table in 'row' to
28506
 * the 'output_vlan' set with 'n_output_vlan' entries.
28507
 *
28508
 * 'n_output_vlan' may be 0 or 1; if it is 0, then 'output_vlan'
28509
 * may be NULL.
28510
 *
28511
 * Argument constraints: in range 1 to 4,095
28512
 *
28513
 * The caller retains ownership of the arguments. */
28514
void
28515
ovsrec_mirror_set_output_vlan(const struct ovsrec_mirror *row, const int64_t *output_vlan, size_t n_output_vlan)
28516
0
{
28517
0
    struct ovsdb_datum datum;
28518
28519
0
    datum.refcnt = NULL;
28520
28521
0
    if (n_output_vlan) {
28522
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
28523
0
        datum.n = 1;
28524
0
        datum.keys = key;
28525
0
        key->integer = *output_vlan;
28526
0
    } else {
28527
0
        datum.n = 0;
28528
0
        datum.keys = NULL;
28529
0
    }
28530
0
    datum.values = NULL;
28531
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_output_vlan, &datum);
28532
0
}
28533
28534
/* Sets the "select_all" column from the "Mirror" table in 'row' to
28535
 * 'select_all'.
28536
 *
28537
 * The caller retains ownership of the arguments. */
28538
void
28539
ovsrec_mirror_set_select_all(const struct ovsrec_mirror *row, bool select_all)
28540
0
{
28541
0
    struct ovsdb_datum datum;
28542
28543
0
    datum.refcnt = NULL;
28544
28545
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
28546
28547
0
    datum.n = 1;
28548
0
    datum.keys = key;
28549
0
    key->boolean = select_all;
28550
0
    datum.values = NULL;
28551
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_select_all, &datum);
28552
0
}
28553
28554
/* Sets the "select_dst_port" column from the "Mirror" table in 'row' to
28555
 * the 'select_dst_port' set with 'n_select_dst_port' entries.
28556
 *
28557
 * The caller retains ownership of the arguments. */
28558
void
28559
ovsrec_mirror_set_select_dst_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_dst_port, size_t n_select_dst_port)
28560
0
{
28561
0
    struct ovsdb_datum datum;
28562
28563
0
    datum.refcnt = NULL;
28564
28565
0
    datum.n = n_select_dst_port;
28566
0
    datum.keys = n_select_dst_port ? xmalloc(n_select_dst_port * sizeof *datum.keys) : NULL;
28567
0
    datum.values = NULL;
28568
0
    for (size_t i = 0; i < n_select_dst_port; i++) {
28569
0
        datum.keys[i].uuid = select_dst_port[i]->header_.uuid;
28570
0
    }
28571
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_select_dst_port, &datum);
28572
0
}
28573
28574
/* Sets the "select_src_port" column from the "Mirror" table in 'row' to
28575
 * the 'select_src_port' set with 'n_select_src_port' entries.
28576
 *
28577
 * The caller retains ownership of the arguments. */
28578
void
28579
ovsrec_mirror_set_select_src_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_src_port, size_t n_select_src_port)
28580
0
{
28581
0
    struct ovsdb_datum datum;
28582
28583
0
    datum.refcnt = NULL;
28584
28585
0
    datum.n = n_select_src_port;
28586
0
    datum.keys = n_select_src_port ? xmalloc(n_select_src_port * sizeof *datum.keys) : NULL;
28587
0
    datum.values = NULL;
28588
0
    for (size_t i = 0; i < n_select_src_port; i++) {
28589
0
        datum.keys[i].uuid = select_src_port[i]->header_.uuid;
28590
0
    }
28591
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_select_src_port, &datum);
28592
0
}
28593
28594
/* Sets the "select_vlan" column from the "Mirror" table in 'row' to
28595
 * the 'select_vlan' set with 'n_select_vlan' entries.
28596
 *
28597
 * Argument constraints: in range 0 to 4,095
28598
 *
28599
 * The caller retains ownership of the arguments. */
28600
void
28601
ovsrec_mirror_set_select_vlan(const struct ovsrec_mirror *row, const int64_t *select_vlan, size_t n_select_vlan)
28602
0
{
28603
0
    struct ovsdb_datum datum;
28604
28605
0
    datum.refcnt = NULL;
28606
28607
0
    datum.n = n_select_vlan;
28608
0
    datum.keys = n_select_vlan ? xmalloc(n_select_vlan * sizeof *datum.keys) : NULL;
28609
0
    datum.values = NULL;
28610
0
    for (size_t i = 0; i < n_select_vlan; i++) {
28611
0
        datum.keys[i].integer = select_vlan[i];
28612
0
    }
28613
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_select_vlan, &datum);
28614
0
}
28615
28616
/* Sets the "snaplen" column from the "Mirror" table in 'row' to
28617
 * the 'snaplen' set with 'n_snaplen' entries.
28618
 *
28619
 * 'n_snaplen' may be 0 or 1; if it is 0, then 'snaplen'
28620
 * may be NULL.
28621
 *
28622
 * Argument constraints: in range 14 to 65,535
28623
 *
28624
 * The caller retains ownership of the arguments. */
28625
void
28626
ovsrec_mirror_set_snaplen(const struct ovsrec_mirror *row, const int64_t *snaplen, size_t n_snaplen)
28627
0
{
28628
0
    struct ovsdb_datum datum;
28629
28630
0
    datum.refcnt = NULL;
28631
28632
0
    if (n_snaplen) {
28633
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
28634
0
        datum.n = 1;
28635
0
        datum.keys = key;
28636
0
        key->integer = *snaplen;
28637
0
    } else {
28638
0
        datum.n = 0;
28639
0
        datum.keys = NULL;
28640
0
    }
28641
0
    datum.values = NULL;
28642
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_snaplen, &datum);
28643
0
}
28644
28645
/* Sets the "statistics" column from the "Mirror" table in 'row' to
28646
 * the map with keys 'key_statistics' and values 'value_statistics'
28647
 * with 'n_statistics' entries.
28648
 *
28649
 * The caller retains ownership of the arguments. */
28650
void
28651
ovsrec_mirror_set_statistics(const struct ovsrec_mirror *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
28652
0
{
28653
0
    struct ovsdb_datum datum;
28654
28655
0
    datum.refcnt = NULL;
28656
28657
0
    datum.n = n_statistics;
28658
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
28659
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
28660
0
    for (size_t i = 0; i < n_statistics; i++) {
28661
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
28662
0
        datum.values[i].integer = value_statistics[i];
28663
0
    }
28664
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_col_statistics, &datum);
28665
0
}
28666
28667
/* Sets an element of the "external_ids" map column from the "Mirror" table in 'row'
28668
 * to 'new_value' given the key value 'new_key'.
28669
 *
28670
 */
28671
void
28672
ovsrec_mirror_update_external_ids_setkey(const struct ovsrec_mirror *row, const char *new_key, const char *new_value)
28673
0
{
28674
0
    struct ovsdb_datum *datum;
28675
28676
0
    datum = xmalloc(sizeof *datum);
28677
0
    datum->n = 1;
28678
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
28679
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
28680
0
    datum->refcnt = NULL;
28681
28682
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
28683
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
28684
28685
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
28686
0
                                    &ovsrec_mirror_col_external_ids,
28687
0
                                    datum);
28688
0
}
28689
28690
/* Deletes an element of the "external_ids" map column from the "Mirror" table in 'row'
28691
 * given the key value 'delete_key'.
28692
 *
28693
 */
28694
void
28695
ovsrec_mirror_update_external_ids_delkey(const struct ovsrec_mirror *row, const char *delete_key)
28696
0
{
28697
0
    struct ovsdb_datum *datum;
28698
28699
0
    datum = xmalloc(sizeof *datum);
28700
0
    datum->n = 1;
28701
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
28702
0
    datum->values = NULL;
28703
0
    datum->refcnt = NULL;
28704
28705
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
28706
28707
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
28708
0
                                    &ovsrec_mirror_col_external_ids,
28709
0
                                    datum);
28710
0
}
28711
28712
/* Adds the value 'new_value' to the "output_port" set column from the "Mirror" table
28713
 * in 'row'.
28714
 *
28715
 */
28716
void
28717
ovsrec_mirror_update_output_port_addvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *new_value)
28718
0
{
28719
0
    struct ovsdb_datum *datum;
28720
28721
0
    datum = xmalloc(sizeof *datum);
28722
0
    datum->n = 1;
28723
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28724
0
    datum->values = NULL;
28725
0
    datum->refcnt = NULL;
28726
28727
0
    datum->keys[0].uuid = new_value->header_.uuid;
28728
28729
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
28730
0
                                    &ovsrec_mirror_col_output_port,
28731
0
                                    datum);
28732
0
}
28733
28734
/* Deletes the value 'delete_value' from the "output_port" set column from the
28735
 * "Mirror" table in 'row'.
28736
 *
28737
 */
28738
void
28739
ovsrec_mirror_update_output_port_delvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *delete_value)
28740
0
{
28741
0
    struct ovsdb_datum *datum;
28742
28743
0
    datum = xmalloc(sizeof *datum);
28744
0
    datum->n = 1;
28745
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28746
0
    datum->values = NULL;
28747
0
    datum->refcnt = NULL;
28748
28749
0
    datum->keys[0].uuid = delete_value->header_.uuid;
28750
28751
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
28752
0
                                    &ovsrec_mirror_col_output_port,
28753
0
                                    datum);
28754
0
}
28755
28756
/* Adds the value 'new_value' to the "output_vlan" set column from the "Mirror" table
28757
 * in 'row'.
28758
 *
28759
 */
28760
void
28761
ovsrec_mirror_update_output_vlan_addvalue(const struct ovsrec_mirror *row, int64_t new_value)
28762
0
{
28763
0
    struct ovsdb_datum *datum;
28764
28765
0
    datum = xmalloc(sizeof *datum);
28766
0
    datum->n = 1;
28767
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28768
0
    datum->values = NULL;
28769
0
    datum->refcnt = NULL;
28770
28771
0
    datum->keys[0].integer = new_value;
28772
28773
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
28774
0
                                    &ovsrec_mirror_col_output_vlan,
28775
0
                                    datum);
28776
0
}
28777
28778
/* Deletes the value 'delete_value' from the "output_vlan" set column from the
28779
 * "Mirror" table in 'row'.
28780
 *
28781
 */
28782
void
28783
ovsrec_mirror_update_output_vlan_delvalue(const struct ovsrec_mirror *row, int64_t delete_value)
28784
0
{
28785
0
    struct ovsdb_datum *datum;
28786
28787
0
    datum = xmalloc(sizeof *datum);
28788
0
    datum->n = 1;
28789
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28790
0
    datum->values = NULL;
28791
0
    datum->refcnt = NULL;
28792
28793
0
    datum->keys[0].integer = delete_value;
28794
28795
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
28796
0
                                    &ovsrec_mirror_col_output_vlan,
28797
0
                                    datum);
28798
0
}
28799
28800
/* Adds the value 'new_value' to the "select_dst_port" set column from the "Mirror" table
28801
 * in 'row'.
28802
 *
28803
 */
28804
void
28805
ovsrec_mirror_update_select_dst_port_addvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *new_value)
28806
0
{
28807
0
    struct ovsdb_datum *datum;
28808
28809
0
    datum = xmalloc(sizeof *datum);
28810
0
    datum->n = 1;
28811
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28812
0
    datum->values = NULL;
28813
0
    datum->refcnt = NULL;
28814
28815
0
    datum->keys[0].uuid = new_value->header_.uuid;
28816
28817
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
28818
0
                                    &ovsrec_mirror_col_select_dst_port,
28819
0
                                    datum);
28820
0
}
28821
28822
/* Deletes the value 'delete_value' from the "select_dst_port" set column from the
28823
 * "Mirror" table in 'row'.
28824
 *
28825
 */
28826
void
28827
ovsrec_mirror_update_select_dst_port_delvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *delete_value)
28828
0
{
28829
0
    struct ovsdb_datum *datum;
28830
28831
0
    datum = xmalloc(sizeof *datum);
28832
0
    datum->n = 1;
28833
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28834
0
    datum->values = NULL;
28835
0
    datum->refcnt = NULL;
28836
28837
0
    datum->keys[0].uuid = delete_value->header_.uuid;
28838
28839
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
28840
0
                                    &ovsrec_mirror_col_select_dst_port,
28841
0
                                    datum);
28842
0
}
28843
28844
/* Adds the value 'new_value' to the "select_src_port" set column from the "Mirror" table
28845
 * in 'row'.
28846
 *
28847
 */
28848
void
28849
ovsrec_mirror_update_select_src_port_addvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *new_value)
28850
0
{
28851
0
    struct ovsdb_datum *datum;
28852
28853
0
    datum = xmalloc(sizeof *datum);
28854
0
    datum->n = 1;
28855
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28856
0
    datum->values = NULL;
28857
0
    datum->refcnt = NULL;
28858
28859
0
    datum->keys[0].uuid = new_value->header_.uuid;
28860
28861
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
28862
0
                                    &ovsrec_mirror_col_select_src_port,
28863
0
                                    datum);
28864
0
}
28865
28866
/* Deletes the value 'delete_value' from the "select_src_port" set column from the
28867
 * "Mirror" table in 'row'.
28868
 *
28869
 */
28870
void
28871
ovsrec_mirror_update_select_src_port_delvalue(const struct ovsrec_mirror *row, const struct ovsrec_port *delete_value)
28872
0
{
28873
0
    struct ovsdb_datum *datum;
28874
28875
0
    datum = xmalloc(sizeof *datum);
28876
0
    datum->n = 1;
28877
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28878
0
    datum->values = NULL;
28879
0
    datum->refcnt = NULL;
28880
28881
0
    datum->keys[0].uuid = delete_value->header_.uuid;
28882
28883
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
28884
0
                                    &ovsrec_mirror_col_select_src_port,
28885
0
                                    datum);
28886
0
}
28887
28888
/* Adds the value 'new_value' to the "select_vlan" set column from the "Mirror" table
28889
 * in 'row'.
28890
 *
28891
 */
28892
void
28893
ovsrec_mirror_update_select_vlan_addvalue(const struct ovsrec_mirror *row, int64_t new_value)
28894
0
{
28895
0
    struct ovsdb_datum *datum;
28896
28897
0
    datum = xmalloc(sizeof *datum);
28898
0
    datum->n = 1;
28899
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28900
0
    datum->values = NULL;
28901
0
    datum->refcnt = NULL;
28902
28903
0
    datum->keys[0].integer = new_value;
28904
28905
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
28906
0
                                    &ovsrec_mirror_col_select_vlan,
28907
0
                                    datum);
28908
0
}
28909
28910
/* Deletes the value 'delete_value' from the "select_vlan" set column from the
28911
 * "Mirror" table in 'row'.
28912
 *
28913
 */
28914
void
28915
ovsrec_mirror_update_select_vlan_delvalue(const struct ovsrec_mirror *row, int64_t delete_value)
28916
0
{
28917
0
    struct ovsdb_datum *datum;
28918
28919
0
    datum = xmalloc(sizeof *datum);
28920
0
    datum->n = 1;
28921
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28922
0
    datum->values = NULL;
28923
0
    datum->refcnt = NULL;
28924
28925
0
    datum->keys[0].integer = delete_value;
28926
28927
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
28928
0
                                    &ovsrec_mirror_col_select_vlan,
28929
0
                                    datum);
28930
0
}
28931
28932
/* Adds the value 'new_value' to the "snaplen" set column from the "Mirror" table
28933
 * in 'row'.
28934
 *
28935
 */
28936
void
28937
ovsrec_mirror_update_snaplen_addvalue(const struct ovsrec_mirror *row, int64_t new_value)
28938
0
{
28939
0
    struct ovsdb_datum *datum;
28940
28941
0
    datum = xmalloc(sizeof *datum);
28942
0
    datum->n = 1;
28943
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28944
0
    datum->values = NULL;
28945
0
    datum->refcnt = NULL;
28946
28947
0
    datum->keys[0].integer = new_value;
28948
28949
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
28950
0
                                    &ovsrec_mirror_col_snaplen,
28951
0
                                    datum);
28952
0
}
28953
28954
/* Deletes the value 'delete_value' from the "snaplen" set column from the
28955
 * "Mirror" table in 'row'.
28956
 *
28957
 */
28958
void
28959
ovsrec_mirror_update_snaplen_delvalue(const struct ovsrec_mirror *row, int64_t delete_value)
28960
0
{
28961
0
    struct ovsdb_datum *datum;
28962
28963
0
    datum = xmalloc(sizeof *datum);
28964
0
    datum->n = 1;
28965
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
28966
0
    datum->values = NULL;
28967
0
    datum->refcnt = NULL;
28968
28969
0
    datum->keys[0].integer = delete_value;
28970
28971
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
28972
0
                                    &ovsrec_mirror_col_snaplen,
28973
0
                                    datum);
28974
0
}
28975
28976
/* Sets an element of the "statistics" map column from the "Mirror" table in 'row'
28977
 * to 'new_value' given the key value 'new_key'.
28978
 *
28979
 */
28980
void
28981
ovsrec_mirror_update_statistics_setkey(const struct ovsrec_mirror *row, const char *new_key, int64_t new_value)
28982
0
{
28983
0
    struct ovsdb_datum *datum;
28984
28985
0
    datum = xmalloc(sizeof *datum);
28986
0
    datum->n = 1;
28987
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
28988
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
28989
0
    datum->refcnt = NULL;
28990
28991
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
28992
0
    datum->values[0].integer = new_value;
28993
28994
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
28995
0
                                    &ovsrec_mirror_col_statistics,
28996
0
                                    datum);
28997
0
}
28998
28999
/* Deletes an element of the "statistics" map column from the "Mirror" table in 'row'
29000
 * given the key value 'delete_key'.
29001
 *
29002
 */
29003
void
29004
ovsrec_mirror_update_statistics_delkey(const struct ovsrec_mirror *row, const char *delete_key)
29005
0
{
29006
0
    struct ovsdb_datum *datum;
29007
29008
0
    datum = xmalloc(sizeof *datum);
29009
0
    datum->n = 1;
29010
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
29011
0
    datum->values = NULL;
29012
0
    datum->refcnt = NULL;
29013
29014
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
29015
29016
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
29017
0
                                    &ovsrec_mirror_col_statistics,
29018
0
                                    datum);
29019
0
}
29020
29021
/* Sets the "external_ids" column's value from the "Mirror" table in 'row'
29022
 * to 'external_ids'.
29023
 *
29024
 * The caller retains ownership of 'external_ids' and everything in it. */
29025
void
29026
ovsrec_mirror_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
29027
0
{
29028
0
    struct ovsdb_datum datum;
29029
29030
0
    if (external_ids) {
29031
0
        ovsdb_datum_from_smap(&datum, external_ids);
29032
0
    } else {
29033
0
        ovsdb_datum_init_empty(&datum);
29034
0
    }
29035
29036
0
    ovsdb_idl_condition_add_clause(cond,
29037
0
                                   function,
29038
0
                                   &ovsrec_mirror_col_external_ids,
29039
0
                                   &datum);
29040
29041
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_external_ids.type);
29042
0
}
29043
29044
29045
/* Sets the "name" column from the "Mirror" table in 'row' to
29046
 * 'name'.
29047
 *
29048
 * The caller retains ownership of the arguments. */
29049
void
29050
ovsrec_mirror_add_clause_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *name)
29051
0
{
29052
0
    struct ovsdb_datum datum;
29053
29054
0
    datum.refcnt = NULL;
29055
29056
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
29057
29058
0
    datum.n = 1;
29059
0
    datum.keys = key;
29060
0
    key->s = ovsdb_atom_string_create(name);
29061
0
    datum.values = NULL;
29062
0
    ovsdb_idl_condition_add_clause(cond,
29063
0
                          function,
29064
0
                          &ovsrec_mirror_col_name,
29065
0
                          &datum);
29066
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_name.type);
29067
0
}
29068
29069
/* Sets the "output_port" column from the "Mirror" table in 'row' to
29070
 * the 'output_port' set.
29071
 *
29072
 * If "output_port" is null, the column will be the empty set,
29073
 * otherwise it will contain the specified value.
29074
 *
29075
 * The caller retains ownership of the arguments. */
29076
void
29077
ovsrec_mirror_add_clause_output_port(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *output_port)
29078
0
{
29079
0
    struct ovsdb_datum datum;
29080
29081
0
    datum.refcnt = NULL;
29082
29083
0
    if (output_port) {
29084
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
29085
0
        datum.n = 1;
29086
0
        datum.keys = key;
29087
0
        key->uuid = *output_port;
29088
0
    } else {
29089
0
        datum.n = 0;
29090
0
        datum.keys = NULL;
29091
0
    }
29092
0
    datum.values = NULL;
29093
0
    ovsdb_idl_condition_add_clause(cond,
29094
0
                          function,
29095
0
                          &ovsrec_mirror_col_output_port,
29096
0
                          &datum);
29097
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_output_port.type);
29098
0
}
29099
29100
/* Sets the "output_vlan" column from the "Mirror" table in 'row' to
29101
 * the 'output_vlan' set with 'n_output_vlan' entries.
29102
 *
29103
 * 'n_output_vlan' may be 0 or 1; if it is 0, then 'output_vlan'
29104
 * may be NULL.
29105
 *
29106
 * Argument constraints: in range 1 to 4,095
29107
 *
29108
 * The caller retains ownership of the arguments. */
29109
void
29110
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)
29111
0
{
29112
0
    struct ovsdb_datum datum;
29113
29114
0
    datum.refcnt = NULL;
29115
29116
0
    if (n_output_vlan) {
29117
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
29118
0
        datum.n = 1;
29119
0
        datum.keys = key;
29120
0
        key->integer = *output_vlan;
29121
0
    } else {
29122
0
        datum.n = 0;
29123
0
        datum.keys = NULL;
29124
0
    }
29125
0
    datum.values = NULL;
29126
0
    ovsdb_idl_condition_add_clause(cond,
29127
0
                          function,
29128
0
                          &ovsrec_mirror_col_output_vlan,
29129
0
                          &datum);
29130
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_output_vlan.type);
29131
0
}
29132
29133
/* Sets the "select_all" column from the "Mirror" table in 'row' to
29134
 * 'select_all'.
29135
 *
29136
 * The caller retains ownership of the arguments. */
29137
void
29138
ovsrec_mirror_add_clause_select_all(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool select_all)
29139
0
{
29140
0
    struct ovsdb_datum datum;
29141
29142
0
    datum.refcnt = NULL;
29143
29144
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
29145
29146
0
    datum.n = 1;
29147
0
    datum.keys = key;
29148
0
    key->boolean = select_all;
29149
0
    datum.values = NULL;
29150
0
    ovsdb_idl_condition_add_clause(cond,
29151
0
                          function,
29152
0
                          &ovsrec_mirror_col_select_all,
29153
0
                          &datum);
29154
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_select_all.type);
29155
0
}
29156
29157
/* Sets the "select_dst_port" column from the "Mirror" table in 'row' to
29158
 * the 'select_dst_port' set with 'n_select_dst_port' entries.
29159
 *
29160
 * The caller retains ownership of the arguments. */
29161
void
29162
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)
29163
0
{
29164
0
    struct ovsdb_datum datum;
29165
29166
0
    datum.refcnt = NULL;
29167
0
    datum.n = n_select_dst_port;
29168
0
    datum.keys = n_select_dst_port ? xmalloc(n_select_dst_port * sizeof *datum.keys) : NULL;
29169
0
    datum.values = NULL;
29170
0
    for (size_t i = 0; i < n_select_dst_port; i++) {
29171
0
        datum.keys[i].uuid = *select_dst_port[i];
29172
0
    }
29173
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_dst_port.type);
29174
0
    ovsdb_idl_condition_add_clause(cond,
29175
0
                          function,
29176
0
                          &ovsrec_mirror_col_select_dst_port,
29177
0
                          &datum);
29178
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_select_dst_port.type);
29179
0
}
29180
29181
/* Sets the "select_src_port" column from the "Mirror" table in 'row' to
29182
 * the 'select_src_port' set with 'n_select_src_port' entries.
29183
 *
29184
 * The caller retains ownership of the arguments. */
29185
void
29186
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)
29187
0
{
29188
0
    struct ovsdb_datum datum;
29189
29190
0
    datum.refcnt = NULL;
29191
0
    datum.n = n_select_src_port;
29192
0
    datum.keys = n_select_src_port ? xmalloc(n_select_src_port * sizeof *datum.keys) : NULL;
29193
0
    datum.values = NULL;
29194
0
    for (size_t i = 0; i < n_select_src_port; i++) {
29195
0
        datum.keys[i].uuid = *select_src_port[i];
29196
0
    }
29197
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_src_port.type);
29198
0
    ovsdb_idl_condition_add_clause(cond,
29199
0
                          function,
29200
0
                          &ovsrec_mirror_col_select_src_port,
29201
0
                          &datum);
29202
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_select_src_port.type);
29203
0
}
29204
29205
/* Sets the "select_vlan" column from the "Mirror" table in 'row' to
29206
 * the 'select_vlan' set with 'n_select_vlan' entries.
29207
 *
29208
 * Argument constraints: in range 0 to 4,095
29209
 *
29210
 * The caller retains ownership of the arguments. */
29211
void
29212
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)
29213
0
{
29214
0
    struct ovsdb_datum datum;
29215
29216
0
    datum.refcnt = NULL;
29217
0
    datum.n = n_select_vlan;
29218
0
    datum.keys = n_select_vlan ? xmalloc(n_select_vlan * sizeof *datum.keys) : NULL;
29219
0
    datum.values = NULL;
29220
0
    for (size_t i = 0; i < n_select_vlan; i++) {
29221
0
        datum.keys[i].integer = select_vlan[i];
29222
0
    }
29223
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_vlan.type);
29224
0
    ovsdb_idl_condition_add_clause(cond,
29225
0
                          function,
29226
0
                          &ovsrec_mirror_col_select_vlan,
29227
0
                          &datum);
29228
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_select_vlan.type);
29229
0
}
29230
29231
/* Sets the "snaplen" column from the "Mirror" table in 'row' to
29232
 * the 'snaplen' set with 'n_snaplen' entries.
29233
 *
29234
 * 'n_snaplen' may be 0 or 1; if it is 0, then 'snaplen'
29235
 * may be NULL.
29236
 *
29237
 * Argument constraints: in range 14 to 65,535
29238
 *
29239
 * The caller retains ownership of the arguments. */
29240
void
29241
ovsrec_mirror_add_clause_snaplen(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *snaplen, size_t n_snaplen)
29242
0
{
29243
0
    struct ovsdb_datum datum;
29244
29245
0
    datum.refcnt = NULL;
29246
29247
0
    if (n_snaplen) {
29248
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
29249
0
        datum.n = 1;
29250
0
        datum.keys = key;
29251
0
        key->integer = *snaplen;
29252
0
    } else {
29253
0
        datum.n = 0;
29254
0
        datum.keys = NULL;
29255
0
    }
29256
0
    datum.values = NULL;
29257
0
    ovsdb_idl_condition_add_clause(cond,
29258
0
                          function,
29259
0
                          &ovsrec_mirror_col_snaplen,
29260
0
                          &datum);
29261
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_snaplen.type);
29262
0
}
29263
29264
/* Sets the "statistics" column from the "Mirror" table in 'row' to
29265
 * the map with keys 'key_statistics' and values 'value_statistics'
29266
 * with 'n_statistics' entries.
29267
 *
29268
 * The caller retains ownership of the arguments. */
29269
void
29270
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)
29271
0
{
29272
0
    struct ovsdb_datum datum;
29273
29274
0
    datum.refcnt = NULL;
29275
0
    datum.n = n_statistics;
29276
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
29277
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
29278
0
    for (size_t i = 0; i < n_statistics; i++) {
29279
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
29280
0
        datum.values[i].integer = value_statistics[i];
29281
0
    }
29282
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_statistics.type);
29283
0
    ovsdb_idl_condition_add_clause(cond,
29284
0
                          function,
29285
0
                          &ovsrec_mirror_col_statistics,
29286
0
                          &datum);
29287
0
    ovsdb_datum_destroy(&datum, &ovsrec_mirror_col_statistics.type);
29288
0
}
29289
29290
/* Destroy 'row' of kind "Mirror". The row must have been
29291
 * created with ovsdb_idl_index_init_row.
29292
 */
29293
void
29294
ovsrec_mirror_index_destroy_row(const struct ovsrec_mirror *row)
29295
0
{
29296
0
    ovsdb_idl_index_destroy_row(&row->header_);
29297
0
}
29298
        
29299
29300
/* Creates a new row of kind "Mirror". */
29301
struct ovsrec_mirror *
29302
ovsrec_mirror_index_init_row(struct ovsdb_idl_index *index)
29303
0
{
29304
0
    ovs_assert(index->table->class_ == &ovsrec_table_mirror);
29305
0
    return ALIGNED_CAST(struct ovsrec_mirror *, ovsdb_idl_index_init_row(index));
29306
0
}
29307
29308
struct ovsrec_mirror *
29309
ovsrec_mirror_index_find(struct ovsdb_idl_index *index, const struct ovsrec_mirror *target)
29310
0
{
29311
0
    ovs_assert(index->table->class_ == &ovsrec_table_mirror);
29312
0
    return ovsrec_mirror_cast(ovsdb_idl_index_find(index, &target->header_));
29313
0
}
29314
29315
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
29316
int
29317
ovsrec_mirror_index_compare(
29318
    struct ovsdb_idl_index *index, 
29319
    const struct ovsrec_mirror *a, 
29320
    const struct ovsrec_mirror *b)
29321
0
{
29322
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
29323
0
}
29324
29325
struct ovsdb_idl_cursor
29326
ovsrec_mirror_cursor_first(struct ovsdb_idl_index *index)
29327
0
{
29328
0
    ovs_assert(index->table->class_ == &ovsrec_table_mirror);
29329
0
    return ovsdb_idl_cursor_first(index);
29330
0
}
29331
29332
struct ovsdb_idl_cursor
29333
ovsrec_mirror_cursor_first_eq(
29334
    struct ovsdb_idl_index *index, const struct ovsrec_mirror *target)
29335
0
{
29336
0
    ovs_assert(index->table->class_ == &ovsrec_table_mirror);
29337
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
29338
0
}
29339
29340
struct ovsdb_idl_cursor
29341
ovsrec_mirror_cursor_first_ge(
29342
    struct ovsdb_idl_index *index, const struct ovsrec_mirror *target)
29343
0
{
29344
0
    ovs_assert(index->table->class_ == &ovsrec_table_mirror);
29345
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
29346
0
}
29347
29348
struct ovsrec_mirror *
29349
ovsrec_mirror_cursor_data(struct ovsdb_idl_cursor *cursor)
29350
0
{
29351
0
    return ovsrec_mirror_cast(ovsdb_idl_cursor_data(cursor));
29352
0
}
29353
29354
29355
/* Sets the "external_ids" column's value from the "Mirror" table in 'row'
29356
 * to 'external_ids'.
29357
 *
29358
 * The caller retains ownership of 'external_ids' and everything in it. */
29359
void
29360
ovsrec_mirror_index_set_external_ids(const struct ovsrec_mirror *row, const struct smap *external_ids)
29361
0
{
29362
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
29363
29364
0
    if (external_ids) {
29365
0
        struct smap_node *node;
29366
0
        size_t i;
29367
29368
0
        datum->n = smap_count(external_ids);
29369
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
29370
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
29371
0
        datum->refcnt = NULL;
29372
29373
0
        i = 0;
29374
0
        SMAP_FOR_EACH (node, external_ids) {
29375
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
29376
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
29377
0
            i++;
29378
0
        }
29379
0
        ovsdb_datum_sort_unique(datum, &ovsrec_mirror_col_external_ids.type);
29380
0
    } else {
29381
0
        ovsdb_datum_init_empty(datum);
29382
0
    }
29383
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
29384
0
                          &ovsrec_mirror_columns[OVSREC_MIRROR_COL_EXTERNAL_IDS],
29385
0
                          datum,
29386
0
                          &ovsrec_table_classes[OVSREC_TABLE_MIRROR]);
29387
0
    free(datum);
29388
0
}
29389
29390
29391
/* Sets the "name" column from the "Mirror" table in 'row' to
29392
 * 'name'.
29393
 *
29394
 * The caller retains ownership of the arguments. */
29395
void
29396
ovsrec_mirror_index_set_name(const struct ovsrec_mirror *row, const char *name)
29397
0
{
29398
0
    struct ovsdb_datum datum;
29399
29400
0
    datum.refcnt = NULL;
29401
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
29402
29403
0
    datum.n = 1;
29404
0
    datum.keys = key;
29405
0
    key->s = ovsdb_atom_string_create(name);
29406
0
    datum.values = NULL;
29407
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]);
29408
0
}
29409
29410
/* Sets the "output_port" column from the "Mirror" table in 'row' to
29411
 * the 'output_port' set.
29412
 *
29413
 * If "output_port" is null, the column will be the empty set,
29414
 * otherwise it will contain the specified value.
29415
 *
29416
 * The caller retains ownership of the arguments. */
29417
void
29418
ovsrec_mirror_index_set_output_port(const struct ovsrec_mirror *row, const struct ovsrec_port *output_port)
29419
0
{
29420
0
    struct ovsdb_datum datum;
29421
29422
0
    datum.refcnt = NULL;
29423
0
    union ovsdb_atom *key;
29424
29425
0
    if (output_port) {
29426
0
        key = xmalloc(sizeof (union ovsdb_atom));
29427
0
        datum.n = 1;
29428
0
        datum.keys = key;
29429
0
        key->uuid = output_port->header_.uuid;
29430
0
    } else {
29431
0
        datum.n = 0;
29432
0
        datum.keys = NULL;
29433
0
    }
29434
0
    datum.values = NULL;
29435
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]);
29436
0
}
29437
29438
/* Sets the "output_vlan" column from the "Mirror" table in 'row' to
29439
 * the 'output_vlan' set with 'n_output_vlan' entries.
29440
 *
29441
 * 'n_output_vlan' may be 0 or 1; if it is 0, then 'output_vlan'
29442
 * may be NULL.
29443
 *
29444
 * Argument constraints: in range 1 to 4,095
29445
 *
29446
 * The caller retains ownership of the arguments. */
29447
void
29448
ovsrec_mirror_index_set_output_vlan(const struct ovsrec_mirror *row, const int64_t *output_vlan, size_t n_output_vlan)
29449
0
{
29450
0
    struct ovsdb_datum datum;
29451
29452
0
    datum.refcnt = NULL;
29453
0
    union ovsdb_atom *key;
29454
29455
0
    if (n_output_vlan) {
29456
0
        key = xmalloc(sizeof(union ovsdb_atom));
29457
0
        datum.n = 1;
29458
0
        datum.keys = key;
29459
0
        key->integer = *output_vlan;
29460
0
    } else {
29461
0
        datum.n = 0;
29462
0
        datum.keys = NULL;
29463
0
    }
29464
0
    datum.values = NULL;
29465
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]);
29466
0
}
29467
29468
/* Sets the "select_all" column from the "Mirror" table in 'row' to
29469
 * 'select_all'.
29470
 *
29471
 * The caller retains ownership of the arguments. */
29472
void
29473
ovsrec_mirror_index_set_select_all(const struct ovsrec_mirror *row, bool select_all)
29474
0
{
29475
0
    struct ovsdb_datum datum;
29476
29477
0
    datum.refcnt = NULL;
29478
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
29479
29480
0
    datum.n = 1;
29481
0
    datum.keys = key;
29482
0
    key->boolean = select_all;
29483
0
    datum.values = NULL;
29484
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]);
29485
0
}
29486
29487
/* Sets the "select_dst_port" column from the "Mirror" table in 'row' to
29488
 * the 'select_dst_port' set with 'n_select_dst_port' entries.
29489
 *
29490
 * The caller retains ownership of the arguments. */
29491
void
29492
ovsrec_mirror_index_set_select_dst_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_dst_port, size_t n_select_dst_port)
29493
0
{
29494
0
    struct ovsdb_datum datum;
29495
29496
0
    datum.refcnt = NULL;
29497
0
    size_t i;
29498
29499
0
    datum.n = n_select_dst_port;
29500
0
    datum.keys = n_select_dst_port ? xmalloc(n_select_dst_port * sizeof *datum.keys) : NULL;
29501
0
    datum.values = NULL;
29502
0
    for (i = 0; i < n_select_dst_port; i++) {
29503
0
        datum.keys[i].uuid = select_dst_port[i]->header_.uuid;
29504
0
    }
29505
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_dst_port.type);
29506
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]);
29507
0
}
29508
29509
/* Sets the "select_src_port" column from the "Mirror" table in 'row' to
29510
 * the 'select_src_port' set with 'n_select_src_port' entries.
29511
 *
29512
 * The caller retains ownership of the arguments. */
29513
void
29514
ovsrec_mirror_index_set_select_src_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_src_port, size_t n_select_src_port)
29515
0
{
29516
0
    struct ovsdb_datum datum;
29517
29518
0
    datum.refcnt = NULL;
29519
0
    size_t i;
29520
29521
0
    datum.n = n_select_src_port;
29522
0
    datum.keys = n_select_src_port ? xmalloc(n_select_src_port * sizeof *datum.keys) : NULL;
29523
0
    datum.values = NULL;
29524
0
    for (i = 0; i < n_select_src_port; i++) {
29525
0
        datum.keys[i].uuid = select_src_port[i]->header_.uuid;
29526
0
    }
29527
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_src_port.type);
29528
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]);
29529
0
}
29530
29531
/* Sets the "select_vlan" column from the "Mirror" table in 'row' to
29532
 * the 'select_vlan' set with 'n_select_vlan' entries.
29533
 *
29534
 * Argument constraints: in range 0 to 4,095
29535
 *
29536
 * The caller retains ownership of the arguments. */
29537
void
29538
ovsrec_mirror_index_set_select_vlan(const struct ovsrec_mirror *row, const int64_t *select_vlan, size_t n_select_vlan)
29539
0
{
29540
0
    struct ovsdb_datum datum;
29541
29542
0
    datum.refcnt = NULL;
29543
0
    size_t i;
29544
29545
0
    datum.n = n_select_vlan;
29546
0
    datum.keys = n_select_vlan ? xmalloc(n_select_vlan * sizeof *datum.keys) : NULL;
29547
0
    datum.values = NULL;
29548
0
    for (i = 0; i < n_select_vlan; i++) {
29549
0
        datum.keys[i].integer = select_vlan[i];
29550
0
    }
29551
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_select_vlan.type);
29552
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]);
29553
0
}
29554
29555
/* Sets the "snaplen" column from the "Mirror" table in 'row' to
29556
 * the 'snaplen' set with 'n_snaplen' entries.
29557
 *
29558
 * 'n_snaplen' may be 0 or 1; if it is 0, then 'snaplen'
29559
 * may be NULL.
29560
 *
29561
 * Argument constraints: in range 14 to 65,535
29562
 *
29563
 * The caller retains ownership of the arguments. */
29564
void
29565
ovsrec_mirror_index_set_snaplen(const struct ovsrec_mirror *row, const int64_t *snaplen, size_t n_snaplen)
29566
0
{
29567
0
    struct ovsdb_datum datum;
29568
29569
0
    datum.refcnt = NULL;
29570
0
    union ovsdb_atom *key;
29571
29572
0
    if (n_snaplen) {
29573
0
        key = xmalloc(sizeof(union ovsdb_atom));
29574
0
        datum.n = 1;
29575
0
        datum.keys = key;
29576
0
        key->integer = *snaplen;
29577
0
    } else {
29578
0
        datum.n = 0;
29579
0
        datum.keys = NULL;
29580
0
    }
29581
0
    datum.values = NULL;
29582
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]);
29583
0
}
29584
29585
/* Sets the "statistics" column from the "Mirror" table in 'row' to
29586
 * the map with keys 'key_statistics' and values 'value_statistics'
29587
 * with 'n_statistics' entries.
29588
 *
29589
 * The caller retains ownership of the arguments. */
29590
void
29591
ovsrec_mirror_index_set_statistics(const struct ovsrec_mirror *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
29592
0
{
29593
0
    struct ovsdb_datum datum;
29594
29595
0
    datum.refcnt = NULL;
29596
0
    size_t i;
29597
29598
0
    datum.n = n_statistics;
29599
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
29600
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
29601
0
    for (i = 0; i < n_statistics; i++) {
29602
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
29603
0
        datum.values[i].integer = value_statistics[i];
29604
0
    }
29605
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_mirror_col_statistics.type);
29606
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]);
29607
0
}
29608
29609
struct ovsdb_idl_column ovsrec_mirror_columns[OVSREC_MIRROR_N_COLUMNS];
29610
29611
unsigned int
29612
ovsrec_mirror_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
29613
0
{
29614
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_mirror, condition);
29615
0
}
29616
29617
struct ovsdb_idl_column ovsrec_mirror_columns[OVSREC_MIRROR_N_COLUMNS] = {
29618
    [OVSREC_MIRROR_COL_EXTERNAL_IDS] = {
29619
         .name = "external_ids",
29620
         .type = {
29621
            .key = {
29622
               .type = OVSDB_TYPE_STRING,
29623
               .string = { .minLen = 0, .maxLen = UINT_MAX },
29624
            },
29625
            .value = {
29626
                .type = OVSDB_TYPE_STRING,
29627
                .string = { .minLen = 0, .maxLen = UINT_MAX },
29628
            },
29629
            .n_min = 0,
29630
            .n_max = UINT_MAX,
29631
         },
29632
         .is_mutable = true,
29633
         .is_synthetic = false,
29634
         .parse = ovsrec_mirror_parse_external_ids,
29635
         .unparse = ovsrec_mirror_unparse_external_ids,
29636
    },
29637
29638
    [OVSREC_MIRROR_COL_NAME] = {
29639
         .name = "name",
29640
         .type = {
29641
            .key = {
29642
               .type = OVSDB_TYPE_STRING,
29643
               .string = { .minLen = 0, .maxLen = UINT_MAX },
29644
            },
29645
            .value = OVSDB_BASE_VOID_INIT,
29646
            .n_min = 1,
29647
            .n_max = 1,
29648
         },
29649
         .is_mutable = true,
29650
         .is_synthetic = false,
29651
         .parse = ovsrec_mirror_parse_name,
29652
         .unparse = ovsrec_mirror_unparse_name,
29653
    },
29654
29655
    [OVSREC_MIRROR_COL_OUTPUT_PORT] = {
29656
         .name = "output_port",
29657
         .type = {
29658
            .key = {
29659
               .type = OVSDB_TYPE_UUID,
29660
               .uuid = { .refTableName = "Port", .refType = OVSDB_REF_WEAK },
29661
            },
29662
            .value = OVSDB_BASE_VOID_INIT,
29663
            .n_min = 0,
29664
            .n_max = 1,
29665
         },
29666
         .is_mutable = true,
29667
         .is_synthetic = false,
29668
         .parse = ovsrec_mirror_parse_output_port,
29669
         .unparse = ovsrec_mirror_unparse_output_port,
29670
    },
29671
29672
    [OVSREC_MIRROR_COL_OUTPUT_VLAN] = {
29673
         .name = "output_vlan",
29674
         .type = {
29675
            .key = {
29676
               .type = OVSDB_TYPE_INTEGER,
29677
               .integer = { .min = INT64_C(1), .max = INT64_C(4095) },
29678
            },
29679
            .value = OVSDB_BASE_VOID_INIT,
29680
            .n_min = 0,
29681
            .n_max = 1,
29682
         },
29683
         .is_mutable = true,
29684
         .is_synthetic = false,
29685
         .parse = ovsrec_mirror_parse_output_vlan,
29686
         .unparse = ovsrec_mirror_unparse_output_vlan,
29687
    },
29688
29689
    [OVSREC_MIRROR_COL_SELECT_ALL] = {
29690
         .name = "select_all",
29691
         .type = {
29692
            .key = {
29693
               .type = OVSDB_TYPE_BOOLEAN,
29694
            },
29695
            .value = OVSDB_BASE_VOID_INIT,
29696
            .n_min = 1,
29697
            .n_max = 1,
29698
         },
29699
         .is_mutable = true,
29700
         .is_synthetic = false,
29701
         .parse = ovsrec_mirror_parse_select_all,
29702
         .unparse = ovsrec_mirror_unparse_select_all,
29703
    },
29704
29705
    [OVSREC_MIRROR_COL_SELECT_DST_PORT] = {
29706
         .name = "select_dst_port",
29707
         .type = {
29708
            .key = {
29709
               .type = OVSDB_TYPE_UUID,
29710
               .uuid = { .refTableName = "Port", .refType = OVSDB_REF_WEAK },
29711
            },
29712
            .value = OVSDB_BASE_VOID_INIT,
29713
            .n_min = 0,
29714
            .n_max = UINT_MAX,
29715
         },
29716
         .is_mutable = true,
29717
         .is_synthetic = false,
29718
         .parse = ovsrec_mirror_parse_select_dst_port,
29719
         .unparse = ovsrec_mirror_unparse_select_dst_port,
29720
    },
29721
29722
    [OVSREC_MIRROR_COL_SELECT_SRC_PORT] = {
29723
         .name = "select_src_port",
29724
         .type = {
29725
            .key = {
29726
               .type = OVSDB_TYPE_UUID,
29727
               .uuid = { .refTableName = "Port", .refType = OVSDB_REF_WEAK },
29728
            },
29729
            .value = OVSDB_BASE_VOID_INIT,
29730
            .n_min = 0,
29731
            .n_max = UINT_MAX,
29732
         },
29733
         .is_mutable = true,
29734
         .is_synthetic = false,
29735
         .parse = ovsrec_mirror_parse_select_src_port,
29736
         .unparse = ovsrec_mirror_unparse_select_src_port,
29737
    },
29738
29739
    [OVSREC_MIRROR_COL_SELECT_VLAN] = {
29740
         .name = "select_vlan",
29741
         .type = {
29742
            .key = {
29743
               .type = OVSDB_TYPE_INTEGER,
29744
               .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
29745
            },
29746
            .value = OVSDB_BASE_VOID_INIT,
29747
            .n_min = 0,
29748
            .n_max = 4096,
29749
         },
29750
         .is_mutable = true,
29751
         .is_synthetic = false,
29752
         .parse = ovsrec_mirror_parse_select_vlan,
29753
         .unparse = ovsrec_mirror_unparse_select_vlan,
29754
    },
29755
29756
    [OVSREC_MIRROR_COL_SNAPLEN] = {
29757
         .name = "snaplen",
29758
         .type = {
29759
            .key = {
29760
               .type = OVSDB_TYPE_INTEGER,
29761
               .integer = { .min = INT64_C(14), .max = INT64_C(65535) },
29762
            },
29763
            .value = OVSDB_BASE_VOID_INIT,
29764
            .n_min = 0,
29765
            .n_max = 1,
29766
         },
29767
         .is_mutable = true,
29768
         .is_synthetic = false,
29769
         .parse = ovsrec_mirror_parse_snaplen,
29770
         .unparse = ovsrec_mirror_unparse_snaplen,
29771
    },
29772
29773
    [OVSREC_MIRROR_COL_STATISTICS] = {
29774
         .name = "statistics",
29775
         .type = {
29776
            .key = {
29777
               .type = OVSDB_TYPE_STRING,
29778
               .string = { .minLen = 0, .maxLen = UINT_MAX },
29779
            },
29780
            .value = {
29781
                .type = OVSDB_TYPE_INTEGER,
29782
                .integer = { .min = INT64_MIN, .max = INT64_MAX },
29783
            },
29784
            .n_min = 0,
29785
            .n_max = UINT_MAX,
29786
         },
29787
         .is_mutable = true,
29788
         .is_synthetic = false,
29789
         .parse = ovsrec_mirror_parse_statistics,
29790
         .unparse = ovsrec_mirror_unparse_statistics,
29791
    },
29792
29793
};
29794

29795
/* NetFlow table. */
29796
29797
bool
29798
ovsrec_server_has_netflow_table_col_active_timeout(const struct ovsdb_idl *idl)
29799
0
{
29800
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_active_timeout);
29801
0
}
29802
29803
29804
bool
29805
ovsrec_server_has_netflow_table_col_add_id_to_interface(const struct ovsdb_idl *idl)
29806
0
{
29807
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_add_id_to_interface);
29808
0
}
29809
29810
29811
bool
29812
ovsrec_server_has_netflow_table_col_engine_id(const struct ovsdb_idl *idl)
29813
0
{
29814
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_engine_id);
29815
0
}
29816
29817
29818
bool
29819
ovsrec_server_has_netflow_table_col_engine_type(const struct ovsdb_idl *idl)
29820
0
{
29821
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_engine_type);
29822
0
}
29823
29824
29825
bool
29826
ovsrec_server_has_netflow_table_col_external_ids(const struct ovsdb_idl *idl)
29827
0
{
29828
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_external_ids);
29829
0
}
29830
29831
29832
bool
29833
ovsrec_server_has_netflow_table_col_targets(const struct ovsdb_idl *idl)
29834
0
{
29835
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_netflow_col_targets);
29836
0
}
29837
29838
29839
bool
29840
ovsrec_server_has_netflow_table(const struct ovsdb_idl *idl)
29841
0
{
29842
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]);
29843
0
}
29844
29845
29846
const struct ovsrec_netflow_table *
29847
ovsrec_netflow_table_get(const struct ovsdb_idl *idl)
29848
0
{
29849
0
    return (const struct ovsrec_netflow_table *) idl;
29850
0
}
29851
29852
const struct ovsrec_netflow *
29853
ovsrec_netflow_table_first(const struct ovsrec_netflow_table *table)
29854
0
{
29855
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
29856
0
    return ovsrec_netflow_first(idl);
29857
0
}
29858
29859
29860
const struct ovsrec_netflow *
29861
ovsrec_netflow_table_track_get_first(const struct ovsrec_netflow_table *table)
29862
0
{
29863
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
29864
0
    return ovsrec_netflow_track_get_first(idl);
29865
0
}
29866
29867
29868
static void
29869
ovsrec_netflow_parse_active_timeout(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29870
0
{
29871
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
29872
29873
0
    if (datum->n >= 1) {
29874
0
        row->active_timeout = datum->keys[0].integer;
29875
0
    } else {
29876
0
        row->active_timeout = 0;
29877
0
    }
29878
0
}
29879
29880
static void
29881
ovsrec_netflow_parse_add_id_to_interface(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29882
0
{
29883
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
29884
29885
0
    if (datum->n >= 1) {
29886
0
        row->add_id_to_interface = datum->keys[0].boolean;
29887
0
    } else {
29888
0
        row->add_id_to_interface = false;
29889
0
    }
29890
0
}
29891
29892
static void
29893
ovsrec_netflow_parse_engine_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29894
0
{
29895
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
29896
0
    size_t n = MIN(1, datum->n);
29897
0
    row->engine_id = NULL;
29898
0
    row->n_engine_id = 0;
29899
0
    for (size_t i = 0; i < n; i++) {
29900
0
        if (!row->n_engine_id) {
29901
0
            row->engine_id = xmalloc(n * sizeof *row->engine_id);
29902
0
        }
29903
0
        row->engine_id[row->n_engine_id] = datum->keys[i].integer;
29904
0
        row->n_engine_id++;
29905
0
    }
29906
0
}
29907
29908
static void
29909
ovsrec_netflow_parse_engine_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29910
0
{
29911
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
29912
0
    size_t n = MIN(1, datum->n);
29913
0
    row->engine_type = NULL;
29914
0
    row->n_engine_type = 0;
29915
0
    for (size_t i = 0; i < n; i++) {
29916
0
        if (!row->n_engine_type) {
29917
0
            row->engine_type = xmalloc(n * sizeof *row->engine_type);
29918
0
        }
29919
0
        row->engine_type[row->n_engine_type] = datum->keys[i].integer;
29920
0
        row->n_engine_type++;
29921
0
    }
29922
0
}
29923
29924
static void
29925
ovsrec_netflow_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29926
0
{
29927
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
29928
0
    smap_init(&row->external_ids);
29929
0
    for (size_t i = 0; i < datum->n; i++) {
29930
0
        smap_add(&row->external_ids,
29931
0
                 json_string(datum->keys[i].s),
29932
0
                 json_string(datum->values[i].s));
29933
0
    }
29934
0
}
29935
29936
static void
29937
ovsrec_netflow_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
29938
0
{
29939
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
29940
0
    row->targets = NULL;
29941
0
    row->n_targets = 0;
29942
0
    for (size_t i = 0; i < datum->n; i++) {
29943
0
        if (!row->n_targets) {
29944
0
            row->targets = xmalloc(datum->n * sizeof *row->targets);
29945
0
        }
29946
0
        row->targets[row->n_targets] = datum->keys[i].s->string;
29947
0
        row->n_targets++;
29948
0
    }
29949
0
}
29950
29951
static void
29952
ovsrec_netflow_unparse_active_timeout(struct ovsdb_idl_row *row OVS_UNUSED)
29953
0
{
29954
    /* Nothing to do. */
29955
0
}
29956
29957
static void
29958
ovsrec_netflow_unparse_add_id_to_interface(struct ovsdb_idl_row *row OVS_UNUSED)
29959
0
{
29960
    /* Nothing to do. */
29961
0
}
29962
29963
static void
29964
ovsrec_netflow_unparse_engine_id(struct ovsdb_idl_row *row_)
29965
0
{
29966
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
29967
0
    free(row->engine_id);
29968
0
}
29969
29970
static void
29971
ovsrec_netflow_unparse_engine_type(struct ovsdb_idl_row *row_)
29972
0
{
29973
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
29974
0
    free(row->engine_type);
29975
0
}
29976
29977
static void
29978
ovsrec_netflow_unparse_external_ids(struct ovsdb_idl_row *row_)
29979
0
{
29980
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
29981
0
    smap_destroy(&row->external_ids);
29982
0
}
29983
29984
static void
29985
ovsrec_netflow_unparse_targets(struct ovsdb_idl_row *row_)
29986
0
{
29987
0
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
29988
0
    free(row->targets);
29989
0
}
29990
29991
static void
29992
ovsrec_netflow_init__(struct ovsdb_idl_row *row)
29993
0
{
29994
0
    ovsrec_netflow_init(ovsrec_netflow_cast(row));
29995
0
}
29996
29997
/* Clears the contents of 'row' in table "NetFlow". */
29998
void
29999
ovsrec_netflow_init(struct ovsrec_netflow *row)
30000
0
{
30001
0
    memset(row, 0, sizeof *row); 
30002
0
    smap_init(&row->external_ids);
30003
0
}
30004
30005
/* Searches table "NetFlow" in 'idl' for a row with UUID 'uuid'.  Returns
30006
 * a pointer to the row if there is one, otherwise a null pointer.  */
30007
const struct ovsrec_netflow *
30008
ovsrec_netflow_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
30009
0
{
30010
0
    return ovsrec_netflow_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_netflow, uuid));
30011
0
}
30012
30013
/* Searches table "NetFlow" for a row with UUID 'uuid'.  Returns
30014
 * a pointer to the row if there is one, otherwise a null pointer.  */
30015
const struct ovsrec_netflow *
30016
ovsrec_netflow_table_get_for_uuid(const struct ovsrec_netflow_table *table, const struct uuid *uuid)
30017
0
{
30018
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
30019
0
    return ovsrec_netflow_get_for_uuid(idl, uuid);
30020
0
}
30021
30022
/* Returns a row in table "NetFlow" in 'idl', or a null pointer if that
30023
 * table is empty.
30024
 *
30025
 * Database tables are internally maintained as hash tables, so adding or
30026
 * removing rows while traversing the same table can cause some rows to be
30027
 * visited twice or not at apply. */
30028
const struct ovsrec_netflow *
30029
ovsrec_netflow_first(const struct ovsdb_idl *idl)
30030
0
{
30031
0
    return ovsrec_netflow_cast(ovsdb_idl_first_row(idl, &ovsrec_table_netflow));
30032
0
}
30033
30034
/* Returns a row following 'row' within its table, or a null pointer if 'row'
30035
 * is the last row in its table. */
30036
const struct ovsrec_netflow *
30037
ovsrec_netflow_next(const struct ovsrec_netflow *row)
30038
0
{
30039
0
    return ovsrec_netflow_cast(ovsdb_idl_next_row(&row->header_));
30040
0
}
30041
30042
unsigned int ovsrec_netflow_get_seqno(const struct ovsdb_idl *idl)
30043
0
{
30044
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_netflow);
30045
0
}
30046
30047
unsigned int ovsrec_netflow_row_get_seqno(const struct ovsrec_netflow *row, enum ovsdb_idl_change change)
30048
0
{
30049
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
30050
0
}
30051
30052
const struct ovsrec_netflow *
30053
ovsrec_netflow_track_get_first(const struct ovsdb_idl *idl)
30054
0
{
30055
0
    return ovsrec_netflow_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_netflow));
30056
0
}
30057
30058
const struct ovsrec_netflow
30059
*ovsrec_netflow_track_get_next(const struct ovsrec_netflow *row)
30060
0
{
30061
0
    return ovsrec_netflow_cast(ovsdb_idl_track_get_next(&row->header_));
30062
0
}
30063
30064
30065
/* Deletes 'row' from table "NetFlow".  'row' may be freed, so it must not be
30066
 * accessed afterward.
30067
 *
30068
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
30069
void
30070
ovsrec_netflow_delete(const struct ovsrec_netflow *row)
30071
0
{
30072
0
    ovsdb_idl_txn_delete(&row->header_);
30073
0
}
30074
30075
/* Inserts and returns a new row in the table "NetFlow" in the database
30076
 * with open transaction 'txn'.
30077
 *
30078
 * The new row is assigned a randomly generated provisional UUID.
30079
 * ovsdb-server will assign a different UUID when 'txn' is committed,
30080
 * but the IDL will replace any uses of the provisional UUID in the
30081
 * data to be to be committed by the UUID assigned by ovsdb-server. */
30082
struct ovsrec_netflow *
30083
ovsrec_netflow_insert(struct ovsdb_idl_txn *txn)
30084
0
{
30085
0
    return ovsrec_netflow_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_netflow, NULL));
30086
0
}
30087
30088
/* Inserts and returns a new row in the table "NetFlow" in the database
30089
 * with open transaction 'txn'.
30090
 *
30091
 * The new row is assigned the UUID specified in the 'uuid' parameter
30092
 * (which cannot be null).  ovsdb-server will try to assign the same
30093
 * UUID when 'txn' is committed. */
30094
struct ovsrec_netflow *
30095
ovsrec_netflow_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
30096
0
{
30097
0
    return ovsrec_netflow_cast(ovsdb_idl_txn_insert_persist_uuid(
30098
0
        txn, &ovsrec_table_netflow, uuid));
30099
0
}
30100
30101
bool
30102
ovsrec_netflow_is_updated(const struct ovsrec_netflow *row, enum ovsrec_netflow_column_id column)
30103
0
{
30104
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_netflow_columns[column]);
30105
0
}
30106
30107
/* Causes the original contents of column "active_timeout" in 'row' to be
30108
 * verified as a prerequisite to completing the transaction.  That is, if
30109
 * "active_timeout" in 'row' changed (or if 'row' was deleted) between the
30110
 * time that the IDL originally read its contents and the time that the
30111
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
30112
 *
30113
 * The intention is that, to ensure that no transaction commits based on dirty
30114
 * reads, an application should call this function any time "active_timeout" is
30115
 * read as part of a read-modify-write operation.
30116
 *
30117
 * In some cases this function reduces to a no-op, because the current value
30118
 * of "active_timeout" is already known:
30119
 *
30120
 *   - If 'row' is a row created by the current transaction (returned by
30121
 *     ovsrec_netflow_insert()).
30122
 *
30123
 *   - If "active_timeout" has already been modified (with
30124
 *     ovsrec_netflow_set_active_timeout()) within the current transaction.
30125
 *
30126
 * Because of the latter property, always call this function *before*
30127
 * ovsrec_netflow_set_active_timeout() for a given read-modify-write.
30128
 *
30129
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
30130
void
30131
ovsrec_netflow_verify_active_timeout(const struct ovsrec_netflow *row)
30132
0
{
30133
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_active_timeout);
30134
0
}
30135
30136
/* Causes the original contents of column "add_id_to_interface" in 'row' to be
30137
 * verified as a prerequisite to completing the transaction.  That is, if
30138
 * "add_id_to_interface" in 'row' changed (or if 'row' was deleted) between the
30139
 * time that the IDL originally read its contents and the time that the
30140
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
30141
 *
30142
 * The intention is that, to ensure that no transaction commits based on dirty
30143
 * reads, an application should call this function any time "add_id_to_interface" is
30144
 * read as part of a read-modify-write operation.
30145
 *
30146
 * In some cases this function reduces to a no-op, because the current value
30147
 * of "add_id_to_interface" is already known:
30148
 *
30149
 *   - If 'row' is a row created by the current transaction (returned by
30150
 *     ovsrec_netflow_insert()).
30151
 *
30152
 *   - If "add_id_to_interface" has already been modified (with
30153
 *     ovsrec_netflow_set_add_id_to_interface()) within the current transaction.
30154
 *
30155
 * Because of the latter property, always call this function *before*
30156
 * ovsrec_netflow_set_add_id_to_interface() for a given read-modify-write.
30157
 *
30158
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
30159
void
30160
ovsrec_netflow_verify_add_id_to_interface(const struct ovsrec_netflow *row)
30161
0
{
30162
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_add_id_to_interface);
30163
0
}
30164
30165
/* Causes the original contents of column "engine_id" in 'row' to be
30166
 * verified as a prerequisite to completing the transaction.  That is, if
30167
 * "engine_id" in 'row' changed (or if 'row' was deleted) between the
30168
 * time that the IDL originally read its contents and the time that the
30169
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
30170
 *
30171
 * The intention is that, to ensure that no transaction commits based on dirty
30172
 * reads, an application should call this function any time "engine_id" is
30173
 * read as part of a read-modify-write operation.
30174
 *
30175
 * In some cases this function reduces to a no-op, because the current value
30176
 * of "engine_id" is already known:
30177
 *
30178
 *   - If 'row' is a row created by the current transaction (returned by
30179
 *     ovsrec_netflow_insert()).
30180
 *
30181
 *   - If "engine_id" has already been modified (with
30182
 *     ovsrec_netflow_set_engine_id()) within the current transaction.
30183
 *
30184
 * Because of the latter property, always call this function *before*
30185
 * ovsrec_netflow_set_engine_id() for a given read-modify-write.
30186
 *
30187
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
30188
void
30189
ovsrec_netflow_verify_engine_id(const struct ovsrec_netflow *row)
30190
0
{
30191
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_engine_id);
30192
0
}
30193
30194
/* Causes the original contents of column "engine_type" in 'row' to be
30195
 * verified as a prerequisite to completing the transaction.  That is, if
30196
 * "engine_type" in 'row' changed (or if 'row' was deleted) between the
30197
 * time that the IDL originally read its contents and the time that the
30198
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
30199
 *
30200
 * The intention is that, to ensure that no transaction commits based on dirty
30201
 * reads, an application should call this function any time "engine_type" is
30202
 * read as part of a read-modify-write operation.
30203
 *
30204
 * In some cases this function reduces to a no-op, because the current value
30205
 * of "engine_type" is already known:
30206
 *
30207
 *   - If 'row' is a row created by the current transaction (returned by
30208
 *     ovsrec_netflow_insert()).
30209
 *
30210
 *   - If "engine_type" has already been modified (with
30211
 *     ovsrec_netflow_set_engine_type()) within the current transaction.
30212
 *
30213
 * Because of the latter property, always call this function *before*
30214
 * ovsrec_netflow_set_engine_type() for a given read-modify-write.
30215
 *
30216
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
30217
void
30218
ovsrec_netflow_verify_engine_type(const struct ovsrec_netflow *row)
30219
0
{
30220
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_engine_type);
30221
0
}
30222
30223
/* Causes the original contents of column "external_ids" in 'row' to be
30224
 * verified as a prerequisite to completing the transaction.  That is, if
30225
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
30226
 * time that the IDL originally read its contents and the time that the
30227
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
30228
 *
30229
 * The intention is that, to ensure that no transaction commits based on dirty
30230
 * reads, an application should call this function any time "external_ids" is
30231
 * read as part of a read-modify-write operation.
30232
 *
30233
 * In some cases this function reduces to a no-op, because the current value
30234
 * of "external_ids" is already known:
30235
 *
30236
 *   - If 'row' is a row created by the current transaction (returned by
30237
 *     ovsrec_netflow_insert()).
30238
 *
30239
 *   - If "external_ids" has already been modified (with
30240
 *     ovsrec_netflow_set_external_ids()) within the current transaction.
30241
 *
30242
 * Because of the latter property, always call this function *before*
30243
 * ovsrec_netflow_set_external_ids() for a given read-modify-write.
30244
 *
30245
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
30246
void
30247
ovsrec_netflow_verify_external_ids(const struct ovsrec_netflow *row)
30248
0
{
30249
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_external_ids);
30250
0
}
30251
30252
/* Causes the original contents of column "targets" in 'row' to be
30253
 * verified as a prerequisite to completing the transaction.  That is, if
30254
 * "targets" in 'row' changed (or if 'row' was deleted) between the
30255
 * time that the IDL originally read its contents and the time that the
30256
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
30257
 *
30258
 * The intention is that, to ensure that no transaction commits based on dirty
30259
 * reads, an application should call this function any time "targets" is
30260
 * read as part of a read-modify-write operation.
30261
 *
30262
 * In some cases this function reduces to a no-op, because the current value
30263
 * of "targets" is already known:
30264
 *
30265
 *   - If 'row' is a row created by the current transaction (returned by
30266
 *     ovsrec_netflow_insert()).
30267
 *
30268
 *   - If "targets" has already been modified (with
30269
 *     ovsrec_netflow_set_targets()) within the current transaction.
30270
 *
30271
 * Because of the latter property, always call this function *before*
30272
 * ovsrec_netflow_set_targets() for a given read-modify-write.
30273
 *
30274
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
30275
void
30276
ovsrec_netflow_verify_targets(const struct ovsrec_netflow *row)
30277
0
{
30278
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_col_targets);
30279
0
}
30280
30281
/* Returns the "active_timeout" column's value from the "NetFlow" table in 'row'
30282
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
30283
 * ovsdb_datum_find_key() is an easier and more efficient way to search
30284
 * for a given key than implementing the same operation on the "cooked"
30285
 * form in 'row'.
30286
 *
30287
 * 'key_type' must be OVSDB_TYPE_INTEGER.
30288
 * (This helps to avoid silent bugs if someone changes active_timeout's
30289
 * type without updating the caller.)
30290
 *
30291
 * The caller must not modify or free the returned value.
30292
 *
30293
 * Various kinds of changes can invalidate the returned value: modifying
30294
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
30295
 * If the returned value is needed for a long time, it is best to make a copy
30296
 * of it with ovsdb_datum_clone().
30297
 *
30298
 * This function is rarely useful, since it is easier to access the value
30299
 * directly through the "active_timeout" member in ovsrec_netflow. */
30300
const struct ovsdb_datum *
30301
ovsrec_netflow_get_active_timeout(const struct ovsrec_netflow *row,
30302
  enum ovsdb_atomic_type key_type OVS_UNUSED)
30303
0
{
30304
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
30305
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_active_timeout);
30306
0
}
30307
30308
/* Returns the "add_id_to_interface" column's value from the "NetFlow" table in 'row'
30309
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
30310
 * ovsdb_datum_find_key() is an easier and more efficient way to search
30311
 * for a given key than implementing the same operation on the "cooked"
30312
 * form in 'row'.
30313
 *
30314
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
30315
 * (This helps to avoid silent bugs if someone changes add_id_to_interface's
30316
 * type without updating the caller.)
30317
 *
30318
 * The caller must not modify or free the returned value.
30319
 *
30320
 * Various kinds of changes can invalidate the returned value: modifying
30321
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
30322
 * If the returned value is needed for a long time, it is best to make a copy
30323
 * of it with ovsdb_datum_clone().
30324
 *
30325
 * This function is rarely useful, since it is easier to access the value
30326
 * directly through the "add_id_to_interface" member in ovsrec_netflow. */
30327
const struct ovsdb_datum *
30328
ovsrec_netflow_get_add_id_to_interface(const struct ovsrec_netflow *row,
30329
  enum ovsdb_atomic_type key_type OVS_UNUSED)
30330
0
{
30331
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
30332
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_add_id_to_interface);
30333
0
}
30334
30335
/* Returns the "engine_id" column's value from the "NetFlow" table in 'row'
30336
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
30337
 * ovsdb_datum_find_key() is an easier and more efficient way to search
30338
 * for a given key than implementing the same operation on the "cooked"
30339
 * form in 'row'.
30340
 *
30341
 * 'key_type' must be OVSDB_TYPE_INTEGER.
30342
 * (This helps to avoid silent bugs if someone changes engine_id's
30343
 * type without updating the caller.)
30344
 *
30345
 * The caller must not modify or free the returned value.
30346
 *
30347
 * Various kinds of changes can invalidate the returned value: modifying
30348
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
30349
 * If the returned value is needed for a long time, it is best to make a copy
30350
 * of it with ovsdb_datum_clone().
30351
 *
30352
 * This function is rarely useful, since it is easier to access the value
30353
 * directly through the "engine_id" member in ovsrec_netflow. */
30354
const struct ovsdb_datum *
30355
ovsrec_netflow_get_engine_id(const struct ovsrec_netflow *row,
30356
  enum ovsdb_atomic_type key_type OVS_UNUSED)
30357
0
{
30358
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
30359
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_engine_id);
30360
0
}
30361
30362
/* Returns the "engine_type" column's value from the "NetFlow" table in 'row'
30363
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
30364
 * ovsdb_datum_find_key() is an easier and more efficient way to search
30365
 * for a given key than implementing the same operation on the "cooked"
30366
 * form in 'row'.
30367
 *
30368
 * 'key_type' must be OVSDB_TYPE_INTEGER.
30369
 * (This helps to avoid silent bugs if someone changes engine_type's
30370
 * type without updating the caller.)
30371
 *
30372
 * The caller must not modify or free the returned value.
30373
 *
30374
 * Various kinds of changes can invalidate the returned value: modifying
30375
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
30376
 * If the returned value is needed for a long time, it is best to make a copy
30377
 * of it with ovsdb_datum_clone().
30378
 *
30379
 * This function is rarely useful, since it is easier to access the value
30380
 * directly through the "engine_type" member in ovsrec_netflow. */
30381
const struct ovsdb_datum *
30382
ovsrec_netflow_get_engine_type(const struct ovsrec_netflow *row,
30383
  enum ovsdb_atomic_type key_type OVS_UNUSED)
30384
0
{
30385
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
30386
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_engine_type);
30387
0
}
30388
30389
/* Returns the "external_ids" column's value from the "NetFlow" table in 'row'
30390
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
30391
 * ovsdb_datum_find_key() is an easier and more efficient way to search
30392
 * for a given key than implementing the same operation on the "cooked"
30393
 * form in 'row'.
30394
 *
30395
 * 'key_type' must be OVSDB_TYPE_STRING.
30396
 * 'value_type' must be OVSDB_TYPE_STRING.
30397
 * (This helps to avoid silent bugs if someone changes external_ids's
30398
 * type without updating the caller.)
30399
 *
30400
 * The caller must not modify or free the returned value.
30401
 *
30402
 * Various kinds of changes can invalidate the returned value: modifying
30403
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
30404
 * If the returned value is needed for a long time, it is best to make a copy
30405
 * of it with ovsdb_datum_clone().
30406
 *
30407
 * This function is rarely useful, since it is easier to access the value
30408
 * directly through the "external_ids" member in ovsrec_netflow. */
30409
const struct ovsdb_datum *
30410
ovsrec_netflow_get_external_ids(const struct ovsrec_netflow *row,
30411
  enum ovsdb_atomic_type key_type OVS_UNUSED,
30412
  enum ovsdb_atomic_type value_type OVS_UNUSED)
30413
0
{
30414
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
30415
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
30416
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_external_ids);
30417
0
}
30418
30419
/* Returns the "targets" column's value from the "NetFlow" table in 'row'
30420
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
30421
 * ovsdb_datum_find_key() is an easier and more efficient way to search
30422
 * for a given key than implementing the same operation on the "cooked"
30423
 * form in 'row'.
30424
 *
30425
 * 'key_type' must be OVSDB_TYPE_STRING.
30426
 * (This helps to avoid silent bugs if someone changes targets's
30427
 * type without updating the caller.)
30428
 *
30429
 * The caller must not modify or free the returned value.
30430
 *
30431
 * Various kinds of changes can invalidate the returned value: modifying
30432
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
30433
 * If the returned value is needed for a long time, it is best to make a copy
30434
 * of it with ovsdb_datum_clone().
30435
 *
30436
 * This function is rarely useful, since it is easier to access the value
30437
 * directly through the "targets" member in ovsrec_netflow. */
30438
const struct ovsdb_datum *
30439
ovsrec_netflow_get_targets(const struct ovsrec_netflow *row,
30440
  enum ovsdb_atomic_type key_type OVS_UNUSED)
30441
0
{
30442
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
30443
0
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_targets);
30444
0
}
30445
30446
/* Sets the "active_timeout" column from the "NetFlow" table in 'row' to
30447
 * 'active_timeout'.
30448
 *
30449
 * Argument constraints: at least -1
30450
 *
30451
 * The caller retains ownership of the arguments. */
30452
void
30453
ovsrec_netflow_set_active_timeout(const struct ovsrec_netflow *row, int64_t active_timeout)
30454
0
{
30455
0
    struct ovsdb_datum datum;
30456
30457
0
    datum.refcnt = NULL;
30458
30459
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
30460
30461
0
    datum.n = 1;
30462
0
    datum.keys = key;
30463
0
    key->integer = active_timeout;
30464
0
    datum.values = NULL;
30465
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_col_active_timeout, &datum);
30466
0
}
30467
30468
/* Sets the "add_id_to_interface" column from the "NetFlow" table in 'row' to
30469
 * 'add_id_to_interface'.
30470
 *
30471
 * The caller retains ownership of the arguments. */
30472
void
30473
ovsrec_netflow_set_add_id_to_interface(const struct ovsrec_netflow *row, bool add_id_to_interface)
30474
0
{
30475
0
    struct ovsdb_datum datum;
30476
30477
0
    datum.refcnt = NULL;
30478
30479
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
30480
30481
0
    datum.n = 1;
30482
0
    datum.keys = key;
30483
0
    key->boolean = add_id_to_interface;
30484
0
    datum.values = NULL;
30485
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_col_add_id_to_interface, &datum);
30486
0
}
30487
30488
/* Sets the "engine_id" column from the "NetFlow" table in 'row' to
30489
 * the 'engine_id' set with 'n_engine_id' entries.
30490
 *
30491
 * 'n_engine_id' may be 0 or 1; if it is 0, then 'engine_id'
30492
 * may be NULL.
30493
 *
30494
 * Argument constraints: in range 0 to 255
30495
 *
30496
 * The caller retains ownership of the arguments. */
30497
void
30498
ovsrec_netflow_set_engine_id(const struct ovsrec_netflow *row, const int64_t *engine_id, size_t n_engine_id)
30499
0
{
30500
0
    struct ovsdb_datum datum;
30501
30502
0
    datum.refcnt = NULL;
30503
30504
0
    if (n_engine_id) {
30505
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30506
0
        datum.n = 1;
30507
0
        datum.keys = key;
30508
0
        key->integer = *engine_id;
30509
0
    } else {
30510
0
        datum.n = 0;
30511
0
        datum.keys = NULL;
30512
0
    }
30513
0
    datum.values = NULL;
30514
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_col_engine_id, &datum);
30515
0
}
30516
30517
/* Sets the "engine_type" column from the "NetFlow" table in 'row' to
30518
 * the 'engine_type' set with 'n_engine_type' entries.
30519
 *
30520
 * 'n_engine_type' may be 0 or 1; if it is 0, then 'engine_type'
30521
 * may be NULL.
30522
 *
30523
 * Argument constraints: in range 0 to 255
30524
 *
30525
 * The caller retains ownership of the arguments. */
30526
void
30527
ovsrec_netflow_set_engine_type(const struct ovsrec_netflow *row, const int64_t *engine_type, size_t n_engine_type)
30528
0
{
30529
0
    struct ovsdb_datum datum;
30530
30531
0
    datum.refcnt = NULL;
30532
30533
0
    if (n_engine_type) {
30534
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30535
0
        datum.n = 1;
30536
0
        datum.keys = key;
30537
0
        key->integer = *engine_type;
30538
0
    } else {
30539
0
        datum.n = 0;
30540
0
        datum.keys = NULL;
30541
0
    }
30542
0
    datum.values = NULL;
30543
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_col_engine_type, &datum);
30544
0
}
30545
30546
/* Sets the "external_ids" column's value from the "NetFlow" table in 'row'
30547
 * to 'external_ids'.
30548
 *
30549
 * The caller retains ownership of 'external_ids' and everything in it. */
30550
void
30551
ovsrec_netflow_set_external_ids(const struct ovsrec_netflow *row, const struct smap *external_ids)
30552
0
{
30553
0
    struct ovsdb_datum datum;
30554
30555
0
    if (external_ids) {
30556
0
        ovsdb_datum_from_smap(&datum, external_ids);
30557
0
    } else {
30558
0
        ovsdb_datum_init_empty(&datum);
30559
0
    }
30560
0
    ovsdb_idl_txn_write(&row->header_,
30561
0
                        &ovsrec_netflow_col_external_ids,
30562
0
                        &datum);
30563
0
}
30564
30565
30566
/* Sets the "targets" column from the "NetFlow" table in 'row' to
30567
 * the 'targets' set with 'n_targets' entries.
30568
 *
30569
 * The caller retains ownership of the arguments. */
30570
void
30571
ovsrec_netflow_set_targets(const struct ovsrec_netflow *row, const char **targets, size_t n_targets)
30572
0
{
30573
0
    struct ovsdb_datum datum;
30574
30575
0
    datum.refcnt = NULL;
30576
30577
0
    datum.n = n_targets;
30578
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
30579
0
    datum.values = NULL;
30580
0
    for (size_t i = 0; i < n_targets; i++) {
30581
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
30582
0
    }
30583
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_col_targets, &datum);
30584
0
}
30585
30586
/* Adds the value 'new_value' to the "engine_id" set column from the "NetFlow" table
30587
 * in 'row'.
30588
 *
30589
 */
30590
void
30591
ovsrec_netflow_update_engine_id_addvalue(const struct ovsrec_netflow *row, int64_t new_value)
30592
0
{
30593
0
    struct ovsdb_datum *datum;
30594
30595
0
    datum = xmalloc(sizeof *datum);
30596
0
    datum->n = 1;
30597
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30598
0
    datum->values = NULL;
30599
0
    datum->refcnt = NULL;
30600
30601
0
    datum->keys[0].integer = new_value;
30602
30603
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
30604
0
                                    &ovsrec_netflow_col_engine_id,
30605
0
                                    datum);
30606
0
}
30607
30608
/* Deletes the value 'delete_value' from the "engine_id" set column from the
30609
 * "NetFlow" table in 'row'.
30610
 *
30611
 */
30612
void
30613
ovsrec_netflow_update_engine_id_delvalue(const struct ovsrec_netflow *row, int64_t delete_value)
30614
0
{
30615
0
    struct ovsdb_datum *datum;
30616
30617
0
    datum = xmalloc(sizeof *datum);
30618
0
    datum->n = 1;
30619
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30620
0
    datum->values = NULL;
30621
0
    datum->refcnt = NULL;
30622
30623
0
    datum->keys[0].integer = delete_value;
30624
30625
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
30626
0
                                    &ovsrec_netflow_col_engine_id,
30627
0
                                    datum);
30628
0
}
30629
30630
/* Adds the value 'new_value' to the "engine_type" set column from the "NetFlow" table
30631
 * in 'row'.
30632
 *
30633
 */
30634
void
30635
ovsrec_netflow_update_engine_type_addvalue(const struct ovsrec_netflow *row, int64_t new_value)
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->values);
30642
0
    datum->values = NULL;
30643
0
    datum->refcnt = NULL;
30644
30645
0
    datum->keys[0].integer = new_value;
30646
30647
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
30648
0
                                    &ovsrec_netflow_col_engine_type,
30649
0
                                    datum);
30650
0
}
30651
30652
/* Deletes the value 'delete_value' from the "engine_type" set column from the
30653
 * "NetFlow" table in 'row'.
30654
 *
30655
 */
30656
void
30657
ovsrec_netflow_update_engine_type_delvalue(const struct ovsrec_netflow *row, int64_t delete_value)
30658
0
{
30659
0
    struct ovsdb_datum *datum;
30660
30661
0
    datum = xmalloc(sizeof *datum);
30662
0
    datum->n = 1;
30663
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30664
0
    datum->values = NULL;
30665
0
    datum->refcnt = NULL;
30666
30667
0
    datum->keys[0].integer = delete_value;
30668
30669
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
30670
0
                                    &ovsrec_netflow_col_engine_type,
30671
0
                                    datum);
30672
0
}
30673
30674
/* Sets an element of the "external_ids" map column from the "NetFlow" table in 'row'
30675
 * to 'new_value' given the key value 'new_key'.
30676
 *
30677
 */
30678
void
30679
ovsrec_netflow_update_external_ids_setkey(const struct ovsrec_netflow *row, const char *new_key, const char *new_value)
30680
0
{
30681
0
    struct ovsdb_datum *datum;
30682
30683
0
    datum = xmalloc(sizeof *datum);
30684
0
    datum->n = 1;
30685
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
30686
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
30687
0
    datum->refcnt = NULL;
30688
30689
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
30690
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
30691
30692
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
30693
0
                                    &ovsrec_netflow_col_external_ids,
30694
0
                                    datum);
30695
0
}
30696
30697
/* Deletes an element of the "external_ids" map column from the "NetFlow" table in 'row'
30698
 * given the key value 'delete_key'.
30699
 *
30700
 */
30701
void
30702
ovsrec_netflow_update_external_ids_delkey(const struct ovsrec_netflow *row, const char *delete_key)
30703
0
{
30704
0
    struct ovsdb_datum *datum;
30705
30706
0
    datum = xmalloc(sizeof *datum);
30707
0
    datum->n = 1;
30708
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
30709
0
    datum->values = NULL;
30710
0
    datum->refcnt = NULL;
30711
30712
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
30713
30714
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
30715
0
                                    &ovsrec_netflow_col_external_ids,
30716
0
                                    datum);
30717
0
}
30718
30719
/* Adds the value 'new_value' to the "targets" set column from the "NetFlow" table
30720
 * in 'row'.
30721
 *
30722
 */
30723
void
30724
ovsrec_netflow_update_targets_addvalue(const struct ovsrec_netflow *row, const char *new_value)
30725
0
{
30726
0
    struct ovsdb_datum *datum;
30727
30728
0
    datum = xmalloc(sizeof *datum);
30729
0
    datum->n = 1;
30730
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30731
0
    datum->values = NULL;
30732
0
    datum->refcnt = NULL;
30733
30734
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
30735
30736
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
30737
0
                                    &ovsrec_netflow_col_targets,
30738
0
                                    datum);
30739
0
}
30740
30741
/* Deletes the value 'delete_value' from the "targets" set column from the
30742
 * "NetFlow" table in 'row'.
30743
 *
30744
 */
30745
void
30746
ovsrec_netflow_update_targets_delvalue(const struct ovsrec_netflow *row, const char *delete_value)
30747
0
{
30748
0
    struct ovsdb_datum *datum;
30749
30750
0
    datum = xmalloc(sizeof *datum);
30751
0
    datum->n = 1;
30752
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
30753
0
    datum->values = NULL;
30754
0
    datum->refcnt = NULL;
30755
30756
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
30757
30758
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
30759
0
                                    &ovsrec_netflow_col_targets,
30760
0
                                    datum);
30761
0
}
30762
30763
/* Sets the "active_timeout" column from the "NetFlow" table in 'row' to
30764
 * 'active_timeout'.
30765
 *
30766
 * Argument constraints: at least -1
30767
 *
30768
 * The caller retains ownership of the arguments. */
30769
void
30770
ovsrec_netflow_add_clause_active_timeout(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t active_timeout)
30771
0
{
30772
0
    struct ovsdb_datum datum;
30773
30774
0
    datum.refcnt = NULL;
30775
30776
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
30777
30778
0
    datum.n = 1;
30779
0
    datum.keys = key;
30780
0
    key->integer = active_timeout;
30781
0
    datum.values = NULL;
30782
0
    ovsdb_idl_condition_add_clause(cond,
30783
0
                          function,
30784
0
                          &ovsrec_netflow_col_active_timeout,
30785
0
                          &datum);
30786
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_active_timeout.type);
30787
0
}
30788
30789
/* Sets the "add_id_to_interface" column from the "NetFlow" table in 'row' to
30790
 * 'add_id_to_interface'.
30791
 *
30792
 * The caller retains ownership of the arguments. */
30793
void
30794
ovsrec_netflow_add_clause_add_id_to_interface(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool add_id_to_interface)
30795
0
{
30796
0
    struct ovsdb_datum datum;
30797
30798
0
    datum.refcnt = NULL;
30799
30800
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
30801
30802
0
    datum.n = 1;
30803
0
    datum.keys = key;
30804
0
    key->boolean = add_id_to_interface;
30805
0
    datum.values = NULL;
30806
0
    ovsdb_idl_condition_add_clause(cond,
30807
0
                          function,
30808
0
                          &ovsrec_netflow_col_add_id_to_interface,
30809
0
                          &datum);
30810
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_add_id_to_interface.type);
30811
0
}
30812
30813
/* Sets the "engine_id" column from the "NetFlow" table in 'row' to
30814
 * the 'engine_id' set with 'n_engine_id' entries.
30815
 *
30816
 * 'n_engine_id' may be 0 or 1; if it is 0, then 'engine_id'
30817
 * may be NULL.
30818
 *
30819
 * Argument constraints: in range 0 to 255
30820
 *
30821
 * The caller retains ownership of the arguments. */
30822
void
30823
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)
30824
0
{
30825
0
    struct ovsdb_datum datum;
30826
30827
0
    datum.refcnt = NULL;
30828
30829
0
    if (n_engine_id) {
30830
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30831
0
        datum.n = 1;
30832
0
        datum.keys = key;
30833
0
        key->integer = *engine_id;
30834
0
    } else {
30835
0
        datum.n = 0;
30836
0
        datum.keys = NULL;
30837
0
    }
30838
0
    datum.values = NULL;
30839
0
    ovsdb_idl_condition_add_clause(cond,
30840
0
                          function,
30841
0
                          &ovsrec_netflow_col_engine_id,
30842
0
                          &datum);
30843
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_engine_id.type);
30844
0
}
30845
30846
/* Sets the "engine_type" column from the "NetFlow" table in 'row' to
30847
 * the 'engine_type' set with 'n_engine_type' entries.
30848
 *
30849
 * 'n_engine_type' may be 0 or 1; if it is 0, then 'engine_type'
30850
 * may be NULL.
30851
 *
30852
 * Argument constraints: in range 0 to 255
30853
 *
30854
 * The caller retains ownership of the arguments. */
30855
void
30856
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)
30857
0
{
30858
0
    struct ovsdb_datum datum;
30859
30860
0
    datum.refcnt = NULL;
30861
30862
0
    if (n_engine_type) {
30863
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
30864
0
        datum.n = 1;
30865
0
        datum.keys = key;
30866
0
        key->integer = *engine_type;
30867
0
    } else {
30868
0
        datum.n = 0;
30869
0
        datum.keys = NULL;
30870
0
    }
30871
0
    datum.values = NULL;
30872
0
    ovsdb_idl_condition_add_clause(cond,
30873
0
                          function,
30874
0
                          &ovsrec_netflow_col_engine_type,
30875
0
                          &datum);
30876
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_engine_type.type);
30877
0
}
30878
30879
/* Sets the "external_ids" column's value from the "NetFlow" table in 'row'
30880
 * to 'external_ids'.
30881
 *
30882
 * The caller retains ownership of 'external_ids' and everything in it. */
30883
void
30884
ovsrec_netflow_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
30885
0
{
30886
0
    struct ovsdb_datum datum;
30887
30888
0
    if (external_ids) {
30889
0
        ovsdb_datum_from_smap(&datum, external_ids);
30890
0
    } else {
30891
0
        ovsdb_datum_init_empty(&datum);
30892
0
    }
30893
30894
0
    ovsdb_idl_condition_add_clause(cond,
30895
0
                                   function,
30896
0
                                   &ovsrec_netflow_col_external_ids,
30897
0
                                   &datum);
30898
30899
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_external_ids.type);
30900
0
}
30901
30902
30903
/* Sets the "targets" column from the "NetFlow" table in 'row' to
30904
 * the 'targets' set with 'n_targets' entries.
30905
 *
30906
 * The caller retains ownership of the arguments. */
30907
void
30908
ovsrec_netflow_add_clause_targets(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **targets, size_t n_targets)
30909
0
{
30910
0
    struct ovsdb_datum datum;
30911
30912
0
    datum.refcnt = NULL;
30913
0
    datum.n = n_targets;
30914
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
30915
0
    datum.values = NULL;
30916
0
    for (size_t i = 0; i < n_targets; i++) {
30917
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
30918
0
    }
30919
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_netflow_col_targets.type);
30920
0
    ovsdb_idl_condition_add_clause(cond,
30921
0
                          function,
30922
0
                          &ovsrec_netflow_col_targets,
30923
0
                          &datum);
30924
0
    ovsdb_datum_destroy(&datum, &ovsrec_netflow_col_targets.type);
30925
0
}
30926
30927
/* Destroy 'row' of kind "NetFlow". The row must have been
30928
 * created with ovsdb_idl_index_init_row.
30929
 */
30930
void
30931
ovsrec_netflow_index_destroy_row(const struct ovsrec_netflow *row)
30932
0
{
30933
0
    ovsdb_idl_index_destroy_row(&row->header_);
30934
0
}
30935
        
30936
30937
/* Creates a new row of kind "NetFlow". */
30938
struct ovsrec_netflow *
30939
ovsrec_netflow_index_init_row(struct ovsdb_idl_index *index)
30940
0
{
30941
0
    ovs_assert(index->table->class_ == &ovsrec_table_netflow);
30942
0
    return ALIGNED_CAST(struct ovsrec_netflow *, ovsdb_idl_index_init_row(index));
30943
0
}
30944
30945
struct ovsrec_netflow *
30946
ovsrec_netflow_index_find(struct ovsdb_idl_index *index, const struct ovsrec_netflow *target)
30947
0
{
30948
0
    ovs_assert(index->table->class_ == &ovsrec_table_netflow);
30949
0
    return ovsrec_netflow_cast(ovsdb_idl_index_find(index, &target->header_));
30950
0
}
30951
30952
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
30953
int
30954
ovsrec_netflow_index_compare(
30955
    struct ovsdb_idl_index *index, 
30956
    const struct ovsrec_netflow *a, 
30957
    const struct ovsrec_netflow *b)
30958
0
{
30959
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
30960
0
}
30961
30962
struct ovsdb_idl_cursor
30963
ovsrec_netflow_cursor_first(struct ovsdb_idl_index *index)
30964
0
{
30965
0
    ovs_assert(index->table->class_ == &ovsrec_table_netflow);
30966
0
    return ovsdb_idl_cursor_first(index);
30967
0
}
30968
30969
struct ovsdb_idl_cursor
30970
ovsrec_netflow_cursor_first_eq(
30971
    struct ovsdb_idl_index *index, const struct ovsrec_netflow *target)
30972
0
{
30973
0
    ovs_assert(index->table->class_ == &ovsrec_table_netflow);
30974
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
30975
0
}
30976
30977
struct ovsdb_idl_cursor
30978
ovsrec_netflow_cursor_first_ge(
30979
    struct ovsdb_idl_index *index, const struct ovsrec_netflow *target)
30980
0
{
30981
0
    ovs_assert(index->table->class_ == &ovsrec_table_netflow);
30982
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
30983
0
}
30984
30985
struct ovsrec_netflow *
30986
ovsrec_netflow_cursor_data(struct ovsdb_idl_cursor *cursor)
30987
0
{
30988
0
    return ovsrec_netflow_cast(ovsdb_idl_cursor_data(cursor));
30989
0
}
30990
30991
30992
/* Sets the "active_timeout" column from the "NetFlow" table in 'row' to
30993
 * 'active_timeout'.
30994
 *
30995
 * Argument constraints: at least -1
30996
 *
30997
 * The caller retains ownership of the arguments. */
30998
void
30999
ovsrec_netflow_index_set_active_timeout(const struct ovsrec_netflow *row, int64_t active_timeout)
31000
0
{
31001
0
    struct ovsdb_datum datum;
31002
31003
0
    datum.refcnt = NULL;
31004
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
31005
31006
0
    datum.n = 1;
31007
0
    datum.keys = key;
31008
0
    key->integer = active_timeout;
31009
0
    datum.values = NULL;
31010
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]);
31011
0
}
31012
31013
/* Sets the "add_id_to_interface" column from the "NetFlow" table in 'row' to
31014
 * 'add_id_to_interface'.
31015
 *
31016
 * The caller retains ownership of the arguments. */
31017
void
31018
ovsrec_netflow_index_set_add_id_to_interface(const struct ovsrec_netflow *row, bool add_id_to_interface)
31019
0
{
31020
0
    struct ovsdb_datum datum;
31021
31022
0
    datum.refcnt = NULL;
31023
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
31024
31025
0
    datum.n = 1;
31026
0
    datum.keys = key;
31027
0
    key->boolean = add_id_to_interface;
31028
0
    datum.values = NULL;
31029
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]);
31030
0
}
31031
31032
/* Sets the "engine_id" column from the "NetFlow" table in 'row' to
31033
 * the 'engine_id' set with 'n_engine_id' entries.
31034
 *
31035
 * 'n_engine_id' may be 0 or 1; if it is 0, then 'engine_id'
31036
 * may be NULL.
31037
 *
31038
 * Argument constraints: in range 0 to 255
31039
 *
31040
 * The caller retains ownership of the arguments. */
31041
void
31042
ovsrec_netflow_index_set_engine_id(const struct ovsrec_netflow *row, const int64_t *engine_id, size_t n_engine_id)
31043
0
{
31044
0
    struct ovsdb_datum datum;
31045
31046
0
    datum.refcnt = NULL;
31047
0
    union ovsdb_atom *key;
31048
31049
0
    if (n_engine_id) {
31050
0
        key = xmalloc(sizeof(union ovsdb_atom));
31051
0
        datum.n = 1;
31052
0
        datum.keys = key;
31053
0
        key->integer = *engine_id;
31054
0
    } else {
31055
0
        datum.n = 0;
31056
0
        datum.keys = NULL;
31057
0
    }
31058
0
    datum.values = NULL;
31059
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]);
31060
0
}
31061
31062
/* Sets the "engine_type" column from the "NetFlow" table in 'row' to
31063
 * the 'engine_type' set with 'n_engine_type' entries.
31064
 *
31065
 * 'n_engine_type' may be 0 or 1; if it is 0, then 'engine_type'
31066
 * may be NULL.
31067
 *
31068
 * Argument constraints: in range 0 to 255
31069
 *
31070
 * The caller retains ownership of the arguments. */
31071
void
31072
ovsrec_netflow_index_set_engine_type(const struct ovsrec_netflow *row, const int64_t *engine_type, size_t n_engine_type)
31073
0
{
31074
0
    struct ovsdb_datum datum;
31075
31076
0
    datum.refcnt = NULL;
31077
0
    union ovsdb_atom *key;
31078
31079
0
    if (n_engine_type) {
31080
0
        key = xmalloc(sizeof(union ovsdb_atom));
31081
0
        datum.n = 1;
31082
0
        datum.keys = key;
31083
0
        key->integer = *engine_type;
31084
0
    } else {
31085
0
        datum.n = 0;
31086
0
        datum.keys = NULL;
31087
0
    }
31088
0
    datum.values = NULL;
31089
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]);
31090
0
}
31091
31092
/* Sets the "external_ids" column's value from the "NetFlow" table in 'row'
31093
 * to 'external_ids'.
31094
 *
31095
 * The caller retains ownership of 'external_ids' and everything in it. */
31096
void
31097
ovsrec_netflow_index_set_external_ids(const struct ovsrec_netflow *row, const struct smap *external_ids)
31098
0
{
31099
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
31100
31101
0
    if (external_ids) {
31102
0
        struct smap_node *node;
31103
0
        size_t i;
31104
31105
0
        datum->n = smap_count(external_ids);
31106
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
31107
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
31108
0
        datum->refcnt = NULL;
31109
31110
0
        i = 0;
31111
0
        SMAP_FOR_EACH (node, external_ids) {
31112
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
31113
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
31114
0
            i++;
31115
0
        }
31116
0
        ovsdb_datum_sort_unique(datum, &ovsrec_netflow_col_external_ids.type);
31117
0
    } else {
31118
0
        ovsdb_datum_init_empty(datum);
31119
0
    }
31120
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
31121
0
                          &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_EXTERNAL_IDS],
31122
0
                          datum,
31123
0
                          &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]);
31124
0
    free(datum);
31125
0
}
31126
31127
31128
/* Sets the "targets" column from the "NetFlow" table in 'row' to
31129
 * the 'targets' set with 'n_targets' entries.
31130
 *
31131
 * The caller retains ownership of the arguments. */
31132
void
31133
ovsrec_netflow_index_set_targets(const struct ovsrec_netflow *row, const char **targets, size_t n_targets)
31134
0
{
31135
0
    struct ovsdb_datum datum;
31136
31137
0
    datum.refcnt = NULL;
31138
0
    size_t i;
31139
31140
0
    datum.n = n_targets;
31141
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
31142
0
    datum.values = NULL;
31143
0
    for (i = 0; i < n_targets; i++) {
31144
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
31145
0
    }
31146
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_netflow_col_targets.type);
31147
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]);
31148
0
}
31149
31150
struct ovsdb_idl_column ovsrec_netflow_columns[OVSREC_NETFLOW_N_COLUMNS];
31151
31152
unsigned int
31153
ovsrec_netflow_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
31154
0
{
31155
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_netflow, condition);
31156
0
}
31157
31158
struct ovsdb_idl_column ovsrec_netflow_columns[OVSREC_NETFLOW_N_COLUMNS] = {
31159
    [OVSREC_NETFLOW_COL_ACTIVE_TIMEOUT] = {
31160
         .name = "active_timeout",
31161
         .type = {
31162
            .key = {
31163
               .type = OVSDB_TYPE_INTEGER,
31164
               .integer = { .min = INT64_C(-1), .max = INT64_MAX },
31165
            },
31166
            .value = OVSDB_BASE_VOID_INIT,
31167
            .n_min = 1,
31168
            .n_max = 1,
31169
         },
31170
         .is_mutable = true,
31171
         .is_synthetic = false,
31172
         .parse = ovsrec_netflow_parse_active_timeout,
31173
         .unparse = ovsrec_netflow_unparse_active_timeout,
31174
    },
31175
31176
    [OVSREC_NETFLOW_COL_ADD_ID_TO_INTERFACE] = {
31177
         .name = "add_id_to_interface",
31178
         .type = {
31179
            .key = {
31180
               .type = OVSDB_TYPE_BOOLEAN,
31181
            },
31182
            .value = OVSDB_BASE_VOID_INIT,
31183
            .n_min = 1,
31184
            .n_max = 1,
31185
         },
31186
         .is_mutable = true,
31187
         .is_synthetic = false,
31188
         .parse = ovsrec_netflow_parse_add_id_to_interface,
31189
         .unparse = ovsrec_netflow_unparse_add_id_to_interface,
31190
    },
31191
31192
    [OVSREC_NETFLOW_COL_ENGINE_ID] = {
31193
         .name = "engine_id",
31194
         .type = {
31195
            .key = {
31196
               .type = OVSDB_TYPE_INTEGER,
31197
               .integer = { .min = INT64_C(0), .max = INT64_C(255) },
31198
            },
31199
            .value = OVSDB_BASE_VOID_INIT,
31200
            .n_min = 0,
31201
            .n_max = 1,
31202
         },
31203
         .is_mutable = true,
31204
         .is_synthetic = false,
31205
         .parse = ovsrec_netflow_parse_engine_id,
31206
         .unparse = ovsrec_netflow_unparse_engine_id,
31207
    },
31208
31209
    [OVSREC_NETFLOW_COL_ENGINE_TYPE] = {
31210
         .name = "engine_type",
31211
         .type = {
31212
            .key = {
31213
               .type = OVSDB_TYPE_INTEGER,
31214
               .integer = { .min = INT64_C(0), .max = INT64_C(255) },
31215
            },
31216
            .value = OVSDB_BASE_VOID_INIT,
31217
            .n_min = 0,
31218
            .n_max = 1,
31219
         },
31220
         .is_mutable = true,
31221
         .is_synthetic = false,
31222
         .parse = ovsrec_netflow_parse_engine_type,
31223
         .unparse = ovsrec_netflow_unparse_engine_type,
31224
    },
31225
31226
    [OVSREC_NETFLOW_COL_EXTERNAL_IDS] = {
31227
         .name = "external_ids",
31228
         .type = {
31229
            .key = {
31230
               .type = OVSDB_TYPE_STRING,
31231
               .string = { .minLen = 0, .maxLen = UINT_MAX },
31232
            },
31233
            .value = {
31234
                .type = OVSDB_TYPE_STRING,
31235
                .string = { .minLen = 0, .maxLen = UINT_MAX },
31236
            },
31237
            .n_min = 0,
31238
            .n_max = UINT_MAX,
31239
         },
31240
         .is_mutable = true,
31241
         .is_synthetic = false,
31242
         .parse = ovsrec_netflow_parse_external_ids,
31243
         .unparse = ovsrec_netflow_unparse_external_ids,
31244
    },
31245
31246
    [OVSREC_NETFLOW_COL_TARGETS] = {
31247
         .name = "targets",
31248
         .type = {
31249
            .key = {
31250
               .type = OVSDB_TYPE_STRING,
31251
               .string = { .minLen = 0, .maxLen = UINT_MAX },
31252
            },
31253
            .value = OVSDB_BASE_VOID_INIT,
31254
            .n_min = 1,
31255
            .n_max = UINT_MAX,
31256
         },
31257
         .is_mutable = true,
31258
         .is_synthetic = false,
31259
         .parse = ovsrec_netflow_parse_targets,
31260
         .unparse = ovsrec_netflow_unparse_targets,
31261
    },
31262
31263
};
31264

31265
/* Open_vSwitch table. */
31266
31267
bool
31268
ovsrec_server_has_open_vswitch_table_col_bridges(const struct ovsdb_idl *idl)
31269
0
{
31270
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_bridges);
31271
0
}
31272
31273
31274
bool
31275
ovsrec_server_has_open_vswitch_table_col_cur_cfg(const struct ovsdb_idl *idl)
31276
0
{
31277
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_cur_cfg);
31278
0
}
31279
31280
31281
bool
31282
ovsrec_server_has_open_vswitch_table_col_datapath_types(const struct ovsdb_idl *idl)
31283
0
{
31284
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_datapath_types);
31285
0
}
31286
31287
31288
bool
31289
ovsrec_server_has_open_vswitch_table_col_datapaths(const struct ovsdb_idl *idl)
31290
0
{
31291
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_datapaths);
31292
0
}
31293
31294
31295
bool
31296
ovsrec_server_has_open_vswitch_table_col_db_version(const struct ovsdb_idl *idl)
31297
0
{
31298
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_db_version);
31299
0
}
31300
31301
31302
bool
31303
ovsrec_server_has_open_vswitch_table_col_dpdk_initialized(const struct ovsdb_idl *idl)
31304
0
{
31305
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_dpdk_initialized);
31306
0
}
31307
31308
31309
bool
31310
ovsrec_server_has_open_vswitch_table_col_dpdk_version(const struct ovsdb_idl *idl)
31311
0
{
31312
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_dpdk_version);
31313
0
}
31314
31315
31316
bool
31317
ovsrec_server_has_open_vswitch_table_col_external_ids(const struct ovsdb_idl *idl)
31318
0
{
31319
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_external_ids);
31320
0
}
31321
31322
31323
bool
31324
ovsrec_server_has_open_vswitch_table_col_iface_types(const struct ovsdb_idl *idl)
31325
0
{
31326
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_iface_types);
31327
0
}
31328
31329
31330
bool
31331
ovsrec_server_has_open_vswitch_table_col_manager_options(const struct ovsdb_idl *idl)
31332
0
{
31333
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_manager_options);
31334
0
}
31335
31336
31337
bool
31338
ovsrec_server_has_open_vswitch_table_col_next_cfg(const struct ovsdb_idl *idl)
31339
0
{
31340
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_next_cfg);
31341
0
}
31342
31343
31344
bool
31345
ovsrec_server_has_open_vswitch_table_col_other_config(const struct ovsdb_idl *idl)
31346
0
{
31347
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_other_config);
31348
0
}
31349
31350
31351
bool
31352
ovsrec_server_has_open_vswitch_table_col_ovs_version(const struct ovsdb_idl *idl)
31353
0
{
31354
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_ovs_version);
31355
0
}
31356
31357
31358
bool
31359
ovsrec_server_has_open_vswitch_table_col_ssl(const struct ovsdb_idl *idl)
31360
0
{
31361
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_ssl);
31362
0
}
31363
31364
31365
bool
31366
ovsrec_server_has_open_vswitch_table_col_statistics(const struct ovsdb_idl *idl)
31367
0
{
31368
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_statistics);
31369
0
}
31370
31371
31372
bool
31373
ovsrec_server_has_open_vswitch_table_col_system_type(const struct ovsdb_idl *idl)
31374
0
{
31375
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_system_type);
31376
0
}
31377
31378
31379
bool
31380
ovsrec_server_has_open_vswitch_table_col_system_version(const struct ovsdb_idl *idl)
31381
0
{
31382
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_open_vswitch_col_system_version);
31383
0
}
31384
31385
31386
bool
31387
ovsrec_server_has_open_vswitch_table(const struct ovsdb_idl *idl)
31388
0
{
31389
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
31390
0
}
31391
31392
31393
const struct ovsrec_open_vswitch_table *
31394
ovsrec_open_vswitch_table_get(const struct ovsdb_idl *idl)
31395
0
{
31396
0
    return (const struct ovsrec_open_vswitch_table *) idl;
31397
0
}
31398
31399
const struct ovsrec_open_vswitch *
31400
ovsrec_open_vswitch_table_first(const struct ovsrec_open_vswitch_table *table)
31401
0
{
31402
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
31403
0
    return ovsrec_open_vswitch_first(idl);
31404
0
}
31405
31406
31407
const struct ovsrec_open_vswitch *
31408
ovsrec_open_vswitch_table_track_get_first(const struct ovsrec_open_vswitch_table *table)
31409
0
{
31410
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
31411
0
    return ovsrec_open_vswitch_track_get_first(idl);
31412
0
}
31413
31414
31415
static void
31416
ovsrec_open_vswitch_parse_bridges(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31417
0
{
31418
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31419
0
    row->bridges = NULL;
31420
0
    row->n_bridges = 0;
31421
0
    for (size_t i = 0; i < datum->n; i++) {
31422
0
        struct ovsrec_bridge *keyRow = ovsrec_bridge_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_bridge, &datum->keys[i].uuid));
31423
0
        if (!keyRow) {
31424
0
            continue;
31425
0
        }
31426
0
        if (!row->n_bridges) {
31427
0
            row->bridges = xmalloc(datum->n * sizeof *row->bridges);
31428
0
        }
31429
0
        row->bridges[row->n_bridges] = keyRow;
31430
0
        row->n_bridges++;
31431
0
    }
31432
0
}
31433
31434
static void
31435
ovsrec_open_vswitch_parse_cur_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31436
0
{
31437
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31438
31439
0
    if (datum->n >= 1) {
31440
0
        row->cur_cfg = datum->keys[0].integer;
31441
0
    } else {
31442
0
        row->cur_cfg = 0;
31443
0
    }
31444
0
}
31445
31446
static void
31447
ovsrec_open_vswitch_parse_datapath_types(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31448
0
{
31449
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31450
0
    row->datapath_types = NULL;
31451
0
    row->n_datapath_types = 0;
31452
0
    for (size_t i = 0; i < datum->n; i++) {
31453
0
        if (!row->n_datapath_types) {
31454
0
            row->datapath_types = xmalloc(datum->n * sizeof *row->datapath_types);
31455
0
        }
31456
0
        row->datapath_types[row->n_datapath_types] = datum->keys[i].s->string;
31457
0
        row->n_datapath_types++;
31458
0
    }
31459
0
}
31460
31461
static void
31462
ovsrec_open_vswitch_parse_datapaths(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31463
0
{
31464
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31465
0
    row->key_datapaths = NULL;
31466
0
    row->value_datapaths = NULL;
31467
0
    row->n_datapaths = 0;
31468
0
    for (size_t i = 0; i < datum->n; i++) {
31469
0
        struct ovsrec_datapath *valueRow = ovsrec_datapath_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_datapath, &datum->values[i].uuid));
31470
0
        if (!valueRow) {
31471
0
            continue;
31472
0
        }
31473
0
        if (!row->n_datapaths) {
31474
0
            row->key_datapaths = xmalloc(datum->n * sizeof *row->key_datapaths);
31475
0
            row->value_datapaths = xmalloc(datum->n * sizeof *row->value_datapaths);
31476
0
        }
31477
0
        row->key_datapaths[row->n_datapaths] = datum->keys[i].s->string;
31478
0
        row->value_datapaths[row->n_datapaths] = valueRow;
31479
0
        row->n_datapaths++;
31480
0
    }
31481
0
}
31482
31483
static void
31484
ovsrec_open_vswitch_parse_db_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31485
0
{
31486
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31487
31488
0
    if (datum->n >= 1) {
31489
0
        row->db_version = datum->keys[0].s->string;
31490
0
    } else {
31491
0
        row->db_version = NULL;
31492
0
    }
31493
0
}
31494
31495
static void
31496
ovsrec_open_vswitch_parse_dpdk_initialized(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31497
0
{
31498
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31499
31500
0
    if (datum->n >= 1) {
31501
0
        row->dpdk_initialized = datum->keys[0].boolean;
31502
0
    } else {
31503
0
        row->dpdk_initialized = false;
31504
0
    }
31505
0
}
31506
31507
static void
31508
ovsrec_open_vswitch_parse_dpdk_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31509
0
{
31510
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31511
31512
0
    if (datum->n >= 1) {
31513
0
        row->dpdk_version = datum->keys[0].s->string;
31514
0
    } else {
31515
0
        row->dpdk_version = NULL;
31516
0
    }
31517
0
}
31518
31519
static void
31520
ovsrec_open_vswitch_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31521
0
{
31522
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31523
0
    smap_init(&row->external_ids);
31524
0
    for (size_t i = 0; i < datum->n; i++) {
31525
0
        smap_add(&row->external_ids,
31526
0
                 json_string(datum->keys[i].s),
31527
0
                 json_string(datum->values[i].s));
31528
0
    }
31529
0
}
31530
31531
static void
31532
ovsrec_open_vswitch_parse_iface_types(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31533
0
{
31534
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31535
0
    row->iface_types = NULL;
31536
0
    row->n_iface_types = 0;
31537
0
    for (size_t i = 0; i < datum->n; i++) {
31538
0
        if (!row->n_iface_types) {
31539
0
            row->iface_types = xmalloc(datum->n * sizeof *row->iface_types);
31540
0
        }
31541
0
        row->iface_types[row->n_iface_types] = datum->keys[i].s->string;
31542
0
        row->n_iface_types++;
31543
0
    }
31544
0
}
31545
31546
static void
31547
ovsrec_open_vswitch_parse_manager_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31548
0
{
31549
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31550
0
    row->manager_options = NULL;
31551
0
    row->n_manager_options = 0;
31552
0
    for (size_t i = 0; i < datum->n; i++) {
31553
0
        struct ovsrec_manager *keyRow = ovsrec_manager_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_manager, &datum->keys[i].uuid));
31554
0
        if (!keyRow) {
31555
0
            continue;
31556
0
        }
31557
0
        if (!row->n_manager_options) {
31558
0
            row->manager_options = xmalloc(datum->n * sizeof *row->manager_options);
31559
0
        }
31560
0
        row->manager_options[row->n_manager_options] = keyRow;
31561
0
        row->n_manager_options++;
31562
0
    }
31563
0
}
31564
31565
static void
31566
ovsrec_open_vswitch_parse_next_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31567
0
{
31568
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31569
31570
0
    if (datum->n >= 1) {
31571
0
        row->next_cfg = datum->keys[0].integer;
31572
0
    } else {
31573
0
        row->next_cfg = 0;
31574
0
    }
31575
0
}
31576
31577
static void
31578
ovsrec_open_vswitch_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31579
0
{
31580
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31581
0
    smap_init(&row->other_config);
31582
0
    for (size_t i = 0; i < datum->n; i++) {
31583
0
        smap_add(&row->other_config,
31584
0
                 json_string(datum->keys[i].s),
31585
0
                 json_string(datum->values[i].s));
31586
0
    }
31587
0
}
31588
31589
static void
31590
ovsrec_open_vswitch_parse_ovs_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31591
0
{
31592
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31593
31594
0
    if (datum->n >= 1) {
31595
0
        row->ovs_version = datum->keys[0].s->string;
31596
0
    } else {
31597
0
        row->ovs_version = NULL;
31598
0
    }
31599
0
}
31600
31601
static void
31602
ovsrec_open_vswitch_parse_ssl(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31603
0
{
31604
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31605
31606
0
    if (datum->n >= 1) {
31607
0
        row->ssl = ovsrec_ssl_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_ssl, &datum->keys[0].uuid));
31608
0
    } else {
31609
0
        row->ssl = NULL;
31610
0
    }
31611
0
}
31612
31613
static void
31614
ovsrec_open_vswitch_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31615
0
{
31616
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31617
0
    smap_init(&row->statistics);
31618
0
    for (size_t i = 0; i < datum->n; i++) {
31619
0
        smap_add(&row->statistics,
31620
0
                 json_string(datum->keys[i].s),
31621
0
                 json_string(datum->values[i].s));
31622
0
    }
31623
0
}
31624
31625
static void
31626
ovsrec_open_vswitch_parse_system_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31627
0
{
31628
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31629
31630
0
    if (datum->n >= 1) {
31631
0
        row->system_type = datum->keys[0].s->string;
31632
0
    } else {
31633
0
        row->system_type = NULL;
31634
0
    }
31635
0
}
31636
31637
static void
31638
ovsrec_open_vswitch_parse_system_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
31639
0
{
31640
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31641
31642
0
    if (datum->n >= 1) {
31643
0
        row->system_version = datum->keys[0].s->string;
31644
0
    } else {
31645
0
        row->system_version = NULL;
31646
0
    }
31647
0
}
31648
31649
static void
31650
ovsrec_open_vswitch_unparse_bridges(struct ovsdb_idl_row *row_)
31651
0
{
31652
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31653
0
    free(row->bridges);
31654
0
}
31655
31656
static void
31657
ovsrec_open_vswitch_unparse_cur_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
31658
0
{
31659
    /* Nothing to do. */
31660
0
}
31661
31662
static void
31663
ovsrec_open_vswitch_unparse_datapath_types(struct ovsdb_idl_row *row_)
31664
0
{
31665
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31666
0
    free(row->datapath_types);
31667
0
}
31668
31669
static void
31670
ovsrec_open_vswitch_unparse_datapaths(struct ovsdb_idl_row *row_)
31671
0
{
31672
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31673
0
    free(row->key_datapaths);
31674
0
    free(row->value_datapaths);
31675
0
}
31676
31677
static void
31678
ovsrec_open_vswitch_unparse_db_version(struct ovsdb_idl_row *row OVS_UNUSED)
31679
0
{
31680
    /* Nothing to do. */
31681
0
}
31682
31683
static void
31684
ovsrec_open_vswitch_unparse_dpdk_initialized(struct ovsdb_idl_row *row OVS_UNUSED)
31685
0
{
31686
    /* Nothing to do. */
31687
0
}
31688
31689
static void
31690
ovsrec_open_vswitch_unparse_dpdk_version(struct ovsdb_idl_row *row OVS_UNUSED)
31691
0
{
31692
    /* Nothing to do. */
31693
0
}
31694
31695
static void
31696
ovsrec_open_vswitch_unparse_external_ids(struct ovsdb_idl_row *row_)
31697
0
{
31698
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31699
0
    smap_destroy(&row->external_ids);
31700
0
}
31701
31702
static void
31703
ovsrec_open_vswitch_unparse_iface_types(struct ovsdb_idl_row *row_)
31704
0
{
31705
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31706
0
    free(row->iface_types);
31707
0
}
31708
31709
static void
31710
ovsrec_open_vswitch_unparse_manager_options(struct ovsdb_idl_row *row_)
31711
0
{
31712
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31713
0
    free(row->manager_options);
31714
0
}
31715
31716
static void
31717
ovsrec_open_vswitch_unparse_next_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
31718
0
{
31719
    /* Nothing to do. */
31720
0
}
31721
31722
static void
31723
ovsrec_open_vswitch_unparse_other_config(struct ovsdb_idl_row *row_)
31724
0
{
31725
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31726
0
    smap_destroy(&row->other_config);
31727
0
}
31728
31729
static void
31730
ovsrec_open_vswitch_unparse_ovs_version(struct ovsdb_idl_row *row OVS_UNUSED)
31731
0
{
31732
    /* Nothing to do. */
31733
0
}
31734
31735
static void
31736
ovsrec_open_vswitch_unparse_ssl(struct ovsdb_idl_row *row OVS_UNUSED)
31737
0
{
31738
    /* Nothing to do. */
31739
0
}
31740
31741
static void
31742
ovsrec_open_vswitch_unparse_statistics(struct ovsdb_idl_row *row_)
31743
0
{
31744
0
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
31745
0
    smap_destroy(&row->statistics);
31746
0
}
31747
31748
static void
31749
ovsrec_open_vswitch_unparse_system_type(struct ovsdb_idl_row *row OVS_UNUSED)
31750
0
{
31751
    /* Nothing to do. */
31752
0
}
31753
31754
static void
31755
ovsrec_open_vswitch_unparse_system_version(struct ovsdb_idl_row *row OVS_UNUSED)
31756
0
{
31757
    /* Nothing to do. */
31758
0
}
31759
31760
static void
31761
ovsrec_open_vswitch_init__(struct ovsdb_idl_row *row)
31762
0
{
31763
0
    ovsrec_open_vswitch_init(ovsrec_open_vswitch_cast(row));
31764
0
}
31765
31766
/* Clears the contents of 'row' in table "Open_vSwitch". */
31767
void
31768
ovsrec_open_vswitch_init(struct ovsrec_open_vswitch *row)
31769
0
{
31770
0
    memset(row, 0, sizeof *row); 
31771
0
    smap_init(&row->external_ids);
31772
0
    smap_init(&row->other_config);
31773
0
    smap_init(&row->statistics);
31774
0
}
31775
31776
/* Searches table "Open_vSwitch" in 'idl' for a row with UUID 'uuid'.  Returns
31777
 * a pointer to the row if there is one, otherwise a null pointer.  */
31778
const struct ovsrec_open_vswitch *
31779
ovsrec_open_vswitch_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
31780
0
{
31781
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_open_vswitch, uuid));
31782
0
}
31783
31784
/* Searches table "Open_vSwitch" for a row with UUID 'uuid'.  Returns
31785
 * a pointer to the row if there is one, otherwise a null pointer.  */
31786
const struct ovsrec_open_vswitch *
31787
ovsrec_open_vswitch_table_get_for_uuid(const struct ovsrec_open_vswitch_table *table, const struct uuid *uuid)
31788
0
{
31789
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
31790
0
    return ovsrec_open_vswitch_get_for_uuid(idl, uuid);
31791
0
}
31792
31793
/* Returns a row in table "Open_vSwitch" in 'idl', or a null pointer if that
31794
 * table is empty.
31795
 *
31796
 * Database tables are internally maintained as hash tables, so adding or
31797
 * removing rows while traversing the same table can cause some rows to be
31798
 * visited twice or not at apply. */
31799
const struct ovsrec_open_vswitch *
31800
ovsrec_open_vswitch_first(const struct ovsdb_idl *idl)
31801
0
{
31802
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_first_row(idl, &ovsrec_table_open_vswitch));
31803
0
}
31804
31805
/* Returns a row following 'row' within its table, or a null pointer if 'row'
31806
 * is the last row in its table. */
31807
const struct ovsrec_open_vswitch *
31808
ovsrec_open_vswitch_next(const struct ovsrec_open_vswitch *row)
31809
0
{
31810
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_next_row(&row->header_));
31811
0
}
31812
31813
unsigned int ovsrec_open_vswitch_get_seqno(const struct ovsdb_idl *idl)
31814
0
{
31815
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_open_vswitch);
31816
0
}
31817
31818
unsigned int ovsrec_open_vswitch_row_get_seqno(const struct ovsrec_open_vswitch *row, enum ovsdb_idl_change change)
31819
0
{
31820
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
31821
0
}
31822
31823
const struct ovsrec_open_vswitch *
31824
ovsrec_open_vswitch_track_get_first(const struct ovsdb_idl *idl)
31825
0
{
31826
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_open_vswitch));
31827
0
}
31828
31829
const struct ovsrec_open_vswitch
31830
*ovsrec_open_vswitch_track_get_next(const struct ovsrec_open_vswitch *row)
31831
0
{
31832
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_track_get_next(&row->header_));
31833
0
}
31834
31835
31836
/* Deletes 'row' from table "Open_vSwitch".  'row' may be freed, so it must not be
31837
 * accessed afterward.
31838
 *
31839
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31840
void
31841
ovsrec_open_vswitch_delete(const struct ovsrec_open_vswitch *row)
31842
0
{
31843
0
    ovsdb_idl_txn_delete(&row->header_);
31844
0
}
31845
31846
/* Inserts and returns a new row in the table "Open_vSwitch" in the database
31847
 * with open transaction 'txn'.
31848
 *
31849
 * The new row is assigned a randomly generated provisional UUID.
31850
 * ovsdb-server will assign a different UUID when 'txn' is committed,
31851
 * but the IDL will replace any uses of the provisional UUID in the
31852
 * data to be to be committed by the UUID assigned by ovsdb-server. */
31853
struct ovsrec_open_vswitch *
31854
ovsrec_open_vswitch_insert(struct ovsdb_idl_txn *txn)
31855
0
{
31856
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_open_vswitch, NULL));
31857
0
}
31858
31859
/* Inserts and returns a new row in the table "Open_vSwitch" in the database
31860
 * with open transaction 'txn'.
31861
 *
31862
 * The new row is assigned the UUID specified in the 'uuid' parameter
31863
 * (which cannot be null).  ovsdb-server will try to assign the same
31864
 * UUID when 'txn' is committed. */
31865
struct ovsrec_open_vswitch *
31866
ovsrec_open_vswitch_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
31867
0
{
31868
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_txn_insert_persist_uuid(
31869
0
        txn, &ovsrec_table_open_vswitch, uuid));
31870
0
}
31871
31872
bool
31873
ovsrec_open_vswitch_is_updated(const struct ovsrec_open_vswitch *row, enum ovsrec_open_vswitch_column_id column)
31874
0
{
31875
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_open_vswitch_columns[column]);
31876
0
}
31877
31878
/* Causes the original contents of column "bridges" in 'row' to be
31879
 * verified as a prerequisite to completing the transaction.  That is, if
31880
 * "bridges" in 'row' changed (or if 'row' was deleted) between the
31881
 * time that the IDL originally read its contents and the time that the
31882
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
31883
 *
31884
 * The intention is that, to ensure that no transaction commits based on dirty
31885
 * reads, an application should call this function any time "bridges" is
31886
 * read as part of a read-modify-write operation.
31887
 *
31888
 * In some cases this function reduces to a no-op, because the current value
31889
 * of "bridges" is already known:
31890
 *
31891
 *   - If 'row' is a row created by the current transaction (returned by
31892
 *     ovsrec_open_vswitch_insert()).
31893
 *
31894
 *   - If "bridges" has already been modified (with
31895
 *     ovsrec_open_vswitch_set_bridges()) within the current transaction.
31896
 *
31897
 * Because of the latter property, always call this function *before*
31898
 * ovsrec_open_vswitch_set_bridges() for a given read-modify-write.
31899
 *
31900
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31901
void
31902
ovsrec_open_vswitch_verify_bridges(const struct ovsrec_open_vswitch *row)
31903
0
{
31904
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_bridges);
31905
0
}
31906
31907
/* Causes the original contents of column "cur_cfg" in 'row' to be
31908
 * verified as a prerequisite to completing the transaction.  That is, if
31909
 * "cur_cfg" in 'row' changed (or if 'row' was deleted) between the
31910
 * time that the IDL originally read its contents and the time that the
31911
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
31912
 *
31913
 * The intention is that, to ensure that no transaction commits based on dirty
31914
 * reads, an application should call this function any time "cur_cfg" is
31915
 * read as part of a read-modify-write operation.
31916
 *
31917
 * In some cases this function reduces to a no-op, because the current value
31918
 * of "cur_cfg" is already known:
31919
 *
31920
 *   - If 'row' is a row created by the current transaction (returned by
31921
 *     ovsrec_open_vswitch_insert()).
31922
 *
31923
 *   - If "cur_cfg" has already been modified (with
31924
 *     ovsrec_open_vswitch_set_cur_cfg()) within the current transaction.
31925
 *
31926
 * Because of the latter property, always call this function *before*
31927
 * ovsrec_open_vswitch_set_cur_cfg() for a given read-modify-write.
31928
 *
31929
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31930
void
31931
ovsrec_open_vswitch_verify_cur_cfg(const struct ovsrec_open_vswitch *row)
31932
0
{
31933
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_cur_cfg);
31934
0
}
31935
31936
/* Causes the original contents of column "datapath_types" in 'row' to be
31937
 * verified as a prerequisite to completing the transaction.  That is, if
31938
 * "datapath_types" in 'row' changed (or if 'row' was deleted) between the
31939
 * time that the IDL originally read its contents and the time that the
31940
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
31941
 *
31942
 * The intention is that, to ensure that no transaction commits based on dirty
31943
 * reads, an application should call this function any time "datapath_types" is
31944
 * read as part of a read-modify-write operation.
31945
 *
31946
 * In some cases this function reduces to a no-op, because the current value
31947
 * of "datapath_types" is already known:
31948
 *
31949
 *   - If 'row' is a row created by the current transaction (returned by
31950
 *     ovsrec_open_vswitch_insert()).
31951
 *
31952
 *   - If "datapath_types" has already been modified (with
31953
 *     ovsrec_open_vswitch_set_datapath_types()) within the current transaction.
31954
 *
31955
 * Because of the latter property, always call this function *before*
31956
 * ovsrec_open_vswitch_set_datapath_types() for a given read-modify-write.
31957
 *
31958
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31959
void
31960
ovsrec_open_vswitch_verify_datapath_types(const struct ovsrec_open_vswitch *row)
31961
0
{
31962
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_datapath_types);
31963
0
}
31964
31965
/* Causes the original contents of column "datapaths" in 'row' to be
31966
 * verified as a prerequisite to completing the transaction.  That is, if
31967
 * "datapaths" in 'row' changed (or if 'row' was deleted) between the
31968
 * time that the IDL originally read its contents and the time that the
31969
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
31970
 *
31971
 * The intention is that, to ensure that no transaction commits based on dirty
31972
 * reads, an application should call this function any time "datapaths" is
31973
 * read as part of a read-modify-write operation.
31974
 *
31975
 * In some cases this function reduces to a no-op, because the current value
31976
 * of "datapaths" is already known:
31977
 *
31978
 *   - If 'row' is a row created by the current transaction (returned by
31979
 *     ovsrec_open_vswitch_insert()).
31980
 *
31981
 *   - If "datapaths" has already been modified (with
31982
 *     ovsrec_open_vswitch_set_datapaths()) within the current transaction.
31983
 *
31984
 * Because of the latter property, always call this function *before*
31985
 * ovsrec_open_vswitch_set_datapaths() for a given read-modify-write.
31986
 *
31987
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
31988
void
31989
ovsrec_open_vswitch_verify_datapaths(const struct ovsrec_open_vswitch *row)
31990
0
{
31991
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_datapaths);
31992
0
}
31993
31994
/* Causes the original contents of column "db_version" in 'row' to be
31995
 * verified as a prerequisite to completing the transaction.  That is, if
31996
 * "db_version" in 'row' changed (or if 'row' was deleted) between the
31997
 * time that the IDL originally read its contents and the time that the
31998
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
31999
 *
32000
 * The intention is that, to ensure that no transaction commits based on dirty
32001
 * reads, an application should call this function any time "db_version" is
32002
 * read as part of a read-modify-write operation.
32003
 *
32004
 * In some cases this function reduces to a no-op, because the current value
32005
 * of "db_version" is already known:
32006
 *
32007
 *   - If 'row' is a row created by the current transaction (returned by
32008
 *     ovsrec_open_vswitch_insert()).
32009
 *
32010
 *   - If "db_version" has already been modified (with
32011
 *     ovsrec_open_vswitch_set_db_version()) within the current transaction.
32012
 *
32013
 * Because of the latter property, always call this function *before*
32014
 * ovsrec_open_vswitch_set_db_version() for a given read-modify-write.
32015
 *
32016
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32017
void
32018
ovsrec_open_vswitch_verify_db_version(const struct ovsrec_open_vswitch *row)
32019
0
{
32020
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_db_version);
32021
0
}
32022
32023
/* Causes the original contents of column "dpdk_initialized" in 'row' to be
32024
 * verified as a prerequisite to completing the transaction.  That is, if
32025
 * "dpdk_initialized" in 'row' changed (or if 'row' was deleted) between the
32026
 * time that the IDL originally read its contents and the time that the
32027
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32028
 *
32029
 * The intention is that, to ensure that no transaction commits based on dirty
32030
 * reads, an application should call this function any time "dpdk_initialized" is
32031
 * read as part of a read-modify-write operation.
32032
 *
32033
 * In some cases this function reduces to a no-op, because the current value
32034
 * of "dpdk_initialized" is already known:
32035
 *
32036
 *   - If 'row' is a row created by the current transaction (returned by
32037
 *     ovsrec_open_vswitch_insert()).
32038
 *
32039
 *   - If "dpdk_initialized" has already been modified (with
32040
 *     ovsrec_open_vswitch_set_dpdk_initialized()) within the current transaction.
32041
 *
32042
 * Because of the latter property, always call this function *before*
32043
 * ovsrec_open_vswitch_set_dpdk_initialized() for a given read-modify-write.
32044
 *
32045
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32046
void
32047
ovsrec_open_vswitch_verify_dpdk_initialized(const struct ovsrec_open_vswitch *row)
32048
0
{
32049
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_dpdk_initialized);
32050
0
}
32051
32052
/* Causes the original contents of column "dpdk_version" in 'row' to be
32053
 * verified as a prerequisite to completing the transaction.  That is, if
32054
 * "dpdk_version" in 'row' changed (or if 'row' was deleted) between the
32055
 * time that the IDL originally read its contents and the time that the
32056
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32057
 *
32058
 * The intention is that, to ensure that no transaction commits based on dirty
32059
 * reads, an application should call this function any time "dpdk_version" is
32060
 * read as part of a read-modify-write operation.
32061
 *
32062
 * In some cases this function reduces to a no-op, because the current value
32063
 * of "dpdk_version" is already known:
32064
 *
32065
 *   - If 'row' is a row created by the current transaction (returned by
32066
 *     ovsrec_open_vswitch_insert()).
32067
 *
32068
 *   - If "dpdk_version" has already been modified (with
32069
 *     ovsrec_open_vswitch_set_dpdk_version()) within the current transaction.
32070
 *
32071
 * Because of the latter property, always call this function *before*
32072
 * ovsrec_open_vswitch_set_dpdk_version() for a given read-modify-write.
32073
 *
32074
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32075
void
32076
ovsrec_open_vswitch_verify_dpdk_version(const struct ovsrec_open_vswitch *row)
32077
0
{
32078
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_dpdk_version);
32079
0
}
32080
32081
/* Causes the original contents of column "external_ids" in 'row' to be
32082
 * verified as a prerequisite to completing the transaction.  That is, if
32083
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
32084
 * time that the IDL originally read its contents and the time that the
32085
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32086
 *
32087
 * The intention is that, to ensure that no transaction commits based on dirty
32088
 * reads, an application should call this function any time "external_ids" is
32089
 * read as part of a read-modify-write operation.
32090
 *
32091
 * In some cases this function reduces to a no-op, because the current value
32092
 * of "external_ids" is already known:
32093
 *
32094
 *   - If 'row' is a row created by the current transaction (returned by
32095
 *     ovsrec_open_vswitch_insert()).
32096
 *
32097
 *   - If "external_ids" has already been modified (with
32098
 *     ovsrec_open_vswitch_set_external_ids()) within the current transaction.
32099
 *
32100
 * Because of the latter property, always call this function *before*
32101
 * ovsrec_open_vswitch_set_external_ids() for a given read-modify-write.
32102
 *
32103
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32104
void
32105
ovsrec_open_vswitch_verify_external_ids(const struct ovsrec_open_vswitch *row)
32106
0
{
32107
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_external_ids);
32108
0
}
32109
32110
/* Causes the original contents of column "iface_types" in 'row' to be
32111
 * verified as a prerequisite to completing the transaction.  That is, if
32112
 * "iface_types" in 'row' changed (or if 'row' was deleted) between the
32113
 * time that the IDL originally read its contents and the time that the
32114
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32115
 *
32116
 * The intention is that, to ensure that no transaction commits based on dirty
32117
 * reads, an application should call this function any time "iface_types" is
32118
 * read as part of a read-modify-write operation.
32119
 *
32120
 * In some cases this function reduces to a no-op, because the current value
32121
 * of "iface_types" is already known:
32122
 *
32123
 *   - If 'row' is a row created by the current transaction (returned by
32124
 *     ovsrec_open_vswitch_insert()).
32125
 *
32126
 *   - If "iface_types" has already been modified (with
32127
 *     ovsrec_open_vswitch_set_iface_types()) within the current transaction.
32128
 *
32129
 * Because of the latter property, always call this function *before*
32130
 * ovsrec_open_vswitch_set_iface_types() for a given read-modify-write.
32131
 *
32132
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32133
void
32134
ovsrec_open_vswitch_verify_iface_types(const struct ovsrec_open_vswitch *row)
32135
0
{
32136
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_iface_types);
32137
0
}
32138
32139
/* Causes the original contents of column "manager_options" in 'row' to be
32140
 * verified as a prerequisite to completing the transaction.  That is, if
32141
 * "manager_options" in 'row' changed (or if 'row' was deleted) between the
32142
 * time that the IDL originally read its contents and the time that the
32143
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32144
 *
32145
 * The intention is that, to ensure that no transaction commits based on dirty
32146
 * reads, an application should call this function any time "manager_options" is
32147
 * read as part of a read-modify-write operation.
32148
 *
32149
 * In some cases this function reduces to a no-op, because the current value
32150
 * of "manager_options" is already known:
32151
 *
32152
 *   - If 'row' is a row created by the current transaction (returned by
32153
 *     ovsrec_open_vswitch_insert()).
32154
 *
32155
 *   - If "manager_options" has already been modified (with
32156
 *     ovsrec_open_vswitch_set_manager_options()) within the current transaction.
32157
 *
32158
 * Because of the latter property, always call this function *before*
32159
 * ovsrec_open_vswitch_set_manager_options() for a given read-modify-write.
32160
 *
32161
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32162
void
32163
ovsrec_open_vswitch_verify_manager_options(const struct ovsrec_open_vswitch *row)
32164
0
{
32165
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_manager_options);
32166
0
}
32167
32168
/* Causes the original contents of column "next_cfg" in 'row' to be
32169
 * verified as a prerequisite to completing the transaction.  That is, if
32170
 * "next_cfg" in 'row' changed (or if 'row' was deleted) between the
32171
 * time that the IDL originally read its contents and the time that the
32172
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32173
 *
32174
 * The intention is that, to ensure that no transaction commits based on dirty
32175
 * reads, an application should call this function any time "next_cfg" is
32176
 * read as part of a read-modify-write operation.
32177
 *
32178
 * In some cases this function reduces to a no-op, because the current value
32179
 * of "next_cfg" is already known:
32180
 *
32181
 *   - If 'row' is a row created by the current transaction (returned by
32182
 *     ovsrec_open_vswitch_insert()).
32183
 *
32184
 *   - If "next_cfg" has already been modified (with
32185
 *     ovsrec_open_vswitch_set_next_cfg()) within the current transaction.
32186
 *
32187
 * Because of the latter property, always call this function *before*
32188
 * ovsrec_open_vswitch_set_next_cfg() for a given read-modify-write.
32189
 *
32190
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32191
void
32192
ovsrec_open_vswitch_verify_next_cfg(const struct ovsrec_open_vswitch *row)
32193
0
{
32194
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_next_cfg);
32195
0
}
32196
32197
/* Causes the original contents of column "other_config" in 'row' to be
32198
 * verified as a prerequisite to completing the transaction.  That is, if
32199
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
32200
 * time that the IDL originally read its contents and the time that the
32201
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32202
 *
32203
 * The intention is that, to ensure that no transaction commits based on dirty
32204
 * reads, an application should call this function any time "other_config" is
32205
 * read as part of a read-modify-write operation.
32206
 *
32207
 * In some cases this function reduces to a no-op, because the current value
32208
 * of "other_config" is already known:
32209
 *
32210
 *   - If 'row' is a row created by the current transaction (returned by
32211
 *     ovsrec_open_vswitch_insert()).
32212
 *
32213
 *   - If "other_config" has already been modified (with
32214
 *     ovsrec_open_vswitch_set_other_config()) within the current transaction.
32215
 *
32216
 * Because of the latter property, always call this function *before*
32217
 * ovsrec_open_vswitch_set_other_config() for a given read-modify-write.
32218
 *
32219
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32220
void
32221
ovsrec_open_vswitch_verify_other_config(const struct ovsrec_open_vswitch *row)
32222
0
{
32223
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_other_config);
32224
0
}
32225
32226
/* Causes the original contents of column "ovs_version" in 'row' to be
32227
 * verified as a prerequisite to completing the transaction.  That is, if
32228
 * "ovs_version" in 'row' changed (or if 'row' was deleted) between the
32229
 * time that the IDL originally read its contents and the time that the
32230
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32231
 *
32232
 * The intention is that, to ensure that no transaction commits based on dirty
32233
 * reads, an application should call this function any time "ovs_version" is
32234
 * read as part of a read-modify-write operation.
32235
 *
32236
 * In some cases this function reduces to a no-op, because the current value
32237
 * of "ovs_version" is already known:
32238
 *
32239
 *   - If 'row' is a row created by the current transaction (returned by
32240
 *     ovsrec_open_vswitch_insert()).
32241
 *
32242
 *   - If "ovs_version" has already been modified (with
32243
 *     ovsrec_open_vswitch_set_ovs_version()) within the current transaction.
32244
 *
32245
 * Because of the latter property, always call this function *before*
32246
 * ovsrec_open_vswitch_set_ovs_version() for a given read-modify-write.
32247
 *
32248
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32249
void
32250
ovsrec_open_vswitch_verify_ovs_version(const struct ovsrec_open_vswitch *row)
32251
0
{
32252
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_ovs_version);
32253
0
}
32254
32255
/* Causes the original contents of column "ssl" in 'row' to be
32256
 * verified as a prerequisite to completing the transaction.  That is, if
32257
 * "ssl" in 'row' changed (or if 'row' was deleted) between the
32258
 * time that the IDL originally read its contents and the time that the
32259
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32260
 *
32261
 * The intention is that, to ensure that no transaction commits based on dirty
32262
 * reads, an application should call this function any time "ssl" is
32263
 * read as part of a read-modify-write operation.
32264
 *
32265
 * In some cases this function reduces to a no-op, because the current value
32266
 * of "ssl" is already known:
32267
 *
32268
 *   - If 'row' is a row created by the current transaction (returned by
32269
 *     ovsrec_open_vswitch_insert()).
32270
 *
32271
 *   - If "ssl" has already been modified (with
32272
 *     ovsrec_open_vswitch_set_ssl()) within the current transaction.
32273
 *
32274
 * Because of the latter property, always call this function *before*
32275
 * ovsrec_open_vswitch_set_ssl() for a given read-modify-write.
32276
 *
32277
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32278
void
32279
ovsrec_open_vswitch_verify_ssl(const struct ovsrec_open_vswitch *row)
32280
0
{
32281
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_ssl);
32282
0
}
32283
32284
/* Causes the original contents of column "statistics" in 'row' to be
32285
 * verified as a prerequisite to completing the transaction.  That is, if
32286
 * "statistics" in 'row' changed (or if 'row' was deleted) between the
32287
 * time that the IDL originally read its contents and the time that the
32288
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32289
 *
32290
 * The intention is that, to ensure that no transaction commits based on dirty
32291
 * reads, an application should call this function any time "statistics" is
32292
 * read as part of a read-modify-write operation.
32293
 *
32294
 * In some cases this function reduces to a no-op, because the current value
32295
 * of "statistics" is already known:
32296
 *
32297
 *   - If 'row' is a row created by the current transaction (returned by
32298
 *     ovsrec_open_vswitch_insert()).
32299
 *
32300
 *   - If "statistics" has already been modified (with
32301
 *     ovsrec_open_vswitch_set_statistics()) within the current transaction.
32302
 *
32303
 * Because of the latter property, always call this function *before*
32304
 * ovsrec_open_vswitch_set_statistics() for a given read-modify-write.
32305
 *
32306
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32307
void
32308
ovsrec_open_vswitch_verify_statistics(const struct ovsrec_open_vswitch *row)
32309
0
{
32310
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_statistics);
32311
0
}
32312
32313
/* Causes the original contents of column "system_type" in 'row' to be
32314
 * verified as a prerequisite to completing the transaction.  That is, if
32315
 * "system_type" in 'row' changed (or if 'row' was deleted) between the
32316
 * time that the IDL originally read its contents and the time that the
32317
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32318
 *
32319
 * The intention is that, to ensure that no transaction commits based on dirty
32320
 * reads, an application should call this function any time "system_type" is
32321
 * read as part of a read-modify-write operation.
32322
 *
32323
 * In some cases this function reduces to a no-op, because the current value
32324
 * of "system_type" is already known:
32325
 *
32326
 *   - If 'row' is a row created by the current transaction (returned by
32327
 *     ovsrec_open_vswitch_insert()).
32328
 *
32329
 *   - If "system_type" has already been modified (with
32330
 *     ovsrec_open_vswitch_set_system_type()) within the current transaction.
32331
 *
32332
 * Because of the latter property, always call this function *before*
32333
 * ovsrec_open_vswitch_set_system_type() for a given read-modify-write.
32334
 *
32335
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32336
void
32337
ovsrec_open_vswitch_verify_system_type(const struct ovsrec_open_vswitch *row)
32338
0
{
32339
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_system_type);
32340
0
}
32341
32342
/* Causes the original contents of column "system_version" in 'row' to be
32343
 * verified as a prerequisite to completing the transaction.  That is, if
32344
 * "system_version" in 'row' changed (or if 'row' was deleted) between the
32345
 * time that the IDL originally read its contents and the time that the
32346
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
32347
 *
32348
 * The intention is that, to ensure that no transaction commits based on dirty
32349
 * reads, an application should call this function any time "system_version" is
32350
 * read as part of a read-modify-write operation.
32351
 *
32352
 * In some cases this function reduces to a no-op, because the current value
32353
 * of "system_version" is already known:
32354
 *
32355
 *   - If 'row' is a row created by the current transaction (returned by
32356
 *     ovsrec_open_vswitch_insert()).
32357
 *
32358
 *   - If "system_version" has already been modified (with
32359
 *     ovsrec_open_vswitch_set_system_version()) within the current transaction.
32360
 *
32361
 * Because of the latter property, always call this function *before*
32362
 * ovsrec_open_vswitch_set_system_version() for a given read-modify-write.
32363
 *
32364
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
32365
void
32366
ovsrec_open_vswitch_verify_system_version(const struct ovsrec_open_vswitch *row)
32367
0
{
32368
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_col_system_version);
32369
0
}
32370
32371
/* Returns the "bridges" column's value from the "Open_vSwitch" table in 'row'
32372
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32373
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32374
 * for a given key than implementing the same operation on the "cooked"
32375
 * form in 'row'.
32376
 *
32377
 * 'key_type' must be OVSDB_TYPE_UUID.
32378
 * (This helps to avoid silent bugs if someone changes bridges's
32379
 * type without updating the caller.)
32380
 *
32381
 * The caller must not modify or free the returned value.
32382
 *
32383
 * Various kinds of changes can invalidate the returned value: modifying
32384
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32385
 * If the returned value is needed for a long time, it is best to make a copy
32386
 * of it with ovsdb_datum_clone().
32387
 *
32388
 * This function is rarely useful, since it is easier to access the value
32389
 * directly through the "bridges" member in ovsrec_open_vswitch. */
32390
const struct ovsdb_datum *
32391
ovsrec_open_vswitch_get_bridges(const struct ovsrec_open_vswitch *row,
32392
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32393
0
{
32394
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
32395
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_bridges);
32396
0
}
32397
32398
/* Returns the "cur_cfg" column's value from the "Open_vSwitch" table in 'row'
32399
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32400
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32401
 * for a given key than implementing the same operation on the "cooked"
32402
 * form in 'row'.
32403
 *
32404
 * 'key_type' must be OVSDB_TYPE_INTEGER.
32405
 * (This helps to avoid silent bugs if someone changes cur_cfg's
32406
 * type without updating the caller.)
32407
 *
32408
 * The caller must not modify or free the returned value.
32409
 *
32410
 * Various kinds of changes can invalidate the returned value: modifying
32411
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32412
 * If the returned value is needed for a long time, it is best to make a copy
32413
 * of it with ovsdb_datum_clone().
32414
 *
32415
 * This function is rarely useful, since it is easier to access the value
32416
 * directly through the "cur_cfg" member in ovsrec_open_vswitch. */
32417
const struct ovsdb_datum *
32418
ovsrec_open_vswitch_get_cur_cfg(const struct ovsrec_open_vswitch *row,
32419
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32420
0
{
32421
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
32422
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_cur_cfg);
32423
0
}
32424
32425
/* Returns the "datapath_types" column's value from the "Open_vSwitch" table in 'row'
32426
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32427
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32428
 * for a given key than implementing the same operation on the "cooked"
32429
 * form in 'row'.
32430
 *
32431
 * 'key_type' must be OVSDB_TYPE_STRING.
32432
 * (This helps to avoid silent bugs if someone changes datapath_types's
32433
 * type without updating the caller.)
32434
 *
32435
 * The caller must not modify or free the returned value.
32436
 *
32437
 * Various kinds of changes can invalidate the returned value: modifying
32438
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32439
 * If the returned value is needed for a long time, it is best to make a copy
32440
 * of it with ovsdb_datum_clone().
32441
 *
32442
 * This function is rarely useful, since it is easier to access the value
32443
 * directly through the "datapath_types" member in ovsrec_open_vswitch. */
32444
const struct ovsdb_datum *
32445
ovsrec_open_vswitch_get_datapath_types(const struct ovsrec_open_vswitch *row,
32446
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32447
0
{
32448
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32449
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_datapath_types);
32450
0
}
32451
32452
/* Returns the "datapaths" column's value from the "Open_vSwitch" table in 'row'
32453
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32454
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32455
 * for a given key than implementing the same operation on the "cooked"
32456
 * form in 'row'.
32457
 *
32458
 * 'key_type' must be OVSDB_TYPE_STRING.
32459
 * 'value_type' must be OVSDB_TYPE_UUID.
32460
 * (This helps to avoid silent bugs if someone changes datapaths's
32461
 * type without updating the caller.)
32462
 *
32463
 * The caller must not modify or free the returned value.
32464
 *
32465
 * Various kinds of changes can invalidate the returned value: modifying
32466
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32467
 * If the returned value is needed for a long time, it is best to make a copy
32468
 * of it with ovsdb_datum_clone().
32469
 *
32470
 * This function is rarely useful, since it is easier to access the value
32471
 * directly through the "datapaths" member in ovsrec_open_vswitch. */
32472
const struct ovsdb_datum *
32473
ovsrec_open_vswitch_get_datapaths(const struct ovsrec_open_vswitch *row,
32474
  enum ovsdb_atomic_type key_type OVS_UNUSED,
32475
  enum ovsdb_atomic_type value_type OVS_UNUSED)
32476
0
{
32477
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32478
0
    ovs_assert(value_type == OVSDB_TYPE_UUID);
32479
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_datapaths);
32480
0
}
32481
32482
/* Returns the "db_version" column's value from the "Open_vSwitch" table in 'row'
32483
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32484
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32485
 * for a given key than implementing the same operation on the "cooked"
32486
 * form in 'row'.
32487
 *
32488
 * 'key_type' must be OVSDB_TYPE_STRING.
32489
 * (This helps to avoid silent bugs if someone changes db_version's
32490
 * type without updating the caller.)
32491
 *
32492
 * The caller must not modify or free the returned value.
32493
 *
32494
 * Various kinds of changes can invalidate the returned value: modifying
32495
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32496
 * If the returned value is needed for a long time, it is best to make a copy
32497
 * of it with ovsdb_datum_clone().
32498
 *
32499
 * This function is rarely useful, since it is easier to access the value
32500
 * directly through the "db_version" member in ovsrec_open_vswitch. */
32501
const struct ovsdb_datum *
32502
ovsrec_open_vswitch_get_db_version(const struct ovsrec_open_vswitch *row,
32503
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32504
0
{
32505
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32506
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_db_version);
32507
0
}
32508
32509
/* Returns the "dpdk_initialized" column's value from the "Open_vSwitch" table in 'row'
32510
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32511
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32512
 * for a given key than implementing the same operation on the "cooked"
32513
 * form in 'row'.
32514
 *
32515
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
32516
 * (This helps to avoid silent bugs if someone changes dpdk_initialized's
32517
 * type without updating the caller.)
32518
 *
32519
 * The caller must not modify or free the returned value.
32520
 *
32521
 * Various kinds of changes can invalidate the returned value: modifying
32522
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32523
 * If the returned value is needed for a long time, it is best to make a copy
32524
 * of it with ovsdb_datum_clone().
32525
 *
32526
 * This function is rarely useful, since it is easier to access the value
32527
 * directly through the "dpdk_initialized" member in ovsrec_open_vswitch. */
32528
const struct ovsdb_datum *
32529
ovsrec_open_vswitch_get_dpdk_initialized(const struct ovsrec_open_vswitch *row,
32530
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32531
0
{
32532
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
32533
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_dpdk_initialized);
32534
0
}
32535
32536
/* Returns the "dpdk_version" column's value from the "Open_vSwitch" table in 'row'
32537
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32538
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32539
 * for a given key than implementing the same operation on the "cooked"
32540
 * form in 'row'.
32541
 *
32542
 * 'key_type' must be OVSDB_TYPE_STRING.
32543
 * (This helps to avoid silent bugs if someone changes dpdk_version's
32544
 * type without updating the caller.)
32545
 *
32546
 * The caller must not modify or free the returned value.
32547
 *
32548
 * Various kinds of changes can invalidate the returned value: modifying
32549
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32550
 * If the returned value is needed for a long time, it is best to make a copy
32551
 * of it with ovsdb_datum_clone().
32552
 *
32553
 * This function is rarely useful, since it is easier to access the value
32554
 * directly through the "dpdk_version" member in ovsrec_open_vswitch. */
32555
const struct ovsdb_datum *
32556
ovsrec_open_vswitch_get_dpdk_version(const struct ovsrec_open_vswitch *row,
32557
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32558
0
{
32559
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32560
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_dpdk_version);
32561
0
}
32562
32563
/* Returns the "external_ids" column's value from the "Open_vSwitch" table in 'row'
32564
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32565
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32566
 * for a given key than implementing the same operation on the "cooked"
32567
 * form in 'row'.
32568
 *
32569
 * 'key_type' must be OVSDB_TYPE_STRING.
32570
 * 'value_type' must be OVSDB_TYPE_STRING.
32571
 * (This helps to avoid silent bugs if someone changes external_ids's
32572
 * type without updating the caller.)
32573
 *
32574
 * The caller must not modify or free the returned value.
32575
 *
32576
 * Various kinds of changes can invalidate the returned value: modifying
32577
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32578
 * If the returned value is needed for a long time, it is best to make a copy
32579
 * of it with ovsdb_datum_clone().
32580
 *
32581
 * This function is rarely useful, since it is easier to access the value
32582
 * directly through the "external_ids" member in ovsrec_open_vswitch. */
32583
const struct ovsdb_datum *
32584
ovsrec_open_vswitch_get_external_ids(const struct ovsrec_open_vswitch *row,
32585
  enum ovsdb_atomic_type key_type OVS_UNUSED,
32586
  enum ovsdb_atomic_type value_type OVS_UNUSED)
32587
0
{
32588
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32589
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
32590
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_external_ids);
32591
0
}
32592
32593
/* Returns the "iface_types" column's value from the "Open_vSwitch" table in 'row'
32594
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32595
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32596
 * for a given key than implementing the same operation on the "cooked"
32597
 * form in 'row'.
32598
 *
32599
 * 'key_type' must be OVSDB_TYPE_STRING.
32600
 * (This helps to avoid silent bugs if someone changes iface_types's
32601
 * type without updating the caller.)
32602
 *
32603
 * The caller must not modify or free the returned value.
32604
 *
32605
 * Various kinds of changes can invalidate the returned value: modifying
32606
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32607
 * If the returned value is needed for a long time, it is best to make a copy
32608
 * of it with ovsdb_datum_clone().
32609
 *
32610
 * This function is rarely useful, since it is easier to access the value
32611
 * directly through the "iface_types" member in ovsrec_open_vswitch. */
32612
const struct ovsdb_datum *
32613
ovsrec_open_vswitch_get_iface_types(const struct ovsrec_open_vswitch *row,
32614
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32615
0
{
32616
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32617
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_iface_types);
32618
0
}
32619
32620
/* Returns the "manager_options" column's value from the "Open_vSwitch" table in 'row'
32621
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32622
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32623
 * for a given key than implementing the same operation on the "cooked"
32624
 * form in 'row'.
32625
 *
32626
 * 'key_type' must be OVSDB_TYPE_UUID.
32627
 * (This helps to avoid silent bugs if someone changes manager_options's
32628
 * type without updating the caller.)
32629
 *
32630
 * The caller must not modify or free the returned value.
32631
 *
32632
 * Various kinds of changes can invalidate the returned value: modifying
32633
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32634
 * If the returned value is needed for a long time, it is best to make a copy
32635
 * of it with ovsdb_datum_clone().
32636
 *
32637
 * This function is rarely useful, since it is easier to access the value
32638
 * directly through the "manager_options" member in ovsrec_open_vswitch. */
32639
const struct ovsdb_datum *
32640
ovsrec_open_vswitch_get_manager_options(const struct ovsrec_open_vswitch *row,
32641
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32642
0
{
32643
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
32644
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_manager_options);
32645
0
}
32646
32647
/* Returns the "next_cfg" column's value from the "Open_vSwitch" table in 'row'
32648
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32649
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32650
 * for a given key than implementing the same operation on the "cooked"
32651
 * form in 'row'.
32652
 *
32653
 * 'key_type' must be OVSDB_TYPE_INTEGER.
32654
 * (This helps to avoid silent bugs if someone changes next_cfg's
32655
 * type without updating the caller.)
32656
 *
32657
 * The caller must not modify or free the returned value.
32658
 *
32659
 * Various kinds of changes can invalidate the returned value: modifying
32660
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32661
 * If the returned value is needed for a long time, it is best to make a copy
32662
 * of it with ovsdb_datum_clone().
32663
 *
32664
 * This function is rarely useful, since it is easier to access the value
32665
 * directly through the "next_cfg" member in ovsrec_open_vswitch. */
32666
const struct ovsdb_datum *
32667
ovsrec_open_vswitch_get_next_cfg(const struct ovsrec_open_vswitch *row,
32668
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32669
0
{
32670
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
32671
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_next_cfg);
32672
0
}
32673
32674
/* Returns the "other_config" column's value from the "Open_vSwitch" table in 'row'
32675
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32676
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32677
 * for a given key than implementing the same operation on the "cooked"
32678
 * form in 'row'.
32679
 *
32680
 * 'key_type' must be OVSDB_TYPE_STRING.
32681
 * 'value_type' must be OVSDB_TYPE_STRING.
32682
 * (This helps to avoid silent bugs if someone changes other_config's
32683
 * type without updating the caller.)
32684
 *
32685
 * The caller must not modify or free the returned value.
32686
 *
32687
 * Various kinds of changes can invalidate the returned value: modifying
32688
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32689
 * If the returned value is needed for a long time, it is best to make a copy
32690
 * of it with ovsdb_datum_clone().
32691
 *
32692
 * This function is rarely useful, since it is easier to access the value
32693
 * directly through the "other_config" member in ovsrec_open_vswitch. */
32694
const struct ovsdb_datum *
32695
ovsrec_open_vswitch_get_other_config(const struct ovsrec_open_vswitch *row,
32696
  enum ovsdb_atomic_type key_type OVS_UNUSED,
32697
  enum ovsdb_atomic_type value_type OVS_UNUSED)
32698
0
{
32699
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32700
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
32701
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_other_config);
32702
0
}
32703
32704
/* Returns the "ovs_version" column's value from the "Open_vSwitch" table in 'row'
32705
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32706
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32707
 * for a given key than implementing the same operation on the "cooked"
32708
 * form in 'row'.
32709
 *
32710
 * 'key_type' must be OVSDB_TYPE_STRING.
32711
 * (This helps to avoid silent bugs if someone changes ovs_version's
32712
 * type without updating the caller.)
32713
 *
32714
 * The caller must not modify or free the returned value.
32715
 *
32716
 * Various kinds of changes can invalidate the returned value: modifying
32717
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32718
 * If the returned value is needed for a long time, it is best to make a copy
32719
 * of it with ovsdb_datum_clone().
32720
 *
32721
 * This function is rarely useful, since it is easier to access the value
32722
 * directly through the "ovs_version" member in ovsrec_open_vswitch. */
32723
const struct ovsdb_datum *
32724
ovsrec_open_vswitch_get_ovs_version(const struct ovsrec_open_vswitch *row,
32725
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32726
0
{
32727
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32728
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_ovs_version);
32729
0
}
32730
32731
/* Returns the "ssl" column's value from the "Open_vSwitch" table in 'row'
32732
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32733
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32734
 * for a given key than implementing the same operation on the "cooked"
32735
 * form in 'row'.
32736
 *
32737
 * 'key_type' must be OVSDB_TYPE_UUID.
32738
 * (This helps to avoid silent bugs if someone changes ssl's
32739
 * type without updating the caller.)
32740
 *
32741
 * The caller must not modify or free the returned value.
32742
 *
32743
 * Various kinds of changes can invalidate the returned value: modifying
32744
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32745
 * If the returned value is needed for a long time, it is best to make a copy
32746
 * of it with ovsdb_datum_clone().
32747
 *
32748
 * This function is rarely useful, since it is easier to access the value
32749
 * directly through the "ssl" member in ovsrec_open_vswitch. */
32750
const struct ovsdb_datum *
32751
ovsrec_open_vswitch_get_ssl(const struct ovsrec_open_vswitch *row,
32752
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32753
0
{
32754
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
32755
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_ssl);
32756
0
}
32757
32758
/* Returns the "statistics" column's value from the "Open_vSwitch" table in 'row'
32759
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32760
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32761
 * for a given key than implementing the same operation on the "cooked"
32762
 * form in 'row'.
32763
 *
32764
 * 'key_type' must be OVSDB_TYPE_STRING.
32765
 * 'value_type' must be OVSDB_TYPE_STRING.
32766
 * (This helps to avoid silent bugs if someone changes statistics's
32767
 * type without updating the caller.)
32768
 *
32769
 * The caller must not modify or free the returned value.
32770
 *
32771
 * Various kinds of changes can invalidate the returned value: modifying
32772
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32773
 * If the returned value is needed for a long time, it is best to make a copy
32774
 * of it with ovsdb_datum_clone().
32775
 *
32776
 * This function is rarely useful, since it is easier to access the value
32777
 * directly through the "statistics" member in ovsrec_open_vswitch. */
32778
const struct ovsdb_datum *
32779
ovsrec_open_vswitch_get_statistics(const struct ovsrec_open_vswitch *row,
32780
  enum ovsdb_atomic_type key_type OVS_UNUSED,
32781
  enum ovsdb_atomic_type value_type OVS_UNUSED)
32782
0
{
32783
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32784
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
32785
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_statistics);
32786
0
}
32787
32788
/* Returns the "system_type" column's value from the "Open_vSwitch" table in 'row'
32789
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32790
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32791
 * for a given key than implementing the same operation on the "cooked"
32792
 * form in 'row'.
32793
 *
32794
 * 'key_type' must be OVSDB_TYPE_STRING.
32795
 * (This helps to avoid silent bugs if someone changes system_type's
32796
 * type without updating the caller.)
32797
 *
32798
 * The caller must not modify or free the returned value.
32799
 *
32800
 * Various kinds of changes can invalidate the returned value: modifying
32801
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32802
 * If the returned value is needed for a long time, it is best to make a copy
32803
 * of it with ovsdb_datum_clone().
32804
 *
32805
 * This function is rarely useful, since it is easier to access the value
32806
 * directly through the "system_type" member in ovsrec_open_vswitch. */
32807
const struct ovsdb_datum *
32808
ovsrec_open_vswitch_get_system_type(const struct ovsrec_open_vswitch *row,
32809
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32810
0
{
32811
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32812
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_system_type);
32813
0
}
32814
32815
/* Returns the "system_version" column's value from the "Open_vSwitch" table in 'row'
32816
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
32817
 * ovsdb_datum_find_key() is an easier and more efficient way to search
32818
 * for a given key than implementing the same operation on the "cooked"
32819
 * form in 'row'.
32820
 *
32821
 * 'key_type' must be OVSDB_TYPE_STRING.
32822
 * (This helps to avoid silent bugs if someone changes system_version's
32823
 * type without updating the caller.)
32824
 *
32825
 * The caller must not modify or free the returned value.
32826
 *
32827
 * Various kinds of changes can invalidate the returned value: modifying
32828
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
32829
 * If the returned value is needed for a long time, it is best to make a copy
32830
 * of it with ovsdb_datum_clone().
32831
 *
32832
 * This function is rarely useful, since it is easier to access the value
32833
 * directly through the "system_version" member in ovsrec_open_vswitch. */
32834
const struct ovsdb_datum *
32835
ovsrec_open_vswitch_get_system_version(const struct ovsrec_open_vswitch *row,
32836
  enum ovsdb_atomic_type key_type OVS_UNUSED)
32837
0
{
32838
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
32839
0
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_system_version);
32840
0
}
32841
32842
/* Sets the "bridges" column from the "Open_vSwitch" table in 'row' to
32843
 * the 'bridges' set with 'n_bridges' entries.
32844
 *
32845
 * The caller retains ownership of the arguments. */
32846
void
32847
ovsrec_open_vswitch_set_bridges(const struct ovsrec_open_vswitch *row, struct ovsrec_bridge **bridges, size_t n_bridges)
32848
0
{
32849
0
    struct ovsdb_datum datum;
32850
32851
0
    datum.refcnt = NULL;
32852
32853
0
    datum.n = n_bridges;
32854
0
    datum.keys = n_bridges ? xmalloc(n_bridges * sizeof *datum.keys) : NULL;
32855
0
    datum.values = NULL;
32856
0
    for (size_t i = 0; i < n_bridges; i++) {
32857
0
        datum.keys[i].uuid = bridges[i]->header_.uuid;
32858
0
    }
32859
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_bridges, &datum);
32860
0
}
32861
32862
/* Sets the "cur_cfg" column from the "Open_vSwitch" table in 'row' to
32863
 * 'cur_cfg'.
32864
 *
32865
 * The caller retains ownership of the arguments. */
32866
void
32867
ovsrec_open_vswitch_set_cur_cfg(const struct ovsrec_open_vswitch *row, int64_t cur_cfg)
32868
0
{
32869
0
    struct ovsdb_datum datum;
32870
32871
0
    datum.refcnt = NULL;
32872
32873
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
32874
32875
0
    datum.n = 1;
32876
0
    datum.keys = key;
32877
0
    key->integer = cur_cfg;
32878
0
    datum.values = NULL;
32879
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_cur_cfg, &datum);
32880
0
}
32881
32882
/* Sets the "datapath_types" column from the "Open_vSwitch" table in 'row' to
32883
 * the 'datapath_types' set with 'n_datapath_types' entries.
32884
 *
32885
 * The caller retains ownership of the arguments. */
32886
void
32887
ovsrec_open_vswitch_set_datapath_types(const struct ovsrec_open_vswitch *row, const char **datapath_types, size_t n_datapath_types)
32888
0
{
32889
0
    struct ovsdb_datum datum;
32890
32891
0
    datum.refcnt = NULL;
32892
32893
0
    datum.n = n_datapath_types;
32894
0
    datum.keys = n_datapath_types ? xmalloc(n_datapath_types * sizeof *datum.keys) : NULL;
32895
0
    datum.values = NULL;
32896
0
    for (size_t i = 0; i < n_datapath_types; i++) {
32897
0
        datum.keys[i].s = ovsdb_atom_string_create(datapath_types[i]);
32898
0
    }
32899
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_datapath_types, &datum);
32900
0
}
32901
32902
/* Sets the "datapaths" column from the "Open_vSwitch" table in 'row' to
32903
 * the map with keys 'key_datapaths' and values 'value_datapaths'
32904
 * with 'n_datapaths' entries.
32905
 *
32906
 * The caller retains ownership of the arguments. */
32907
void
32908
ovsrec_open_vswitch_set_datapaths(const struct ovsrec_open_vswitch *row, const char **key_datapaths, struct ovsrec_datapath **value_datapaths, size_t n_datapaths)
32909
0
{
32910
0
    struct ovsdb_datum datum;
32911
32912
0
    datum.refcnt = NULL;
32913
32914
0
    datum.n = n_datapaths;
32915
0
    datum.keys = n_datapaths ? xmalloc(n_datapaths * sizeof *datum.keys) : NULL;
32916
0
    datum.values = xmalloc(n_datapaths * sizeof *datum.values);
32917
0
    for (size_t i = 0; i < n_datapaths; i++) {
32918
0
        datum.keys[i].s = ovsdb_atom_string_create(key_datapaths[i]);
32919
0
        datum.values[i].uuid = value_datapaths[i]->header_.uuid;
32920
0
    }
32921
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_datapaths, &datum);
32922
0
}
32923
32924
/* Sets the "db_version" column from the "Open_vSwitch" table in 'row' to
32925
 * the 'db_version' set.
32926
 *
32927
 * If "db_version" is null, the column will be the empty set,
32928
 * otherwise it will contain the specified value.
32929
 *
32930
 * The caller retains ownership of the arguments. */
32931
void
32932
ovsrec_open_vswitch_set_db_version(const struct ovsrec_open_vswitch *row, const char *db_version)
32933
0
{
32934
0
    struct ovsdb_datum datum;
32935
32936
0
    datum.refcnt = NULL;
32937
32938
0
    if (db_version) {
32939
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
32940
0
        datum.n = 1;
32941
0
        datum.keys = key;
32942
0
        key->s = ovsdb_atom_string_create(db_version);
32943
0
    } else {
32944
0
        datum.n = 0;
32945
0
        datum.keys = NULL;
32946
0
    }
32947
0
    datum.values = NULL;
32948
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_db_version, &datum);
32949
0
}
32950
32951
/* Sets the "dpdk_initialized" column from the "Open_vSwitch" table in 'row' to
32952
 * 'dpdk_initialized'.
32953
 *
32954
 * The caller retains ownership of the arguments. */
32955
void
32956
ovsrec_open_vswitch_set_dpdk_initialized(const struct ovsrec_open_vswitch *row, bool dpdk_initialized)
32957
0
{
32958
0
    struct ovsdb_datum datum;
32959
32960
0
    datum.refcnt = NULL;
32961
32962
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
32963
32964
0
    datum.n = 1;
32965
0
    datum.keys = key;
32966
0
    key->boolean = dpdk_initialized;
32967
0
    datum.values = NULL;
32968
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_dpdk_initialized, &datum);
32969
0
}
32970
32971
/* Sets the "dpdk_version" column from the "Open_vSwitch" table in 'row' to
32972
 * the 'dpdk_version' set.
32973
 *
32974
 * If "dpdk_version" is null, the column will be the empty set,
32975
 * otherwise it will contain the specified value.
32976
 *
32977
 * The caller retains ownership of the arguments. */
32978
void
32979
ovsrec_open_vswitch_set_dpdk_version(const struct ovsrec_open_vswitch *row, const char *dpdk_version)
32980
0
{
32981
0
    struct ovsdb_datum datum;
32982
32983
0
    datum.refcnt = NULL;
32984
32985
0
    if (dpdk_version) {
32986
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
32987
0
        datum.n = 1;
32988
0
        datum.keys = key;
32989
0
        key->s = ovsdb_atom_string_create(dpdk_version);
32990
0
    } else {
32991
0
        datum.n = 0;
32992
0
        datum.keys = NULL;
32993
0
    }
32994
0
    datum.values = NULL;
32995
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_dpdk_version, &datum);
32996
0
}
32997
32998
/* Sets the "external_ids" column's value from the "Open_vSwitch" table in 'row'
32999
 * to 'external_ids'.
33000
 *
33001
 * The caller retains ownership of 'external_ids' and everything in it. */
33002
void
33003
ovsrec_open_vswitch_set_external_ids(const struct ovsrec_open_vswitch *row, const struct smap *external_ids)
33004
0
{
33005
0
    struct ovsdb_datum datum;
33006
33007
0
    if (external_ids) {
33008
0
        ovsdb_datum_from_smap(&datum, external_ids);
33009
0
    } else {
33010
0
        ovsdb_datum_init_empty(&datum);
33011
0
    }
33012
0
    ovsdb_idl_txn_write(&row->header_,
33013
0
                        &ovsrec_open_vswitch_col_external_ids,
33014
0
                        &datum);
33015
0
}
33016
33017
33018
/* Sets the "iface_types" column from the "Open_vSwitch" table in 'row' to
33019
 * the 'iface_types' set with 'n_iface_types' entries.
33020
 *
33021
 * The caller retains ownership of the arguments. */
33022
void
33023
ovsrec_open_vswitch_set_iface_types(const struct ovsrec_open_vswitch *row, const char **iface_types, size_t n_iface_types)
33024
0
{
33025
0
    struct ovsdb_datum datum;
33026
33027
0
    datum.refcnt = NULL;
33028
33029
0
    datum.n = n_iface_types;
33030
0
    datum.keys = n_iface_types ? xmalloc(n_iface_types * sizeof *datum.keys) : NULL;
33031
0
    datum.values = NULL;
33032
0
    for (size_t i = 0; i < n_iface_types; i++) {
33033
0
        datum.keys[i].s = ovsdb_atom_string_create(iface_types[i]);
33034
0
    }
33035
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_iface_types, &datum);
33036
0
}
33037
33038
/* Sets the "manager_options" column from the "Open_vSwitch" table in 'row' to
33039
 * the 'manager_options' set with 'n_manager_options' entries.
33040
 *
33041
 * The caller retains ownership of the arguments. */
33042
void
33043
ovsrec_open_vswitch_set_manager_options(const struct ovsrec_open_vswitch *row, struct ovsrec_manager **manager_options, size_t n_manager_options)
33044
0
{
33045
0
    struct ovsdb_datum datum;
33046
33047
0
    datum.refcnt = NULL;
33048
33049
0
    datum.n = n_manager_options;
33050
0
    datum.keys = n_manager_options ? xmalloc(n_manager_options * sizeof *datum.keys) : NULL;
33051
0
    datum.values = NULL;
33052
0
    for (size_t i = 0; i < n_manager_options; i++) {
33053
0
        datum.keys[i].uuid = manager_options[i]->header_.uuid;
33054
0
    }
33055
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_manager_options, &datum);
33056
0
}
33057
33058
/* Sets the "next_cfg" column from the "Open_vSwitch" table in 'row' to
33059
 * 'next_cfg'.
33060
 *
33061
 * The caller retains ownership of the arguments. */
33062
void
33063
ovsrec_open_vswitch_set_next_cfg(const struct ovsrec_open_vswitch *row, int64_t next_cfg)
33064
0
{
33065
0
    struct ovsdb_datum datum;
33066
33067
0
    datum.refcnt = NULL;
33068
33069
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
33070
33071
0
    datum.n = 1;
33072
0
    datum.keys = key;
33073
0
    key->integer = next_cfg;
33074
0
    datum.values = NULL;
33075
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_next_cfg, &datum);
33076
0
}
33077
33078
/* Sets the "other_config" column's value from the "Open_vSwitch" table in 'row'
33079
 * to 'other_config'.
33080
 *
33081
 * The caller retains ownership of 'other_config' and everything in it. */
33082
void
33083
ovsrec_open_vswitch_set_other_config(const struct ovsrec_open_vswitch *row, const struct smap *other_config)
33084
0
{
33085
0
    struct ovsdb_datum datum;
33086
33087
0
    if (other_config) {
33088
0
        ovsdb_datum_from_smap(&datum, other_config);
33089
0
    } else {
33090
0
        ovsdb_datum_init_empty(&datum);
33091
0
    }
33092
0
    ovsdb_idl_txn_write(&row->header_,
33093
0
                        &ovsrec_open_vswitch_col_other_config,
33094
0
                        &datum);
33095
0
}
33096
33097
33098
/* Sets the "ovs_version" column from the "Open_vSwitch" table in 'row' to
33099
 * the 'ovs_version' set.
33100
 *
33101
 * If "ovs_version" is null, the column will be the empty set,
33102
 * otherwise it will contain the specified value.
33103
 *
33104
 * The caller retains ownership of the arguments. */
33105
void
33106
ovsrec_open_vswitch_set_ovs_version(const struct ovsrec_open_vswitch *row, const char *ovs_version)
33107
0
{
33108
0
    struct ovsdb_datum datum;
33109
33110
0
    datum.refcnt = NULL;
33111
33112
0
    if (ovs_version) {
33113
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
33114
0
        datum.n = 1;
33115
0
        datum.keys = key;
33116
0
        key->s = ovsdb_atom_string_create(ovs_version);
33117
0
    } else {
33118
0
        datum.n = 0;
33119
0
        datum.keys = NULL;
33120
0
    }
33121
0
    datum.values = NULL;
33122
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_ovs_version, &datum);
33123
0
}
33124
33125
/* Sets the "ssl" column from the "Open_vSwitch" table in 'row' to
33126
 * the 'ssl' set.
33127
 *
33128
 * If "ssl" is null, the column will be the empty set,
33129
 * otherwise it will contain the specified value.
33130
 *
33131
 * The caller retains ownership of the arguments. */
33132
void
33133
ovsrec_open_vswitch_set_ssl(const struct ovsrec_open_vswitch *row, const struct ovsrec_ssl *ssl)
33134
0
{
33135
0
    struct ovsdb_datum datum;
33136
33137
0
    datum.refcnt = NULL;
33138
33139
0
    if (ssl) {
33140
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
33141
0
        datum.n = 1;
33142
0
        datum.keys = key;
33143
0
        key->uuid = ssl->header_.uuid;
33144
0
    } else {
33145
0
        datum.n = 0;
33146
0
        datum.keys = NULL;
33147
0
    }
33148
0
    datum.values = NULL;
33149
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_ssl, &datum);
33150
0
}
33151
33152
/* Sets the "statistics" column's value from the "Open_vSwitch" table in 'row'
33153
 * to 'statistics'.
33154
 *
33155
 * The caller retains ownership of 'statistics' and everything in it. */
33156
void
33157
ovsrec_open_vswitch_set_statistics(const struct ovsrec_open_vswitch *row, const struct smap *statistics)
33158
0
{
33159
0
    struct ovsdb_datum datum;
33160
33161
0
    if (statistics) {
33162
0
        ovsdb_datum_from_smap(&datum, statistics);
33163
0
    } else {
33164
0
        ovsdb_datum_init_empty(&datum);
33165
0
    }
33166
0
    ovsdb_idl_txn_write(&row->header_,
33167
0
                        &ovsrec_open_vswitch_col_statistics,
33168
0
                        &datum);
33169
0
}
33170
33171
33172
/* Sets the "system_type" column from the "Open_vSwitch" table in 'row' to
33173
 * the 'system_type' set.
33174
 *
33175
 * If "system_type" is null, the column will be the empty set,
33176
 * otherwise it will contain the specified value.
33177
 *
33178
 * The caller retains ownership of the arguments. */
33179
void
33180
ovsrec_open_vswitch_set_system_type(const struct ovsrec_open_vswitch *row, const char *system_type)
33181
0
{
33182
0
    struct ovsdb_datum datum;
33183
33184
0
    datum.refcnt = NULL;
33185
33186
0
    if (system_type) {
33187
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
33188
0
        datum.n = 1;
33189
0
        datum.keys = key;
33190
0
        key->s = ovsdb_atom_string_create(system_type);
33191
0
    } else {
33192
0
        datum.n = 0;
33193
0
        datum.keys = NULL;
33194
0
    }
33195
0
    datum.values = NULL;
33196
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_system_type, &datum);
33197
0
}
33198
33199
/* Sets the "system_version" column from the "Open_vSwitch" table in 'row' to
33200
 * the 'system_version' set.
33201
 *
33202
 * If "system_version" is null, the column will be the empty set,
33203
 * otherwise it will contain the specified value.
33204
 *
33205
 * The caller retains ownership of the arguments. */
33206
void
33207
ovsrec_open_vswitch_set_system_version(const struct ovsrec_open_vswitch *row, const char *system_version)
33208
0
{
33209
0
    struct ovsdb_datum datum;
33210
33211
0
    datum.refcnt = NULL;
33212
33213
0
    if (system_version) {
33214
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
33215
0
        datum.n = 1;
33216
0
        datum.keys = key;
33217
0
        key->s = ovsdb_atom_string_create(system_version);
33218
0
    } else {
33219
0
        datum.n = 0;
33220
0
        datum.keys = NULL;
33221
0
    }
33222
0
    datum.values = NULL;
33223
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_col_system_version, &datum);
33224
0
}
33225
33226
/* Adds the value 'new_value' to the "bridges" set column from the "Open_vSwitch" table
33227
 * in 'row'.
33228
 *
33229
 */
33230
void
33231
ovsrec_open_vswitch_update_bridges_addvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_bridge *new_value)
33232
0
{
33233
0
    struct ovsdb_datum *datum;
33234
33235
0
    datum = xmalloc(sizeof *datum);
33236
0
    datum->n = 1;
33237
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33238
0
    datum->values = NULL;
33239
0
    datum->refcnt = NULL;
33240
33241
0
    datum->keys[0].uuid = new_value->header_.uuid;
33242
33243
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
33244
0
                                    &ovsrec_open_vswitch_col_bridges,
33245
0
                                    datum);
33246
0
}
33247
33248
/* Deletes the value 'delete_value' from the "bridges" set column from the
33249
 * "Open_vSwitch" table in 'row'.
33250
 *
33251
 */
33252
void
33253
ovsrec_open_vswitch_update_bridges_delvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_bridge *delete_value)
33254
0
{
33255
0
    struct ovsdb_datum *datum;
33256
33257
0
    datum = xmalloc(sizeof *datum);
33258
0
    datum->n = 1;
33259
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33260
0
    datum->values = NULL;
33261
0
    datum->refcnt = NULL;
33262
33263
0
    datum->keys[0].uuid = delete_value->header_.uuid;
33264
33265
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
33266
0
                                    &ovsrec_open_vswitch_col_bridges,
33267
0
                                    datum);
33268
0
}
33269
33270
/* Adds the value 'new_value' to the "datapath_types" set column from the "Open_vSwitch" table
33271
 * in 'row'.
33272
 *
33273
 */
33274
void
33275
ovsrec_open_vswitch_update_datapath_types_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
33276
0
{
33277
0
    struct ovsdb_datum *datum;
33278
33279
0
    datum = xmalloc(sizeof *datum);
33280
0
    datum->n = 1;
33281
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33282
0
    datum->values = NULL;
33283
0
    datum->refcnt = NULL;
33284
33285
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
33286
33287
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
33288
0
                                    &ovsrec_open_vswitch_col_datapath_types,
33289
0
                                    datum);
33290
0
}
33291
33292
/* Deletes the value 'delete_value' from the "datapath_types" set column from the
33293
 * "Open_vSwitch" table in 'row'.
33294
 *
33295
 */
33296
void
33297
ovsrec_open_vswitch_update_datapath_types_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
33298
0
{
33299
0
    struct ovsdb_datum *datum;
33300
33301
0
    datum = xmalloc(sizeof *datum);
33302
0
    datum->n = 1;
33303
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33304
0
    datum->values = NULL;
33305
0
    datum->refcnt = NULL;
33306
33307
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
33308
33309
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
33310
0
                                    &ovsrec_open_vswitch_col_datapath_types,
33311
0
                                    datum);
33312
0
}
33313
33314
/* Sets an element of the "datapaths" map column from the "Open_vSwitch" table in 'row'
33315
 * to 'new_value' given the key value 'new_key'.
33316
 *
33317
 */
33318
void
33319
ovsrec_open_vswitch_update_datapaths_setkey(const struct ovsrec_open_vswitch *row, const char *new_key, const struct ovsrec_datapath *new_value)
33320
0
{
33321
0
    struct ovsdb_datum *datum;
33322
33323
0
    datum = xmalloc(sizeof *datum);
33324
0
    datum->n = 1;
33325
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
33326
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
33327
0
    datum->refcnt = NULL;
33328
33329
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
33330
0
    datum->values[0].uuid = new_value->header_.uuid;
33331
33332
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
33333
0
                                    &ovsrec_open_vswitch_col_datapaths,
33334
0
                                    datum);
33335
0
}
33336
33337
/* Deletes an element of the "datapaths" map column from the "Open_vSwitch" table in 'row'
33338
 * given the key value 'delete_key'.
33339
 *
33340
 */
33341
void
33342
ovsrec_open_vswitch_update_datapaths_delkey(const struct ovsrec_open_vswitch *row, const char *delete_key)
33343
0
{
33344
0
    struct ovsdb_datum *datum;
33345
33346
0
    datum = xmalloc(sizeof *datum);
33347
0
    datum->n = 1;
33348
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
33349
0
    datum->values = NULL;
33350
0
    datum->refcnt = NULL;
33351
33352
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
33353
33354
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
33355
0
                                    &ovsrec_open_vswitch_col_datapaths,
33356
0
                                    datum);
33357
0
}
33358
33359
/* Adds the value 'new_value' to the "db_version" set column from the "Open_vSwitch" table
33360
 * in 'row'.
33361
 *
33362
 */
33363
void
33364
ovsrec_open_vswitch_update_db_version_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
33365
0
{
33366
0
    struct ovsdb_datum *datum;
33367
33368
0
    datum = xmalloc(sizeof *datum);
33369
0
    datum->n = 1;
33370
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33371
0
    datum->values = NULL;
33372
0
    datum->refcnt = NULL;
33373
33374
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
33375
33376
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
33377
0
                                    &ovsrec_open_vswitch_col_db_version,
33378
0
                                    datum);
33379
0
}
33380
33381
/* Deletes the value 'delete_value' from the "db_version" set column from the
33382
 * "Open_vSwitch" table in 'row'.
33383
 *
33384
 */
33385
void
33386
ovsrec_open_vswitch_update_db_version_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
33387
0
{
33388
0
    struct ovsdb_datum *datum;
33389
33390
0
    datum = xmalloc(sizeof *datum);
33391
0
    datum->n = 1;
33392
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33393
0
    datum->values = NULL;
33394
0
    datum->refcnt = NULL;
33395
33396
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
33397
33398
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
33399
0
                                    &ovsrec_open_vswitch_col_db_version,
33400
0
                                    datum);
33401
0
}
33402
33403
/* Adds the value 'new_value' to the "dpdk_version" set column from the "Open_vSwitch" table
33404
 * in 'row'.
33405
 *
33406
 */
33407
void
33408
ovsrec_open_vswitch_update_dpdk_version_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
33409
0
{
33410
0
    struct ovsdb_datum *datum;
33411
33412
0
    datum = xmalloc(sizeof *datum);
33413
0
    datum->n = 1;
33414
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33415
0
    datum->values = NULL;
33416
0
    datum->refcnt = NULL;
33417
33418
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
33419
33420
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
33421
0
                                    &ovsrec_open_vswitch_col_dpdk_version,
33422
0
                                    datum);
33423
0
}
33424
33425
/* Deletes the value 'delete_value' from the "dpdk_version" set column from the
33426
 * "Open_vSwitch" table in 'row'.
33427
 *
33428
 */
33429
void
33430
ovsrec_open_vswitch_update_dpdk_version_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
33431
0
{
33432
0
    struct ovsdb_datum *datum;
33433
33434
0
    datum = xmalloc(sizeof *datum);
33435
0
    datum->n = 1;
33436
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33437
0
    datum->values = NULL;
33438
0
    datum->refcnt = NULL;
33439
33440
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
33441
33442
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
33443
0
                                    &ovsrec_open_vswitch_col_dpdk_version,
33444
0
                                    datum);
33445
0
}
33446
33447
/* Sets an element of the "external_ids" map column from the "Open_vSwitch" table in 'row'
33448
 * to 'new_value' given the key value 'new_key'.
33449
 *
33450
 */
33451
void
33452
ovsrec_open_vswitch_update_external_ids_setkey(const struct ovsrec_open_vswitch *row, const char *new_key, const char *new_value)
33453
0
{
33454
0
    struct ovsdb_datum *datum;
33455
33456
0
    datum = xmalloc(sizeof *datum);
33457
0
    datum->n = 1;
33458
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
33459
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
33460
0
    datum->refcnt = NULL;
33461
33462
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
33463
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
33464
33465
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
33466
0
                                    &ovsrec_open_vswitch_col_external_ids,
33467
0
                                    datum);
33468
0
}
33469
33470
/* Deletes an element of the "external_ids" map column from the "Open_vSwitch" table in 'row'
33471
 * given the key value 'delete_key'.
33472
 *
33473
 */
33474
void
33475
ovsrec_open_vswitch_update_external_ids_delkey(const struct ovsrec_open_vswitch *row, const char *delete_key)
33476
0
{
33477
0
    struct ovsdb_datum *datum;
33478
33479
0
    datum = xmalloc(sizeof *datum);
33480
0
    datum->n = 1;
33481
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
33482
0
    datum->values = NULL;
33483
0
    datum->refcnt = NULL;
33484
33485
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
33486
33487
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
33488
0
                                    &ovsrec_open_vswitch_col_external_ids,
33489
0
                                    datum);
33490
0
}
33491
33492
/* Adds the value 'new_value' to the "iface_types" set column from the "Open_vSwitch" table
33493
 * in 'row'.
33494
 *
33495
 */
33496
void
33497
ovsrec_open_vswitch_update_iface_types_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
33498
0
{
33499
0
    struct ovsdb_datum *datum;
33500
33501
0
    datum = xmalloc(sizeof *datum);
33502
0
    datum->n = 1;
33503
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33504
0
    datum->values = NULL;
33505
0
    datum->refcnt = NULL;
33506
33507
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
33508
33509
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
33510
0
                                    &ovsrec_open_vswitch_col_iface_types,
33511
0
                                    datum);
33512
0
}
33513
33514
/* Deletes the value 'delete_value' from the "iface_types" set column from the
33515
 * "Open_vSwitch" table in 'row'.
33516
 *
33517
 */
33518
void
33519
ovsrec_open_vswitch_update_iface_types_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
33520
0
{
33521
0
    struct ovsdb_datum *datum;
33522
33523
0
    datum = xmalloc(sizeof *datum);
33524
0
    datum->n = 1;
33525
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33526
0
    datum->values = NULL;
33527
0
    datum->refcnt = NULL;
33528
33529
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
33530
33531
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
33532
0
                                    &ovsrec_open_vswitch_col_iface_types,
33533
0
                                    datum);
33534
0
}
33535
33536
/* Adds the value 'new_value' to the "manager_options" set column from the "Open_vSwitch" table
33537
 * in 'row'.
33538
 *
33539
 */
33540
void
33541
ovsrec_open_vswitch_update_manager_options_addvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_manager *new_value)
33542
0
{
33543
0
    struct ovsdb_datum *datum;
33544
33545
0
    datum = xmalloc(sizeof *datum);
33546
0
    datum->n = 1;
33547
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33548
0
    datum->values = NULL;
33549
0
    datum->refcnt = NULL;
33550
33551
0
    datum->keys[0].uuid = new_value->header_.uuid;
33552
33553
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
33554
0
                                    &ovsrec_open_vswitch_col_manager_options,
33555
0
                                    datum);
33556
0
}
33557
33558
/* Deletes the value 'delete_value' from the "manager_options" set column from the
33559
 * "Open_vSwitch" table in 'row'.
33560
 *
33561
 */
33562
void
33563
ovsrec_open_vswitch_update_manager_options_delvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_manager *delete_value)
33564
0
{
33565
0
    struct ovsdb_datum *datum;
33566
33567
0
    datum = xmalloc(sizeof *datum);
33568
0
    datum->n = 1;
33569
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33570
0
    datum->values = NULL;
33571
0
    datum->refcnt = NULL;
33572
33573
0
    datum->keys[0].uuid = delete_value->header_.uuid;
33574
33575
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
33576
0
                                    &ovsrec_open_vswitch_col_manager_options,
33577
0
                                    datum);
33578
0
}
33579
33580
/* Sets an element of the "other_config" map column from the "Open_vSwitch" table in 'row'
33581
 * to 'new_value' given the key value 'new_key'.
33582
 *
33583
 */
33584
void
33585
ovsrec_open_vswitch_update_other_config_setkey(const struct ovsrec_open_vswitch *row, const char *new_key, const char *new_value)
33586
0
{
33587
0
    struct ovsdb_datum *datum;
33588
33589
0
    datum = xmalloc(sizeof *datum);
33590
0
    datum->n = 1;
33591
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
33592
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
33593
0
    datum->refcnt = NULL;
33594
33595
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
33596
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
33597
33598
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
33599
0
                                    &ovsrec_open_vswitch_col_other_config,
33600
0
                                    datum);
33601
0
}
33602
33603
/* Deletes an element of the "other_config" map column from the "Open_vSwitch" table in 'row'
33604
 * given the key value 'delete_key'.
33605
 *
33606
 */
33607
void
33608
ovsrec_open_vswitch_update_other_config_delkey(const struct ovsrec_open_vswitch *row, const char *delete_key)
33609
0
{
33610
0
    struct ovsdb_datum *datum;
33611
33612
0
    datum = xmalloc(sizeof *datum);
33613
0
    datum->n = 1;
33614
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
33615
0
    datum->values = NULL;
33616
0
    datum->refcnt = NULL;
33617
33618
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
33619
33620
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
33621
0
                                    &ovsrec_open_vswitch_col_other_config,
33622
0
                                    datum);
33623
0
}
33624
33625
/* Adds the value 'new_value' to the "ovs_version" set column from the "Open_vSwitch" table
33626
 * in 'row'.
33627
 *
33628
 */
33629
void
33630
ovsrec_open_vswitch_update_ovs_version_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
33631
0
{
33632
0
    struct ovsdb_datum *datum;
33633
33634
0
    datum = xmalloc(sizeof *datum);
33635
0
    datum->n = 1;
33636
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33637
0
    datum->values = NULL;
33638
0
    datum->refcnt = NULL;
33639
33640
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
33641
33642
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
33643
0
                                    &ovsrec_open_vswitch_col_ovs_version,
33644
0
                                    datum);
33645
0
}
33646
33647
/* Deletes the value 'delete_value' from the "ovs_version" set column from the
33648
 * "Open_vSwitch" table in 'row'.
33649
 *
33650
 */
33651
void
33652
ovsrec_open_vswitch_update_ovs_version_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
33653
0
{
33654
0
    struct ovsdb_datum *datum;
33655
33656
0
    datum = xmalloc(sizeof *datum);
33657
0
    datum->n = 1;
33658
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33659
0
    datum->values = NULL;
33660
0
    datum->refcnt = NULL;
33661
33662
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
33663
33664
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
33665
0
                                    &ovsrec_open_vswitch_col_ovs_version,
33666
0
                                    datum);
33667
0
}
33668
33669
/* Adds the value 'new_value' to the "ssl" set column from the "Open_vSwitch" table
33670
 * in 'row'.
33671
 *
33672
 */
33673
void
33674
ovsrec_open_vswitch_update_ssl_addvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_ssl *new_value)
33675
0
{
33676
0
    struct ovsdb_datum *datum;
33677
33678
0
    datum = xmalloc(sizeof *datum);
33679
0
    datum->n = 1;
33680
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33681
0
    datum->values = NULL;
33682
0
    datum->refcnt = NULL;
33683
33684
0
    datum->keys[0].uuid = new_value->header_.uuid;
33685
33686
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
33687
0
                                    &ovsrec_open_vswitch_col_ssl,
33688
0
                                    datum);
33689
0
}
33690
33691
/* Deletes the value 'delete_value' from the "ssl" set column from the
33692
 * "Open_vSwitch" table in 'row'.
33693
 *
33694
 */
33695
void
33696
ovsrec_open_vswitch_update_ssl_delvalue(const struct ovsrec_open_vswitch *row, const struct ovsrec_ssl *delete_value)
33697
0
{
33698
0
    struct ovsdb_datum *datum;
33699
33700
0
    datum = xmalloc(sizeof *datum);
33701
0
    datum->n = 1;
33702
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33703
0
    datum->values = NULL;
33704
0
    datum->refcnt = NULL;
33705
33706
0
    datum->keys[0].uuid = delete_value->header_.uuid;
33707
33708
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
33709
0
                                    &ovsrec_open_vswitch_col_ssl,
33710
0
                                    datum);
33711
0
}
33712
33713
/* Sets an element of the "statistics" map column from the "Open_vSwitch" table in 'row'
33714
 * to 'new_value' given the key value 'new_key'.
33715
 *
33716
 */
33717
void
33718
ovsrec_open_vswitch_update_statistics_setkey(const struct ovsrec_open_vswitch *row, const char *new_key, const char *new_value)
33719
0
{
33720
0
    struct ovsdb_datum *datum;
33721
33722
0
    datum = xmalloc(sizeof *datum);
33723
0
    datum->n = 1;
33724
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
33725
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
33726
0
    datum->refcnt = NULL;
33727
33728
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
33729
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
33730
33731
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
33732
0
                                    &ovsrec_open_vswitch_col_statistics,
33733
0
                                    datum);
33734
0
}
33735
33736
/* Deletes an element of the "statistics" map column from the "Open_vSwitch" table in 'row'
33737
 * given the key value 'delete_key'.
33738
 *
33739
 */
33740
void
33741
ovsrec_open_vswitch_update_statistics_delkey(const struct ovsrec_open_vswitch *row, const char *delete_key)
33742
0
{
33743
0
    struct ovsdb_datum *datum;
33744
33745
0
    datum = xmalloc(sizeof *datum);
33746
0
    datum->n = 1;
33747
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
33748
0
    datum->values = NULL;
33749
0
    datum->refcnt = NULL;
33750
33751
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
33752
33753
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
33754
0
                                    &ovsrec_open_vswitch_col_statistics,
33755
0
                                    datum);
33756
0
}
33757
33758
/* Adds the value 'new_value' to the "system_type" set column from the "Open_vSwitch" table
33759
 * in 'row'.
33760
 *
33761
 */
33762
void
33763
ovsrec_open_vswitch_update_system_type_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
33764
0
{
33765
0
    struct ovsdb_datum *datum;
33766
33767
0
    datum = xmalloc(sizeof *datum);
33768
0
    datum->n = 1;
33769
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33770
0
    datum->values = NULL;
33771
0
    datum->refcnt = NULL;
33772
33773
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
33774
33775
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
33776
0
                                    &ovsrec_open_vswitch_col_system_type,
33777
0
                                    datum);
33778
0
}
33779
33780
/* Deletes the value 'delete_value' from the "system_type" set column from the
33781
 * "Open_vSwitch" table in 'row'.
33782
 *
33783
 */
33784
void
33785
ovsrec_open_vswitch_update_system_type_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
33786
0
{
33787
0
    struct ovsdb_datum *datum;
33788
33789
0
    datum = xmalloc(sizeof *datum);
33790
0
    datum->n = 1;
33791
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33792
0
    datum->values = NULL;
33793
0
    datum->refcnt = NULL;
33794
33795
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
33796
33797
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
33798
0
                                    &ovsrec_open_vswitch_col_system_type,
33799
0
                                    datum);
33800
0
}
33801
33802
/* Adds the value 'new_value' to the "system_version" set column from the "Open_vSwitch" table
33803
 * in 'row'.
33804
 *
33805
 */
33806
void
33807
ovsrec_open_vswitch_update_system_version_addvalue(const struct ovsrec_open_vswitch *row, const char *new_value)
33808
0
{
33809
0
    struct ovsdb_datum *datum;
33810
33811
0
    datum = xmalloc(sizeof *datum);
33812
0
    datum->n = 1;
33813
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33814
0
    datum->values = NULL;
33815
0
    datum->refcnt = NULL;
33816
33817
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
33818
33819
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
33820
0
                                    &ovsrec_open_vswitch_col_system_version,
33821
0
                                    datum);
33822
0
}
33823
33824
/* Deletes the value 'delete_value' from the "system_version" set column from the
33825
 * "Open_vSwitch" table in 'row'.
33826
 *
33827
 */
33828
void
33829
ovsrec_open_vswitch_update_system_version_delvalue(const struct ovsrec_open_vswitch *row, const char *delete_value)
33830
0
{
33831
0
    struct ovsdb_datum *datum;
33832
33833
0
    datum = xmalloc(sizeof *datum);
33834
0
    datum->n = 1;
33835
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
33836
0
    datum->values = NULL;
33837
0
    datum->refcnt = NULL;
33838
33839
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
33840
33841
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
33842
0
                                    &ovsrec_open_vswitch_col_system_version,
33843
0
                                    datum);
33844
0
}
33845
33846
/* Sets the "bridges" column from the "Open_vSwitch" table in 'row' to
33847
 * the 'bridges' set with 'n_bridges' entries.
33848
 *
33849
 * The caller retains ownership of the arguments. */
33850
void
33851
ovsrec_open_vswitch_add_clause_bridges(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **bridges, size_t n_bridges)
33852
0
{
33853
0
    struct ovsdb_datum datum;
33854
33855
0
    datum.refcnt = NULL;
33856
0
    datum.n = n_bridges;
33857
0
    datum.keys = n_bridges ? xmalloc(n_bridges * sizeof *datum.keys) : NULL;
33858
0
    datum.values = NULL;
33859
0
    for (size_t i = 0; i < n_bridges; i++) {
33860
0
        datum.keys[i].uuid = *bridges[i];
33861
0
    }
33862
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_bridges.type);
33863
0
    ovsdb_idl_condition_add_clause(cond,
33864
0
                          function,
33865
0
                          &ovsrec_open_vswitch_col_bridges,
33866
0
                          &datum);
33867
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_bridges.type);
33868
0
}
33869
33870
/* Sets the "cur_cfg" column from the "Open_vSwitch" table in 'row' to
33871
 * 'cur_cfg'.
33872
 *
33873
 * The caller retains ownership of the arguments. */
33874
void
33875
ovsrec_open_vswitch_add_clause_cur_cfg(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t cur_cfg)
33876
0
{
33877
0
    struct ovsdb_datum datum;
33878
33879
0
    datum.refcnt = NULL;
33880
33881
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
33882
33883
0
    datum.n = 1;
33884
0
    datum.keys = key;
33885
0
    key->integer = cur_cfg;
33886
0
    datum.values = NULL;
33887
0
    ovsdb_idl_condition_add_clause(cond,
33888
0
                          function,
33889
0
                          &ovsrec_open_vswitch_col_cur_cfg,
33890
0
                          &datum);
33891
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_cur_cfg.type);
33892
0
}
33893
33894
/* Sets the "datapath_types" column from the "Open_vSwitch" table in 'row' to
33895
 * the 'datapath_types' set with 'n_datapath_types' entries.
33896
 *
33897
 * The caller retains ownership of the arguments. */
33898
void
33899
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)
33900
0
{
33901
0
    struct ovsdb_datum datum;
33902
33903
0
    datum.refcnt = NULL;
33904
0
    datum.n = n_datapath_types;
33905
0
    datum.keys = n_datapath_types ? xmalloc(n_datapath_types * sizeof *datum.keys) : NULL;
33906
0
    datum.values = NULL;
33907
0
    for (size_t i = 0; i < n_datapath_types; i++) {
33908
0
        datum.keys[i].s = ovsdb_atom_string_create(datapath_types[i]);
33909
0
    }
33910
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_datapath_types.type);
33911
0
    ovsdb_idl_condition_add_clause(cond,
33912
0
                          function,
33913
0
                          &ovsrec_open_vswitch_col_datapath_types,
33914
0
                          &datum);
33915
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_datapath_types.type);
33916
0
}
33917
33918
/* Sets the "datapaths" column from the "Open_vSwitch" table in 'row' to
33919
 * the map with keys 'key_datapaths' and values 'value_datapaths'
33920
 * with 'n_datapaths' entries.
33921
 *
33922
 * The caller retains ownership of the arguments. */
33923
void
33924
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)
33925
0
{
33926
0
    struct ovsdb_datum datum;
33927
33928
0
    datum.refcnt = NULL;
33929
0
    datum.n = n_datapaths;
33930
0
    datum.keys = n_datapaths ? xmalloc(n_datapaths * sizeof *datum.keys) : NULL;
33931
0
    datum.values = xmalloc(n_datapaths * sizeof *datum.values);
33932
0
    for (size_t i = 0; i < n_datapaths; i++) {
33933
0
        datum.keys[i].s = ovsdb_atom_string_create(key_datapaths[i]);
33934
0
        datum.values[i].uuid = *value_datapaths[i];
33935
0
    }
33936
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_datapaths.type);
33937
0
    ovsdb_idl_condition_add_clause(cond,
33938
0
                          function,
33939
0
                          &ovsrec_open_vswitch_col_datapaths,
33940
0
                          &datum);
33941
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_datapaths.type);
33942
0
}
33943
33944
/* Sets the "db_version" column from the "Open_vSwitch" table in 'row' to
33945
 * the 'db_version' set.
33946
 *
33947
 * If "db_version" is null, the column will be the empty set,
33948
 * otherwise it will contain the specified value.
33949
 *
33950
 * The caller retains ownership of the arguments. */
33951
void
33952
ovsrec_open_vswitch_add_clause_db_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *db_version)
33953
0
{
33954
0
    struct ovsdb_datum datum;
33955
33956
0
    datum.refcnt = NULL;
33957
33958
0
    if (db_version) {
33959
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
33960
0
        datum.n = 1;
33961
0
        datum.keys = key;
33962
0
        key->s = ovsdb_atom_string_create(db_version);
33963
0
    } else {
33964
0
        datum.n = 0;
33965
0
        datum.keys = NULL;
33966
0
    }
33967
0
    datum.values = NULL;
33968
0
    ovsdb_idl_condition_add_clause(cond,
33969
0
                          function,
33970
0
                          &ovsrec_open_vswitch_col_db_version,
33971
0
                          &datum);
33972
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_db_version.type);
33973
0
}
33974
33975
/* Sets the "dpdk_initialized" column from the "Open_vSwitch" table in 'row' to
33976
 * 'dpdk_initialized'.
33977
 *
33978
 * The caller retains ownership of the arguments. */
33979
void
33980
ovsrec_open_vswitch_add_clause_dpdk_initialized(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool dpdk_initialized)
33981
0
{
33982
0
    struct ovsdb_datum datum;
33983
33984
0
    datum.refcnt = NULL;
33985
33986
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
33987
33988
0
    datum.n = 1;
33989
0
    datum.keys = key;
33990
0
    key->boolean = dpdk_initialized;
33991
0
    datum.values = NULL;
33992
0
    ovsdb_idl_condition_add_clause(cond,
33993
0
                          function,
33994
0
                          &ovsrec_open_vswitch_col_dpdk_initialized,
33995
0
                          &datum);
33996
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_dpdk_initialized.type);
33997
0
}
33998
33999
/* Sets the "dpdk_version" column from the "Open_vSwitch" table in 'row' to
34000
 * the 'dpdk_version' set.
34001
 *
34002
 * If "dpdk_version" is null, the column will be the empty set,
34003
 * otherwise it will contain the specified value.
34004
 *
34005
 * The caller retains ownership of the arguments. */
34006
void
34007
ovsrec_open_vswitch_add_clause_dpdk_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *dpdk_version)
34008
0
{
34009
0
    struct ovsdb_datum datum;
34010
34011
0
    datum.refcnt = NULL;
34012
34013
0
    if (dpdk_version) {
34014
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
34015
0
        datum.n = 1;
34016
0
        datum.keys = key;
34017
0
        key->s = ovsdb_atom_string_create(dpdk_version);
34018
0
    } else {
34019
0
        datum.n = 0;
34020
0
        datum.keys = NULL;
34021
0
    }
34022
0
    datum.values = NULL;
34023
0
    ovsdb_idl_condition_add_clause(cond,
34024
0
                          function,
34025
0
                          &ovsrec_open_vswitch_col_dpdk_version,
34026
0
                          &datum);
34027
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_dpdk_version.type);
34028
0
}
34029
34030
/* Sets the "external_ids" column's value from the "Open_vSwitch" table in 'row'
34031
 * to 'external_ids'.
34032
 *
34033
 * The caller retains ownership of 'external_ids' and everything in it. */
34034
void
34035
ovsrec_open_vswitch_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
34036
0
{
34037
0
    struct ovsdb_datum datum;
34038
34039
0
    if (external_ids) {
34040
0
        ovsdb_datum_from_smap(&datum, external_ids);
34041
0
    } else {
34042
0
        ovsdb_datum_init_empty(&datum);
34043
0
    }
34044
34045
0
    ovsdb_idl_condition_add_clause(cond,
34046
0
                                   function,
34047
0
                                   &ovsrec_open_vswitch_col_external_ids,
34048
0
                                   &datum);
34049
34050
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_external_ids.type);
34051
0
}
34052
34053
34054
/* Sets the "iface_types" column from the "Open_vSwitch" table in 'row' to
34055
 * the 'iface_types' set with 'n_iface_types' entries.
34056
 *
34057
 * The caller retains ownership of the arguments. */
34058
void
34059
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)
34060
0
{
34061
0
    struct ovsdb_datum datum;
34062
34063
0
    datum.refcnt = NULL;
34064
0
    datum.n = n_iface_types;
34065
0
    datum.keys = n_iface_types ? xmalloc(n_iface_types * sizeof *datum.keys) : NULL;
34066
0
    datum.values = NULL;
34067
0
    for (size_t i = 0; i < n_iface_types; i++) {
34068
0
        datum.keys[i].s = ovsdb_atom_string_create(iface_types[i]);
34069
0
    }
34070
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_iface_types.type);
34071
0
    ovsdb_idl_condition_add_clause(cond,
34072
0
                          function,
34073
0
                          &ovsrec_open_vswitch_col_iface_types,
34074
0
                          &datum);
34075
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_iface_types.type);
34076
0
}
34077
34078
/* Sets the "manager_options" column from the "Open_vSwitch" table in 'row' to
34079
 * the 'manager_options' set with 'n_manager_options' entries.
34080
 *
34081
 * The caller retains ownership of the arguments. */
34082
void
34083
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)
34084
0
{
34085
0
    struct ovsdb_datum datum;
34086
34087
0
    datum.refcnt = NULL;
34088
0
    datum.n = n_manager_options;
34089
0
    datum.keys = n_manager_options ? xmalloc(n_manager_options * sizeof *datum.keys) : NULL;
34090
0
    datum.values = NULL;
34091
0
    for (size_t i = 0; i < n_manager_options; i++) {
34092
0
        datum.keys[i].uuid = *manager_options[i];
34093
0
    }
34094
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_manager_options.type);
34095
0
    ovsdb_idl_condition_add_clause(cond,
34096
0
                          function,
34097
0
                          &ovsrec_open_vswitch_col_manager_options,
34098
0
                          &datum);
34099
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_manager_options.type);
34100
0
}
34101
34102
/* Sets the "next_cfg" column from the "Open_vSwitch" table in 'row' to
34103
 * 'next_cfg'.
34104
 *
34105
 * The caller retains ownership of the arguments. */
34106
void
34107
ovsrec_open_vswitch_add_clause_next_cfg(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t next_cfg)
34108
0
{
34109
0
    struct ovsdb_datum datum;
34110
34111
0
    datum.refcnt = NULL;
34112
34113
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
34114
34115
0
    datum.n = 1;
34116
0
    datum.keys = key;
34117
0
    key->integer = next_cfg;
34118
0
    datum.values = NULL;
34119
0
    ovsdb_idl_condition_add_clause(cond,
34120
0
                          function,
34121
0
                          &ovsrec_open_vswitch_col_next_cfg,
34122
0
                          &datum);
34123
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_next_cfg.type);
34124
0
}
34125
34126
/* Sets the "other_config" column's value from the "Open_vSwitch" table in 'row'
34127
 * to 'other_config'.
34128
 *
34129
 * The caller retains ownership of 'other_config' and everything in it. */
34130
void
34131
ovsrec_open_vswitch_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
34132
0
{
34133
0
    struct ovsdb_datum datum;
34134
34135
0
    if (other_config) {
34136
0
        ovsdb_datum_from_smap(&datum, other_config);
34137
0
    } else {
34138
0
        ovsdb_datum_init_empty(&datum);
34139
0
    }
34140
34141
0
    ovsdb_idl_condition_add_clause(cond,
34142
0
                                   function,
34143
0
                                   &ovsrec_open_vswitch_col_other_config,
34144
0
                                   &datum);
34145
34146
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_other_config.type);
34147
0
}
34148
34149
34150
/* Sets the "ovs_version" column from the "Open_vSwitch" table in 'row' to
34151
 * the 'ovs_version' set.
34152
 *
34153
 * If "ovs_version" is null, the column will be the empty set,
34154
 * otherwise it will contain the specified value.
34155
 *
34156
 * The caller retains ownership of the arguments. */
34157
void
34158
ovsrec_open_vswitch_add_clause_ovs_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *ovs_version)
34159
0
{
34160
0
    struct ovsdb_datum datum;
34161
34162
0
    datum.refcnt = NULL;
34163
34164
0
    if (ovs_version) {
34165
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
34166
0
        datum.n = 1;
34167
0
        datum.keys = key;
34168
0
        key->s = ovsdb_atom_string_create(ovs_version);
34169
0
    } else {
34170
0
        datum.n = 0;
34171
0
        datum.keys = NULL;
34172
0
    }
34173
0
    datum.values = NULL;
34174
0
    ovsdb_idl_condition_add_clause(cond,
34175
0
                          function,
34176
0
                          &ovsrec_open_vswitch_col_ovs_version,
34177
0
                          &datum);
34178
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_ovs_version.type);
34179
0
}
34180
34181
/* Sets the "ssl" column from the "Open_vSwitch" table in 'row' to
34182
 * the 'ssl' set.
34183
 *
34184
 * If "ssl" is null, the column will be the empty set,
34185
 * otherwise it will contain the specified value.
34186
 *
34187
 * The caller retains ownership of the arguments. */
34188
void
34189
ovsrec_open_vswitch_add_clause_ssl(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *ssl)
34190
0
{
34191
0
    struct ovsdb_datum datum;
34192
34193
0
    datum.refcnt = NULL;
34194
34195
0
    if (ssl) {
34196
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
34197
0
        datum.n = 1;
34198
0
        datum.keys = key;
34199
0
        key->uuid = *ssl;
34200
0
    } else {
34201
0
        datum.n = 0;
34202
0
        datum.keys = NULL;
34203
0
    }
34204
0
    datum.values = NULL;
34205
0
    ovsdb_idl_condition_add_clause(cond,
34206
0
                          function,
34207
0
                          &ovsrec_open_vswitch_col_ssl,
34208
0
                          &datum);
34209
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_ssl.type);
34210
0
}
34211
34212
/* Sets the "statistics" column's value from the "Open_vSwitch" table in 'row'
34213
 * to 'statistics'.
34214
 *
34215
 * The caller retains ownership of 'statistics' and everything in it. */
34216
void
34217
ovsrec_open_vswitch_add_clause_statistics(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *statistics)
34218
0
{
34219
0
    struct ovsdb_datum datum;
34220
34221
0
    if (statistics) {
34222
0
        ovsdb_datum_from_smap(&datum, statistics);
34223
0
    } else {
34224
0
        ovsdb_datum_init_empty(&datum);
34225
0
    }
34226
34227
0
    ovsdb_idl_condition_add_clause(cond,
34228
0
                                   function,
34229
0
                                   &ovsrec_open_vswitch_col_statistics,
34230
0
                                   &datum);
34231
34232
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_statistics.type);
34233
0
}
34234
34235
34236
/* Sets the "system_type" column from the "Open_vSwitch" table in 'row' to
34237
 * the 'system_type' set.
34238
 *
34239
 * If "system_type" is null, the column will be the empty set,
34240
 * otherwise it will contain the specified value.
34241
 *
34242
 * The caller retains ownership of the arguments. */
34243
void
34244
ovsrec_open_vswitch_add_clause_system_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *system_type)
34245
0
{
34246
0
    struct ovsdb_datum datum;
34247
34248
0
    datum.refcnt = NULL;
34249
34250
0
    if (system_type) {
34251
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
34252
0
        datum.n = 1;
34253
0
        datum.keys = key;
34254
0
        key->s = ovsdb_atom_string_create(system_type);
34255
0
    } else {
34256
0
        datum.n = 0;
34257
0
        datum.keys = NULL;
34258
0
    }
34259
0
    datum.values = NULL;
34260
0
    ovsdb_idl_condition_add_clause(cond,
34261
0
                          function,
34262
0
                          &ovsrec_open_vswitch_col_system_type,
34263
0
                          &datum);
34264
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_system_type.type);
34265
0
}
34266
34267
/* Sets the "system_version" column from the "Open_vSwitch" table in 'row' to
34268
 * the 'system_version' set.
34269
 *
34270
 * If "system_version" is null, the column will be the empty set,
34271
 * otherwise it will contain the specified value.
34272
 *
34273
 * The caller retains ownership of the arguments. */
34274
void
34275
ovsrec_open_vswitch_add_clause_system_version(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *system_version)
34276
0
{
34277
0
    struct ovsdb_datum datum;
34278
34279
0
    datum.refcnt = NULL;
34280
34281
0
    if (system_version) {
34282
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
34283
0
        datum.n = 1;
34284
0
        datum.keys = key;
34285
0
        key->s = ovsdb_atom_string_create(system_version);
34286
0
    } else {
34287
0
        datum.n = 0;
34288
0
        datum.keys = NULL;
34289
0
    }
34290
0
    datum.values = NULL;
34291
0
    ovsdb_idl_condition_add_clause(cond,
34292
0
                          function,
34293
0
                          &ovsrec_open_vswitch_col_system_version,
34294
0
                          &datum);
34295
0
    ovsdb_datum_destroy(&datum, &ovsrec_open_vswitch_col_system_version.type);
34296
0
}
34297
34298
/* Destroy 'row' of kind "Open_vSwitch". The row must have been
34299
 * created with ovsdb_idl_index_init_row.
34300
 */
34301
void
34302
ovsrec_open_vswitch_index_destroy_row(const struct ovsrec_open_vswitch *row)
34303
0
{
34304
0
    ovsdb_idl_index_destroy_row(&row->header_);
34305
0
}
34306
        
34307
34308
/* Creates a new row of kind "Open_vSwitch". */
34309
struct ovsrec_open_vswitch *
34310
ovsrec_open_vswitch_index_init_row(struct ovsdb_idl_index *index)
34311
0
{
34312
0
    ovs_assert(index->table->class_ == &ovsrec_table_open_vswitch);
34313
0
    return ALIGNED_CAST(struct ovsrec_open_vswitch *, ovsdb_idl_index_init_row(index));
34314
0
}
34315
34316
struct ovsrec_open_vswitch *
34317
ovsrec_open_vswitch_index_find(struct ovsdb_idl_index *index, const struct ovsrec_open_vswitch *target)
34318
0
{
34319
0
    ovs_assert(index->table->class_ == &ovsrec_table_open_vswitch);
34320
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_index_find(index, &target->header_));
34321
0
}
34322
34323
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
34324
int
34325
ovsrec_open_vswitch_index_compare(
34326
    struct ovsdb_idl_index *index, 
34327
    const struct ovsrec_open_vswitch *a, 
34328
    const struct ovsrec_open_vswitch *b)
34329
0
{
34330
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
34331
0
}
34332
34333
struct ovsdb_idl_cursor
34334
ovsrec_open_vswitch_cursor_first(struct ovsdb_idl_index *index)
34335
0
{
34336
0
    ovs_assert(index->table->class_ == &ovsrec_table_open_vswitch);
34337
0
    return ovsdb_idl_cursor_first(index);
34338
0
}
34339
34340
struct ovsdb_idl_cursor
34341
ovsrec_open_vswitch_cursor_first_eq(
34342
    struct ovsdb_idl_index *index, const struct ovsrec_open_vswitch *target)
34343
0
{
34344
0
    ovs_assert(index->table->class_ == &ovsrec_table_open_vswitch);
34345
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
34346
0
}
34347
34348
struct ovsdb_idl_cursor
34349
ovsrec_open_vswitch_cursor_first_ge(
34350
    struct ovsdb_idl_index *index, const struct ovsrec_open_vswitch *target)
34351
0
{
34352
0
    ovs_assert(index->table->class_ == &ovsrec_table_open_vswitch);
34353
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
34354
0
}
34355
34356
struct ovsrec_open_vswitch *
34357
ovsrec_open_vswitch_cursor_data(struct ovsdb_idl_cursor *cursor)
34358
0
{
34359
0
    return ovsrec_open_vswitch_cast(ovsdb_idl_cursor_data(cursor));
34360
0
}
34361
34362
34363
/* Sets the "bridges" column from the "Open_vSwitch" table in 'row' to
34364
 * the 'bridges' set with 'n_bridges' entries.
34365
 *
34366
 * The caller retains ownership of the arguments. */
34367
void
34368
ovsrec_open_vswitch_index_set_bridges(const struct ovsrec_open_vswitch *row, struct ovsrec_bridge **bridges, size_t n_bridges)
34369
0
{
34370
0
    struct ovsdb_datum datum;
34371
34372
0
    datum.refcnt = NULL;
34373
0
    size_t i;
34374
34375
0
    datum.n = n_bridges;
34376
0
    datum.keys = n_bridges ? xmalloc(n_bridges * sizeof *datum.keys) : NULL;
34377
0
    datum.values = NULL;
34378
0
    for (i = 0; i < n_bridges; i++) {
34379
0
        datum.keys[i].uuid = bridges[i]->header_.uuid;
34380
0
    }
34381
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_bridges.type);
34382
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]);
34383
0
}
34384
34385
/* Sets the "cur_cfg" column from the "Open_vSwitch" table in 'row' to
34386
 * 'cur_cfg'.
34387
 *
34388
 * The caller retains ownership of the arguments. */
34389
void
34390
ovsrec_open_vswitch_index_set_cur_cfg(const struct ovsrec_open_vswitch *row, int64_t cur_cfg)
34391
0
{
34392
0
    struct ovsdb_datum datum;
34393
34394
0
    datum.refcnt = NULL;
34395
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
34396
34397
0
    datum.n = 1;
34398
0
    datum.keys = key;
34399
0
    key->integer = cur_cfg;
34400
0
    datum.values = NULL;
34401
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]);
34402
0
}
34403
34404
/* Sets the "datapath_types" column from the "Open_vSwitch" table in 'row' to
34405
 * the 'datapath_types' set with 'n_datapath_types' entries.
34406
 *
34407
 * The caller retains ownership of the arguments. */
34408
void
34409
ovsrec_open_vswitch_index_set_datapath_types(const struct ovsrec_open_vswitch *row, const char **datapath_types, size_t n_datapath_types)
34410
0
{
34411
0
    struct ovsdb_datum datum;
34412
34413
0
    datum.refcnt = NULL;
34414
0
    size_t i;
34415
34416
0
    datum.n = n_datapath_types;
34417
0
    datum.keys = n_datapath_types ? xmalloc(n_datapath_types * sizeof *datum.keys) : NULL;
34418
0
    datum.values = NULL;
34419
0
    for (i = 0; i < n_datapath_types; i++) {
34420
0
        datum.keys[i].s = ovsdb_atom_string_create(datapath_types[i]);
34421
0
    }
34422
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_datapath_types.type);
34423
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]);
34424
0
}
34425
34426
/* Sets the "datapaths" column from the "Open_vSwitch" table in 'row' to
34427
 * the map with keys 'key_datapaths' and values 'value_datapaths'
34428
 * with 'n_datapaths' entries.
34429
 *
34430
 * The caller retains ownership of the arguments. */
34431
void
34432
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)
34433
0
{
34434
0
    struct ovsdb_datum datum;
34435
34436
0
    datum.refcnt = NULL;
34437
0
    size_t i;
34438
34439
0
    datum.n = n_datapaths;
34440
0
    datum.keys = n_datapaths ? xmalloc(n_datapaths * sizeof *datum.keys) : NULL;
34441
0
    datum.values = xmalloc(n_datapaths * sizeof *datum.values);
34442
0
    for (i = 0; i < n_datapaths; i++) {
34443
0
        datum.keys[i].s = ovsdb_atom_string_create(key_datapaths[i]);
34444
0
        datum.values[i].uuid = value_datapaths[i]->header_.uuid;
34445
0
    }
34446
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_datapaths.type);
34447
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]);
34448
0
}
34449
34450
/* Sets the "db_version" column from the "Open_vSwitch" table in 'row' to
34451
 * the 'db_version' set.
34452
 *
34453
 * If "db_version" is null, the column will be the empty set,
34454
 * otherwise it will contain the specified value.
34455
 *
34456
 * The caller retains ownership of the arguments. */
34457
void
34458
ovsrec_open_vswitch_index_set_db_version(const struct ovsrec_open_vswitch *row, const char *db_version)
34459
0
{
34460
0
    struct ovsdb_datum datum;
34461
34462
0
    datum.refcnt = NULL;
34463
0
    union ovsdb_atom *key;
34464
34465
0
    if (db_version) {
34466
0
        key = xmalloc(sizeof (union ovsdb_atom));
34467
0
        datum.n = 1;
34468
0
        datum.keys = key;
34469
0
        key->s = ovsdb_atom_string_create(db_version);
34470
0
    } else {
34471
0
        datum.n = 0;
34472
0
        datum.keys = NULL;
34473
0
    }
34474
0
    datum.values = NULL;
34475
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]);
34476
0
}
34477
34478
/* Sets the "dpdk_initialized" column from the "Open_vSwitch" table in 'row' to
34479
 * 'dpdk_initialized'.
34480
 *
34481
 * The caller retains ownership of the arguments. */
34482
void
34483
ovsrec_open_vswitch_index_set_dpdk_initialized(const struct ovsrec_open_vswitch *row, bool dpdk_initialized)
34484
0
{
34485
0
    struct ovsdb_datum datum;
34486
34487
0
    datum.refcnt = NULL;
34488
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
34489
34490
0
    datum.n = 1;
34491
0
    datum.keys = key;
34492
0
    key->boolean = dpdk_initialized;
34493
0
    datum.values = NULL;
34494
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]);
34495
0
}
34496
34497
/* Sets the "dpdk_version" column from the "Open_vSwitch" table in 'row' to
34498
 * the 'dpdk_version' set.
34499
 *
34500
 * If "dpdk_version" is null, the column will be the empty set,
34501
 * otherwise it will contain the specified value.
34502
 *
34503
 * The caller retains ownership of the arguments. */
34504
void
34505
ovsrec_open_vswitch_index_set_dpdk_version(const struct ovsrec_open_vswitch *row, const char *dpdk_version)
34506
0
{
34507
0
    struct ovsdb_datum datum;
34508
34509
0
    datum.refcnt = NULL;
34510
0
    union ovsdb_atom *key;
34511
34512
0
    if (dpdk_version) {
34513
0
        key = xmalloc(sizeof (union ovsdb_atom));
34514
0
        datum.n = 1;
34515
0
        datum.keys = key;
34516
0
        key->s = ovsdb_atom_string_create(dpdk_version);
34517
0
    } else {
34518
0
        datum.n = 0;
34519
0
        datum.keys = NULL;
34520
0
    }
34521
0
    datum.values = NULL;
34522
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]);
34523
0
}
34524
34525
/* Sets the "external_ids" column's value from the "Open_vSwitch" table in 'row'
34526
 * to 'external_ids'.
34527
 *
34528
 * The caller retains ownership of 'external_ids' and everything in it. */
34529
void
34530
ovsrec_open_vswitch_index_set_external_ids(const struct ovsrec_open_vswitch *row, const struct smap *external_ids)
34531
0
{
34532
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
34533
34534
0
    if (external_ids) {
34535
0
        struct smap_node *node;
34536
0
        size_t i;
34537
34538
0
        datum->n = smap_count(external_ids);
34539
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
34540
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
34541
0
        datum->refcnt = NULL;
34542
34543
0
        i = 0;
34544
0
        SMAP_FOR_EACH (node, external_ids) {
34545
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
34546
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
34547
0
            i++;
34548
0
        }
34549
0
        ovsdb_datum_sort_unique(datum, &ovsrec_open_vswitch_col_external_ids.type);
34550
0
    } else {
34551
0
        ovsdb_datum_init_empty(datum);
34552
0
    }
34553
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
34554
0
                          &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_EXTERNAL_IDS],
34555
0
                          datum,
34556
0
                          &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
34557
0
    free(datum);
34558
0
}
34559
34560
34561
/* Sets the "iface_types" column from the "Open_vSwitch" table in 'row' to
34562
 * the 'iface_types' set with 'n_iface_types' entries.
34563
 *
34564
 * The caller retains ownership of the arguments. */
34565
void
34566
ovsrec_open_vswitch_index_set_iface_types(const struct ovsrec_open_vswitch *row, const char **iface_types, size_t n_iface_types)
34567
0
{
34568
0
    struct ovsdb_datum datum;
34569
34570
0
    datum.refcnt = NULL;
34571
0
    size_t i;
34572
34573
0
    datum.n = n_iface_types;
34574
0
    datum.keys = n_iface_types ? xmalloc(n_iface_types * sizeof *datum.keys) : NULL;
34575
0
    datum.values = NULL;
34576
0
    for (i = 0; i < n_iface_types; i++) {
34577
0
        datum.keys[i].s = ovsdb_atom_string_create(iface_types[i]);
34578
0
    }
34579
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_iface_types.type);
34580
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]);
34581
0
}
34582
34583
/* Sets the "manager_options" column from the "Open_vSwitch" table in 'row' to
34584
 * the 'manager_options' set with 'n_manager_options' entries.
34585
 *
34586
 * The caller retains ownership of the arguments. */
34587
void
34588
ovsrec_open_vswitch_index_set_manager_options(const struct ovsrec_open_vswitch *row, struct ovsrec_manager **manager_options, size_t n_manager_options)
34589
0
{
34590
0
    struct ovsdb_datum datum;
34591
34592
0
    datum.refcnt = NULL;
34593
0
    size_t i;
34594
34595
0
    datum.n = n_manager_options;
34596
0
    datum.keys = n_manager_options ? xmalloc(n_manager_options * sizeof *datum.keys) : NULL;
34597
0
    datum.values = NULL;
34598
0
    for (i = 0; i < n_manager_options; i++) {
34599
0
        datum.keys[i].uuid = manager_options[i]->header_.uuid;
34600
0
    }
34601
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_open_vswitch_col_manager_options.type);
34602
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]);
34603
0
}
34604
34605
/* Sets the "next_cfg" column from the "Open_vSwitch" table in 'row' to
34606
 * 'next_cfg'.
34607
 *
34608
 * The caller retains ownership of the arguments. */
34609
void
34610
ovsrec_open_vswitch_index_set_next_cfg(const struct ovsrec_open_vswitch *row, int64_t next_cfg)
34611
0
{
34612
0
    struct ovsdb_datum datum;
34613
34614
0
    datum.refcnt = NULL;
34615
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
34616
34617
0
    datum.n = 1;
34618
0
    datum.keys = key;
34619
0
    key->integer = next_cfg;
34620
0
    datum.values = NULL;
34621
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]);
34622
0
}
34623
34624
/* Sets the "other_config" column's value from the "Open_vSwitch" table in 'row'
34625
 * to 'other_config'.
34626
 *
34627
 * The caller retains ownership of 'other_config' and everything in it. */
34628
void
34629
ovsrec_open_vswitch_index_set_other_config(const struct ovsrec_open_vswitch *row, const struct smap *other_config)
34630
0
{
34631
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
34632
34633
0
    if (other_config) {
34634
0
        struct smap_node *node;
34635
0
        size_t i;
34636
34637
0
        datum->n = smap_count(other_config);
34638
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
34639
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
34640
0
        datum->refcnt = NULL;
34641
34642
0
        i = 0;
34643
0
        SMAP_FOR_EACH (node, other_config) {
34644
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
34645
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
34646
0
            i++;
34647
0
        }
34648
0
        ovsdb_datum_sort_unique(datum, &ovsrec_open_vswitch_col_other_config.type);
34649
0
    } else {
34650
0
        ovsdb_datum_init_empty(datum);
34651
0
    }
34652
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
34653
0
                          &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_OTHER_CONFIG],
34654
0
                          datum,
34655
0
                          &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
34656
0
    free(datum);
34657
0
}
34658
34659
34660
/* Sets the "ovs_version" column from the "Open_vSwitch" table in 'row' to
34661
 * the 'ovs_version' set.
34662
 *
34663
 * If "ovs_version" is null, the column will be the empty set,
34664
 * otherwise it will contain the specified value.
34665
 *
34666
 * The caller retains ownership of the arguments. */
34667
void
34668
ovsrec_open_vswitch_index_set_ovs_version(const struct ovsrec_open_vswitch *row, const char *ovs_version)
34669
0
{
34670
0
    struct ovsdb_datum datum;
34671
34672
0
    datum.refcnt = NULL;
34673
0
    union ovsdb_atom *key;
34674
34675
0
    if (ovs_version) {
34676
0
        key = xmalloc(sizeof (union ovsdb_atom));
34677
0
        datum.n = 1;
34678
0
        datum.keys = key;
34679
0
        key->s = ovsdb_atom_string_create(ovs_version);
34680
0
    } else {
34681
0
        datum.n = 0;
34682
0
        datum.keys = NULL;
34683
0
    }
34684
0
    datum.values = NULL;
34685
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]);
34686
0
}
34687
34688
/* Sets the "ssl" column from the "Open_vSwitch" table in 'row' to
34689
 * the 'ssl' set.
34690
 *
34691
 * If "ssl" is null, the column will be the empty set,
34692
 * otherwise it will contain the specified value.
34693
 *
34694
 * The caller retains ownership of the arguments. */
34695
void
34696
ovsrec_open_vswitch_index_set_ssl(const struct ovsrec_open_vswitch *row, const struct ovsrec_ssl *ssl)
34697
0
{
34698
0
    struct ovsdb_datum datum;
34699
34700
0
    datum.refcnt = NULL;
34701
0
    union ovsdb_atom *key;
34702
34703
0
    if (ssl) {
34704
0
        key = xmalloc(sizeof (union ovsdb_atom));
34705
0
        datum.n = 1;
34706
0
        datum.keys = key;
34707
0
        key->uuid = ssl->header_.uuid;
34708
0
    } else {
34709
0
        datum.n = 0;
34710
0
        datum.keys = NULL;
34711
0
    }
34712
0
    datum.values = NULL;
34713
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]);
34714
0
}
34715
34716
/* Sets the "statistics" column's value from the "Open_vSwitch" table in 'row'
34717
 * to 'statistics'.
34718
 *
34719
 * The caller retains ownership of 'statistics' and everything in it. */
34720
void
34721
ovsrec_open_vswitch_index_set_statistics(const struct ovsrec_open_vswitch *row, const struct smap *statistics)
34722
0
{
34723
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
34724
34725
0
    if (statistics) {
34726
0
        struct smap_node *node;
34727
0
        size_t i;
34728
34729
0
        datum->n = smap_count(statistics);
34730
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
34731
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
34732
0
        datum->refcnt = NULL;
34733
34734
0
        i = 0;
34735
0
        SMAP_FOR_EACH (node, statistics) {
34736
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
34737
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
34738
0
            i++;
34739
0
        }
34740
0
        ovsdb_datum_sort_unique(datum, &ovsrec_open_vswitch_col_statistics.type);
34741
0
    } else {
34742
0
        ovsdb_datum_init_empty(datum);
34743
0
    }
34744
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
34745
0
                          &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_STATISTICS],
34746
0
                          datum,
34747
0
                          &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]);
34748
0
    free(datum);
34749
0
}
34750
34751
34752
/* Sets the "system_type" column from the "Open_vSwitch" table in 'row' to
34753
 * the 'system_type' set.
34754
 *
34755
 * If "system_type" is null, the column will be the empty set,
34756
 * otherwise it will contain the specified value.
34757
 *
34758
 * The caller retains ownership of the arguments. */
34759
void
34760
ovsrec_open_vswitch_index_set_system_type(const struct ovsrec_open_vswitch *row, const char *system_type)
34761
0
{
34762
0
    struct ovsdb_datum datum;
34763
34764
0
    datum.refcnt = NULL;
34765
0
    union ovsdb_atom *key;
34766
34767
0
    if (system_type) {
34768
0
        key = xmalloc(sizeof (union ovsdb_atom));
34769
0
        datum.n = 1;
34770
0
        datum.keys = key;
34771
0
        key->s = ovsdb_atom_string_create(system_type);
34772
0
    } else {
34773
0
        datum.n = 0;
34774
0
        datum.keys = NULL;
34775
0
    }
34776
0
    datum.values = NULL;
34777
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]);
34778
0
}
34779
34780
/* Sets the "system_version" column from the "Open_vSwitch" table in 'row' to
34781
 * the 'system_version' set.
34782
 *
34783
 * If "system_version" is null, the column will be the empty set,
34784
 * otherwise it will contain the specified value.
34785
 *
34786
 * The caller retains ownership of the arguments. */
34787
void
34788
ovsrec_open_vswitch_index_set_system_version(const struct ovsrec_open_vswitch *row, const char *system_version)
34789
0
{
34790
0
    struct ovsdb_datum datum;
34791
34792
0
    datum.refcnt = NULL;
34793
0
    union ovsdb_atom *key;
34794
34795
0
    if (system_version) {
34796
0
        key = xmalloc(sizeof (union ovsdb_atom));
34797
0
        datum.n = 1;
34798
0
        datum.keys = key;
34799
0
        key->s = ovsdb_atom_string_create(system_version);
34800
0
    } else {
34801
0
        datum.n = 0;
34802
0
        datum.keys = NULL;
34803
0
    }
34804
0
    datum.values = NULL;
34805
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]);
34806
0
}
34807
34808
struct ovsdb_idl_column ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_N_COLUMNS];
34809
34810
unsigned int
34811
ovsrec_open_vswitch_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
34812
0
{
34813
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_open_vswitch, condition);
34814
0
}
34815
34816
struct ovsdb_idl_column ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_N_COLUMNS] = {
34817
    [OVSREC_OPEN_VSWITCH_COL_BRIDGES] = {
34818
         .name = "bridges",
34819
         .type = {
34820
            .key = {
34821
               .type = OVSDB_TYPE_UUID,
34822
               .uuid = { .refTableName = "Bridge", .refType = OVSDB_REF_STRONG },
34823
            },
34824
            .value = OVSDB_BASE_VOID_INIT,
34825
            .n_min = 0,
34826
            .n_max = UINT_MAX,
34827
         },
34828
         .is_mutable = true,
34829
         .is_synthetic = false,
34830
         .parse = ovsrec_open_vswitch_parse_bridges,
34831
         .unparse = ovsrec_open_vswitch_unparse_bridges,
34832
    },
34833
34834
    [OVSREC_OPEN_VSWITCH_COL_CUR_CFG] = {
34835
         .name = "cur_cfg",
34836
         .type = {
34837
            .key = {
34838
               .type = OVSDB_TYPE_INTEGER,
34839
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
34840
            },
34841
            .value = OVSDB_BASE_VOID_INIT,
34842
            .n_min = 1,
34843
            .n_max = 1,
34844
         },
34845
         .is_mutable = true,
34846
         .is_synthetic = false,
34847
         .parse = ovsrec_open_vswitch_parse_cur_cfg,
34848
         .unparse = ovsrec_open_vswitch_unparse_cur_cfg,
34849
    },
34850
34851
    [OVSREC_OPEN_VSWITCH_COL_DATAPATH_TYPES] = {
34852
         .name = "datapath_types",
34853
         .type = {
34854
            .key = {
34855
               .type = OVSDB_TYPE_STRING,
34856
               .string = { .minLen = 0, .maxLen = UINT_MAX },
34857
            },
34858
            .value = OVSDB_BASE_VOID_INIT,
34859
            .n_min = 0,
34860
            .n_max = UINT_MAX,
34861
         },
34862
         .is_mutable = true,
34863
         .is_synthetic = false,
34864
         .parse = ovsrec_open_vswitch_parse_datapath_types,
34865
         .unparse = ovsrec_open_vswitch_unparse_datapath_types,
34866
    },
34867
34868
    [OVSREC_OPEN_VSWITCH_COL_DATAPATHS] = {
34869
         .name = "datapaths",
34870
         .type = {
34871
            .key = {
34872
               .type = OVSDB_TYPE_STRING,
34873
               .string = { .minLen = 0, .maxLen = UINT_MAX },
34874
            },
34875
            .value = {
34876
                .type = OVSDB_TYPE_UUID,
34877
                .uuid = { .refTableName = "Datapath", .refType = OVSDB_REF_STRONG },
34878
            },
34879
            .n_min = 0,
34880
            .n_max = UINT_MAX,
34881
         },
34882
         .is_mutable = true,
34883
         .is_synthetic = false,
34884
         .parse = ovsrec_open_vswitch_parse_datapaths,
34885
         .unparse = ovsrec_open_vswitch_unparse_datapaths,
34886
    },
34887
34888
    [OVSREC_OPEN_VSWITCH_COL_DB_VERSION] = {
34889
         .name = "db_version",
34890
         .type = {
34891
            .key = {
34892
               .type = OVSDB_TYPE_STRING,
34893
               .string = { .minLen = 0, .maxLen = UINT_MAX },
34894
            },
34895
            .value = OVSDB_BASE_VOID_INIT,
34896
            .n_min = 0,
34897
            .n_max = 1,
34898
         },
34899
         .is_mutable = true,
34900
         .is_synthetic = false,
34901
         .parse = ovsrec_open_vswitch_parse_db_version,
34902
         .unparse = ovsrec_open_vswitch_unparse_db_version,
34903
    },
34904
34905
    [OVSREC_OPEN_VSWITCH_COL_DPDK_INITIALIZED] = {
34906
         .name = "dpdk_initialized",
34907
         .type = {
34908
            .key = {
34909
               .type = OVSDB_TYPE_BOOLEAN,
34910
            },
34911
            .value = OVSDB_BASE_VOID_INIT,
34912
            .n_min = 1,
34913
            .n_max = 1,
34914
         },
34915
         .is_mutable = true,
34916
         .is_synthetic = false,
34917
         .parse = ovsrec_open_vswitch_parse_dpdk_initialized,
34918
         .unparse = ovsrec_open_vswitch_unparse_dpdk_initialized,
34919
    },
34920
34921
    [OVSREC_OPEN_VSWITCH_COL_DPDK_VERSION] = {
34922
         .name = "dpdk_version",
34923
         .type = {
34924
            .key = {
34925
               .type = OVSDB_TYPE_STRING,
34926
               .string = { .minLen = 0, .maxLen = UINT_MAX },
34927
            },
34928
            .value = OVSDB_BASE_VOID_INIT,
34929
            .n_min = 0,
34930
            .n_max = 1,
34931
         },
34932
         .is_mutable = true,
34933
         .is_synthetic = false,
34934
         .parse = ovsrec_open_vswitch_parse_dpdk_version,
34935
         .unparse = ovsrec_open_vswitch_unparse_dpdk_version,
34936
    },
34937
34938
    [OVSREC_OPEN_VSWITCH_COL_EXTERNAL_IDS] = {
34939
         .name = "external_ids",
34940
         .type = {
34941
            .key = {
34942
               .type = OVSDB_TYPE_STRING,
34943
               .string = { .minLen = 0, .maxLen = UINT_MAX },
34944
            },
34945
            .value = {
34946
                .type = OVSDB_TYPE_STRING,
34947
                .string = { .minLen = 0, .maxLen = UINT_MAX },
34948
            },
34949
            .n_min = 0,
34950
            .n_max = UINT_MAX,
34951
         },
34952
         .is_mutable = true,
34953
         .is_synthetic = false,
34954
         .parse = ovsrec_open_vswitch_parse_external_ids,
34955
         .unparse = ovsrec_open_vswitch_unparse_external_ids,
34956
    },
34957
34958
    [OVSREC_OPEN_VSWITCH_COL_IFACE_TYPES] = {
34959
         .name = "iface_types",
34960
         .type = {
34961
            .key = {
34962
               .type = OVSDB_TYPE_STRING,
34963
               .string = { .minLen = 0, .maxLen = UINT_MAX },
34964
            },
34965
            .value = OVSDB_BASE_VOID_INIT,
34966
            .n_min = 0,
34967
            .n_max = UINT_MAX,
34968
         },
34969
         .is_mutable = true,
34970
         .is_synthetic = false,
34971
         .parse = ovsrec_open_vswitch_parse_iface_types,
34972
         .unparse = ovsrec_open_vswitch_unparse_iface_types,
34973
    },
34974
34975
    [OVSREC_OPEN_VSWITCH_COL_MANAGER_OPTIONS] = {
34976
         .name = "manager_options",
34977
         .type = {
34978
            .key = {
34979
               .type = OVSDB_TYPE_UUID,
34980
               .uuid = { .refTableName = "Manager", .refType = OVSDB_REF_STRONG },
34981
            },
34982
            .value = OVSDB_BASE_VOID_INIT,
34983
            .n_min = 0,
34984
            .n_max = UINT_MAX,
34985
         },
34986
         .is_mutable = true,
34987
         .is_synthetic = false,
34988
         .parse = ovsrec_open_vswitch_parse_manager_options,
34989
         .unparse = ovsrec_open_vswitch_unparse_manager_options,
34990
    },
34991
34992
    [OVSREC_OPEN_VSWITCH_COL_NEXT_CFG] = {
34993
         .name = "next_cfg",
34994
         .type = {
34995
            .key = {
34996
               .type = OVSDB_TYPE_INTEGER,
34997
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
34998
            },
34999
            .value = OVSDB_BASE_VOID_INIT,
35000
            .n_min = 1,
35001
            .n_max = 1,
35002
         },
35003
         .is_mutable = true,
35004
         .is_synthetic = false,
35005
         .parse = ovsrec_open_vswitch_parse_next_cfg,
35006
         .unparse = ovsrec_open_vswitch_unparse_next_cfg,
35007
    },
35008
35009
    [OVSREC_OPEN_VSWITCH_COL_OTHER_CONFIG] = {
35010
         .name = "other_config",
35011
         .type = {
35012
            .key = {
35013
               .type = OVSDB_TYPE_STRING,
35014
               .string = { .minLen = 0, .maxLen = UINT_MAX },
35015
            },
35016
            .value = {
35017
                .type = OVSDB_TYPE_STRING,
35018
                .string = { .minLen = 0, .maxLen = UINT_MAX },
35019
            },
35020
            .n_min = 0,
35021
            .n_max = UINT_MAX,
35022
         },
35023
         .is_mutable = true,
35024
         .is_synthetic = false,
35025
         .parse = ovsrec_open_vswitch_parse_other_config,
35026
         .unparse = ovsrec_open_vswitch_unparse_other_config,
35027
    },
35028
35029
    [OVSREC_OPEN_VSWITCH_COL_OVS_VERSION] = {
35030
         .name = "ovs_version",
35031
         .type = {
35032
            .key = {
35033
               .type = OVSDB_TYPE_STRING,
35034
               .string = { .minLen = 0, .maxLen = UINT_MAX },
35035
            },
35036
            .value = OVSDB_BASE_VOID_INIT,
35037
            .n_min = 0,
35038
            .n_max = 1,
35039
         },
35040
         .is_mutable = true,
35041
         .is_synthetic = false,
35042
         .parse = ovsrec_open_vswitch_parse_ovs_version,
35043
         .unparse = ovsrec_open_vswitch_unparse_ovs_version,
35044
    },
35045
35046
    [OVSREC_OPEN_VSWITCH_COL_SSL] = {
35047
         .name = "ssl",
35048
         .type = {
35049
            .key = {
35050
               .type = OVSDB_TYPE_UUID,
35051
               .uuid = { .refTableName = "SSL", .refType = OVSDB_REF_STRONG },
35052
            },
35053
            .value = OVSDB_BASE_VOID_INIT,
35054
            .n_min = 0,
35055
            .n_max = 1,
35056
         },
35057
         .is_mutable = true,
35058
         .is_synthetic = false,
35059
         .parse = ovsrec_open_vswitch_parse_ssl,
35060
         .unparse = ovsrec_open_vswitch_unparse_ssl,
35061
    },
35062
35063
    [OVSREC_OPEN_VSWITCH_COL_STATISTICS] = {
35064
         .name = "statistics",
35065
         .type = {
35066
            .key = {
35067
               .type = OVSDB_TYPE_STRING,
35068
               .string = { .minLen = 0, .maxLen = UINT_MAX },
35069
            },
35070
            .value = {
35071
                .type = OVSDB_TYPE_STRING,
35072
                .string = { .minLen = 0, .maxLen = UINT_MAX },
35073
            },
35074
            .n_min = 0,
35075
            .n_max = UINT_MAX,
35076
         },
35077
         .is_mutable = true,
35078
         .is_synthetic = false,
35079
         .parse = ovsrec_open_vswitch_parse_statistics,
35080
         .unparse = ovsrec_open_vswitch_unparse_statistics,
35081
    },
35082
35083
    [OVSREC_OPEN_VSWITCH_COL_SYSTEM_TYPE] = {
35084
         .name = "system_type",
35085
         .type = {
35086
            .key = {
35087
               .type = OVSDB_TYPE_STRING,
35088
               .string = { .minLen = 0, .maxLen = UINT_MAX },
35089
            },
35090
            .value = OVSDB_BASE_VOID_INIT,
35091
            .n_min = 0,
35092
            .n_max = 1,
35093
         },
35094
         .is_mutable = true,
35095
         .is_synthetic = false,
35096
         .parse = ovsrec_open_vswitch_parse_system_type,
35097
         .unparse = ovsrec_open_vswitch_unparse_system_type,
35098
    },
35099
35100
    [OVSREC_OPEN_VSWITCH_COL_SYSTEM_VERSION] = {
35101
         .name = "system_version",
35102
         .type = {
35103
            .key = {
35104
               .type = OVSDB_TYPE_STRING,
35105
               .string = { .minLen = 0, .maxLen = UINT_MAX },
35106
            },
35107
            .value = OVSDB_BASE_VOID_INIT,
35108
            .n_min = 0,
35109
            .n_max = 1,
35110
         },
35111
         .is_mutable = true,
35112
         .is_synthetic = false,
35113
         .parse = ovsrec_open_vswitch_parse_system_version,
35114
         .unparse = ovsrec_open_vswitch_unparse_system_version,
35115
    },
35116
35117
};
35118

35119
/* Port table. */
35120
35121
bool
35122
ovsrec_server_has_port_table_col_bond_active_slave(const struct ovsdb_idl *idl)
35123
0
{
35124
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_bond_active_slave);
35125
0
}
35126
35127
35128
bool
35129
ovsrec_server_has_port_table_col_bond_downdelay(const struct ovsdb_idl *idl)
35130
0
{
35131
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_bond_downdelay);
35132
0
}
35133
35134
35135
bool
35136
ovsrec_server_has_port_table_col_bond_fake_iface(const struct ovsdb_idl *idl)
35137
0
{
35138
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_bond_fake_iface);
35139
0
}
35140
35141
35142
bool
35143
ovsrec_server_has_port_table_col_bond_mode(const struct ovsdb_idl *idl)
35144
0
{
35145
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_bond_mode);
35146
0
}
35147
35148
35149
bool
35150
ovsrec_server_has_port_table_col_bond_updelay(const struct ovsdb_idl *idl)
35151
0
{
35152
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_bond_updelay);
35153
0
}
35154
35155
35156
bool
35157
ovsrec_server_has_port_table_col_cvlans(const struct ovsdb_idl *idl)
35158
0
{
35159
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_cvlans);
35160
0
}
35161
35162
35163
bool
35164
ovsrec_server_has_port_table_col_external_ids(const struct ovsdb_idl *idl)
35165
0
{
35166
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_external_ids);
35167
0
}
35168
35169
35170
bool
35171
ovsrec_server_has_port_table_col_fake_bridge(const struct ovsdb_idl *idl)
35172
0
{
35173
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_fake_bridge);
35174
0
}
35175
35176
35177
bool
35178
ovsrec_server_has_port_table_col_interfaces(const struct ovsdb_idl *idl)
35179
0
{
35180
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_interfaces);
35181
0
}
35182
35183
35184
bool
35185
ovsrec_server_has_port_table_col_lacp(const struct ovsdb_idl *idl)
35186
0
{
35187
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_lacp);
35188
0
}
35189
35190
35191
bool
35192
ovsrec_server_has_port_table_col_mac(const struct ovsdb_idl *idl)
35193
0
{
35194
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_mac);
35195
0
}
35196
35197
35198
bool
35199
ovsrec_server_has_port_table_col_name(const struct ovsdb_idl *idl)
35200
0
{
35201
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_name);
35202
0
}
35203
35204
35205
bool
35206
ovsrec_server_has_port_table_col_other_config(const struct ovsdb_idl *idl)
35207
0
{
35208
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_other_config);
35209
0
}
35210
35211
35212
bool
35213
ovsrec_server_has_port_table_col_qos(const struct ovsdb_idl *idl)
35214
0
{
35215
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_qos);
35216
0
}
35217
35218
35219
bool
35220
ovsrec_server_has_port_table_col_rstp_statistics(const struct ovsdb_idl *idl)
35221
0
{
35222
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_rstp_statistics);
35223
0
}
35224
35225
35226
bool
35227
ovsrec_server_has_port_table_col_rstp_status(const struct ovsdb_idl *idl)
35228
0
{
35229
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_rstp_status);
35230
0
}
35231
35232
35233
bool
35234
ovsrec_server_has_port_table_col_statistics(const struct ovsdb_idl *idl)
35235
0
{
35236
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_statistics);
35237
0
}
35238
35239
35240
bool
35241
ovsrec_server_has_port_table_col_status(const struct ovsdb_idl *idl)
35242
0
{
35243
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_status);
35244
0
}
35245
35246
35247
bool
35248
ovsrec_server_has_port_table_col_tag(const struct ovsdb_idl *idl)
35249
0
{
35250
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_tag);
35251
0
}
35252
35253
35254
bool
35255
ovsrec_server_has_port_table_col_trunks(const struct ovsdb_idl *idl)
35256
0
{
35257
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_trunks);
35258
0
}
35259
35260
35261
bool
35262
ovsrec_server_has_port_table_col_vlan_mode(const struct ovsdb_idl *idl)
35263
0
{
35264
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_vlan_mode);
35265
0
}
35266
35267
35268
bool
35269
ovsrec_server_has_port_table_col_protected_(const struct ovsdb_idl *idl)
35270
0
{
35271
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_port_col_protected_);
35272
0
}
35273
35274
35275
bool
35276
ovsrec_server_has_port_table(const struct ovsdb_idl *idl)
35277
0
{
35278
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_PORT]);
35279
0
}
35280
35281
35282
const struct ovsrec_port_table *
35283
ovsrec_port_table_get(const struct ovsdb_idl *idl)
35284
0
{
35285
0
    return (const struct ovsrec_port_table *) idl;
35286
0
}
35287
35288
const struct ovsrec_port *
35289
ovsrec_port_table_first(const struct ovsrec_port_table *table)
35290
0
{
35291
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
35292
0
    return ovsrec_port_first(idl);
35293
0
}
35294
35295
35296
const struct ovsrec_port *
35297
ovsrec_port_table_track_get_first(const struct ovsrec_port_table *table)
35298
0
{
35299
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
35300
0
    return ovsrec_port_track_get_first(idl);
35301
0
}
35302
35303
35304
static void
35305
ovsrec_port_parse_bond_active_slave(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35306
0
{
35307
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35308
35309
0
    if (datum->n >= 1) {
35310
0
        row->bond_active_slave = datum->keys[0].s->string;
35311
0
    } else {
35312
0
        row->bond_active_slave = NULL;
35313
0
    }
35314
0
}
35315
35316
static void
35317
ovsrec_port_parse_bond_downdelay(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35318
0
{
35319
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35320
35321
0
    if (datum->n >= 1) {
35322
0
        row->bond_downdelay = datum->keys[0].integer;
35323
0
    } else {
35324
0
        row->bond_downdelay = 0;
35325
0
    }
35326
0
}
35327
35328
static void
35329
ovsrec_port_parse_bond_fake_iface(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35330
0
{
35331
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35332
35333
0
    if (datum->n >= 1) {
35334
0
        row->bond_fake_iface = datum->keys[0].boolean;
35335
0
    } else {
35336
0
        row->bond_fake_iface = false;
35337
0
    }
35338
0
}
35339
35340
static void
35341
ovsrec_port_parse_bond_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35342
0
{
35343
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35344
35345
0
    if (datum->n >= 1) {
35346
0
        row->bond_mode = datum->keys[0].s->string;
35347
0
    } else {
35348
0
        row->bond_mode = NULL;
35349
0
    }
35350
0
}
35351
35352
static void
35353
ovsrec_port_parse_bond_updelay(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35354
0
{
35355
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35356
35357
0
    if (datum->n >= 1) {
35358
0
        row->bond_updelay = datum->keys[0].integer;
35359
0
    } else {
35360
0
        row->bond_updelay = 0;
35361
0
    }
35362
0
}
35363
35364
static void
35365
ovsrec_port_parse_cvlans(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35366
0
{
35367
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35368
0
    size_t n = MIN(4096, datum->n);
35369
0
    row->cvlans = NULL;
35370
0
    row->n_cvlans = 0;
35371
0
    for (size_t i = 0; i < n; i++) {
35372
0
        if (!row->n_cvlans) {
35373
0
            row->cvlans = xmalloc(n * sizeof *row->cvlans);
35374
0
        }
35375
0
        row->cvlans[row->n_cvlans] = datum->keys[i].integer;
35376
0
        row->n_cvlans++;
35377
0
    }
35378
0
}
35379
35380
static void
35381
ovsrec_port_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35382
0
{
35383
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35384
0
    smap_init(&row->external_ids);
35385
0
    for (size_t i = 0; i < datum->n; i++) {
35386
0
        smap_add(&row->external_ids,
35387
0
                 json_string(datum->keys[i].s),
35388
0
                 json_string(datum->values[i].s));
35389
0
    }
35390
0
}
35391
35392
static void
35393
ovsrec_port_parse_fake_bridge(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35394
0
{
35395
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35396
35397
0
    if (datum->n >= 1) {
35398
0
        row->fake_bridge = datum->keys[0].boolean;
35399
0
    } else {
35400
0
        row->fake_bridge = false;
35401
0
    }
35402
0
}
35403
35404
static void
35405
ovsrec_port_parse_interfaces(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35406
0
{
35407
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35408
0
    row->interfaces = NULL;
35409
0
    row->n_interfaces = 0;
35410
0
    for (size_t i = 0; i < datum->n; i++) {
35411
0
        struct ovsrec_interface *keyRow = ovsrec_interface_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_interface, &datum->keys[i].uuid));
35412
0
        if (!keyRow) {
35413
0
            continue;
35414
0
        }
35415
0
        if (!row->n_interfaces) {
35416
0
            row->interfaces = xmalloc(datum->n * sizeof *row->interfaces);
35417
0
        }
35418
0
        row->interfaces[row->n_interfaces] = keyRow;
35419
0
        row->n_interfaces++;
35420
0
    }
35421
0
}
35422
35423
static void
35424
ovsrec_port_parse_lacp(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35425
0
{
35426
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35427
35428
0
    if (datum->n >= 1) {
35429
0
        row->lacp = datum->keys[0].s->string;
35430
0
    } else {
35431
0
        row->lacp = NULL;
35432
0
    }
35433
0
}
35434
35435
static void
35436
ovsrec_port_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35437
0
{
35438
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35439
35440
0
    if (datum->n >= 1) {
35441
0
        row->mac = datum->keys[0].s->string;
35442
0
    } else {
35443
0
        row->mac = NULL;
35444
0
    }
35445
0
}
35446
35447
static void
35448
ovsrec_port_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35449
0
{
35450
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35451
35452
0
    if (datum->n >= 1) {
35453
0
        row->name = datum->keys[0].s->string;
35454
0
    } else {
35455
0
        row->name = "";
35456
0
    }
35457
0
}
35458
35459
static void
35460
ovsrec_port_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35461
0
{
35462
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35463
0
    smap_init(&row->other_config);
35464
0
    for (size_t i = 0; i < datum->n; i++) {
35465
0
        smap_add(&row->other_config,
35466
0
                 json_string(datum->keys[i].s),
35467
0
                 json_string(datum->values[i].s));
35468
0
    }
35469
0
}
35470
35471
static void
35472
ovsrec_port_parse_protected_(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35473
0
{
35474
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35475
35476
0
    if (datum->n >= 1) {
35477
0
        row->protected_ = datum->keys[0].boolean;
35478
0
    } else {
35479
0
        row->protected_ = false;
35480
0
    }
35481
0
}
35482
35483
static void
35484
ovsrec_port_parse_qos(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35485
0
{
35486
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35487
35488
0
    if (datum->n >= 1) {
35489
0
        row->qos = ovsrec_qos_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_qos, &datum->keys[0].uuid));
35490
0
    } else {
35491
0
        row->qos = NULL;
35492
0
    }
35493
0
}
35494
35495
static void
35496
ovsrec_port_parse_rstp_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35497
0
{
35498
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35499
0
    row->key_rstp_statistics = NULL;
35500
0
    row->value_rstp_statistics = NULL;
35501
0
    row->n_rstp_statistics = 0;
35502
0
    for (size_t i = 0; i < datum->n; i++) {
35503
0
        if (!row->n_rstp_statistics) {
35504
0
            row->key_rstp_statistics = xmalloc(datum->n * sizeof *row->key_rstp_statistics);
35505
0
            row->value_rstp_statistics = xmalloc(datum->n * sizeof *row->value_rstp_statistics);
35506
0
        }
35507
0
        row->key_rstp_statistics[row->n_rstp_statistics] = datum->keys[i].s->string;
35508
0
        row->value_rstp_statistics[row->n_rstp_statistics] = datum->values[i].integer;
35509
0
        row->n_rstp_statistics++;
35510
0
    }
35511
0
}
35512
35513
static void
35514
ovsrec_port_parse_rstp_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35515
0
{
35516
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35517
0
    smap_init(&row->rstp_status);
35518
0
    for (size_t i = 0; i < datum->n; i++) {
35519
0
        smap_add(&row->rstp_status,
35520
0
                 json_string(datum->keys[i].s),
35521
0
                 json_string(datum->values[i].s));
35522
0
    }
35523
0
}
35524
35525
static void
35526
ovsrec_port_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35527
0
{
35528
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35529
0
    row->key_statistics = NULL;
35530
0
    row->value_statistics = NULL;
35531
0
    row->n_statistics = 0;
35532
0
    for (size_t i = 0; i < datum->n; i++) {
35533
0
        if (!row->n_statistics) {
35534
0
            row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
35535
0
            row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
35536
0
        }
35537
0
        row->key_statistics[row->n_statistics] = datum->keys[i].s->string;
35538
0
        row->value_statistics[row->n_statistics] = datum->values[i].integer;
35539
0
        row->n_statistics++;
35540
0
    }
35541
0
}
35542
35543
static void
35544
ovsrec_port_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35545
0
{
35546
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35547
0
    smap_init(&row->status);
35548
0
    for (size_t i = 0; i < datum->n; i++) {
35549
0
        smap_add(&row->status,
35550
0
                 json_string(datum->keys[i].s),
35551
0
                 json_string(datum->values[i].s));
35552
0
    }
35553
0
}
35554
35555
static void
35556
ovsrec_port_parse_tag(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35557
0
{
35558
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35559
0
    size_t n = MIN(1, datum->n);
35560
0
    row->tag = NULL;
35561
0
    row->n_tag = 0;
35562
0
    for (size_t i = 0; i < n; i++) {
35563
0
        if (!row->n_tag) {
35564
0
            row->tag = xmalloc(n * sizeof *row->tag);
35565
0
        }
35566
0
        row->tag[row->n_tag] = datum->keys[i].integer;
35567
0
        row->n_tag++;
35568
0
    }
35569
0
}
35570
35571
static void
35572
ovsrec_port_parse_trunks(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35573
0
{
35574
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35575
0
    size_t n = MIN(4096, datum->n);
35576
0
    row->trunks = NULL;
35577
0
    row->n_trunks = 0;
35578
0
    for (size_t i = 0; i < n; i++) {
35579
0
        if (!row->n_trunks) {
35580
0
            row->trunks = xmalloc(n * sizeof *row->trunks);
35581
0
        }
35582
0
        row->trunks[row->n_trunks] = datum->keys[i].integer;
35583
0
        row->n_trunks++;
35584
0
    }
35585
0
}
35586
35587
static void
35588
ovsrec_port_parse_vlan_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
35589
0
{
35590
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35591
35592
0
    if (datum->n >= 1) {
35593
0
        row->vlan_mode = datum->keys[0].s->string;
35594
0
    } else {
35595
0
        row->vlan_mode = NULL;
35596
0
    }
35597
0
}
35598
35599
static void
35600
ovsrec_port_unparse_bond_active_slave(struct ovsdb_idl_row *row OVS_UNUSED)
35601
0
{
35602
    /* Nothing to do. */
35603
0
}
35604
35605
static void
35606
ovsrec_port_unparse_bond_downdelay(struct ovsdb_idl_row *row OVS_UNUSED)
35607
0
{
35608
    /* Nothing to do. */
35609
0
}
35610
35611
static void
35612
ovsrec_port_unparse_bond_fake_iface(struct ovsdb_idl_row *row OVS_UNUSED)
35613
0
{
35614
    /* Nothing to do. */
35615
0
}
35616
35617
static void
35618
ovsrec_port_unparse_bond_mode(struct ovsdb_idl_row *row OVS_UNUSED)
35619
0
{
35620
    /* Nothing to do. */
35621
0
}
35622
35623
static void
35624
ovsrec_port_unparse_bond_updelay(struct ovsdb_idl_row *row OVS_UNUSED)
35625
0
{
35626
    /* Nothing to do. */
35627
0
}
35628
35629
static void
35630
ovsrec_port_unparse_cvlans(struct ovsdb_idl_row *row_)
35631
0
{
35632
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35633
0
    free(row->cvlans);
35634
0
}
35635
35636
static void
35637
ovsrec_port_unparse_external_ids(struct ovsdb_idl_row *row_)
35638
0
{
35639
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35640
0
    smap_destroy(&row->external_ids);
35641
0
}
35642
35643
static void
35644
ovsrec_port_unparse_fake_bridge(struct ovsdb_idl_row *row OVS_UNUSED)
35645
0
{
35646
    /* Nothing to do. */
35647
0
}
35648
35649
static void
35650
ovsrec_port_unparse_interfaces(struct ovsdb_idl_row *row_)
35651
0
{
35652
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35653
0
    free(row->interfaces);
35654
0
}
35655
35656
static void
35657
ovsrec_port_unparse_lacp(struct ovsdb_idl_row *row OVS_UNUSED)
35658
0
{
35659
    /* Nothing to do. */
35660
0
}
35661
35662
static void
35663
ovsrec_port_unparse_mac(struct ovsdb_idl_row *row OVS_UNUSED)
35664
0
{
35665
    /* Nothing to do. */
35666
0
}
35667
35668
static void
35669
ovsrec_port_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
35670
0
{
35671
    /* Nothing to do. */
35672
0
}
35673
35674
static void
35675
ovsrec_port_unparse_other_config(struct ovsdb_idl_row *row_)
35676
0
{
35677
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35678
0
    smap_destroy(&row->other_config);
35679
0
}
35680
35681
static void
35682
ovsrec_port_unparse_protected_(struct ovsdb_idl_row *row OVS_UNUSED)
35683
0
{
35684
    /* Nothing to do. */
35685
0
}
35686
35687
static void
35688
ovsrec_port_unparse_qos(struct ovsdb_idl_row *row OVS_UNUSED)
35689
0
{
35690
    /* Nothing to do. */
35691
0
}
35692
35693
static void
35694
ovsrec_port_unparse_rstp_statistics(struct ovsdb_idl_row *row_)
35695
0
{
35696
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35697
0
    free(row->key_rstp_statistics);
35698
0
    free(row->value_rstp_statistics);
35699
0
}
35700
35701
static void
35702
ovsrec_port_unparse_rstp_status(struct ovsdb_idl_row *row_)
35703
0
{
35704
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35705
0
    smap_destroy(&row->rstp_status);
35706
0
}
35707
35708
static void
35709
ovsrec_port_unparse_statistics(struct ovsdb_idl_row *row_)
35710
0
{
35711
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35712
0
    free(row->key_statistics);
35713
0
    free(row->value_statistics);
35714
0
}
35715
35716
static void
35717
ovsrec_port_unparse_status(struct ovsdb_idl_row *row_)
35718
0
{
35719
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35720
0
    smap_destroy(&row->status);
35721
0
}
35722
35723
static void
35724
ovsrec_port_unparse_tag(struct ovsdb_idl_row *row_)
35725
0
{
35726
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35727
0
    free(row->tag);
35728
0
}
35729
35730
static void
35731
ovsrec_port_unparse_trunks(struct ovsdb_idl_row *row_)
35732
0
{
35733
0
    struct ovsrec_port *row = ovsrec_port_cast(row_);
35734
0
    free(row->trunks);
35735
0
}
35736
35737
static void
35738
ovsrec_port_unparse_vlan_mode(struct ovsdb_idl_row *row OVS_UNUSED)
35739
0
{
35740
    /* Nothing to do. */
35741
0
}
35742
35743
static void
35744
ovsrec_port_init__(struct ovsdb_idl_row *row)
35745
0
{
35746
0
    ovsrec_port_init(ovsrec_port_cast(row));
35747
0
}
35748
35749
/* Clears the contents of 'row' in table "Port". */
35750
void
35751
ovsrec_port_init(struct ovsrec_port *row)
35752
0
{
35753
0
    memset(row, 0, sizeof *row); 
35754
0
    smap_init(&row->external_ids);
35755
0
    row->name = "";
35756
0
    smap_init(&row->other_config);
35757
0
    smap_init(&row->rstp_status);
35758
0
    smap_init(&row->status);
35759
0
}
35760
35761
/* Searches table "Port" in 'idl' for a row with UUID 'uuid'.  Returns
35762
 * a pointer to the row if there is one, otherwise a null pointer.  */
35763
const struct ovsrec_port *
35764
ovsrec_port_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
35765
0
{
35766
0
    return ovsrec_port_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_port, uuid));
35767
0
}
35768
35769
/* Searches table "Port" for a row with UUID 'uuid'.  Returns
35770
 * a pointer to the row if there is one, otherwise a null pointer.  */
35771
const struct ovsrec_port *
35772
ovsrec_port_table_get_for_uuid(const struct ovsrec_port_table *table, const struct uuid *uuid)
35773
0
{
35774
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
35775
0
    return ovsrec_port_get_for_uuid(idl, uuid);
35776
0
}
35777
35778
/* Returns a row in table "Port" in 'idl', or a null pointer if that
35779
 * table is empty.
35780
 *
35781
 * Database tables are internally maintained as hash tables, so adding or
35782
 * removing rows while traversing the same table can cause some rows to be
35783
 * visited twice or not at apply. */
35784
const struct ovsrec_port *
35785
ovsrec_port_first(const struct ovsdb_idl *idl)
35786
0
{
35787
0
    return ovsrec_port_cast(ovsdb_idl_first_row(idl, &ovsrec_table_port));
35788
0
}
35789
35790
/* Returns a row following 'row' within its table, or a null pointer if 'row'
35791
 * is the last row in its table. */
35792
const struct ovsrec_port *
35793
ovsrec_port_next(const struct ovsrec_port *row)
35794
0
{
35795
0
    return ovsrec_port_cast(ovsdb_idl_next_row(&row->header_));
35796
0
}
35797
35798
unsigned int ovsrec_port_get_seqno(const struct ovsdb_idl *idl)
35799
0
{
35800
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_port);
35801
0
}
35802
35803
unsigned int ovsrec_port_row_get_seqno(const struct ovsrec_port *row, enum ovsdb_idl_change change)
35804
0
{
35805
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
35806
0
}
35807
35808
const struct ovsrec_port *
35809
ovsrec_port_track_get_first(const struct ovsdb_idl *idl)
35810
0
{
35811
0
    return ovsrec_port_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_port));
35812
0
}
35813
35814
const struct ovsrec_port
35815
*ovsrec_port_track_get_next(const struct ovsrec_port *row)
35816
0
{
35817
0
    return ovsrec_port_cast(ovsdb_idl_track_get_next(&row->header_));
35818
0
}
35819
35820
35821
/* Deletes 'row' from table "Port".  'row' may be freed, so it must not be
35822
 * accessed afterward.
35823
 *
35824
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
35825
void
35826
ovsrec_port_delete(const struct ovsrec_port *row)
35827
0
{
35828
0
    ovsdb_idl_txn_delete(&row->header_);
35829
0
}
35830
35831
/* Inserts and returns a new row in the table "Port" in the database
35832
 * with open transaction 'txn'.
35833
 *
35834
 * The new row is assigned a randomly generated provisional UUID.
35835
 * ovsdb-server will assign a different UUID when 'txn' is committed,
35836
 * but the IDL will replace any uses of the provisional UUID in the
35837
 * data to be to be committed by the UUID assigned by ovsdb-server. */
35838
struct ovsrec_port *
35839
ovsrec_port_insert(struct ovsdb_idl_txn *txn)
35840
0
{
35841
0
    return ovsrec_port_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_port, NULL));
35842
0
}
35843
35844
/* Inserts and returns a new row in the table "Port" in the database
35845
 * with open transaction 'txn'.
35846
 *
35847
 * The new row is assigned the UUID specified in the 'uuid' parameter
35848
 * (which cannot be null).  ovsdb-server will try to assign the same
35849
 * UUID when 'txn' is committed. */
35850
struct ovsrec_port *
35851
ovsrec_port_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
35852
0
{
35853
0
    return ovsrec_port_cast(ovsdb_idl_txn_insert_persist_uuid(
35854
0
        txn, &ovsrec_table_port, uuid));
35855
0
}
35856
35857
bool
35858
ovsrec_port_is_updated(const struct ovsrec_port *row, enum ovsrec_port_column_id column)
35859
0
{
35860
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_port_columns[column]);
35861
0
}
35862
35863
/* Causes the original contents of column "bond_active_slave" in 'row' to be
35864
 * verified as a prerequisite to completing the transaction.  That is, if
35865
 * "bond_active_slave" in 'row' changed (or if 'row' was deleted) between the
35866
 * time that the IDL originally read its contents and the time that the
35867
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
35868
 *
35869
 * The intention is that, to ensure that no transaction commits based on dirty
35870
 * reads, an application should call this function any time "bond_active_slave" is
35871
 * read as part of a read-modify-write operation.
35872
 *
35873
 * In some cases this function reduces to a no-op, because the current value
35874
 * of "bond_active_slave" is already known:
35875
 *
35876
 *   - If 'row' is a row created by the current transaction (returned by
35877
 *     ovsrec_port_insert()).
35878
 *
35879
 *   - If "bond_active_slave" has already been modified (with
35880
 *     ovsrec_port_set_bond_active_slave()) within the current transaction.
35881
 *
35882
 * Because of the latter property, always call this function *before*
35883
 * ovsrec_port_set_bond_active_slave() for a given read-modify-write.
35884
 *
35885
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
35886
void
35887
ovsrec_port_verify_bond_active_slave(const struct ovsrec_port *row)
35888
0
{
35889
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_bond_active_slave);
35890
0
}
35891
35892
/* Causes the original contents of column "bond_downdelay" in 'row' to be
35893
 * verified as a prerequisite to completing the transaction.  That is, if
35894
 * "bond_downdelay" in 'row' changed (or if 'row' was deleted) between the
35895
 * time that the IDL originally read its contents and the time that the
35896
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
35897
 *
35898
 * The intention is that, to ensure that no transaction commits based on dirty
35899
 * reads, an application should call this function any time "bond_downdelay" is
35900
 * read as part of a read-modify-write operation.
35901
 *
35902
 * In some cases this function reduces to a no-op, because the current value
35903
 * of "bond_downdelay" is already known:
35904
 *
35905
 *   - If 'row' is a row created by the current transaction (returned by
35906
 *     ovsrec_port_insert()).
35907
 *
35908
 *   - If "bond_downdelay" has already been modified (with
35909
 *     ovsrec_port_set_bond_downdelay()) within the current transaction.
35910
 *
35911
 * Because of the latter property, always call this function *before*
35912
 * ovsrec_port_set_bond_downdelay() for a given read-modify-write.
35913
 *
35914
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
35915
void
35916
ovsrec_port_verify_bond_downdelay(const struct ovsrec_port *row)
35917
0
{
35918
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_bond_downdelay);
35919
0
}
35920
35921
/* Causes the original contents of column "bond_fake_iface" in 'row' to be
35922
 * verified as a prerequisite to completing the transaction.  That is, if
35923
 * "bond_fake_iface" in 'row' changed (or if 'row' was deleted) between the
35924
 * time that the IDL originally read its contents and the time that the
35925
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
35926
 *
35927
 * The intention is that, to ensure that no transaction commits based on dirty
35928
 * reads, an application should call this function any time "bond_fake_iface" is
35929
 * read as part of a read-modify-write operation.
35930
 *
35931
 * In some cases this function reduces to a no-op, because the current value
35932
 * of "bond_fake_iface" is already known:
35933
 *
35934
 *   - If 'row' is a row created by the current transaction (returned by
35935
 *     ovsrec_port_insert()).
35936
 *
35937
 *   - If "bond_fake_iface" has already been modified (with
35938
 *     ovsrec_port_set_bond_fake_iface()) within the current transaction.
35939
 *
35940
 * Because of the latter property, always call this function *before*
35941
 * ovsrec_port_set_bond_fake_iface() for a given read-modify-write.
35942
 *
35943
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
35944
void
35945
ovsrec_port_verify_bond_fake_iface(const struct ovsrec_port *row)
35946
0
{
35947
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_bond_fake_iface);
35948
0
}
35949
35950
/* Causes the original contents of column "bond_mode" in 'row' to be
35951
 * verified as a prerequisite to completing the transaction.  That is, if
35952
 * "bond_mode" in 'row' changed (or if 'row' was deleted) between the
35953
 * time that the IDL originally read its contents and the time that the
35954
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
35955
 *
35956
 * The intention is that, to ensure that no transaction commits based on dirty
35957
 * reads, an application should call this function any time "bond_mode" is
35958
 * read as part of a read-modify-write operation.
35959
 *
35960
 * In some cases this function reduces to a no-op, because the current value
35961
 * of "bond_mode" is already known:
35962
 *
35963
 *   - If 'row' is a row created by the current transaction (returned by
35964
 *     ovsrec_port_insert()).
35965
 *
35966
 *   - If "bond_mode" has already been modified (with
35967
 *     ovsrec_port_set_bond_mode()) within the current transaction.
35968
 *
35969
 * Because of the latter property, always call this function *before*
35970
 * ovsrec_port_set_bond_mode() for a given read-modify-write.
35971
 *
35972
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
35973
void
35974
ovsrec_port_verify_bond_mode(const struct ovsrec_port *row)
35975
0
{
35976
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_bond_mode);
35977
0
}
35978
35979
/* Causes the original contents of column "bond_updelay" in 'row' to be
35980
 * verified as a prerequisite to completing the transaction.  That is, if
35981
 * "bond_updelay" in 'row' changed (or if 'row' was deleted) between the
35982
 * time that the IDL originally read its contents and the time that the
35983
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
35984
 *
35985
 * The intention is that, to ensure that no transaction commits based on dirty
35986
 * reads, an application should call this function any time "bond_updelay" is
35987
 * read as part of a read-modify-write operation.
35988
 *
35989
 * In some cases this function reduces to a no-op, because the current value
35990
 * of "bond_updelay" is already known:
35991
 *
35992
 *   - If 'row' is a row created by the current transaction (returned by
35993
 *     ovsrec_port_insert()).
35994
 *
35995
 *   - If "bond_updelay" has already been modified (with
35996
 *     ovsrec_port_set_bond_updelay()) within the current transaction.
35997
 *
35998
 * Because of the latter property, always call this function *before*
35999
 * ovsrec_port_set_bond_updelay() for a given read-modify-write.
36000
 *
36001
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36002
void
36003
ovsrec_port_verify_bond_updelay(const struct ovsrec_port *row)
36004
0
{
36005
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_bond_updelay);
36006
0
}
36007
36008
/* Causes the original contents of column "cvlans" in 'row' to be
36009
 * verified as a prerequisite to completing the transaction.  That is, if
36010
 * "cvlans" in 'row' changed (or if 'row' was deleted) between the
36011
 * time that the IDL originally read its contents and the time that the
36012
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36013
 *
36014
 * The intention is that, to ensure that no transaction commits based on dirty
36015
 * reads, an application should call this function any time "cvlans" is
36016
 * read as part of a read-modify-write operation.
36017
 *
36018
 * In some cases this function reduces to a no-op, because the current value
36019
 * of "cvlans" is already known:
36020
 *
36021
 *   - If 'row' is a row created by the current transaction (returned by
36022
 *     ovsrec_port_insert()).
36023
 *
36024
 *   - If "cvlans" has already been modified (with
36025
 *     ovsrec_port_set_cvlans()) within the current transaction.
36026
 *
36027
 * Because of the latter property, always call this function *before*
36028
 * ovsrec_port_set_cvlans() for a given read-modify-write.
36029
 *
36030
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36031
void
36032
ovsrec_port_verify_cvlans(const struct ovsrec_port *row)
36033
0
{
36034
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_cvlans);
36035
0
}
36036
36037
/* Causes the original contents of column "external_ids" in 'row' to be
36038
 * verified as a prerequisite to completing the transaction.  That is, if
36039
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
36040
 * time that the IDL originally read its contents and the time that the
36041
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36042
 *
36043
 * The intention is that, to ensure that no transaction commits based on dirty
36044
 * reads, an application should call this function any time "external_ids" is
36045
 * read as part of a read-modify-write operation.
36046
 *
36047
 * In some cases this function reduces to a no-op, because the current value
36048
 * of "external_ids" is already known:
36049
 *
36050
 *   - If 'row' is a row created by the current transaction (returned by
36051
 *     ovsrec_port_insert()).
36052
 *
36053
 *   - If "external_ids" has already been modified (with
36054
 *     ovsrec_port_set_external_ids()) within the current transaction.
36055
 *
36056
 * Because of the latter property, always call this function *before*
36057
 * ovsrec_port_set_external_ids() for a given read-modify-write.
36058
 *
36059
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36060
void
36061
ovsrec_port_verify_external_ids(const struct ovsrec_port *row)
36062
0
{
36063
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_external_ids);
36064
0
}
36065
36066
/* Causes the original contents of column "fake_bridge" in 'row' to be
36067
 * verified as a prerequisite to completing the transaction.  That is, if
36068
 * "fake_bridge" in 'row' changed (or if 'row' was deleted) between the
36069
 * time that the IDL originally read its contents and the time that the
36070
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36071
 *
36072
 * The intention is that, to ensure that no transaction commits based on dirty
36073
 * reads, an application should call this function any time "fake_bridge" is
36074
 * read as part of a read-modify-write operation.
36075
 *
36076
 * In some cases this function reduces to a no-op, because the current value
36077
 * of "fake_bridge" is already known:
36078
 *
36079
 *   - If 'row' is a row created by the current transaction (returned by
36080
 *     ovsrec_port_insert()).
36081
 *
36082
 *   - If "fake_bridge" has already been modified (with
36083
 *     ovsrec_port_set_fake_bridge()) within the current transaction.
36084
 *
36085
 * Because of the latter property, always call this function *before*
36086
 * ovsrec_port_set_fake_bridge() for a given read-modify-write.
36087
 *
36088
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36089
void
36090
ovsrec_port_verify_fake_bridge(const struct ovsrec_port *row)
36091
0
{
36092
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_fake_bridge);
36093
0
}
36094
36095
/* Causes the original contents of column "interfaces" in 'row' to be
36096
 * verified as a prerequisite to completing the transaction.  That is, if
36097
 * "interfaces" in 'row' changed (or if 'row' was deleted) between the
36098
 * time that the IDL originally read its contents and the time that the
36099
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36100
 *
36101
 * The intention is that, to ensure that no transaction commits based on dirty
36102
 * reads, an application should call this function any time "interfaces" is
36103
 * read as part of a read-modify-write operation.
36104
 *
36105
 * In some cases this function reduces to a no-op, because the current value
36106
 * of "interfaces" is already known:
36107
 *
36108
 *   - If 'row' is a row created by the current transaction (returned by
36109
 *     ovsrec_port_insert()).
36110
 *
36111
 *   - If "interfaces" has already been modified (with
36112
 *     ovsrec_port_set_interfaces()) within the current transaction.
36113
 *
36114
 * Because of the latter property, always call this function *before*
36115
 * ovsrec_port_set_interfaces() for a given read-modify-write.
36116
 *
36117
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36118
void
36119
ovsrec_port_verify_interfaces(const struct ovsrec_port *row)
36120
0
{
36121
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_interfaces);
36122
0
}
36123
36124
/* Causes the original contents of column "lacp" in 'row' to be
36125
 * verified as a prerequisite to completing the transaction.  That is, if
36126
 * "lacp" in 'row' changed (or if 'row' was deleted) between the
36127
 * time that the IDL originally read its contents and the time that the
36128
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36129
 *
36130
 * The intention is that, to ensure that no transaction commits based on dirty
36131
 * reads, an application should call this function any time "lacp" is
36132
 * read as part of a read-modify-write operation.
36133
 *
36134
 * In some cases this function reduces to a no-op, because the current value
36135
 * of "lacp" is already known:
36136
 *
36137
 *   - If 'row' is a row created by the current transaction (returned by
36138
 *     ovsrec_port_insert()).
36139
 *
36140
 *   - If "lacp" has already been modified (with
36141
 *     ovsrec_port_set_lacp()) within the current transaction.
36142
 *
36143
 * Because of the latter property, always call this function *before*
36144
 * ovsrec_port_set_lacp() for a given read-modify-write.
36145
 *
36146
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36147
void
36148
ovsrec_port_verify_lacp(const struct ovsrec_port *row)
36149
0
{
36150
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_lacp);
36151
0
}
36152
36153
/* Causes the original contents of column "mac" in 'row' to be
36154
 * verified as a prerequisite to completing the transaction.  That is, if
36155
 * "mac" in 'row' changed (or if 'row' was deleted) between the
36156
 * time that the IDL originally read its contents and the time that the
36157
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36158
 *
36159
 * The intention is that, to ensure that no transaction commits based on dirty
36160
 * reads, an application should call this function any time "mac" is
36161
 * read as part of a read-modify-write operation.
36162
 *
36163
 * In some cases this function reduces to a no-op, because the current value
36164
 * of "mac" is already known:
36165
 *
36166
 *   - If 'row' is a row created by the current transaction (returned by
36167
 *     ovsrec_port_insert()).
36168
 *
36169
 *   - If "mac" has already been modified (with
36170
 *     ovsrec_port_set_mac()) within the current transaction.
36171
 *
36172
 * Because of the latter property, always call this function *before*
36173
 * ovsrec_port_set_mac() for a given read-modify-write.
36174
 *
36175
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36176
void
36177
ovsrec_port_verify_mac(const struct ovsrec_port *row)
36178
0
{
36179
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_mac);
36180
0
}
36181
36182
/* Causes the original contents of column "name" in 'row' to be
36183
 * verified as a prerequisite to completing the transaction.  That is, if
36184
 * "name" in 'row' changed (or if 'row' was deleted) between the
36185
 * time that the IDL originally read its contents and the time that the
36186
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36187
 *
36188
 * The intention is that, to ensure that no transaction commits based on dirty
36189
 * reads, an application should call this function any time "name" is
36190
 * read as part of a read-modify-write operation.
36191
 *
36192
 * In some cases this function reduces to a no-op, because the current value
36193
 * of "name" is already known:
36194
 *
36195
 *   - If 'row' is a row created by the current transaction (returned by
36196
 *     ovsrec_port_insert()).
36197
 *
36198
 *   - If "name" has already been modified (with
36199
 *     ovsrec_port_set_name()) within the current transaction.
36200
 *
36201
 * Because of the latter property, always call this function *before*
36202
 * ovsrec_port_set_name() for a given read-modify-write.
36203
 *
36204
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36205
void
36206
ovsrec_port_verify_name(const struct ovsrec_port *row)
36207
0
{
36208
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_name);
36209
0
}
36210
36211
/* Causes the original contents of column "other_config" in 'row' to be
36212
 * verified as a prerequisite to completing the transaction.  That is, if
36213
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
36214
 * time that the IDL originally read its contents and the time that the
36215
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36216
 *
36217
 * The intention is that, to ensure that no transaction commits based on dirty
36218
 * reads, an application should call this function any time "other_config" is
36219
 * read as part of a read-modify-write operation.
36220
 *
36221
 * In some cases this function reduces to a no-op, because the current value
36222
 * of "other_config" is already known:
36223
 *
36224
 *   - If 'row' is a row created by the current transaction (returned by
36225
 *     ovsrec_port_insert()).
36226
 *
36227
 *   - If "other_config" has already been modified (with
36228
 *     ovsrec_port_set_other_config()) within the current transaction.
36229
 *
36230
 * Because of the latter property, always call this function *before*
36231
 * ovsrec_port_set_other_config() for a given read-modify-write.
36232
 *
36233
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36234
void
36235
ovsrec_port_verify_other_config(const struct ovsrec_port *row)
36236
0
{
36237
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_other_config);
36238
0
}
36239
36240
/* Causes the original contents of column "protected_" in 'row' to be
36241
 * verified as a prerequisite to completing the transaction.  That is, if
36242
 * "protected_" in 'row' changed (or if 'row' was deleted) between the
36243
 * time that the IDL originally read its contents and the time that the
36244
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36245
 *
36246
 * The intention is that, to ensure that no transaction commits based on dirty
36247
 * reads, an application should call this function any time "protected_" is
36248
 * read as part of a read-modify-write operation.
36249
 *
36250
 * In some cases this function reduces to a no-op, because the current value
36251
 * of "protected_" is already known:
36252
 *
36253
 *   - If 'row' is a row created by the current transaction (returned by
36254
 *     ovsrec_port_insert()).
36255
 *
36256
 *   - If "protected_" has already been modified (with
36257
 *     ovsrec_port_set_protected_()) within the current transaction.
36258
 *
36259
 * Because of the latter property, always call this function *before*
36260
 * ovsrec_port_set_protected_() for a given read-modify-write.
36261
 *
36262
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36263
void
36264
ovsrec_port_verify_protected_(const struct ovsrec_port *row)
36265
0
{
36266
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_protected_);
36267
0
}
36268
36269
/* Causes the original contents of column "qos" in 'row' to be
36270
 * verified as a prerequisite to completing the transaction.  That is, if
36271
 * "qos" in 'row' changed (or if 'row' was deleted) between the
36272
 * time that the IDL originally read its contents and the time that the
36273
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36274
 *
36275
 * The intention is that, to ensure that no transaction commits based on dirty
36276
 * reads, an application should call this function any time "qos" is
36277
 * read as part of a read-modify-write operation.
36278
 *
36279
 * In some cases this function reduces to a no-op, because the current value
36280
 * of "qos" is already known:
36281
 *
36282
 *   - If 'row' is a row created by the current transaction (returned by
36283
 *     ovsrec_port_insert()).
36284
 *
36285
 *   - If "qos" has already been modified (with
36286
 *     ovsrec_port_set_qos()) within the current transaction.
36287
 *
36288
 * Because of the latter property, always call this function *before*
36289
 * ovsrec_port_set_qos() for a given read-modify-write.
36290
 *
36291
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36292
void
36293
ovsrec_port_verify_qos(const struct ovsrec_port *row)
36294
0
{
36295
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_qos);
36296
0
}
36297
36298
/* Causes the original contents of column "rstp_statistics" in 'row' to be
36299
 * verified as a prerequisite to completing the transaction.  That is, if
36300
 * "rstp_statistics" in 'row' changed (or if 'row' was deleted) between the
36301
 * time that the IDL originally read its contents and the time that the
36302
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36303
 *
36304
 * The intention is that, to ensure that no transaction commits based on dirty
36305
 * reads, an application should call this function any time "rstp_statistics" is
36306
 * read as part of a read-modify-write operation.
36307
 *
36308
 * In some cases this function reduces to a no-op, because the current value
36309
 * of "rstp_statistics" is already known:
36310
 *
36311
 *   - If 'row' is a row created by the current transaction (returned by
36312
 *     ovsrec_port_insert()).
36313
 *
36314
 *   - If "rstp_statistics" has already been modified (with
36315
 *     ovsrec_port_set_rstp_statistics()) within the current transaction.
36316
 *
36317
 * Because of the latter property, always call this function *before*
36318
 * ovsrec_port_set_rstp_statistics() for a given read-modify-write.
36319
 *
36320
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36321
void
36322
ovsrec_port_verify_rstp_statistics(const struct ovsrec_port *row)
36323
0
{
36324
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_rstp_statistics);
36325
0
}
36326
36327
/* Causes the original contents of column "rstp_status" in 'row' to be
36328
 * verified as a prerequisite to completing the transaction.  That is, if
36329
 * "rstp_status" in 'row' changed (or if 'row' was deleted) between the
36330
 * time that the IDL originally read its contents and the time that the
36331
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36332
 *
36333
 * The intention is that, to ensure that no transaction commits based on dirty
36334
 * reads, an application should call this function any time "rstp_status" is
36335
 * read as part of a read-modify-write operation.
36336
 *
36337
 * In some cases this function reduces to a no-op, because the current value
36338
 * of "rstp_status" is already known:
36339
 *
36340
 *   - If 'row' is a row created by the current transaction (returned by
36341
 *     ovsrec_port_insert()).
36342
 *
36343
 *   - If "rstp_status" has already been modified (with
36344
 *     ovsrec_port_set_rstp_status()) within the current transaction.
36345
 *
36346
 * Because of the latter property, always call this function *before*
36347
 * ovsrec_port_set_rstp_status() for a given read-modify-write.
36348
 *
36349
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36350
void
36351
ovsrec_port_verify_rstp_status(const struct ovsrec_port *row)
36352
0
{
36353
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_rstp_status);
36354
0
}
36355
36356
/* Causes the original contents of column "statistics" in 'row' to be
36357
 * verified as a prerequisite to completing the transaction.  That is, if
36358
 * "statistics" in 'row' changed (or if 'row' was deleted) between the
36359
 * time that the IDL originally read its contents and the time that the
36360
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36361
 *
36362
 * The intention is that, to ensure that no transaction commits based on dirty
36363
 * reads, an application should call this function any time "statistics" is
36364
 * read as part of a read-modify-write operation.
36365
 *
36366
 * In some cases this function reduces to a no-op, because the current value
36367
 * of "statistics" is already known:
36368
 *
36369
 *   - If 'row' is a row created by the current transaction (returned by
36370
 *     ovsrec_port_insert()).
36371
 *
36372
 *   - If "statistics" has already been modified (with
36373
 *     ovsrec_port_set_statistics()) within the current transaction.
36374
 *
36375
 * Because of the latter property, always call this function *before*
36376
 * ovsrec_port_set_statistics() for a given read-modify-write.
36377
 *
36378
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36379
void
36380
ovsrec_port_verify_statistics(const struct ovsrec_port *row)
36381
0
{
36382
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_statistics);
36383
0
}
36384
36385
/* Causes the original contents of column "status" in 'row' to be
36386
 * verified as a prerequisite to completing the transaction.  That is, if
36387
 * "status" in 'row' changed (or if 'row' was deleted) between the
36388
 * time that the IDL originally read its contents and the time that the
36389
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36390
 *
36391
 * The intention is that, to ensure that no transaction commits based on dirty
36392
 * reads, an application should call this function any time "status" is
36393
 * read as part of a read-modify-write operation.
36394
 *
36395
 * In some cases this function reduces to a no-op, because the current value
36396
 * of "status" is already known:
36397
 *
36398
 *   - If 'row' is a row created by the current transaction (returned by
36399
 *     ovsrec_port_insert()).
36400
 *
36401
 *   - If "status" has already been modified (with
36402
 *     ovsrec_port_set_status()) within the current transaction.
36403
 *
36404
 * Because of the latter property, always call this function *before*
36405
 * ovsrec_port_set_status() for a given read-modify-write.
36406
 *
36407
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36408
void
36409
ovsrec_port_verify_status(const struct ovsrec_port *row)
36410
0
{
36411
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_status);
36412
0
}
36413
36414
/* Causes the original contents of column "tag" in 'row' to be
36415
 * verified as a prerequisite to completing the transaction.  That is, if
36416
 * "tag" in 'row' changed (or if 'row' was deleted) between the
36417
 * time that the IDL originally read its contents and the time that the
36418
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36419
 *
36420
 * The intention is that, to ensure that no transaction commits based on dirty
36421
 * reads, an application should call this function any time "tag" is
36422
 * read as part of a read-modify-write operation.
36423
 *
36424
 * In some cases this function reduces to a no-op, because the current value
36425
 * of "tag" is already known:
36426
 *
36427
 *   - If 'row' is a row created by the current transaction (returned by
36428
 *     ovsrec_port_insert()).
36429
 *
36430
 *   - If "tag" has already been modified (with
36431
 *     ovsrec_port_set_tag()) within the current transaction.
36432
 *
36433
 * Because of the latter property, always call this function *before*
36434
 * ovsrec_port_set_tag() for a given read-modify-write.
36435
 *
36436
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36437
void
36438
ovsrec_port_verify_tag(const struct ovsrec_port *row)
36439
0
{
36440
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_tag);
36441
0
}
36442
36443
/* Causes the original contents of column "trunks" in 'row' to be
36444
 * verified as a prerequisite to completing the transaction.  That is, if
36445
 * "trunks" in 'row' changed (or if 'row' was deleted) between the
36446
 * time that the IDL originally read its contents and the time that the
36447
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36448
 *
36449
 * The intention is that, to ensure that no transaction commits based on dirty
36450
 * reads, an application should call this function any time "trunks" is
36451
 * read as part of a read-modify-write operation.
36452
 *
36453
 * In some cases this function reduces to a no-op, because the current value
36454
 * of "trunks" is already known:
36455
 *
36456
 *   - If 'row' is a row created by the current transaction (returned by
36457
 *     ovsrec_port_insert()).
36458
 *
36459
 *   - If "trunks" has already been modified (with
36460
 *     ovsrec_port_set_trunks()) within the current transaction.
36461
 *
36462
 * Because of the latter property, always call this function *before*
36463
 * ovsrec_port_set_trunks() for a given read-modify-write.
36464
 *
36465
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36466
void
36467
ovsrec_port_verify_trunks(const struct ovsrec_port *row)
36468
0
{
36469
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_trunks);
36470
0
}
36471
36472
/* Causes the original contents of column "vlan_mode" in 'row' to be
36473
 * verified as a prerequisite to completing the transaction.  That is, if
36474
 * "vlan_mode" in 'row' changed (or if 'row' was deleted) between the
36475
 * time that the IDL originally read its contents and the time that the
36476
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
36477
 *
36478
 * The intention is that, to ensure that no transaction commits based on dirty
36479
 * reads, an application should call this function any time "vlan_mode" is
36480
 * read as part of a read-modify-write operation.
36481
 *
36482
 * In some cases this function reduces to a no-op, because the current value
36483
 * of "vlan_mode" is already known:
36484
 *
36485
 *   - If 'row' is a row created by the current transaction (returned by
36486
 *     ovsrec_port_insert()).
36487
 *
36488
 *   - If "vlan_mode" has already been modified (with
36489
 *     ovsrec_port_set_vlan_mode()) within the current transaction.
36490
 *
36491
 * Because of the latter property, always call this function *before*
36492
 * ovsrec_port_set_vlan_mode() for a given read-modify-write.
36493
 *
36494
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
36495
void
36496
ovsrec_port_verify_vlan_mode(const struct ovsrec_port *row)
36497
0
{
36498
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_col_vlan_mode);
36499
0
}
36500
36501
/* Returns the "bond_active_slave" column's value from the "Port" table in 'row'
36502
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36503
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36504
 * for a given key than implementing the same operation on the "cooked"
36505
 * form in 'row'.
36506
 *
36507
 * 'key_type' must be OVSDB_TYPE_STRING.
36508
 * (This helps to avoid silent bugs if someone changes bond_active_slave's
36509
 * type without updating the caller.)
36510
 *
36511
 * The caller must not modify or free the returned value.
36512
 *
36513
 * Various kinds of changes can invalidate the returned value: modifying
36514
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36515
 * If the returned value is needed for a long time, it is best to make a copy
36516
 * of it with ovsdb_datum_clone().
36517
 *
36518
 * This function is rarely useful, since it is easier to access the value
36519
 * directly through the "bond_active_slave" member in ovsrec_port. */
36520
const struct ovsdb_datum *
36521
ovsrec_port_get_bond_active_slave(const struct ovsrec_port *row,
36522
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36523
0
{
36524
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
36525
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_active_slave);
36526
0
}
36527
36528
/* Returns the "bond_downdelay" column's value from the "Port" table in 'row'
36529
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36530
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36531
 * for a given key than implementing the same operation on the "cooked"
36532
 * form in 'row'.
36533
 *
36534
 * 'key_type' must be OVSDB_TYPE_INTEGER.
36535
 * (This helps to avoid silent bugs if someone changes bond_downdelay's
36536
 * type without updating the caller.)
36537
 *
36538
 * The caller must not modify or free the returned value.
36539
 *
36540
 * Various kinds of changes can invalidate the returned value: modifying
36541
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36542
 * If the returned value is needed for a long time, it is best to make a copy
36543
 * of it with ovsdb_datum_clone().
36544
 *
36545
 * This function is rarely useful, since it is easier to access the value
36546
 * directly through the "bond_downdelay" member in ovsrec_port. */
36547
const struct ovsdb_datum *
36548
ovsrec_port_get_bond_downdelay(const struct ovsrec_port *row,
36549
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36550
0
{
36551
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
36552
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_downdelay);
36553
0
}
36554
36555
/* Returns the "bond_fake_iface" column's value from the "Port" table in 'row'
36556
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36557
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36558
 * for a given key than implementing the same operation on the "cooked"
36559
 * form in 'row'.
36560
 *
36561
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
36562
 * (This helps to avoid silent bugs if someone changes bond_fake_iface's
36563
 * type without updating the caller.)
36564
 *
36565
 * The caller must not modify or free the returned value.
36566
 *
36567
 * Various kinds of changes can invalidate the returned value: modifying
36568
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36569
 * If the returned value is needed for a long time, it is best to make a copy
36570
 * of it with ovsdb_datum_clone().
36571
 *
36572
 * This function is rarely useful, since it is easier to access the value
36573
 * directly through the "bond_fake_iface" member in ovsrec_port. */
36574
const struct ovsdb_datum *
36575
ovsrec_port_get_bond_fake_iface(const struct ovsrec_port *row,
36576
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36577
0
{
36578
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
36579
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_fake_iface);
36580
0
}
36581
36582
/* Returns the "bond_mode" column's value from the "Port" table in 'row'
36583
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36584
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36585
 * for a given key than implementing the same operation on the "cooked"
36586
 * form in 'row'.
36587
 *
36588
 * 'key_type' must be OVSDB_TYPE_STRING.
36589
 * (This helps to avoid silent bugs if someone changes bond_mode's
36590
 * type without updating the caller.)
36591
 *
36592
 * The caller must not modify or free the returned value.
36593
 *
36594
 * Various kinds of changes can invalidate the returned value: modifying
36595
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36596
 * If the returned value is needed for a long time, it is best to make a copy
36597
 * of it with ovsdb_datum_clone().
36598
 *
36599
 * This function is rarely useful, since it is easier to access the value
36600
 * directly through the "bond_mode" member in ovsrec_port. */
36601
const struct ovsdb_datum *
36602
ovsrec_port_get_bond_mode(const struct ovsrec_port *row,
36603
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36604
0
{
36605
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
36606
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_mode);
36607
0
}
36608
36609
/* Returns the "bond_updelay" column's value from the "Port" table in 'row'
36610
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36611
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36612
 * for a given key than implementing the same operation on the "cooked"
36613
 * form in 'row'.
36614
 *
36615
 * 'key_type' must be OVSDB_TYPE_INTEGER.
36616
 * (This helps to avoid silent bugs if someone changes bond_updelay's
36617
 * type without updating the caller.)
36618
 *
36619
 * The caller must not modify or free the returned value.
36620
 *
36621
 * Various kinds of changes can invalidate the returned value: modifying
36622
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36623
 * If the returned value is needed for a long time, it is best to make a copy
36624
 * of it with ovsdb_datum_clone().
36625
 *
36626
 * This function is rarely useful, since it is easier to access the value
36627
 * directly through the "bond_updelay" member in ovsrec_port. */
36628
const struct ovsdb_datum *
36629
ovsrec_port_get_bond_updelay(const struct ovsrec_port *row,
36630
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36631
0
{
36632
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
36633
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_updelay);
36634
0
}
36635
36636
/* Returns the "cvlans" column's value from the "Port" table in 'row'
36637
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36638
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36639
 * for a given key than implementing the same operation on the "cooked"
36640
 * form in 'row'.
36641
 *
36642
 * 'key_type' must be OVSDB_TYPE_INTEGER.
36643
 * (This helps to avoid silent bugs if someone changes cvlans's
36644
 * type without updating the caller.)
36645
 *
36646
 * The caller must not modify or free the returned value.
36647
 *
36648
 * Various kinds of changes can invalidate the returned value: modifying
36649
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36650
 * If the returned value is needed for a long time, it is best to make a copy
36651
 * of it with ovsdb_datum_clone().
36652
 *
36653
 * This function is rarely useful, since it is easier to access the value
36654
 * directly through the "cvlans" member in ovsrec_port. */
36655
const struct ovsdb_datum *
36656
ovsrec_port_get_cvlans(const struct ovsrec_port *row,
36657
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36658
0
{
36659
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
36660
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_cvlans);
36661
0
}
36662
36663
/* Returns the "external_ids" column's value from the "Port" table in 'row'
36664
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36665
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36666
 * for a given key than implementing the same operation on the "cooked"
36667
 * form in 'row'.
36668
 *
36669
 * 'key_type' must be OVSDB_TYPE_STRING.
36670
 * 'value_type' must be OVSDB_TYPE_STRING.
36671
 * (This helps to avoid silent bugs if someone changes external_ids's
36672
 * type without updating the caller.)
36673
 *
36674
 * The caller must not modify or free the returned value.
36675
 *
36676
 * Various kinds of changes can invalidate the returned value: modifying
36677
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36678
 * If the returned value is needed for a long time, it is best to make a copy
36679
 * of it with ovsdb_datum_clone().
36680
 *
36681
 * This function is rarely useful, since it is easier to access the value
36682
 * directly through the "external_ids" member in ovsrec_port. */
36683
const struct ovsdb_datum *
36684
ovsrec_port_get_external_ids(const struct ovsrec_port *row,
36685
  enum ovsdb_atomic_type key_type OVS_UNUSED,
36686
  enum ovsdb_atomic_type value_type OVS_UNUSED)
36687
0
{
36688
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
36689
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
36690
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_external_ids);
36691
0
}
36692
36693
/* Returns the "fake_bridge" column's value from the "Port" table in 'row'
36694
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36695
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36696
 * for a given key than implementing the same operation on the "cooked"
36697
 * form in 'row'.
36698
 *
36699
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
36700
 * (This helps to avoid silent bugs if someone changes fake_bridge's
36701
 * type without updating the caller.)
36702
 *
36703
 * The caller must not modify or free the returned value.
36704
 *
36705
 * Various kinds of changes can invalidate the returned value: modifying
36706
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36707
 * If the returned value is needed for a long time, it is best to make a copy
36708
 * of it with ovsdb_datum_clone().
36709
 *
36710
 * This function is rarely useful, since it is easier to access the value
36711
 * directly through the "fake_bridge" member in ovsrec_port. */
36712
const struct ovsdb_datum *
36713
ovsrec_port_get_fake_bridge(const struct ovsrec_port *row,
36714
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36715
0
{
36716
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
36717
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_fake_bridge);
36718
0
}
36719
36720
/* Returns the "interfaces" column's value from the "Port" table in 'row'
36721
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36722
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36723
 * for a given key than implementing the same operation on the "cooked"
36724
 * form in 'row'.
36725
 *
36726
 * 'key_type' must be OVSDB_TYPE_UUID.
36727
 * (This helps to avoid silent bugs if someone changes interfaces's
36728
 * type without updating the caller.)
36729
 *
36730
 * The caller must not modify or free the returned value.
36731
 *
36732
 * Various kinds of changes can invalidate the returned value: modifying
36733
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36734
 * If the returned value is needed for a long time, it is best to make a copy
36735
 * of it with ovsdb_datum_clone().
36736
 *
36737
 * This function is rarely useful, since it is easier to access the value
36738
 * directly through the "interfaces" member in ovsrec_port. */
36739
const struct ovsdb_datum *
36740
ovsrec_port_get_interfaces(const struct ovsrec_port *row,
36741
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36742
0
{
36743
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
36744
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_interfaces);
36745
0
}
36746
36747
/* Returns the "lacp" column's value from the "Port" table in 'row'
36748
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36749
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36750
 * for a given key than implementing the same operation on the "cooked"
36751
 * form in 'row'.
36752
 *
36753
 * 'key_type' must be OVSDB_TYPE_STRING.
36754
 * (This helps to avoid silent bugs if someone changes lacp's
36755
 * type without updating the caller.)
36756
 *
36757
 * The caller must not modify or free the returned value.
36758
 *
36759
 * Various kinds of changes can invalidate the returned value: modifying
36760
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36761
 * If the returned value is needed for a long time, it is best to make a copy
36762
 * of it with ovsdb_datum_clone().
36763
 *
36764
 * This function is rarely useful, since it is easier to access the value
36765
 * directly through the "lacp" member in ovsrec_port. */
36766
const struct ovsdb_datum *
36767
ovsrec_port_get_lacp(const struct ovsrec_port *row,
36768
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36769
0
{
36770
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
36771
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_lacp);
36772
0
}
36773
36774
/* Returns the "mac" column's value from the "Port" table in 'row'
36775
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36776
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36777
 * for a given key than implementing the same operation on the "cooked"
36778
 * form in 'row'.
36779
 *
36780
 * 'key_type' must be OVSDB_TYPE_STRING.
36781
 * (This helps to avoid silent bugs if someone changes mac's
36782
 * type without updating the caller.)
36783
 *
36784
 * The caller must not modify or free the returned value.
36785
 *
36786
 * Various kinds of changes can invalidate the returned value: modifying
36787
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36788
 * If the returned value is needed for a long time, it is best to make a copy
36789
 * of it with ovsdb_datum_clone().
36790
 *
36791
 * This function is rarely useful, since it is easier to access the value
36792
 * directly through the "mac" member in ovsrec_port. */
36793
const struct ovsdb_datum *
36794
ovsrec_port_get_mac(const struct ovsrec_port *row,
36795
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36796
0
{
36797
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
36798
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_mac);
36799
0
}
36800
36801
/* Returns the "name" column's value from the "Port" table in 'row'
36802
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36803
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36804
 * for a given key than implementing the same operation on the "cooked"
36805
 * form in 'row'.
36806
 *
36807
 * 'key_type' must be OVSDB_TYPE_STRING.
36808
 * (This helps to avoid silent bugs if someone changes name's
36809
 * type without updating the caller.)
36810
 *
36811
 * The caller must not modify or free the returned value.
36812
 *
36813
 * Various kinds of changes can invalidate the returned value: modifying
36814
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36815
 * If the returned value is needed for a long time, it is best to make a copy
36816
 * of it with ovsdb_datum_clone().
36817
 *
36818
 * This function is rarely useful, since it is easier to access the value
36819
 * directly through the "name" member in ovsrec_port. */
36820
const struct ovsdb_datum *
36821
ovsrec_port_get_name(const struct ovsrec_port *row,
36822
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36823
0
{
36824
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
36825
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_name);
36826
0
}
36827
36828
/* Returns the "other_config" column's value from the "Port" table in 'row'
36829
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36830
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36831
 * for a given key than implementing the same operation on the "cooked"
36832
 * form in 'row'.
36833
 *
36834
 * 'key_type' must be OVSDB_TYPE_STRING.
36835
 * 'value_type' must be OVSDB_TYPE_STRING.
36836
 * (This helps to avoid silent bugs if someone changes other_config's
36837
 * type without updating the caller.)
36838
 *
36839
 * The caller must not modify or free the returned value.
36840
 *
36841
 * Various kinds of changes can invalidate the returned value: modifying
36842
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36843
 * If the returned value is needed for a long time, it is best to make a copy
36844
 * of it with ovsdb_datum_clone().
36845
 *
36846
 * This function is rarely useful, since it is easier to access the value
36847
 * directly through the "other_config" member in ovsrec_port. */
36848
const struct ovsdb_datum *
36849
ovsrec_port_get_other_config(const struct ovsrec_port *row,
36850
  enum ovsdb_atomic_type key_type OVS_UNUSED,
36851
  enum ovsdb_atomic_type value_type OVS_UNUSED)
36852
0
{
36853
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
36854
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
36855
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_other_config);
36856
0
}
36857
36858
/* Returns the "protected_" column's value from the "Port" table in 'row'
36859
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36860
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36861
 * for a given key than implementing the same operation on the "cooked"
36862
 * form in 'row'.
36863
 *
36864
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
36865
 * (This helps to avoid silent bugs if someone changes protected_'s
36866
 * type without updating the caller.)
36867
 *
36868
 * The caller must not modify or free the returned value.
36869
 *
36870
 * Various kinds of changes can invalidate the returned value: modifying
36871
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36872
 * If the returned value is needed for a long time, it is best to make a copy
36873
 * of it with ovsdb_datum_clone().
36874
 *
36875
 * This function is rarely useful, since it is easier to access the value
36876
 * directly through the "protected_" member in ovsrec_port. */
36877
const struct ovsdb_datum *
36878
ovsrec_port_get_protected_(const struct ovsrec_port *row,
36879
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36880
0
{
36881
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
36882
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_protected_);
36883
0
}
36884
36885
/* Returns the "qos" column's value from the "Port" table in 'row'
36886
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36887
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36888
 * for a given key than implementing the same operation on the "cooked"
36889
 * form in 'row'.
36890
 *
36891
 * 'key_type' must be OVSDB_TYPE_UUID.
36892
 * (This helps to avoid silent bugs if someone changes qos's
36893
 * type without updating the caller.)
36894
 *
36895
 * The caller must not modify or free the returned value.
36896
 *
36897
 * Various kinds of changes can invalidate the returned value: modifying
36898
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36899
 * If the returned value is needed for a long time, it is best to make a copy
36900
 * of it with ovsdb_datum_clone().
36901
 *
36902
 * This function is rarely useful, since it is easier to access the value
36903
 * directly through the "qos" member in ovsrec_port. */
36904
const struct ovsdb_datum *
36905
ovsrec_port_get_qos(const struct ovsrec_port *row,
36906
  enum ovsdb_atomic_type key_type OVS_UNUSED)
36907
0
{
36908
0
    ovs_assert(key_type == OVSDB_TYPE_UUID);
36909
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_qos);
36910
0
}
36911
36912
/* Returns the "rstp_statistics" column's value from the "Port" table in 'row'
36913
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36914
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36915
 * for a given key than implementing the same operation on the "cooked"
36916
 * form in 'row'.
36917
 *
36918
 * 'key_type' must be OVSDB_TYPE_STRING.
36919
 * 'value_type' must be OVSDB_TYPE_INTEGER.
36920
 * (This helps to avoid silent bugs if someone changes rstp_statistics's
36921
 * type without updating the caller.)
36922
 *
36923
 * The caller must not modify or free the returned value.
36924
 *
36925
 * Various kinds of changes can invalidate the returned value: modifying
36926
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36927
 * If the returned value is needed for a long time, it is best to make a copy
36928
 * of it with ovsdb_datum_clone().
36929
 *
36930
 * This function is rarely useful, since it is easier to access the value
36931
 * directly through the "rstp_statistics" member in ovsrec_port. */
36932
const struct ovsdb_datum *
36933
ovsrec_port_get_rstp_statistics(const struct ovsrec_port *row,
36934
  enum ovsdb_atomic_type key_type OVS_UNUSED,
36935
  enum ovsdb_atomic_type value_type OVS_UNUSED)
36936
0
{
36937
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
36938
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
36939
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_rstp_statistics);
36940
0
}
36941
36942
/* Returns the "rstp_status" column's value from the "Port" table in 'row'
36943
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36944
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36945
 * for a given key than implementing the same operation on the "cooked"
36946
 * form in 'row'.
36947
 *
36948
 * 'key_type' must be OVSDB_TYPE_STRING.
36949
 * 'value_type' must be OVSDB_TYPE_STRING.
36950
 * (This helps to avoid silent bugs if someone changes rstp_status's
36951
 * type without updating the caller.)
36952
 *
36953
 * The caller must not modify or free the returned value.
36954
 *
36955
 * Various kinds of changes can invalidate the returned value: modifying
36956
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36957
 * If the returned value is needed for a long time, it is best to make a copy
36958
 * of it with ovsdb_datum_clone().
36959
 *
36960
 * This function is rarely useful, since it is easier to access the value
36961
 * directly through the "rstp_status" member in ovsrec_port. */
36962
const struct ovsdb_datum *
36963
ovsrec_port_get_rstp_status(const struct ovsrec_port *row,
36964
  enum ovsdb_atomic_type key_type OVS_UNUSED,
36965
  enum ovsdb_atomic_type value_type OVS_UNUSED)
36966
0
{
36967
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
36968
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
36969
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_rstp_status);
36970
0
}
36971
36972
/* Returns the "statistics" column's value from the "Port" table in 'row'
36973
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
36974
 * ovsdb_datum_find_key() is an easier and more efficient way to search
36975
 * for a given key than implementing the same operation on the "cooked"
36976
 * form in 'row'.
36977
 *
36978
 * 'key_type' must be OVSDB_TYPE_STRING.
36979
 * 'value_type' must be OVSDB_TYPE_INTEGER.
36980
 * (This helps to avoid silent bugs if someone changes statistics's
36981
 * type without updating the caller.)
36982
 *
36983
 * The caller must not modify or free the returned value.
36984
 *
36985
 * Various kinds of changes can invalidate the returned value: modifying
36986
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
36987
 * If the returned value is needed for a long time, it is best to make a copy
36988
 * of it with ovsdb_datum_clone().
36989
 *
36990
 * This function is rarely useful, since it is easier to access the value
36991
 * directly through the "statistics" member in ovsrec_port. */
36992
const struct ovsdb_datum *
36993
ovsrec_port_get_statistics(const struct ovsrec_port *row,
36994
  enum ovsdb_atomic_type key_type OVS_UNUSED,
36995
  enum ovsdb_atomic_type value_type OVS_UNUSED)
36996
0
{
36997
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
36998
0
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
36999
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_statistics);
37000
0
}
37001
37002
/* Returns the "status" column's value from the "Port" table in 'row'
37003
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
37004
 * ovsdb_datum_find_key() is an easier and more efficient way to search
37005
 * for a given key than implementing the same operation on the "cooked"
37006
 * form in 'row'.
37007
 *
37008
 * 'key_type' must be OVSDB_TYPE_STRING.
37009
 * 'value_type' must be OVSDB_TYPE_STRING.
37010
 * (This helps to avoid silent bugs if someone changes status's
37011
 * type without updating the caller.)
37012
 *
37013
 * The caller must not modify or free the returned value.
37014
 *
37015
 * Various kinds of changes can invalidate the returned value: modifying
37016
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
37017
 * If the returned value is needed for a long time, it is best to make a copy
37018
 * of it with ovsdb_datum_clone().
37019
 *
37020
 * This function is rarely useful, since it is easier to access the value
37021
 * directly through the "status" member in ovsrec_port. */
37022
const struct ovsdb_datum *
37023
ovsrec_port_get_status(const struct ovsrec_port *row,
37024
  enum ovsdb_atomic_type key_type OVS_UNUSED,
37025
  enum ovsdb_atomic_type value_type OVS_UNUSED)
37026
0
{
37027
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
37028
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
37029
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_status);
37030
0
}
37031
37032
/* Returns the "tag" column's value from the "Port" table in 'row'
37033
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
37034
 * ovsdb_datum_find_key() is an easier and more efficient way to search
37035
 * for a given key than implementing the same operation on the "cooked"
37036
 * form in 'row'.
37037
 *
37038
 * 'key_type' must be OVSDB_TYPE_INTEGER.
37039
 * (This helps to avoid silent bugs if someone changes tag's
37040
 * type without updating the caller.)
37041
 *
37042
 * The caller must not modify or free the returned value.
37043
 *
37044
 * Various kinds of changes can invalidate the returned value: modifying
37045
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
37046
 * If the returned value is needed for a long time, it is best to make a copy
37047
 * of it with ovsdb_datum_clone().
37048
 *
37049
 * This function is rarely useful, since it is easier to access the value
37050
 * directly through the "tag" member in ovsrec_port. */
37051
const struct ovsdb_datum *
37052
ovsrec_port_get_tag(const struct ovsrec_port *row,
37053
  enum ovsdb_atomic_type key_type OVS_UNUSED)
37054
0
{
37055
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
37056
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_tag);
37057
0
}
37058
37059
/* Returns the "trunks" column's value from the "Port" table in 'row'
37060
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
37061
 * ovsdb_datum_find_key() is an easier and more efficient way to search
37062
 * for a given key than implementing the same operation on the "cooked"
37063
 * form in 'row'.
37064
 *
37065
 * 'key_type' must be OVSDB_TYPE_INTEGER.
37066
 * (This helps to avoid silent bugs if someone changes trunks's
37067
 * type without updating the caller.)
37068
 *
37069
 * The caller must not modify or free the returned value.
37070
 *
37071
 * Various kinds of changes can invalidate the returned value: modifying
37072
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
37073
 * If the returned value is needed for a long time, it is best to make a copy
37074
 * of it with ovsdb_datum_clone().
37075
 *
37076
 * This function is rarely useful, since it is easier to access the value
37077
 * directly through the "trunks" member in ovsrec_port. */
37078
const struct ovsdb_datum *
37079
ovsrec_port_get_trunks(const struct ovsrec_port *row,
37080
  enum ovsdb_atomic_type key_type OVS_UNUSED)
37081
0
{
37082
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
37083
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_trunks);
37084
0
}
37085
37086
/* Returns the "vlan_mode" column's value from the "Port" table in 'row'
37087
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
37088
 * ovsdb_datum_find_key() is an easier and more efficient way to search
37089
 * for a given key than implementing the same operation on the "cooked"
37090
 * form in 'row'.
37091
 *
37092
 * 'key_type' must be OVSDB_TYPE_STRING.
37093
 * (This helps to avoid silent bugs if someone changes vlan_mode's
37094
 * type without updating the caller.)
37095
 *
37096
 * The caller must not modify or free the returned value.
37097
 *
37098
 * Various kinds of changes can invalidate the returned value: modifying
37099
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
37100
 * If the returned value is needed for a long time, it is best to make a copy
37101
 * of it with ovsdb_datum_clone().
37102
 *
37103
 * This function is rarely useful, since it is easier to access the value
37104
 * directly through the "vlan_mode" member in ovsrec_port. */
37105
const struct ovsdb_datum *
37106
ovsrec_port_get_vlan_mode(const struct ovsrec_port *row,
37107
  enum ovsdb_atomic_type key_type OVS_UNUSED)
37108
0
{
37109
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
37110
0
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_vlan_mode);
37111
0
}
37112
37113
/* Sets the "bond_active_slave" column from the "Port" table in 'row' to
37114
 * the 'bond_active_slave' set.
37115
 *
37116
 * If "bond_active_slave" is null, the column will be the empty set,
37117
 * otherwise it will contain the specified value.
37118
 *
37119
 * The caller retains ownership of the arguments. */
37120
void
37121
ovsrec_port_set_bond_active_slave(const struct ovsrec_port *row, const char *bond_active_slave)
37122
0
{
37123
0
    struct ovsdb_datum datum;
37124
37125
0
    datum.refcnt = NULL;
37126
37127
0
    if (bond_active_slave) {
37128
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
37129
0
        datum.n = 1;
37130
0
        datum.keys = key;
37131
0
        key->s = ovsdb_atom_string_create(bond_active_slave);
37132
0
    } else {
37133
0
        datum.n = 0;
37134
0
        datum.keys = NULL;
37135
0
    }
37136
0
    datum.values = NULL;
37137
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_bond_active_slave, &datum);
37138
0
}
37139
37140
/* Sets the "bond_downdelay" column from the "Port" table in 'row' to
37141
 * 'bond_downdelay'.
37142
 *
37143
 * The caller retains ownership of the arguments. */
37144
void
37145
ovsrec_port_set_bond_downdelay(const struct ovsrec_port *row, int64_t bond_downdelay)
37146
0
{
37147
0
    struct ovsdb_datum datum;
37148
37149
0
    datum.refcnt = NULL;
37150
37151
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
37152
37153
0
    datum.n = 1;
37154
0
    datum.keys = key;
37155
0
    key->integer = bond_downdelay;
37156
0
    datum.values = NULL;
37157
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_bond_downdelay, &datum);
37158
0
}
37159
37160
/* Sets the "bond_fake_iface" column from the "Port" table in 'row' to
37161
 * 'bond_fake_iface'.
37162
 *
37163
 * The caller retains ownership of the arguments. */
37164
void
37165
ovsrec_port_set_bond_fake_iface(const struct ovsrec_port *row, bool bond_fake_iface)
37166
0
{
37167
0
    struct ovsdb_datum datum;
37168
37169
0
    datum.refcnt = NULL;
37170
37171
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
37172
37173
0
    datum.n = 1;
37174
0
    datum.keys = key;
37175
0
    key->boolean = bond_fake_iface;
37176
0
    datum.values = NULL;
37177
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_bond_fake_iface, &datum);
37178
0
}
37179
37180
/* Sets the "bond_mode" column from the "Port" table in 'row' to
37181
 * the 'bond_mode' set.
37182
 *
37183
 * If "bond_mode" is null, the column will be the empty set,
37184
 * otherwise it will contain the specified value.
37185
 *
37186
 * Argument constraints: one of "active-backup", "balance-slb", or "balance-tcp"
37187
 *
37188
 * The caller retains ownership of the arguments. */
37189
void
37190
ovsrec_port_set_bond_mode(const struct ovsrec_port *row, const char *bond_mode)
37191
0
{
37192
0
    struct ovsdb_datum datum;
37193
37194
0
    datum.refcnt = NULL;
37195
37196
0
    if (bond_mode) {
37197
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
37198
0
        datum.n = 1;
37199
0
        datum.keys = key;
37200
0
        key->s = ovsdb_atom_string_create(bond_mode);
37201
0
    } else {
37202
0
        datum.n = 0;
37203
0
        datum.keys = NULL;
37204
0
    }
37205
0
    datum.values = NULL;
37206
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_bond_mode, &datum);
37207
0
}
37208
37209
/* Sets the "bond_updelay" column from the "Port" table in 'row' to
37210
 * 'bond_updelay'.
37211
 *
37212
 * The caller retains ownership of the arguments. */
37213
void
37214
ovsrec_port_set_bond_updelay(const struct ovsrec_port *row, int64_t bond_updelay)
37215
0
{
37216
0
    struct ovsdb_datum datum;
37217
37218
0
    datum.refcnt = NULL;
37219
37220
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
37221
37222
0
    datum.n = 1;
37223
0
    datum.keys = key;
37224
0
    key->integer = bond_updelay;
37225
0
    datum.values = NULL;
37226
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_bond_updelay, &datum);
37227
0
}
37228
37229
/* Sets the "cvlans" column from the "Port" table in 'row' to
37230
 * the 'cvlans' set with 'n_cvlans' entries.
37231
 *
37232
 * Argument constraints: in range 0 to 4,095
37233
 *
37234
 * The caller retains ownership of the arguments. */
37235
void
37236
ovsrec_port_set_cvlans(const struct ovsrec_port *row, const int64_t *cvlans, size_t n_cvlans)
37237
0
{
37238
0
    struct ovsdb_datum datum;
37239
37240
0
    datum.refcnt = NULL;
37241
37242
0
    datum.n = n_cvlans;
37243
0
    datum.keys = n_cvlans ? xmalloc(n_cvlans * sizeof *datum.keys) : NULL;
37244
0
    datum.values = NULL;
37245
0
    for (size_t i = 0; i < n_cvlans; i++) {
37246
0
        datum.keys[i].integer = cvlans[i];
37247
0
    }
37248
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_cvlans, &datum);
37249
0
}
37250
37251
/* Sets the "external_ids" column's value from the "Port" table in 'row'
37252
 * to 'external_ids'.
37253
 *
37254
 * The caller retains ownership of 'external_ids' and everything in it. */
37255
void
37256
ovsrec_port_set_external_ids(const struct ovsrec_port *row, const struct smap *external_ids)
37257
0
{
37258
0
    struct ovsdb_datum datum;
37259
37260
0
    if (external_ids) {
37261
0
        ovsdb_datum_from_smap(&datum, external_ids);
37262
0
    } else {
37263
0
        ovsdb_datum_init_empty(&datum);
37264
0
    }
37265
0
    ovsdb_idl_txn_write(&row->header_,
37266
0
                        &ovsrec_port_col_external_ids,
37267
0
                        &datum);
37268
0
}
37269
37270
37271
/* Sets the "fake_bridge" column from the "Port" table in 'row' to
37272
 * 'fake_bridge'.
37273
 *
37274
 * The caller retains ownership of the arguments. */
37275
void
37276
ovsrec_port_set_fake_bridge(const struct ovsrec_port *row, bool fake_bridge)
37277
0
{
37278
0
    struct ovsdb_datum datum;
37279
37280
0
    datum.refcnt = NULL;
37281
37282
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
37283
37284
0
    datum.n = 1;
37285
0
    datum.keys = key;
37286
0
    key->boolean = fake_bridge;
37287
0
    datum.values = NULL;
37288
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_fake_bridge, &datum);
37289
0
}
37290
37291
/* Sets the "interfaces" column from the "Port" table in 'row' to
37292
 * the 'interfaces' set with 'n_interfaces' entries.
37293
 *
37294
 * The caller retains ownership of the arguments. */
37295
void
37296
ovsrec_port_set_interfaces(const struct ovsrec_port *row, struct ovsrec_interface **interfaces, size_t n_interfaces)
37297
0
{
37298
0
    struct ovsdb_datum datum;
37299
37300
0
    datum.refcnt = NULL;
37301
37302
0
    datum.n = n_interfaces;
37303
0
    datum.keys = n_interfaces ? xmalloc(n_interfaces * sizeof *datum.keys) : NULL;
37304
0
    datum.values = NULL;
37305
0
    for (size_t i = 0; i < n_interfaces; i++) {
37306
0
        datum.keys[i].uuid = interfaces[i]->header_.uuid;
37307
0
    }
37308
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_interfaces, &datum);
37309
0
}
37310
37311
/* Sets the "lacp" column from the "Port" table in 'row' to
37312
 * the 'lacp' set.
37313
 *
37314
 * If "lacp" is null, the column will be the empty set,
37315
 * otherwise it will contain the specified value.
37316
 *
37317
 * Argument constraints: one of "active", "off", or "passive"
37318
 *
37319
 * The caller retains ownership of the arguments. */
37320
void
37321
ovsrec_port_set_lacp(const struct ovsrec_port *row, const char *lacp)
37322
0
{
37323
0
    struct ovsdb_datum datum;
37324
37325
0
    datum.refcnt = NULL;
37326
37327
0
    if (lacp) {
37328
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
37329
0
        datum.n = 1;
37330
0
        datum.keys = key;
37331
0
        key->s = ovsdb_atom_string_create(lacp);
37332
0
    } else {
37333
0
        datum.n = 0;
37334
0
        datum.keys = NULL;
37335
0
    }
37336
0
    datum.values = NULL;
37337
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_lacp, &datum);
37338
0
}
37339
37340
/* Sets the "mac" column from the "Port" table in 'row' to
37341
 * the 'mac' set.
37342
 *
37343
 * If "mac" is null, the column will be the empty set,
37344
 * otherwise it will contain the specified value.
37345
 *
37346
 * The caller retains ownership of the arguments. */
37347
void
37348
ovsrec_port_set_mac(const struct ovsrec_port *row, const char *mac)
37349
0
{
37350
0
    struct ovsdb_datum datum;
37351
37352
0
    datum.refcnt = NULL;
37353
37354
0
    if (mac) {
37355
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
37356
0
        datum.n = 1;
37357
0
        datum.keys = key;
37358
0
        key->s = ovsdb_atom_string_create(mac);
37359
0
    } else {
37360
0
        datum.n = 0;
37361
0
        datum.keys = NULL;
37362
0
    }
37363
0
    datum.values = NULL;
37364
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_mac, &datum);
37365
0
}
37366
37367
/* Sets the "name" column from the "Port" table in 'row' to
37368
 * 'name'.
37369
 *
37370
 * The caller retains ownership of the arguments. */
37371
void
37372
ovsrec_port_set_name(const struct ovsrec_port *row, const char *name)
37373
0
{
37374
0
    struct ovsdb_datum datum;
37375
37376
0
    datum.refcnt = NULL;
37377
37378
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
37379
37380
0
    datum.n = 1;
37381
0
    datum.keys = key;
37382
0
    key->s = ovsdb_atom_string_create(name);
37383
0
    datum.values = NULL;
37384
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_name, &datum);
37385
0
}
37386
37387
/* Sets the "other_config" column's value from the "Port" table in 'row'
37388
 * to 'other_config'.
37389
 *
37390
 * The caller retains ownership of 'other_config' and everything in it. */
37391
void
37392
ovsrec_port_set_other_config(const struct ovsrec_port *row, const struct smap *other_config)
37393
0
{
37394
0
    struct ovsdb_datum datum;
37395
37396
0
    if (other_config) {
37397
0
        ovsdb_datum_from_smap(&datum, other_config);
37398
0
    } else {
37399
0
        ovsdb_datum_init_empty(&datum);
37400
0
    }
37401
0
    ovsdb_idl_txn_write(&row->header_,
37402
0
                        &ovsrec_port_col_other_config,
37403
0
                        &datum);
37404
0
}
37405
37406
37407
/* Sets the "protected_" column from the "Port" table in 'row' to
37408
 * 'protected_'.
37409
 *
37410
 * The caller retains ownership of the arguments. */
37411
void
37412
ovsrec_port_set_protected_(const struct ovsrec_port *row, bool protected_)
37413
0
{
37414
0
    struct ovsdb_datum datum;
37415
37416
0
    datum.refcnt = NULL;
37417
37418
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
37419
37420
0
    datum.n = 1;
37421
0
    datum.keys = key;
37422
0
    key->boolean = protected_;
37423
0
    datum.values = NULL;
37424
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_protected_, &datum);
37425
0
}
37426
37427
/* Sets the "qos" column from the "Port" table in 'row' to
37428
 * the 'qos' set.
37429
 *
37430
 * If "qos" is null, the column will be the empty set,
37431
 * otherwise it will contain the specified value.
37432
 *
37433
 * The caller retains ownership of the arguments. */
37434
void
37435
ovsrec_port_set_qos(const struct ovsrec_port *row, const struct ovsrec_qos *qos)
37436
0
{
37437
0
    struct ovsdb_datum datum;
37438
37439
0
    datum.refcnt = NULL;
37440
37441
0
    if (qos) {
37442
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
37443
0
        datum.n = 1;
37444
0
        datum.keys = key;
37445
0
        key->uuid = qos->header_.uuid;
37446
0
    } else {
37447
0
        datum.n = 0;
37448
0
        datum.keys = NULL;
37449
0
    }
37450
0
    datum.values = NULL;
37451
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_qos, &datum);
37452
0
}
37453
37454
/* Sets the "rstp_statistics" column from the "Port" table in 'row' to
37455
 * the map with keys 'key_rstp_statistics' and values 'value_rstp_statistics'
37456
 * with 'n_rstp_statistics' entries.
37457
 *
37458
 * The caller retains ownership of the arguments. */
37459
void
37460
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)
37461
0
{
37462
0
    struct ovsdb_datum datum;
37463
37464
0
    datum.refcnt = NULL;
37465
37466
0
    datum.n = n_rstp_statistics;
37467
0
    datum.keys = n_rstp_statistics ? xmalloc(n_rstp_statistics * sizeof *datum.keys) : NULL;
37468
0
    datum.values = xmalloc(n_rstp_statistics * sizeof *datum.values);
37469
0
    for (size_t i = 0; i < n_rstp_statistics; i++) {
37470
0
        datum.keys[i].s = ovsdb_atom_string_create(key_rstp_statistics[i]);
37471
0
        datum.values[i].integer = value_rstp_statistics[i];
37472
0
    }
37473
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_rstp_statistics, &datum);
37474
0
}
37475
37476
/* Sets the "rstp_status" column's value from the "Port" table in 'row'
37477
 * to 'rstp_status'.
37478
 *
37479
 * The caller retains ownership of 'rstp_status' and everything in it. */
37480
void
37481
ovsrec_port_set_rstp_status(const struct ovsrec_port *row, const struct smap *rstp_status)
37482
0
{
37483
0
    struct ovsdb_datum datum;
37484
37485
0
    if (rstp_status) {
37486
0
        ovsdb_datum_from_smap(&datum, rstp_status);
37487
0
    } else {
37488
0
        ovsdb_datum_init_empty(&datum);
37489
0
    }
37490
0
    ovsdb_idl_txn_write(&row->header_,
37491
0
                        &ovsrec_port_col_rstp_status,
37492
0
                        &datum);
37493
0
}
37494
37495
37496
/* Sets the "statistics" column from the "Port" table in 'row' to
37497
 * the map with keys 'key_statistics' and values 'value_statistics'
37498
 * with 'n_statistics' entries.
37499
 *
37500
 * The caller retains ownership of the arguments. */
37501
void
37502
ovsrec_port_set_statistics(const struct ovsrec_port *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
37503
0
{
37504
0
    struct ovsdb_datum datum;
37505
37506
0
    datum.refcnt = NULL;
37507
37508
0
    datum.n = n_statistics;
37509
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
37510
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
37511
0
    for (size_t i = 0; i < n_statistics; i++) {
37512
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
37513
0
        datum.values[i].integer = value_statistics[i];
37514
0
    }
37515
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_statistics, &datum);
37516
0
}
37517
37518
/* Sets the "status" column's value from the "Port" table in 'row'
37519
 * to 'status'.
37520
 *
37521
 * The caller retains ownership of 'status' and everything in it. */
37522
void
37523
ovsrec_port_set_status(const struct ovsrec_port *row, const struct smap *status)
37524
0
{
37525
0
    struct ovsdb_datum datum;
37526
37527
0
    if (status) {
37528
0
        ovsdb_datum_from_smap(&datum, status);
37529
0
    } else {
37530
0
        ovsdb_datum_init_empty(&datum);
37531
0
    }
37532
0
    ovsdb_idl_txn_write(&row->header_,
37533
0
                        &ovsrec_port_col_status,
37534
0
                        &datum);
37535
0
}
37536
37537
37538
/* Sets the "tag" column from the "Port" table in 'row' to
37539
 * the 'tag' set with 'n_tag' entries.
37540
 *
37541
 * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
37542
 * may be NULL.
37543
 *
37544
 * Argument constraints: in range 0 to 4,095
37545
 *
37546
 * The caller retains ownership of the arguments. */
37547
void
37548
ovsrec_port_set_tag(const struct ovsrec_port *row, const int64_t *tag, size_t n_tag)
37549
0
{
37550
0
    struct ovsdb_datum datum;
37551
37552
0
    datum.refcnt = NULL;
37553
37554
0
    if (n_tag) {
37555
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
37556
0
        datum.n = 1;
37557
0
        datum.keys = key;
37558
0
        key->integer = *tag;
37559
0
    } else {
37560
0
        datum.n = 0;
37561
0
        datum.keys = NULL;
37562
0
    }
37563
0
    datum.values = NULL;
37564
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_tag, &datum);
37565
0
}
37566
37567
/* Sets the "trunks" column from the "Port" table in 'row' to
37568
 * the 'trunks' set with 'n_trunks' entries.
37569
 *
37570
 * Argument constraints: in range 0 to 4,095
37571
 *
37572
 * The caller retains ownership of the arguments. */
37573
void
37574
ovsrec_port_set_trunks(const struct ovsrec_port *row, const int64_t *trunks, size_t n_trunks)
37575
0
{
37576
0
    struct ovsdb_datum datum;
37577
37578
0
    datum.refcnt = NULL;
37579
37580
0
    datum.n = n_trunks;
37581
0
    datum.keys = n_trunks ? xmalloc(n_trunks * sizeof *datum.keys) : NULL;
37582
0
    datum.values = NULL;
37583
0
    for (size_t i = 0; i < n_trunks; i++) {
37584
0
        datum.keys[i].integer = trunks[i];
37585
0
    }
37586
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_trunks, &datum);
37587
0
}
37588
37589
/* Sets the "vlan_mode" column from the "Port" table in 'row' to
37590
 * the 'vlan_mode' set.
37591
 *
37592
 * If "vlan_mode" is null, the column will be the empty set,
37593
 * otherwise it will contain the specified value.
37594
 *
37595
 * Argument constraints: one of "access", "dot1q-tunnel", "native-tagged", "native-untagged", or "trunk"
37596
 *
37597
 * The caller retains ownership of the arguments. */
37598
void
37599
ovsrec_port_set_vlan_mode(const struct ovsrec_port *row, const char *vlan_mode)
37600
0
{
37601
0
    struct ovsdb_datum datum;
37602
37603
0
    datum.refcnt = NULL;
37604
37605
0
    if (vlan_mode) {
37606
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
37607
0
        datum.n = 1;
37608
0
        datum.keys = key;
37609
0
        key->s = ovsdb_atom_string_create(vlan_mode);
37610
0
    } else {
37611
0
        datum.n = 0;
37612
0
        datum.keys = NULL;
37613
0
    }
37614
0
    datum.values = NULL;
37615
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_col_vlan_mode, &datum);
37616
0
}
37617
37618
/* Adds the value 'new_value' to the "bond_active_slave" set column from the "Port" table
37619
 * in 'row'.
37620
 *
37621
 */
37622
void
37623
ovsrec_port_update_bond_active_slave_addvalue(const struct ovsrec_port *row, const char *new_value)
37624
0
{
37625
0
    struct ovsdb_datum *datum;
37626
37627
0
    datum = xmalloc(sizeof *datum);
37628
0
    datum->n = 1;
37629
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37630
0
    datum->values = NULL;
37631
0
    datum->refcnt = NULL;
37632
37633
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
37634
37635
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
37636
0
                                    &ovsrec_port_col_bond_active_slave,
37637
0
                                    datum);
37638
0
}
37639
37640
/* Deletes the value 'delete_value' from the "bond_active_slave" set column from the
37641
 * "Port" table in 'row'.
37642
 *
37643
 */
37644
void
37645
ovsrec_port_update_bond_active_slave_delvalue(const struct ovsrec_port *row, const char *delete_value)
37646
0
{
37647
0
    struct ovsdb_datum *datum;
37648
37649
0
    datum = xmalloc(sizeof *datum);
37650
0
    datum->n = 1;
37651
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37652
0
    datum->values = NULL;
37653
0
    datum->refcnt = NULL;
37654
37655
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
37656
37657
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
37658
0
                                    &ovsrec_port_col_bond_active_slave,
37659
0
                                    datum);
37660
0
}
37661
37662
/* Adds the value 'new_value' to the "bond_mode" set column from the "Port" table
37663
 * in 'row'.
37664
 *
37665
 */
37666
void
37667
ovsrec_port_update_bond_mode_addvalue(const struct ovsrec_port *row, const char *new_value)
37668
0
{
37669
0
    struct ovsdb_datum *datum;
37670
37671
0
    datum = xmalloc(sizeof *datum);
37672
0
    datum->n = 1;
37673
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37674
0
    datum->values = NULL;
37675
0
    datum->refcnt = NULL;
37676
37677
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
37678
37679
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
37680
0
                                    &ovsrec_port_col_bond_mode,
37681
0
                                    datum);
37682
0
}
37683
37684
/* Deletes the value 'delete_value' from the "bond_mode" set column from the
37685
 * "Port" table in 'row'.
37686
 *
37687
 */
37688
void
37689
ovsrec_port_update_bond_mode_delvalue(const struct ovsrec_port *row, const char *delete_value)
37690
0
{
37691
0
    struct ovsdb_datum *datum;
37692
37693
0
    datum = xmalloc(sizeof *datum);
37694
0
    datum->n = 1;
37695
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37696
0
    datum->values = NULL;
37697
0
    datum->refcnt = NULL;
37698
37699
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
37700
37701
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
37702
0
                                    &ovsrec_port_col_bond_mode,
37703
0
                                    datum);
37704
0
}
37705
37706
/* Adds the value 'new_value' to the "cvlans" set column from the "Port" table
37707
 * in 'row'.
37708
 *
37709
 */
37710
void
37711
ovsrec_port_update_cvlans_addvalue(const struct ovsrec_port *row, int64_t new_value)
37712
0
{
37713
0
    struct ovsdb_datum *datum;
37714
37715
0
    datum = xmalloc(sizeof *datum);
37716
0
    datum->n = 1;
37717
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37718
0
    datum->values = NULL;
37719
0
    datum->refcnt = NULL;
37720
37721
0
    datum->keys[0].integer = new_value;
37722
37723
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
37724
0
                                    &ovsrec_port_col_cvlans,
37725
0
                                    datum);
37726
0
}
37727
37728
/* Deletes the value 'delete_value' from the "cvlans" set column from the
37729
 * "Port" table in 'row'.
37730
 *
37731
 */
37732
void
37733
ovsrec_port_update_cvlans_delvalue(const struct ovsrec_port *row, int64_t delete_value)
37734
0
{
37735
0
    struct ovsdb_datum *datum;
37736
37737
0
    datum = xmalloc(sizeof *datum);
37738
0
    datum->n = 1;
37739
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37740
0
    datum->values = NULL;
37741
0
    datum->refcnt = NULL;
37742
37743
0
    datum->keys[0].integer = delete_value;
37744
37745
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
37746
0
                                    &ovsrec_port_col_cvlans,
37747
0
                                    datum);
37748
0
}
37749
37750
/* Sets an element of the "external_ids" map column from the "Port" table in 'row'
37751
 * to 'new_value' given the key value 'new_key'.
37752
 *
37753
 */
37754
void
37755
ovsrec_port_update_external_ids_setkey(const struct ovsrec_port *row, const char *new_key, const char *new_value)
37756
0
{
37757
0
    struct ovsdb_datum *datum;
37758
37759
0
    datum = xmalloc(sizeof *datum);
37760
0
    datum->n = 1;
37761
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
37762
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
37763
0
    datum->refcnt = NULL;
37764
37765
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
37766
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
37767
37768
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
37769
0
                                    &ovsrec_port_col_external_ids,
37770
0
                                    datum);
37771
0
}
37772
37773
/* Deletes an element of the "external_ids" map column from the "Port" table in 'row'
37774
 * given the key value 'delete_key'.
37775
 *
37776
 */
37777
void
37778
ovsrec_port_update_external_ids_delkey(const struct ovsrec_port *row, const char *delete_key)
37779
0
{
37780
0
    struct ovsdb_datum *datum;
37781
37782
0
    datum = xmalloc(sizeof *datum);
37783
0
    datum->n = 1;
37784
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
37785
0
    datum->values = NULL;
37786
0
    datum->refcnt = NULL;
37787
37788
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
37789
37790
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
37791
0
                                    &ovsrec_port_col_external_ids,
37792
0
                                    datum);
37793
0
}
37794
37795
/* Adds the value 'new_value' to the "interfaces" set column from the "Port" table
37796
 * in 'row'.
37797
 *
37798
 */
37799
void
37800
ovsrec_port_update_interfaces_addvalue(const struct ovsrec_port *row, const struct ovsrec_interface *new_value)
37801
0
{
37802
0
    struct ovsdb_datum *datum;
37803
37804
0
    datum = xmalloc(sizeof *datum);
37805
0
    datum->n = 1;
37806
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37807
0
    datum->values = NULL;
37808
0
    datum->refcnt = NULL;
37809
37810
0
    datum->keys[0].uuid = new_value->header_.uuid;
37811
37812
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
37813
0
                                    &ovsrec_port_col_interfaces,
37814
0
                                    datum);
37815
0
}
37816
37817
/* Deletes the value 'delete_value' from the "interfaces" set column from the
37818
 * "Port" table in 'row'.
37819
 *
37820
 */
37821
void
37822
ovsrec_port_update_interfaces_delvalue(const struct ovsrec_port *row, const struct ovsrec_interface *delete_value)
37823
0
{
37824
0
    struct ovsdb_datum *datum;
37825
37826
0
    datum = xmalloc(sizeof *datum);
37827
0
    datum->n = 1;
37828
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37829
0
    datum->values = NULL;
37830
0
    datum->refcnt = NULL;
37831
37832
0
    datum->keys[0].uuid = delete_value->header_.uuid;
37833
37834
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
37835
0
                                    &ovsrec_port_col_interfaces,
37836
0
                                    datum);
37837
0
}
37838
37839
/* Adds the value 'new_value' to the "lacp" set column from the "Port" table
37840
 * in 'row'.
37841
 *
37842
 */
37843
void
37844
ovsrec_port_update_lacp_addvalue(const struct ovsrec_port *row, const char *new_value)
37845
0
{
37846
0
    struct ovsdb_datum *datum;
37847
37848
0
    datum = xmalloc(sizeof *datum);
37849
0
    datum->n = 1;
37850
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37851
0
    datum->values = NULL;
37852
0
    datum->refcnt = NULL;
37853
37854
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
37855
37856
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
37857
0
                                    &ovsrec_port_col_lacp,
37858
0
                                    datum);
37859
0
}
37860
37861
/* Deletes the value 'delete_value' from the "lacp" set column from the
37862
 * "Port" table in 'row'.
37863
 *
37864
 */
37865
void
37866
ovsrec_port_update_lacp_delvalue(const struct ovsrec_port *row, const char *delete_value)
37867
0
{
37868
0
    struct ovsdb_datum *datum;
37869
37870
0
    datum = xmalloc(sizeof *datum);
37871
0
    datum->n = 1;
37872
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37873
0
    datum->values = NULL;
37874
0
    datum->refcnt = NULL;
37875
37876
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
37877
37878
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
37879
0
                                    &ovsrec_port_col_lacp,
37880
0
                                    datum);
37881
0
}
37882
37883
/* Adds the value 'new_value' to the "mac" set column from the "Port" table
37884
 * in 'row'.
37885
 *
37886
 */
37887
void
37888
ovsrec_port_update_mac_addvalue(const struct ovsrec_port *row, const char *new_value)
37889
0
{
37890
0
    struct ovsdb_datum *datum;
37891
37892
0
    datum = xmalloc(sizeof *datum);
37893
0
    datum->n = 1;
37894
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37895
0
    datum->values = NULL;
37896
0
    datum->refcnt = NULL;
37897
37898
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
37899
37900
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
37901
0
                                    &ovsrec_port_col_mac,
37902
0
                                    datum);
37903
0
}
37904
37905
/* Deletes the value 'delete_value' from the "mac" set column from the
37906
 * "Port" table in 'row'.
37907
 *
37908
 */
37909
void
37910
ovsrec_port_update_mac_delvalue(const struct ovsrec_port *row, const char *delete_value)
37911
0
{
37912
0
    struct ovsdb_datum *datum;
37913
37914
0
    datum = xmalloc(sizeof *datum);
37915
0
    datum->n = 1;
37916
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37917
0
    datum->values = NULL;
37918
0
    datum->refcnt = NULL;
37919
37920
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
37921
37922
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
37923
0
                                    &ovsrec_port_col_mac,
37924
0
                                    datum);
37925
0
}
37926
37927
/* Sets an element of the "other_config" map column from the "Port" table in 'row'
37928
 * to 'new_value' given the key value 'new_key'.
37929
 *
37930
 */
37931
void
37932
ovsrec_port_update_other_config_setkey(const struct ovsrec_port *row, const char *new_key, const char *new_value)
37933
0
{
37934
0
    struct ovsdb_datum *datum;
37935
37936
0
    datum = xmalloc(sizeof *datum);
37937
0
    datum->n = 1;
37938
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
37939
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
37940
0
    datum->refcnt = NULL;
37941
37942
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
37943
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
37944
37945
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
37946
0
                                    &ovsrec_port_col_other_config,
37947
0
                                    datum);
37948
0
}
37949
37950
/* Deletes an element of the "other_config" map column from the "Port" table in 'row'
37951
 * given the key value 'delete_key'.
37952
 *
37953
 */
37954
void
37955
ovsrec_port_update_other_config_delkey(const struct ovsrec_port *row, const char *delete_key)
37956
0
{
37957
0
    struct ovsdb_datum *datum;
37958
37959
0
    datum = xmalloc(sizeof *datum);
37960
0
    datum->n = 1;
37961
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
37962
0
    datum->values = NULL;
37963
0
    datum->refcnt = NULL;
37964
37965
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
37966
37967
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
37968
0
                                    &ovsrec_port_col_other_config,
37969
0
                                    datum);
37970
0
}
37971
37972
/* Adds the value 'new_value' to the "qos" set column from the "Port" table
37973
 * in 'row'.
37974
 *
37975
 */
37976
void
37977
ovsrec_port_update_qos_addvalue(const struct ovsrec_port *row, const struct ovsrec_qos *new_value)
37978
0
{
37979
0
    struct ovsdb_datum *datum;
37980
37981
0
    datum = xmalloc(sizeof *datum);
37982
0
    datum->n = 1;
37983
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
37984
0
    datum->values = NULL;
37985
0
    datum->refcnt = NULL;
37986
37987
0
    datum->keys[0].uuid = new_value->header_.uuid;
37988
37989
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
37990
0
                                    &ovsrec_port_col_qos,
37991
0
                                    datum);
37992
0
}
37993
37994
/* Deletes the value 'delete_value' from the "qos" set column from the
37995
 * "Port" table in 'row'.
37996
 *
37997
 */
37998
void
37999
ovsrec_port_update_qos_delvalue(const struct ovsrec_port *row, const struct ovsrec_qos *delete_value)
38000
0
{
38001
0
    struct ovsdb_datum *datum;
38002
38003
0
    datum = xmalloc(sizeof *datum);
38004
0
    datum->n = 1;
38005
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
38006
0
    datum->values = NULL;
38007
0
    datum->refcnt = NULL;
38008
38009
0
    datum->keys[0].uuid = delete_value->header_.uuid;
38010
38011
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
38012
0
                                    &ovsrec_port_col_qos,
38013
0
                                    datum);
38014
0
}
38015
38016
/* Sets an element of the "rstp_statistics" map column from the "Port" table in 'row'
38017
 * to 'new_value' given the key value 'new_key'.
38018
 *
38019
 */
38020
void
38021
ovsrec_port_update_rstp_statistics_setkey(const struct ovsrec_port *row, const char *new_key, int64_t new_value)
38022
0
{
38023
0
    struct ovsdb_datum *datum;
38024
38025
0
    datum = xmalloc(sizeof *datum);
38026
0
    datum->n = 1;
38027
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
38028
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
38029
0
    datum->refcnt = NULL;
38030
38031
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
38032
0
    datum->values[0].integer = new_value;
38033
38034
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
38035
0
                                    &ovsrec_port_col_rstp_statistics,
38036
0
                                    datum);
38037
0
}
38038
38039
/* Deletes an element of the "rstp_statistics" map column from the "Port" table in 'row'
38040
 * given the key value 'delete_key'.
38041
 *
38042
 */
38043
void
38044
ovsrec_port_update_rstp_statistics_delkey(const struct ovsrec_port *row, const char *delete_key)
38045
0
{
38046
0
    struct ovsdb_datum *datum;
38047
38048
0
    datum = xmalloc(sizeof *datum);
38049
0
    datum->n = 1;
38050
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
38051
0
    datum->values = NULL;
38052
0
    datum->refcnt = NULL;
38053
38054
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
38055
38056
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
38057
0
                                    &ovsrec_port_col_rstp_statistics,
38058
0
                                    datum);
38059
0
}
38060
38061
/* Sets an element of the "rstp_status" map column from the "Port" table in 'row'
38062
 * to 'new_value' given the key value 'new_key'.
38063
 *
38064
 */
38065
void
38066
ovsrec_port_update_rstp_status_setkey(const struct ovsrec_port *row, const char *new_key, const char *new_value)
38067
0
{
38068
0
    struct ovsdb_datum *datum;
38069
38070
0
    datum = xmalloc(sizeof *datum);
38071
0
    datum->n = 1;
38072
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
38073
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
38074
0
    datum->refcnt = NULL;
38075
38076
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
38077
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
38078
38079
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
38080
0
                                    &ovsrec_port_col_rstp_status,
38081
0
                                    datum);
38082
0
}
38083
38084
/* Deletes an element of the "rstp_status" map column from the "Port" table in 'row'
38085
 * given the key value 'delete_key'.
38086
 *
38087
 */
38088
void
38089
ovsrec_port_update_rstp_status_delkey(const struct ovsrec_port *row, const char *delete_key)
38090
0
{
38091
0
    struct ovsdb_datum *datum;
38092
38093
0
    datum = xmalloc(sizeof *datum);
38094
0
    datum->n = 1;
38095
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
38096
0
    datum->values = NULL;
38097
0
    datum->refcnt = NULL;
38098
38099
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
38100
38101
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
38102
0
                                    &ovsrec_port_col_rstp_status,
38103
0
                                    datum);
38104
0
}
38105
38106
/* Sets an element of the "statistics" map column from the "Port" table in 'row'
38107
 * to 'new_value' given the key value 'new_key'.
38108
 *
38109
 */
38110
void
38111
ovsrec_port_update_statistics_setkey(const struct ovsrec_port *row, const char *new_key, int64_t new_value)
38112
0
{
38113
0
    struct ovsdb_datum *datum;
38114
38115
0
    datum = xmalloc(sizeof *datum);
38116
0
    datum->n = 1;
38117
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
38118
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
38119
0
    datum->refcnt = NULL;
38120
38121
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
38122
0
    datum->values[0].integer = new_value;
38123
38124
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
38125
0
                                    &ovsrec_port_col_statistics,
38126
0
                                    datum);
38127
0
}
38128
38129
/* Deletes an element of the "statistics" map column from the "Port" table in 'row'
38130
 * given the key value 'delete_key'.
38131
 *
38132
 */
38133
void
38134
ovsrec_port_update_statistics_delkey(const struct ovsrec_port *row, const char *delete_key)
38135
0
{
38136
0
    struct ovsdb_datum *datum;
38137
38138
0
    datum = xmalloc(sizeof *datum);
38139
0
    datum->n = 1;
38140
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
38141
0
    datum->values = NULL;
38142
0
    datum->refcnt = NULL;
38143
38144
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
38145
38146
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
38147
0
                                    &ovsrec_port_col_statistics,
38148
0
                                    datum);
38149
0
}
38150
38151
/* Sets an element of the "status" map column from the "Port" table in 'row'
38152
 * to 'new_value' given the key value 'new_key'.
38153
 *
38154
 */
38155
void
38156
ovsrec_port_update_status_setkey(const struct ovsrec_port *row, const char *new_key, const char *new_value)
38157
0
{
38158
0
    struct ovsdb_datum *datum;
38159
38160
0
    datum = xmalloc(sizeof *datum);
38161
0
    datum->n = 1;
38162
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
38163
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
38164
0
    datum->refcnt = NULL;
38165
38166
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
38167
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
38168
38169
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
38170
0
                                    &ovsrec_port_col_status,
38171
0
                                    datum);
38172
0
}
38173
38174
/* Deletes an element of the "status" map column from the "Port" table in 'row'
38175
 * given the key value 'delete_key'.
38176
 *
38177
 */
38178
void
38179
ovsrec_port_update_status_delkey(const struct ovsrec_port *row, const char *delete_key)
38180
0
{
38181
0
    struct ovsdb_datum *datum;
38182
38183
0
    datum = xmalloc(sizeof *datum);
38184
0
    datum->n = 1;
38185
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
38186
0
    datum->values = NULL;
38187
0
    datum->refcnt = NULL;
38188
38189
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
38190
38191
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
38192
0
                                    &ovsrec_port_col_status,
38193
0
                                    datum);
38194
0
}
38195
38196
/* Adds the value 'new_value' to the "tag" set column from the "Port" table
38197
 * in 'row'.
38198
 *
38199
 */
38200
void
38201
ovsrec_port_update_tag_addvalue(const struct ovsrec_port *row, int64_t new_value)
38202
0
{
38203
0
    struct ovsdb_datum *datum;
38204
38205
0
    datum = xmalloc(sizeof *datum);
38206
0
    datum->n = 1;
38207
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
38208
0
    datum->values = NULL;
38209
0
    datum->refcnt = NULL;
38210
38211
0
    datum->keys[0].integer = new_value;
38212
38213
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
38214
0
                                    &ovsrec_port_col_tag,
38215
0
                                    datum);
38216
0
}
38217
38218
/* Deletes the value 'delete_value' from the "tag" set column from the
38219
 * "Port" table in 'row'.
38220
 *
38221
 */
38222
void
38223
ovsrec_port_update_tag_delvalue(const struct ovsrec_port *row, int64_t delete_value)
38224
0
{
38225
0
    struct ovsdb_datum *datum;
38226
38227
0
    datum = xmalloc(sizeof *datum);
38228
0
    datum->n = 1;
38229
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
38230
0
    datum->values = NULL;
38231
0
    datum->refcnt = NULL;
38232
38233
0
    datum->keys[0].integer = delete_value;
38234
38235
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
38236
0
                                    &ovsrec_port_col_tag,
38237
0
                                    datum);
38238
0
}
38239
38240
/* Adds the value 'new_value' to the "trunks" set column from the "Port" table
38241
 * in 'row'.
38242
 *
38243
 */
38244
void
38245
ovsrec_port_update_trunks_addvalue(const struct ovsrec_port *row, int64_t new_value)
38246
0
{
38247
0
    struct ovsdb_datum *datum;
38248
38249
0
    datum = xmalloc(sizeof *datum);
38250
0
    datum->n = 1;
38251
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
38252
0
    datum->values = NULL;
38253
0
    datum->refcnt = NULL;
38254
38255
0
    datum->keys[0].integer = new_value;
38256
38257
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
38258
0
                                    &ovsrec_port_col_trunks,
38259
0
                                    datum);
38260
0
}
38261
38262
/* Deletes the value 'delete_value' from the "trunks" set column from the
38263
 * "Port" table in 'row'.
38264
 *
38265
 */
38266
void
38267
ovsrec_port_update_trunks_delvalue(const struct ovsrec_port *row, int64_t delete_value)
38268
0
{
38269
0
    struct ovsdb_datum *datum;
38270
38271
0
    datum = xmalloc(sizeof *datum);
38272
0
    datum->n = 1;
38273
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
38274
0
    datum->values = NULL;
38275
0
    datum->refcnt = NULL;
38276
38277
0
    datum->keys[0].integer = delete_value;
38278
38279
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
38280
0
                                    &ovsrec_port_col_trunks,
38281
0
                                    datum);
38282
0
}
38283
38284
/* Adds the value 'new_value' to the "vlan_mode" set column from the "Port" table
38285
 * in 'row'.
38286
 *
38287
 */
38288
void
38289
ovsrec_port_update_vlan_mode_addvalue(const struct ovsrec_port *row, const char *new_value)
38290
0
{
38291
0
    struct ovsdb_datum *datum;
38292
38293
0
    datum = xmalloc(sizeof *datum);
38294
0
    datum->n = 1;
38295
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
38296
0
    datum->values = NULL;
38297
0
    datum->refcnt = NULL;
38298
38299
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
38300
38301
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
38302
0
                                    &ovsrec_port_col_vlan_mode,
38303
0
                                    datum);
38304
0
}
38305
38306
/* Deletes the value 'delete_value' from the "vlan_mode" set column from the
38307
 * "Port" table in 'row'.
38308
 *
38309
 */
38310
void
38311
ovsrec_port_update_vlan_mode_delvalue(const struct ovsrec_port *row, const char *delete_value)
38312
0
{
38313
0
    struct ovsdb_datum *datum;
38314
38315
0
    datum = xmalloc(sizeof *datum);
38316
0
    datum->n = 1;
38317
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
38318
0
    datum->values = NULL;
38319
0
    datum->refcnt = NULL;
38320
38321
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
38322
38323
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
38324
0
                                    &ovsrec_port_col_vlan_mode,
38325
0
                                    datum);
38326
0
}
38327
38328
/* Sets the "bond_active_slave" column from the "Port" table in 'row' to
38329
 * the 'bond_active_slave' set.
38330
 *
38331
 * If "bond_active_slave" is null, the column will be the empty set,
38332
 * otherwise it will contain the specified value.
38333
 *
38334
 * The caller retains ownership of the arguments. */
38335
void
38336
ovsrec_port_add_clause_bond_active_slave(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *bond_active_slave)
38337
0
{
38338
0
    struct ovsdb_datum datum;
38339
38340
0
    datum.refcnt = NULL;
38341
38342
0
    if (bond_active_slave) {
38343
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
38344
0
        datum.n = 1;
38345
0
        datum.keys = key;
38346
0
        key->s = ovsdb_atom_string_create(bond_active_slave);
38347
0
    } else {
38348
0
        datum.n = 0;
38349
0
        datum.keys = NULL;
38350
0
    }
38351
0
    datum.values = NULL;
38352
0
    ovsdb_idl_condition_add_clause(cond,
38353
0
                          function,
38354
0
                          &ovsrec_port_col_bond_active_slave,
38355
0
                          &datum);
38356
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_bond_active_slave.type);
38357
0
}
38358
38359
/* Sets the "bond_downdelay" column from the "Port" table in 'row' to
38360
 * 'bond_downdelay'.
38361
 *
38362
 * The caller retains ownership of the arguments. */
38363
void
38364
ovsrec_port_add_clause_bond_downdelay(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t bond_downdelay)
38365
0
{
38366
0
    struct ovsdb_datum datum;
38367
38368
0
    datum.refcnt = NULL;
38369
38370
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
38371
38372
0
    datum.n = 1;
38373
0
    datum.keys = key;
38374
0
    key->integer = bond_downdelay;
38375
0
    datum.values = NULL;
38376
0
    ovsdb_idl_condition_add_clause(cond,
38377
0
                          function,
38378
0
                          &ovsrec_port_col_bond_downdelay,
38379
0
                          &datum);
38380
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_bond_downdelay.type);
38381
0
}
38382
38383
/* Sets the "bond_fake_iface" column from the "Port" table in 'row' to
38384
 * 'bond_fake_iface'.
38385
 *
38386
 * The caller retains ownership of the arguments. */
38387
void
38388
ovsrec_port_add_clause_bond_fake_iface(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool bond_fake_iface)
38389
0
{
38390
0
    struct ovsdb_datum datum;
38391
38392
0
    datum.refcnt = NULL;
38393
38394
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
38395
38396
0
    datum.n = 1;
38397
0
    datum.keys = key;
38398
0
    key->boolean = bond_fake_iface;
38399
0
    datum.values = NULL;
38400
0
    ovsdb_idl_condition_add_clause(cond,
38401
0
                          function,
38402
0
                          &ovsrec_port_col_bond_fake_iface,
38403
0
                          &datum);
38404
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_bond_fake_iface.type);
38405
0
}
38406
38407
/* Sets the "bond_mode" column from the "Port" table in 'row' to
38408
 * the 'bond_mode' set.
38409
 *
38410
 * If "bond_mode" is null, the column will be the empty set,
38411
 * otherwise it will contain the specified value.
38412
 *
38413
 * Argument constraints: one of "active-backup", "balance-slb", or "balance-tcp"
38414
 *
38415
 * The caller retains ownership of the arguments. */
38416
void
38417
ovsrec_port_add_clause_bond_mode(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *bond_mode)
38418
0
{
38419
0
    struct ovsdb_datum datum;
38420
38421
0
    datum.refcnt = NULL;
38422
38423
0
    if (bond_mode) {
38424
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
38425
0
        datum.n = 1;
38426
0
        datum.keys = key;
38427
0
        key->s = ovsdb_atom_string_create(bond_mode);
38428
0
    } else {
38429
0
        datum.n = 0;
38430
0
        datum.keys = NULL;
38431
0
    }
38432
0
    datum.values = NULL;
38433
0
    ovsdb_idl_condition_add_clause(cond,
38434
0
                          function,
38435
0
                          &ovsrec_port_col_bond_mode,
38436
0
                          &datum);
38437
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_bond_mode.type);
38438
0
}
38439
38440
/* Sets the "bond_updelay" column from the "Port" table in 'row' to
38441
 * 'bond_updelay'.
38442
 *
38443
 * The caller retains ownership of the arguments. */
38444
void
38445
ovsrec_port_add_clause_bond_updelay(struct ovsdb_idl_condition *cond, enum ovsdb_function function, int64_t bond_updelay)
38446
0
{
38447
0
    struct ovsdb_datum datum;
38448
38449
0
    datum.refcnt = NULL;
38450
38451
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
38452
38453
0
    datum.n = 1;
38454
0
    datum.keys = key;
38455
0
    key->integer = bond_updelay;
38456
0
    datum.values = NULL;
38457
0
    ovsdb_idl_condition_add_clause(cond,
38458
0
                          function,
38459
0
                          &ovsrec_port_col_bond_updelay,
38460
0
                          &datum);
38461
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_bond_updelay.type);
38462
0
}
38463
38464
/* Sets the "cvlans" column from the "Port" table in 'row' to
38465
 * the 'cvlans' set with 'n_cvlans' entries.
38466
 *
38467
 * Argument constraints: in range 0 to 4,095
38468
 *
38469
 * The caller retains ownership of the arguments. */
38470
void
38471
ovsrec_port_add_clause_cvlans(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *cvlans, size_t n_cvlans)
38472
0
{
38473
0
    struct ovsdb_datum datum;
38474
38475
0
    datum.refcnt = NULL;
38476
0
    datum.n = n_cvlans;
38477
0
    datum.keys = n_cvlans ? xmalloc(n_cvlans * sizeof *datum.keys) : NULL;
38478
0
    datum.values = NULL;
38479
0
    for (size_t i = 0; i < n_cvlans; i++) {
38480
0
        datum.keys[i].integer = cvlans[i];
38481
0
    }
38482
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_cvlans.type);
38483
0
    ovsdb_idl_condition_add_clause(cond,
38484
0
                          function,
38485
0
                          &ovsrec_port_col_cvlans,
38486
0
                          &datum);
38487
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_cvlans.type);
38488
0
}
38489
38490
/* Sets the "external_ids" column's value from the "Port" table in 'row'
38491
 * to 'external_ids'.
38492
 *
38493
 * The caller retains ownership of 'external_ids' and everything in it. */
38494
void
38495
ovsrec_port_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
38496
0
{
38497
0
    struct ovsdb_datum datum;
38498
38499
0
    if (external_ids) {
38500
0
        ovsdb_datum_from_smap(&datum, external_ids);
38501
0
    } else {
38502
0
        ovsdb_datum_init_empty(&datum);
38503
0
    }
38504
38505
0
    ovsdb_idl_condition_add_clause(cond,
38506
0
                                   function,
38507
0
                                   &ovsrec_port_col_external_ids,
38508
0
                                   &datum);
38509
38510
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_external_ids.type);
38511
0
}
38512
38513
38514
/* Sets the "fake_bridge" column from the "Port" table in 'row' to
38515
 * 'fake_bridge'.
38516
 *
38517
 * The caller retains ownership of the arguments. */
38518
void
38519
ovsrec_port_add_clause_fake_bridge(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool fake_bridge)
38520
0
{
38521
0
    struct ovsdb_datum datum;
38522
38523
0
    datum.refcnt = NULL;
38524
38525
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
38526
38527
0
    datum.n = 1;
38528
0
    datum.keys = key;
38529
0
    key->boolean = fake_bridge;
38530
0
    datum.values = NULL;
38531
0
    ovsdb_idl_condition_add_clause(cond,
38532
0
                          function,
38533
0
                          &ovsrec_port_col_fake_bridge,
38534
0
                          &datum);
38535
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_fake_bridge.type);
38536
0
}
38537
38538
/* Sets the "interfaces" column from the "Port" table in 'row' to
38539
 * the 'interfaces' set with 'n_interfaces' entries.
38540
 *
38541
 * The caller retains ownership of the arguments. */
38542
void
38543
ovsrec_port_add_clause_interfaces(struct ovsdb_idl_condition *cond, enum ovsdb_function function, struct uuid **interfaces, size_t n_interfaces)
38544
0
{
38545
0
    struct ovsdb_datum datum;
38546
38547
0
    datum.refcnt = NULL;
38548
0
    datum.n = n_interfaces;
38549
0
    datum.keys = n_interfaces ? xmalloc(n_interfaces * sizeof *datum.keys) : NULL;
38550
0
    datum.values = NULL;
38551
0
    for (size_t i = 0; i < n_interfaces; i++) {
38552
0
        datum.keys[i].uuid = *interfaces[i];
38553
0
    }
38554
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_interfaces.type);
38555
0
    ovsdb_idl_condition_add_clause(cond,
38556
0
                          function,
38557
0
                          &ovsrec_port_col_interfaces,
38558
0
                          &datum);
38559
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_interfaces.type);
38560
0
}
38561
38562
/* Sets the "lacp" column from the "Port" table in 'row' to
38563
 * the 'lacp' set.
38564
 *
38565
 * If "lacp" is null, the column will be the empty set,
38566
 * otherwise it will contain the specified value.
38567
 *
38568
 * Argument constraints: one of "active", "off", or "passive"
38569
 *
38570
 * The caller retains ownership of the arguments. */
38571
void
38572
ovsrec_port_add_clause_lacp(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *lacp)
38573
0
{
38574
0
    struct ovsdb_datum datum;
38575
38576
0
    datum.refcnt = NULL;
38577
38578
0
    if (lacp) {
38579
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
38580
0
        datum.n = 1;
38581
0
        datum.keys = key;
38582
0
        key->s = ovsdb_atom_string_create(lacp);
38583
0
    } else {
38584
0
        datum.n = 0;
38585
0
        datum.keys = NULL;
38586
0
    }
38587
0
    datum.values = NULL;
38588
0
    ovsdb_idl_condition_add_clause(cond,
38589
0
                          function,
38590
0
                          &ovsrec_port_col_lacp,
38591
0
                          &datum);
38592
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_lacp.type);
38593
0
}
38594
38595
/* Sets the "mac" column from the "Port" table in 'row' to
38596
 * the 'mac' set.
38597
 *
38598
 * If "mac" is null, the column will be the empty set,
38599
 * otherwise it will contain the specified value.
38600
 *
38601
 * The caller retains ownership of the arguments. */
38602
void
38603
ovsrec_port_add_clause_mac(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *mac)
38604
0
{
38605
0
    struct ovsdb_datum datum;
38606
38607
0
    datum.refcnt = NULL;
38608
38609
0
    if (mac) {
38610
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
38611
0
        datum.n = 1;
38612
0
        datum.keys = key;
38613
0
        key->s = ovsdb_atom_string_create(mac);
38614
0
    } else {
38615
0
        datum.n = 0;
38616
0
        datum.keys = NULL;
38617
0
    }
38618
0
    datum.values = NULL;
38619
0
    ovsdb_idl_condition_add_clause(cond,
38620
0
                          function,
38621
0
                          &ovsrec_port_col_mac,
38622
0
                          &datum);
38623
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_mac.type);
38624
0
}
38625
38626
/* Sets the "name" column from the "Port" table in 'row' to
38627
 * 'name'.
38628
 *
38629
 * The caller retains ownership of the arguments. */
38630
void
38631
ovsrec_port_add_clause_name(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *name)
38632
0
{
38633
0
    struct ovsdb_datum datum;
38634
38635
0
    datum.refcnt = NULL;
38636
38637
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
38638
38639
0
    datum.n = 1;
38640
0
    datum.keys = key;
38641
0
    key->s = ovsdb_atom_string_create(name);
38642
0
    datum.values = NULL;
38643
0
    ovsdb_idl_condition_add_clause(cond,
38644
0
                          function,
38645
0
                          &ovsrec_port_col_name,
38646
0
                          &datum);
38647
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_name.type);
38648
0
}
38649
38650
/* Sets the "other_config" column's value from the "Port" table in 'row'
38651
 * to 'other_config'.
38652
 *
38653
 * The caller retains ownership of 'other_config' and everything in it. */
38654
void
38655
ovsrec_port_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
38656
0
{
38657
0
    struct ovsdb_datum datum;
38658
38659
0
    if (other_config) {
38660
0
        ovsdb_datum_from_smap(&datum, other_config);
38661
0
    } else {
38662
0
        ovsdb_datum_init_empty(&datum);
38663
0
    }
38664
38665
0
    ovsdb_idl_condition_add_clause(cond,
38666
0
                                   function,
38667
0
                                   &ovsrec_port_col_other_config,
38668
0
                                   &datum);
38669
38670
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_other_config.type);
38671
0
}
38672
38673
38674
/* Sets the "protected_" column from the "Port" table in 'row' to
38675
 * 'protected_'.
38676
 *
38677
 * The caller retains ownership of the arguments. */
38678
void
38679
ovsrec_port_add_clause_protected_(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool protected_)
38680
0
{
38681
0
    struct ovsdb_datum datum;
38682
38683
0
    datum.refcnt = NULL;
38684
38685
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
38686
38687
0
    datum.n = 1;
38688
0
    datum.keys = key;
38689
0
    key->boolean = protected_;
38690
0
    datum.values = NULL;
38691
0
    ovsdb_idl_condition_add_clause(cond,
38692
0
                          function,
38693
0
                          &ovsrec_port_col_protected_,
38694
0
                          &datum);
38695
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_protected_.type);
38696
0
}
38697
38698
/* Sets the "qos" column from the "Port" table in 'row' to
38699
 * the 'qos' set.
38700
 *
38701
 * If "qos" is null, the column will be the empty set,
38702
 * otherwise it will contain the specified value.
38703
 *
38704
 * The caller retains ownership of the arguments. */
38705
void
38706
ovsrec_port_add_clause_qos(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct uuid *qos)
38707
0
{
38708
0
    struct ovsdb_datum datum;
38709
38710
0
    datum.refcnt = NULL;
38711
38712
0
    if (qos) {
38713
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
38714
0
        datum.n = 1;
38715
0
        datum.keys = key;
38716
0
        key->uuid = *qos;
38717
0
    } else {
38718
0
        datum.n = 0;
38719
0
        datum.keys = NULL;
38720
0
    }
38721
0
    datum.values = NULL;
38722
0
    ovsdb_idl_condition_add_clause(cond,
38723
0
                          function,
38724
0
                          &ovsrec_port_col_qos,
38725
0
                          &datum);
38726
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_qos.type);
38727
0
}
38728
38729
/* Sets the "rstp_statistics" column from the "Port" table in 'row' to
38730
 * the map with keys 'key_rstp_statistics' and values 'value_rstp_statistics'
38731
 * with 'n_rstp_statistics' entries.
38732
 *
38733
 * The caller retains ownership of the arguments. */
38734
void
38735
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)
38736
0
{
38737
0
    struct ovsdb_datum datum;
38738
38739
0
    datum.refcnt = NULL;
38740
0
    datum.n = n_rstp_statistics;
38741
0
    datum.keys = n_rstp_statistics ? xmalloc(n_rstp_statistics * sizeof *datum.keys) : NULL;
38742
0
    datum.values = xmalloc(n_rstp_statistics * sizeof *datum.values);
38743
0
    for (size_t i = 0; i < n_rstp_statistics; i++) {
38744
0
        datum.keys[i].s = ovsdb_atom_string_create(key_rstp_statistics[i]);
38745
0
        datum.values[i].integer = value_rstp_statistics[i];
38746
0
    }
38747
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_rstp_statistics.type);
38748
0
    ovsdb_idl_condition_add_clause(cond,
38749
0
                          function,
38750
0
                          &ovsrec_port_col_rstp_statistics,
38751
0
                          &datum);
38752
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_rstp_statistics.type);
38753
0
}
38754
38755
/* Sets the "rstp_status" column's value from the "Port" table in 'row'
38756
 * to 'rstp_status'.
38757
 *
38758
 * The caller retains ownership of 'rstp_status' and everything in it. */
38759
void
38760
ovsrec_port_add_clause_rstp_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *rstp_status)
38761
0
{
38762
0
    struct ovsdb_datum datum;
38763
38764
0
    if (rstp_status) {
38765
0
        ovsdb_datum_from_smap(&datum, rstp_status);
38766
0
    } else {
38767
0
        ovsdb_datum_init_empty(&datum);
38768
0
    }
38769
38770
0
    ovsdb_idl_condition_add_clause(cond,
38771
0
                                   function,
38772
0
                                   &ovsrec_port_col_rstp_status,
38773
0
                                   &datum);
38774
38775
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_rstp_status.type);
38776
0
}
38777
38778
38779
/* Sets the "statistics" column from the "Port" table in 'row' to
38780
 * the map with keys 'key_statistics' and values 'value_statistics'
38781
 * with 'n_statistics' entries.
38782
 *
38783
 * The caller retains ownership of the arguments. */
38784
void
38785
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)
38786
0
{
38787
0
    struct ovsdb_datum datum;
38788
38789
0
    datum.refcnt = NULL;
38790
0
    datum.n = n_statistics;
38791
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
38792
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
38793
0
    for (size_t i = 0; i < n_statistics; i++) {
38794
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
38795
0
        datum.values[i].integer = value_statistics[i];
38796
0
    }
38797
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_statistics.type);
38798
0
    ovsdb_idl_condition_add_clause(cond,
38799
0
                          function,
38800
0
                          &ovsrec_port_col_statistics,
38801
0
                          &datum);
38802
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_statistics.type);
38803
0
}
38804
38805
/* Sets the "status" column's value from the "Port" table in 'row'
38806
 * to 'status'.
38807
 *
38808
 * The caller retains ownership of 'status' and everything in it. */
38809
void
38810
ovsrec_port_add_clause_status(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *status)
38811
0
{
38812
0
    struct ovsdb_datum datum;
38813
38814
0
    if (status) {
38815
0
        ovsdb_datum_from_smap(&datum, status);
38816
0
    } else {
38817
0
        ovsdb_datum_init_empty(&datum);
38818
0
    }
38819
38820
0
    ovsdb_idl_condition_add_clause(cond,
38821
0
                                   function,
38822
0
                                   &ovsrec_port_col_status,
38823
0
                                   &datum);
38824
38825
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_status.type);
38826
0
}
38827
38828
38829
/* Sets the "tag" column from the "Port" table in 'row' to
38830
 * the 'tag' set with 'n_tag' entries.
38831
 *
38832
 * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
38833
 * may be NULL.
38834
 *
38835
 * Argument constraints: in range 0 to 4,095
38836
 *
38837
 * The caller retains ownership of the arguments. */
38838
void
38839
ovsrec_port_add_clause_tag(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *tag, size_t n_tag)
38840
0
{
38841
0
    struct ovsdb_datum datum;
38842
38843
0
    datum.refcnt = NULL;
38844
38845
0
    if (n_tag) {
38846
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
38847
0
        datum.n = 1;
38848
0
        datum.keys = key;
38849
0
        key->integer = *tag;
38850
0
    } else {
38851
0
        datum.n = 0;
38852
0
        datum.keys = NULL;
38853
0
    }
38854
0
    datum.values = NULL;
38855
0
    ovsdb_idl_condition_add_clause(cond,
38856
0
                          function,
38857
0
                          &ovsrec_port_col_tag,
38858
0
                          &datum);
38859
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_tag.type);
38860
0
}
38861
38862
/* Sets the "trunks" column from the "Port" table in 'row' to
38863
 * the 'trunks' set with 'n_trunks' entries.
38864
 *
38865
 * Argument constraints: in range 0 to 4,095
38866
 *
38867
 * The caller retains ownership of the arguments. */
38868
void
38869
ovsrec_port_add_clause_trunks(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *trunks, size_t n_trunks)
38870
0
{
38871
0
    struct ovsdb_datum datum;
38872
38873
0
    datum.refcnt = NULL;
38874
0
    datum.n = n_trunks;
38875
0
    datum.keys = n_trunks ? xmalloc(n_trunks * sizeof *datum.keys) : NULL;
38876
0
    datum.values = NULL;
38877
0
    for (size_t i = 0; i < n_trunks; i++) {
38878
0
        datum.keys[i].integer = trunks[i];
38879
0
    }
38880
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_trunks.type);
38881
0
    ovsdb_idl_condition_add_clause(cond,
38882
0
                          function,
38883
0
                          &ovsrec_port_col_trunks,
38884
0
                          &datum);
38885
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_trunks.type);
38886
0
}
38887
38888
/* Sets the "vlan_mode" column from the "Port" table in 'row' to
38889
 * the 'vlan_mode' set.
38890
 *
38891
 * If "vlan_mode" is null, the column will be the empty set,
38892
 * otherwise it will contain the specified value.
38893
 *
38894
 * Argument constraints: one of "access", "dot1q-tunnel", "native-tagged", "native-untagged", or "trunk"
38895
 *
38896
 * The caller retains ownership of the arguments. */
38897
void
38898
ovsrec_port_add_clause_vlan_mode(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *vlan_mode)
38899
0
{
38900
0
    struct ovsdb_datum datum;
38901
38902
0
    datum.refcnt = NULL;
38903
38904
0
    if (vlan_mode) {
38905
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
38906
0
        datum.n = 1;
38907
0
        datum.keys = key;
38908
0
        key->s = ovsdb_atom_string_create(vlan_mode);
38909
0
    } else {
38910
0
        datum.n = 0;
38911
0
        datum.keys = NULL;
38912
0
    }
38913
0
    datum.values = NULL;
38914
0
    ovsdb_idl_condition_add_clause(cond,
38915
0
                          function,
38916
0
                          &ovsrec_port_col_vlan_mode,
38917
0
                          &datum);
38918
0
    ovsdb_datum_destroy(&datum, &ovsrec_port_col_vlan_mode.type);
38919
0
}
38920
38921
/* Destroy 'row' of kind "Port". The row must have been
38922
 * created with ovsdb_idl_index_init_row.
38923
 */
38924
void
38925
ovsrec_port_index_destroy_row(const struct ovsrec_port *row)
38926
0
{
38927
0
    ovsdb_idl_index_destroy_row(&row->header_);
38928
0
}
38929
        
38930
38931
/* Creates a new row of kind "Port". */
38932
struct ovsrec_port *
38933
ovsrec_port_index_init_row(struct ovsdb_idl_index *index)
38934
0
{
38935
0
    ovs_assert(index->table->class_ == &ovsrec_table_port);
38936
0
    return ALIGNED_CAST(struct ovsrec_port *, ovsdb_idl_index_init_row(index));
38937
0
}
38938
38939
struct ovsrec_port *
38940
ovsrec_port_index_find(struct ovsdb_idl_index *index, const struct ovsrec_port *target)
38941
0
{
38942
0
    ovs_assert(index->table->class_ == &ovsrec_table_port);
38943
0
    return ovsrec_port_cast(ovsdb_idl_index_find(index, &target->header_));
38944
0
}
38945
38946
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
38947
int
38948
ovsrec_port_index_compare(
38949
    struct ovsdb_idl_index *index, 
38950
    const struct ovsrec_port *a, 
38951
    const struct ovsrec_port *b)
38952
0
{
38953
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
38954
0
}
38955
38956
struct ovsdb_idl_cursor
38957
ovsrec_port_cursor_first(struct ovsdb_idl_index *index)
38958
0
{
38959
0
    ovs_assert(index->table->class_ == &ovsrec_table_port);
38960
0
    return ovsdb_idl_cursor_first(index);
38961
0
}
38962
38963
struct ovsdb_idl_cursor
38964
ovsrec_port_cursor_first_eq(
38965
    struct ovsdb_idl_index *index, const struct ovsrec_port *target)
38966
0
{
38967
0
    ovs_assert(index->table->class_ == &ovsrec_table_port);
38968
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
38969
0
}
38970
38971
struct ovsdb_idl_cursor
38972
ovsrec_port_cursor_first_ge(
38973
    struct ovsdb_idl_index *index, const struct ovsrec_port *target)
38974
0
{
38975
0
    ovs_assert(index->table->class_ == &ovsrec_table_port);
38976
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
38977
0
}
38978
38979
struct ovsrec_port *
38980
ovsrec_port_cursor_data(struct ovsdb_idl_cursor *cursor)
38981
0
{
38982
0
    return ovsrec_port_cast(ovsdb_idl_cursor_data(cursor));
38983
0
}
38984
38985
38986
/* Sets the "bond_active_slave" column from the "Port" table in 'row' to
38987
 * the 'bond_active_slave' set.
38988
 *
38989
 * If "bond_active_slave" is null, the column will be the empty set,
38990
 * otherwise it will contain the specified value.
38991
 *
38992
 * The caller retains ownership of the arguments. */
38993
void
38994
ovsrec_port_index_set_bond_active_slave(const struct ovsrec_port *row, const char *bond_active_slave)
38995
0
{
38996
0
    struct ovsdb_datum datum;
38997
38998
0
    datum.refcnt = NULL;
38999
0
    union ovsdb_atom *key;
39000
39001
0
    if (bond_active_slave) {
39002
0
        key = xmalloc(sizeof (union ovsdb_atom));
39003
0
        datum.n = 1;
39004
0
        datum.keys = key;
39005
0
        key->s = ovsdb_atom_string_create(bond_active_slave);
39006
0
    } else {
39007
0
        datum.n = 0;
39008
0
        datum.keys = NULL;
39009
0
    }
39010
0
    datum.values = NULL;
39011
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]);
39012
0
}
39013
39014
/* Sets the "bond_downdelay" column from the "Port" table in 'row' to
39015
 * 'bond_downdelay'.
39016
 *
39017
 * The caller retains ownership of the arguments. */
39018
void
39019
ovsrec_port_index_set_bond_downdelay(const struct ovsrec_port *row, int64_t bond_downdelay)
39020
0
{
39021
0
    struct ovsdb_datum datum;
39022
39023
0
    datum.refcnt = NULL;
39024
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
39025
39026
0
    datum.n = 1;
39027
0
    datum.keys = key;
39028
0
    key->integer = bond_downdelay;
39029
0
    datum.values = NULL;
39030
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]);
39031
0
}
39032
39033
/* Sets the "bond_fake_iface" column from the "Port" table in 'row' to
39034
 * 'bond_fake_iface'.
39035
 *
39036
 * The caller retains ownership of the arguments. */
39037
void
39038
ovsrec_port_index_set_bond_fake_iface(const struct ovsrec_port *row, bool bond_fake_iface)
39039
0
{
39040
0
    struct ovsdb_datum datum;
39041
39042
0
    datum.refcnt = NULL;
39043
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
39044
39045
0
    datum.n = 1;
39046
0
    datum.keys = key;
39047
0
    key->boolean = bond_fake_iface;
39048
0
    datum.values = NULL;
39049
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]);
39050
0
}
39051
39052
/* Sets the "bond_mode" column from the "Port" table in 'row' to
39053
 * the 'bond_mode' set.
39054
 *
39055
 * If "bond_mode" is null, the column will be the empty set,
39056
 * otherwise it will contain the specified value.
39057
 *
39058
 * Argument constraints: one of "active-backup", "balance-slb", or "balance-tcp"
39059
 *
39060
 * The caller retains ownership of the arguments. */
39061
void
39062
ovsrec_port_index_set_bond_mode(const struct ovsrec_port *row, const char *bond_mode)
39063
0
{
39064
0
    struct ovsdb_datum datum;
39065
39066
0
    datum.refcnt = NULL;
39067
0
    union ovsdb_atom *key;
39068
39069
0
    if (bond_mode) {
39070
0
        key = xmalloc(sizeof (union ovsdb_atom));
39071
0
        datum.n = 1;
39072
0
        datum.keys = key;
39073
0
        key->s = ovsdb_atom_string_create(bond_mode);
39074
0
    } else {
39075
0
        datum.n = 0;
39076
0
        datum.keys = NULL;
39077
0
    }
39078
0
    datum.values = NULL;
39079
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]);
39080
0
}
39081
39082
/* Sets the "bond_updelay" column from the "Port" table in 'row' to
39083
 * 'bond_updelay'.
39084
 *
39085
 * The caller retains ownership of the arguments. */
39086
void
39087
ovsrec_port_index_set_bond_updelay(const struct ovsrec_port *row, int64_t bond_updelay)
39088
0
{
39089
0
    struct ovsdb_datum datum;
39090
39091
0
    datum.refcnt = NULL;
39092
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
39093
39094
0
    datum.n = 1;
39095
0
    datum.keys = key;
39096
0
    key->integer = bond_updelay;
39097
0
    datum.values = NULL;
39098
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]);
39099
0
}
39100
39101
/* Sets the "cvlans" column from the "Port" table in 'row' to
39102
 * the 'cvlans' set with 'n_cvlans' entries.
39103
 *
39104
 * Argument constraints: in range 0 to 4,095
39105
 *
39106
 * The caller retains ownership of the arguments. */
39107
void
39108
ovsrec_port_index_set_cvlans(const struct ovsrec_port *row, const int64_t *cvlans, size_t n_cvlans)
39109
0
{
39110
0
    struct ovsdb_datum datum;
39111
39112
0
    datum.refcnt = NULL;
39113
0
    size_t i;
39114
39115
0
    datum.n = n_cvlans;
39116
0
    datum.keys = n_cvlans ? xmalloc(n_cvlans * sizeof *datum.keys) : NULL;
39117
0
    datum.values = NULL;
39118
0
    for (i = 0; i < n_cvlans; i++) {
39119
0
        datum.keys[i].integer = cvlans[i];
39120
0
    }
39121
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_cvlans.type);
39122
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]);
39123
0
}
39124
39125
/* Sets the "external_ids" column's value from the "Port" table in 'row'
39126
 * to 'external_ids'.
39127
 *
39128
 * The caller retains ownership of 'external_ids' and everything in it. */
39129
void
39130
ovsrec_port_index_set_external_ids(const struct ovsrec_port *row, const struct smap *external_ids)
39131
0
{
39132
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
39133
39134
0
    if (external_ids) {
39135
0
        struct smap_node *node;
39136
0
        size_t i;
39137
39138
0
        datum->n = smap_count(external_ids);
39139
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
39140
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
39141
0
        datum->refcnt = NULL;
39142
39143
0
        i = 0;
39144
0
        SMAP_FOR_EACH (node, external_ids) {
39145
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
39146
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
39147
0
            i++;
39148
0
        }
39149
0
        ovsdb_datum_sort_unique(datum, &ovsrec_port_col_external_ids.type);
39150
0
    } else {
39151
0
        ovsdb_datum_init_empty(datum);
39152
0
    }
39153
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
39154
0
                          &ovsrec_port_columns[OVSREC_PORT_COL_EXTERNAL_IDS],
39155
0
                          datum,
39156
0
                          &ovsrec_table_classes[OVSREC_TABLE_PORT]);
39157
0
    free(datum);
39158
0
}
39159
39160
39161
/* Sets the "fake_bridge" column from the "Port" table in 'row' to
39162
 * 'fake_bridge'.
39163
 *
39164
 * The caller retains ownership of the arguments. */
39165
void
39166
ovsrec_port_index_set_fake_bridge(const struct ovsrec_port *row, bool fake_bridge)
39167
0
{
39168
0
    struct ovsdb_datum datum;
39169
39170
0
    datum.refcnt = NULL;
39171
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
39172
39173
0
    datum.n = 1;
39174
0
    datum.keys = key;
39175
0
    key->boolean = fake_bridge;
39176
0
    datum.values = NULL;
39177
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]);
39178
0
}
39179
39180
/* Sets the "interfaces" column from the "Port" table in 'row' to
39181
 * the 'interfaces' set with 'n_interfaces' entries.
39182
 *
39183
 * The caller retains ownership of the arguments. */
39184
void
39185
ovsrec_port_index_set_interfaces(const struct ovsrec_port *row, struct ovsrec_interface **interfaces, size_t n_interfaces)
39186
0
{
39187
0
    struct ovsdb_datum datum;
39188
39189
0
    datum.refcnt = NULL;
39190
0
    size_t i;
39191
39192
0
    datum.n = n_interfaces;
39193
0
    datum.keys = n_interfaces ? xmalloc(n_interfaces * sizeof *datum.keys) : NULL;
39194
0
    datum.values = NULL;
39195
0
    for (i = 0; i < n_interfaces; i++) {
39196
0
        datum.keys[i].uuid = interfaces[i]->header_.uuid;
39197
0
    }
39198
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_interfaces.type);
39199
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]);
39200
0
}
39201
39202
/* Sets the "lacp" column from the "Port" table in 'row' to
39203
 * the 'lacp' set.
39204
 *
39205
 * If "lacp" is null, the column will be the empty set,
39206
 * otherwise it will contain the specified value.
39207
 *
39208
 * Argument constraints: one of "active", "off", or "passive"
39209
 *
39210
 * The caller retains ownership of the arguments. */
39211
void
39212
ovsrec_port_index_set_lacp(const struct ovsrec_port *row, const char *lacp)
39213
0
{
39214
0
    struct ovsdb_datum datum;
39215
39216
0
    datum.refcnt = NULL;
39217
0
    union ovsdb_atom *key;
39218
39219
0
    if (lacp) {
39220
0
        key = xmalloc(sizeof (union ovsdb_atom));
39221
0
        datum.n = 1;
39222
0
        datum.keys = key;
39223
0
        key->s = ovsdb_atom_string_create(lacp);
39224
0
    } else {
39225
0
        datum.n = 0;
39226
0
        datum.keys = NULL;
39227
0
    }
39228
0
    datum.values = NULL;
39229
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]);
39230
0
}
39231
39232
/* Sets the "mac" column from the "Port" table in 'row' to
39233
 * the 'mac' set.
39234
 *
39235
 * If "mac" is null, the column will be the empty set,
39236
 * otherwise it will contain the specified value.
39237
 *
39238
 * The caller retains ownership of the arguments. */
39239
void
39240
ovsrec_port_index_set_mac(const struct ovsrec_port *row, const char *mac)
39241
0
{
39242
0
    struct ovsdb_datum datum;
39243
39244
0
    datum.refcnt = NULL;
39245
0
    union ovsdb_atom *key;
39246
39247
0
    if (mac) {
39248
0
        key = xmalloc(sizeof (union ovsdb_atom));
39249
0
        datum.n = 1;
39250
0
        datum.keys = key;
39251
0
        key->s = ovsdb_atom_string_create(mac);
39252
0
    } else {
39253
0
        datum.n = 0;
39254
0
        datum.keys = NULL;
39255
0
    }
39256
0
    datum.values = NULL;
39257
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]);
39258
0
}
39259
39260
/* Sets the "name" column from the "Port" table in 'row' to
39261
 * 'name'.
39262
 *
39263
 * The caller retains ownership of the arguments. */
39264
void
39265
ovsrec_port_index_set_name(const struct ovsrec_port *row, const char *name)
39266
0
{
39267
0
    struct ovsdb_datum datum;
39268
39269
0
    datum.refcnt = NULL;
39270
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
39271
39272
0
    datum.n = 1;
39273
0
    datum.keys = key;
39274
0
    key->s = ovsdb_atom_string_create(name);
39275
0
    datum.values = NULL;
39276
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]);
39277
0
}
39278
39279
/* Sets the "other_config" column's value from the "Port" table in 'row'
39280
 * to 'other_config'.
39281
 *
39282
 * The caller retains ownership of 'other_config' and everything in it. */
39283
void
39284
ovsrec_port_index_set_other_config(const struct ovsrec_port *row, const struct smap *other_config)
39285
0
{
39286
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
39287
39288
0
    if (other_config) {
39289
0
        struct smap_node *node;
39290
0
        size_t i;
39291
39292
0
        datum->n = smap_count(other_config);
39293
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
39294
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
39295
0
        datum->refcnt = NULL;
39296
39297
0
        i = 0;
39298
0
        SMAP_FOR_EACH (node, other_config) {
39299
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
39300
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
39301
0
            i++;
39302
0
        }
39303
0
        ovsdb_datum_sort_unique(datum, &ovsrec_port_col_other_config.type);
39304
0
    } else {
39305
0
        ovsdb_datum_init_empty(datum);
39306
0
    }
39307
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
39308
0
                          &ovsrec_port_columns[OVSREC_PORT_COL_OTHER_CONFIG],
39309
0
                          datum,
39310
0
                          &ovsrec_table_classes[OVSREC_TABLE_PORT]);
39311
0
    free(datum);
39312
0
}
39313
39314
39315
/* Sets the "protected_" column from the "Port" table in 'row' to
39316
 * 'protected_'.
39317
 *
39318
 * The caller retains ownership of the arguments. */
39319
void
39320
ovsrec_port_index_set_protected_(const struct ovsrec_port *row, bool protected_)
39321
0
{
39322
0
    struct ovsdb_datum datum;
39323
39324
0
    datum.refcnt = NULL;
39325
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
39326
39327
0
    datum.n = 1;
39328
0
    datum.keys = key;
39329
0
    key->boolean = protected_;
39330
0
    datum.values = NULL;
39331
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]);
39332
0
}
39333
39334
/* Sets the "qos" column from the "Port" table in 'row' to
39335
 * the 'qos' set.
39336
 *
39337
 * If "qos" is null, the column will be the empty set,
39338
 * otherwise it will contain the specified value.
39339
 *
39340
 * The caller retains ownership of the arguments. */
39341
void
39342
ovsrec_port_index_set_qos(const struct ovsrec_port *row, const struct ovsrec_qos *qos)
39343
0
{
39344
0
    struct ovsdb_datum datum;
39345
39346
0
    datum.refcnt = NULL;
39347
0
    union ovsdb_atom *key;
39348
39349
0
    if (qos) {
39350
0
        key = xmalloc(sizeof (union ovsdb_atom));
39351
0
        datum.n = 1;
39352
0
        datum.keys = key;
39353
0
        key->uuid = qos->header_.uuid;
39354
0
    } else {
39355
0
        datum.n = 0;
39356
0
        datum.keys = NULL;
39357
0
    }
39358
0
    datum.values = NULL;
39359
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]);
39360
0
}
39361
39362
/* Sets the "rstp_statistics" column from the "Port" table in 'row' to
39363
 * the map with keys 'key_rstp_statistics' and values 'value_rstp_statistics'
39364
 * with 'n_rstp_statistics' entries.
39365
 *
39366
 * The caller retains ownership of the arguments. */
39367
void
39368
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)
39369
0
{
39370
0
    struct ovsdb_datum datum;
39371
39372
0
    datum.refcnt = NULL;
39373
0
    size_t i;
39374
39375
0
    datum.n = n_rstp_statistics;
39376
0
    datum.keys = n_rstp_statistics ? xmalloc(n_rstp_statistics * sizeof *datum.keys) : NULL;
39377
0
    datum.values = xmalloc(n_rstp_statistics * sizeof *datum.values);
39378
0
    for (i = 0; i < n_rstp_statistics; i++) {
39379
0
        datum.keys[i].s = ovsdb_atom_string_create(key_rstp_statistics[i]);
39380
0
        datum.values[i].integer = value_rstp_statistics[i];
39381
0
    }
39382
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_rstp_statistics.type);
39383
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]);
39384
0
}
39385
39386
/* Sets the "rstp_status" column's value from the "Port" table in 'row'
39387
 * to 'rstp_status'.
39388
 *
39389
 * The caller retains ownership of 'rstp_status' and everything in it. */
39390
void
39391
ovsrec_port_index_set_rstp_status(const struct ovsrec_port *row, const struct smap *rstp_status)
39392
0
{
39393
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
39394
39395
0
    if (rstp_status) {
39396
0
        struct smap_node *node;
39397
0
        size_t i;
39398
39399
0
        datum->n = smap_count(rstp_status);
39400
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
39401
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
39402
0
        datum->refcnt = NULL;
39403
39404
0
        i = 0;
39405
0
        SMAP_FOR_EACH (node, rstp_status) {
39406
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
39407
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
39408
0
            i++;
39409
0
        }
39410
0
        ovsdb_datum_sort_unique(datum, &ovsrec_port_col_rstp_status.type);
39411
0
    } else {
39412
0
        ovsdb_datum_init_empty(datum);
39413
0
    }
39414
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
39415
0
                          &ovsrec_port_columns[OVSREC_PORT_COL_RSTP_STATUS],
39416
0
                          datum,
39417
0
                          &ovsrec_table_classes[OVSREC_TABLE_PORT]);
39418
0
    free(datum);
39419
0
}
39420
39421
39422
/* Sets the "statistics" column from the "Port" table in 'row' to
39423
 * the map with keys 'key_statistics' and values 'value_statistics'
39424
 * with 'n_statistics' entries.
39425
 *
39426
 * The caller retains ownership of the arguments. */
39427
void
39428
ovsrec_port_index_set_statistics(const struct ovsrec_port *row, const char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
39429
0
{
39430
0
    struct ovsdb_datum datum;
39431
39432
0
    datum.refcnt = NULL;
39433
0
    size_t i;
39434
39435
0
    datum.n = n_statistics;
39436
0
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
39437
0
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
39438
0
    for (i = 0; i < n_statistics; i++) {
39439
0
        datum.keys[i].s = ovsdb_atom_string_create(key_statistics[i]);
39440
0
        datum.values[i].integer = value_statistics[i];
39441
0
    }
39442
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_statistics.type);
39443
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]);
39444
0
}
39445
39446
/* Sets the "status" column's value from the "Port" table in 'row'
39447
 * to 'status'.
39448
 *
39449
 * The caller retains ownership of 'status' and everything in it. */
39450
void
39451
ovsrec_port_index_set_status(const struct ovsrec_port *row, const struct smap *status)
39452
0
{
39453
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
39454
39455
0
    if (status) {
39456
0
        struct smap_node *node;
39457
0
        size_t i;
39458
39459
0
        datum->n = smap_count(status);
39460
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
39461
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
39462
0
        datum->refcnt = NULL;
39463
39464
0
        i = 0;
39465
0
        SMAP_FOR_EACH (node, status) {
39466
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
39467
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
39468
0
            i++;
39469
0
        }
39470
0
        ovsdb_datum_sort_unique(datum, &ovsrec_port_col_status.type);
39471
0
    } else {
39472
0
        ovsdb_datum_init_empty(datum);
39473
0
    }
39474
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
39475
0
                          &ovsrec_port_columns[OVSREC_PORT_COL_STATUS],
39476
0
                          datum,
39477
0
                          &ovsrec_table_classes[OVSREC_TABLE_PORT]);
39478
0
    free(datum);
39479
0
}
39480
39481
39482
/* Sets the "tag" column from the "Port" table in 'row' to
39483
 * the 'tag' set with 'n_tag' entries.
39484
 *
39485
 * 'n_tag' may be 0 or 1; if it is 0, then 'tag'
39486
 * may be NULL.
39487
 *
39488
 * Argument constraints: in range 0 to 4,095
39489
 *
39490
 * The caller retains ownership of the arguments. */
39491
void
39492
ovsrec_port_index_set_tag(const struct ovsrec_port *row, const int64_t *tag, size_t n_tag)
39493
0
{
39494
0
    struct ovsdb_datum datum;
39495
39496
0
    datum.refcnt = NULL;
39497
0
    union ovsdb_atom *key;
39498
39499
0
    if (n_tag) {
39500
0
        key = xmalloc(sizeof(union ovsdb_atom));
39501
0
        datum.n = 1;
39502
0
        datum.keys = key;
39503
0
        key->integer = *tag;
39504
0
    } else {
39505
0
        datum.n = 0;
39506
0
        datum.keys = NULL;
39507
0
    }
39508
0
    datum.values = NULL;
39509
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]);
39510
0
}
39511
39512
/* Sets the "trunks" column from the "Port" table in 'row' to
39513
 * the 'trunks' set with 'n_trunks' entries.
39514
 *
39515
 * Argument constraints: in range 0 to 4,095
39516
 *
39517
 * The caller retains ownership of the arguments. */
39518
void
39519
ovsrec_port_index_set_trunks(const struct ovsrec_port *row, const int64_t *trunks, size_t n_trunks)
39520
0
{
39521
0
    struct ovsdb_datum datum;
39522
39523
0
    datum.refcnt = NULL;
39524
0
    size_t i;
39525
39526
0
    datum.n = n_trunks;
39527
0
    datum.keys = n_trunks ? xmalloc(n_trunks * sizeof *datum.keys) : NULL;
39528
0
    datum.values = NULL;
39529
0
    for (i = 0; i < n_trunks; i++) {
39530
0
        datum.keys[i].integer = trunks[i];
39531
0
    }
39532
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_port_col_trunks.type);
39533
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]);
39534
0
}
39535
39536
/* Sets the "vlan_mode" column from the "Port" table in 'row' to
39537
 * the 'vlan_mode' set.
39538
 *
39539
 * If "vlan_mode" is null, the column will be the empty set,
39540
 * otherwise it will contain the specified value.
39541
 *
39542
 * Argument constraints: one of "access", "dot1q-tunnel", "native-tagged", "native-untagged", or "trunk"
39543
 *
39544
 * The caller retains ownership of the arguments. */
39545
void
39546
ovsrec_port_index_set_vlan_mode(const struct ovsrec_port *row, const char *vlan_mode)
39547
0
{
39548
0
    struct ovsdb_datum datum;
39549
39550
0
    datum.refcnt = NULL;
39551
0
    union ovsdb_atom *key;
39552
39553
0
    if (vlan_mode) {
39554
0
        key = xmalloc(sizeof (union ovsdb_atom));
39555
0
        datum.n = 1;
39556
0
        datum.keys = key;
39557
0
        key->s = ovsdb_atom_string_create(vlan_mode);
39558
0
    } else {
39559
0
        datum.n = 0;
39560
0
        datum.keys = NULL;
39561
0
    }
39562
0
    datum.values = NULL;
39563
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]);
39564
0
}
39565
39566
struct ovsdb_idl_column ovsrec_port_columns[OVSREC_PORT_N_COLUMNS];
39567
39568
unsigned int
39569
ovsrec_port_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
39570
0
{
39571
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_port, condition);
39572
0
}
39573
static struct json Port_col_bond_mode_key_enum_key_strings[3] = {
39574
    { .type = JSON_STRING, .string = "active-backup", .count = 2 },
39575
    { .type = JSON_STRING, .string = "balance-slb", .count = 2 },
39576
    { .type = JSON_STRING, .string = "balance-tcp", .count = 2 },
39577
};
39578
static union ovsdb_atom Port_col_bond_mode_key_enum_keys[3] = {
39579
    { .s = &Port_col_bond_mode_key_enum_key_strings[0] },
39580
    { .s = &Port_col_bond_mode_key_enum_key_strings[1] },
39581
    { .s = &Port_col_bond_mode_key_enum_key_strings[2] },
39582
};
39583
static struct ovsdb_datum Port_col_bond_mode_key_enum = {
39584
    .n = 3,
39585
    .keys = Port_col_bond_mode_key_enum_keys,
39586
};
39587
static struct json Port_col_lacp_key_enum_key_strings[3] = {
39588
    { .type = JSON_STRING, .string = "active", .count = 2 },
39589
    { .type = JSON_STRING, .string = "off", .count = 2 },
39590
    { .type = JSON_STRING, .string = "passive", .count = 2 },
39591
};
39592
static union ovsdb_atom Port_col_lacp_key_enum_keys[3] = {
39593
    { .s = &Port_col_lacp_key_enum_key_strings[0] },
39594
    { .s = &Port_col_lacp_key_enum_key_strings[1] },
39595
    { .s = &Port_col_lacp_key_enum_key_strings[2] },
39596
};
39597
static struct ovsdb_datum Port_col_lacp_key_enum = {
39598
    .n = 3,
39599
    .keys = Port_col_lacp_key_enum_keys,
39600
};
39601
static struct json Port_col_vlan_mode_key_enum_key_strings[5] = {
39602
    { .type = JSON_STRING, .string = "access", .count = 2 },
39603
    { .type = JSON_STRING, .string = "dot1q-tunnel", .count = 2 },
39604
    { .type = JSON_STRING, .string = "native-tagged", .count = 2 },
39605
    { .type = JSON_STRING, .string = "native-untagged", .count = 2 },
39606
    { .type = JSON_STRING, .string = "trunk", .count = 2 },
39607
};
39608
static union ovsdb_atom Port_col_vlan_mode_key_enum_keys[5] = {
39609
    { .s = &Port_col_vlan_mode_key_enum_key_strings[0] },
39610
    { .s = &Port_col_vlan_mode_key_enum_key_strings[1] },
39611
    { .s = &Port_col_vlan_mode_key_enum_key_strings[2] },
39612
    { .s = &Port_col_vlan_mode_key_enum_key_strings[3] },
39613
    { .s = &Port_col_vlan_mode_key_enum_key_strings[4] },
39614
};
39615
static struct ovsdb_datum Port_col_vlan_mode_key_enum = {
39616
    .n = 5,
39617
    .keys = Port_col_vlan_mode_key_enum_keys,
39618
};
39619
39620
struct ovsdb_idl_column ovsrec_port_columns[OVSREC_PORT_N_COLUMNS] = {
39621
    [OVSREC_PORT_COL_BOND_ACTIVE_SLAVE] = {
39622
         .name = "bond_active_slave",
39623
         .type = {
39624
            .key = {
39625
               .type = OVSDB_TYPE_STRING,
39626
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39627
            },
39628
            .value = OVSDB_BASE_VOID_INIT,
39629
            .n_min = 0,
39630
            .n_max = 1,
39631
         },
39632
         .is_mutable = true,
39633
         .is_synthetic = false,
39634
         .parse = ovsrec_port_parse_bond_active_slave,
39635
         .unparse = ovsrec_port_unparse_bond_active_slave,
39636
    },
39637
39638
    [OVSREC_PORT_COL_BOND_DOWNDELAY] = {
39639
         .name = "bond_downdelay",
39640
         .type = {
39641
            .key = {
39642
               .type = OVSDB_TYPE_INTEGER,
39643
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
39644
            },
39645
            .value = OVSDB_BASE_VOID_INIT,
39646
            .n_min = 1,
39647
            .n_max = 1,
39648
         },
39649
         .is_mutable = true,
39650
         .is_synthetic = false,
39651
         .parse = ovsrec_port_parse_bond_downdelay,
39652
         .unparse = ovsrec_port_unparse_bond_downdelay,
39653
    },
39654
39655
    [OVSREC_PORT_COL_BOND_FAKE_IFACE] = {
39656
         .name = "bond_fake_iface",
39657
         .type = {
39658
            .key = {
39659
               .type = OVSDB_TYPE_BOOLEAN,
39660
            },
39661
            .value = OVSDB_BASE_VOID_INIT,
39662
            .n_min = 1,
39663
            .n_max = 1,
39664
         },
39665
         .is_mutable = true,
39666
         .is_synthetic = false,
39667
         .parse = ovsrec_port_parse_bond_fake_iface,
39668
         .unparse = ovsrec_port_unparse_bond_fake_iface,
39669
    },
39670
39671
    [OVSREC_PORT_COL_BOND_MODE] = {
39672
         .name = "bond_mode",
39673
         .type = {
39674
            .key = {
39675
               .type = OVSDB_TYPE_STRING,
39676
               .enum_ = &Port_col_bond_mode_key_enum,
39677
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39678
            },
39679
            .value = OVSDB_BASE_VOID_INIT,
39680
            .n_min = 0,
39681
            .n_max = 1,
39682
         },
39683
         .is_mutable = true,
39684
         .is_synthetic = false,
39685
         .parse = ovsrec_port_parse_bond_mode,
39686
         .unparse = ovsrec_port_unparse_bond_mode,
39687
    },
39688
39689
    [OVSREC_PORT_COL_BOND_UPDELAY] = {
39690
         .name = "bond_updelay",
39691
         .type = {
39692
            .key = {
39693
               .type = OVSDB_TYPE_INTEGER,
39694
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
39695
            },
39696
            .value = OVSDB_BASE_VOID_INIT,
39697
            .n_min = 1,
39698
            .n_max = 1,
39699
         },
39700
         .is_mutable = true,
39701
         .is_synthetic = false,
39702
         .parse = ovsrec_port_parse_bond_updelay,
39703
         .unparse = ovsrec_port_unparse_bond_updelay,
39704
    },
39705
39706
    [OVSREC_PORT_COL_CVLANS] = {
39707
         .name = "cvlans",
39708
         .type = {
39709
            .key = {
39710
               .type = OVSDB_TYPE_INTEGER,
39711
               .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
39712
            },
39713
            .value = OVSDB_BASE_VOID_INIT,
39714
            .n_min = 0,
39715
            .n_max = 4096,
39716
         },
39717
         .is_mutable = true,
39718
         .is_synthetic = false,
39719
         .parse = ovsrec_port_parse_cvlans,
39720
         .unparse = ovsrec_port_unparse_cvlans,
39721
    },
39722
39723
    [OVSREC_PORT_COL_EXTERNAL_IDS] = {
39724
         .name = "external_ids",
39725
         .type = {
39726
            .key = {
39727
               .type = OVSDB_TYPE_STRING,
39728
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39729
            },
39730
            .value = {
39731
                .type = OVSDB_TYPE_STRING,
39732
                .string = { .minLen = 0, .maxLen = UINT_MAX },
39733
            },
39734
            .n_min = 0,
39735
            .n_max = UINT_MAX,
39736
         },
39737
         .is_mutable = true,
39738
         .is_synthetic = false,
39739
         .parse = ovsrec_port_parse_external_ids,
39740
         .unparse = ovsrec_port_unparse_external_ids,
39741
    },
39742
39743
    [OVSREC_PORT_COL_FAKE_BRIDGE] = {
39744
         .name = "fake_bridge",
39745
         .type = {
39746
            .key = {
39747
               .type = OVSDB_TYPE_BOOLEAN,
39748
            },
39749
            .value = OVSDB_BASE_VOID_INIT,
39750
            .n_min = 1,
39751
            .n_max = 1,
39752
         },
39753
         .is_mutable = true,
39754
         .is_synthetic = false,
39755
         .parse = ovsrec_port_parse_fake_bridge,
39756
         .unparse = ovsrec_port_unparse_fake_bridge,
39757
    },
39758
39759
    [OVSREC_PORT_COL_INTERFACES] = {
39760
         .name = "interfaces",
39761
         .type = {
39762
            .key = {
39763
               .type = OVSDB_TYPE_UUID,
39764
               .uuid = { .refTableName = "Interface", .refType = OVSDB_REF_STRONG },
39765
            },
39766
            .value = OVSDB_BASE_VOID_INIT,
39767
            .n_min = 1,
39768
            .n_max = UINT_MAX,
39769
         },
39770
         .is_mutable = true,
39771
         .is_synthetic = false,
39772
         .parse = ovsrec_port_parse_interfaces,
39773
         .unparse = ovsrec_port_unparse_interfaces,
39774
    },
39775
39776
    [OVSREC_PORT_COL_LACP] = {
39777
         .name = "lacp",
39778
         .type = {
39779
            .key = {
39780
               .type = OVSDB_TYPE_STRING,
39781
               .enum_ = &Port_col_lacp_key_enum,
39782
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39783
            },
39784
            .value = OVSDB_BASE_VOID_INIT,
39785
            .n_min = 0,
39786
            .n_max = 1,
39787
         },
39788
         .is_mutable = true,
39789
         .is_synthetic = false,
39790
         .parse = ovsrec_port_parse_lacp,
39791
         .unparse = ovsrec_port_unparse_lacp,
39792
    },
39793
39794
    [OVSREC_PORT_COL_MAC] = {
39795
         .name = "mac",
39796
         .type = {
39797
            .key = {
39798
               .type = OVSDB_TYPE_STRING,
39799
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39800
            },
39801
            .value = OVSDB_BASE_VOID_INIT,
39802
            .n_min = 0,
39803
            .n_max = 1,
39804
         },
39805
         .is_mutable = true,
39806
         .is_synthetic = false,
39807
         .parse = ovsrec_port_parse_mac,
39808
         .unparse = ovsrec_port_unparse_mac,
39809
    },
39810
39811
    [OVSREC_PORT_COL_NAME] = {
39812
         .name = "name",
39813
         .type = {
39814
            .key = {
39815
               .type = OVSDB_TYPE_STRING,
39816
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39817
            },
39818
            .value = OVSDB_BASE_VOID_INIT,
39819
            .n_min = 1,
39820
            .n_max = 1,
39821
         },
39822
         .is_mutable = false,
39823
         .is_synthetic = false,
39824
         .parse = ovsrec_port_parse_name,
39825
         .unparse = ovsrec_port_unparse_name,
39826
    },
39827
39828
    [OVSREC_PORT_COL_OTHER_CONFIG] = {
39829
         .name = "other_config",
39830
         .type = {
39831
            .key = {
39832
               .type = OVSDB_TYPE_STRING,
39833
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39834
            },
39835
            .value = {
39836
                .type = OVSDB_TYPE_STRING,
39837
                .string = { .minLen = 0, .maxLen = UINT_MAX },
39838
            },
39839
            .n_min = 0,
39840
            .n_max = UINT_MAX,
39841
         },
39842
         .is_mutable = true,
39843
         .is_synthetic = false,
39844
         .parse = ovsrec_port_parse_other_config,
39845
         .unparse = ovsrec_port_unparse_other_config,
39846
    },
39847
39848
    [OVSREC_PORT_COL_PROTECTED_] = {
39849
         .name = "protected",
39850
         .type = {
39851
            .key = {
39852
               .type = OVSDB_TYPE_BOOLEAN,
39853
            },
39854
            .value = OVSDB_BASE_VOID_INIT,
39855
            .n_min = 1,
39856
            .n_max = 1,
39857
         },
39858
         .is_mutable = true,
39859
         .is_synthetic = false,
39860
         .parse = ovsrec_port_parse_protected_,
39861
         .unparse = ovsrec_port_unparse_protected_,
39862
    },
39863
39864
    [OVSREC_PORT_COL_QOS] = {
39865
         .name = "qos",
39866
         .type = {
39867
            .key = {
39868
               .type = OVSDB_TYPE_UUID,
39869
               .uuid = { .refTableName = "QoS", .refType = OVSDB_REF_STRONG },
39870
            },
39871
            .value = OVSDB_BASE_VOID_INIT,
39872
            .n_min = 0,
39873
            .n_max = 1,
39874
         },
39875
         .is_mutable = true,
39876
         .is_synthetic = false,
39877
         .parse = ovsrec_port_parse_qos,
39878
         .unparse = ovsrec_port_unparse_qos,
39879
    },
39880
39881
    [OVSREC_PORT_COL_RSTP_STATISTICS] = {
39882
         .name = "rstp_statistics",
39883
         .type = {
39884
            .key = {
39885
               .type = OVSDB_TYPE_STRING,
39886
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39887
            },
39888
            .value = {
39889
                .type = OVSDB_TYPE_INTEGER,
39890
                .integer = { .min = INT64_MIN, .max = INT64_MAX },
39891
            },
39892
            .n_min = 0,
39893
            .n_max = UINT_MAX,
39894
         },
39895
         .is_mutable = true,
39896
         .is_synthetic = false,
39897
         .parse = ovsrec_port_parse_rstp_statistics,
39898
         .unparse = ovsrec_port_unparse_rstp_statistics,
39899
    },
39900
39901
    [OVSREC_PORT_COL_RSTP_STATUS] = {
39902
         .name = "rstp_status",
39903
         .type = {
39904
            .key = {
39905
               .type = OVSDB_TYPE_STRING,
39906
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39907
            },
39908
            .value = {
39909
                .type = OVSDB_TYPE_STRING,
39910
                .string = { .minLen = 0, .maxLen = UINT_MAX },
39911
            },
39912
            .n_min = 0,
39913
            .n_max = UINT_MAX,
39914
         },
39915
         .is_mutable = true,
39916
         .is_synthetic = false,
39917
         .parse = ovsrec_port_parse_rstp_status,
39918
         .unparse = ovsrec_port_unparse_rstp_status,
39919
    },
39920
39921
    [OVSREC_PORT_COL_STATISTICS] = {
39922
         .name = "statistics",
39923
         .type = {
39924
            .key = {
39925
               .type = OVSDB_TYPE_STRING,
39926
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39927
            },
39928
            .value = {
39929
                .type = OVSDB_TYPE_INTEGER,
39930
                .integer = { .min = INT64_MIN, .max = INT64_MAX },
39931
            },
39932
            .n_min = 0,
39933
            .n_max = UINT_MAX,
39934
         },
39935
         .is_mutable = true,
39936
         .is_synthetic = false,
39937
         .parse = ovsrec_port_parse_statistics,
39938
         .unparse = ovsrec_port_unparse_statistics,
39939
    },
39940
39941
    [OVSREC_PORT_COL_STATUS] = {
39942
         .name = "status",
39943
         .type = {
39944
            .key = {
39945
               .type = OVSDB_TYPE_STRING,
39946
               .string = { .minLen = 0, .maxLen = UINT_MAX },
39947
            },
39948
            .value = {
39949
                .type = OVSDB_TYPE_STRING,
39950
                .string = { .minLen = 0, .maxLen = UINT_MAX },
39951
            },
39952
            .n_min = 0,
39953
            .n_max = UINT_MAX,
39954
         },
39955
         .is_mutable = true,
39956
         .is_synthetic = false,
39957
         .parse = ovsrec_port_parse_status,
39958
         .unparse = ovsrec_port_unparse_status,
39959
    },
39960
39961
    [OVSREC_PORT_COL_TAG] = {
39962
         .name = "tag",
39963
         .type = {
39964
            .key = {
39965
               .type = OVSDB_TYPE_INTEGER,
39966
               .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
39967
            },
39968
            .value = OVSDB_BASE_VOID_INIT,
39969
            .n_min = 0,
39970
            .n_max = 1,
39971
         },
39972
         .is_mutable = true,
39973
         .is_synthetic = false,
39974
         .parse = ovsrec_port_parse_tag,
39975
         .unparse = ovsrec_port_unparse_tag,
39976
    },
39977
39978
    [OVSREC_PORT_COL_TRUNKS] = {
39979
         .name = "trunks",
39980
         .type = {
39981
            .key = {
39982
               .type = OVSDB_TYPE_INTEGER,
39983
               .integer = { .min = INT64_C(0), .max = INT64_C(4095) },
39984
            },
39985
            .value = OVSDB_BASE_VOID_INIT,
39986
            .n_min = 0,
39987
            .n_max = 4096,
39988
         },
39989
         .is_mutable = true,
39990
         .is_synthetic = false,
39991
         .parse = ovsrec_port_parse_trunks,
39992
         .unparse = ovsrec_port_unparse_trunks,
39993
    },
39994
39995
    [OVSREC_PORT_COL_VLAN_MODE] = {
39996
         .name = "vlan_mode",
39997
         .type = {
39998
            .key = {
39999
               .type = OVSDB_TYPE_STRING,
40000
               .enum_ = &Port_col_vlan_mode_key_enum,
40001
               .string = { .minLen = 0, .maxLen = UINT_MAX },
40002
            },
40003
            .value = OVSDB_BASE_VOID_INIT,
40004
            .n_min = 0,
40005
            .n_max = 1,
40006
         },
40007
         .is_mutable = true,
40008
         .is_synthetic = false,
40009
         .parse = ovsrec_port_parse_vlan_mode,
40010
         .unparse = ovsrec_port_unparse_vlan_mode,
40011
    },
40012
40013
};
40014

40015
/* QoS table. */
40016
40017
bool
40018
ovsrec_server_has_qos_table_col_external_ids(const struct ovsdb_idl *idl)
40019
0
{
40020
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_qos_col_external_ids);
40021
0
}
40022
40023
40024
bool
40025
ovsrec_server_has_qos_table_col_other_config(const struct ovsdb_idl *idl)
40026
0
{
40027
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_qos_col_other_config);
40028
0
}
40029
40030
40031
bool
40032
ovsrec_server_has_qos_table_col_queues(const struct ovsdb_idl *idl)
40033
0
{
40034
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_qos_col_queues);
40035
0
}
40036
40037
40038
bool
40039
ovsrec_server_has_qos_table_col_type(const struct ovsdb_idl *idl)
40040
0
{
40041
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_qos_col_type);
40042
0
}
40043
40044
40045
bool
40046
ovsrec_server_has_qos_table(const struct ovsdb_idl *idl)
40047
0
{
40048
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_QOS]);
40049
0
}
40050
40051
40052
const struct ovsrec_qos_table *
40053
ovsrec_qos_table_get(const struct ovsdb_idl *idl)
40054
0
{
40055
0
    return (const struct ovsrec_qos_table *) idl;
40056
0
}
40057
40058
const struct ovsrec_qos *
40059
ovsrec_qos_table_first(const struct ovsrec_qos_table *table)
40060
0
{
40061
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
40062
0
    return ovsrec_qos_first(idl);
40063
0
}
40064
40065
40066
const struct ovsrec_qos *
40067
ovsrec_qos_table_track_get_first(const struct ovsrec_qos_table *table)
40068
0
{
40069
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
40070
0
    return ovsrec_qos_track_get_first(idl);
40071
0
}
40072
40073
40074
static void
40075
ovsrec_qos_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
40076
0
{
40077
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
40078
0
    smap_init(&row->external_ids);
40079
0
    for (size_t i = 0; i < datum->n; i++) {
40080
0
        smap_add(&row->external_ids,
40081
0
                 json_string(datum->keys[i].s),
40082
0
                 json_string(datum->values[i].s));
40083
0
    }
40084
0
}
40085
40086
static void
40087
ovsrec_qos_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
40088
0
{
40089
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
40090
0
    smap_init(&row->other_config);
40091
0
    for (size_t i = 0; i < datum->n; i++) {
40092
0
        smap_add(&row->other_config,
40093
0
                 json_string(datum->keys[i].s),
40094
0
                 json_string(datum->values[i].s));
40095
0
    }
40096
0
}
40097
40098
static void
40099
ovsrec_qos_parse_queues(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
40100
0
{
40101
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
40102
0
    row->key_queues = NULL;
40103
0
    row->value_queues = NULL;
40104
0
    row->n_queues = 0;
40105
0
    for (size_t i = 0; i < datum->n; i++) {
40106
0
        struct ovsrec_queue *valueRow = ovsrec_queue_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_queue, &datum->values[i].uuid));
40107
0
        if (!valueRow) {
40108
0
            continue;
40109
0
        }
40110
0
        if (!row->n_queues) {
40111
0
            row->key_queues = xmalloc(datum->n * sizeof *row->key_queues);
40112
0
            row->value_queues = xmalloc(datum->n * sizeof *row->value_queues);
40113
0
        }
40114
0
        row->key_queues[row->n_queues] = datum->keys[i].integer;
40115
0
        row->value_queues[row->n_queues] = valueRow;
40116
0
        row->n_queues++;
40117
0
    }
40118
0
}
40119
40120
static void
40121
ovsrec_qos_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
40122
0
{
40123
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
40124
40125
0
    if (datum->n >= 1) {
40126
0
        row->type = datum->keys[0].s->string;
40127
0
    } else {
40128
0
        row->type = "";
40129
0
    }
40130
0
}
40131
40132
static void
40133
ovsrec_qos_unparse_external_ids(struct ovsdb_idl_row *row_)
40134
0
{
40135
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
40136
0
    smap_destroy(&row->external_ids);
40137
0
}
40138
40139
static void
40140
ovsrec_qos_unparse_other_config(struct ovsdb_idl_row *row_)
40141
0
{
40142
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
40143
0
    smap_destroy(&row->other_config);
40144
0
}
40145
40146
static void
40147
ovsrec_qos_unparse_queues(struct ovsdb_idl_row *row_)
40148
0
{
40149
0
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
40150
0
    free(row->key_queues);
40151
0
    free(row->value_queues);
40152
0
}
40153
40154
static void
40155
ovsrec_qos_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
40156
0
{
40157
    /* Nothing to do. */
40158
0
}
40159
40160
static void
40161
ovsrec_qos_init__(struct ovsdb_idl_row *row)
40162
0
{
40163
0
    ovsrec_qos_init(ovsrec_qos_cast(row));
40164
0
}
40165
40166
/* Clears the contents of 'row' in table "QoS". */
40167
void
40168
ovsrec_qos_init(struct ovsrec_qos *row)
40169
0
{
40170
0
    memset(row, 0, sizeof *row); 
40171
0
    smap_init(&row->external_ids);
40172
0
    smap_init(&row->other_config);
40173
0
    row->type = "";
40174
0
}
40175
40176
/* Searches table "QoS" in 'idl' for a row with UUID 'uuid'.  Returns
40177
 * a pointer to the row if there is one, otherwise a null pointer.  */
40178
const struct ovsrec_qos *
40179
ovsrec_qos_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
40180
0
{
40181
0
    return ovsrec_qos_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_qos, uuid));
40182
0
}
40183
40184
/* Searches table "QoS" for a row with UUID 'uuid'.  Returns
40185
 * a pointer to the row if there is one, otherwise a null pointer.  */
40186
const struct ovsrec_qos *
40187
ovsrec_qos_table_get_for_uuid(const struct ovsrec_qos_table *table, const struct uuid *uuid)
40188
0
{
40189
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
40190
0
    return ovsrec_qos_get_for_uuid(idl, uuid);
40191
0
}
40192
40193
/* Returns a row in table "QoS" in 'idl', or a null pointer if that
40194
 * table is empty.
40195
 *
40196
 * Database tables are internally maintained as hash tables, so adding or
40197
 * removing rows while traversing the same table can cause some rows to be
40198
 * visited twice or not at apply. */
40199
const struct ovsrec_qos *
40200
ovsrec_qos_first(const struct ovsdb_idl *idl)
40201
0
{
40202
0
    return ovsrec_qos_cast(ovsdb_idl_first_row(idl, &ovsrec_table_qos));
40203
0
}
40204
40205
/* Returns a row following 'row' within its table, or a null pointer if 'row'
40206
 * is the last row in its table. */
40207
const struct ovsrec_qos *
40208
ovsrec_qos_next(const struct ovsrec_qos *row)
40209
0
{
40210
0
    return ovsrec_qos_cast(ovsdb_idl_next_row(&row->header_));
40211
0
}
40212
40213
unsigned int ovsrec_qos_get_seqno(const struct ovsdb_idl *idl)
40214
0
{
40215
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_qos);
40216
0
}
40217
40218
unsigned int ovsrec_qos_row_get_seqno(const struct ovsrec_qos *row, enum ovsdb_idl_change change)
40219
0
{
40220
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
40221
0
}
40222
40223
const struct ovsrec_qos *
40224
ovsrec_qos_track_get_first(const struct ovsdb_idl *idl)
40225
0
{
40226
0
    return ovsrec_qos_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_qos));
40227
0
}
40228
40229
const struct ovsrec_qos
40230
*ovsrec_qos_track_get_next(const struct ovsrec_qos *row)
40231
0
{
40232
0
    return ovsrec_qos_cast(ovsdb_idl_track_get_next(&row->header_));
40233
0
}
40234
40235
40236
/* Deletes 'row' from table "QoS".  'row' may be freed, so it must not be
40237
 * accessed afterward.
40238
 *
40239
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
40240
void
40241
ovsrec_qos_delete(const struct ovsrec_qos *row)
40242
0
{
40243
0
    ovsdb_idl_txn_delete(&row->header_);
40244
0
}
40245
40246
/* Inserts and returns a new row in the table "QoS" in the database
40247
 * with open transaction 'txn'.
40248
 *
40249
 * The new row is assigned a randomly generated provisional UUID.
40250
 * ovsdb-server will assign a different UUID when 'txn' is committed,
40251
 * but the IDL will replace any uses of the provisional UUID in the
40252
 * data to be to be committed by the UUID assigned by ovsdb-server. */
40253
struct ovsrec_qos *
40254
ovsrec_qos_insert(struct ovsdb_idl_txn *txn)
40255
0
{
40256
0
    return ovsrec_qos_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_qos, NULL));
40257
0
}
40258
40259
/* Inserts and returns a new row in the table "QoS" in the database
40260
 * with open transaction 'txn'.
40261
 *
40262
 * The new row is assigned the UUID specified in the 'uuid' parameter
40263
 * (which cannot be null).  ovsdb-server will try to assign the same
40264
 * UUID when 'txn' is committed. */
40265
struct ovsrec_qos *
40266
ovsrec_qos_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
40267
0
{
40268
0
    return ovsrec_qos_cast(ovsdb_idl_txn_insert_persist_uuid(
40269
0
        txn, &ovsrec_table_qos, uuid));
40270
0
}
40271
40272
bool
40273
ovsrec_qos_is_updated(const struct ovsrec_qos *row, enum ovsrec_qos_column_id column)
40274
0
{
40275
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_qos_columns[column]);
40276
0
}
40277
40278
/* Causes the original contents of column "external_ids" in 'row' to be
40279
 * verified as a prerequisite to completing the transaction.  That is, if
40280
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
40281
 * time that the IDL originally read its contents and the time that the
40282
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
40283
 *
40284
 * The intention is that, to ensure that no transaction commits based on dirty
40285
 * reads, an application should call this function any time "external_ids" is
40286
 * read as part of a read-modify-write operation.
40287
 *
40288
 * In some cases this function reduces to a no-op, because the current value
40289
 * of "external_ids" is already known:
40290
 *
40291
 *   - If 'row' is a row created by the current transaction (returned by
40292
 *     ovsrec_qos_insert()).
40293
 *
40294
 *   - If "external_ids" has already been modified (with
40295
 *     ovsrec_qos_set_external_ids()) within the current transaction.
40296
 *
40297
 * Because of the latter property, always call this function *before*
40298
 * ovsrec_qos_set_external_ids() for a given read-modify-write.
40299
 *
40300
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
40301
void
40302
ovsrec_qos_verify_external_ids(const struct ovsrec_qos *row)
40303
0
{
40304
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_col_external_ids);
40305
0
}
40306
40307
/* Causes the original contents of column "other_config" in 'row' to be
40308
 * verified as a prerequisite to completing the transaction.  That is, if
40309
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
40310
 * time that the IDL originally read its contents and the time that the
40311
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
40312
 *
40313
 * The intention is that, to ensure that no transaction commits based on dirty
40314
 * reads, an application should call this function any time "other_config" is
40315
 * read as part of a read-modify-write operation.
40316
 *
40317
 * In some cases this function reduces to a no-op, because the current value
40318
 * of "other_config" is already known:
40319
 *
40320
 *   - If 'row' is a row created by the current transaction (returned by
40321
 *     ovsrec_qos_insert()).
40322
 *
40323
 *   - If "other_config" has already been modified (with
40324
 *     ovsrec_qos_set_other_config()) within the current transaction.
40325
 *
40326
 * Because of the latter property, always call this function *before*
40327
 * ovsrec_qos_set_other_config() for a given read-modify-write.
40328
 *
40329
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
40330
void
40331
ovsrec_qos_verify_other_config(const struct ovsrec_qos *row)
40332
0
{
40333
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_col_other_config);
40334
0
}
40335
40336
/* Causes the original contents of column "queues" in 'row' to be
40337
 * verified as a prerequisite to completing the transaction.  That is, if
40338
 * "queues" in 'row' changed (or if 'row' was deleted) between the
40339
 * time that the IDL originally read its contents and the time that the
40340
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
40341
 *
40342
 * The intention is that, to ensure that no transaction commits based on dirty
40343
 * reads, an application should call this function any time "queues" is
40344
 * read as part of a read-modify-write operation.
40345
 *
40346
 * In some cases this function reduces to a no-op, because the current value
40347
 * of "queues" is already known:
40348
 *
40349
 *   - If 'row' is a row created by the current transaction (returned by
40350
 *     ovsrec_qos_insert()).
40351
 *
40352
 *   - If "queues" has already been modified (with
40353
 *     ovsrec_qos_set_queues()) within the current transaction.
40354
 *
40355
 * Because of the latter property, always call this function *before*
40356
 * ovsrec_qos_set_queues() for a given read-modify-write.
40357
 *
40358
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
40359
void
40360
ovsrec_qos_verify_queues(const struct ovsrec_qos *row)
40361
0
{
40362
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_col_queues);
40363
0
}
40364
40365
/* Causes the original contents of column "type" in 'row' to be
40366
 * verified as a prerequisite to completing the transaction.  That is, if
40367
 * "type" in 'row' changed (or if 'row' was deleted) between the
40368
 * time that the IDL originally read its contents and the time that the
40369
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
40370
 *
40371
 * The intention is that, to ensure that no transaction commits based on dirty
40372
 * reads, an application should call this function any time "type" is
40373
 * read as part of a read-modify-write operation.
40374
 *
40375
 * In some cases this function reduces to a no-op, because the current value
40376
 * of "type" is already known:
40377
 *
40378
 *   - If 'row' is a row created by the current transaction (returned by
40379
 *     ovsrec_qos_insert()).
40380
 *
40381
 *   - If "type" has already been modified (with
40382
 *     ovsrec_qos_set_type()) within the current transaction.
40383
 *
40384
 * Because of the latter property, always call this function *before*
40385
 * ovsrec_qos_set_type() for a given read-modify-write.
40386
 *
40387
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
40388
void
40389
ovsrec_qos_verify_type(const struct ovsrec_qos *row)
40390
0
{
40391
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_col_type);
40392
0
}
40393
40394
/* Returns the "external_ids" column's value from the "QoS" table in 'row'
40395
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
40396
 * ovsdb_datum_find_key() is an easier and more efficient way to search
40397
 * for a given key than implementing the same operation on the "cooked"
40398
 * form in 'row'.
40399
 *
40400
 * 'key_type' must be OVSDB_TYPE_STRING.
40401
 * 'value_type' must be OVSDB_TYPE_STRING.
40402
 * (This helps to avoid silent bugs if someone changes external_ids's
40403
 * type without updating the caller.)
40404
 *
40405
 * The caller must not modify or free the returned value.
40406
 *
40407
 * Various kinds of changes can invalidate the returned value: modifying
40408
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
40409
 * If the returned value is needed for a long time, it is best to make a copy
40410
 * of it with ovsdb_datum_clone().
40411
 *
40412
 * This function is rarely useful, since it is easier to access the value
40413
 * directly through the "external_ids" member in ovsrec_qos. */
40414
const struct ovsdb_datum *
40415
ovsrec_qos_get_external_ids(const struct ovsrec_qos *row,
40416
  enum ovsdb_atomic_type key_type OVS_UNUSED,
40417
  enum ovsdb_atomic_type value_type OVS_UNUSED)
40418
0
{
40419
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
40420
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
40421
0
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_external_ids);
40422
0
}
40423
40424
/* Returns the "other_config" column's value from the "QoS" table in 'row'
40425
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
40426
 * ovsdb_datum_find_key() is an easier and more efficient way to search
40427
 * for a given key than implementing the same operation on the "cooked"
40428
 * form in 'row'.
40429
 *
40430
 * 'key_type' must be OVSDB_TYPE_STRING.
40431
 * 'value_type' must be OVSDB_TYPE_STRING.
40432
 * (This helps to avoid silent bugs if someone changes other_config's
40433
 * type without updating the caller.)
40434
 *
40435
 * The caller must not modify or free the returned value.
40436
 *
40437
 * Various kinds of changes can invalidate the returned value: modifying
40438
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
40439
 * If the returned value is needed for a long time, it is best to make a copy
40440
 * of it with ovsdb_datum_clone().
40441
 *
40442
 * This function is rarely useful, since it is easier to access the value
40443
 * directly through the "other_config" member in ovsrec_qos. */
40444
const struct ovsdb_datum *
40445
ovsrec_qos_get_other_config(const struct ovsrec_qos *row,
40446
  enum ovsdb_atomic_type key_type OVS_UNUSED,
40447
  enum ovsdb_atomic_type value_type OVS_UNUSED)
40448
0
{
40449
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
40450
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
40451
0
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_other_config);
40452
0
}
40453
40454
/* Returns the "queues" column's value from the "QoS" table in 'row'
40455
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
40456
 * ovsdb_datum_find_key() is an easier and more efficient way to search
40457
 * for a given key than implementing the same operation on the "cooked"
40458
 * form in 'row'.
40459
 *
40460
 * 'key_type' must be OVSDB_TYPE_INTEGER.
40461
 * 'value_type' must be OVSDB_TYPE_UUID.
40462
 * (This helps to avoid silent bugs if someone changes queues's
40463
 * type without updating the caller.)
40464
 *
40465
 * The caller must not modify or free the returned value.
40466
 *
40467
 * Various kinds of changes can invalidate the returned value: modifying
40468
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
40469
 * If the returned value is needed for a long time, it is best to make a copy
40470
 * of it with ovsdb_datum_clone().
40471
 *
40472
 * This function is rarely useful, since it is easier to access the value
40473
 * directly through the "queues" member in ovsrec_qos. */
40474
const struct ovsdb_datum *
40475
ovsrec_qos_get_queues(const struct ovsrec_qos *row,
40476
  enum ovsdb_atomic_type key_type OVS_UNUSED,
40477
  enum ovsdb_atomic_type value_type OVS_UNUSED)
40478
0
{
40479
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
40480
0
    ovs_assert(value_type == OVSDB_TYPE_UUID);
40481
0
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_queues);
40482
0
}
40483
40484
/* Returns the "type" column's value from the "QoS" table in 'row'
40485
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
40486
 * ovsdb_datum_find_key() is an easier and more efficient way to search
40487
 * for a given key than implementing the same operation on the "cooked"
40488
 * form in 'row'.
40489
 *
40490
 * 'key_type' must be OVSDB_TYPE_STRING.
40491
 * (This helps to avoid silent bugs if someone changes type's
40492
 * type without updating the caller.)
40493
 *
40494
 * The caller must not modify or free the returned value.
40495
 *
40496
 * Various kinds of changes can invalidate the returned value: modifying
40497
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
40498
 * If the returned value is needed for a long time, it is best to make a copy
40499
 * of it with ovsdb_datum_clone().
40500
 *
40501
 * This function is rarely useful, since it is easier to access the value
40502
 * directly through the "type" member in ovsrec_qos. */
40503
const struct ovsdb_datum *
40504
ovsrec_qos_get_type(const struct ovsrec_qos *row,
40505
  enum ovsdb_atomic_type key_type OVS_UNUSED)
40506
0
{
40507
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
40508
0
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_type);
40509
0
}
40510
40511
/* Sets the "external_ids" column's value from the "QoS" table in 'row'
40512
 * to 'external_ids'.
40513
 *
40514
 * The caller retains ownership of 'external_ids' and everything in it. */
40515
void
40516
ovsrec_qos_set_external_ids(const struct ovsrec_qos *row, const struct smap *external_ids)
40517
0
{
40518
0
    struct ovsdb_datum datum;
40519
40520
0
    if (external_ids) {
40521
0
        ovsdb_datum_from_smap(&datum, external_ids);
40522
0
    } else {
40523
0
        ovsdb_datum_init_empty(&datum);
40524
0
    }
40525
0
    ovsdb_idl_txn_write(&row->header_,
40526
0
                        &ovsrec_qos_col_external_ids,
40527
0
                        &datum);
40528
0
}
40529
40530
40531
/* Sets the "other_config" column's value from the "QoS" table in 'row'
40532
 * to 'other_config'.
40533
 *
40534
 * The caller retains ownership of 'other_config' and everything in it. */
40535
void
40536
ovsrec_qos_set_other_config(const struct ovsrec_qos *row, const struct smap *other_config)
40537
0
{
40538
0
    struct ovsdb_datum datum;
40539
40540
0
    if (other_config) {
40541
0
        ovsdb_datum_from_smap(&datum, other_config);
40542
0
    } else {
40543
0
        ovsdb_datum_init_empty(&datum);
40544
0
    }
40545
0
    ovsdb_idl_txn_write(&row->header_,
40546
0
                        &ovsrec_qos_col_other_config,
40547
0
                        &datum);
40548
0
}
40549
40550
40551
/* Sets the "queues" column from the "QoS" table in 'row' to
40552
 * the map with keys 'key_queues' and values 'value_queues'
40553
 * with 'n_queues' entries.
40554
 *
40555
 * Argument constraints: key in range 0 to 4,294,967,295
40556
 *
40557
 * The caller retains ownership of the arguments. */
40558
void
40559
ovsrec_qos_set_queues(const struct ovsrec_qos *row, const int64_t *key_queues, struct ovsrec_queue **value_queues, size_t n_queues)
40560
0
{
40561
0
    struct ovsdb_datum datum;
40562
40563
0
    datum.refcnt = NULL;
40564
40565
0
    datum.n = n_queues;
40566
0
    datum.keys = n_queues ? xmalloc(n_queues * sizeof *datum.keys) : NULL;
40567
0
    datum.values = xmalloc(n_queues * sizeof *datum.values);
40568
0
    for (size_t i = 0; i < n_queues; i++) {
40569
0
        datum.keys[i].integer = key_queues[i];
40570
0
        datum.values[i].uuid = value_queues[i]->header_.uuid;
40571
0
    }
40572
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_qos_col_queues, &datum);
40573
0
}
40574
40575
/* Sets the "type" column from the "QoS" table in 'row' to
40576
 * 'type'.
40577
 *
40578
 * The caller retains ownership of the arguments. */
40579
void
40580
ovsrec_qos_set_type(const struct ovsrec_qos *row, const char *type)
40581
0
{
40582
0
    struct ovsdb_datum datum;
40583
40584
0
    datum.refcnt = NULL;
40585
40586
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
40587
40588
0
    datum.n = 1;
40589
0
    datum.keys = key;
40590
0
    key->s = ovsdb_atom_string_create(type);
40591
0
    datum.values = NULL;
40592
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_qos_col_type, &datum);
40593
0
}
40594
40595
/* Sets an element of the "external_ids" map column from the "QoS" table in 'row'
40596
 * to 'new_value' given the key value 'new_key'.
40597
 *
40598
 */
40599
void
40600
ovsrec_qos_update_external_ids_setkey(const struct ovsrec_qos *row, const char *new_key, const char *new_value)
40601
0
{
40602
0
    struct ovsdb_datum *datum;
40603
40604
0
    datum = xmalloc(sizeof *datum);
40605
0
    datum->n = 1;
40606
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40607
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
40608
0
    datum->refcnt = NULL;
40609
40610
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
40611
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
40612
40613
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
40614
0
                                    &ovsrec_qos_col_external_ids,
40615
0
                                    datum);
40616
0
}
40617
40618
/* Deletes an element of the "external_ids" map column from the "QoS" table in 'row'
40619
 * given the key value 'delete_key'.
40620
 *
40621
 */
40622
void
40623
ovsrec_qos_update_external_ids_delkey(const struct ovsrec_qos *row, const char *delete_key)
40624
0
{
40625
0
    struct ovsdb_datum *datum;
40626
40627
0
    datum = xmalloc(sizeof *datum);
40628
0
    datum->n = 1;
40629
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40630
0
    datum->values = NULL;
40631
0
    datum->refcnt = NULL;
40632
40633
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
40634
40635
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
40636
0
                                    &ovsrec_qos_col_external_ids,
40637
0
                                    datum);
40638
0
}
40639
40640
/* Sets an element of the "other_config" map column from the "QoS" table in 'row'
40641
 * to 'new_value' given the key value 'new_key'.
40642
 *
40643
 */
40644
void
40645
ovsrec_qos_update_other_config_setkey(const struct ovsrec_qos *row, const char *new_key, const char *new_value)
40646
0
{
40647
0
    struct ovsdb_datum *datum;
40648
40649
0
    datum = xmalloc(sizeof *datum);
40650
0
    datum->n = 1;
40651
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40652
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
40653
0
    datum->refcnt = NULL;
40654
40655
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
40656
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
40657
40658
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
40659
0
                                    &ovsrec_qos_col_other_config,
40660
0
                                    datum);
40661
0
}
40662
40663
/* Deletes an element of the "other_config" map column from the "QoS" table in 'row'
40664
 * given the key value 'delete_key'.
40665
 *
40666
 */
40667
void
40668
ovsrec_qos_update_other_config_delkey(const struct ovsrec_qos *row, const char *delete_key)
40669
0
{
40670
0
    struct ovsdb_datum *datum;
40671
40672
0
    datum = xmalloc(sizeof *datum);
40673
0
    datum->n = 1;
40674
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40675
0
    datum->values = NULL;
40676
0
    datum->refcnt = NULL;
40677
40678
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
40679
40680
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
40681
0
                                    &ovsrec_qos_col_other_config,
40682
0
                                    datum);
40683
0
}
40684
40685
/* Sets an element of the "queues" map column from the "QoS" table in 'row'
40686
 * to 'new_value' given the key value 'new_key'.
40687
 *
40688
 */
40689
void
40690
ovsrec_qos_update_queues_setkey(const struct ovsrec_qos *row, int64_t new_key, const struct ovsrec_queue *new_value)
40691
0
{
40692
0
    struct ovsdb_datum *datum;
40693
40694
0
    datum = xmalloc(sizeof *datum);
40695
0
    datum->n = 1;
40696
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40697
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
40698
0
    datum->refcnt = NULL;
40699
40700
0
    datum->keys[0].integer = new_key;
40701
0
    datum->values[0].uuid = new_value->header_.uuid;
40702
40703
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
40704
0
                                    &ovsrec_qos_col_queues,
40705
0
                                    datum);
40706
0
}
40707
40708
/* Deletes an element of the "queues" map column from the "QoS" table in 'row'
40709
 * given the key value 'delete_key'.
40710
 *
40711
 */
40712
void
40713
ovsrec_qos_update_queues_delkey(const struct ovsrec_qos *row, int64_t delete_key)
40714
0
{
40715
0
    struct ovsdb_datum *datum;
40716
40717
0
    datum = xmalloc(sizeof *datum);
40718
0
    datum->n = 1;
40719
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40720
0
    datum->values = NULL;
40721
0
    datum->refcnt = NULL;
40722
40723
0
    datum->keys[0].integer = delete_key;
40724
40725
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
40726
0
                                    &ovsrec_qos_col_queues,
40727
0
                                    datum);
40728
0
}
40729
40730
/* Sets the "external_ids" column's value from the "QoS" table in 'row'
40731
 * to 'external_ids'.
40732
 *
40733
 * The caller retains ownership of 'external_ids' and everything in it. */
40734
void
40735
ovsrec_qos_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
40736
0
{
40737
0
    struct ovsdb_datum datum;
40738
40739
0
    if (external_ids) {
40740
0
        ovsdb_datum_from_smap(&datum, external_ids);
40741
0
    } else {
40742
0
        ovsdb_datum_init_empty(&datum);
40743
0
    }
40744
40745
0
    ovsdb_idl_condition_add_clause(cond,
40746
0
                                   function,
40747
0
                                   &ovsrec_qos_col_external_ids,
40748
0
                                   &datum);
40749
40750
0
    ovsdb_datum_destroy(&datum, &ovsrec_qos_col_external_ids.type);
40751
0
}
40752
40753
40754
/* Sets the "other_config" column's value from the "QoS" table in 'row'
40755
 * to 'other_config'.
40756
 *
40757
 * The caller retains ownership of 'other_config' and everything in it. */
40758
void
40759
ovsrec_qos_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
40760
0
{
40761
0
    struct ovsdb_datum datum;
40762
40763
0
    if (other_config) {
40764
0
        ovsdb_datum_from_smap(&datum, other_config);
40765
0
    } else {
40766
0
        ovsdb_datum_init_empty(&datum);
40767
0
    }
40768
40769
0
    ovsdb_idl_condition_add_clause(cond,
40770
0
                                   function,
40771
0
                                   &ovsrec_qos_col_other_config,
40772
0
                                   &datum);
40773
40774
0
    ovsdb_datum_destroy(&datum, &ovsrec_qos_col_other_config.type);
40775
0
}
40776
40777
40778
/* Sets the "queues" column from the "QoS" table in 'row' to
40779
 * the map with keys 'key_queues' and values 'value_queues'
40780
 * with 'n_queues' entries.
40781
 *
40782
 * Argument constraints: key in range 0 to 4,294,967,295
40783
 *
40784
 * The caller retains ownership of the arguments. */
40785
void
40786
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)
40787
0
{
40788
0
    struct ovsdb_datum datum;
40789
40790
0
    datum.refcnt = NULL;
40791
0
    datum.n = n_queues;
40792
0
    datum.keys = n_queues ? xmalloc(n_queues * sizeof *datum.keys) : NULL;
40793
0
    datum.values = xmalloc(n_queues * sizeof *datum.values);
40794
0
    for (size_t i = 0; i < n_queues; i++) {
40795
0
        datum.keys[i].integer = key_queues[i];
40796
0
        datum.values[i].uuid = *value_queues[i];
40797
0
    }
40798
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_qos_col_queues.type);
40799
0
    ovsdb_idl_condition_add_clause(cond,
40800
0
                          function,
40801
0
                          &ovsrec_qos_col_queues,
40802
0
                          &datum);
40803
0
    ovsdb_datum_destroy(&datum, &ovsrec_qos_col_queues.type);
40804
0
}
40805
40806
/* Sets the "type" column from the "QoS" table in 'row' to
40807
 * 'type'.
40808
 *
40809
 * The caller retains ownership of the arguments. */
40810
void
40811
ovsrec_qos_add_clause_type(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *type)
40812
0
{
40813
0
    struct ovsdb_datum datum;
40814
40815
0
    datum.refcnt = NULL;
40816
40817
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
40818
40819
0
    datum.n = 1;
40820
0
    datum.keys = key;
40821
0
    key->s = ovsdb_atom_string_create(type);
40822
0
    datum.values = NULL;
40823
0
    ovsdb_idl_condition_add_clause(cond,
40824
0
                          function,
40825
0
                          &ovsrec_qos_col_type,
40826
0
                          &datum);
40827
0
    ovsdb_datum_destroy(&datum, &ovsrec_qos_col_type.type);
40828
0
}
40829
40830
/* Destroy 'row' of kind "QoS". The row must have been
40831
 * created with ovsdb_idl_index_init_row.
40832
 */
40833
void
40834
ovsrec_qos_index_destroy_row(const struct ovsrec_qos *row)
40835
0
{
40836
0
    ovsdb_idl_index_destroy_row(&row->header_);
40837
0
}
40838
        
40839
40840
/* Creates a new row of kind "QoS". */
40841
struct ovsrec_qos *
40842
ovsrec_qos_index_init_row(struct ovsdb_idl_index *index)
40843
0
{
40844
0
    ovs_assert(index->table->class_ == &ovsrec_table_qos);
40845
0
    return ALIGNED_CAST(struct ovsrec_qos *, ovsdb_idl_index_init_row(index));
40846
0
}
40847
40848
struct ovsrec_qos *
40849
ovsrec_qos_index_find(struct ovsdb_idl_index *index, const struct ovsrec_qos *target)
40850
0
{
40851
0
    ovs_assert(index->table->class_ == &ovsrec_table_qos);
40852
0
    return ovsrec_qos_cast(ovsdb_idl_index_find(index, &target->header_));
40853
0
}
40854
40855
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
40856
int
40857
ovsrec_qos_index_compare(
40858
    struct ovsdb_idl_index *index, 
40859
    const struct ovsrec_qos *a, 
40860
    const struct ovsrec_qos *b)
40861
0
{
40862
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
40863
0
}
40864
40865
struct ovsdb_idl_cursor
40866
ovsrec_qos_cursor_first(struct ovsdb_idl_index *index)
40867
0
{
40868
0
    ovs_assert(index->table->class_ == &ovsrec_table_qos);
40869
0
    return ovsdb_idl_cursor_first(index);
40870
0
}
40871
40872
struct ovsdb_idl_cursor
40873
ovsrec_qos_cursor_first_eq(
40874
    struct ovsdb_idl_index *index, const struct ovsrec_qos *target)
40875
0
{
40876
0
    ovs_assert(index->table->class_ == &ovsrec_table_qos);
40877
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
40878
0
}
40879
40880
struct ovsdb_idl_cursor
40881
ovsrec_qos_cursor_first_ge(
40882
    struct ovsdb_idl_index *index, const struct ovsrec_qos *target)
40883
0
{
40884
0
    ovs_assert(index->table->class_ == &ovsrec_table_qos);
40885
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
40886
0
}
40887
40888
struct ovsrec_qos *
40889
ovsrec_qos_cursor_data(struct ovsdb_idl_cursor *cursor)
40890
0
{
40891
0
    return ovsrec_qos_cast(ovsdb_idl_cursor_data(cursor));
40892
0
}
40893
40894
40895
/* Sets the "external_ids" column's value from the "QoS" table in 'row'
40896
 * to 'external_ids'.
40897
 *
40898
 * The caller retains ownership of 'external_ids' and everything in it. */
40899
void
40900
ovsrec_qos_index_set_external_ids(const struct ovsrec_qos *row, const struct smap *external_ids)
40901
0
{
40902
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
40903
40904
0
    if (external_ids) {
40905
0
        struct smap_node *node;
40906
0
        size_t i;
40907
40908
0
        datum->n = smap_count(external_ids);
40909
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40910
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
40911
0
        datum->refcnt = NULL;
40912
40913
0
        i = 0;
40914
0
        SMAP_FOR_EACH (node, external_ids) {
40915
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
40916
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
40917
0
            i++;
40918
0
        }
40919
0
        ovsdb_datum_sort_unique(datum, &ovsrec_qos_col_external_ids.type);
40920
0
    } else {
40921
0
        ovsdb_datum_init_empty(datum);
40922
0
    }
40923
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
40924
0
                          &ovsrec_qos_columns[OVSREC_QOS_COL_EXTERNAL_IDS],
40925
0
                          datum,
40926
0
                          &ovsrec_table_classes[OVSREC_TABLE_QOS]);
40927
0
    free(datum);
40928
0
}
40929
40930
40931
/* Sets the "other_config" column's value from the "QoS" table in 'row'
40932
 * to 'other_config'.
40933
 *
40934
 * The caller retains ownership of 'other_config' and everything in it. */
40935
void
40936
ovsrec_qos_index_set_other_config(const struct ovsrec_qos *row, const struct smap *other_config)
40937
0
{
40938
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
40939
40940
0
    if (other_config) {
40941
0
        struct smap_node *node;
40942
0
        size_t i;
40943
40944
0
        datum->n = smap_count(other_config);
40945
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
40946
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
40947
0
        datum->refcnt = NULL;
40948
40949
0
        i = 0;
40950
0
        SMAP_FOR_EACH (node, other_config) {
40951
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
40952
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
40953
0
            i++;
40954
0
        }
40955
0
        ovsdb_datum_sort_unique(datum, &ovsrec_qos_col_other_config.type);
40956
0
    } else {
40957
0
        ovsdb_datum_init_empty(datum);
40958
0
    }
40959
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
40960
0
                          &ovsrec_qos_columns[OVSREC_QOS_COL_OTHER_CONFIG],
40961
0
                          datum,
40962
0
                          &ovsrec_table_classes[OVSREC_TABLE_QOS]);
40963
0
    free(datum);
40964
0
}
40965
40966
40967
/* Sets the "queues" column from the "QoS" table in 'row' to
40968
 * the map with keys 'key_queues' and values 'value_queues'
40969
 * with 'n_queues' entries.
40970
 *
40971
 * Argument constraints: key in range 0 to 4,294,967,295
40972
 *
40973
 * The caller retains ownership of the arguments. */
40974
void
40975
ovsrec_qos_index_set_queues(const struct ovsrec_qos *row, const int64_t *key_queues, struct ovsrec_queue **value_queues, size_t n_queues)
40976
0
{
40977
0
    struct ovsdb_datum datum;
40978
40979
0
    datum.refcnt = NULL;
40980
0
    size_t i;
40981
40982
0
    datum.n = n_queues;
40983
0
    datum.keys = n_queues ? xmalloc(n_queues * sizeof *datum.keys) : NULL;
40984
0
    datum.values = xmalloc(n_queues * sizeof *datum.values);
40985
0
    for (i = 0; i < n_queues; i++) {
40986
0
        datum.keys[i].integer = key_queues[i];
40987
0
        datum.values[i].uuid = value_queues[i]->header_.uuid;
40988
0
    }
40989
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_qos_col_queues.type);
40990
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]);
40991
0
}
40992
40993
/* Sets the "type" column from the "QoS" table in 'row' to
40994
 * 'type'.
40995
 *
40996
 * The caller retains ownership of the arguments. */
40997
void
40998
ovsrec_qos_index_set_type(const struct ovsrec_qos *row, const char *type)
40999
0
{
41000
0
    struct ovsdb_datum datum;
41001
41002
0
    datum.refcnt = NULL;
41003
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
41004
41005
0
    datum.n = 1;
41006
0
    datum.keys = key;
41007
0
    key->s = ovsdb_atom_string_create(type);
41008
0
    datum.values = NULL;
41009
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]);
41010
0
}
41011
41012
struct ovsdb_idl_column ovsrec_qos_columns[OVSREC_QOS_N_COLUMNS];
41013
41014
unsigned int
41015
ovsrec_qos_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
41016
0
{
41017
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_qos, condition);
41018
0
}
41019
41020
struct ovsdb_idl_column ovsrec_qos_columns[OVSREC_QOS_N_COLUMNS] = {
41021
    [OVSREC_QOS_COL_EXTERNAL_IDS] = {
41022
         .name = "external_ids",
41023
         .type = {
41024
            .key = {
41025
               .type = OVSDB_TYPE_STRING,
41026
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41027
            },
41028
            .value = {
41029
                .type = OVSDB_TYPE_STRING,
41030
                .string = { .minLen = 0, .maxLen = UINT_MAX },
41031
            },
41032
            .n_min = 0,
41033
            .n_max = UINT_MAX,
41034
         },
41035
         .is_mutable = true,
41036
         .is_synthetic = false,
41037
         .parse = ovsrec_qos_parse_external_ids,
41038
         .unparse = ovsrec_qos_unparse_external_ids,
41039
    },
41040
41041
    [OVSREC_QOS_COL_OTHER_CONFIG] = {
41042
         .name = "other_config",
41043
         .type = {
41044
            .key = {
41045
               .type = OVSDB_TYPE_STRING,
41046
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41047
            },
41048
            .value = {
41049
                .type = OVSDB_TYPE_STRING,
41050
                .string = { .minLen = 0, .maxLen = UINT_MAX },
41051
            },
41052
            .n_min = 0,
41053
            .n_max = UINT_MAX,
41054
         },
41055
         .is_mutable = true,
41056
         .is_synthetic = false,
41057
         .parse = ovsrec_qos_parse_other_config,
41058
         .unparse = ovsrec_qos_unparse_other_config,
41059
    },
41060
41061
    [OVSREC_QOS_COL_QUEUES] = {
41062
         .name = "queues",
41063
         .type = {
41064
            .key = {
41065
               .type = OVSDB_TYPE_INTEGER,
41066
               .integer = { .min = INT64_C(0), .max = INT64_C(4294967295) },
41067
            },
41068
            .value = {
41069
                .type = OVSDB_TYPE_UUID,
41070
                .uuid = { .refTableName = "Queue", .refType = OVSDB_REF_STRONG },
41071
            },
41072
            .n_min = 0,
41073
            .n_max = UINT_MAX,
41074
         },
41075
         .is_mutable = true,
41076
         .is_synthetic = false,
41077
         .parse = ovsrec_qos_parse_queues,
41078
         .unparse = ovsrec_qos_unparse_queues,
41079
    },
41080
41081
    [OVSREC_QOS_COL_TYPE] = {
41082
         .name = "type",
41083
         .type = {
41084
            .key = {
41085
               .type = OVSDB_TYPE_STRING,
41086
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41087
            },
41088
            .value = OVSDB_BASE_VOID_INIT,
41089
            .n_min = 1,
41090
            .n_max = 1,
41091
         },
41092
         .is_mutable = true,
41093
         .is_synthetic = false,
41094
         .parse = ovsrec_qos_parse_type,
41095
         .unparse = ovsrec_qos_unparse_type,
41096
    },
41097
41098
};
41099

41100
/* Queue table. */
41101
41102
bool
41103
ovsrec_server_has_queue_table_col_dscp(const struct ovsdb_idl *idl)
41104
0
{
41105
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_queue_col_dscp);
41106
0
}
41107
41108
41109
bool
41110
ovsrec_server_has_queue_table_col_external_ids(const struct ovsdb_idl *idl)
41111
0
{
41112
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_queue_col_external_ids);
41113
0
}
41114
41115
41116
bool
41117
ovsrec_server_has_queue_table_col_other_config(const struct ovsdb_idl *idl)
41118
0
{
41119
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_queue_col_other_config);
41120
0
}
41121
41122
41123
bool
41124
ovsrec_server_has_queue_table(const struct ovsdb_idl *idl)
41125
0
{
41126
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_QUEUE]);
41127
0
}
41128
41129
41130
const struct ovsrec_queue_table *
41131
ovsrec_queue_table_get(const struct ovsdb_idl *idl)
41132
0
{
41133
0
    return (const struct ovsrec_queue_table *) idl;
41134
0
}
41135
41136
const struct ovsrec_queue *
41137
ovsrec_queue_table_first(const struct ovsrec_queue_table *table)
41138
0
{
41139
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
41140
0
    return ovsrec_queue_first(idl);
41141
0
}
41142
41143
41144
const struct ovsrec_queue *
41145
ovsrec_queue_table_track_get_first(const struct ovsrec_queue_table *table)
41146
0
{
41147
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
41148
0
    return ovsrec_queue_track_get_first(idl);
41149
0
}
41150
41151
41152
static void
41153
ovsrec_queue_parse_dscp(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
41154
0
{
41155
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
41156
0
    size_t n = MIN(1, datum->n);
41157
0
    row->dscp = NULL;
41158
0
    row->n_dscp = 0;
41159
0
    for (size_t i = 0; i < n; i++) {
41160
0
        if (!row->n_dscp) {
41161
0
            row->dscp = xmalloc(n * sizeof *row->dscp);
41162
0
        }
41163
0
        row->dscp[row->n_dscp] = datum->keys[i].integer;
41164
0
        row->n_dscp++;
41165
0
    }
41166
0
}
41167
41168
static void
41169
ovsrec_queue_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
41170
0
{
41171
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
41172
0
    smap_init(&row->external_ids);
41173
0
    for (size_t i = 0; i < datum->n; i++) {
41174
0
        smap_add(&row->external_ids,
41175
0
                 json_string(datum->keys[i].s),
41176
0
                 json_string(datum->values[i].s));
41177
0
    }
41178
0
}
41179
41180
static void
41181
ovsrec_queue_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
41182
0
{
41183
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
41184
0
    smap_init(&row->other_config);
41185
0
    for (size_t i = 0; i < datum->n; i++) {
41186
0
        smap_add(&row->other_config,
41187
0
                 json_string(datum->keys[i].s),
41188
0
                 json_string(datum->values[i].s));
41189
0
    }
41190
0
}
41191
41192
static void
41193
ovsrec_queue_unparse_dscp(struct ovsdb_idl_row *row_)
41194
0
{
41195
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
41196
0
    free(row->dscp);
41197
0
}
41198
41199
static void
41200
ovsrec_queue_unparse_external_ids(struct ovsdb_idl_row *row_)
41201
0
{
41202
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
41203
0
    smap_destroy(&row->external_ids);
41204
0
}
41205
41206
static void
41207
ovsrec_queue_unparse_other_config(struct ovsdb_idl_row *row_)
41208
0
{
41209
0
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
41210
0
    smap_destroy(&row->other_config);
41211
0
}
41212
41213
static void
41214
ovsrec_queue_init__(struct ovsdb_idl_row *row)
41215
0
{
41216
0
    ovsrec_queue_init(ovsrec_queue_cast(row));
41217
0
}
41218
41219
/* Clears the contents of 'row' in table "Queue". */
41220
void
41221
ovsrec_queue_init(struct ovsrec_queue *row)
41222
0
{
41223
0
    memset(row, 0, sizeof *row); 
41224
0
    smap_init(&row->external_ids);
41225
0
    smap_init(&row->other_config);
41226
0
}
41227
41228
/* Searches table "Queue" in 'idl' for a row with UUID 'uuid'.  Returns
41229
 * a pointer to the row if there is one, otherwise a null pointer.  */
41230
const struct ovsrec_queue *
41231
ovsrec_queue_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
41232
0
{
41233
0
    return ovsrec_queue_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_queue, uuid));
41234
0
}
41235
41236
/* Searches table "Queue" for a row with UUID 'uuid'.  Returns
41237
 * a pointer to the row if there is one, otherwise a null pointer.  */
41238
const struct ovsrec_queue *
41239
ovsrec_queue_table_get_for_uuid(const struct ovsrec_queue_table *table, const struct uuid *uuid)
41240
0
{
41241
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
41242
0
    return ovsrec_queue_get_for_uuid(idl, uuid);
41243
0
}
41244
41245
/* Returns a row in table "Queue" in 'idl', or a null pointer if that
41246
 * table is empty.
41247
 *
41248
 * Database tables are internally maintained as hash tables, so adding or
41249
 * removing rows while traversing the same table can cause some rows to be
41250
 * visited twice or not at apply. */
41251
const struct ovsrec_queue *
41252
ovsrec_queue_first(const struct ovsdb_idl *idl)
41253
0
{
41254
0
    return ovsrec_queue_cast(ovsdb_idl_first_row(idl, &ovsrec_table_queue));
41255
0
}
41256
41257
/* Returns a row following 'row' within its table, or a null pointer if 'row'
41258
 * is the last row in its table. */
41259
const struct ovsrec_queue *
41260
ovsrec_queue_next(const struct ovsrec_queue *row)
41261
0
{
41262
0
    return ovsrec_queue_cast(ovsdb_idl_next_row(&row->header_));
41263
0
}
41264
41265
unsigned int ovsrec_queue_get_seqno(const struct ovsdb_idl *idl)
41266
0
{
41267
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_queue);
41268
0
}
41269
41270
unsigned int ovsrec_queue_row_get_seqno(const struct ovsrec_queue *row, enum ovsdb_idl_change change)
41271
0
{
41272
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
41273
0
}
41274
41275
const struct ovsrec_queue *
41276
ovsrec_queue_track_get_first(const struct ovsdb_idl *idl)
41277
0
{
41278
0
    return ovsrec_queue_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_queue));
41279
0
}
41280
41281
const struct ovsrec_queue
41282
*ovsrec_queue_track_get_next(const struct ovsrec_queue *row)
41283
0
{
41284
0
    return ovsrec_queue_cast(ovsdb_idl_track_get_next(&row->header_));
41285
0
}
41286
41287
41288
/* Deletes 'row' from table "Queue".  'row' may be freed, so it must not be
41289
 * accessed afterward.
41290
 *
41291
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
41292
void
41293
ovsrec_queue_delete(const struct ovsrec_queue *row)
41294
0
{
41295
0
    ovsdb_idl_txn_delete(&row->header_);
41296
0
}
41297
41298
/* Inserts and returns a new row in the table "Queue" in the database
41299
 * with open transaction 'txn'.
41300
 *
41301
 * The new row is assigned a randomly generated provisional UUID.
41302
 * ovsdb-server will assign a different UUID when 'txn' is committed,
41303
 * but the IDL will replace any uses of the provisional UUID in the
41304
 * data to be to be committed by the UUID assigned by ovsdb-server. */
41305
struct ovsrec_queue *
41306
ovsrec_queue_insert(struct ovsdb_idl_txn *txn)
41307
0
{
41308
0
    return ovsrec_queue_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_queue, NULL));
41309
0
}
41310
41311
/* Inserts and returns a new row in the table "Queue" in the database
41312
 * with open transaction 'txn'.
41313
 *
41314
 * The new row is assigned the UUID specified in the 'uuid' parameter
41315
 * (which cannot be null).  ovsdb-server will try to assign the same
41316
 * UUID when 'txn' is committed. */
41317
struct ovsrec_queue *
41318
ovsrec_queue_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
41319
0
{
41320
0
    return ovsrec_queue_cast(ovsdb_idl_txn_insert_persist_uuid(
41321
0
        txn, &ovsrec_table_queue, uuid));
41322
0
}
41323
41324
bool
41325
ovsrec_queue_is_updated(const struct ovsrec_queue *row, enum ovsrec_queue_column_id column)
41326
0
{
41327
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_queue_columns[column]);
41328
0
}
41329
41330
/* Causes the original contents of column "dscp" in 'row' to be
41331
 * verified as a prerequisite to completing the transaction.  That is, if
41332
 * "dscp" in 'row' changed (or if 'row' was deleted) between the
41333
 * time that the IDL originally read its contents and the time that the
41334
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
41335
 *
41336
 * The intention is that, to ensure that no transaction commits based on dirty
41337
 * reads, an application should call this function any time "dscp" is
41338
 * read as part of a read-modify-write operation.
41339
 *
41340
 * In some cases this function reduces to a no-op, because the current value
41341
 * of "dscp" is already known:
41342
 *
41343
 *   - If 'row' is a row created by the current transaction (returned by
41344
 *     ovsrec_queue_insert()).
41345
 *
41346
 *   - If "dscp" has already been modified (with
41347
 *     ovsrec_queue_set_dscp()) within the current transaction.
41348
 *
41349
 * Because of the latter property, always call this function *before*
41350
 * ovsrec_queue_set_dscp() for a given read-modify-write.
41351
 *
41352
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
41353
void
41354
ovsrec_queue_verify_dscp(const struct ovsrec_queue *row)
41355
0
{
41356
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_col_dscp);
41357
0
}
41358
41359
/* Causes the original contents of column "external_ids" in 'row' to be
41360
 * verified as a prerequisite to completing the transaction.  That is, if
41361
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
41362
 * time that the IDL originally read its contents and the time that the
41363
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
41364
 *
41365
 * The intention is that, to ensure that no transaction commits based on dirty
41366
 * reads, an application should call this function any time "external_ids" is
41367
 * read as part of a read-modify-write operation.
41368
 *
41369
 * In some cases this function reduces to a no-op, because the current value
41370
 * of "external_ids" is already known:
41371
 *
41372
 *   - If 'row' is a row created by the current transaction (returned by
41373
 *     ovsrec_queue_insert()).
41374
 *
41375
 *   - If "external_ids" has already been modified (with
41376
 *     ovsrec_queue_set_external_ids()) within the current transaction.
41377
 *
41378
 * Because of the latter property, always call this function *before*
41379
 * ovsrec_queue_set_external_ids() for a given read-modify-write.
41380
 *
41381
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
41382
void
41383
ovsrec_queue_verify_external_ids(const struct ovsrec_queue *row)
41384
0
{
41385
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_col_external_ids);
41386
0
}
41387
41388
/* Causes the original contents of column "other_config" in 'row' to be
41389
 * verified as a prerequisite to completing the transaction.  That is, if
41390
 * "other_config" in 'row' changed (or if 'row' was deleted) between the
41391
 * time that the IDL originally read its contents and the time that the
41392
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
41393
 *
41394
 * The intention is that, to ensure that no transaction commits based on dirty
41395
 * reads, an application should call this function any time "other_config" is
41396
 * read as part of a read-modify-write operation.
41397
 *
41398
 * In some cases this function reduces to a no-op, because the current value
41399
 * of "other_config" is already known:
41400
 *
41401
 *   - If 'row' is a row created by the current transaction (returned by
41402
 *     ovsrec_queue_insert()).
41403
 *
41404
 *   - If "other_config" has already been modified (with
41405
 *     ovsrec_queue_set_other_config()) within the current transaction.
41406
 *
41407
 * Because of the latter property, always call this function *before*
41408
 * ovsrec_queue_set_other_config() for a given read-modify-write.
41409
 *
41410
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
41411
void
41412
ovsrec_queue_verify_other_config(const struct ovsrec_queue *row)
41413
0
{
41414
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_col_other_config);
41415
0
}
41416
41417
/* Returns the "dscp" column's value from the "Queue" table in 'row'
41418
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
41419
 * ovsdb_datum_find_key() is an easier and more efficient way to search
41420
 * for a given key than implementing the same operation on the "cooked"
41421
 * form in 'row'.
41422
 *
41423
 * 'key_type' must be OVSDB_TYPE_INTEGER.
41424
 * (This helps to avoid silent bugs if someone changes dscp's
41425
 * type without updating the caller.)
41426
 *
41427
 * The caller must not modify or free the returned value.
41428
 *
41429
 * Various kinds of changes can invalidate the returned value: modifying
41430
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
41431
 * If the returned value is needed for a long time, it is best to make a copy
41432
 * of it with ovsdb_datum_clone().
41433
 *
41434
 * This function is rarely useful, since it is easier to access the value
41435
 * directly through the "dscp" member in ovsrec_queue. */
41436
const struct ovsdb_datum *
41437
ovsrec_queue_get_dscp(const struct ovsrec_queue *row,
41438
  enum ovsdb_atomic_type key_type OVS_UNUSED)
41439
0
{
41440
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
41441
0
    return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_dscp);
41442
0
}
41443
41444
/* Returns the "external_ids" column's value from the "Queue" table in 'row'
41445
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
41446
 * ovsdb_datum_find_key() is an easier and more efficient way to search
41447
 * for a given key than implementing the same operation on the "cooked"
41448
 * form in 'row'.
41449
 *
41450
 * 'key_type' must be OVSDB_TYPE_STRING.
41451
 * 'value_type' must be OVSDB_TYPE_STRING.
41452
 * (This helps to avoid silent bugs if someone changes external_ids's
41453
 * type without updating the caller.)
41454
 *
41455
 * The caller must not modify or free the returned value.
41456
 *
41457
 * Various kinds of changes can invalidate the returned value: modifying
41458
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
41459
 * If the returned value is needed for a long time, it is best to make a copy
41460
 * of it with ovsdb_datum_clone().
41461
 *
41462
 * This function is rarely useful, since it is easier to access the value
41463
 * directly through the "external_ids" member in ovsrec_queue. */
41464
const struct ovsdb_datum *
41465
ovsrec_queue_get_external_ids(const struct ovsrec_queue *row,
41466
  enum ovsdb_atomic_type key_type OVS_UNUSED,
41467
  enum ovsdb_atomic_type value_type OVS_UNUSED)
41468
0
{
41469
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
41470
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
41471
0
    return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_external_ids);
41472
0
}
41473
41474
/* Returns the "other_config" column's value from the "Queue" table in 'row'
41475
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
41476
 * ovsdb_datum_find_key() is an easier and more efficient way to search
41477
 * for a given key than implementing the same operation on the "cooked"
41478
 * form in 'row'.
41479
 *
41480
 * 'key_type' must be OVSDB_TYPE_STRING.
41481
 * 'value_type' must be OVSDB_TYPE_STRING.
41482
 * (This helps to avoid silent bugs if someone changes other_config's
41483
 * type without updating the caller.)
41484
 *
41485
 * The caller must not modify or free the returned value.
41486
 *
41487
 * Various kinds of changes can invalidate the returned value: modifying
41488
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
41489
 * If the returned value is needed for a long time, it is best to make a copy
41490
 * of it with ovsdb_datum_clone().
41491
 *
41492
 * This function is rarely useful, since it is easier to access the value
41493
 * directly through the "other_config" member in ovsrec_queue. */
41494
const struct ovsdb_datum *
41495
ovsrec_queue_get_other_config(const struct ovsrec_queue *row,
41496
  enum ovsdb_atomic_type key_type OVS_UNUSED,
41497
  enum ovsdb_atomic_type value_type OVS_UNUSED)
41498
0
{
41499
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
41500
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
41501
0
    return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_other_config);
41502
0
}
41503
41504
/* Sets the "dscp" column from the "Queue" table in 'row' to
41505
 * the 'dscp' set with 'n_dscp' entries.
41506
 *
41507
 * 'n_dscp' may be 0 or 1; if it is 0, then 'dscp'
41508
 * may be NULL.
41509
 *
41510
 * Argument constraints: in range 0 to 63
41511
 *
41512
 * The caller retains ownership of the arguments. */
41513
void
41514
ovsrec_queue_set_dscp(const struct ovsrec_queue *row, const int64_t *dscp, size_t n_dscp)
41515
0
{
41516
0
    struct ovsdb_datum datum;
41517
41518
0
    datum.refcnt = NULL;
41519
41520
0
    if (n_dscp) {
41521
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
41522
0
        datum.n = 1;
41523
0
        datum.keys = key;
41524
0
        key->integer = *dscp;
41525
0
    } else {
41526
0
        datum.n = 0;
41527
0
        datum.keys = NULL;
41528
0
    }
41529
0
    datum.values = NULL;
41530
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_queue_col_dscp, &datum);
41531
0
}
41532
41533
/* Sets the "external_ids" column's value from the "Queue" table in 'row'
41534
 * to 'external_ids'.
41535
 *
41536
 * The caller retains ownership of 'external_ids' and everything in it. */
41537
void
41538
ovsrec_queue_set_external_ids(const struct ovsrec_queue *row, const struct smap *external_ids)
41539
0
{
41540
0
    struct ovsdb_datum datum;
41541
41542
0
    if (external_ids) {
41543
0
        ovsdb_datum_from_smap(&datum, external_ids);
41544
0
    } else {
41545
0
        ovsdb_datum_init_empty(&datum);
41546
0
    }
41547
0
    ovsdb_idl_txn_write(&row->header_,
41548
0
                        &ovsrec_queue_col_external_ids,
41549
0
                        &datum);
41550
0
}
41551
41552
41553
/* Sets the "other_config" column's value from the "Queue" table in 'row'
41554
 * to 'other_config'.
41555
 *
41556
 * The caller retains ownership of 'other_config' and everything in it. */
41557
void
41558
ovsrec_queue_set_other_config(const struct ovsrec_queue *row, const struct smap *other_config)
41559
0
{
41560
0
    struct ovsdb_datum datum;
41561
41562
0
    if (other_config) {
41563
0
        ovsdb_datum_from_smap(&datum, other_config);
41564
0
    } else {
41565
0
        ovsdb_datum_init_empty(&datum);
41566
0
    }
41567
0
    ovsdb_idl_txn_write(&row->header_,
41568
0
                        &ovsrec_queue_col_other_config,
41569
0
                        &datum);
41570
0
}
41571
41572
41573
/* Adds the value 'new_value' to the "dscp" set column from the "Queue" table
41574
 * in 'row'.
41575
 *
41576
 */
41577
void
41578
ovsrec_queue_update_dscp_addvalue(const struct ovsrec_queue *row, int64_t new_value)
41579
0
{
41580
0
    struct ovsdb_datum *datum;
41581
41582
0
    datum = xmalloc(sizeof *datum);
41583
0
    datum->n = 1;
41584
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
41585
0
    datum->values = NULL;
41586
0
    datum->refcnt = NULL;
41587
41588
0
    datum->keys[0].integer = new_value;
41589
41590
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
41591
0
                                    &ovsrec_queue_col_dscp,
41592
0
                                    datum);
41593
0
}
41594
41595
/* Deletes the value 'delete_value' from the "dscp" set column from the
41596
 * "Queue" table in 'row'.
41597
 *
41598
 */
41599
void
41600
ovsrec_queue_update_dscp_delvalue(const struct ovsrec_queue *row, int64_t delete_value)
41601
0
{
41602
0
    struct ovsdb_datum *datum;
41603
41604
0
    datum = xmalloc(sizeof *datum);
41605
0
    datum->n = 1;
41606
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
41607
0
    datum->values = NULL;
41608
0
    datum->refcnt = NULL;
41609
41610
0
    datum->keys[0].integer = delete_value;
41611
41612
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
41613
0
                                    &ovsrec_queue_col_dscp,
41614
0
                                    datum);
41615
0
}
41616
41617
/* Sets an element of the "external_ids" map column from the "Queue" table in 'row'
41618
 * to 'new_value' given the key value 'new_key'.
41619
 *
41620
 */
41621
void
41622
ovsrec_queue_update_external_ids_setkey(const struct ovsrec_queue *row, const char *new_key, const char *new_value)
41623
0
{
41624
0
    struct ovsdb_datum *datum;
41625
41626
0
    datum = xmalloc(sizeof *datum);
41627
0
    datum->n = 1;
41628
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
41629
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
41630
0
    datum->refcnt = NULL;
41631
41632
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
41633
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
41634
41635
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
41636
0
                                    &ovsrec_queue_col_external_ids,
41637
0
                                    datum);
41638
0
}
41639
41640
/* Deletes an element of the "external_ids" map column from the "Queue" table in 'row'
41641
 * given the key value 'delete_key'.
41642
 *
41643
 */
41644
void
41645
ovsrec_queue_update_external_ids_delkey(const struct ovsrec_queue *row, const char *delete_key)
41646
0
{
41647
0
    struct ovsdb_datum *datum;
41648
41649
0
    datum = xmalloc(sizeof *datum);
41650
0
    datum->n = 1;
41651
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
41652
0
    datum->values = NULL;
41653
0
    datum->refcnt = NULL;
41654
41655
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
41656
41657
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
41658
0
                                    &ovsrec_queue_col_external_ids,
41659
0
                                    datum);
41660
0
}
41661
41662
/* Sets an element of the "other_config" map column from the "Queue" table in 'row'
41663
 * to 'new_value' given the key value 'new_key'.
41664
 *
41665
 */
41666
void
41667
ovsrec_queue_update_other_config_setkey(const struct ovsrec_queue *row, const char *new_key, const char *new_value)
41668
0
{
41669
0
    struct ovsdb_datum *datum;
41670
41671
0
    datum = xmalloc(sizeof *datum);
41672
0
    datum->n = 1;
41673
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
41674
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
41675
0
    datum->refcnt = NULL;
41676
41677
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
41678
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
41679
41680
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
41681
0
                                    &ovsrec_queue_col_other_config,
41682
0
                                    datum);
41683
0
}
41684
41685
/* Deletes an element of the "other_config" map column from the "Queue" table in 'row'
41686
 * given the key value 'delete_key'.
41687
 *
41688
 */
41689
void
41690
ovsrec_queue_update_other_config_delkey(const struct ovsrec_queue *row, const char *delete_key)
41691
0
{
41692
0
    struct ovsdb_datum *datum;
41693
41694
0
    datum = xmalloc(sizeof *datum);
41695
0
    datum->n = 1;
41696
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
41697
0
    datum->values = NULL;
41698
0
    datum->refcnt = NULL;
41699
41700
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
41701
41702
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
41703
0
                                    &ovsrec_queue_col_other_config,
41704
0
                                    datum);
41705
0
}
41706
41707
/* Sets the "dscp" column from the "Queue" table in 'row' to
41708
 * the 'dscp' set with 'n_dscp' entries.
41709
 *
41710
 * 'n_dscp' may be 0 or 1; if it is 0, then 'dscp'
41711
 * may be NULL.
41712
 *
41713
 * Argument constraints: in range 0 to 63
41714
 *
41715
 * The caller retains ownership of the arguments. */
41716
void
41717
ovsrec_queue_add_clause_dscp(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *dscp, size_t n_dscp)
41718
0
{
41719
0
    struct ovsdb_datum datum;
41720
41721
0
    datum.refcnt = NULL;
41722
41723
0
    if (n_dscp) {
41724
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
41725
0
        datum.n = 1;
41726
0
        datum.keys = key;
41727
0
        key->integer = *dscp;
41728
0
    } else {
41729
0
        datum.n = 0;
41730
0
        datum.keys = NULL;
41731
0
    }
41732
0
    datum.values = NULL;
41733
0
    ovsdb_idl_condition_add_clause(cond,
41734
0
                          function,
41735
0
                          &ovsrec_queue_col_dscp,
41736
0
                          &datum);
41737
0
    ovsdb_datum_destroy(&datum, &ovsrec_queue_col_dscp.type);
41738
0
}
41739
41740
/* Sets the "external_ids" column's value from the "Queue" table in 'row'
41741
 * to 'external_ids'.
41742
 *
41743
 * The caller retains ownership of 'external_ids' and everything in it. */
41744
void
41745
ovsrec_queue_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
41746
0
{
41747
0
    struct ovsdb_datum datum;
41748
41749
0
    if (external_ids) {
41750
0
        ovsdb_datum_from_smap(&datum, external_ids);
41751
0
    } else {
41752
0
        ovsdb_datum_init_empty(&datum);
41753
0
    }
41754
41755
0
    ovsdb_idl_condition_add_clause(cond,
41756
0
                                   function,
41757
0
                                   &ovsrec_queue_col_external_ids,
41758
0
                                   &datum);
41759
41760
0
    ovsdb_datum_destroy(&datum, &ovsrec_queue_col_external_ids.type);
41761
0
}
41762
41763
41764
/* Sets the "other_config" column's value from the "Queue" table in 'row'
41765
 * to 'other_config'.
41766
 *
41767
 * The caller retains ownership of 'other_config' and everything in it. */
41768
void
41769
ovsrec_queue_add_clause_other_config(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *other_config)
41770
0
{
41771
0
    struct ovsdb_datum datum;
41772
41773
0
    if (other_config) {
41774
0
        ovsdb_datum_from_smap(&datum, other_config);
41775
0
    } else {
41776
0
        ovsdb_datum_init_empty(&datum);
41777
0
    }
41778
41779
0
    ovsdb_idl_condition_add_clause(cond,
41780
0
                                   function,
41781
0
                                   &ovsrec_queue_col_other_config,
41782
0
                                   &datum);
41783
41784
0
    ovsdb_datum_destroy(&datum, &ovsrec_queue_col_other_config.type);
41785
0
}
41786
41787
41788
/* Destroy 'row' of kind "Queue". The row must have been
41789
 * created with ovsdb_idl_index_init_row.
41790
 */
41791
void
41792
ovsrec_queue_index_destroy_row(const struct ovsrec_queue *row)
41793
0
{
41794
0
    ovsdb_idl_index_destroy_row(&row->header_);
41795
0
}
41796
        
41797
41798
/* Creates a new row of kind "Queue". */
41799
struct ovsrec_queue *
41800
ovsrec_queue_index_init_row(struct ovsdb_idl_index *index)
41801
0
{
41802
0
    ovs_assert(index->table->class_ == &ovsrec_table_queue);
41803
0
    return ALIGNED_CAST(struct ovsrec_queue *, ovsdb_idl_index_init_row(index));
41804
0
}
41805
41806
struct ovsrec_queue *
41807
ovsrec_queue_index_find(struct ovsdb_idl_index *index, const struct ovsrec_queue *target)
41808
0
{
41809
0
    ovs_assert(index->table->class_ == &ovsrec_table_queue);
41810
0
    return ovsrec_queue_cast(ovsdb_idl_index_find(index, &target->header_));
41811
0
}
41812
41813
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
41814
int
41815
ovsrec_queue_index_compare(
41816
    struct ovsdb_idl_index *index, 
41817
    const struct ovsrec_queue *a, 
41818
    const struct ovsrec_queue *b)
41819
0
{
41820
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
41821
0
}
41822
41823
struct ovsdb_idl_cursor
41824
ovsrec_queue_cursor_first(struct ovsdb_idl_index *index)
41825
0
{
41826
0
    ovs_assert(index->table->class_ == &ovsrec_table_queue);
41827
0
    return ovsdb_idl_cursor_first(index);
41828
0
}
41829
41830
struct ovsdb_idl_cursor
41831
ovsrec_queue_cursor_first_eq(
41832
    struct ovsdb_idl_index *index, const struct ovsrec_queue *target)
41833
0
{
41834
0
    ovs_assert(index->table->class_ == &ovsrec_table_queue);
41835
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
41836
0
}
41837
41838
struct ovsdb_idl_cursor
41839
ovsrec_queue_cursor_first_ge(
41840
    struct ovsdb_idl_index *index, const struct ovsrec_queue *target)
41841
0
{
41842
0
    ovs_assert(index->table->class_ == &ovsrec_table_queue);
41843
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
41844
0
}
41845
41846
struct ovsrec_queue *
41847
ovsrec_queue_cursor_data(struct ovsdb_idl_cursor *cursor)
41848
0
{
41849
0
    return ovsrec_queue_cast(ovsdb_idl_cursor_data(cursor));
41850
0
}
41851
41852
41853
/* Sets the "dscp" column from the "Queue" table in 'row' to
41854
 * the 'dscp' set with 'n_dscp' entries.
41855
 *
41856
 * 'n_dscp' may be 0 or 1; if it is 0, then 'dscp'
41857
 * may be NULL.
41858
 *
41859
 * Argument constraints: in range 0 to 63
41860
 *
41861
 * The caller retains ownership of the arguments. */
41862
void
41863
ovsrec_queue_index_set_dscp(const struct ovsrec_queue *row, const int64_t *dscp, size_t n_dscp)
41864
0
{
41865
0
    struct ovsdb_datum datum;
41866
41867
0
    datum.refcnt = NULL;
41868
0
    union ovsdb_atom *key;
41869
41870
0
    if (n_dscp) {
41871
0
        key = xmalloc(sizeof(union ovsdb_atom));
41872
0
        datum.n = 1;
41873
0
        datum.keys = key;
41874
0
        key->integer = *dscp;
41875
0
    } else {
41876
0
        datum.n = 0;
41877
0
        datum.keys = NULL;
41878
0
    }
41879
0
    datum.values = NULL;
41880
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]);
41881
0
}
41882
41883
/* Sets the "external_ids" column's value from the "Queue" table in 'row'
41884
 * to 'external_ids'.
41885
 *
41886
 * The caller retains ownership of 'external_ids' and everything in it. */
41887
void
41888
ovsrec_queue_index_set_external_ids(const struct ovsrec_queue *row, const struct smap *external_ids)
41889
0
{
41890
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
41891
41892
0
    if (external_ids) {
41893
0
        struct smap_node *node;
41894
0
        size_t i;
41895
41896
0
        datum->n = smap_count(external_ids);
41897
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
41898
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
41899
0
        datum->refcnt = NULL;
41900
41901
0
        i = 0;
41902
0
        SMAP_FOR_EACH (node, external_ids) {
41903
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
41904
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
41905
0
            i++;
41906
0
        }
41907
0
        ovsdb_datum_sort_unique(datum, &ovsrec_queue_col_external_ids.type);
41908
0
    } else {
41909
0
        ovsdb_datum_init_empty(datum);
41910
0
    }
41911
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
41912
0
                          &ovsrec_queue_columns[OVSREC_QUEUE_COL_EXTERNAL_IDS],
41913
0
                          datum,
41914
0
                          &ovsrec_table_classes[OVSREC_TABLE_QUEUE]);
41915
0
    free(datum);
41916
0
}
41917
41918
41919
/* Sets the "other_config" column's value from the "Queue" table in 'row'
41920
 * to 'other_config'.
41921
 *
41922
 * The caller retains ownership of 'other_config' and everything in it. */
41923
void
41924
ovsrec_queue_index_set_other_config(const struct ovsrec_queue *row, const struct smap *other_config)
41925
0
{
41926
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
41927
41928
0
    if (other_config) {
41929
0
        struct smap_node *node;
41930
0
        size_t i;
41931
41932
0
        datum->n = smap_count(other_config);
41933
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
41934
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
41935
0
        datum->refcnt = NULL;
41936
41937
0
        i = 0;
41938
0
        SMAP_FOR_EACH (node, other_config) {
41939
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
41940
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
41941
0
            i++;
41942
0
        }
41943
0
        ovsdb_datum_sort_unique(datum, &ovsrec_queue_col_other_config.type);
41944
0
    } else {
41945
0
        ovsdb_datum_init_empty(datum);
41946
0
    }
41947
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
41948
0
                          &ovsrec_queue_columns[OVSREC_QUEUE_COL_OTHER_CONFIG],
41949
0
                          datum,
41950
0
                          &ovsrec_table_classes[OVSREC_TABLE_QUEUE]);
41951
0
    free(datum);
41952
0
}
41953
41954
41955
struct ovsdb_idl_column ovsrec_queue_columns[OVSREC_QUEUE_N_COLUMNS];
41956
41957
unsigned int
41958
ovsrec_queue_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
41959
0
{
41960
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_queue, condition);
41961
0
}
41962
41963
struct ovsdb_idl_column ovsrec_queue_columns[OVSREC_QUEUE_N_COLUMNS] = {
41964
    [OVSREC_QUEUE_COL_DSCP] = {
41965
         .name = "dscp",
41966
         .type = {
41967
            .key = {
41968
               .type = OVSDB_TYPE_INTEGER,
41969
               .integer = { .min = INT64_C(0), .max = INT64_C(63) },
41970
            },
41971
            .value = OVSDB_BASE_VOID_INIT,
41972
            .n_min = 0,
41973
            .n_max = 1,
41974
         },
41975
         .is_mutable = true,
41976
         .is_synthetic = false,
41977
         .parse = ovsrec_queue_parse_dscp,
41978
         .unparse = ovsrec_queue_unparse_dscp,
41979
    },
41980
41981
    [OVSREC_QUEUE_COL_EXTERNAL_IDS] = {
41982
         .name = "external_ids",
41983
         .type = {
41984
            .key = {
41985
               .type = OVSDB_TYPE_STRING,
41986
               .string = { .minLen = 0, .maxLen = UINT_MAX },
41987
            },
41988
            .value = {
41989
                .type = OVSDB_TYPE_STRING,
41990
                .string = { .minLen = 0, .maxLen = UINT_MAX },
41991
            },
41992
            .n_min = 0,
41993
            .n_max = UINT_MAX,
41994
         },
41995
         .is_mutable = true,
41996
         .is_synthetic = false,
41997
         .parse = ovsrec_queue_parse_external_ids,
41998
         .unparse = ovsrec_queue_unparse_external_ids,
41999
    },
42000
42001
    [OVSREC_QUEUE_COL_OTHER_CONFIG] = {
42002
         .name = "other_config",
42003
         .type = {
42004
            .key = {
42005
               .type = OVSDB_TYPE_STRING,
42006
               .string = { .minLen = 0, .maxLen = UINT_MAX },
42007
            },
42008
            .value = {
42009
                .type = OVSDB_TYPE_STRING,
42010
                .string = { .minLen = 0, .maxLen = UINT_MAX },
42011
            },
42012
            .n_min = 0,
42013
            .n_max = UINT_MAX,
42014
         },
42015
         .is_mutable = true,
42016
         .is_synthetic = false,
42017
         .parse = ovsrec_queue_parse_other_config,
42018
         .unparse = ovsrec_queue_unparse_other_config,
42019
    },
42020
42021
};
42022

42023
/* SSL table. */
42024
42025
bool
42026
ovsrec_server_has_ssl_table_col_bootstrap_ca_cert(const struct ovsdb_idl *idl)
42027
0
{
42028
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ssl_col_bootstrap_ca_cert);
42029
0
}
42030
42031
42032
bool
42033
ovsrec_server_has_ssl_table_col_ca_cert(const struct ovsdb_idl *idl)
42034
0
{
42035
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ssl_col_ca_cert);
42036
0
}
42037
42038
42039
bool
42040
ovsrec_server_has_ssl_table_col_certificate(const struct ovsdb_idl *idl)
42041
0
{
42042
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ssl_col_certificate);
42043
0
}
42044
42045
42046
bool
42047
ovsrec_server_has_ssl_table_col_external_ids(const struct ovsdb_idl *idl)
42048
0
{
42049
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ssl_col_external_ids);
42050
0
}
42051
42052
42053
bool
42054
ovsrec_server_has_ssl_table_col_private_key(const struct ovsdb_idl *idl)
42055
0
{
42056
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_ssl_col_private_key);
42057
0
}
42058
42059
42060
bool
42061
ovsrec_server_has_ssl_table(const struct ovsdb_idl *idl)
42062
0
{
42063
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_SSL]);
42064
0
}
42065
42066
42067
const struct ovsrec_ssl_table *
42068
ovsrec_ssl_table_get(const struct ovsdb_idl *idl)
42069
0
{
42070
0
    return (const struct ovsrec_ssl_table *) idl;
42071
0
}
42072
42073
const struct ovsrec_ssl *
42074
ovsrec_ssl_table_first(const struct ovsrec_ssl_table *table)
42075
0
{
42076
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
42077
0
    return ovsrec_ssl_first(idl);
42078
0
}
42079
42080
42081
const struct ovsrec_ssl *
42082
ovsrec_ssl_table_track_get_first(const struct ovsrec_ssl_table *table)
42083
0
{
42084
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
42085
0
    return ovsrec_ssl_track_get_first(idl);
42086
0
}
42087
42088
42089
static void
42090
ovsrec_ssl_parse_bootstrap_ca_cert(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
42091
0
{
42092
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
42093
42094
0
    if (datum->n >= 1) {
42095
0
        row->bootstrap_ca_cert = datum->keys[0].boolean;
42096
0
    } else {
42097
0
        row->bootstrap_ca_cert = false;
42098
0
    }
42099
0
}
42100
42101
static void
42102
ovsrec_ssl_parse_ca_cert(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
42103
0
{
42104
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
42105
42106
0
    if (datum->n >= 1) {
42107
0
        row->ca_cert = datum->keys[0].s->string;
42108
0
    } else {
42109
0
        row->ca_cert = "";
42110
0
    }
42111
0
}
42112
42113
static void
42114
ovsrec_ssl_parse_certificate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
42115
0
{
42116
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
42117
42118
0
    if (datum->n >= 1) {
42119
0
        row->certificate = datum->keys[0].s->string;
42120
0
    } else {
42121
0
        row->certificate = "";
42122
0
    }
42123
0
}
42124
42125
static void
42126
ovsrec_ssl_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
42127
0
{
42128
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
42129
0
    smap_init(&row->external_ids);
42130
0
    for (size_t i = 0; i < datum->n; i++) {
42131
0
        smap_add(&row->external_ids,
42132
0
                 json_string(datum->keys[i].s),
42133
0
                 json_string(datum->values[i].s));
42134
0
    }
42135
0
}
42136
42137
static void
42138
ovsrec_ssl_parse_private_key(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
42139
0
{
42140
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
42141
42142
0
    if (datum->n >= 1) {
42143
0
        row->private_key = datum->keys[0].s->string;
42144
0
    } else {
42145
0
        row->private_key = "";
42146
0
    }
42147
0
}
42148
42149
static void
42150
ovsrec_ssl_unparse_bootstrap_ca_cert(struct ovsdb_idl_row *row OVS_UNUSED)
42151
0
{
42152
    /* Nothing to do. */
42153
0
}
42154
42155
static void
42156
ovsrec_ssl_unparse_ca_cert(struct ovsdb_idl_row *row OVS_UNUSED)
42157
0
{
42158
    /* Nothing to do. */
42159
0
}
42160
42161
static void
42162
ovsrec_ssl_unparse_certificate(struct ovsdb_idl_row *row OVS_UNUSED)
42163
0
{
42164
    /* Nothing to do. */
42165
0
}
42166
42167
static void
42168
ovsrec_ssl_unparse_external_ids(struct ovsdb_idl_row *row_)
42169
0
{
42170
0
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
42171
0
    smap_destroy(&row->external_ids);
42172
0
}
42173
42174
static void
42175
ovsrec_ssl_unparse_private_key(struct ovsdb_idl_row *row OVS_UNUSED)
42176
0
{
42177
    /* Nothing to do. */
42178
0
}
42179
42180
static void
42181
ovsrec_ssl_init__(struct ovsdb_idl_row *row)
42182
0
{
42183
0
    ovsrec_ssl_init(ovsrec_ssl_cast(row));
42184
0
}
42185
42186
/* Clears the contents of 'row' in table "SSL". */
42187
void
42188
ovsrec_ssl_init(struct ovsrec_ssl *row)
42189
0
{
42190
0
    memset(row, 0, sizeof *row); 
42191
0
    row->ca_cert = "";
42192
0
    row->certificate = "";
42193
0
    smap_init(&row->external_ids);
42194
0
    row->private_key = "";
42195
0
}
42196
42197
/* Searches table "SSL" in 'idl' for a row with UUID 'uuid'.  Returns
42198
 * a pointer to the row if there is one, otherwise a null pointer.  */
42199
const struct ovsrec_ssl *
42200
ovsrec_ssl_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
42201
0
{
42202
0
    return ovsrec_ssl_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_ssl, uuid));
42203
0
}
42204
42205
/* Searches table "SSL" for a row with UUID 'uuid'.  Returns
42206
 * a pointer to the row if there is one, otherwise a null pointer.  */
42207
const struct ovsrec_ssl *
42208
ovsrec_ssl_table_get_for_uuid(const struct ovsrec_ssl_table *table, const struct uuid *uuid)
42209
0
{
42210
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
42211
0
    return ovsrec_ssl_get_for_uuid(idl, uuid);
42212
0
}
42213
42214
/* Returns a row in table "SSL" in 'idl', or a null pointer if that
42215
 * table is empty.
42216
 *
42217
 * Database tables are internally maintained as hash tables, so adding or
42218
 * removing rows while traversing the same table can cause some rows to be
42219
 * visited twice or not at apply. */
42220
const struct ovsrec_ssl *
42221
ovsrec_ssl_first(const struct ovsdb_idl *idl)
42222
0
{
42223
0
    return ovsrec_ssl_cast(ovsdb_idl_first_row(idl, &ovsrec_table_ssl));
42224
0
}
42225
42226
/* Returns a row following 'row' within its table, or a null pointer if 'row'
42227
 * is the last row in its table. */
42228
const struct ovsrec_ssl *
42229
ovsrec_ssl_next(const struct ovsrec_ssl *row)
42230
0
{
42231
0
    return ovsrec_ssl_cast(ovsdb_idl_next_row(&row->header_));
42232
0
}
42233
42234
unsigned int ovsrec_ssl_get_seqno(const struct ovsdb_idl *idl)
42235
0
{
42236
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_ssl);
42237
0
}
42238
42239
unsigned int ovsrec_ssl_row_get_seqno(const struct ovsrec_ssl *row, enum ovsdb_idl_change change)
42240
0
{
42241
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
42242
0
}
42243
42244
const struct ovsrec_ssl *
42245
ovsrec_ssl_track_get_first(const struct ovsdb_idl *idl)
42246
0
{
42247
0
    return ovsrec_ssl_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_ssl));
42248
0
}
42249
42250
const struct ovsrec_ssl
42251
*ovsrec_ssl_track_get_next(const struct ovsrec_ssl *row)
42252
0
{
42253
0
    return ovsrec_ssl_cast(ovsdb_idl_track_get_next(&row->header_));
42254
0
}
42255
42256
42257
/* Deletes 'row' from table "SSL".  'row' may be freed, so it must not be
42258
 * accessed afterward.
42259
 *
42260
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42261
void
42262
ovsrec_ssl_delete(const struct ovsrec_ssl *row)
42263
0
{
42264
0
    ovsdb_idl_txn_delete(&row->header_);
42265
0
}
42266
42267
/* Inserts and returns a new row in the table "SSL" in the database
42268
 * with open transaction 'txn'.
42269
 *
42270
 * The new row is assigned a randomly generated provisional UUID.
42271
 * ovsdb-server will assign a different UUID when 'txn' is committed,
42272
 * but the IDL will replace any uses of the provisional UUID in the
42273
 * data to be to be committed by the UUID assigned by ovsdb-server. */
42274
struct ovsrec_ssl *
42275
ovsrec_ssl_insert(struct ovsdb_idl_txn *txn)
42276
0
{
42277
0
    return ovsrec_ssl_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_ssl, NULL));
42278
0
}
42279
42280
/* Inserts and returns a new row in the table "SSL" in the database
42281
 * with open transaction 'txn'.
42282
 *
42283
 * The new row is assigned the UUID specified in the 'uuid' parameter
42284
 * (which cannot be null).  ovsdb-server will try to assign the same
42285
 * UUID when 'txn' is committed. */
42286
struct ovsrec_ssl *
42287
ovsrec_ssl_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
42288
0
{
42289
0
    return ovsrec_ssl_cast(ovsdb_idl_txn_insert_persist_uuid(
42290
0
        txn, &ovsrec_table_ssl, uuid));
42291
0
}
42292
42293
bool
42294
ovsrec_ssl_is_updated(const struct ovsrec_ssl *row, enum ovsrec_ssl_column_id column)
42295
0
{
42296
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_ssl_columns[column]);
42297
0
}
42298
42299
/* Causes the original contents of column "bootstrap_ca_cert" in 'row' to be
42300
 * verified as a prerequisite to completing the transaction.  That is, if
42301
 * "bootstrap_ca_cert" in 'row' changed (or if 'row' was deleted) between the
42302
 * time that the IDL originally read its contents and the time that the
42303
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
42304
 *
42305
 * The intention is that, to ensure that no transaction commits based on dirty
42306
 * reads, an application should call this function any time "bootstrap_ca_cert" is
42307
 * read as part of a read-modify-write operation.
42308
 *
42309
 * In some cases this function reduces to a no-op, because the current value
42310
 * of "bootstrap_ca_cert" is already known:
42311
 *
42312
 *   - If 'row' is a row created by the current transaction (returned by
42313
 *     ovsrec_ssl_insert()).
42314
 *
42315
 *   - If "bootstrap_ca_cert" has already been modified (with
42316
 *     ovsrec_ssl_set_bootstrap_ca_cert()) within the current transaction.
42317
 *
42318
 * Because of the latter property, always call this function *before*
42319
 * ovsrec_ssl_set_bootstrap_ca_cert() for a given read-modify-write.
42320
 *
42321
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42322
void
42323
ovsrec_ssl_verify_bootstrap_ca_cert(const struct ovsrec_ssl *row)
42324
0
{
42325
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_col_bootstrap_ca_cert);
42326
0
}
42327
42328
/* Causes the original contents of column "ca_cert" in 'row' to be
42329
 * verified as a prerequisite to completing the transaction.  That is, if
42330
 * "ca_cert" in 'row' changed (or if 'row' was deleted) between the
42331
 * time that the IDL originally read its contents and the time that the
42332
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
42333
 *
42334
 * The intention is that, to ensure that no transaction commits based on dirty
42335
 * reads, an application should call this function any time "ca_cert" is
42336
 * read as part of a read-modify-write operation.
42337
 *
42338
 * In some cases this function reduces to a no-op, because the current value
42339
 * of "ca_cert" is already known:
42340
 *
42341
 *   - If 'row' is a row created by the current transaction (returned by
42342
 *     ovsrec_ssl_insert()).
42343
 *
42344
 *   - If "ca_cert" has already been modified (with
42345
 *     ovsrec_ssl_set_ca_cert()) within the current transaction.
42346
 *
42347
 * Because of the latter property, always call this function *before*
42348
 * ovsrec_ssl_set_ca_cert() for a given read-modify-write.
42349
 *
42350
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42351
void
42352
ovsrec_ssl_verify_ca_cert(const struct ovsrec_ssl *row)
42353
0
{
42354
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_col_ca_cert);
42355
0
}
42356
42357
/* Causes the original contents of column "certificate" in 'row' to be
42358
 * verified as a prerequisite to completing the transaction.  That is, if
42359
 * "certificate" in 'row' changed (or if 'row' was deleted) between the
42360
 * time that the IDL originally read its contents and the time that the
42361
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
42362
 *
42363
 * The intention is that, to ensure that no transaction commits based on dirty
42364
 * reads, an application should call this function any time "certificate" is
42365
 * read as part of a read-modify-write operation.
42366
 *
42367
 * In some cases this function reduces to a no-op, because the current value
42368
 * of "certificate" is already known:
42369
 *
42370
 *   - If 'row' is a row created by the current transaction (returned by
42371
 *     ovsrec_ssl_insert()).
42372
 *
42373
 *   - If "certificate" has already been modified (with
42374
 *     ovsrec_ssl_set_certificate()) within the current transaction.
42375
 *
42376
 * Because of the latter property, always call this function *before*
42377
 * ovsrec_ssl_set_certificate() for a given read-modify-write.
42378
 *
42379
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42380
void
42381
ovsrec_ssl_verify_certificate(const struct ovsrec_ssl *row)
42382
0
{
42383
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_col_certificate);
42384
0
}
42385
42386
/* Causes the original contents of column "external_ids" in 'row' to be
42387
 * verified as a prerequisite to completing the transaction.  That is, if
42388
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
42389
 * time that the IDL originally read its contents and the time that the
42390
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
42391
 *
42392
 * The intention is that, to ensure that no transaction commits based on dirty
42393
 * reads, an application should call this function any time "external_ids" is
42394
 * read as part of a read-modify-write operation.
42395
 *
42396
 * In some cases this function reduces to a no-op, because the current value
42397
 * of "external_ids" is already known:
42398
 *
42399
 *   - If 'row' is a row created by the current transaction (returned by
42400
 *     ovsrec_ssl_insert()).
42401
 *
42402
 *   - If "external_ids" has already been modified (with
42403
 *     ovsrec_ssl_set_external_ids()) within the current transaction.
42404
 *
42405
 * Because of the latter property, always call this function *before*
42406
 * ovsrec_ssl_set_external_ids() for a given read-modify-write.
42407
 *
42408
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42409
void
42410
ovsrec_ssl_verify_external_ids(const struct ovsrec_ssl *row)
42411
0
{
42412
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_col_external_ids);
42413
0
}
42414
42415
/* Causes the original contents of column "private_key" in 'row' to be
42416
 * verified as a prerequisite to completing the transaction.  That is, if
42417
 * "private_key" in 'row' changed (or if 'row' was deleted) between the
42418
 * time that the IDL originally read its contents and the time that the
42419
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
42420
 *
42421
 * The intention is that, to ensure that no transaction commits based on dirty
42422
 * reads, an application should call this function any time "private_key" is
42423
 * read as part of a read-modify-write operation.
42424
 *
42425
 * In some cases this function reduces to a no-op, because the current value
42426
 * of "private_key" is already known:
42427
 *
42428
 *   - If 'row' is a row created by the current transaction (returned by
42429
 *     ovsrec_ssl_insert()).
42430
 *
42431
 *   - If "private_key" has already been modified (with
42432
 *     ovsrec_ssl_set_private_key()) within the current transaction.
42433
 *
42434
 * Because of the latter property, always call this function *before*
42435
 * ovsrec_ssl_set_private_key() for a given read-modify-write.
42436
 *
42437
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
42438
void
42439
ovsrec_ssl_verify_private_key(const struct ovsrec_ssl *row)
42440
0
{
42441
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_col_private_key);
42442
0
}
42443
42444
/* Returns the "bootstrap_ca_cert" column's value from the "SSL" table in 'row'
42445
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
42446
 * ovsdb_datum_find_key() is an easier and more efficient way to search
42447
 * for a given key than implementing the same operation on the "cooked"
42448
 * form in 'row'.
42449
 *
42450
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
42451
 * (This helps to avoid silent bugs if someone changes bootstrap_ca_cert's
42452
 * type without updating the caller.)
42453
 *
42454
 * The caller must not modify or free the returned value.
42455
 *
42456
 * Various kinds of changes can invalidate the returned value: modifying
42457
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
42458
 * If the returned value is needed for a long time, it is best to make a copy
42459
 * of it with ovsdb_datum_clone().
42460
 *
42461
 * This function is rarely useful, since it is easier to access the value
42462
 * directly through the "bootstrap_ca_cert" member in ovsrec_ssl. */
42463
const struct ovsdb_datum *
42464
ovsrec_ssl_get_bootstrap_ca_cert(const struct ovsrec_ssl *row,
42465
  enum ovsdb_atomic_type key_type OVS_UNUSED)
42466
0
{
42467
0
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
42468
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_bootstrap_ca_cert);
42469
0
}
42470
42471
/* Returns the "ca_cert" column's value from the "SSL" table in 'row'
42472
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
42473
 * ovsdb_datum_find_key() is an easier and more efficient way to search
42474
 * for a given key than implementing the same operation on the "cooked"
42475
 * form in 'row'.
42476
 *
42477
 * 'key_type' must be OVSDB_TYPE_STRING.
42478
 * (This helps to avoid silent bugs if someone changes ca_cert's
42479
 * type without updating the caller.)
42480
 *
42481
 * The caller must not modify or free the returned value.
42482
 *
42483
 * Various kinds of changes can invalidate the returned value: modifying
42484
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
42485
 * If the returned value is needed for a long time, it is best to make a copy
42486
 * of it with ovsdb_datum_clone().
42487
 *
42488
 * This function is rarely useful, since it is easier to access the value
42489
 * directly through the "ca_cert" member in ovsrec_ssl. */
42490
const struct ovsdb_datum *
42491
ovsrec_ssl_get_ca_cert(const struct ovsrec_ssl *row,
42492
  enum ovsdb_atomic_type key_type OVS_UNUSED)
42493
0
{
42494
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
42495
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_ca_cert);
42496
0
}
42497
42498
/* Returns the "certificate" column's value from the "SSL" table in 'row'
42499
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
42500
 * ovsdb_datum_find_key() is an easier and more efficient way to search
42501
 * for a given key than implementing the same operation on the "cooked"
42502
 * form in 'row'.
42503
 *
42504
 * 'key_type' must be OVSDB_TYPE_STRING.
42505
 * (This helps to avoid silent bugs if someone changes certificate's
42506
 * type without updating the caller.)
42507
 *
42508
 * The caller must not modify or free the returned value.
42509
 *
42510
 * Various kinds of changes can invalidate the returned value: modifying
42511
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
42512
 * If the returned value is needed for a long time, it is best to make a copy
42513
 * of it with ovsdb_datum_clone().
42514
 *
42515
 * This function is rarely useful, since it is easier to access the value
42516
 * directly through the "certificate" member in ovsrec_ssl. */
42517
const struct ovsdb_datum *
42518
ovsrec_ssl_get_certificate(const struct ovsrec_ssl *row,
42519
  enum ovsdb_atomic_type key_type OVS_UNUSED)
42520
0
{
42521
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
42522
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_certificate);
42523
0
}
42524
42525
/* Returns the "external_ids" column's value from the "SSL" table in 'row'
42526
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
42527
 * ovsdb_datum_find_key() is an easier and more efficient way to search
42528
 * for a given key than implementing the same operation on the "cooked"
42529
 * form in 'row'.
42530
 *
42531
 * 'key_type' must be OVSDB_TYPE_STRING.
42532
 * 'value_type' must be OVSDB_TYPE_STRING.
42533
 * (This helps to avoid silent bugs if someone changes external_ids's
42534
 * type without updating the caller.)
42535
 *
42536
 * The caller must not modify or free the returned value.
42537
 *
42538
 * Various kinds of changes can invalidate the returned value: modifying
42539
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
42540
 * If the returned value is needed for a long time, it is best to make a copy
42541
 * of it with ovsdb_datum_clone().
42542
 *
42543
 * This function is rarely useful, since it is easier to access the value
42544
 * directly through the "external_ids" member in ovsrec_ssl. */
42545
const struct ovsdb_datum *
42546
ovsrec_ssl_get_external_ids(const struct ovsrec_ssl *row,
42547
  enum ovsdb_atomic_type key_type OVS_UNUSED,
42548
  enum ovsdb_atomic_type value_type OVS_UNUSED)
42549
0
{
42550
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
42551
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
42552
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_external_ids);
42553
0
}
42554
42555
/* Returns the "private_key" column's value from the "SSL" table in 'row'
42556
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
42557
 * ovsdb_datum_find_key() is an easier and more efficient way to search
42558
 * for a given key than implementing the same operation on the "cooked"
42559
 * form in 'row'.
42560
 *
42561
 * 'key_type' must be OVSDB_TYPE_STRING.
42562
 * (This helps to avoid silent bugs if someone changes private_key's
42563
 * type without updating the caller.)
42564
 *
42565
 * The caller must not modify or free the returned value.
42566
 *
42567
 * Various kinds of changes can invalidate the returned value: modifying
42568
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
42569
 * If the returned value is needed for a long time, it is best to make a copy
42570
 * of it with ovsdb_datum_clone().
42571
 *
42572
 * This function is rarely useful, since it is easier to access the value
42573
 * directly through the "private_key" member in ovsrec_ssl. */
42574
const struct ovsdb_datum *
42575
ovsrec_ssl_get_private_key(const struct ovsrec_ssl *row,
42576
  enum ovsdb_atomic_type key_type OVS_UNUSED)
42577
0
{
42578
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
42579
0
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_private_key);
42580
0
}
42581
42582
/* Sets the "bootstrap_ca_cert" column from the "SSL" table in 'row' to
42583
 * 'bootstrap_ca_cert'.
42584
 *
42585
 * The caller retains ownership of the arguments. */
42586
void
42587
ovsrec_ssl_set_bootstrap_ca_cert(const struct ovsrec_ssl *row, bool bootstrap_ca_cert)
42588
0
{
42589
0
    struct ovsdb_datum datum;
42590
42591
0
    datum.refcnt = NULL;
42592
42593
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
42594
42595
0
    datum.n = 1;
42596
0
    datum.keys = key;
42597
0
    key->boolean = bootstrap_ca_cert;
42598
0
    datum.values = NULL;
42599
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ssl_col_bootstrap_ca_cert, &datum);
42600
0
}
42601
42602
/* Sets the "ca_cert" column from the "SSL" table in 'row' to
42603
 * 'ca_cert'.
42604
 *
42605
 * The caller retains ownership of the arguments. */
42606
void
42607
ovsrec_ssl_set_ca_cert(const struct ovsrec_ssl *row, const char *ca_cert)
42608
0
{
42609
0
    struct ovsdb_datum datum;
42610
42611
0
    datum.refcnt = NULL;
42612
42613
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
42614
42615
0
    datum.n = 1;
42616
0
    datum.keys = key;
42617
0
    key->s = ovsdb_atom_string_create(ca_cert);
42618
0
    datum.values = NULL;
42619
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ssl_col_ca_cert, &datum);
42620
0
}
42621
42622
/* Sets the "certificate" column from the "SSL" table in 'row' to
42623
 * 'certificate'.
42624
 *
42625
 * The caller retains ownership of the arguments. */
42626
void
42627
ovsrec_ssl_set_certificate(const struct ovsrec_ssl *row, const char *certificate)
42628
0
{
42629
0
    struct ovsdb_datum datum;
42630
42631
0
    datum.refcnt = NULL;
42632
42633
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
42634
42635
0
    datum.n = 1;
42636
0
    datum.keys = key;
42637
0
    key->s = ovsdb_atom_string_create(certificate);
42638
0
    datum.values = NULL;
42639
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ssl_col_certificate, &datum);
42640
0
}
42641
42642
/* Sets the "external_ids" column's value from the "SSL" table in 'row'
42643
 * to 'external_ids'.
42644
 *
42645
 * The caller retains ownership of 'external_ids' and everything in it. */
42646
void
42647
ovsrec_ssl_set_external_ids(const struct ovsrec_ssl *row, const struct smap *external_ids)
42648
0
{
42649
0
    struct ovsdb_datum datum;
42650
42651
0
    if (external_ids) {
42652
0
        ovsdb_datum_from_smap(&datum, external_ids);
42653
0
    } else {
42654
0
        ovsdb_datum_init_empty(&datum);
42655
0
    }
42656
0
    ovsdb_idl_txn_write(&row->header_,
42657
0
                        &ovsrec_ssl_col_external_ids,
42658
0
                        &datum);
42659
0
}
42660
42661
42662
/* Sets the "private_key" column from the "SSL" table in 'row' to
42663
 * 'private_key'.
42664
 *
42665
 * The caller retains ownership of the arguments. */
42666
void
42667
ovsrec_ssl_set_private_key(const struct ovsrec_ssl *row, const char *private_key)
42668
0
{
42669
0
    struct ovsdb_datum datum;
42670
42671
0
    datum.refcnt = NULL;
42672
42673
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
42674
42675
0
    datum.n = 1;
42676
0
    datum.keys = key;
42677
0
    key->s = ovsdb_atom_string_create(private_key);
42678
0
    datum.values = NULL;
42679
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ssl_col_private_key, &datum);
42680
0
}
42681
42682
/* Sets an element of the "external_ids" map column from the "SSL" table in 'row'
42683
 * to 'new_value' given the key value 'new_key'.
42684
 *
42685
 */
42686
void
42687
ovsrec_ssl_update_external_ids_setkey(const struct ovsrec_ssl *row, const char *new_key, const char *new_value)
42688
0
{
42689
0
    struct ovsdb_datum *datum;
42690
42691
0
    datum = xmalloc(sizeof *datum);
42692
0
    datum->n = 1;
42693
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42694
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
42695
0
    datum->refcnt = NULL;
42696
42697
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
42698
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
42699
42700
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
42701
0
                                    &ovsrec_ssl_col_external_ids,
42702
0
                                    datum);
42703
0
}
42704
42705
/* Deletes an element of the "external_ids" map column from the "SSL" table in 'row'
42706
 * given the key value 'delete_key'.
42707
 *
42708
 */
42709
void
42710
ovsrec_ssl_update_external_ids_delkey(const struct ovsrec_ssl *row, const char *delete_key)
42711
0
{
42712
0
    struct ovsdb_datum *datum;
42713
42714
0
    datum = xmalloc(sizeof *datum);
42715
0
    datum->n = 1;
42716
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42717
0
    datum->values = NULL;
42718
0
    datum->refcnt = NULL;
42719
42720
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
42721
42722
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
42723
0
                                    &ovsrec_ssl_col_external_ids,
42724
0
                                    datum);
42725
0
}
42726
42727
/* Sets the "bootstrap_ca_cert" column from the "SSL" table in 'row' to
42728
 * 'bootstrap_ca_cert'.
42729
 *
42730
 * The caller retains ownership of the arguments. */
42731
void
42732
ovsrec_ssl_add_clause_bootstrap_ca_cert(struct ovsdb_idl_condition *cond, enum ovsdb_function function, bool bootstrap_ca_cert)
42733
0
{
42734
0
    struct ovsdb_datum datum;
42735
42736
0
    datum.refcnt = NULL;
42737
42738
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
42739
42740
0
    datum.n = 1;
42741
0
    datum.keys = key;
42742
0
    key->boolean = bootstrap_ca_cert;
42743
0
    datum.values = NULL;
42744
0
    ovsdb_idl_condition_add_clause(cond,
42745
0
                          function,
42746
0
                          &ovsrec_ssl_col_bootstrap_ca_cert,
42747
0
                          &datum);
42748
0
    ovsdb_datum_destroy(&datum, &ovsrec_ssl_col_bootstrap_ca_cert.type);
42749
0
}
42750
42751
/* Sets the "ca_cert" column from the "SSL" table in 'row' to
42752
 * 'ca_cert'.
42753
 *
42754
 * The caller retains ownership of the arguments. */
42755
void
42756
ovsrec_ssl_add_clause_ca_cert(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *ca_cert)
42757
0
{
42758
0
    struct ovsdb_datum datum;
42759
42760
0
    datum.refcnt = NULL;
42761
42762
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
42763
42764
0
    datum.n = 1;
42765
0
    datum.keys = key;
42766
0
    key->s = ovsdb_atom_string_create(ca_cert);
42767
0
    datum.values = NULL;
42768
0
    ovsdb_idl_condition_add_clause(cond,
42769
0
                          function,
42770
0
                          &ovsrec_ssl_col_ca_cert,
42771
0
                          &datum);
42772
0
    ovsdb_datum_destroy(&datum, &ovsrec_ssl_col_ca_cert.type);
42773
0
}
42774
42775
/* Sets the "certificate" column from the "SSL" table in 'row' to
42776
 * 'certificate'.
42777
 *
42778
 * The caller retains ownership of the arguments. */
42779
void
42780
ovsrec_ssl_add_clause_certificate(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *certificate)
42781
0
{
42782
0
    struct ovsdb_datum datum;
42783
42784
0
    datum.refcnt = NULL;
42785
42786
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
42787
42788
0
    datum.n = 1;
42789
0
    datum.keys = key;
42790
0
    key->s = ovsdb_atom_string_create(certificate);
42791
0
    datum.values = NULL;
42792
0
    ovsdb_idl_condition_add_clause(cond,
42793
0
                          function,
42794
0
                          &ovsrec_ssl_col_certificate,
42795
0
                          &datum);
42796
0
    ovsdb_datum_destroy(&datum, &ovsrec_ssl_col_certificate.type);
42797
0
}
42798
42799
/* Sets the "external_ids" column's value from the "SSL" table in 'row'
42800
 * to 'external_ids'.
42801
 *
42802
 * The caller retains ownership of 'external_ids' and everything in it. */
42803
void
42804
ovsrec_ssl_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
42805
0
{
42806
0
    struct ovsdb_datum datum;
42807
42808
0
    if (external_ids) {
42809
0
        ovsdb_datum_from_smap(&datum, external_ids);
42810
0
    } else {
42811
0
        ovsdb_datum_init_empty(&datum);
42812
0
    }
42813
42814
0
    ovsdb_idl_condition_add_clause(cond,
42815
0
                                   function,
42816
0
                                   &ovsrec_ssl_col_external_ids,
42817
0
                                   &datum);
42818
42819
0
    ovsdb_datum_destroy(&datum, &ovsrec_ssl_col_external_ids.type);
42820
0
}
42821
42822
42823
/* Sets the "private_key" column from the "SSL" table in 'row' to
42824
 * 'private_key'.
42825
 *
42826
 * The caller retains ownership of the arguments. */
42827
void
42828
ovsrec_ssl_add_clause_private_key(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *private_key)
42829
0
{
42830
0
    struct ovsdb_datum datum;
42831
42832
0
    datum.refcnt = NULL;
42833
42834
0
    union ovsdb_atom *key = xmalloc(sizeof *key);
42835
42836
0
    datum.n = 1;
42837
0
    datum.keys = key;
42838
0
    key->s = ovsdb_atom_string_create(private_key);
42839
0
    datum.values = NULL;
42840
0
    ovsdb_idl_condition_add_clause(cond,
42841
0
                          function,
42842
0
                          &ovsrec_ssl_col_private_key,
42843
0
                          &datum);
42844
0
    ovsdb_datum_destroy(&datum, &ovsrec_ssl_col_private_key.type);
42845
0
}
42846
42847
/* Destroy 'row' of kind "SSL". The row must have been
42848
 * created with ovsdb_idl_index_init_row.
42849
 */
42850
void
42851
ovsrec_ssl_index_destroy_row(const struct ovsrec_ssl *row)
42852
0
{
42853
0
    ovsdb_idl_index_destroy_row(&row->header_);
42854
0
}
42855
        
42856
42857
/* Creates a new row of kind "SSL". */
42858
struct ovsrec_ssl *
42859
ovsrec_ssl_index_init_row(struct ovsdb_idl_index *index)
42860
0
{
42861
0
    ovs_assert(index->table->class_ == &ovsrec_table_ssl);
42862
0
    return ALIGNED_CAST(struct ovsrec_ssl *, ovsdb_idl_index_init_row(index));
42863
0
}
42864
42865
struct ovsrec_ssl *
42866
ovsrec_ssl_index_find(struct ovsdb_idl_index *index, const struct ovsrec_ssl *target)
42867
0
{
42868
0
    ovs_assert(index->table->class_ == &ovsrec_table_ssl);
42869
0
    return ovsrec_ssl_cast(ovsdb_idl_index_find(index, &target->header_));
42870
0
}
42871
42872
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
42873
int
42874
ovsrec_ssl_index_compare(
42875
    struct ovsdb_idl_index *index, 
42876
    const struct ovsrec_ssl *a, 
42877
    const struct ovsrec_ssl *b)
42878
0
{
42879
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
42880
0
}
42881
42882
struct ovsdb_idl_cursor
42883
ovsrec_ssl_cursor_first(struct ovsdb_idl_index *index)
42884
0
{
42885
0
    ovs_assert(index->table->class_ == &ovsrec_table_ssl);
42886
0
    return ovsdb_idl_cursor_first(index);
42887
0
}
42888
42889
struct ovsdb_idl_cursor
42890
ovsrec_ssl_cursor_first_eq(
42891
    struct ovsdb_idl_index *index, const struct ovsrec_ssl *target)
42892
0
{
42893
0
    ovs_assert(index->table->class_ == &ovsrec_table_ssl);
42894
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
42895
0
}
42896
42897
struct ovsdb_idl_cursor
42898
ovsrec_ssl_cursor_first_ge(
42899
    struct ovsdb_idl_index *index, const struct ovsrec_ssl *target)
42900
0
{
42901
0
    ovs_assert(index->table->class_ == &ovsrec_table_ssl);
42902
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
42903
0
}
42904
42905
struct ovsrec_ssl *
42906
ovsrec_ssl_cursor_data(struct ovsdb_idl_cursor *cursor)
42907
0
{
42908
0
    return ovsrec_ssl_cast(ovsdb_idl_cursor_data(cursor));
42909
0
}
42910
42911
42912
/* Sets the "bootstrap_ca_cert" column from the "SSL" table in 'row' to
42913
 * 'bootstrap_ca_cert'.
42914
 *
42915
 * The caller retains ownership of the arguments. */
42916
void
42917
ovsrec_ssl_index_set_bootstrap_ca_cert(const struct ovsrec_ssl *row, bool bootstrap_ca_cert)
42918
0
{
42919
0
    struct ovsdb_datum datum;
42920
42921
0
    datum.refcnt = NULL;
42922
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
42923
42924
0
    datum.n = 1;
42925
0
    datum.keys = key;
42926
0
    key->boolean = bootstrap_ca_cert;
42927
0
    datum.values = NULL;
42928
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]);
42929
0
}
42930
42931
/* Sets the "ca_cert" column from the "SSL" table in 'row' to
42932
 * 'ca_cert'.
42933
 *
42934
 * The caller retains ownership of the arguments. */
42935
void
42936
ovsrec_ssl_index_set_ca_cert(const struct ovsrec_ssl *row, const char *ca_cert)
42937
0
{
42938
0
    struct ovsdb_datum datum;
42939
42940
0
    datum.refcnt = NULL;
42941
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
42942
42943
0
    datum.n = 1;
42944
0
    datum.keys = key;
42945
0
    key->s = ovsdb_atom_string_create(ca_cert);
42946
0
    datum.values = NULL;
42947
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]);
42948
0
}
42949
42950
/* Sets the "certificate" column from the "SSL" table in 'row' to
42951
 * 'certificate'.
42952
 *
42953
 * The caller retains ownership of the arguments. */
42954
void
42955
ovsrec_ssl_index_set_certificate(const struct ovsrec_ssl *row, const char *certificate)
42956
0
{
42957
0
    struct ovsdb_datum datum;
42958
42959
0
    datum.refcnt = NULL;
42960
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
42961
42962
0
    datum.n = 1;
42963
0
    datum.keys = key;
42964
0
    key->s = ovsdb_atom_string_create(certificate);
42965
0
    datum.values = NULL;
42966
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]);
42967
0
}
42968
42969
/* Sets the "external_ids" column's value from the "SSL" table in 'row'
42970
 * to 'external_ids'.
42971
 *
42972
 * The caller retains ownership of 'external_ids' and everything in it. */
42973
void
42974
ovsrec_ssl_index_set_external_ids(const struct ovsrec_ssl *row, const struct smap *external_ids)
42975
0
{
42976
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
42977
42978
0
    if (external_ids) {
42979
0
        struct smap_node *node;
42980
0
        size_t i;
42981
42982
0
        datum->n = smap_count(external_ids);
42983
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
42984
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
42985
0
        datum->refcnt = NULL;
42986
42987
0
        i = 0;
42988
0
        SMAP_FOR_EACH (node, external_ids) {
42989
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
42990
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
42991
0
            i++;
42992
0
        }
42993
0
        ovsdb_datum_sort_unique(datum, &ovsrec_ssl_col_external_ids.type);
42994
0
    } else {
42995
0
        ovsdb_datum_init_empty(datum);
42996
0
    }
42997
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
42998
0
                          &ovsrec_ssl_columns[OVSREC_SSL_COL_EXTERNAL_IDS],
42999
0
                          datum,
43000
0
                          &ovsrec_table_classes[OVSREC_TABLE_SSL]);
43001
0
    free(datum);
43002
0
}
43003
43004
43005
/* Sets the "private_key" column from the "SSL" table in 'row' to
43006
 * 'private_key'.
43007
 *
43008
 * The caller retains ownership of the arguments. */
43009
void
43010
ovsrec_ssl_index_set_private_key(const struct ovsrec_ssl *row, const char *private_key)
43011
0
{
43012
0
    struct ovsdb_datum datum;
43013
43014
0
    datum.refcnt = NULL;
43015
0
    union ovsdb_atom *key = xmalloc(sizeof(union ovsdb_atom));
43016
43017
0
    datum.n = 1;
43018
0
    datum.keys = key;
43019
0
    key->s = ovsdb_atom_string_create(private_key);
43020
0
    datum.values = NULL;
43021
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]);
43022
0
}
43023
43024
struct ovsdb_idl_column ovsrec_ssl_columns[OVSREC_SSL_N_COLUMNS];
43025
43026
unsigned int
43027
ovsrec_ssl_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
43028
0
{
43029
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_ssl, condition);
43030
0
}
43031
43032
struct ovsdb_idl_column ovsrec_ssl_columns[OVSREC_SSL_N_COLUMNS] = {
43033
    [OVSREC_SSL_COL_BOOTSTRAP_CA_CERT] = {
43034
         .name = "bootstrap_ca_cert",
43035
         .type = {
43036
            .key = {
43037
               .type = OVSDB_TYPE_BOOLEAN,
43038
            },
43039
            .value = OVSDB_BASE_VOID_INIT,
43040
            .n_min = 1,
43041
            .n_max = 1,
43042
         },
43043
         .is_mutable = true,
43044
         .is_synthetic = false,
43045
         .parse = ovsrec_ssl_parse_bootstrap_ca_cert,
43046
         .unparse = ovsrec_ssl_unparse_bootstrap_ca_cert,
43047
    },
43048
43049
    [OVSREC_SSL_COL_CA_CERT] = {
43050
         .name = "ca_cert",
43051
         .type = {
43052
            .key = {
43053
               .type = OVSDB_TYPE_STRING,
43054
               .string = { .minLen = 0, .maxLen = UINT_MAX },
43055
            },
43056
            .value = OVSDB_BASE_VOID_INIT,
43057
            .n_min = 1,
43058
            .n_max = 1,
43059
         },
43060
         .is_mutable = true,
43061
         .is_synthetic = false,
43062
         .parse = ovsrec_ssl_parse_ca_cert,
43063
         .unparse = ovsrec_ssl_unparse_ca_cert,
43064
    },
43065
43066
    [OVSREC_SSL_COL_CERTIFICATE] = {
43067
         .name = "certificate",
43068
         .type = {
43069
            .key = {
43070
               .type = OVSDB_TYPE_STRING,
43071
               .string = { .minLen = 0, .maxLen = UINT_MAX },
43072
            },
43073
            .value = OVSDB_BASE_VOID_INIT,
43074
            .n_min = 1,
43075
            .n_max = 1,
43076
         },
43077
         .is_mutable = true,
43078
         .is_synthetic = false,
43079
         .parse = ovsrec_ssl_parse_certificate,
43080
         .unparse = ovsrec_ssl_unparse_certificate,
43081
    },
43082
43083
    [OVSREC_SSL_COL_EXTERNAL_IDS] = {
43084
         .name = "external_ids",
43085
         .type = {
43086
            .key = {
43087
               .type = OVSDB_TYPE_STRING,
43088
               .string = { .minLen = 0, .maxLen = UINT_MAX },
43089
            },
43090
            .value = {
43091
                .type = OVSDB_TYPE_STRING,
43092
                .string = { .minLen = 0, .maxLen = UINT_MAX },
43093
            },
43094
            .n_min = 0,
43095
            .n_max = UINT_MAX,
43096
         },
43097
         .is_mutable = true,
43098
         .is_synthetic = false,
43099
         .parse = ovsrec_ssl_parse_external_ids,
43100
         .unparse = ovsrec_ssl_unparse_external_ids,
43101
    },
43102
43103
    [OVSREC_SSL_COL_PRIVATE_KEY] = {
43104
         .name = "private_key",
43105
         .type = {
43106
            .key = {
43107
               .type = OVSDB_TYPE_STRING,
43108
               .string = { .minLen = 0, .maxLen = UINT_MAX },
43109
            },
43110
            .value = OVSDB_BASE_VOID_INIT,
43111
            .n_min = 1,
43112
            .n_max = 1,
43113
         },
43114
         .is_mutable = true,
43115
         .is_synthetic = false,
43116
         .parse = ovsrec_ssl_parse_private_key,
43117
         .unparse = ovsrec_ssl_unparse_private_key,
43118
    },
43119
43120
};
43121

43122
/* sFlow table. */
43123
43124
bool
43125
ovsrec_server_has_sflow_table_col_agent(const struct ovsdb_idl *idl)
43126
0
{
43127
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_agent);
43128
0
}
43129
43130
43131
bool
43132
ovsrec_server_has_sflow_table_col_external_ids(const struct ovsdb_idl *idl)
43133
0
{
43134
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_external_ids);
43135
0
}
43136
43137
43138
bool
43139
ovsrec_server_has_sflow_table_col_header(const struct ovsdb_idl *idl)
43140
0
{
43141
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_header);
43142
0
}
43143
43144
43145
bool
43146
ovsrec_server_has_sflow_table_col_polling(const struct ovsdb_idl *idl)
43147
0
{
43148
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_polling);
43149
0
}
43150
43151
43152
bool
43153
ovsrec_server_has_sflow_table_col_sampling(const struct ovsdb_idl *idl)
43154
0
{
43155
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_sampling);
43156
0
}
43157
43158
43159
bool
43160
ovsrec_server_has_sflow_table_col_targets(const struct ovsdb_idl *idl)
43161
0
{
43162
0
    return ovsdb_idl_server_has_column(idl, &ovsrec_sflow_col_targets);
43163
0
}
43164
43165
43166
bool
43167
ovsrec_server_has_sflow_table(const struct ovsdb_idl *idl)
43168
0
{
43169
0
    return ovsdb_idl_server_has_table(idl, &ovsrec_table_classes[OVSREC_TABLE_SFLOW]);
43170
0
}
43171
43172
43173
const struct ovsrec_sflow_table *
43174
ovsrec_sflow_table_get(const struct ovsdb_idl *idl)
43175
0
{
43176
0
    return (const struct ovsrec_sflow_table *) idl;
43177
0
}
43178
43179
const struct ovsrec_sflow *
43180
ovsrec_sflow_table_first(const struct ovsrec_sflow_table *table)
43181
0
{
43182
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
43183
0
    return ovsrec_sflow_first(idl);
43184
0
}
43185
43186
43187
const struct ovsrec_sflow *
43188
ovsrec_sflow_table_track_get_first(const struct ovsrec_sflow_table *table)
43189
0
{
43190
0
    const struct ovsdb_idl *idl =  (const struct ovsdb_idl *) table;
43191
0
    return ovsrec_sflow_track_get_first(idl);
43192
0
}
43193
43194
43195
static void
43196
ovsrec_sflow_parse_agent(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
43197
0
{
43198
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43199
43200
0
    if (datum->n >= 1) {
43201
0
        row->agent = datum->keys[0].s->string;
43202
0
    } else {
43203
0
        row->agent = NULL;
43204
0
    }
43205
0
}
43206
43207
static void
43208
ovsrec_sflow_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
43209
0
{
43210
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43211
0
    smap_init(&row->external_ids);
43212
0
    for (size_t i = 0; i < datum->n; i++) {
43213
0
        smap_add(&row->external_ids,
43214
0
                 json_string(datum->keys[i].s),
43215
0
                 json_string(datum->values[i].s));
43216
0
    }
43217
0
}
43218
43219
static void
43220
ovsrec_sflow_parse_header(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
43221
0
{
43222
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43223
0
    size_t n = MIN(1, datum->n);
43224
0
    row->header = NULL;
43225
0
    row->n_header = 0;
43226
0
    for (size_t i = 0; i < n; i++) {
43227
0
        if (!row->n_header) {
43228
0
            row->header = xmalloc(n * sizeof *row->header);
43229
0
        }
43230
0
        row->header[row->n_header] = datum->keys[i].integer;
43231
0
        row->n_header++;
43232
0
    }
43233
0
}
43234
43235
static void
43236
ovsrec_sflow_parse_polling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
43237
0
{
43238
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43239
0
    size_t n = MIN(1, datum->n);
43240
0
    row->polling = NULL;
43241
0
    row->n_polling = 0;
43242
0
    for (size_t i = 0; i < n; i++) {
43243
0
        if (!row->n_polling) {
43244
0
            row->polling = xmalloc(n * sizeof *row->polling);
43245
0
        }
43246
0
        row->polling[row->n_polling] = datum->keys[i].integer;
43247
0
        row->n_polling++;
43248
0
    }
43249
0
}
43250
43251
static void
43252
ovsrec_sflow_parse_sampling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
43253
0
{
43254
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43255
0
    size_t n = MIN(1, datum->n);
43256
0
    row->sampling = NULL;
43257
0
    row->n_sampling = 0;
43258
0
    for (size_t i = 0; i < n; i++) {
43259
0
        if (!row->n_sampling) {
43260
0
            row->sampling = xmalloc(n * sizeof *row->sampling);
43261
0
        }
43262
0
        row->sampling[row->n_sampling] = datum->keys[i].integer;
43263
0
        row->n_sampling++;
43264
0
    }
43265
0
}
43266
43267
static void
43268
ovsrec_sflow_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
43269
0
{
43270
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43271
0
    row->targets = NULL;
43272
0
    row->n_targets = 0;
43273
0
    for (size_t i = 0; i < datum->n; i++) {
43274
0
        if (!row->n_targets) {
43275
0
            row->targets = xmalloc(datum->n * sizeof *row->targets);
43276
0
        }
43277
0
        row->targets[row->n_targets] = datum->keys[i].s->string;
43278
0
        row->n_targets++;
43279
0
    }
43280
0
}
43281
43282
static void
43283
ovsrec_sflow_unparse_agent(struct ovsdb_idl_row *row OVS_UNUSED)
43284
0
{
43285
    /* Nothing to do. */
43286
0
}
43287
43288
static void
43289
ovsrec_sflow_unparse_external_ids(struct ovsdb_idl_row *row_)
43290
0
{
43291
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43292
0
    smap_destroy(&row->external_ids);
43293
0
}
43294
43295
static void
43296
ovsrec_sflow_unparse_header(struct ovsdb_idl_row *row_)
43297
0
{
43298
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43299
0
    free(row->header);
43300
0
}
43301
43302
static void
43303
ovsrec_sflow_unparse_polling(struct ovsdb_idl_row *row_)
43304
0
{
43305
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43306
0
    free(row->polling);
43307
0
}
43308
43309
static void
43310
ovsrec_sflow_unparse_sampling(struct ovsdb_idl_row *row_)
43311
0
{
43312
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43313
0
    free(row->sampling);
43314
0
}
43315
43316
static void
43317
ovsrec_sflow_unparse_targets(struct ovsdb_idl_row *row_)
43318
0
{
43319
0
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
43320
0
    free(row->targets);
43321
0
}
43322
43323
static void
43324
ovsrec_sflow_init__(struct ovsdb_idl_row *row)
43325
0
{
43326
0
    ovsrec_sflow_init(ovsrec_sflow_cast(row));
43327
0
}
43328
43329
/* Clears the contents of 'row' in table "sFlow". */
43330
void
43331
ovsrec_sflow_init(struct ovsrec_sflow *row)
43332
0
{
43333
0
    memset(row, 0, sizeof *row); 
43334
0
    smap_init(&row->external_ids);
43335
0
}
43336
43337
/* Searches table "sFlow" in 'idl' for a row with UUID 'uuid'.  Returns
43338
 * a pointer to the row if there is one, otherwise a null pointer.  */
43339
const struct ovsrec_sflow *
43340
ovsrec_sflow_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
43341
0
{
43342
0
    return ovsrec_sflow_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_sflow, uuid));
43343
0
}
43344
43345
/* Searches table "sFlow" for a row with UUID 'uuid'.  Returns
43346
 * a pointer to the row if there is one, otherwise a null pointer.  */
43347
const struct ovsrec_sflow *
43348
ovsrec_sflow_table_get_for_uuid(const struct ovsrec_sflow_table *table, const struct uuid *uuid)
43349
0
{
43350
0
    const struct ovsdb_idl *idl = (const struct ovsdb_idl *) table;
43351
0
    return ovsrec_sflow_get_for_uuid(idl, uuid);
43352
0
}
43353
43354
/* Returns a row in table "sFlow" in 'idl', or a null pointer if that
43355
 * table is empty.
43356
 *
43357
 * Database tables are internally maintained as hash tables, so adding or
43358
 * removing rows while traversing the same table can cause some rows to be
43359
 * visited twice or not at apply. */
43360
const struct ovsrec_sflow *
43361
ovsrec_sflow_first(const struct ovsdb_idl *idl)
43362
0
{
43363
0
    return ovsrec_sflow_cast(ovsdb_idl_first_row(idl, &ovsrec_table_sflow));
43364
0
}
43365
43366
/* Returns a row following 'row' within its table, or a null pointer if 'row'
43367
 * is the last row in its table. */
43368
const struct ovsrec_sflow *
43369
ovsrec_sflow_next(const struct ovsrec_sflow *row)
43370
0
{
43371
0
    return ovsrec_sflow_cast(ovsdb_idl_next_row(&row->header_));
43372
0
}
43373
43374
unsigned int ovsrec_sflow_get_seqno(const struct ovsdb_idl *idl)
43375
0
{
43376
0
    return ovsdb_idl_table_get_seqno(idl, &ovsrec_table_sflow);
43377
0
}
43378
43379
unsigned int ovsrec_sflow_row_get_seqno(const struct ovsrec_sflow *row, enum ovsdb_idl_change change)
43380
0
{
43381
0
    return ovsdb_idl_row_get_seqno(&row->header_, change);
43382
0
}
43383
43384
const struct ovsrec_sflow *
43385
ovsrec_sflow_track_get_first(const struct ovsdb_idl *idl)
43386
0
{
43387
0
    return ovsrec_sflow_cast(ovsdb_idl_track_get_first(idl, &ovsrec_table_sflow));
43388
0
}
43389
43390
const struct ovsrec_sflow
43391
*ovsrec_sflow_track_get_next(const struct ovsrec_sflow *row)
43392
0
{
43393
0
    return ovsrec_sflow_cast(ovsdb_idl_track_get_next(&row->header_));
43394
0
}
43395
43396
43397
/* Deletes 'row' from table "sFlow".  'row' may be freed, so it must not be
43398
 * accessed afterward.
43399
 *
43400
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43401
void
43402
ovsrec_sflow_delete(const struct ovsrec_sflow *row)
43403
0
{
43404
0
    ovsdb_idl_txn_delete(&row->header_);
43405
0
}
43406
43407
/* Inserts and returns a new row in the table "sFlow" in the database
43408
 * with open transaction 'txn'.
43409
 *
43410
 * The new row is assigned a randomly generated provisional UUID.
43411
 * ovsdb-server will assign a different UUID when 'txn' is committed,
43412
 * but the IDL will replace any uses of the provisional UUID in the
43413
 * data to be to be committed by the UUID assigned by ovsdb-server. */
43414
struct ovsrec_sflow *
43415
ovsrec_sflow_insert(struct ovsdb_idl_txn *txn)
43416
0
{
43417
0
    return ovsrec_sflow_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_sflow, NULL));
43418
0
}
43419
43420
/* Inserts and returns a new row in the table "sFlow" in the database
43421
 * with open transaction 'txn'.
43422
 *
43423
 * The new row is assigned the UUID specified in the 'uuid' parameter
43424
 * (which cannot be null).  ovsdb-server will try to assign the same
43425
 * UUID when 'txn' is committed. */
43426
struct ovsrec_sflow *
43427
ovsrec_sflow_insert_persist_uuid(struct ovsdb_idl_txn *txn, const struct uuid *uuid)
43428
0
{
43429
0
    return ovsrec_sflow_cast(ovsdb_idl_txn_insert_persist_uuid(
43430
0
        txn, &ovsrec_table_sflow, uuid));
43431
0
}
43432
43433
bool
43434
ovsrec_sflow_is_updated(const struct ovsrec_sflow *row, enum ovsrec_sflow_column_id column)
43435
0
{
43436
0
    return ovsdb_idl_track_is_updated(&row->header_, &ovsrec_sflow_columns[column]);
43437
0
}
43438
43439
/* Causes the original contents of column "agent" in 'row' to be
43440
 * verified as a prerequisite to completing the transaction.  That is, if
43441
 * "agent" in 'row' changed (or if 'row' was deleted) between the
43442
 * time that the IDL originally read its contents and the time that the
43443
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
43444
 *
43445
 * The intention is that, to ensure that no transaction commits based on dirty
43446
 * reads, an application should call this function any time "agent" is
43447
 * read as part of a read-modify-write operation.
43448
 *
43449
 * In some cases this function reduces to a no-op, because the current value
43450
 * of "agent" is already known:
43451
 *
43452
 *   - If 'row' is a row created by the current transaction (returned by
43453
 *     ovsrec_sflow_insert()).
43454
 *
43455
 *   - If "agent" has already been modified (with
43456
 *     ovsrec_sflow_set_agent()) within the current transaction.
43457
 *
43458
 * Because of the latter property, always call this function *before*
43459
 * ovsrec_sflow_set_agent() for a given read-modify-write.
43460
 *
43461
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43462
void
43463
ovsrec_sflow_verify_agent(const struct ovsrec_sflow *row)
43464
0
{
43465
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_agent);
43466
0
}
43467
43468
/* Causes the original contents of column "external_ids" in 'row' to be
43469
 * verified as a prerequisite to completing the transaction.  That is, if
43470
 * "external_ids" in 'row' changed (or if 'row' was deleted) between the
43471
 * time that the IDL originally read its contents and the time that the
43472
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
43473
 *
43474
 * The intention is that, to ensure that no transaction commits based on dirty
43475
 * reads, an application should call this function any time "external_ids" is
43476
 * read as part of a read-modify-write operation.
43477
 *
43478
 * In some cases this function reduces to a no-op, because the current value
43479
 * of "external_ids" is already known:
43480
 *
43481
 *   - If 'row' is a row created by the current transaction (returned by
43482
 *     ovsrec_sflow_insert()).
43483
 *
43484
 *   - If "external_ids" has already been modified (with
43485
 *     ovsrec_sflow_set_external_ids()) within the current transaction.
43486
 *
43487
 * Because of the latter property, always call this function *before*
43488
 * ovsrec_sflow_set_external_ids() for a given read-modify-write.
43489
 *
43490
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43491
void
43492
ovsrec_sflow_verify_external_ids(const struct ovsrec_sflow *row)
43493
0
{
43494
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_external_ids);
43495
0
}
43496
43497
/* Causes the original contents of column "header" in 'row' to be
43498
 * verified as a prerequisite to completing the transaction.  That is, if
43499
 * "header" in 'row' changed (or if 'row' was deleted) between the
43500
 * time that the IDL originally read its contents and the time that the
43501
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
43502
 *
43503
 * The intention is that, to ensure that no transaction commits based on dirty
43504
 * reads, an application should call this function any time "header" is
43505
 * read as part of a read-modify-write operation.
43506
 *
43507
 * In some cases this function reduces to a no-op, because the current value
43508
 * of "header" is already known:
43509
 *
43510
 *   - If 'row' is a row created by the current transaction (returned by
43511
 *     ovsrec_sflow_insert()).
43512
 *
43513
 *   - If "header" has already been modified (with
43514
 *     ovsrec_sflow_set_header()) within the current transaction.
43515
 *
43516
 * Because of the latter property, always call this function *before*
43517
 * ovsrec_sflow_set_header() for a given read-modify-write.
43518
 *
43519
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43520
void
43521
ovsrec_sflow_verify_header(const struct ovsrec_sflow *row)
43522
0
{
43523
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_header);
43524
0
}
43525
43526
/* Causes the original contents of column "polling" in 'row' to be
43527
 * verified as a prerequisite to completing the transaction.  That is, if
43528
 * "polling" in 'row' changed (or if 'row' was deleted) between the
43529
 * time that the IDL originally read its contents and the time that the
43530
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
43531
 *
43532
 * The intention is that, to ensure that no transaction commits based on dirty
43533
 * reads, an application should call this function any time "polling" is
43534
 * read as part of a read-modify-write operation.
43535
 *
43536
 * In some cases this function reduces to a no-op, because the current value
43537
 * of "polling" is already known:
43538
 *
43539
 *   - If 'row' is a row created by the current transaction (returned by
43540
 *     ovsrec_sflow_insert()).
43541
 *
43542
 *   - If "polling" has already been modified (with
43543
 *     ovsrec_sflow_set_polling()) within the current transaction.
43544
 *
43545
 * Because of the latter property, always call this function *before*
43546
 * ovsrec_sflow_set_polling() for a given read-modify-write.
43547
 *
43548
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43549
void
43550
ovsrec_sflow_verify_polling(const struct ovsrec_sflow *row)
43551
0
{
43552
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_polling);
43553
0
}
43554
43555
/* Causes the original contents of column "sampling" in 'row' to be
43556
 * verified as a prerequisite to completing the transaction.  That is, if
43557
 * "sampling" in 'row' changed (or if 'row' was deleted) between the
43558
 * time that the IDL originally read its contents and the time that the
43559
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
43560
 *
43561
 * The intention is that, to ensure that no transaction commits based on dirty
43562
 * reads, an application should call this function any time "sampling" is
43563
 * read as part of a read-modify-write operation.
43564
 *
43565
 * In some cases this function reduces to a no-op, because the current value
43566
 * of "sampling" is already known:
43567
 *
43568
 *   - If 'row' is a row created by the current transaction (returned by
43569
 *     ovsrec_sflow_insert()).
43570
 *
43571
 *   - If "sampling" has already been modified (with
43572
 *     ovsrec_sflow_set_sampling()) within the current transaction.
43573
 *
43574
 * Because of the latter property, always call this function *before*
43575
 * ovsrec_sflow_set_sampling() for a given read-modify-write.
43576
 *
43577
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43578
void
43579
ovsrec_sflow_verify_sampling(const struct ovsrec_sflow *row)
43580
0
{
43581
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_sampling);
43582
0
}
43583
43584
/* Causes the original contents of column "targets" in 'row' to be
43585
 * verified as a prerequisite to completing the transaction.  That is, if
43586
 * "targets" in 'row' changed (or if 'row' was deleted) between the
43587
 * time that the IDL originally read its contents and the time that the
43588
 * transaction aborts and ovsdb_idl_txn_commit() returns TXN_TRY_AGAIN.
43589
 *
43590
 * The intention is that, to ensure that no transaction commits based on dirty
43591
 * reads, an application should call this function any time "targets" is
43592
 * read as part of a read-modify-write operation.
43593
 *
43594
 * In some cases this function reduces to a no-op, because the current value
43595
 * of "targets" is already known:
43596
 *
43597
 *   - If 'row' is a row created by the current transaction (returned by
43598
 *     ovsrec_sflow_insert()).
43599
 *
43600
 *   - If "targets" has already been modified (with
43601
 *     ovsrec_sflow_set_targets()) within the current transaction.
43602
 *
43603
 * Because of the latter property, always call this function *before*
43604
 * ovsrec_sflow_set_targets() for a given read-modify-write.
43605
 *
43606
 * The caller must have started a transaction with ovsdb_idl_txn_create(). */
43607
void
43608
ovsrec_sflow_verify_targets(const struct ovsrec_sflow *row)
43609
0
{
43610
0
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_col_targets);
43611
0
}
43612
43613
/* Returns the "agent" column's value from the "sFlow" table in 'row'
43614
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
43615
 * ovsdb_datum_find_key() is an easier and more efficient way to search
43616
 * for a given key than implementing the same operation on the "cooked"
43617
 * form in 'row'.
43618
 *
43619
 * 'key_type' must be OVSDB_TYPE_STRING.
43620
 * (This helps to avoid silent bugs if someone changes agent's
43621
 * type without updating the caller.)
43622
 *
43623
 * The caller must not modify or free the returned value.
43624
 *
43625
 * Various kinds of changes can invalidate the returned value: modifying
43626
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
43627
 * If the returned value is needed for a long time, it is best to make a copy
43628
 * of it with ovsdb_datum_clone().
43629
 *
43630
 * This function is rarely useful, since it is easier to access the value
43631
 * directly through the "agent" member in ovsrec_sflow. */
43632
const struct ovsdb_datum *
43633
ovsrec_sflow_get_agent(const struct ovsrec_sflow *row,
43634
  enum ovsdb_atomic_type key_type OVS_UNUSED)
43635
0
{
43636
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
43637
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_agent);
43638
0
}
43639
43640
/* Returns the "external_ids" column's value from the "sFlow" table in 'row'
43641
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
43642
 * ovsdb_datum_find_key() is an easier and more efficient way to search
43643
 * for a given key than implementing the same operation on the "cooked"
43644
 * form in 'row'.
43645
 *
43646
 * 'key_type' must be OVSDB_TYPE_STRING.
43647
 * 'value_type' must be OVSDB_TYPE_STRING.
43648
 * (This helps to avoid silent bugs if someone changes external_ids's
43649
 * type without updating the caller.)
43650
 *
43651
 * The caller must not modify or free the returned value.
43652
 *
43653
 * Various kinds of changes can invalidate the returned value: modifying
43654
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
43655
 * If the returned value is needed for a long time, it is best to make a copy
43656
 * of it with ovsdb_datum_clone().
43657
 *
43658
 * This function is rarely useful, since it is easier to access the value
43659
 * directly through the "external_ids" member in ovsrec_sflow. */
43660
const struct ovsdb_datum *
43661
ovsrec_sflow_get_external_ids(const struct ovsrec_sflow *row,
43662
  enum ovsdb_atomic_type key_type OVS_UNUSED,
43663
  enum ovsdb_atomic_type value_type OVS_UNUSED)
43664
0
{
43665
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
43666
0
    ovs_assert(value_type == OVSDB_TYPE_STRING);
43667
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_external_ids);
43668
0
}
43669
43670
/* Returns the "header" column's value from the "sFlow" table in 'row'
43671
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
43672
 * ovsdb_datum_find_key() is an easier and more efficient way to search
43673
 * for a given key than implementing the same operation on the "cooked"
43674
 * form in 'row'.
43675
 *
43676
 * 'key_type' must be OVSDB_TYPE_INTEGER.
43677
 * (This helps to avoid silent bugs if someone changes header's
43678
 * type without updating the caller.)
43679
 *
43680
 * The caller must not modify or free the returned value.
43681
 *
43682
 * Various kinds of changes can invalidate the returned value: modifying
43683
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
43684
 * If the returned value is needed for a long time, it is best to make a copy
43685
 * of it with ovsdb_datum_clone().
43686
 *
43687
 * This function is rarely useful, since it is easier to access the value
43688
 * directly through the "header" member in ovsrec_sflow. */
43689
const struct ovsdb_datum *
43690
ovsrec_sflow_get_header(const struct ovsrec_sflow *row,
43691
  enum ovsdb_atomic_type key_type OVS_UNUSED)
43692
0
{
43693
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
43694
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_header);
43695
0
}
43696
43697
/* Returns the "polling" column's value from the "sFlow" table in 'row'
43698
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
43699
 * ovsdb_datum_find_key() is an easier and more efficient way to search
43700
 * for a given key than implementing the same operation on the "cooked"
43701
 * form in 'row'.
43702
 *
43703
 * 'key_type' must be OVSDB_TYPE_INTEGER.
43704
 * (This helps to avoid silent bugs if someone changes polling's
43705
 * type without updating the caller.)
43706
 *
43707
 * The caller must not modify or free the returned value.
43708
 *
43709
 * Various kinds of changes can invalidate the returned value: modifying
43710
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
43711
 * If the returned value is needed for a long time, it is best to make a copy
43712
 * of it with ovsdb_datum_clone().
43713
 *
43714
 * This function is rarely useful, since it is easier to access the value
43715
 * directly through the "polling" member in ovsrec_sflow. */
43716
const struct ovsdb_datum *
43717
ovsrec_sflow_get_polling(const struct ovsrec_sflow *row,
43718
  enum ovsdb_atomic_type key_type OVS_UNUSED)
43719
0
{
43720
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
43721
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_polling);
43722
0
}
43723
43724
/* Returns the "sampling" column's value from the "sFlow" table in 'row'
43725
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
43726
 * ovsdb_datum_find_key() is an easier and more efficient way to search
43727
 * for a given key than implementing the same operation on the "cooked"
43728
 * form in 'row'.
43729
 *
43730
 * 'key_type' must be OVSDB_TYPE_INTEGER.
43731
 * (This helps to avoid silent bugs if someone changes sampling's
43732
 * type without updating the caller.)
43733
 *
43734
 * The caller must not modify or free the returned value.
43735
 *
43736
 * Various kinds of changes can invalidate the returned value: modifying
43737
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
43738
 * If the returned value is needed for a long time, it is best to make a copy
43739
 * of it with ovsdb_datum_clone().
43740
 *
43741
 * This function is rarely useful, since it is easier to access the value
43742
 * directly through the "sampling" member in ovsrec_sflow. */
43743
const struct ovsdb_datum *
43744
ovsrec_sflow_get_sampling(const struct ovsrec_sflow *row,
43745
  enum ovsdb_atomic_type key_type OVS_UNUSED)
43746
0
{
43747
0
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
43748
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_sampling);
43749
0
}
43750
43751
/* Returns the "targets" column's value from the "sFlow" table in 'row'
43752
 * as a struct ovsdb_datum.  This is useful occasionally: for example,
43753
 * ovsdb_datum_find_key() is an easier and more efficient way to search
43754
 * for a given key than implementing the same operation on the "cooked"
43755
 * form in 'row'.
43756
 *
43757
 * 'key_type' must be OVSDB_TYPE_STRING.
43758
 * (This helps to avoid silent bugs if someone changes targets's
43759
 * type without updating the caller.)
43760
 *
43761
 * The caller must not modify or free the returned value.
43762
 *
43763
 * Various kinds of changes can invalidate the returned value: modifying
43764
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
43765
 * If the returned value is needed for a long time, it is best to make a copy
43766
 * of it with ovsdb_datum_clone().
43767
 *
43768
 * This function is rarely useful, since it is easier to access the value
43769
 * directly through the "targets" member in ovsrec_sflow. */
43770
const struct ovsdb_datum *
43771
ovsrec_sflow_get_targets(const struct ovsrec_sflow *row,
43772
  enum ovsdb_atomic_type key_type OVS_UNUSED)
43773
0
{
43774
0
    ovs_assert(key_type == OVSDB_TYPE_STRING);
43775
0
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_targets);
43776
0
}
43777
43778
/* Sets the "agent" column from the "sFlow" table in 'row' to
43779
 * the 'agent' set.
43780
 *
43781
 * If "agent" is null, the column will be the empty set,
43782
 * otherwise it will contain the specified value.
43783
 *
43784
 * The caller retains ownership of the arguments. */
43785
void
43786
ovsrec_sflow_set_agent(const struct ovsrec_sflow *row, const char *agent)
43787
0
{
43788
0
    struct ovsdb_datum datum;
43789
43790
0
    datum.refcnt = NULL;
43791
43792
0
    if (agent) {
43793
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
43794
0
        datum.n = 1;
43795
0
        datum.keys = key;
43796
0
        key->s = ovsdb_atom_string_create(agent);
43797
0
    } else {
43798
0
        datum.n = 0;
43799
0
        datum.keys = NULL;
43800
0
    }
43801
0
    datum.values = NULL;
43802
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_col_agent, &datum);
43803
0
}
43804
43805
/* Sets the "external_ids" column's value from the "sFlow" table in 'row'
43806
 * to 'external_ids'.
43807
 *
43808
 * The caller retains ownership of 'external_ids' and everything in it. */
43809
void
43810
ovsrec_sflow_set_external_ids(const struct ovsrec_sflow *row, const struct smap *external_ids)
43811
0
{
43812
0
    struct ovsdb_datum datum;
43813
43814
0
    if (external_ids) {
43815
0
        ovsdb_datum_from_smap(&datum, external_ids);
43816
0
    } else {
43817
0
        ovsdb_datum_init_empty(&datum);
43818
0
    }
43819
0
    ovsdb_idl_txn_write(&row->header_,
43820
0
                        &ovsrec_sflow_col_external_ids,
43821
0
                        &datum);
43822
0
}
43823
43824
43825
/* Sets the "header" column from the "sFlow" table in 'row' to
43826
 * the 'header' set with 'n_header' entries.
43827
 *
43828
 * 'n_header' may be 0 or 1; if it is 0, then 'header'
43829
 * may be NULL.
43830
 *
43831
 * The caller retains ownership of the arguments. */
43832
void
43833
ovsrec_sflow_set_header(const struct ovsrec_sflow *row, const int64_t *header, size_t n_header)
43834
0
{
43835
0
    struct ovsdb_datum datum;
43836
43837
0
    datum.refcnt = NULL;
43838
43839
0
    if (n_header) {
43840
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
43841
0
        datum.n = 1;
43842
0
        datum.keys = key;
43843
0
        key->integer = *header;
43844
0
    } else {
43845
0
        datum.n = 0;
43846
0
        datum.keys = NULL;
43847
0
    }
43848
0
    datum.values = NULL;
43849
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_col_header, &datum);
43850
0
}
43851
43852
/* Sets the "polling" column from the "sFlow" table in 'row' to
43853
 * the 'polling' set with 'n_polling' entries.
43854
 *
43855
 * 'n_polling' may be 0 or 1; if it is 0, then 'polling'
43856
 * may be NULL.
43857
 *
43858
 * The caller retains ownership of the arguments. */
43859
void
43860
ovsrec_sflow_set_polling(const struct ovsrec_sflow *row, const int64_t *polling, size_t n_polling)
43861
0
{
43862
0
    struct ovsdb_datum datum;
43863
43864
0
    datum.refcnt = NULL;
43865
43866
0
    if (n_polling) {
43867
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
43868
0
        datum.n = 1;
43869
0
        datum.keys = key;
43870
0
        key->integer = *polling;
43871
0
    } else {
43872
0
        datum.n = 0;
43873
0
        datum.keys = NULL;
43874
0
    }
43875
0
    datum.values = NULL;
43876
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_col_polling, &datum);
43877
0
}
43878
43879
/* Sets the "sampling" column from the "sFlow" table in 'row' to
43880
 * the 'sampling' set with 'n_sampling' entries.
43881
 *
43882
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
43883
 * may be NULL.
43884
 *
43885
 * The caller retains ownership of the arguments. */
43886
void
43887
ovsrec_sflow_set_sampling(const struct ovsrec_sflow *row, const int64_t *sampling, size_t n_sampling)
43888
0
{
43889
0
    struct ovsdb_datum datum;
43890
43891
0
    datum.refcnt = NULL;
43892
43893
0
    if (n_sampling) {
43894
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
43895
0
        datum.n = 1;
43896
0
        datum.keys = key;
43897
0
        key->integer = *sampling;
43898
0
    } else {
43899
0
        datum.n = 0;
43900
0
        datum.keys = NULL;
43901
0
    }
43902
0
    datum.values = NULL;
43903
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_col_sampling, &datum);
43904
0
}
43905
43906
/* Sets the "targets" column from the "sFlow" table in 'row' to
43907
 * the 'targets' set with 'n_targets' entries.
43908
 *
43909
 * The caller retains ownership of the arguments. */
43910
void
43911
ovsrec_sflow_set_targets(const struct ovsrec_sflow *row, const char **targets, size_t n_targets)
43912
0
{
43913
0
    struct ovsdb_datum datum;
43914
43915
0
    datum.refcnt = NULL;
43916
43917
0
    datum.n = n_targets;
43918
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
43919
0
    datum.values = NULL;
43920
0
    for (size_t i = 0; i < n_targets; i++) {
43921
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
43922
0
    }
43923
0
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_col_targets, &datum);
43924
0
}
43925
43926
/* Adds the value 'new_value' to the "agent" set column from the "sFlow" table
43927
 * in 'row'.
43928
 *
43929
 */
43930
void
43931
ovsrec_sflow_update_agent_addvalue(const struct ovsrec_sflow *row, const char *new_value)
43932
0
{
43933
0
    struct ovsdb_datum *datum;
43934
43935
0
    datum = xmalloc(sizeof *datum);
43936
0
    datum->n = 1;
43937
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
43938
0
    datum->values = NULL;
43939
0
    datum->refcnt = NULL;
43940
43941
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
43942
43943
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
43944
0
                                    &ovsrec_sflow_col_agent,
43945
0
                                    datum);
43946
0
}
43947
43948
/* Deletes the value 'delete_value' from the "agent" set column from the
43949
 * "sFlow" table in 'row'.
43950
 *
43951
 */
43952
void
43953
ovsrec_sflow_update_agent_delvalue(const struct ovsrec_sflow *row, const char *delete_value)
43954
0
{
43955
0
    struct ovsdb_datum *datum;
43956
43957
0
    datum = xmalloc(sizeof *datum);
43958
0
    datum->n = 1;
43959
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
43960
0
    datum->values = NULL;
43961
0
    datum->refcnt = NULL;
43962
43963
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
43964
43965
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
43966
0
                                    &ovsrec_sflow_col_agent,
43967
0
                                    datum);
43968
0
}
43969
43970
/* Sets an element of the "external_ids" map column from the "sFlow" table in 'row'
43971
 * to 'new_value' given the key value 'new_key'.
43972
 *
43973
 */
43974
void
43975
ovsrec_sflow_update_external_ids_setkey(const struct ovsrec_sflow *row, const char *new_key, const char *new_value)
43976
0
{
43977
0
    struct ovsdb_datum *datum;
43978
43979
0
    datum = xmalloc(sizeof *datum);
43980
0
    datum->n = 1;
43981
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
43982
0
    datum->values = xmalloc(datum->n * sizeof *datum->values);
43983
0
    datum->refcnt = NULL;
43984
43985
0
    datum->keys[0].s = ovsdb_atom_string_create(new_key);
43986
0
    datum->values[0].s = ovsdb_atom_string_create(new_value);
43987
43988
0
    ovsdb_idl_txn_write_partial_map(&row->header_,
43989
0
                                    &ovsrec_sflow_col_external_ids,
43990
0
                                    datum);
43991
0
}
43992
43993
/* Deletes an element of the "external_ids" map column from the "sFlow" table in 'row'
43994
 * given the key value 'delete_key'.
43995
 *
43996
 */
43997
void
43998
ovsrec_sflow_update_external_ids_delkey(const struct ovsrec_sflow *row, const char *delete_key)
43999
0
{
44000
0
    struct ovsdb_datum *datum;
44001
44002
0
    datum = xmalloc(sizeof *datum);
44003
0
    datum->n = 1;
44004
0
    datum->keys = xmalloc(datum->n * sizeof *datum->keys);
44005
0
    datum->values = NULL;
44006
0
    datum->refcnt = NULL;
44007
44008
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_key);
44009
44010
0
    ovsdb_idl_txn_delete_partial_map(&row->header_,
44011
0
                                    &ovsrec_sflow_col_external_ids,
44012
0
                                    datum);
44013
0
}
44014
44015
/* Adds the value 'new_value' to the "header" set column from the "sFlow" table
44016
 * in 'row'.
44017
 *
44018
 */
44019
void
44020
ovsrec_sflow_update_header_addvalue(const struct ovsrec_sflow *row, int64_t new_value)
44021
0
{
44022
0
    struct ovsdb_datum *datum;
44023
44024
0
    datum = xmalloc(sizeof *datum);
44025
0
    datum->n = 1;
44026
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
44027
0
    datum->values = NULL;
44028
0
    datum->refcnt = NULL;
44029
44030
0
    datum->keys[0].integer = new_value;
44031
44032
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
44033
0
                                    &ovsrec_sflow_col_header,
44034
0
                                    datum);
44035
0
}
44036
44037
/* Deletes the value 'delete_value' from the "header" set column from the
44038
 * "sFlow" table in 'row'.
44039
 *
44040
 */
44041
void
44042
ovsrec_sflow_update_header_delvalue(const struct ovsrec_sflow *row, int64_t delete_value)
44043
0
{
44044
0
    struct ovsdb_datum *datum;
44045
44046
0
    datum = xmalloc(sizeof *datum);
44047
0
    datum->n = 1;
44048
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
44049
0
    datum->values = NULL;
44050
0
    datum->refcnt = NULL;
44051
44052
0
    datum->keys[0].integer = delete_value;
44053
44054
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
44055
0
                                    &ovsrec_sflow_col_header,
44056
0
                                    datum);
44057
0
}
44058
44059
/* Adds the value 'new_value' to the "polling" set column from the "sFlow" table
44060
 * in 'row'.
44061
 *
44062
 */
44063
void
44064
ovsrec_sflow_update_polling_addvalue(const struct ovsrec_sflow *row, int64_t new_value)
44065
0
{
44066
0
    struct ovsdb_datum *datum;
44067
44068
0
    datum = xmalloc(sizeof *datum);
44069
0
    datum->n = 1;
44070
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
44071
0
    datum->values = NULL;
44072
0
    datum->refcnt = NULL;
44073
44074
0
    datum->keys[0].integer = new_value;
44075
44076
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
44077
0
                                    &ovsrec_sflow_col_polling,
44078
0
                                    datum);
44079
0
}
44080
44081
/* Deletes the value 'delete_value' from the "polling" set column from the
44082
 * "sFlow" table in 'row'.
44083
 *
44084
 */
44085
void
44086
ovsrec_sflow_update_polling_delvalue(const struct ovsrec_sflow *row, int64_t delete_value)
44087
0
{
44088
0
    struct ovsdb_datum *datum;
44089
44090
0
    datum = xmalloc(sizeof *datum);
44091
0
    datum->n = 1;
44092
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
44093
0
    datum->values = NULL;
44094
0
    datum->refcnt = NULL;
44095
44096
0
    datum->keys[0].integer = delete_value;
44097
44098
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
44099
0
                                    &ovsrec_sflow_col_polling,
44100
0
                                    datum);
44101
0
}
44102
44103
/* Adds the value 'new_value' to the "sampling" set column from the "sFlow" table
44104
 * in 'row'.
44105
 *
44106
 */
44107
void
44108
ovsrec_sflow_update_sampling_addvalue(const struct ovsrec_sflow *row, int64_t new_value)
44109
0
{
44110
0
    struct ovsdb_datum *datum;
44111
44112
0
    datum = xmalloc(sizeof *datum);
44113
0
    datum->n = 1;
44114
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
44115
0
    datum->values = NULL;
44116
0
    datum->refcnt = NULL;
44117
44118
0
    datum->keys[0].integer = new_value;
44119
44120
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
44121
0
                                    &ovsrec_sflow_col_sampling,
44122
0
                                    datum);
44123
0
}
44124
44125
/* Deletes the value 'delete_value' from the "sampling" set column from the
44126
 * "sFlow" table in 'row'.
44127
 *
44128
 */
44129
void
44130
ovsrec_sflow_update_sampling_delvalue(const struct ovsrec_sflow *row, int64_t delete_value)
44131
0
{
44132
0
    struct ovsdb_datum *datum;
44133
44134
0
    datum = xmalloc(sizeof *datum);
44135
0
    datum->n = 1;
44136
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
44137
0
    datum->values = NULL;
44138
0
    datum->refcnt = NULL;
44139
44140
0
    datum->keys[0].integer = delete_value;
44141
44142
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
44143
0
                                    &ovsrec_sflow_col_sampling,
44144
0
                                    datum);
44145
0
}
44146
44147
/* Adds the value 'new_value' to the "targets" set column from the "sFlow" table
44148
 * in 'row'.
44149
 *
44150
 */
44151
void
44152
ovsrec_sflow_update_targets_addvalue(const struct ovsrec_sflow *row, const char *new_value)
44153
0
{
44154
0
    struct ovsdb_datum *datum;
44155
44156
0
    datum = xmalloc(sizeof *datum);
44157
0
    datum->n = 1;
44158
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
44159
0
    datum->values = NULL;
44160
0
    datum->refcnt = NULL;
44161
44162
0
    datum->keys[0].s = ovsdb_atom_string_create(new_value);
44163
44164
0
    ovsdb_idl_txn_write_partial_set(&row->header_,
44165
0
                                    &ovsrec_sflow_col_targets,
44166
0
                                    datum);
44167
0
}
44168
44169
/* Deletes the value 'delete_value' from the "targets" set column from the
44170
 * "sFlow" table in 'row'.
44171
 *
44172
 */
44173
void
44174
ovsrec_sflow_update_targets_delvalue(const struct ovsrec_sflow *row, const char *delete_value)
44175
0
{
44176
0
    struct ovsdb_datum *datum;
44177
44178
0
    datum = xmalloc(sizeof *datum);
44179
0
    datum->n = 1;
44180
0
    datum->keys = xmalloc(datum->n * sizeof *datum->values);
44181
0
    datum->values = NULL;
44182
0
    datum->refcnt = NULL;
44183
44184
0
    datum->keys[0].s = ovsdb_atom_string_create(delete_value);
44185
44186
0
    ovsdb_idl_txn_delete_partial_set(&row->header_,
44187
0
                                    &ovsrec_sflow_col_targets,
44188
0
                                    datum);
44189
0
}
44190
44191
/* Sets the "agent" column from the "sFlow" table in 'row' to
44192
 * the 'agent' set.
44193
 *
44194
 * If "agent" is null, the column will be the empty set,
44195
 * otherwise it will contain the specified value.
44196
 *
44197
 * The caller retains ownership of the arguments. */
44198
void
44199
ovsrec_sflow_add_clause_agent(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char *agent)
44200
0
{
44201
0
    struct ovsdb_datum datum;
44202
44203
0
    datum.refcnt = NULL;
44204
44205
0
    if (agent) {
44206
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
44207
0
        datum.n = 1;
44208
0
        datum.keys = key;
44209
0
        key->s = ovsdb_atom_string_create(agent);
44210
0
    } else {
44211
0
        datum.n = 0;
44212
0
        datum.keys = NULL;
44213
0
    }
44214
0
    datum.values = NULL;
44215
0
    ovsdb_idl_condition_add_clause(cond,
44216
0
                          function,
44217
0
                          &ovsrec_sflow_col_agent,
44218
0
                          &datum);
44219
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_agent.type);
44220
0
}
44221
44222
/* Sets the "external_ids" column's value from the "sFlow" table in 'row'
44223
 * to 'external_ids'.
44224
 *
44225
 * The caller retains ownership of 'external_ids' and everything in it. */
44226
void
44227
ovsrec_sflow_add_clause_external_ids(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const struct smap *external_ids)
44228
0
{
44229
0
    struct ovsdb_datum datum;
44230
44231
0
    if (external_ids) {
44232
0
        ovsdb_datum_from_smap(&datum, external_ids);
44233
0
    } else {
44234
0
        ovsdb_datum_init_empty(&datum);
44235
0
    }
44236
44237
0
    ovsdb_idl_condition_add_clause(cond,
44238
0
                                   function,
44239
0
                                   &ovsrec_sflow_col_external_ids,
44240
0
                                   &datum);
44241
44242
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_external_ids.type);
44243
0
}
44244
44245
44246
/* Sets the "header" column from the "sFlow" table in 'row' to
44247
 * the 'header' set with 'n_header' entries.
44248
 *
44249
 * 'n_header' may be 0 or 1; if it is 0, then 'header'
44250
 * may be NULL.
44251
 *
44252
 * The caller retains ownership of the arguments. */
44253
void
44254
ovsrec_sflow_add_clause_header(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *header, size_t n_header)
44255
0
{
44256
0
    struct ovsdb_datum datum;
44257
44258
0
    datum.refcnt = NULL;
44259
44260
0
    if (n_header) {
44261
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
44262
0
        datum.n = 1;
44263
0
        datum.keys = key;
44264
0
        key->integer = *header;
44265
0
    } else {
44266
0
        datum.n = 0;
44267
0
        datum.keys = NULL;
44268
0
    }
44269
0
    datum.values = NULL;
44270
0
    ovsdb_idl_condition_add_clause(cond,
44271
0
                          function,
44272
0
                          &ovsrec_sflow_col_header,
44273
0
                          &datum);
44274
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_header.type);
44275
0
}
44276
44277
/* Sets the "polling" column from the "sFlow" table in 'row' to
44278
 * the 'polling' set with 'n_polling' entries.
44279
 *
44280
 * 'n_polling' may be 0 or 1; if it is 0, then 'polling'
44281
 * may be NULL.
44282
 *
44283
 * The caller retains ownership of the arguments. */
44284
void
44285
ovsrec_sflow_add_clause_polling(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *polling, size_t n_polling)
44286
0
{
44287
0
    struct ovsdb_datum datum;
44288
44289
0
    datum.refcnt = NULL;
44290
44291
0
    if (n_polling) {
44292
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
44293
0
        datum.n = 1;
44294
0
        datum.keys = key;
44295
0
        key->integer = *polling;
44296
0
    } else {
44297
0
        datum.n = 0;
44298
0
        datum.keys = NULL;
44299
0
    }
44300
0
    datum.values = NULL;
44301
0
    ovsdb_idl_condition_add_clause(cond,
44302
0
                          function,
44303
0
                          &ovsrec_sflow_col_polling,
44304
0
                          &datum);
44305
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_polling.type);
44306
0
}
44307
44308
/* Sets the "sampling" column from the "sFlow" table in 'row' to
44309
 * the 'sampling' set with 'n_sampling' entries.
44310
 *
44311
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
44312
 * may be NULL.
44313
 *
44314
 * The caller retains ownership of the arguments. */
44315
void
44316
ovsrec_sflow_add_clause_sampling(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const int64_t *sampling, size_t n_sampling)
44317
0
{
44318
0
    struct ovsdb_datum datum;
44319
44320
0
    datum.refcnt = NULL;
44321
44322
0
    if (n_sampling) {
44323
0
        union ovsdb_atom *key = xmalloc(sizeof *key);
44324
0
        datum.n = 1;
44325
0
        datum.keys = key;
44326
0
        key->integer = *sampling;
44327
0
    } else {
44328
0
        datum.n = 0;
44329
0
        datum.keys = NULL;
44330
0
    }
44331
0
    datum.values = NULL;
44332
0
    ovsdb_idl_condition_add_clause(cond,
44333
0
                          function,
44334
0
                          &ovsrec_sflow_col_sampling,
44335
0
                          &datum);
44336
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_sampling.type);
44337
0
}
44338
44339
/* Sets the "targets" column from the "sFlow" table in 'row' to
44340
 * the 'targets' set with 'n_targets' entries.
44341
 *
44342
 * The caller retains ownership of the arguments. */
44343
void
44344
ovsrec_sflow_add_clause_targets(struct ovsdb_idl_condition *cond, enum ovsdb_function function, const char **targets, size_t n_targets)
44345
0
{
44346
0
    struct ovsdb_datum datum;
44347
44348
0
    datum.refcnt = NULL;
44349
0
    datum.n = n_targets;
44350
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
44351
0
    datum.values = NULL;
44352
0
    for (size_t i = 0; i < n_targets; i++) {
44353
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
44354
0
    }
44355
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_sflow_col_targets.type);
44356
0
    ovsdb_idl_condition_add_clause(cond,
44357
0
                          function,
44358
0
                          &ovsrec_sflow_col_targets,
44359
0
                          &datum);
44360
0
    ovsdb_datum_destroy(&datum, &ovsrec_sflow_col_targets.type);
44361
0
}
44362
44363
/* Destroy 'row' of kind "sFlow". The row must have been
44364
 * created with ovsdb_idl_index_init_row.
44365
 */
44366
void
44367
ovsrec_sflow_index_destroy_row(const struct ovsrec_sflow *row)
44368
0
{
44369
0
    ovsdb_idl_index_destroy_row(&row->header_);
44370
0
}
44371
        
44372
44373
/* Creates a new row of kind "sFlow". */
44374
struct ovsrec_sflow *
44375
ovsrec_sflow_index_init_row(struct ovsdb_idl_index *index)
44376
0
{
44377
0
    ovs_assert(index->table->class_ == &ovsrec_table_sflow);
44378
0
    return ALIGNED_CAST(struct ovsrec_sflow *, ovsdb_idl_index_init_row(index));
44379
0
}
44380
44381
struct ovsrec_sflow *
44382
ovsrec_sflow_index_find(struct ovsdb_idl_index *index, const struct ovsrec_sflow *target)
44383
0
{
44384
0
    ovs_assert(index->table->class_ == &ovsrec_table_sflow);
44385
0
    return ovsrec_sflow_cast(ovsdb_idl_index_find(index, &target->header_));
44386
0
}
44387
44388
/* Compares 'a' to 'b' and returns a strcmp()-type result. */
44389
int
44390
ovsrec_sflow_index_compare(
44391
    struct ovsdb_idl_index *index, 
44392
    const struct ovsrec_sflow *a, 
44393
    const struct ovsrec_sflow *b)
44394
0
{
44395
0
    return ovsdb_idl_index_compare(index, &a->header_, &b->header_);
44396
0
}
44397
44398
struct ovsdb_idl_cursor
44399
ovsrec_sflow_cursor_first(struct ovsdb_idl_index *index)
44400
0
{
44401
0
    ovs_assert(index->table->class_ == &ovsrec_table_sflow);
44402
0
    return ovsdb_idl_cursor_first(index);
44403
0
}
44404
44405
struct ovsdb_idl_cursor
44406
ovsrec_sflow_cursor_first_eq(
44407
    struct ovsdb_idl_index *index, const struct ovsrec_sflow *target)
44408
0
{
44409
0
    ovs_assert(index->table->class_ == &ovsrec_table_sflow);
44410
0
    return ovsdb_idl_cursor_first_eq(index, &target->header_);
44411
0
}
44412
44413
struct ovsdb_idl_cursor
44414
ovsrec_sflow_cursor_first_ge(
44415
    struct ovsdb_idl_index *index, const struct ovsrec_sflow *target)
44416
0
{
44417
0
    ovs_assert(index->table->class_ == &ovsrec_table_sflow);
44418
0
    return ovsdb_idl_cursor_first_ge(index, target ? &target->header_ : NULL);
44419
0
}
44420
44421
struct ovsrec_sflow *
44422
ovsrec_sflow_cursor_data(struct ovsdb_idl_cursor *cursor)
44423
0
{
44424
0
    return ovsrec_sflow_cast(ovsdb_idl_cursor_data(cursor));
44425
0
}
44426
44427
44428
/* Sets the "agent" column from the "sFlow" table in 'row' to
44429
 * the 'agent' set.
44430
 *
44431
 * If "agent" is null, the column will be the empty set,
44432
 * otherwise it will contain the specified value.
44433
 *
44434
 * The caller retains ownership of the arguments. */
44435
void
44436
ovsrec_sflow_index_set_agent(const struct ovsrec_sflow *row, const char *agent)
44437
0
{
44438
0
    struct ovsdb_datum datum;
44439
44440
0
    datum.refcnt = NULL;
44441
0
    union ovsdb_atom *key;
44442
44443
0
    if (agent) {
44444
0
        key = xmalloc(sizeof (union ovsdb_atom));
44445
0
        datum.n = 1;
44446
0
        datum.keys = key;
44447
0
        key->s = ovsdb_atom_string_create(agent);
44448
0
    } else {
44449
0
        datum.n = 0;
44450
0
        datum.keys = NULL;
44451
0
    }
44452
0
    datum.values = NULL;
44453
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]);
44454
0
}
44455
44456
/* Sets the "external_ids" column's value from the "sFlow" table in 'row'
44457
 * to 'external_ids'.
44458
 *
44459
 * The caller retains ownership of 'external_ids' and everything in it. */
44460
void
44461
ovsrec_sflow_index_set_external_ids(const struct ovsrec_sflow *row, const struct smap *external_ids)
44462
0
{
44463
0
    struct ovsdb_datum *datum = xmalloc(sizeof(struct ovsdb_datum));
44464
44465
0
    if (external_ids) {
44466
0
        struct smap_node *node;
44467
0
        size_t i;
44468
44469
0
        datum->n = smap_count(external_ids);
44470
0
        datum->keys = xmalloc(datum->n * sizeof *datum->keys);
44471
0
        datum->values = xmalloc(datum->n * sizeof *datum->values);
44472
0
        datum->refcnt = NULL;
44473
44474
0
        i = 0;
44475
0
        SMAP_FOR_EACH (node, external_ids) {
44476
0
            datum->keys[i].s = ovsdb_atom_string_create(node->key);
44477
0
            datum->values[i].s = ovsdb_atom_string_create(node->value);
44478
0
            i++;
44479
0
        }
44480
0
        ovsdb_datum_sort_unique(datum, &ovsrec_sflow_col_external_ids.type);
44481
0
    } else {
44482
0
        ovsdb_datum_init_empty(datum);
44483
0
    }
44484
0
    ovsdb_idl_index_write(CONST_CAST(struct ovsdb_idl_row *, &row->header_),
44485
0
                          &ovsrec_sflow_columns[OVSREC_SFLOW_COL_EXTERNAL_IDS],
44486
0
                          datum,
44487
0
                          &ovsrec_table_classes[OVSREC_TABLE_SFLOW]);
44488
0
    free(datum);
44489
0
}
44490
44491
44492
/* Sets the "header" column from the "sFlow" table in 'row' to
44493
 * the 'header' set with 'n_header' entries.
44494
 *
44495
 * 'n_header' may be 0 or 1; if it is 0, then 'header'
44496
 * may be NULL.
44497
 *
44498
 * The caller retains ownership of the arguments. */
44499
void
44500
ovsrec_sflow_index_set_header(const struct ovsrec_sflow *row, const int64_t *header, size_t n_header)
44501
0
{
44502
0
    struct ovsdb_datum datum;
44503
44504
0
    datum.refcnt = NULL;
44505
0
    union ovsdb_atom *key;
44506
44507
0
    if (n_header) {
44508
0
        key = xmalloc(sizeof(union ovsdb_atom));
44509
0
        datum.n = 1;
44510
0
        datum.keys = key;
44511
0
        key->integer = *header;
44512
0
    } else {
44513
0
        datum.n = 0;
44514
0
        datum.keys = NULL;
44515
0
    }
44516
0
    datum.values = NULL;
44517
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]);
44518
0
}
44519
44520
/* Sets the "polling" column from the "sFlow" table in 'row' to
44521
 * the 'polling' set with 'n_polling' entries.
44522
 *
44523
 * 'n_polling' may be 0 or 1; if it is 0, then 'polling'
44524
 * may be NULL.
44525
 *
44526
 * The caller retains ownership of the arguments. */
44527
void
44528
ovsrec_sflow_index_set_polling(const struct ovsrec_sflow *row, const int64_t *polling, size_t n_polling)
44529
0
{
44530
0
    struct ovsdb_datum datum;
44531
44532
0
    datum.refcnt = NULL;
44533
0
    union ovsdb_atom *key;
44534
44535
0
    if (n_polling) {
44536
0
        key = xmalloc(sizeof(union ovsdb_atom));
44537
0
        datum.n = 1;
44538
0
        datum.keys = key;
44539
0
        key->integer = *polling;
44540
0
    } else {
44541
0
        datum.n = 0;
44542
0
        datum.keys = NULL;
44543
0
    }
44544
0
    datum.values = NULL;
44545
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]);
44546
0
}
44547
44548
/* Sets the "sampling" column from the "sFlow" table in 'row' to
44549
 * the 'sampling' set with 'n_sampling' entries.
44550
 *
44551
 * 'n_sampling' may be 0 or 1; if it is 0, then 'sampling'
44552
 * may be NULL.
44553
 *
44554
 * The caller retains ownership of the arguments. */
44555
void
44556
ovsrec_sflow_index_set_sampling(const struct ovsrec_sflow *row, const int64_t *sampling, size_t n_sampling)
44557
0
{
44558
0
    struct ovsdb_datum datum;
44559
44560
0
    datum.refcnt = NULL;
44561
0
    union ovsdb_atom *key;
44562
44563
0
    if (n_sampling) {
44564
0
        key = xmalloc(sizeof(union ovsdb_atom));
44565
0
        datum.n = 1;
44566
0
        datum.keys = key;
44567
0
        key->integer = *sampling;
44568
0
    } else {
44569
0
        datum.n = 0;
44570
0
        datum.keys = NULL;
44571
0
    }
44572
0
    datum.values = NULL;
44573
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]);
44574
0
}
44575
44576
/* Sets the "targets" column from the "sFlow" table in 'row' to
44577
 * the 'targets' set with 'n_targets' entries.
44578
 *
44579
 * The caller retains ownership of the arguments. */
44580
void
44581
ovsrec_sflow_index_set_targets(const struct ovsrec_sflow *row, const char **targets, size_t n_targets)
44582
0
{
44583
0
    struct ovsdb_datum datum;
44584
44585
0
    datum.refcnt = NULL;
44586
0
    size_t i;
44587
44588
0
    datum.n = n_targets;
44589
0
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
44590
0
    datum.values = NULL;
44591
0
    for (i = 0; i < n_targets; i++) {
44592
0
        datum.keys[i].s = ovsdb_atom_string_create(targets[i]);
44593
0
    }
44594
0
    ovsdb_datum_sort_unique(&datum, &ovsrec_sflow_col_targets.type);
44595
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]);
44596
0
}
44597
44598
struct ovsdb_idl_column ovsrec_sflow_columns[OVSREC_SFLOW_N_COLUMNS];
44599
44600
unsigned int
44601
ovsrec_sflow_set_condition(struct ovsdb_idl *idl, struct ovsdb_idl_condition *condition)
44602
0
{
44603
0
    return ovsdb_idl_set_condition(idl, &ovsrec_table_sflow, condition);
44604
0
}
44605
44606
struct ovsdb_idl_column ovsrec_sflow_columns[OVSREC_SFLOW_N_COLUMNS] = {
44607
    [OVSREC_SFLOW_COL_AGENT] = {
44608
         .name = "agent",
44609
         .type = {
44610
            .key = {
44611
               .type = OVSDB_TYPE_STRING,
44612
               .string = { .minLen = 0, .maxLen = UINT_MAX },
44613
            },
44614
            .value = OVSDB_BASE_VOID_INIT,
44615
            .n_min = 0,
44616
            .n_max = 1,
44617
         },
44618
         .is_mutable = true,
44619
         .is_synthetic = false,
44620
         .parse = ovsrec_sflow_parse_agent,
44621
         .unparse = ovsrec_sflow_unparse_agent,
44622
    },
44623
44624
    [OVSREC_SFLOW_COL_EXTERNAL_IDS] = {
44625
         .name = "external_ids",
44626
         .type = {
44627
            .key = {
44628
               .type = OVSDB_TYPE_STRING,
44629
               .string = { .minLen = 0, .maxLen = UINT_MAX },
44630
            },
44631
            .value = {
44632
                .type = OVSDB_TYPE_STRING,
44633
                .string = { .minLen = 0, .maxLen = UINT_MAX },
44634
            },
44635
            .n_min = 0,
44636
            .n_max = UINT_MAX,
44637
         },
44638
         .is_mutable = true,
44639
         .is_synthetic = false,
44640
         .parse = ovsrec_sflow_parse_external_ids,
44641
         .unparse = ovsrec_sflow_unparse_external_ids,
44642
    },
44643
44644
    [OVSREC_SFLOW_COL_HEADER] = {
44645
         .name = "header",
44646
         .type = {
44647
            .key = {
44648
               .type = OVSDB_TYPE_INTEGER,
44649
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
44650
            },
44651
            .value = OVSDB_BASE_VOID_INIT,
44652
            .n_min = 0,
44653
            .n_max = 1,
44654
         },
44655
         .is_mutable = true,
44656
         .is_synthetic = false,
44657
         .parse = ovsrec_sflow_parse_header,
44658
         .unparse = ovsrec_sflow_unparse_header,
44659
    },
44660
44661
    [OVSREC_SFLOW_COL_POLLING] = {
44662
         .name = "polling",
44663
         .type = {
44664
            .key = {
44665
               .type = OVSDB_TYPE_INTEGER,
44666
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
44667
            },
44668
            .value = OVSDB_BASE_VOID_INIT,
44669
            .n_min = 0,
44670
            .n_max = 1,
44671
         },
44672
         .is_mutable = true,
44673
         .is_synthetic = false,
44674
         .parse = ovsrec_sflow_parse_polling,
44675
         .unparse = ovsrec_sflow_unparse_polling,
44676
    },
44677
44678
    [OVSREC_SFLOW_COL_SAMPLING] = {
44679
         .name = "sampling",
44680
         .type = {
44681
            .key = {
44682
               .type = OVSDB_TYPE_INTEGER,
44683
               .integer = { .min = INT64_MIN, .max = INT64_MAX },
44684
            },
44685
            .value = OVSDB_BASE_VOID_INIT,
44686
            .n_min = 0,
44687
            .n_max = 1,
44688
         },
44689
         .is_mutable = true,
44690
         .is_synthetic = false,
44691
         .parse = ovsrec_sflow_parse_sampling,
44692
         .unparse = ovsrec_sflow_unparse_sampling,
44693
    },
44694
44695
    [OVSREC_SFLOW_COL_TARGETS] = {
44696
         .name = "targets",
44697
         .type = {
44698
            .key = {
44699
               .type = OVSDB_TYPE_STRING,
44700
               .string = { .minLen = 0, .maxLen = UINT_MAX },
44701
            },
44702
            .value = OVSDB_BASE_VOID_INIT,
44703
            .n_min = 1,
44704
            .n_max = UINT_MAX,
44705
         },
44706
         .is_mutable = true,
44707
         .is_synthetic = false,
44708
         .parse = ovsrec_sflow_parse_targets,
44709
         .unparse = ovsrec_sflow_unparse_targets,
44710
    },
44711
44712
};
44713

44714
struct ovsdb_idl_table_class ovsrec_table_classes[OVSREC_N_TABLES] = {
44715
    {"AutoAttach", false, false,
44716
     ovsrec_autoattach_columns, ARRAY_SIZE(ovsrec_autoattach_columns),
44717
     sizeof(struct ovsrec_autoattach), ovsrec_autoattach_init__},
44718
    {"Bridge", false, false,
44719
     ovsrec_bridge_columns, ARRAY_SIZE(ovsrec_bridge_columns),
44720
     sizeof(struct ovsrec_bridge), ovsrec_bridge_init__},
44721
    {"CT_Timeout_Policy", false, false,
44722
     ovsrec_ct_timeout_policy_columns, ARRAY_SIZE(ovsrec_ct_timeout_policy_columns),
44723
     sizeof(struct ovsrec_ct_timeout_policy), ovsrec_ct_timeout_policy_init__},
44724
    {"CT_Zone", false, false,
44725
     ovsrec_ct_zone_columns, ARRAY_SIZE(ovsrec_ct_zone_columns),
44726
     sizeof(struct ovsrec_ct_zone), ovsrec_ct_zone_init__},
44727
    {"Controller", false, false,
44728
     ovsrec_controller_columns, ARRAY_SIZE(ovsrec_controller_columns),
44729
     sizeof(struct ovsrec_controller), ovsrec_controller_init__},
44730
    {"Datapath", false, false,
44731
     ovsrec_datapath_columns, ARRAY_SIZE(ovsrec_datapath_columns),
44732
     sizeof(struct ovsrec_datapath), ovsrec_datapath_init__},
44733
    {"Flow_Sample_Collector_Set", true, false,
44734
     ovsrec_flow_sample_collector_set_columns, ARRAY_SIZE(ovsrec_flow_sample_collector_set_columns),
44735
     sizeof(struct ovsrec_flow_sample_collector_set), ovsrec_flow_sample_collector_set_init__},
44736
    {"Flow_Table", false, false,
44737
     ovsrec_flow_table_columns, ARRAY_SIZE(ovsrec_flow_table_columns),
44738
     sizeof(struct ovsrec_flow_table), ovsrec_flow_table_init__},
44739
    {"IPFIX", false, false,
44740
     ovsrec_ipfix_columns, ARRAY_SIZE(ovsrec_ipfix_columns),
44741
     sizeof(struct ovsrec_ipfix), ovsrec_ipfix_init__},
44742
    {"Interface", false, false,
44743
     ovsrec_interface_columns, ARRAY_SIZE(ovsrec_interface_columns),
44744
     sizeof(struct ovsrec_interface), ovsrec_interface_init__},
44745
    {"Manager", false, false,
44746
     ovsrec_manager_columns, ARRAY_SIZE(ovsrec_manager_columns),
44747
     sizeof(struct ovsrec_manager), ovsrec_manager_init__},
44748
    {"Mirror", false, false,
44749
     ovsrec_mirror_columns, ARRAY_SIZE(ovsrec_mirror_columns),
44750
     sizeof(struct ovsrec_mirror), ovsrec_mirror_init__},
44751
    {"NetFlow", false, false,
44752
     ovsrec_netflow_columns, ARRAY_SIZE(ovsrec_netflow_columns),
44753
     sizeof(struct ovsrec_netflow), ovsrec_netflow_init__},
44754
    {"Open_vSwitch", true, true,
44755
     ovsrec_open_vswitch_columns, ARRAY_SIZE(ovsrec_open_vswitch_columns),
44756
     sizeof(struct ovsrec_open_vswitch), ovsrec_open_vswitch_init__},
44757
    {"Port", false, false,
44758
     ovsrec_port_columns, ARRAY_SIZE(ovsrec_port_columns),
44759
     sizeof(struct ovsrec_port), ovsrec_port_init__},
44760
    {"QoS", true, false,
44761
     ovsrec_qos_columns, ARRAY_SIZE(ovsrec_qos_columns),
44762
     sizeof(struct ovsrec_qos), ovsrec_qos_init__},
44763
    {"Queue", true, false,
44764
     ovsrec_queue_columns, ARRAY_SIZE(ovsrec_queue_columns),
44765
     sizeof(struct ovsrec_queue), ovsrec_queue_init__},
44766
    {"SSL", false, true,
44767
     ovsrec_ssl_columns, ARRAY_SIZE(ovsrec_ssl_columns),
44768
     sizeof(struct ovsrec_ssl), ovsrec_ssl_init__},
44769
    {"sFlow", false, false,
44770
     ovsrec_sflow_columns, ARRAY_SIZE(ovsrec_sflow_columns),
44771
     sizeof(struct ovsrec_sflow), ovsrec_sflow_init__},
44772
};
44773
44774
struct ovsdb_idl_class ovsrec_idl_class = {
44775
    "Open_vSwitch", ovsrec_table_classes, ARRAY_SIZE(ovsrec_table_classes)
44776
};
44777
44778
/* Return the schema version.  The caller must not free the returned value. */
44779
const char *
44780
ovsrec_get_db_version(void)
44781
0
{
44782
0
    return "8.4.0";
44783
0
}
44784