~ubuntu-branches/ubuntu/wily/openvswitch/wily

« back to all changes in this revision

Viewing changes to lib/vswitch-idl.c

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-08-10 11:35:15 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20150810113515-575vj06oq29emxsn
Tags: 2.4.0~git20150810.97bab95-0ubuntu1
* New upstream snapshot from 2.4 branch:
  - d/*: Align any relevant packaging changes with upstream.
* d/*: wrap-and-sort.
* d/openvswitch-{common,vswitch}.install: Correct install location for
  bash completion files.
* d/tests/openflow.py: Explicitly use ovs-testcontroller as provided
  by 2.4.0 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
#ifdef __CHECKER__
12
 
/* Sparse dislikes sizeof(bool) ("warning: expression using sizeof bool"). */
13
 
enum { sizeof_bool = 1 };
14
 
#else
15
 
enum { sizeof_bool = sizeof(bool) };
16
 
#endif
17
 
 
18
 
static bool inited;
19
 
 
20
 
 
21
 
static struct ovsrec_bridge *
22
 
ovsrec_bridge_cast(const struct ovsdb_idl_row *row)
23
 
{
24
 
    return row ? CONTAINER_OF(row, struct ovsrec_bridge, header_) : NULL;
25
 
}
26
 
 
27
 
static struct ovsrec_controller *
28
 
ovsrec_controller_cast(const struct ovsdb_idl_row *row)
29
 
{
30
 
    return row ? CONTAINER_OF(row, struct ovsrec_controller, header_) : NULL;
31
 
}
32
 
 
33
 
static struct ovsrec_flow_sample_collector_set *
34
 
ovsrec_flow_sample_collector_set_cast(const struct ovsdb_idl_row *row)
35
 
{
36
 
    return row ? CONTAINER_OF(row, struct ovsrec_flow_sample_collector_set, header_) : NULL;
37
 
}
38
 
 
39
 
static struct ovsrec_flow_table *
40
 
ovsrec_flow_table_cast(const struct ovsdb_idl_row *row)
41
 
{
42
 
    return row ? CONTAINER_OF(row, struct ovsrec_flow_table, header_) : NULL;
43
 
}
44
 
 
45
 
static struct ovsrec_ipfix *
46
 
ovsrec_ipfix_cast(const struct ovsdb_idl_row *row)
47
 
{
48
 
    return row ? CONTAINER_OF(row, struct ovsrec_ipfix, header_) : NULL;
49
 
}
50
 
 
51
 
static struct ovsrec_interface *
52
 
ovsrec_interface_cast(const struct ovsdb_idl_row *row)
53
 
{
54
 
    return row ? CONTAINER_OF(row, struct ovsrec_interface, header_) : NULL;
55
 
}
56
 
 
57
 
static struct ovsrec_manager *
58
 
ovsrec_manager_cast(const struct ovsdb_idl_row *row)
59
 
{
60
 
    return row ? CONTAINER_OF(row, struct ovsrec_manager, header_) : NULL;
61
 
}
62
 
 
63
 
static struct ovsrec_mirror *
64
 
ovsrec_mirror_cast(const struct ovsdb_idl_row *row)
65
 
{
66
 
    return row ? CONTAINER_OF(row, struct ovsrec_mirror, header_) : NULL;
67
 
}
68
 
 
69
 
static struct ovsrec_netflow *
70
 
ovsrec_netflow_cast(const struct ovsdb_idl_row *row)
71
 
{
72
 
    return row ? CONTAINER_OF(row, struct ovsrec_netflow, header_) : NULL;
73
 
}
74
 
 
75
 
static struct ovsrec_open_vswitch *
76
 
ovsrec_open_vswitch_cast(const struct ovsdb_idl_row *row)
77
 
{
78
 
    return row ? CONTAINER_OF(row, struct ovsrec_open_vswitch, header_) : NULL;
79
 
}
80
 
 
81
 
static struct ovsrec_port *
82
 
ovsrec_port_cast(const struct ovsdb_idl_row *row)
83
 
{
84
 
    return row ? CONTAINER_OF(row, struct ovsrec_port, header_) : NULL;
85
 
}
86
 
 
87
 
static struct ovsrec_qos *
88
 
ovsrec_qos_cast(const struct ovsdb_idl_row *row)
89
 
{
90
 
    return row ? CONTAINER_OF(row, struct ovsrec_qos, header_) : NULL;
91
 
}
92
 
 
93
 
static struct ovsrec_queue *
94
 
ovsrec_queue_cast(const struct ovsdb_idl_row *row)
95
 
{
96
 
    return row ? CONTAINER_OF(row, struct ovsrec_queue, header_) : NULL;
97
 
}
98
 
 
99
 
static struct ovsrec_ssl *
100
 
ovsrec_ssl_cast(const struct ovsdb_idl_row *row)
101
 
{
102
 
    return row ? CONTAINER_OF(row, struct ovsrec_ssl, header_) : NULL;
103
 
}
104
 
 
105
 
static struct ovsrec_sflow *
106
 
ovsrec_sflow_cast(const struct ovsdb_idl_row *row)
107
 
{
108
 
    return row ? CONTAINER_OF(row, struct ovsrec_sflow, header_) : NULL;
109
 
}
110
 
 
111
 
/* Bridge table. */
112
 
 
113
 
static void
114
 
ovsrec_bridge_parse_controller(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
115
 
{
116
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
117
 
    size_t i;
118
 
 
119
 
    ovs_assert(inited);
120
 
    row->controller = NULL;
121
 
    row->n_controller = 0;
122
 
    for (i = 0; i < datum->n; i++) {
123
 
        struct ovsrec_controller *keyRow = ovsrec_controller_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER], &datum->keys[i].uuid));
124
 
        if (keyRow) {
125
 
            if (!row->n_controller) {
126
 
                row->controller = xmalloc(datum->n * sizeof *row->controller);
127
 
            }
128
 
            row->controller[row->n_controller] = keyRow;
129
 
            row->n_controller++;
130
 
        }
131
 
    }
132
 
}
133
 
 
134
 
static void
135
 
ovsrec_bridge_parse_datapath_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
136
 
{
137
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
138
 
 
139
 
    ovs_assert(inited);
140
 
    if (datum->n >= 1) {
141
 
        row->datapath_id = datum->keys[0].string;
142
 
    } else {
143
 
        row->datapath_id = NULL;
144
 
    }
145
 
}
146
 
 
147
 
static void
148
 
ovsrec_bridge_parse_datapath_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
149
 
{
150
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
151
 
 
152
 
    ovs_assert(inited);
153
 
    if (datum->n >= 1) {
154
 
        row->datapath_type = datum->keys[0].string;
155
 
    } else {
156
 
        row->datapath_type = "";
157
 
    }
158
 
}
159
 
 
160
 
static void
161
 
ovsrec_bridge_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
162
 
{
163
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
164
 
    size_t i;
165
 
 
166
 
    ovs_assert(inited);
167
 
    smap_init(&row->external_ids);
168
 
    for (i = 0; i < datum->n; i++) {
169
 
        smap_add(&row->external_ids,
170
 
                 datum->keys[i].string,
171
 
                 datum->values[i].string);
172
 
    }
173
 
}
174
 
 
175
 
static void
176
 
ovsrec_bridge_parse_fail_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
177
 
{
178
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
179
 
 
180
 
    ovs_assert(inited);
181
 
    if (datum->n >= 1) {
182
 
        row->fail_mode = datum->keys[0].string;
183
 
    } else {
184
 
        row->fail_mode = NULL;
185
 
    }
186
 
}
187
 
 
188
 
static void
189
 
ovsrec_bridge_parse_flood_vlans(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
190
 
{
191
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
192
 
    size_t n = MIN(4096, datum->n);
193
 
    size_t i;
194
 
 
195
 
    ovs_assert(inited);
196
 
    row->flood_vlans = NULL;
197
 
    row->n_flood_vlans = 0;
198
 
    for (i = 0; i < n; i++) {
199
 
        if (!row->n_flood_vlans) {
200
 
            row->flood_vlans = xmalloc(n * sizeof *row->flood_vlans);
201
 
        }
202
 
        row->flood_vlans[row->n_flood_vlans] = datum->keys[i].integer;
203
 
        row->n_flood_vlans++;
204
 
    }
205
 
}
206
 
 
207
 
static void
208
 
ovsrec_bridge_parse_flow_tables(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
209
 
{
210
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
211
 
    size_t i;
212
 
 
213
 
    ovs_assert(inited);
214
 
    row->key_flow_tables = NULL;
215
 
    row->value_flow_tables = NULL;
216
 
    row->n_flow_tables = 0;
217
 
    for (i = 0; i < datum->n; i++) {
218
 
        struct ovsrec_flow_table *valueRow = ovsrec_flow_table_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE], &datum->values[i].uuid));
219
 
        if (valueRow) {
220
 
            if (!row->n_flow_tables) {
221
 
                row->key_flow_tables = xmalloc(datum->n * sizeof *row->key_flow_tables);
222
 
                row->value_flow_tables = xmalloc(datum->n * sizeof *row->value_flow_tables);
223
 
            }
224
 
            row->key_flow_tables[row->n_flow_tables] = datum->keys[i].integer;
225
 
            row->value_flow_tables[row->n_flow_tables] = valueRow;
226
 
            row->n_flow_tables++;
227
 
        }
228
 
    }
229
 
}
230
 
 
231
 
static void
232
 
ovsrec_bridge_parse_ipfix(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
233
 
{
234
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
235
 
 
236
 
    ovs_assert(inited);
237
 
    if (datum->n >= 1) {
238
 
        row->ipfix = ovsrec_ipfix_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_IPFIX], &datum->keys[0].uuid));
239
 
    } else {
240
 
        row->ipfix = NULL;
241
 
    }
242
 
}
243
 
 
244
 
static void
245
 
ovsrec_bridge_parse_mirrors(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
246
 
{
247
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
248
 
    size_t i;
249
 
 
250
 
    ovs_assert(inited);
251
 
    row->mirrors = NULL;
252
 
    row->n_mirrors = 0;
253
 
    for (i = 0; i < datum->n; i++) {
254
 
        struct ovsrec_mirror *keyRow = ovsrec_mirror_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_MIRROR], &datum->keys[i].uuid));
255
 
        if (keyRow) {
256
 
            if (!row->n_mirrors) {
257
 
                row->mirrors = xmalloc(datum->n * sizeof *row->mirrors);
258
 
            }
259
 
            row->mirrors[row->n_mirrors] = keyRow;
260
 
            row->n_mirrors++;
261
 
        }
262
 
    }
263
 
}
264
 
 
265
 
static void
266
 
ovsrec_bridge_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
267
 
{
268
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
269
 
 
270
 
    ovs_assert(inited);
271
 
    if (datum->n >= 1) {
272
 
        row->name = datum->keys[0].string;
273
 
    } else {
274
 
        row->name = "";
275
 
    }
276
 
}
277
 
 
278
 
static void
279
 
ovsrec_bridge_parse_netflow(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
280
 
{
281
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
282
 
 
283
 
    ovs_assert(inited);
284
 
    if (datum->n >= 1) {
285
 
        row->netflow = ovsrec_netflow_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW], &datum->keys[0].uuid));
286
 
    } else {
287
 
        row->netflow = NULL;
288
 
    }
289
 
}
290
 
 
291
 
static void
292
 
ovsrec_bridge_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
293
 
{
294
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
295
 
    size_t i;
296
 
 
297
 
    ovs_assert(inited);
298
 
    smap_init(&row->other_config);
299
 
    for (i = 0; i < datum->n; i++) {
300
 
        smap_add(&row->other_config,
301
 
                 datum->keys[i].string,
302
 
                 datum->values[i].string);
303
 
    }
304
 
}
305
 
 
306
 
static void
307
 
ovsrec_bridge_parse_ports(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
308
 
{
309
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
310
 
    size_t i;
311
 
 
312
 
    ovs_assert(inited);
313
 
    row->ports = NULL;
314
 
    row->n_ports = 0;
315
 
    for (i = 0; i < datum->n; i++) {
316
 
        struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_PORT], &datum->keys[i].uuid));
317
 
        if (keyRow) {
318
 
            if (!row->n_ports) {
319
 
                row->ports = xmalloc(datum->n * sizeof *row->ports);
320
 
            }
321
 
            row->ports[row->n_ports] = keyRow;
322
 
            row->n_ports++;
323
 
        }
324
 
    }
325
 
}
326
 
 
327
 
static void
328
 
ovsrec_bridge_parse_protocols(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
329
 
{
330
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
331
 
    size_t i;
332
 
 
333
 
    ovs_assert(inited);
334
 
    row->protocols = NULL;
335
 
    row->n_protocols = 0;
336
 
    for (i = 0; i < datum->n; i++) {
337
 
        if (!row->n_protocols) {
338
 
            row->protocols = xmalloc(datum->n * sizeof *row->protocols);
339
 
        }
340
 
        row->protocols[row->n_protocols] = datum->keys[i].string;
341
 
        row->n_protocols++;
342
 
    }
343
 
}
344
 
 
345
 
static void
346
 
ovsrec_bridge_parse_sflow(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
347
 
{
348
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
349
 
 
350
 
    ovs_assert(inited);
351
 
    if (datum->n >= 1) {
352
 
        row->sflow = ovsrec_sflow_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_SFLOW], &datum->keys[0].uuid));
353
 
    } else {
354
 
        row->sflow = NULL;
355
 
    }
356
 
}
357
 
 
358
 
static void
359
 
ovsrec_bridge_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
360
 
{
361
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
362
 
    size_t i;
363
 
 
364
 
    ovs_assert(inited);
365
 
    smap_init(&row->status);
366
 
    for (i = 0; i < datum->n; i++) {
367
 
        smap_add(&row->status,
368
 
                 datum->keys[i].string,
369
 
                 datum->values[i].string);
370
 
    }
371
 
}
372
 
 
373
 
static void
374
 
ovsrec_bridge_parse_stp_enable(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
375
 
{
376
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
377
 
 
378
 
    ovs_assert(inited);
379
 
    if (datum->n >= 1) {
380
 
        row->stp_enable = datum->keys[0].boolean;
381
 
    } else {
382
 
        row->stp_enable = false;
383
 
    }
384
 
}
385
 
 
386
 
static void
387
 
ovsrec_bridge_unparse_controller(struct ovsdb_idl_row *row_)
388
 
{
389
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
390
 
 
391
 
    ovs_assert(inited);
392
 
    free(row->controller);
393
 
}
394
 
 
395
 
static void
396
 
ovsrec_bridge_unparse_datapath_id(struct ovsdb_idl_row *row OVS_UNUSED)
397
 
{
398
 
    /* Nothing to do. */
399
 
}
400
 
 
401
 
static void
402
 
ovsrec_bridge_unparse_datapath_type(struct ovsdb_idl_row *row OVS_UNUSED)
403
 
{
404
 
    /* Nothing to do. */
405
 
}
406
 
 
407
 
static void
408
 
ovsrec_bridge_unparse_external_ids(struct ovsdb_idl_row *row_)
409
 
{
410
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
411
 
 
412
 
    ovs_assert(inited);
413
 
    smap_destroy(&row->external_ids);
414
 
}
415
 
 
416
 
static void
417
 
ovsrec_bridge_unparse_fail_mode(struct ovsdb_idl_row *row OVS_UNUSED)
418
 
{
419
 
    /* Nothing to do. */
420
 
}
421
 
 
422
 
static void
423
 
ovsrec_bridge_unparse_flood_vlans(struct ovsdb_idl_row *row_)
424
 
{
425
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
426
 
 
427
 
    ovs_assert(inited);
428
 
    free(row->flood_vlans);
429
 
}
430
 
 
431
 
static void
432
 
ovsrec_bridge_unparse_flow_tables(struct ovsdb_idl_row *row_)
433
 
{
434
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
435
 
 
436
 
    ovs_assert(inited);
437
 
    free(row->key_flow_tables);
438
 
    free(row->value_flow_tables);
439
 
}
440
 
 
441
 
static void
442
 
ovsrec_bridge_unparse_ipfix(struct ovsdb_idl_row *row OVS_UNUSED)
443
 
{
444
 
    /* Nothing to do. */
445
 
}
446
 
 
447
 
static void
448
 
ovsrec_bridge_unparse_mirrors(struct ovsdb_idl_row *row_)
449
 
{
450
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
451
 
 
452
 
    ovs_assert(inited);
453
 
    free(row->mirrors);
454
 
}
455
 
 
456
 
static void
457
 
ovsrec_bridge_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
458
 
{
459
 
    /* Nothing to do. */
460
 
}
461
 
 
462
 
static void
463
 
ovsrec_bridge_unparse_netflow(struct ovsdb_idl_row *row OVS_UNUSED)
464
 
{
465
 
    /* Nothing to do. */
466
 
}
467
 
 
468
 
static void
469
 
ovsrec_bridge_unparse_other_config(struct ovsdb_idl_row *row_)
470
 
{
471
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
472
 
 
473
 
    ovs_assert(inited);
474
 
    smap_destroy(&row->other_config);
475
 
}
476
 
 
477
 
static void
478
 
ovsrec_bridge_unparse_ports(struct ovsdb_idl_row *row_)
479
 
{
480
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
481
 
 
482
 
    ovs_assert(inited);
483
 
    free(row->ports);
484
 
}
485
 
 
486
 
static void
487
 
ovsrec_bridge_unparse_protocols(struct ovsdb_idl_row *row_)
488
 
{
489
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
490
 
 
491
 
    ovs_assert(inited);
492
 
    free(row->protocols);
493
 
}
494
 
 
495
 
static void
496
 
ovsrec_bridge_unparse_sflow(struct ovsdb_idl_row *row OVS_UNUSED)
497
 
{
498
 
    /* Nothing to do. */
499
 
}
500
 
 
501
 
static void
502
 
ovsrec_bridge_unparse_status(struct ovsdb_idl_row *row_)
503
 
{
504
 
    struct ovsrec_bridge *row = ovsrec_bridge_cast(row_);
505
 
 
506
 
    ovs_assert(inited);
507
 
    smap_destroy(&row->status);
508
 
}
509
 
 
510
 
static void
511
 
ovsrec_bridge_unparse_stp_enable(struct ovsdb_idl_row *row OVS_UNUSED)
512
 
{
513
 
    /* Nothing to do. */
514
 
}
515
 
 
516
 
static void
517
 
ovsrec_bridge_init__(struct ovsdb_idl_row *row)
518
 
{
519
 
    ovsrec_bridge_init(ovsrec_bridge_cast(row));
520
 
}
521
 
 
522
 
void
523
 
ovsrec_bridge_init(struct ovsrec_bridge *row)
524
 
{
525
 
    memset(row, 0, sizeof *row); 
526
 
    smap_init(&row->external_ids);
527
 
    smap_init(&row->other_config);
528
 
    smap_init(&row->status);
529
 
}
530
 
 
531
 
const struct ovsrec_bridge *
532
 
ovsrec_bridge_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
533
 
{
534
 
    return ovsrec_bridge_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE], uuid));
535
 
}
536
 
 
537
 
const struct ovsrec_bridge *
538
 
ovsrec_bridge_first(const struct ovsdb_idl *idl)
539
 
{
540
 
    return ovsrec_bridge_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE]));
541
 
}
542
 
 
543
 
const struct ovsrec_bridge *
544
 
ovsrec_bridge_next(const struct ovsrec_bridge *row)
545
 
{
546
 
    return ovsrec_bridge_cast(ovsdb_idl_next_row(&row->header_));
547
 
}
548
 
 
549
 
void
550
 
ovsrec_bridge_delete(const struct ovsrec_bridge *row)
551
 
{
552
 
    ovsdb_idl_txn_delete(&row->header_);
553
 
}
554
 
 
555
 
struct ovsrec_bridge *
556
 
ovsrec_bridge_insert(struct ovsdb_idl_txn *txn)
557
 
{
558
 
    return ovsrec_bridge_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE], NULL));
559
 
}
560
 
 
561
 
 
562
 
void
563
 
ovsrec_bridge_verify_controller(const struct ovsrec_bridge *row)
564
 
{
565
 
    ovs_assert(inited);
566
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_CONTROLLER]);
567
 
}
568
 
 
569
 
void
570
 
ovsrec_bridge_verify_datapath_id(const struct ovsrec_bridge *row)
571
 
{
572
 
    ovs_assert(inited);
573
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_DATAPATH_ID]);
574
 
}
575
 
 
576
 
void
577
 
ovsrec_bridge_verify_datapath_type(const struct ovsrec_bridge *row)
578
 
{
579
 
    ovs_assert(inited);
580
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_DATAPATH_TYPE]);
581
 
}
582
 
 
583
 
void
584
 
ovsrec_bridge_verify_external_ids(const struct ovsrec_bridge *row)
585
 
{
586
 
    ovs_assert(inited);
587
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_EXTERNAL_IDS]);
588
 
}
589
 
 
590
 
void
591
 
ovsrec_bridge_verify_fail_mode(const struct ovsrec_bridge *row)
592
 
{
593
 
    ovs_assert(inited);
594
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FAIL_MODE]);
595
 
}
596
 
 
597
 
void
598
 
ovsrec_bridge_verify_flood_vlans(const struct ovsrec_bridge *row)
599
 
{
600
 
    ovs_assert(inited);
601
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FLOOD_VLANS]);
602
 
}
603
 
 
604
 
void
605
 
ovsrec_bridge_verify_flow_tables(const struct ovsrec_bridge *row)
606
 
{
607
 
    ovs_assert(inited);
608
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FLOW_TABLES]);
609
 
}
610
 
 
611
 
void
612
 
ovsrec_bridge_verify_ipfix(const struct ovsrec_bridge *row)
613
 
{
614
 
    ovs_assert(inited);
615
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_IPFIX]);
616
 
}
617
 
 
618
 
void
619
 
ovsrec_bridge_verify_mirrors(const struct ovsrec_bridge *row)
620
 
{
621
 
    ovs_assert(inited);
622
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_MIRRORS]);
623
 
}
624
 
 
625
 
void
626
 
ovsrec_bridge_verify_name(const struct ovsrec_bridge *row)
627
 
{
628
 
    ovs_assert(inited);
629
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_NAME]);
630
 
}
631
 
 
632
 
void
633
 
ovsrec_bridge_verify_netflow(const struct ovsrec_bridge *row)
634
 
{
635
 
    ovs_assert(inited);
636
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_NETFLOW]);
637
 
}
638
 
 
639
 
void
640
 
ovsrec_bridge_verify_other_config(const struct ovsrec_bridge *row)
641
 
{
642
 
    ovs_assert(inited);
643
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_OTHER_CONFIG]);
644
 
}
645
 
 
646
 
void
647
 
ovsrec_bridge_verify_ports(const struct ovsrec_bridge *row)
648
 
{
649
 
    ovs_assert(inited);
650
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_PORTS]);
651
 
}
652
 
 
653
 
void
654
 
ovsrec_bridge_verify_protocols(const struct ovsrec_bridge *row)
655
 
{
656
 
    ovs_assert(inited);
657
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_PROTOCOLS]);
658
 
}
659
 
 
660
 
void
661
 
ovsrec_bridge_verify_sflow(const struct ovsrec_bridge *row)
662
 
{
663
 
    ovs_assert(inited);
664
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_SFLOW]);
665
 
}
666
 
 
667
 
void
668
 
ovsrec_bridge_verify_status(const struct ovsrec_bridge *row)
669
 
{
670
 
    ovs_assert(inited);
671
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_STATUS]);
672
 
}
673
 
 
674
 
void
675
 
ovsrec_bridge_verify_stp_enable(const struct ovsrec_bridge *row)
676
 
{
677
 
    ovs_assert(inited);
678
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_STP_ENABLE]);
679
 
}
680
 
 
681
 
/* Returns the controller column's value in 'row' as a struct ovsdb_datum.
682
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
683
 
 * easier and more efficient way to search for a given key than implementing
684
 
 * the same operation on the "cooked" form in 'row'.
685
 
 *
686
 
 * 'key_type' must be OVSDB_TYPE_UUID.
687
 
 * (This helps to avoid silent bugs if someone changes controller's
688
 
 * type without updating the caller.)
689
 
 *
690
 
 * The caller must not modify or free the returned value.
691
 
 *
692
 
 * Various kinds of changes can invalidate the returned value: modifying
693
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
694
 
 * If the returned value is needed for a long time, it is best to make a copy
695
 
 * of it with ovsdb_datum_clone(). */
696
 
const struct ovsdb_datum *
697
 
ovsrec_bridge_get_controller(const struct ovsrec_bridge *row,
698
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
699
 
{
700
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
701
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_controller);
702
 
}
703
 
 
704
 
/* Returns the datapath_id column's value in 'row' as a struct ovsdb_datum.
705
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
706
 
 * easier and more efficient way to search for a given key than implementing
707
 
 * the same operation on the "cooked" form in 'row'.
708
 
 *
709
 
 * 'key_type' must be OVSDB_TYPE_STRING.
710
 
 * (This helps to avoid silent bugs if someone changes datapath_id's
711
 
 * type without updating the caller.)
712
 
 *
713
 
 * The caller must not modify or free the returned value.
714
 
 *
715
 
 * Various kinds of changes can invalidate the returned value: modifying
716
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
717
 
 * If the returned value is needed for a long time, it is best to make a copy
718
 
 * of it with ovsdb_datum_clone(). */
719
 
const struct ovsdb_datum *
720
 
ovsrec_bridge_get_datapath_id(const struct ovsrec_bridge *row,
721
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
722
 
{
723
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
724
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_datapath_id);
725
 
}
726
 
 
727
 
/* Returns the datapath_type column's value in 'row' as a struct ovsdb_datum.
728
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
729
 
 * easier and more efficient way to search for a given key than implementing
730
 
 * the same operation on the "cooked" form in 'row'.
731
 
 *
732
 
 * 'key_type' must be OVSDB_TYPE_STRING.
733
 
 * (This helps to avoid silent bugs if someone changes datapath_type's
734
 
 * type without updating the caller.)
735
 
 *
736
 
 * The caller must not modify or free the returned value.
737
 
 *
738
 
 * Various kinds of changes can invalidate the returned value: modifying
739
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
740
 
 * If the returned value is needed for a long time, it is best to make a copy
741
 
 * of it with ovsdb_datum_clone(). */
742
 
const struct ovsdb_datum *
743
 
ovsrec_bridge_get_datapath_type(const struct ovsrec_bridge *row,
744
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
745
 
{
746
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
747
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_datapath_type);
748
 
}
749
 
 
750
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
751
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
752
 
 * easier and more efficient way to search for a given key than implementing
753
 
 * the same operation on the "cooked" form in 'row'.
754
 
 *
755
 
 * 'key_type' must be OVSDB_TYPE_STRING.
756
 
 * 'value_type' must be OVSDB_TYPE_STRING.
757
 
 * (This helps to avoid silent bugs if someone changes external_ids's
758
 
 * type without updating the caller.)
759
 
 *
760
 
 * The caller must not modify or free the returned value.
761
 
 *
762
 
 * Various kinds of changes can invalidate the returned value: modifying
763
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
764
 
 * If the returned value is needed for a long time, it is best to make a copy
765
 
 * of it with ovsdb_datum_clone(). */
766
 
const struct ovsdb_datum *
767
 
ovsrec_bridge_get_external_ids(const struct ovsrec_bridge *row,
768
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
769
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
770
 
{
771
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
772
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
773
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_external_ids);
774
 
}
775
 
 
776
 
/* Returns the fail_mode column's value in 'row' as a struct ovsdb_datum.
777
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
778
 
 * easier and more efficient way to search for a given key than implementing
779
 
 * the same operation on the "cooked" form in 'row'.
780
 
 *
781
 
 * 'key_type' must be OVSDB_TYPE_STRING.
782
 
 * (This helps to avoid silent bugs if someone changes fail_mode's
783
 
 * type without updating the caller.)
784
 
 *
785
 
 * The caller must not modify or free the returned value.
786
 
 *
787
 
 * Various kinds of changes can invalidate the returned value: modifying
788
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
789
 
 * If the returned value is needed for a long time, it is best to make a copy
790
 
 * of it with ovsdb_datum_clone(). */
791
 
const struct ovsdb_datum *
792
 
ovsrec_bridge_get_fail_mode(const struct ovsrec_bridge *row,
793
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
794
 
{
795
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
796
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_fail_mode);
797
 
}
798
 
 
799
 
/* Returns the flood_vlans column's value in 'row' as a struct ovsdb_datum.
800
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
801
 
 * easier and more efficient way to search for a given key than implementing
802
 
 * the same operation on the "cooked" form in 'row'.
803
 
 *
804
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
805
 
 * (This helps to avoid silent bugs if someone changes flood_vlans's
806
 
 * type without updating the caller.)
807
 
 *
808
 
 * The caller must not modify or free the returned value.
809
 
 *
810
 
 * Various kinds of changes can invalidate the returned value: modifying
811
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
812
 
 * If the returned value is needed for a long time, it is best to make a copy
813
 
 * of it with ovsdb_datum_clone(). */
814
 
const struct ovsdb_datum *
815
 
ovsrec_bridge_get_flood_vlans(const struct ovsrec_bridge *row,
816
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
817
 
{
818
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
819
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_flood_vlans);
820
 
}
821
 
 
822
 
/* Returns the flow_tables column's value in 'row' as a struct ovsdb_datum.
823
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
824
 
 * easier and more efficient way to search for a given key than implementing
825
 
 * the same operation on the "cooked" form in 'row'.
826
 
 *
827
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
828
 
 * 'value_type' must be OVSDB_TYPE_UUID.
829
 
 * (This helps to avoid silent bugs if someone changes flow_tables's
830
 
 * type without updating the caller.)
831
 
 *
832
 
 * The caller must not modify or free the returned value.
833
 
 *
834
 
 * Various kinds of changes can invalidate the returned value: modifying
835
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
836
 
 * If the returned value is needed for a long time, it is best to make a copy
837
 
 * of it with ovsdb_datum_clone(). */
838
 
const struct ovsdb_datum *
839
 
ovsrec_bridge_get_flow_tables(const struct ovsrec_bridge *row,
840
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
841
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
842
 
{
843
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
844
 
    ovs_assert(value_type == OVSDB_TYPE_UUID);
845
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_flow_tables);
846
 
}
847
 
 
848
 
/* Returns the ipfix column's value in 'row' as a struct ovsdb_datum.
849
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
850
 
 * easier and more efficient way to search for a given key than implementing
851
 
 * the same operation on the "cooked" form in 'row'.
852
 
 *
853
 
 * 'key_type' must be OVSDB_TYPE_UUID.
854
 
 * (This helps to avoid silent bugs if someone changes ipfix's
855
 
 * type without updating the caller.)
856
 
 *
857
 
 * The caller must not modify or free the returned value.
858
 
 *
859
 
 * Various kinds of changes can invalidate the returned value: modifying
860
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
861
 
 * If the returned value is needed for a long time, it is best to make a copy
862
 
 * of it with ovsdb_datum_clone(). */
863
 
const struct ovsdb_datum *
864
 
ovsrec_bridge_get_ipfix(const struct ovsrec_bridge *row,
865
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
866
 
{
867
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
868
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_ipfix);
869
 
}
870
 
 
871
 
/* Returns the mirrors column's value in 'row' as a struct ovsdb_datum.
872
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
873
 
 * easier and more efficient way to search for a given key than implementing
874
 
 * the same operation on the "cooked" form in 'row'.
875
 
 *
876
 
 * 'key_type' must be OVSDB_TYPE_UUID.
877
 
 * (This helps to avoid silent bugs if someone changes mirrors's
878
 
 * type without updating the caller.)
879
 
 *
880
 
 * The caller must not modify or free the returned value.
881
 
 *
882
 
 * Various kinds of changes can invalidate the returned value: modifying
883
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
884
 
 * If the returned value is needed for a long time, it is best to make a copy
885
 
 * of it with ovsdb_datum_clone(). */
886
 
const struct ovsdb_datum *
887
 
ovsrec_bridge_get_mirrors(const struct ovsrec_bridge *row,
888
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
889
 
{
890
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
891
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_mirrors);
892
 
}
893
 
 
894
 
/* Returns the name column's value in 'row' as a struct ovsdb_datum.
895
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
896
 
 * easier and more efficient way to search for a given key than implementing
897
 
 * the same operation on the "cooked" form in 'row'.
898
 
 *
899
 
 * 'key_type' must be OVSDB_TYPE_STRING.
900
 
 * (This helps to avoid silent bugs if someone changes name's
901
 
 * type without updating the caller.)
902
 
 *
903
 
 * The caller must not modify or free the returned value.
904
 
 *
905
 
 * Various kinds of changes can invalidate the returned value: modifying
906
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
907
 
 * If the returned value is needed for a long time, it is best to make a copy
908
 
 * of it with ovsdb_datum_clone(). */
909
 
const struct ovsdb_datum *
910
 
ovsrec_bridge_get_name(const struct ovsrec_bridge *row,
911
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
912
 
{
913
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
914
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_name);
915
 
}
916
 
 
917
 
/* Returns the netflow column's value in 'row' as a struct ovsdb_datum.
918
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
919
 
 * easier and more efficient way to search for a given key than implementing
920
 
 * the same operation on the "cooked" form in 'row'.
921
 
 *
922
 
 * 'key_type' must be OVSDB_TYPE_UUID.
923
 
 * (This helps to avoid silent bugs if someone changes netflow's
924
 
 * type without updating the caller.)
925
 
 *
926
 
 * The caller must not modify or free the returned value.
927
 
 *
928
 
 * Various kinds of changes can invalidate the returned value: modifying
929
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
930
 
 * If the returned value is needed for a long time, it is best to make a copy
931
 
 * of it with ovsdb_datum_clone(). */
932
 
const struct ovsdb_datum *
933
 
ovsrec_bridge_get_netflow(const struct ovsrec_bridge *row,
934
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
935
 
{
936
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
937
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_netflow);
938
 
}
939
 
 
940
 
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
941
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
942
 
 * easier and more efficient way to search for a given key than implementing
943
 
 * the same operation on the "cooked" form in 'row'.
944
 
 *
945
 
 * 'key_type' must be OVSDB_TYPE_STRING.
946
 
 * 'value_type' must be OVSDB_TYPE_STRING.
947
 
 * (This helps to avoid silent bugs if someone changes other_config's
948
 
 * type without updating the caller.)
949
 
 *
950
 
 * The caller must not modify or free the returned value.
951
 
 *
952
 
 * Various kinds of changes can invalidate the returned value: modifying
953
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
954
 
 * If the returned value is needed for a long time, it is best to make a copy
955
 
 * of it with ovsdb_datum_clone(). */
956
 
const struct ovsdb_datum *
957
 
ovsrec_bridge_get_other_config(const struct ovsrec_bridge *row,
958
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
959
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
960
 
{
961
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
962
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
963
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_other_config);
964
 
}
965
 
 
966
 
/* Returns the ports column's value in 'row' as a struct ovsdb_datum.
967
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
968
 
 * easier and more efficient way to search for a given key than implementing
969
 
 * the same operation on the "cooked" form in 'row'.
970
 
 *
971
 
 * 'key_type' must be OVSDB_TYPE_UUID.
972
 
 * (This helps to avoid silent bugs if someone changes ports's
973
 
 * type without updating the caller.)
974
 
 *
975
 
 * The caller must not modify or free the returned value.
976
 
 *
977
 
 * Various kinds of changes can invalidate the returned value: modifying
978
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
979
 
 * If the returned value is needed for a long time, it is best to make a copy
980
 
 * of it with ovsdb_datum_clone(). */
981
 
const struct ovsdb_datum *
982
 
ovsrec_bridge_get_ports(const struct ovsrec_bridge *row,
983
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
984
 
{
985
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
986
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_ports);
987
 
}
988
 
 
989
 
/* Returns the protocols column's value in 'row' as a struct ovsdb_datum.
990
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
991
 
 * easier and more efficient way to search for a given key than implementing
992
 
 * the same operation on the "cooked" form in 'row'.
993
 
 *
994
 
 * 'key_type' must be OVSDB_TYPE_STRING.
995
 
 * (This helps to avoid silent bugs if someone changes protocols's
996
 
 * type without updating the caller.)
997
 
 *
998
 
 * The caller must not modify or free the returned value.
999
 
 *
1000
 
 * Various kinds of changes can invalidate the returned value: modifying
1001
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1002
 
 * If the returned value is needed for a long time, it is best to make a copy
1003
 
 * of it with ovsdb_datum_clone(). */
1004
 
const struct ovsdb_datum *
1005
 
ovsrec_bridge_get_protocols(const struct ovsrec_bridge *row,
1006
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
1007
 
{
1008
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
1009
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_protocols);
1010
 
}
1011
 
 
1012
 
/* Returns the sflow column's value in 'row' as a struct ovsdb_datum.
1013
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
1014
 
 * easier and more efficient way to search for a given key than implementing
1015
 
 * the same operation on the "cooked" form in 'row'.
1016
 
 *
1017
 
 * 'key_type' must be OVSDB_TYPE_UUID.
1018
 
 * (This helps to avoid silent bugs if someone changes sflow's
1019
 
 * type without updating the caller.)
1020
 
 *
1021
 
 * The caller must not modify or free the returned value.
1022
 
 *
1023
 
 * Various kinds of changes can invalidate the returned value: modifying
1024
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1025
 
 * If the returned value is needed for a long time, it is best to make a copy
1026
 
 * of it with ovsdb_datum_clone(). */
1027
 
const struct ovsdb_datum *
1028
 
ovsrec_bridge_get_sflow(const struct ovsrec_bridge *row,
1029
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
1030
 
{
1031
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
1032
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_sflow);
1033
 
}
1034
 
 
1035
 
/* Returns the status column's value in 'row' as a struct ovsdb_datum.
1036
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
1037
 
 * easier and more efficient way to search for a given key than implementing
1038
 
 * the same operation on the "cooked" form in 'row'.
1039
 
 *
1040
 
 * 'key_type' must be OVSDB_TYPE_STRING.
1041
 
 * 'value_type' must be OVSDB_TYPE_STRING.
1042
 
 * (This helps to avoid silent bugs if someone changes status's
1043
 
 * type without updating the caller.)
1044
 
 *
1045
 
 * The caller must not modify or free the returned value.
1046
 
 *
1047
 
 * Various kinds of changes can invalidate the returned value: modifying
1048
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1049
 
 * If the returned value is needed for a long time, it is best to make a copy
1050
 
 * of it with ovsdb_datum_clone(). */
1051
 
const struct ovsdb_datum *
1052
 
ovsrec_bridge_get_status(const struct ovsrec_bridge *row,
1053
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
1054
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
1055
 
{
1056
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
1057
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
1058
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_status);
1059
 
}
1060
 
 
1061
 
/* Returns the stp_enable column's value in 'row' as a struct ovsdb_datum.
1062
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
1063
 
 * easier and more efficient way to search for a given key than implementing
1064
 
 * the same operation on the "cooked" form in 'row'.
1065
 
 *
1066
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
1067
 
 * (This helps to avoid silent bugs if someone changes stp_enable's
1068
 
 * type without updating the caller.)
1069
 
 *
1070
 
 * The caller must not modify or free the returned value.
1071
 
 *
1072
 
 * Various kinds of changes can invalidate the returned value: modifying
1073
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
1074
 
 * If the returned value is needed for a long time, it is best to make a copy
1075
 
 * of it with ovsdb_datum_clone(). */
1076
 
const struct ovsdb_datum *
1077
 
ovsrec_bridge_get_stp_enable(const struct ovsrec_bridge *row,
1078
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
1079
 
{
1080
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
1081
 
    return ovsdb_idl_read(&row->header_, &ovsrec_bridge_col_stp_enable);
1082
 
}
1083
 
 
1084
 
void
1085
 
ovsrec_bridge_set_controller(const struct ovsrec_bridge *row, struct ovsrec_controller **controller, size_t n_controller)
1086
 
{
1087
 
    struct ovsdb_datum datum;
1088
 
    size_t i;
1089
 
 
1090
 
    ovs_assert(inited);
1091
 
    datum.n = n_controller;
1092
 
    datum.keys = n_controller ? xmalloc(n_controller * sizeof *datum.keys) : NULL;
1093
 
    datum.values = NULL;
1094
 
    for (i = 0; i < n_controller; i++) {
1095
 
        datum.keys[i].uuid = controller[i]->header_.uuid;
1096
 
    }
1097
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
1098
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_CONTROLLER], &datum);
1099
 
}
1100
 
 
1101
 
void
1102
 
ovsrec_bridge_set_datapath_id(const struct ovsrec_bridge *row, const char *datapath_id)
1103
 
{
1104
 
    struct ovsdb_datum datum;
1105
 
    union ovsdb_atom key;
1106
 
 
1107
 
    ovs_assert(inited);
1108
 
    if (datapath_id) {
1109
 
        datum.n = 1;
1110
 
        datum.keys = &key;
1111
 
        key.string = CONST_CAST(char *, datapath_id);
1112
 
    } else {
1113
 
        datum.n = 0;
1114
 
        datum.keys = NULL;
1115
 
    }
1116
 
    datum.values = NULL;
1117
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_DATAPATH_ID], &datum);
1118
 
}
1119
 
 
1120
 
void
1121
 
ovsrec_bridge_set_datapath_type(const struct ovsrec_bridge *row, const char *datapath_type)
1122
 
{
1123
 
    struct ovsdb_datum datum;
1124
 
    union ovsdb_atom key;
1125
 
 
1126
 
    ovs_assert(inited);
1127
 
    datum.n = 1;
1128
 
    datum.keys = &key;
1129
 
    key.string = CONST_CAST(char *, datapath_type);
1130
 
    datum.values = NULL;
1131
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_DATAPATH_TYPE], &datum);
1132
 
}
1133
 
 
1134
 
void
1135
 
ovsrec_bridge_set_external_ids(const struct ovsrec_bridge *row, const struct smap *smap)
1136
 
{
1137
 
    struct ovsdb_datum datum;
1138
 
 
1139
 
    ovs_assert(inited);
1140
 
    if (smap) {
1141
 
        struct smap_node *node;
1142
 
        size_t i;
1143
 
 
1144
 
        datum.n = smap_count(smap);
1145
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1146
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
1147
 
 
1148
 
        i = 0;
1149
 
        SMAP_FOR_EACH (node, smap) {
1150
 
            datum.keys[i].string = xstrdup(node->key);
1151
 
            datum.values[i].string = xstrdup(node->value);
1152
 
            i++;
1153
 
        }
1154
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1155
 
    } else {
1156
 
        ovsdb_datum_init_empty(&datum);
1157
 
    }
1158
 
    ovsdb_idl_txn_write(&row->header_,
1159
 
                        &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_EXTERNAL_IDS],
1160
 
                        &datum);
1161
 
}
1162
 
 
1163
 
 
1164
 
void
1165
 
ovsrec_bridge_set_fail_mode(const struct ovsrec_bridge *row, const char *fail_mode)
1166
 
{
1167
 
    struct ovsdb_datum datum;
1168
 
    union ovsdb_atom key;
1169
 
 
1170
 
    ovs_assert(inited);
1171
 
    if (fail_mode) {
1172
 
        datum.n = 1;
1173
 
        datum.keys = &key;
1174
 
        key.string = CONST_CAST(char *, fail_mode);
1175
 
    } else {
1176
 
        datum.n = 0;
1177
 
        datum.keys = NULL;
1178
 
    }
1179
 
    datum.values = NULL;
1180
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FAIL_MODE], &datum);
1181
 
}
1182
 
 
1183
 
void
1184
 
ovsrec_bridge_set_flood_vlans(const struct ovsrec_bridge *row, const int64_t *flood_vlans, size_t n_flood_vlans)
1185
 
{
1186
 
    struct ovsdb_datum datum;
1187
 
    size_t i;
1188
 
 
1189
 
    ovs_assert(inited);
1190
 
    datum.n = n_flood_vlans;
1191
 
    datum.keys = n_flood_vlans ? xmalloc(n_flood_vlans * sizeof *datum.keys) : NULL;
1192
 
    datum.values = NULL;
1193
 
    for (i = 0; i < n_flood_vlans; i++) {
1194
 
        datum.keys[i].integer = flood_vlans[i];
1195
 
    }
1196
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_VOID);
1197
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FLOOD_VLANS], &datum);
1198
 
}
1199
 
 
1200
 
void
1201
 
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)
1202
 
{
1203
 
    struct ovsdb_datum datum;
1204
 
    size_t i;
1205
 
 
1206
 
    ovs_assert(inited);
1207
 
    datum.n = n_flow_tables;
1208
 
    datum.keys = n_flow_tables ? xmalloc(n_flow_tables * sizeof *datum.keys) : NULL;
1209
 
    datum.values = xmalloc(n_flow_tables * sizeof *datum.values);
1210
 
    for (i = 0; i < n_flow_tables; i++) {
1211
 
        datum.keys[i].integer = key_flow_tables[i];
1212
 
        datum.values[i].uuid = value_flow_tables[i]->header_.uuid;
1213
 
    }
1214
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_UUID);
1215
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_FLOW_TABLES], &datum);
1216
 
}
1217
 
 
1218
 
void
1219
 
ovsrec_bridge_set_ipfix(const struct ovsrec_bridge *row, const struct ovsrec_ipfix *ipfix)
1220
 
{
1221
 
    struct ovsdb_datum datum;
1222
 
    union ovsdb_atom key;
1223
 
 
1224
 
    ovs_assert(inited);
1225
 
    if (ipfix) {
1226
 
        datum.n = 1;
1227
 
        datum.keys = &key;
1228
 
        key.uuid = ipfix->header_.uuid;
1229
 
    } else {
1230
 
        datum.n = 0;
1231
 
        datum.keys = NULL;
1232
 
    }
1233
 
    datum.values = NULL;
1234
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_IPFIX], &datum);
1235
 
}
1236
 
 
1237
 
void
1238
 
ovsrec_bridge_set_mirrors(const struct ovsrec_bridge *row, struct ovsrec_mirror **mirrors, size_t n_mirrors)
1239
 
{
1240
 
    struct ovsdb_datum datum;
1241
 
    size_t i;
1242
 
 
1243
 
    ovs_assert(inited);
1244
 
    datum.n = n_mirrors;
1245
 
    datum.keys = n_mirrors ? xmalloc(n_mirrors * sizeof *datum.keys) : NULL;
1246
 
    datum.values = NULL;
1247
 
    for (i = 0; i < n_mirrors; i++) {
1248
 
        datum.keys[i].uuid = mirrors[i]->header_.uuid;
1249
 
    }
1250
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
1251
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_MIRRORS], &datum);
1252
 
}
1253
 
 
1254
 
void
1255
 
ovsrec_bridge_set_name(const struct ovsrec_bridge *row, const char *name)
1256
 
{
1257
 
    struct ovsdb_datum datum;
1258
 
    union ovsdb_atom key;
1259
 
 
1260
 
    ovs_assert(inited);
1261
 
    datum.n = 1;
1262
 
    datum.keys = &key;
1263
 
    key.string = CONST_CAST(char *, name);
1264
 
    datum.values = NULL;
1265
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_NAME], &datum);
1266
 
}
1267
 
 
1268
 
void
1269
 
ovsrec_bridge_set_netflow(const struct ovsrec_bridge *row, const struct ovsrec_netflow *netflow)
1270
 
{
1271
 
    struct ovsdb_datum datum;
1272
 
    union ovsdb_atom key;
1273
 
 
1274
 
    ovs_assert(inited);
1275
 
    if (netflow) {
1276
 
        datum.n = 1;
1277
 
        datum.keys = &key;
1278
 
        key.uuid = netflow->header_.uuid;
1279
 
    } else {
1280
 
        datum.n = 0;
1281
 
        datum.keys = NULL;
1282
 
    }
1283
 
    datum.values = NULL;
1284
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_NETFLOW], &datum);
1285
 
}
1286
 
 
1287
 
void
1288
 
ovsrec_bridge_set_other_config(const struct ovsrec_bridge *row, const struct smap *smap)
1289
 
{
1290
 
    struct ovsdb_datum datum;
1291
 
 
1292
 
    ovs_assert(inited);
1293
 
    if (smap) {
1294
 
        struct smap_node *node;
1295
 
        size_t i;
1296
 
 
1297
 
        datum.n = smap_count(smap);
1298
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1299
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
1300
 
 
1301
 
        i = 0;
1302
 
        SMAP_FOR_EACH (node, smap) {
1303
 
            datum.keys[i].string = xstrdup(node->key);
1304
 
            datum.values[i].string = xstrdup(node->value);
1305
 
            i++;
1306
 
        }
1307
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1308
 
    } else {
1309
 
        ovsdb_datum_init_empty(&datum);
1310
 
    }
1311
 
    ovsdb_idl_txn_write(&row->header_,
1312
 
                        &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_OTHER_CONFIG],
1313
 
                        &datum);
1314
 
}
1315
 
 
1316
 
 
1317
 
void
1318
 
ovsrec_bridge_set_ports(const struct ovsrec_bridge *row, struct ovsrec_port **ports, size_t n_ports)
1319
 
{
1320
 
    struct ovsdb_datum datum;
1321
 
    size_t i;
1322
 
 
1323
 
    ovs_assert(inited);
1324
 
    datum.n = n_ports;
1325
 
    datum.keys = n_ports ? xmalloc(n_ports * sizeof *datum.keys) : NULL;
1326
 
    datum.values = NULL;
1327
 
    for (i = 0; i < n_ports; i++) {
1328
 
        datum.keys[i].uuid = ports[i]->header_.uuid;
1329
 
    }
1330
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
1331
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_PORTS], &datum);
1332
 
}
1333
 
 
1334
 
void
1335
 
ovsrec_bridge_set_protocols(const struct ovsrec_bridge *row, char **protocols, size_t n_protocols)
1336
 
{
1337
 
    struct ovsdb_datum datum;
1338
 
    size_t i;
1339
 
 
1340
 
    ovs_assert(inited);
1341
 
    datum.n = n_protocols;
1342
 
    datum.keys = n_protocols ? xmalloc(n_protocols * sizeof *datum.keys) : NULL;
1343
 
    datum.values = NULL;
1344
 
    for (i = 0; i < n_protocols; i++) {
1345
 
        datum.keys[i].string = xstrdup(protocols[i]);
1346
 
    }
1347
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
1348
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_PROTOCOLS], &datum);
1349
 
}
1350
 
 
1351
 
void
1352
 
ovsrec_bridge_set_sflow(const struct ovsrec_bridge *row, const struct ovsrec_sflow *sflow)
1353
 
{
1354
 
    struct ovsdb_datum datum;
1355
 
    union ovsdb_atom key;
1356
 
 
1357
 
    ovs_assert(inited);
1358
 
    if (sflow) {
1359
 
        datum.n = 1;
1360
 
        datum.keys = &key;
1361
 
        key.uuid = sflow->header_.uuid;
1362
 
    } else {
1363
 
        datum.n = 0;
1364
 
        datum.keys = NULL;
1365
 
    }
1366
 
    datum.values = NULL;
1367
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_SFLOW], &datum);
1368
 
}
1369
 
 
1370
 
void
1371
 
ovsrec_bridge_set_status(const struct ovsrec_bridge *row, const struct smap *smap)
1372
 
{
1373
 
    struct ovsdb_datum datum;
1374
 
 
1375
 
    ovs_assert(inited);
1376
 
    if (smap) {
1377
 
        struct smap_node *node;
1378
 
        size_t i;
1379
 
 
1380
 
        datum.n = smap_count(smap);
1381
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
1382
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
1383
 
 
1384
 
        i = 0;
1385
 
        SMAP_FOR_EACH (node, smap) {
1386
 
            datum.keys[i].string = xstrdup(node->key);
1387
 
            datum.values[i].string = xstrdup(node->value);
1388
 
            i++;
1389
 
        }
1390
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
1391
 
    } else {
1392
 
        ovsdb_datum_init_empty(&datum);
1393
 
    }
1394
 
    ovsdb_idl_txn_write(&row->header_,
1395
 
                        &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_STATUS],
1396
 
                        &datum);
1397
 
}
1398
 
 
1399
 
 
1400
 
void
1401
 
ovsrec_bridge_set_stp_enable(const struct ovsrec_bridge *row, bool stp_enable)
1402
 
{
1403
 
    struct ovsdb_datum datum;
1404
 
    union ovsdb_atom key;
1405
 
 
1406
 
    ovs_assert(inited);
1407
 
    datum.n = 1;
1408
 
    datum.keys = &key;
1409
 
    key.boolean = stp_enable;
1410
 
    datum.values = NULL;
1411
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_bridge_columns[OVSREC_BRIDGE_COL_STP_ENABLE], &datum);
1412
 
}
1413
 
 
1414
 
struct ovsdb_idl_column ovsrec_bridge_columns[OVSREC_BRIDGE_N_COLUMNS];
1415
 
 
1416
 
static void
1417
 
ovsrec_bridge_columns_init(void)
1418
 
{
1419
 
    struct ovsdb_idl_column *c;
1420
 
 
1421
 
    /* Initialize ovsrec_bridge_col_controller. */
1422
 
    c = &ovsrec_bridge_col_controller;
1423
 
    c->name = "controller";
1424
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1425
 
    c->type.key.u.uuid.refTableName = "Controller";
1426
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1427
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1428
 
    c->type.n_min = 0;
1429
 
    c->type.n_max = UINT_MAX;
1430
 
    c->mutable = true;
1431
 
    c->parse = ovsrec_bridge_parse_controller;
1432
 
    c->unparse = ovsrec_bridge_unparse_controller;
1433
 
 
1434
 
    /* Initialize ovsrec_bridge_col_datapath_id. */
1435
 
    c = &ovsrec_bridge_col_datapath_id;
1436
 
    c->name = "datapath_id";
1437
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1438
 
    c->type.key.u.string.minLen = 0;
1439
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1440
 
    c->type.n_min = 0;
1441
 
    c->type.n_max = 1;
1442
 
    c->mutable = true;
1443
 
    c->parse = ovsrec_bridge_parse_datapath_id;
1444
 
    c->unparse = ovsrec_bridge_unparse_datapath_id;
1445
 
 
1446
 
    /* Initialize ovsrec_bridge_col_datapath_type. */
1447
 
    c = &ovsrec_bridge_col_datapath_type;
1448
 
    c->name = "datapath_type";
1449
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1450
 
    c->type.key.u.string.minLen = 0;
1451
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1452
 
    c->type.n_min = 1;
1453
 
    c->type.n_max = 1;
1454
 
    c->mutable = true;
1455
 
    c->parse = ovsrec_bridge_parse_datapath_type;
1456
 
    c->unparse = ovsrec_bridge_unparse_datapath_type;
1457
 
 
1458
 
    /* Initialize ovsrec_bridge_col_external_ids. */
1459
 
    c = &ovsrec_bridge_col_external_ids;
1460
 
    c->name = "external_ids";
1461
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1462
 
    c->type.key.u.string.minLen = 0;
1463
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
1464
 
    c->type.value.u.string.minLen = 0;
1465
 
    c->type.n_min = 0;
1466
 
    c->type.n_max = UINT_MAX;
1467
 
    c->mutable = true;
1468
 
    c->parse = ovsrec_bridge_parse_external_ids;
1469
 
    c->unparse = ovsrec_bridge_unparse_external_ids;
1470
 
 
1471
 
    /* Initialize ovsrec_bridge_col_fail_mode. */
1472
 
    c = &ovsrec_bridge_col_fail_mode;
1473
 
    c->name = "fail_mode";
1474
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1475
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
1476
 
    c->type.key.enum_->n = 2;
1477
 
    c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
1478
 
    c->type.key.enum_->keys[0].string = xstrdup("secure");
1479
 
    c->type.key.enum_->keys[1].string = xstrdup("standalone");
1480
 
    c->type.key.enum_->values = NULL;
1481
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
1482
 
    c->type.key.u.string.minLen = 0;
1483
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1484
 
    c->type.n_min = 0;
1485
 
    c->type.n_max = 1;
1486
 
    c->mutable = true;
1487
 
    c->parse = ovsrec_bridge_parse_fail_mode;
1488
 
    c->unparse = ovsrec_bridge_unparse_fail_mode;
1489
 
 
1490
 
    /* Initialize ovsrec_bridge_col_flood_vlans. */
1491
 
    c = &ovsrec_bridge_col_flood_vlans;
1492
 
    c->name = "flood_vlans";
1493
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
1494
 
    c->type.key.u.integer.min = INT64_C(0);
1495
 
    c->type.key.u.integer.max = INT64_C(4095);
1496
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1497
 
    c->type.n_min = 0;
1498
 
    c->type.n_max = 4096;
1499
 
    c->mutable = true;
1500
 
    c->parse = ovsrec_bridge_parse_flood_vlans;
1501
 
    c->unparse = ovsrec_bridge_unparse_flood_vlans;
1502
 
 
1503
 
    /* Initialize ovsrec_bridge_col_flow_tables. */
1504
 
    c = &ovsrec_bridge_col_flow_tables;
1505
 
    c->name = "flow_tables";
1506
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
1507
 
    c->type.key.u.integer.min = INT64_C(0);
1508
 
    c->type.key.u.integer.max = INT64_C(254);
1509
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_UUID);
1510
 
    c->type.value.u.uuid.refTableName = "Flow_Table";
1511
 
    c->type.value.u.uuid.refType = OVSDB_REF_STRONG;
1512
 
    c->type.n_min = 0;
1513
 
    c->type.n_max = UINT_MAX;
1514
 
    c->mutable = true;
1515
 
    c->parse = ovsrec_bridge_parse_flow_tables;
1516
 
    c->unparse = ovsrec_bridge_unparse_flow_tables;
1517
 
 
1518
 
    /* Initialize ovsrec_bridge_col_ipfix. */
1519
 
    c = &ovsrec_bridge_col_ipfix;
1520
 
    c->name = "ipfix";
1521
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1522
 
    c->type.key.u.uuid.refTableName = "IPFIX";
1523
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1524
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1525
 
    c->type.n_min = 0;
1526
 
    c->type.n_max = 1;
1527
 
    c->mutable = true;
1528
 
    c->parse = ovsrec_bridge_parse_ipfix;
1529
 
    c->unparse = ovsrec_bridge_unparse_ipfix;
1530
 
 
1531
 
    /* Initialize ovsrec_bridge_col_mirrors. */
1532
 
    c = &ovsrec_bridge_col_mirrors;
1533
 
    c->name = "mirrors";
1534
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1535
 
    c->type.key.u.uuid.refTableName = "Mirror";
1536
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1537
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1538
 
    c->type.n_min = 0;
1539
 
    c->type.n_max = UINT_MAX;
1540
 
    c->mutable = true;
1541
 
    c->parse = ovsrec_bridge_parse_mirrors;
1542
 
    c->unparse = ovsrec_bridge_unparse_mirrors;
1543
 
 
1544
 
    /* Initialize ovsrec_bridge_col_name. */
1545
 
    c = &ovsrec_bridge_col_name;
1546
 
    c->name = "name";
1547
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1548
 
    c->type.key.u.string.minLen = 0;
1549
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1550
 
    c->type.n_min = 1;
1551
 
    c->type.n_max = 1;
1552
 
    c->mutable = false;
1553
 
    c->parse = ovsrec_bridge_parse_name;
1554
 
    c->unparse = ovsrec_bridge_unparse_name;
1555
 
 
1556
 
    /* Initialize ovsrec_bridge_col_netflow. */
1557
 
    c = &ovsrec_bridge_col_netflow;
1558
 
    c->name = "netflow";
1559
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1560
 
    c->type.key.u.uuid.refTableName = "NetFlow";
1561
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1562
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1563
 
    c->type.n_min = 0;
1564
 
    c->type.n_max = 1;
1565
 
    c->mutable = true;
1566
 
    c->parse = ovsrec_bridge_parse_netflow;
1567
 
    c->unparse = ovsrec_bridge_unparse_netflow;
1568
 
 
1569
 
    /* Initialize ovsrec_bridge_col_other_config. */
1570
 
    c = &ovsrec_bridge_col_other_config;
1571
 
    c->name = "other_config";
1572
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1573
 
    c->type.key.u.string.minLen = 0;
1574
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
1575
 
    c->type.value.u.string.minLen = 0;
1576
 
    c->type.n_min = 0;
1577
 
    c->type.n_max = UINT_MAX;
1578
 
    c->mutable = true;
1579
 
    c->parse = ovsrec_bridge_parse_other_config;
1580
 
    c->unparse = ovsrec_bridge_unparse_other_config;
1581
 
 
1582
 
    /* Initialize ovsrec_bridge_col_ports. */
1583
 
    c = &ovsrec_bridge_col_ports;
1584
 
    c->name = "ports";
1585
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1586
 
    c->type.key.u.uuid.refTableName = "Port";
1587
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1588
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1589
 
    c->type.n_min = 0;
1590
 
    c->type.n_max = UINT_MAX;
1591
 
    c->mutable = true;
1592
 
    c->parse = ovsrec_bridge_parse_ports;
1593
 
    c->unparse = ovsrec_bridge_unparse_ports;
1594
 
 
1595
 
    /* Initialize ovsrec_bridge_col_protocols. */
1596
 
    c = &ovsrec_bridge_col_protocols;
1597
 
    c->name = "protocols";
1598
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1599
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
1600
 
    c->type.key.enum_->n = 6;
1601
 
    c->type.key.enum_->keys = xmalloc(6 * sizeof *c->type.key.enum_->keys);
1602
 
    c->type.key.enum_->keys[0].string = xstrdup("OpenFlow10");
1603
 
    c->type.key.enum_->keys[1].string = xstrdup("OpenFlow11");
1604
 
    c->type.key.enum_->keys[2].string = xstrdup("OpenFlow12");
1605
 
    c->type.key.enum_->keys[3].string = xstrdup("OpenFlow13");
1606
 
    c->type.key.enum_->keys[4].string = xstrdup("OpenFlow14");
1607
 
    c->type.key.enum_->keys[5].string = xstrdup("OpenFlow15");
1608
 
    c->type.key.enum_->values = NULL;
1609
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
1610
 
    c->type.key.u.string.minLen = 0;
1611
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1612
 
    c->type.n_min = 0;
1613
 
    c->type.n_max = UINT_MAX;
1614
 
    c->mutable = true;
1615
 
    c->parse = ovsrec_bridge_parse_protocols;
1616
 
    c->unparse = ovsrec_bridge_unparse_protocols;
1617
 
 
1618
 
    /* Initialize ovsrec_bridge_col_sflow. */
1619
 
    c = &ovsrec_bridge_col_sflow;
1620
 
    c->name = "sflow";
1621
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
1622
 
    c->type.key.u.uuid.refTableName = "sFlow";
1623
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
1624
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1625
 
    c->type.n_min = 0;
1626
 
    c->type.n_max = 1;
1627
 
    c->mutable = true;
1628
 
    c->parse = ovsrec_bridge_parse_sflow;
1629
 
    c->unparse = ovsrec_bridge_unparse_sflow;
1630
 
 
1631
 
    /* Initialize ovsrec_bridge_col_status. */
1632
 
    c = &ovsrec_bridge_col_status;
1633
 
    c->name = "status";
1634
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
1635
 
    c->type.key.u.string.minLen = 0;
1636
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
1637
 
    c->type.value.u.string.minLen = 0;
1638
 
    c->type.n_min = 0;
1639
 
    c->type.n_max = UINT_MAX;
1640
 
    c->mutable = true;
1641
 
    c->parse = ovsrec_bridge_parse_status;
1642
 
    c->unparse = ovsrec_bridge_unparse_status;
1643
 
 
1644
 
    /* Initialize ovsrec_bridge_col_stp_enable. */
1645
 
    c = &ovsrec_bridge_col_stp_enable;
1646
 
    c->name = "stp_enable";
1647
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
1648
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
1649
 
    c->type.n_min = 1;
1650
 
    c->type.n_max = 1;
1651
 
    c->mutable = true;
1652
 
    c->parse = ovsrec_bridge_parse_stp_enable;
1653
 
    c->unparse = ovsrec_bridge_unparse_stp_enable;
1654
 
}
1655
 
 
1656
 
/* Controller table. */
1657
 
 
1658
 
static void
1659
 
ovsrec_controller_parse_connection_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1660
 
{
1661
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1662
 
 
1663
 
    ovs_assert(inited);
1664
 
    if (datum->n >= 1) {
1665
 
        row->connection_mode = datum->keys[0].string;
1666
 
    } else {
1667
 
        row->connection_mode = NULL;
1668
 
    }
1669
 
}
1670
 
 
1671
 
static void
1672
 
ovsrec_controller_parse_controller_burst_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1673
 
{
1674
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1675
 
    size_t n = MIN(1, datum->n);
1676
 
    size_t i;
1677
 
 
1678
 
    ovs_assert(inited);
1679
 
    row->controller_burst_limit = NULL;
1680
 
    row->n_controller_burst_limit = 0;
1681
 
    for (i = 0; i < n; i++) {
1682
 
        if (!row->n_controller_burst_limit) {
1683
 
            row->controller_burst_limit = xmalloc(n * sizeof *row->controller_burst_limit);
1684
 
        }
1685
 
        row->controller_burst_limit[row->n_controller_burst_limit] = datum->keys[i].integer;
1686
 
        row->n_controller_burst_limit++;
1687
 
    }
1688
 
}
1689
 
 
1690
 
static void
1691
 
ovsrec_controller_parse_controller_rate_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1692
 
{
1693
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1694
 
    size_t n = MIN(1, datum->n);
1695
 
    size_t i;
1696
 
 
1697
 
    ovs_assert(inited);
1698
 
    row->controller_rate_limit = NULL;
1699
 
    row->n_controller_rate_limit = 0;
1700
 
    for (i = 0; i < n; i++) {
1701
 
        if (!row->n_controller_rate_limit) {
1702
 
            row->controller_rate_limit = xmalloc(n * sizeof *row->controller_rate_limit);
1703
 
        }
1704
 
        row->controller_rate_limit[row->n_controller_rate_limit] = datum->keys[i].integer;
1705
 
        row->n_controller_rate_limit++;
1706
 
    }
1707
 
}
1708
 
 
1709
 
static void
1710
 
ovsrec_controller_parse_enable_async_messages(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1711
 
{
1712
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1713
 
    size_t n = MIN(1, datum->n);
1714
 
    size_t i;
1715
 
 
1716
 
    ovs_assert(inited);
1717
 
    row->enable_async_messages = NULL;
1718
 
    row->n_enable_async_messages = 0;
1719
 
    for (i = 0; i < n; i++) {
1720
 
        if (!row->n_enable_async_messages) {
1721
 
            row->enable_async_messages = xmalloc(n * sizeof_bool);
1722
 
        }
1723
 
        row->enable_async_messages[row->n_enable_async_messages] = datum->keys[i].boolean;
1724
 
        row->n_enable_async_messages++;
1725
 
    }
1726
 
}
1727
 
 
1728
 
static void
1729
 
ovsrec_controller_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1730
 
{
1731
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1732
 
    size_t i;
1733
 
 
1734
 
    ovs_assert(inited);
1735
 
    smap_init(&row->external_ids);
1736
 
    for (i = 0; i < datum->n; i++) {
1737
 
        smap_add(&row->external_ids,
1738
 
                 datum->keys[i].string,
1739
 
                 datum->values[i].string);
1740
 
    }
1741
 
}
1742
 
 
1743
 
static void
1744
 
ovsrec_controller_parse_inactivity_probe(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1745
 
{
1746
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1747
 
    size_t n = MIN(1, datum->n);
1748
 
    size_t i;
1749
 
 
1750
 
    ovs_assert(inited);
1751
 
    row->inactivity_probe = NULL;
1752
 
    row->n_inactivity_probe = 0;
1753
 
    for (i = 0; i < n; i++) {
1754
 
        if (!row->n_inactivity_probe) {
1755
 
            row->inactivity_probe = xmalloc(n * sizeof *row->inactivity_probe);
1756
 
        }
1757
 
        row->inactivity_probe[row->n_inactivity_probe] = datum->keys[i].integer;
1758
 
        row->n_inactivity_probe++;
1759
 
    }
1760
 
}
1761
 
 
1762
 
static void
1763
 
ovsrec_controller_parse_is_connected(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1764
 
{
1765
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1766
 
 
1767
 
    ovs_assert(inited);
1768
 
    if (datum->n >= 1) {
1769
 
        row->is_connected = datum->keys[0].boolean;
1770
 
    } else {
1771
 
        row->is_connected = false;
1772
 
    }
1773
 
}
1774
 
 
1775
 
static void
1776
 
ovsrec_controller_parse_local_gateway(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1777
 
{
1778
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1779
 
 
1780
 
    ovs_assert(inited);
1781
 
    if (datum->n >= 1) {
1782
 
        row->local_gateway = datum->keys[0].string;
1783
 
    } else {
1784
 
        row->local_gateway = NULL;
1785
 
    }
1786
 
}
1787
 
 
1788
 
static void
1789
 
ovsrec_controller_parse_local_ip(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1790
 
{
1791
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1792
 
 
1793
 
    ovs_assert(inited);
1794
 
    if (datum->n >= 1) {
1795
 
        row->local_ip = datum->keys[0].string;
1796
 
    } else {
1797
 
        row->local_ip = NULL;
1798
 
    }
1799
 
}
1800
 
 
1801
 
static void
1802
 
ovsrec_controller_parse_local_netmask(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1803
 
{
1804
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1805
 
 
1806
 
    ovs_assert(inited);
1807
 
    if (datum->n >= 1) {
1808
 
        row->local_netmask = datum->keys[0].string;
1809
 
    } else {
1810
 
        row->local_netmask = NULL;
1811
 
    }
1812
 
}
1813
 
 
1814
 
static void
1815
 
ovsrec_controller_parse_max_backoff(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1816
 
{
1817
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1818
 
    size_t n = MIN(1, datum->n);
1819
 
    size_t i;
1820
 
 
1821
 
    ovs_assert(inited);
1822
 
    row->max_backoff = NULL;
1823
 
    row->n_max_backoff = 0;
1824
 
    for (i = 0; i < n; i++) {
1825
 
        if (!row->n_max_backoff) {
1826
 
            row->max_backoff = xmalloc(n * sizeof *row->max_backoff);
1827
 
        }
1828
 
        row->max_backoff[row->n_max_backoff] = datum->keys[i].integer;
1829
 
        row->n_max_backoff++;
1830
 
    }
1831
 
}
1832
 
 
1833
 
static void
1834
 
ovsrec_controller_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1835
 
{
1836
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1837
 
    size_t i;
1838
 
 
1839
 
    ovs_assert(inited);
1840
 
    smap_init(&row->other_config);
1841
 
    for (i = 0; i < datum->n; i++) {
1842
 
        smap_add(&row->other_config,
1843
 
                 datum->keys[i].string,
1844
 
                 datum->values[i].string);
1845
 
    }
1846
 
}
1847
 
 
1848
 
static void
1849
 
ovsrec_controller_parse_role(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1850
 
{
1851
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1852
 
 
1853
 
    ovs_assert(inited);
1854
 
    if (datum->n >= 1) {
1855
 
        row->role = datum->keys[0].string;
1856
 
    } else {
1857
 
        row->role = NULL;
1858
 
    }
1859
 
}
1860
 
 
1861
 
static void
1862
 
ovsrec_controller_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1863
 
{
1864
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1865
 
    size_t i;
1866
 
 
1867
 
    ovs_assert(inited);
1868
 
    smap_init(&row->status);
1869
 
    for (i = 0; i < datum->n; i++) {
1870
 
        smap_add(&row->status,
1871
 
                 datum->keys[i].string,
1872
 
                 datum->values[i].string);
1873
 
    }
1874
 
}
1875
 
 
1876
 
static void
1877
 
ovsrec_controller_parse_target(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
1878
 
{
1879
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1880
 
 
1881
 
    ovs_assert(inited);
1882
 
    if (datum->n >= 1) {
1883
 
        row->target = datum->keys[0].string;
1884
 
    } else {
1885
 
        row->target = "";
1886
 
    }
1887
 
}
1888
 
 
1889
 
static void
1890
 
ovsrec_controller_unparse_connection_mode(struct ovsdb_idl_row *row OVS_UNUSED)
1891
 
{
1892
 
    /* Nothing to do. */
1893
 
}
1894
 
 
1895
 
static void
1896
 
ovsrec_controller_unparse_controller_burst_limit(struct ovsdb_idl_row *row_)
1897
 
{
1898
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1899
 
 
1900
 
    ovs_assert(inited);
1901
 
    free(row->controller_burst_limit);
1902
 
}
1903
 
 
1904
 
static void
1905
 
ovsrec_controller_unparse_controller_rate_limit(struct ovsdb_idl_row *row_)
1906
 
{
1907
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1908
 
 
1909
 
    ovs_assert(inited);
1910
 
    free(row->controller_rate_limit);
1911
 
}
1912
 
 
1913
 
static void
1914
 
ovsrec_controller_unparse_enable_async_messages(struct ovsdb_idl_row *row_)
1915
 
{
1916
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1917
 
 
1918
 
    ovs_assert(inited);
1919
 
    free(row->enable_async_messages);
1920
 
}
1921
 
 
1922
 
static void
1923
 
ovsrec_controller_unparse_external_ids(struct ovsdb_idl_row *row_)
1924
 
{
1925
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1926
 
 
1927
 
    ovs_assert(inited);
1928
 
    smap_destroy(&row->external_ids);
1929
 
}
1930
 
 
1931
 
static void
1932
 
ovsrec_controller_unparse_inactivity_probe(struct ovsdb_idl_row *row_)
1933
 
{
1934
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1935
 
 
1936
 
    ovs_assert(inited);
1937
 
    free(row->inactivity_probe);
1938
 
}
1939
 
 
1940
 
static void
1941
 
ovsrec_controller_unparse_is_connected(struct ovsdb_idl_row *row OVS_UNUSED)
1942
 
{
1943
 
    /* Nothing to do. */
1944
 
}
1945
 
 
1946
 
static void
1947
 
ovsrec_controller_unparse_local_gateway(struct ovsdb_idl_row *row OVS_UNUSED)
1948
 
{
1949
 
    /* Nothing to do. */
1950
 
}
1951
 
 
1952
 
static void
1953
 
ovsrec_controller_unparse_local_ip(struct ovsdb_idl_row *row OVS_UNUSED)
1954
 
{
1955
 
    /* Nothing to do. */
1956
 
}
1957
 
 
1958
 
static void
1959
 
ovsrec_controller_unparse_local_netmask(struct ovsdb_idl_row *row OVS_UNUSED)
1960
 
{
1961
 
    /* Nothing to do. */
1962
 
}
1963
 
 
1964
 
static void
1965
 
ovsrec_controller_unparse_max_backoff(struct ovsdb_idl_row *row_)
1966
 
{
1967
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1968
 
 
1969
 
    ovs_assert(inited);
1970
 
    free(row->max_backoff);
1971
 
}
1972
 
 
1973
 
static void
1974
 
ovsrec_controller_unparse_other_config(struct ovsdb_idl_row *row_)
1975
 
{
1976
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1977
 
 
1978
 
    ovs_assert(inited);
1979
 
    smap_destroy(&row->other_config);
1980
 
}
1981
 
 
1982
 
static void
1983
 
ovsrec_controller_unparse_role(struct ovsdb_idl_row *row OVS_UNUSED)
1984
 
{
1985
 
    /* Nothing to do. */
1986
 
}
1987
 
 
1988
 
static void
1989
 
ovsrec_controller_unparse_status(struct ovsdb_idl_row *row_)
1990
 
{
1991
 
    struct ovsrec_controller *row = ovsrec_controller_cast(row_);
1992
 
 
1993
 
    ovs_assert(inited);
1994
 
    smap_destroy(&row->status);
1995
 
}
1996
 
 
1997
 
static void
1998
 
ovsrec_controller_unparse_target(struct ovsdb_idl_row *row OVS_UNUSED)
1999
 
{
2000
 
    /* Nothing to do. */
2001
 
}
2002
 
 
2003
 
static void
2004
 
ovsrec_controller_init__(struct ovsdb_idl_row *row)
2005
 
{
2006
 
    ovsrec_controller_init(ovsrec_controller_cast(row));
2007
 
}
2008
 
 
2009
 
void
2010
 
ovsrec_controller_init(struct ovsrec_controller *row)
2011
 
{
2012
 
    memset(row, 0, sizeof *row); 
2013
 
    smap_init(&row->external_ids);
2014
 
    smap_init(&row->other_config);
2015
 
    smap_init(&row->status);
2016
 
}
2017
 
 
2018
 
const struct ovsrec_controller *
2019
 
ovsrec_controller_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
2020
 
{
2021
 
    return ovsrec_controller_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER], uuid));
2022
 
}
2023
 
 
2024
 
const struct ovsrec_controller *
2025
 
ovsrec_controller_first(const struct ovsdb_idl *idl)
2026
 
{
2027
 
    return ovsrec_controller_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER]));
2028
 
}
2029
 
 
2030
 
const struct ovsrec_controller *
2031
 
ovsrec_controller_next(const struct ovsrec_controller *row)
2032
 
{
2033
 
    return ovsrec_controller_cast(ovsdb_idl_next_row(&row->header_));
2034
 
}
2035
 
 
2036
 
void
2037
 
ovsrec_controller_delete(const struct ovsrec_controller *row)
2038
 
{
2039
 
    ovsdb_idl_txn_delete(&row->header_);
2040
 
}
2041
 
 
2042
 
struct ovsrec_controller *
2043
 
ovsrec_controller_insert(struct ovsdb_idl_txn *txn)
2044
 
{
2045
 
    return ovsrec_controller_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_CONTROLLER], NULL));
2046
 
}
2047
 
 
2048
 
 
2049
 
void
2050
 
ovsrec_controller_verify_connection_mode(const struct ovsrec_controller *row)
2051
 
{
2052
 
    ovs_assert(inited);
2053
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONNECTION_MODE]);
2054
 
}
2055
 
 
2056
 
void
2057
 
ovsrec_controller_verify_controller_burst_limit(const struct ovsrec_controller *row)
2058
 
{
2059
 
    ovs_assert(inited);
2060
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONTROLLER_BURST_LIMIT]);
2061
 
}
2062
 
 
2063
 
void
2064
 
ovsrec_controller_verify_controller_rate_limit(const struct ovsrec_controller *row)
2065
 
{
2066
 
    ovs_assert(inited);
2067
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONTROLLER_RATE_LIMIT]);
2068
 
}
2069
 
 
2070
 
void
2071
 
ovsrec_controller_verify_enable_async_messages(const struct ovsrec_controller *row)
2072
 
{
2073
 
    ovs_assert(inited);
2074
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_ENABLE_ASYNC_MESSAGES]);
2075
 
}
2076
 
 
2077
 
void
2078
 
ovsrec_controller_verify_external_ids(const struct ovsrec_controller *row)
2079
 
{
2080
 
    ovs_assert(inited);
2081
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_EXTERNAL_IDS]);
2082
 
}
2083
 
 
2084
 
void
2085
 
ovsrec_controller_verify_inactivity_probe(const struct ovsrec_controller *row)
2086
 
{
2087
 
    ovs_assert(inited);
2088
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_INACTIVITY_PROBE]);
2089
 
}
2090
 
 
2091
 
void
2092
 
ovsrec_controller_verify_is_connected(const struct ovsrec_controller *row)
2093
 
{
2094
 
    ovs_assert(inited);
2095
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_IS_CONNECTED]);
2096
 
}
2097
 
 
2098
 
void
2099
 
ovsrec_controller_verify_local_gateway(const struct ovsrec_controller *row)
2100
 
{
2101
 
    ovs_assert(inited);
2102
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_GATEWAY]);
2103
 
}
2104
 
 
2105
 
void
2106
 
ovsrec_controller_verify_local_ip(const struct ovsrec_controller *row)
2107
 
{
2108
 
    ovs_assert(inited);
2109
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_IP]);
2110
 
}
2111
 
 
2112
 
void
2113
 
ovsrec_controller_verify_local_netmask(const struct ovsrec_controller *row)
2114
 
{
2115
 
    ovs_assert(inited);
2116
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_NETMASK]);
2117
 
}
2118
 
 
2119
 
void
2120
 
ovsrec_controller_verify_max_backoff(const struct ovsrec_controller *row)
2121
 
{
2122
 
    ovs_assert(inited);
2123
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_MAX_BACKOFF]);
2124
 
}
2125
 
 
2126
 
void
2127
 
ovsrec_controller_verify_other_config(const struct ovsrec_controller *row)
2128
 
{
2129
 
    ovs_assert(inited);
2130
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_OTHER_CONFIG]);
2131
 
}
2132
 
 
2133
 
void
2134
 
ovsrec_controller_verify_role(const struct ovsrec_controller *row)
2135
 
{
2136
 
    ovs_assert(inited);
2137
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_ROLE]);
2138
 
}
2139
 
 
2140
 
void
2141
 
ovsrec_controller_verify_status(const struct ovsrec_controller *row)
2142
 
{
2143
 
    ovs_assert(inited);
2144
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_STATUS]);
2145
 
}
2146
 
 
2147
 
void
2148
 
ovsrec_controller_verify_target(const struct ovsrec_controller *row)
2149
 
{
2150
 
    ovs_assert(inited);
2151
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_TARGET]);
2152
 
}
2153
 
 
2154
 
/* Returns the connection_mode column's value in 'row' as a struct ovsdb_datum.
2155
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2156
 
 * easier and more efficient way to search for a given key than implementing
2157
 
 * the same operation on the "cooked" form in 'row'.
2158
 
 *
2159
 
 * 'key_type' must be OVSDB_TYPE_STRING.
2160
 
 * (This helps to avoid silent bugs if someone changes connection_mode's
2161
 
 * type without updating the caller.)
2162
 
 *
2163
 
 * The caller must not modify or free the returned value.
2164
 
 *
2165
 
 * Various kinds of changes can invalidate the returned value: modifying
2166
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2167
 
 * If the returned value is needed for a long time, it is best to make a copy
2168
 
 * of it with ovsdb_datum_clone(). */
2169
 
const struct ovsdb_datum *
2170
 
ovsrec_controller_get_connection_mode(const struct ovsrec_controller *row,
2171
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2172
 
{
2173
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2174
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_connection_mode);
2175
 
}
2176
 
 
2177
 
/* Returns the controller_burst_limit column's value in 'row' as a struct ovsdb_datum.
2178
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2179
 
 * easier and more efficient way to search for a given key than implementing
2180
 
 * the same operation on the "cooked" form in 'row'.
2181
 
 *
2182
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
2183
 
 * (This helps to avoid silent bugs if someone changes controller_burst_limit's
2184
 
 * type without updating the caller.)
2185
 
 *
2186
 
 * The caller must not modify or free the returned value.
2187
 
 *
2188
 
 * Various kinds of changes can invalidate the returned value: modifying
2189
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2190
 
 * If the returned value is needed for a long time, it is best to make a copy
2191
 
 * of it with ovsdb_datum_clone(). */
2192
 
const struct ovsdb_datum *
2193
 
ovsrec_controller_get_controller_burst_limit(const struct ovsrec_controller *row,
2194
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2195
 
{
2196
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2197
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_controller_burst_limit);
2198
 
}
2199
 
 
2200
 
/* Returns the controller_rate_limit column's value in 'row' as a struct ovsdb_datum.
2201
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2202
 
 * easier and more efficient way to search for a given key than implementing
2203
 
 * the same operation on the "cooked" form in 'row'.
2204
 
 *
2205
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
2206
 
 * (This helps to avoid silent bugs if someone changes controller_rate_limit's
2207
 
 * type without updating the caller.)
2208
 
 *
2209
 
 * The caller must not modify or free the returned value.
2210
 
 *
2211
 
 * Various kinds of changes can invalidate the returned value: modifying
2212
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2213
 
 * If the returned value is needed for a long time, it is best to make a copy
2214
 
 * of it with ovsdb_datum_clone(). */
2215
 
const struct ovsdb_datum *
2216
 
ovsrec_controller_get_controller_rate_limit(const struct ovsrec_controller *row,
2217
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2218
 
{
2219
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2220
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_controller_rate_limit);
2221
 
}
2222
 
 
2223
 
/* Returns the enable_async_messages column's value in 'row' as a struct ovsdb_datum.
2224
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2225
 
 * easier and more efficient way to search for a given key than implementing
2226
 
 * the same operation on the "cooked" form in 'row'.
2227
 
 *
2228
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
2229
 
 * (This helps to avoid silent bugs if someone changes enable_async_messages's
2230
 
 * type without updating the caller.)
2231
 
 *
2232
 
 * The caller must not modify or free the returned value.
2233
 
 *
2234
 
 * Various kinds of changes can invalidate the returned value: modifying
2235
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2236
 
 * If the returned value is needed for a long time, it is best to make a copy
2237
 
 * of it with ovsdb_datum_clone(). */
2238
 
const struct ovsdb_datum *
2239
 
ovsrec_controller_get_enable_async_messages(const struct ovsrec_controller *row,
2240
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2241
 
{
2242
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
2243
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_enable_async_messages);
2244
 
}
2245
 
 
2246
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
2247
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2248
 
 * easier and more efficient way to search for a given key than implementing
2249
 
 * the same operation on the "cooked" form in 'row'.
2250
 
 *
2251
 
 * 'key_type' must be OVSDB_TYPE_STRING.
2252
 
 * 'value_type' must be OVSDB_TYPE_STRING.
2253
 
 * (This helps to avoid silent bugs if someone changes external_ids's
2254
 
 * type without updating the caller.)
2255
 
 *
2256
 
 * The caller must not modify or free the returned value.
2257
 
 *
2258
 
 * Various kinds of changes can invalidate the returned value: modifying
2259
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2260
 
 * If the returned value is needed for a long time, it is best to make a copy
2261
 
 * of it with ovsdb_datum_clone(). */
2262
 
const struct ovsdb_datum *
2263
 
ovsrec_controller_get_external_ids(const struct ovsrec_controller *row,
2264
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
2265
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
2266
 
{
2267
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2268
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
2269
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_external_ids);
2270
 
}
2271
 
 
2272
 
/* Returns the inactivity_probe column's value in 'row' as a struct ovsdb_datum.
2273
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2274
 
 * easier and more efficient way to search for a given key than implementing
2275
 
 * the same operation on the "cooked" form in 'row'.
2276
 
 *
2277
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
2278
 
 * (This helps to avoid silent bugs if someone changes inactivity_probe's
2279
 
 * type without updating the caller.)
2280
 
 *
2281
 
 * The caller must not modify or free the returned value.
2282
 
 *
2283
 
 * Various kinds of changes can invalidate the returned value: modifying
2284
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2285
 
 * If the returned value is needed for a long time, it is best to make a copy
2286
 
 * of it with ovsdb_datum_clone(). */
2287
 
const struct ovsdb_datum *
2288
 
ovsrec_controller_get_inactivity_probe(const struct ovsrec_controller *row,
2289
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2290
 
{
2291
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2292
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_inactivity_probe);
2293
 
}
2294
 
 
2295
 
/* Returns the is_connected column's value in 'row' as a struct ovsdb_datum.
2296
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2297
 
 * easier and more efficient way to search for a given key than implementing
2298
 
 * the same operation on the "cooked" form in 'row'.
2299
 
 *
2300
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
2301
 
 * (This helps to avoid silent bugs if someone changes is_connected's
2302
 
 * type without updating the caller.)
2303
 
 *
2304
 
 * The caller must not modify or free the returned value.
2305
 
 *
2306
 
 * Various kinds of changes can invalidate the returned value: modifying
2307
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2308
 
 * If the returned value is needed for a long time, it is best to make a copy
2309
 
 * of it with ovsdb_datum_clone(). */
2310
 
const struct ovsdb_datum *
2311
 
ovsrec_controller_get_is_connected(const struct ovsrec_controller *row,
2312
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2313
 
{
2314
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
2315
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_is_connected);
2316
 
}
2317
 
 
2318
 
/* Returns the local_gateway column's value in 'row' as a struct ovsdb_datum.
2319
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2320
 
 * easier and more efficient way to search for a given key than implementing
2321
 
 * the same operation on the "cooked" form in 'row'.
2322
 
 *
2323
 
 * 'key_type' must be OVSDB_TYPE_STRING.
2324
 
 * (This helps to avoid silent bugs if someone changes local_gateway's
2325
 
 * type without updating the caller.)
2326
 
 *
2327
 
 * The caller must not modify or free the returned value.
2328
 
 *
2329
 
 * Various kinds of changes can invalidate the returned value: modifying
2330
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2331
 
 * If the returned value is needed for a long time, it is best to make a copy
2332
 
 * of it with ovsdb_datum_clone(). */
2333
 
const struct ovsdb_datum *
2334
 
ovsrec_controller_get_local_gateway(const struct ovsrec_controller *row,
2335
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2336
 
{
2337
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2338
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_gateway);
2339
 
}
2340
 
 
2341
 
/* Returns the local_ip column's value in 'row' as a struct ovsdb_datum.
2342
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2343
 
 * easier and more efficient way to search for a given key than implementing
2344
 
 * the same operation on the "cooked" form in 'row'.
2345
 
 *
2346
 
 * 'key_type' must be OVSDB_TYPE_STRING.
2347
 
 * (This helps to avoid silent bugs if someone changes local_ip's
2348
 
 * type without updating the caller.)
2349
 
 *
2350
 
 * The caller must not modify or free the returned value.
2351
 
 *
2352
 
 * Various kinds of changes can invalidate the returned value: modifying
2353
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2354
 
 * If the returned value is needed for a long time, it is best to make a copy
2355
 
 * of it with ovsdb_datum_clone(). */
2356
 
const struct ovsdb_datum *
2357
 
ovsrec_controller_get_local_ip(const struct ovsrec_controller *row,
2358
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2359
 
{
2360
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2361
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_ip);
2362
 
}
2363
 
 
2364
 
/* Returns the local_netmask column's value in 'row' as a struct ovsdb_datum.
2365
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2366
 
 * easier and more efficient way to search for a given key than implementing
2367
 
 * the same operation on the "cooked" form in 'row'.
2368
 
 *
2369
 
 * 'key_type' must be OVSDB_TYPE_STRING.
2370
 
 * (This helps to avoid silent bugs if someone changes local_netmask's
2371
 
 * type without updating the caller.)
2372
 
 *
2373
 
 * The caller must not modify or free the returned value.
2374
 
 *
2375
 
 * Various kinds of changes can invalidate the returned value: modifying
2376
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2377
 
 * If the returned value is needed for a long time, it is best to make a copy
2378
 
 * of it with ovsdb_datum_clone(). */
2379
 
const struct ovsdb_datum *
2380
 
ovsrec_controller_get_local_netmask(const struct ovsrec_controller *row,
2381
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2382
 
{
2383
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2384
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_local_netmask);
2385
 
}
2386
 
 
2387
 
/* Returns the max_backoff column's value in 'row' as a struct ovsdb_datum.
2388
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2389
 
 * easier and more efficient way to search for a given key than implementing
2390
 
 * the same operation on the "cooked" form in 'row'.
2391
 
 *
2392
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
2393
 
 * (This helps to avoid silent bugs if someone changes max_backoff's
2394
 
 * type without updating the caller.)
2395
 
 *
2396
 
 * The caller must not modify or free the returned value.
2397
 
 *
2398
 
 * Various kinds of changes can invalidate the returned value: modifying
2399
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2400
 
 * If the returned value is needed for a long time, it is best to make a copy
2401
 
 * of it with ovsdb_datum_clone(). */
2402
 
const struct ovsdb_datum *
2403
 
ovsrec_controller_get_max_backoff(const struct ovsrec_controller *row,
2404
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2405
 
{
2406
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
2407
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_max_backoff);
2408
 
}
2409
 
 
2410
 
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
2411
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2412
 
 * easier and more efficient way to search for a given key than implementing
2413
 
 * the same operation on the "cooked" form in 'row'.
2414
 
 *
2415
 
 * 'key_type' must be OVSDB_TYPE_STRING.
2416
 
 * 'value_type' must be OVSDB_TYPE_STRING.
2417
 
 * (This helps to avoid silent bugs if someone changes other_config's
2418
 
 * type without updating the caller.)
2419
 
 *
2420
 
 * The caller must not modify or free the returned value.
2421
 
 *
2422
 
 * Various kinds of changes can invalidate the returned value: modifying
2423
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2424
 
 * If the returned value is needed for a long time, it is best to make a copy
2425
 
 * of it with ovsdb_datum_clone(). */
2426
 
const struct ovsdb_datum *
2427
 
ovsrec_controller_get_other_config(const struct ovsrec_controller *row,
2428
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
2429
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
2430
 
{
2431
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2432
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
2433
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_other_config);
2434
 
}
2435
 
 
2436
 
/* Returns the role column's value in 'row' as a struct ovsdb_datum.
2437
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2438
 
 * easier and more efficient way to search for a given key than implementing
2439
 
 * the same operation on the "cooked" form in 'row'.
2440
 
 *
2441
 
 * 'key_type' must be OVSDB_TYPE_STRING.
2442
 
 * (This helps to avoid silent bugs if someone changes role's
2443
 
 * type without updating the caller.)
2444
 
 *
2445
 
 * The caller must not modify or free the returned value.
2446
 
 *
2447
 
 * Various kinds of changes can invalidate the returned value: modifying
2448
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2449
 
 * If the returned value is needed for a long time, it is best to make a copy
2450
 
 * of it with ovsdb_datum_clone(). */
2451
 
const struct ovsdb_datum *
2452
 
ovsrec_controller_get_role(const struct ovsrec_controller *row,
2453
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2454
 
{
2455
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2456
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_role);
2457
 
}
2458
 
 
2459
 
/* Returns the status column's value in 'row' as a struct ovsdb_datum.
2460
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2461
 
 * easier and more efficient way to search for a given key than implementing
2462
 
 * the same operation on the "cooked" form in 'row'.
2463
 
 *
2464
 
 * 'key_type' must be OVSDB_TYPE_STRING.
2465
 
 * 'value_type' must be OVSDB_TYPE_STRING.
2466
 
 * (This helps to avoid silent bugs if someone changes status's
2467
 
 * type without updating the caller.)
2468
 
 *
2469
 
 * The caller must not modify or free the returned value.
2470
 
 *
2471
 
 * Various kinds of changes can invalidate the returned value: modifying
2472
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2473
 
 * If the returned value is needed for a long time, it is best to make a copy
2474
 
 * of it with ovsdb_datum_clone(). */
2475
 
const struct ovsdb_datum *
2476
 
ovsrec_controller_get_status(const struct ovsrec_controller *row,
2477
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
2478
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
2479
 
{
2480
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2481
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
2482
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_status);
2483
 
}
2484
 
 
2485
 
/* Returns the target column's value in 'row' as a struct ovsdb_datum.
2486
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
2487
 
 * easier and more efficient way to search for a given key than implementing
2488
 
 * the same operation on the "cooked" form in 'row'.
2489
 
 *
2490
 
 * 'key_type' must be OVSDB_TYPE_STRING.
2491
 
 * (This helps to avoid silent bugs if someone changes target's
2492
 
 * type without updating the caller.)
2493
 
 *
2494
 
 * The caller must not modify or free the returned value.
2495
 
 *
2496
 
 * Various kinds of changes can invalidate the returned value: modifying
2497
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
2498
 
 * If the returned value is needed for a long time, it is best to make a copy
2499
 
 * of it with ovsdb_datum_clone(). */
2500
 
const struct ovsdb_datum *
2501
 
ovsrec_controller_get_target(const struct ovsrec_controller *row,
2502
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
2503
 
{
2504
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
2505
 
    return ovsdb_idl_read(&row->header_, &ovsrec_controller_col_target);
2506
 
}
2507
 
 
2508
 
void
2509
 
ovsrec_controller_set_connection_mode(const struct ovsrec_controller *row, const char *connection_mode)
2510
 
{
2511
 
    struct ovsdb_datum datum;
2512
 
    union ovsdb_atom key;
2513
 
 
2514
 
    ovs_assert(inited);
2515
 
    if (connection_mode) {
2516
 
        datum.n = 1;
2517
 
        datum.keys = &key;
2518
 
        key.string = CONST_CAST(char *, connection_mode);
2519
 
    } else {
2520
 
        datum.n = 0;
2521
 
        datum.keys = NULL;
2522
 
    }
2523
 
    datum.values = NULL;
2524
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONNECTION_MODE], &datum);
2525
 
}
2526
 
 
2527
 
void
2528
 
ovsrec_controller_set_controller_burst_limit(const struct ovsrec_controller *row, const int64_t *controller_burst_limit, size_t n_controller_burst_limit)
2529
 
{
2530
 
    struct ovsdb_datum datum;
2531
 
    union ovsdb_atom key;
2532
 
 
2533
 
    ovs_assert(inited);
2534
 
    if (n_controller_burst_limit) {
2535
 
        datum.n = 1;
2536
 
        datum.keys = &key;
2537
 
        key.integer = *controller_burst_limit;
2538
 
    } else {
2539
 
        datum.n = 0;
2540
 
        datum.keys = NULL;
2541
 
    }
2542
 
    datum.values = NULL;
2543
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONTROLLER_BURST_LIMIT], &datum);
2544
 
}
2545
 
 
2546
 
void
2547
 
ovsrec_controller_set_controller_rate_limit(const struct ovsrec_controller *row, const int64_t *controller_rate_limit, size_t n_controller_rate_limit)
2548
 
{
2549
 
    struct ovsdb_datum datum;
2550
 
    union ovsdb_atom key;
2551
 
 
2552
 
    ovs_assert(inited);
2553
 
    if (n_controller_rate_limit) {
2554
 
        datum.n = 1;
2555
 
        datum.keys = &key;
2556
 
        key.integer = *controller_rate_limit;
2557
 
    } else {
2558
 
        datum.n = 0;
2559
 
        datum.keys = NULL;
2560
 
    }
2561
 
    datum.values = NULL;
2562
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_CONTROLLER_RATE_LIMIT], &datum);
2563
 
}
2564
 
 
2565
 
void
2566
 
ovsrec_controller_set_enable_async_messages(const struct ovsrec_controller *row, const bool *enable_async_messages, size_t n_enable_async_messages)
2567
 
{
2568
 
    struct ovsdb_datum datum;
2569
 
    union ovsdb_atom key;
2570
 
 
2571
 
    ovs_assert(inited);
2572
 
    if (n_enable_async_messages) {
2573
 
        datum.n = 1;
2574
 
        datum.keys = &key;
2575
 
        key.boolean = *enable_async_messages;
2576
 
    } else {
2577
 
        datum.n = 0;
2578
 
        datum.keys = NULL;
2579
 
    }
2580
 
    datum.values = NULL;
2581
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_ENABLE_ASYNC_MESSAGES], &datum);
2582
 
}
2583
 
 
2584
 
void
2585
 
ovsrec_controller_set_external_ids(const struct ovsrec_controller *row, const struct smap *smap)
2586
 
{
2587
 
    struct ovsdb_datum datum;
2588
 
 
2589
 
    ovs_assert(inited);
2590
 
    if (smap) {
2591
 
        struct smap_node *node;
2592
 
        size_t i;
2593
 
 
2594
 
        datum.n = smap_count(smap);
2595
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2596
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
2597
 
 
2598
 
        i = 0;
2599
 
        SMAP_FOR_EACH (node, smap) {
2600
 
            datum.keys[i].string = xstrdup(node->key);
2601
 
            datum.values[i].string = xstrdup(node->value);
2602
 
            i++;
2603
 
        }
2604
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2605
 
    } else {
2606
 
        ovsdb_datum_init_empty(&datum);
2607
 
    }
2608
 
    ovsdb_idl_txn_write(&row->header_,
2609
 
                        &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_EXTERNAL_IDS],
2610
 
                        &datum);
2611
 
}
2612
 
 
2613
 
 
2614
 
void
2615
 
ovsrec_controller_set_inactivity_probe(const struct ovsrec_controller *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
2616
 
{
2617
 
    struct ovsdb_datum datum;
2618
 
    union ovsdb_atom key;
2619
 
 
2620
 
    ovs_assert(inited);
2621
 
    if (n_inactivity_probe) {
2622
 
        datum.n = 1;
2623
 
        datum.keys = &key;
2624
 
        key.integer = *inactivity_probe;
2625
 
    } else {
2626
 
        datum.n = 0;
2627
 
        datum.keys = NULL;
2628
 
    }
2629
 
    datum.values = NULL;
2630
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_INACTIVITY_PROBE], &datum);
2631
 
}
2632
 
 
2633
 
void
2634
 
ovsrec_controller_set_is_connected(const struct ovsrec_controller *row, bool is_connected)
2635
 
{
2636
 
    struct ovsdb_datum datum;
2637
 
    union ovsdb_atom key;
2638
 
 
2639
 
    ovs_assert(inited);
2640
 
    datum.n = 1;
2641
 
    datum.keys = &key;
2642
 
    key.boolean = is_connected;
2643
 
    datum.values = NULL;
2644
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_IS_CONNECTED], &datum);
2645
 
}
2646
 
 
2647
 
void
2648
 
ovsrec_controller_set_local_gateway(const struct ovsrec_controller *row, const char *local_gateway)
2649
 
{
2650
 
    struct ovsdb_datum datum;
2651
 
    union ovsdb_atom key;
2652
 
 
2653
 
    ovs_assert(inited);
2654
 
    if (local_gateway) {
2655
 
        datum.n = 1;
2656
 
        datum.keys = &key;
2657
 
        key.string = CONST_CAST(char *, local_gateway);
2658
 
    } else {
2659
 
        datum.n = 0;
2660
 
        datum.keys = NULL;
2661
 
    }
2662
 
    datum.values = NULL;
2663
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_GATEWAY], &datum);
2664
 
}
2665
 
 
2666
 
void
2667
 
ovsrec_controller_set_local_ip(const struct ovsrec_controller *row, const char *local_ip)
2668
 
{
2669
 
    struct ovsdb_datum datum;
2670
 
    union ovsdb_atom key;
2671
 
 
2672
 
    ovs_assert(inited);
2673
 
    if (local_ip) {
2674
 
        datum.n = 1;
2675
 
        datum.keys = &key;
2676
 
        key.string = CONST_CAST(char *, local_ip);
2677
 
    } else {
2678
 
        datum.n = 0;
2679
 
        datum.keys = NULL;
2680
 
    }
2681
 
    datum.values = NULL;
2682
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_IP], &datum);
2683
 
}
2684
 
 
2685
 
void
2686
 
ovsrec_controller_set_local_netmask(const struct ovsrec_controller *row, const char *local_netmask)
2687
 
{
2688
 
    struct ovsdb_datum datum;
2689
 
    union ovsdb_atom key;
2690
 
 
2691
 
    ovs_assert(inited);
2692
 
    if (local_netmask) {
2693
 
        datum.n = 1;
2694
 
        datum.keys = &key;
2695
 
        key.string = CONST_CAST(char *, local_netmask);
2696
 
    } else {
2697
 
        datum.n = 0;
2698
 
        datum.keys = NULL;
2699
 
    }
2700
 
    datum.values = NULL;
2701
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_LOCAL_NETMASK], &datum);
2702
 
}
2703
 
 
2704
 
void
2705
 
ovsrec_controller_set_max_backoff(const struct ovsrec_controller *row, const int64_t *max_backoff, size_t n_max_backoff)
2706
 
{
2707
 
    struct ovsdb_datum datum;
2708
 
    union ovsdb_atom key;
2709
 
 
2710
 
    ovs_assert(inited);
2711
 
    if (n_max_backoff) {
2712
 
        datum.n = 1;
2713
 
        datum.keys = &key;
2714
 
        key.integer = *max_backoff;
2715
 
    } else {
2716
 
        datum.n = 0;
2717
 
        datum.keys = NULL;
2718
 
    }
2719
 
    datum.values = NULL;
2720
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_MAX_BACKOFF], &datum);
2721
 
}
2722
 
 
2723
 
void
2724
 
ovsrec_controller_set_other_config(const struct ovsrec_controller *row, const struct smap *smap)
2725
 
{
2726
 
    struct ovsdb_datum datum;
2727
 
 
2728
 
    ovs_assert(inited);
2729
 
    if (smap) {
2730
 
        struct smap_node *node;
2731
 
        size_t i;
2732
 
 
2733
 
        datum.n = smap_count(smap);
2734
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2735
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
2736
 
 
2737
 
        i = 0;
2738
 
        SMAP_FOR_EACH (node, smap) {
2739
 
            datum.keys[i].string = xstrdup(node->key);
2740
 
            datum.values[i].string = xstrdup(node->value);
2741
 
            i++;
2742
 
        }
2743
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2744
 
    } else {
2745
 
        ovsdb_datum_init_empty(&datum);
2746
 
    }
2747
 
    ovsdb_idl_txn_write(&row->header_,
2748
 
                        &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_OTHER_CONFIG],
2749
 
                        &datum);
2750
 
}
2751
 
 
2752
 
 
2753
 
void
2754
 
ovsrec_controller_set_role(const struct ovsrec_controller *row, const char *role)
2755
 
{
2756
 
    struct ovsdb_datum datum;
2757
 
    union ovsdb_atom key;
2758
 
 
2759
 
    ovs_assert(inited);
2760
 
    if (role) {
2761
 
        datum.n = 1;
2762
 
        datum.keys = &key;
2763
 
        key.string = CONST_CAST(char *, role);
2764
 
    } else {
2765
 
        datum.n = 0;
2766
 
        datum.keys = NULL;
2767
 
    }
2768
 
    datum.values = NULL;
2769
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_ROLE], &datum);
2770
 
}
2771
 
 
2772
 
void
2773
 
ovsrec_controller_set_status(const struct ovsrec_controller *row, const struct smap *smap)
2774
 
{
2775
 
    struct ovsdb_datum datum;
2776
 
 
2777
 
    ovs_assert(inited);
2778
 
    if (smap) {
2779
 
        struct smap_node *node;
2780
 
        size_t i;
2781
 
 
2782
 
        datum.n = smap_count(smap);
2783
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
2784
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
2785
 
 
2786
 
        i = 0;
2787
 
        SMAP_FOR_EACH (node, smap) {
2788
 
            datum.keys[i].string = xstrdup(node->key);
2789
 
            datum.values[i].string = xstrdup(node->value);
2790
 
            i++;
2791
 
        }
2792
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
2793
 
    } else {
2794
 
        ovsdb_datum_init_empty(&datum);
2795
 
    }
2796
 
    ovsdb_idl_txn_write(&row->header_,
2797
 
                        &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_STATUS],
2798
 
                        &datum);
2799
 
}
2800
 
 
2801
 
 
2802
 
void
2803
 
ovsrec_controller_set_target(const struct ovsrec_controller *row, const char *target)
2804
 
{
2805
 
    struct ovsdb_datum datum;
2806
 
    union ovsdb_atom key;
2807
 
 
2808
 
    ovs_assert(inited);
2809
 
    datum.n = 1;
2810
 
    datum.keys = &key;
2811
 
    key.string = CONST_CAST(char *, target);
2812
 
    datum.values = NULL;
2813
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_controller_columns[OVSREC_CONTROLLER_COL_TARGET], &datum);
2814
 
}
2815
 
 
2816
 
struct ovsdb_idl_column ovsrec_controller_columns[OVSREC_CONTROLLER_N_COLUMNS];
2817
 
 
2818
 
static void
2819
 
ovsrec_controller_columns_init(void)
2820
 
{
2821
 
    struct ovsdb_idl_column *c;
2822
 
 
2823
 
    /* Initialize ovsrec_controller_col_connection_mode. */
2824
 
    c = &ovsrec_controller_col_connection_mode;
2825
 
    c->name = "connection_mode";
2826
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2827
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
2828
 
    c->type.key.enum_->n = 2;
2829
 
    c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
2830
 
    c->type.key.enum_->keys[0].string = xstrdup("in-band");
2831
 
    c->type.key.enum_->keys[1].string = xstrdup("out-of-band");
2832
 
    c->type.key.enum_->values = NULL;
2833
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
2834
 
    c->type.key.u.string.minLen = 0;
2835
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2836
 
    c->type.n_min = 0;
2837
 
    c->type.n_max = 1;
2838
 
    c->mutable = true;
2839
 
    c->parse = ovsrec_controller_parse_connection_mode;
2840
 
    c->unparse = ovsrec_controller_unparse_connection_mode;
2841
 
 
2842
 
    /* Initialize ovsrec_controller_col_controller_burst_limit. */
2843
 
    c = &ovsrec_controller_col_controller_burst_limit;
2844
 
    c->name = "controller_burst_limit";
2845
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
2846
 
    c->type.key.u.integer.min = INT64_C(25);
2847
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2848
 
    c->type.n_min = 0;
2849
 
    c->type.n_max = 1;
2850
 
    c->mutable = true;
2851
 
    c->parse = ovsrec_controller_parse_controller_burst_limit;
2852
 
    c->unparse = ovsrec_controller_unparse_controller_burst_limit;
2853
 
 
2854
 
    /* Initialize ovsrec_controller_col_controller_rate_limit. */
2855
 
    c = &ovsrec_controller_col_controller_rate_limit;
2856
 
    c->name = "controller_rate_limit";
2857
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
2858
 
    c->type.key.u.integer.min = INT64_C(100);
2859
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2860
 
    c->type.n_min = 0;
2861
 
    c->type.n_max = 1;
2862
 
    c->mutable = true;
2863
 
    c->parse = ovsrec_controller_parse_controller_rate_limit;
2864
 
    c->unparse = ovsrec_controller_unparse_controller_rate_limit;
2865
 
 
2866
 
    /* Initialize ovsrec_controller_col_enable_async_messages. */
2867
 
    c = &ovsrec_controller_col_enable_async_messages;
2868
 
    c->name = "enable_async_messages";
2869
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
2870
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2871
 
    c->type.n_min = 0;
2872
 
    c->type.n_max = 1;
2873
 
    c->mutable = true;
2874
 
    c->parse = ovsrec_controller_parse_enable_async_messages;
2875
 
    c->unparse = ovsrec_controller_unparse_enable_async_messages;
2876
 
 
2877
 
    /* Initialize ovsrec_controller_col_external_ids. */
2878
 
    c = &ovsrec_controller_col_external_ids;
2879
 
    c->name = "external_ids";
2880
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2881
 
    c->type.key.u.string.minLen = 0;
2882
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
2883
 
    c->type.value.u.string.minLen = 0;
2884
 
    c->type.n_min = 0;
2885
 
    c->type.n_max = UINT_MAX;
2886
 
    c->mutable = true;
2887
 
    c->parse = ovsrec_controller_parse_external_ids;
2888
 
    c->unparse = ovsrec_controller_unparse_external_ids;
2889
 
 
2890
 
    /* Initialize ovsrec_controller_col_inactivity_probe. */
2891
 
    c = &ovsrec_controller_col_inactivity_probe;
2892
 
    c->name = "inactivity_probe";
2893
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
2894
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2895
 
    c->type.n_min = 0;
2896
 
    c->type.n_max = 1;
2897
 
    c->mutable = true;
2898
 
    c->parse = ovsrec_controller_parse_inactivity_probe;
2899
 
    c->unparse = ovsrec_controller_unparse_inactivity_probe;
2900
 
 
2901
 
    /* Initialize ovsrec_controller_col_is_connected. */
2902
 
    c = &ovsrec_controller_col_is_connected;
2903
 
    c->name = "is_connected";
2904
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
2905
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2906
 
    c->type.n_min = 1;
2907
 
    c->type.n_max = 1;
2908
 
    c->mutable = true;
2909
 
    c->parse = ovsrec_controller_parse_is_connected;
2910
 
    c->unparse = ovsrec_controller_unparse_is_connected;
2911
 
 
2912
 
    /* Initialize ovsrec_controller_col_local_gateway. */
2913
 
    c = &ovsrec_controller_col_local_gateway;
2914
 
    c->name = "local_gateway";
2915
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2916
 
    c->type.key.u.string.minLen = 0;
2917
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2918
 
    c->type.n_min = 0;
2919
 
    c->type.n_max = 1;
2920
 
    c->mutable = true;
2921
 
    c->parse = ovsrec_controller_parse_local_gateway;
2922
 
    c->unparse = ovsrec_controller_unparse_local_gateway;
2923
 
 
2924
 
    /* Initialize ovsrec_controller_col_local_ip. */
2925
 
    c = &ovsrec_controller_col_local_ip;
2926
 
    c->name = "local_ip";
2927
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2928
 
    c->type.key.u.string.minLen = 0;
2929
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2930
 
    c->type.n_min = 0;
2931
 
    c->type.n_max = 1;
2932
 
    c->mutable = true;
2933
 
    c->parse = ovsrec_controller_parse_local_ip;
2934
 
    c->unparse = ovsrec_controller_unparse_local_ip;
2935
 
 
2936
 
    /* Initialize ovsrec_controller_col_local_netmask. */
2937
 
    c = &ovsrec_controller_col_local_netmask;
2938
 
    c->name = "local_netmask";
2939
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2940
 
    c->type.key.u.string.minLen = 0;
2941
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2942
 
    c->type.n_min = 0;
2943
 
    c->type.n_max = 1;
2944
 
    c->mutable = true;
2945
 
    c->parse = ovsrec_controller_parse_local_netmask;
2946
 
    c->unparse = ovsrec_controller_unparse_local_netmask;
2947
 
 
2948
 
    /* Initialize ovsrec_controller_col_max_backoff. */
2949
 
    c = &ovsrec_controller_col_max_backoff;
2950
 
    c->name = "max_backoff";
2951
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
2952
 
    c->type.key.u.integer.min = INT64_C(1000);
2953
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2954
 
    c->type.n_min = 0;
2955
 
    c->type.n_max = 1;
2956
 
    c->mutable = true;
2957
 
    c->parse = ovsrec_controller_parse_max_backoff;
2958
 
    c->unparse = ovsrec_controller_unparse_max_backoff;
2959
 
 
2960
 
    /* Initialize ovsrec_controller_col_other_config. */
2961
 
    c = &ovsrec_controller_col_other_config;
2962
 
    c->name = "other_config";
2963
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2964
 
    c->type.key.u.string.minLen = 0;
2965
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
2966
 
    c->type.value.u.string.minLen = 0;
2967
 
    c->type.n_min = 0;
2968
 
    c->type.n_max = UINT_MAX;
2969
 
    c->mutable = true;
2970
 
    c->parse = ovsrec_controller_parse_other_config;
2971
 
    c->unparse = ovsrec_controller_unparse_other_config;
2972
 
 
2973
 
    /* Initialize ovsrec_controller_col_role. */
2974
 
    c = &ovsrec_controller_col_role;
2975
 
    c->name = "role";
2976
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2977
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
2978
 
    c->type.key.enum_->n = 3;
2979
 
    c->type.key.enum_->keys = xmalloc(3 * sizeof *c->type.key.enum_->keys);
2980
 
    c->type.key.enum_->keys[0].string = xstrdup("master");
2981
 
    c->type.key.enum_->keys[1].string = xstrdup("other");
2982
 
    c->type.key.enum_->keys[2].string = xstrdup("slave");
2983
 
    c->type.key.enum_->values = NULL;
2984
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
2985
 
    c->type.key.u.string.minLen = 0;
2986
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
2987
 
    c->type.n_min = 0;
2988
 
    c->type.n_max = 1;
2989
 
    c->mutable = true;
2990
 
    c->parse = ovsrec_controller_parse_role;
2991
 
    c->unparse = ovsrec_controller_unparse_role;
2992
 
 
2993
 
    /* Initialize ovsrec_controller_col_status. */
2994
 
    c = &ovsrec_controller_col_status;
2995
 
    c->name = "status";
2996
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
2997
 
    c->type.key.u.string.minLen = 0;
2998
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
2999
 
    c->type.value.u.string.minLen = 0;
3000
 
    c->type.n_min = 0;
3001
 
    c->type.n_max = UINT_MAX;
3002
 
    c->mutable = true;
3003
 
    c->parse = ovsrec_controller_parse_status;
3004
 
    c->unparse = ovsrec_controller_unparse_status;
3005
 
 
3006
 
    /* Initialize ovsrec_controller_col_target. */
3007
 
    c = &ovsrec_controller_col_target;
3008
 
    c->name = "target";
3009
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3010
 
    c->type.key.u.string.minLen = 0;
3011
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3012
 
    c->type.n_min = 1;
3013
 
    c->type.n_max = 1;
3014
 
    c->mutable = true;
3015
 
    c->parse = ovsrec_controller_parse_target;
3016
 
    c->unparse = ovsrec_controller_unparse_target;
3017
 
}
3018
 
 
3019
 
/* Flow_Sample_Collector_Set table. */
3020
 
 
3021
 
static void
3022
 
ovsrec_flow_sample_collector_set_parse_bridge(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3023
 
{
3024
 
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
3025
 
 
3026
 
    ovs_assert(inited);
3027
 
    if (datum->n >= 1) {
3028
 
        row->bridge = ovsrec_bridge_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE], &datum->keys[0].uuid));
3029
 
    } else {
3030
 
        row->bridge = NULL;
3031
 
    }
3032
 
}
3033
 
 
3034
 
static void
3035
 
ovsrec_flow_sample_collector_set_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3036
 
{
3037
 
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
3038
 
    size_t i;
3039
 
 
3040
 
    ovs_assert(inited);
3041
 
    smap_init(&row->external_ids);
3042
 
    for (i = 0; i < datum->n; i++) {
3043
 
        smap_add(&row->external_ids,
3044
 
                 datum->keys[i].string,
3045
 
                 datum->values[i].string);
3046
 
    }
3047
 
}
3048
 
 
3049
 
static void
3050
 
ovsrec_flow_sample_collector_set_parse_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3051
 
{
3052
 
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
3053
 
 
3054
 
    ovs_assert(inited);
3055
 
    if (datum->n >= 1) {
3056
 
        row->id = datum->keys[0].integer;
3057
 
    } else {
3058
 
        row->id = 0;
3059
 
    }
3060
 
}
3061
 
 
3062
 
static void
3063
 
ovsrec_flow_sample_collector_set_parse_ipfix(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3064
 
{
3065
 
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
3066
 
 
3067
 
    ovs_assert(inited);
3068
 
    if (datum->n >= 1) {
3069
 
        row->ipfix = ovsrec_ipfix_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_IPFIX], &datum->keys[0].uuid));
3070
 
    } else {
3071
 
        row->ipfix = NULL;
3072
 
    }
3073
 
}
3074
 
 
3075
 
static void
3076
 
ovsrec_flow_sample_collector_set_unparse_bridge(struct ovsdb_idl_row *row OVS_UNUSED)
3077
 
{
3078
 
    /* Nothing to do. */
3079
 
}
3080
 
 
3081
 
static void
3082
 
ovsrec_flow_sample_collector_set_unparse_external_ids(struct ovsdb_idl_row *row_)
3083
 
{
3084
 
    struct ovsrec_flow_sample_collector_set *row = ovsrec_flow_sample_collector_set_cast(row_);
3085
 
 
3086
 
    ovs_assert(inited);
3087
 
    smap_destroy(&row->external_ids);
3088
 
}
3089
 
 
3090
 
static void
3091
 
ovsrec_flow_sample_collector_set_unparse_id(struct ovsdb_idl_row *row OVS_UNUSED)
3092
 
{
3093
 
    /* Nothing to do. */
3094
 
}
3095
 
 
3096
 
static void
3097
 
ovsrec_flow_sample_collector_set_unparse_ipfix(struct ovsdb_idl_row *row OVS_UNUSED)
3098
 
{
3099
 
    /* Nothing to do. */
3100
 
}
3101
 
 
3102
 
static void
3103
 
ovsrec_flow_sample_collector_set_init__(struct ovsdb_idl_row *row)
3104
 
{
3105
 
    ovsrec_flow_sample_collector_set_init(ovsrec_flow_sample_collector_set_cast(row));
3106
 
}
3107
 
 
3108
 
void
3109
 
ovsrec_flow_sample_collector_set_init(struct ovsrec_flow_sample_collector_set *row)
3110
 
{
3111
 
    memset(row, 0, sizeof *row); 
3112
 
    smap_init(&row->external_ids);
3113
 
}
3114
 
 
3115
 
const struct ovsrec_flow_sample_collector_set *
3116
 
ovsrec_flow_sample_collector_set_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
3117
 
{
3118
 
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET], uuid));
3119
 
}
3120
 
 
3121
 
const struct ovsrec_flow_sample_collector_set *
3122
 
ovsrec_flow_sample_collector_set_first(const struct ovsdb_idl *idl)
3123
 
{
3124
 
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET]));
3125
 
}
3126
 
 
3127
 
const struct ovsrec_flow_sample_collector_set *
3128
 
ovsrec_flow_sample_collector_set_next(const struct ovsrec_flow_sample_collector_set *row)
3129
 
{
3130
 
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_next_row(&row->header_));
3131
 
}
3132
 
 
3133
 
void
3134
 
ovsrec_flow_sample_collector_set_delete(const struct ovsrec_flow_sample_collector_set *row)
3135
 
{
3136
 
    ovsdb_idl_txn_delete(&row->header_);
3137
 
}
3138
 
 
3139
 
struct ovsrec_flow_sample_collector_set *
3140
 
ovsrec_flow_sample_collector_set_insert(struct ovsdb_idl_txn *txn)
3141
 
{
3142
 
    return ovsrec_flow_sample_collector_set_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_FLOW_SAMPLE_COLLECTOR_SET], NULL));
3143
 
}
3144
 
 
3145
 
 
3146
 
void
3147
 
ovsrec_flow_sample_collector_set_verify_bridge(const struct ovsrec_flow_sample_collector_set *row)
3148
 
{
3149
 
    ovs_assert(inited);
3150
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_BRIDGE]);
3151
 
}
3152
 
 
3153
 
void
3154
 
ovsrec_flow_sample_collector_set_verify_external_ids(const struct ovsrec_flow_sample_collector_set *row)
3155
 
{
3156
 
    ovs_assert(inited);
3157
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_EXTERNAL_IDS]);
3158
 
}
3159
 
 
3160
 
void
3161
 
ovsrec_flow_sample_collector_set_verify_id(const struct ovsrec_flow_sample_collector_set *row)
3162
 
{
3163
 
    ovs_assert(inited);
3164
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_ID]);
3165
 
}
3166
 
 
3167
 
void
3168
 
ovsrec_flow_sample_collector_set_verify_ipfix(const struct ovsrec_flow_sample_collector_set *row)
3169
 
{
3170
 
    ovs_assert(inited);
3171
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_IPFIX]);
3172
 
}
3173
 
 
3174
 
/* Returns the bridge column's value in 'row' as a struct ovsdb_datum.
3175
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
3176
 
 * easier and more efficient way to search for a given key than implementing
3177
 
 * the same operation on the "cooked" form in 'row'.
3178
 
 *
3179
 
 * 'key_type' must be OVSDB_TYPE_UUID.
3180
 
 * (This helps to avoid silent bugs if someone changes bridge's
3181
 
 * type without updating the caller.)
3182
 
 *
3183
 
 * The caller must not modify or free the returned value.
3184
 
 *
3185
 
 * Various kinds of changes can invalidate the returned value: modifying
3186
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3187
 
 * If the returned value is needed for a long time, it is best to make a copy
3188
 
 * of it with ovsdb_datum_clone(). */
3189
 
const struct ovsdb_datum *
3190
 
ovsrec_flow_sample_collector_set_get_bridge(const struct ovsrec_flow_sample_collector_set *row,
3191
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
3192
 
{
3193
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
3194
 
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_bridge);
3195
 
}
3196
 
 
3197
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
3198
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
3199
 
 * easier and more efficient way to search for a given key than implementing
3200
 
 * the same operation on the "cooked" form in 'row'.
3201
 
 *
3202
 
 * 'key_type' must be OVSDB_TYPE_STRING.
3203
 
 * 'value_type' must be OVSDB_TYPE_STRING.
3204
 
 * (This helps to avoid silent bugs if someone changes external_ids's
3205
 
 * type without updating the caller.)
3206
 
 *
3207
 
 * The caller must not modify or free the returned value.
3208
 
 *
3209
 
 * Various kinds of changes can invalidate the returned value: modifying
3210
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3211
 
 * If the returned value is needed for a long time, it is best to make a copy
3212
 
 * of it with ovsdb_datum_clone(). */
3213
 
const struct ovsdb_datum *
3214
 
ovsrec_flow_sample_collector_set_get_external_ids(const struct ovsrec_flow_sample_collector_set *row,
3215
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
3216
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
3217
 
{
3218
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
3219
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
3220
 
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_external_ids);
3221
 
}
3222
 
 
3223
 
/* Returns the id column's value in 'row' as a struct ovsdb_datum.
3224
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
3225
 
 * easier and more efficient way to search for a given key than implementing
3226
 
 * the same operation on the "cooked" form in 'row'.
3227
 
 *
3228
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
3229
 
 * (This helps to avoid silent bugs if someone changes id's
3230
 
 * type without updating the caller.)
3231
 
 *
3232
 
 * The caller must not modify or free the returned value.
3233
 
 *
3234
 
 * Various kinds of changes can invalidate the returned value: modifying
3235
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3236
 
 * If the returned value is needed for a long time, it is best to make a copy
3237
 
 * of it with ovsdb_datum_clone(). */
3238
 
const struct ovsdb_datum *
3239
 
ovsrec_flow_sample_collector_set_get_id(const struct ovsrec_flow_sample_collector_set *row,
3240
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
3241
 
{
3242
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
3243
 
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_id);
3244
 
}
3245
 
 
3246
 
/* Returns the ipfix column's value in 'row' as a struct ovsdb_datum.
3247
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
3248
 
 * easier and more efficient way to search for a given key than implementing
3249
 
 * the same operation on the "cooked" form in 'row'.
3250
 
 *
3251
 
 * 'key_type' must be OVSDB_TYPE_UUID.
3252
 
 * (This helps to avoid silent bugs if someone changes ipfix's
3253
 
 * type without updating the caller.)
3254
 
 *
3255
 
 * The caller must not modify or free the returned value.
3256
 
 *
3257
 
 * Various kinds of changes can invalidate the returned value: modifying
3258
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3259
 
 * If the returned value is needed for a long time, it is best to make a copy
3260
 
 * of it with ovsdb_datum_clone(). */
3261
 
const struct ovsdb_datum *
3262
 
ovsrec_flow_sample_collector_set_get_ipfix(const struct ovsrec_flow_sample_collector_set *row,
3263
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
3264
 
{
3265
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
3266
 
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_sample_collector_set_col_ipfix);
3267
 
}
3268
 
 
3269
 
void
3270
 
ovsrec_flow_sample_collector_set_set_bridge(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_bridge *bridge)
3271
 
{
3272
 
    struct ovsdb_datum datum;
3273
 
    union ovsdb_atom key;
3274
 
 
3275
 
    ovs_assert(inited);
3276
 
    datum.n = 1;
3277
 
    datum.keys = &key;
3278
 
    key.uuid = bridge->header_.uuid;
3279
 
    datum.values = NULL;
3280
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_BRIDGE], &datum);
3281
 
}
3282
 
 
3283
 
void
3284
 
ovsrec_flow_sample_collector_set_set_external_ids(const struct ovsrec_flow_sample_collector_set *row, const struct smap *smap)
3285
 
{
3286
 
    struct ovsdb_datum datum;
3287
 
 
3288
 
    ovs_assert(inited);
3289
 
    if (smap) {
3290
 
        struct smap_node *node;
3291
 
        size_t i;
3292
 
 
3293
 
        datum.n = smap_count(smap);
3294
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3295
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
3296
 
 
3297
 
        i = 0;
3298
 
        SMAP_FOR_EACH (node, smap) {
3299
 
            datum.keys[i].string = xstrdup(node->key);
3300
 
            datum.values[i].string = xstrdup(node->value);
3301
 
            i++;
3302
 
        }
3303
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3304
 
    } else {
3305
 
        ovsdb_datum_init_empty(&datum);
3306
 
    }
3307
 
    ovsdb_idl_txn_write(&row->header_,
3308
 
                        &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_EXTERNAL_IDS],
3309
 
                        &datum);
3310
 
}
3311
 
 
3312
 
 
3313
 
void
3314
 
ovsrec_flow_sample_collector_set_set_id(const struct ovsrec_flow_sample_collector_set *row, int64_t id)
3315
 
{
3316
 
    struct ovsdb_datum datum;
3317
 
    union ovsdb_atom key;
3318
 
 
3319
 
    ovs_assert(inited);
3320
 
    datum.n = 1;
3321
 
    datum.keys = &key;
3322
 
    key.integer = id;
3323
 
    datum.values = NULL;
3324
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_ID], &datum);
3325
 
}
3326
 
 
3327
 
void
3328
 
ovsrec_flow_sample_collector_set_set_ipfix(const struct ovsrec_flow_sample_collector_set *row, const struct ovsrec_ipfix *ipfix)
3329
 
{
3330
 
    struct ovsdb_datum datum;
3331
 
    union ovsdb_atom key;
3332
 
 
3333
 
    ovs_assert(inited);
3334
 
    if (ipfix) {
3335
 
        datum.n = 1;
3336
 
        datum.keys = &key;
3337
 
        key.uuid = ipfix->header_.uuid;
3338
 
    } else {
3339
 
        datum.n = 0;
3340
 
        datum.keys = NULL;
3341
 
    }
3342
 
    datum.values = NULL;
3343
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_COL_IPFIX], &datum);
3344
 
}
3345
 
 
3346
 
struct ovsdb_idl_column ovsrec_flow_sample_collector_set_columns[OVSREC_FLOW_SAMPLE_COLLECTOR_SET_N_COLUMNS];
3347
 
 
3348
 
static void
3349
 
ovsrec_flow_sample_collector_set_columns_init(void)
3350
 
{
3351
 
    struct ovsdb_idl_column *c;
3352
 
 
3353
 
    /* Initialize ovsrec_flow_sample_collector_set_col_bridge. */
3354
 
    c = &ovsrec_flow_sample_collector_set_col_bridge;
3355
 
    c->name = "bridge";
3356
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
3357
 
    c->type.key.u.uuid.refTableName = "Bridge";
3358
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
3359
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3360
 
    c->type.n_min = 1;
3361
 
    c->type.n_max = 1;
3362
 
    c->mutable = true;
3363
 
    c->parse = ovsrec_flow_sample_collector_set_parse_bridge;
3364
 
    c->unparse = ovsrec_flow_sample_collector_set_unparse_bridge;
3365
 
 
3366
 
    /* Initialize ovsrec_flow_sample_collector_set_col_external_ids. */
3367
 
    c = &ovsrec_flow_sample_collector_set_col_external_ids;
3368
 
    c->name = "external_ids";
3369
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3370
 
    c->type.key.u.string.minLen = 0;
3371
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
3372
 
    c->type.value.u.string.minLen = 0;
3373
 
    c->type.n_min = 0;
3374
 
    c->type.n_max = UINT_MAX;
3375
 
    c->mutable = true;
3376
 
    c->parse = ovsrec_flow_sample_collector_set_parse_external_ids;
3377
 
    c->unparse = ovsrec_flow_sample_collector_set_unparse_external_ids;
3378
 
 
3379
 
    /* Initialize ovsrec_flow_sample_collector_set_col_id. */
3380
 
    c = &ovsrec_flow_sample_collector_set_col_id;
3381
 
    c->name = "id";
3382
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
3383
 
    c->type.key.u.integer.min = INT64_C(0);
3384
 
    c->type.key.u.integer.max = INT64_C(4294967295);
3385
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3386
 
    c->type.n_min = 1;
3387
 
    c->type.n_max = 1;
3388
 
    c->mutable = true;
3389
 
    c->parse = ovsrec_flow_sample_collector_set_parse_id;
3390
 
    c->unparse = ovsrec_flow_sample_collector_set_unparse_id;
3391
 
 
3392
 
    /* Initialize ovsrec_flow_sample_collector_set_col_ipfix. */
3393
 
    c = &ovsrec_flow_sample_collector_set_col_ipfix;
3394
 
    c->name = "ipfix";
3395
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
3396
 
    c->type.key.u.uuid.refTableName = "IPFIX";
3397
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
3398
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3399
 
    c->type.n_min = 0;
3400
 
    c->type.n_max = 1;
3401
 
    c->mutable = true;
3402
 
    c->parse = ovsrec_flow_sample_collector_set_parse_ipfix;
3403
 
    c->unparse = ovsrec_flow_sample_collector_set_unparse_ipfix;
3404
 
}
3405
 
 
3406
 
/* Flow_Table table. */
3407
 
 
3408
 
static void
3409
 
ovsrec_flow_table_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3410
 
{
3411
 
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3412
 
    size_t i;
3413
 
 
3414
 
    ovs_assert(inited);
3415
 
    smap_init(&row->external_ids);
3416
 
    for (i = 0; i < datum->n; i++) {
3417
 
        smap_add(&row->external_ids,
3418
 
                 datum->keys[i].string,
3419
 
                 datum->values[i].string);
3420
 
    }
3421
 
}
3422
 
 
3423
 
static void
3424
 
ovsrec_flow_table_parse_flow_limit(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3425
 
{
3426
 
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3427
 
    size_t n = MIN(1, datum->n);
3428
 
    size_t i;
3429
 
 
3430
 
    ovs_assert(inited);
3431
 
    row->flow_limit = NULL;
3432
 
    row->n_flow_limit = 0;
3433
 
    for (i = 0; i < n; i++) {
3434
 
        if (!row->n_flow_limit) {
3435
 
            row->flow_limit = xmalloc(n * sizeof *row->flow_limit);
3436
 
        }
3437
 
        row->flow_limit[row->n_flow_limit] = datum->keys[i].integer;
3438
 
        row->n_flow_limit++;
3439
 
    }
3440
 
}
3441
 
 
3442
 
static void
3443
 
ovsrec_flow_table_parse_groups(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3444
 
{
3445
 
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3446
 
    size_t i;
3447
 
 
3448
 
    ovs_assert(inited);
3449
 
    row->groups = NULL;
3450
 
    row->n_groups = 0;
3451
 
    for (i = 0; i < datum->n; i++) {
3452
 
        if (!row->n_groups) {
3453
 
            row->groups = xmalloc(datum->n * sizeof *row->groups);
3454
 
        }
3455
 
        row->groups[row->n_groups] = datum->keys[i].string;
3456
 
        row->n_groups++;
3457
 
    }
3458
 
}
3459
 
 
3460
 
static void
3461
 
ovsrec_flow_table_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3462
 
{
3463
 
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3464
 
 
3465
 
    ovs_assert(inited);
3466
 
    if (datum->n >= 1) {
3467
 
        row->name = datum->keys[0].string;
3468
 
    } else {
3469
 
        row->name = NULL;
3470
 
    }
3471
 
}
3472
 
 
3473
 
static void
3474
 
ovsrec_flow_table_parse_overflow_policy(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3475
 
{
3476
 
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3477
 
 
3478
 
    ovs_assert(inited);
3479
 
    if (datum->n >= 1) {
3480
 
        row->overflow_policy = datum->keys[0].string;
3481
 
    } else {
3482
 
        row->overflow_policy = NULL;
3483
 
    }
3484
 
}
3485
 
 
3486
 
static void
3487
 
ovsrec_flow_table_parse_prefixes(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3488
 
{
3489
 
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3490
 
    size_t n = MIN(3, datum->n);
3491
 
    size_t i;
3492
 
 
3493
 
    ovs_assert(inited);
3494
 
    row->prefixes = NULL;
3495
 
    row->n_prefixes = 0;
3496
 
    for (i = 0; i < n; i++) {
3497
 
        if (!row->n_prefixes) {
3498
 
            row->prefixes = xmalloc(n * sizeof *row->prefixes);
3499
 
        }
3500
 
        row->prefixes[row->n_prefixes] = datum->keys[i].string;
3501
 
        row->n_prefixes++;
3502
 
    }
3503
 
}
3504
 
 
3505
 
static void
3506
 
ovsrec_flow_table_unparse_external_ids(struct ovsdb_idl_row *row_)
3507
 
{
3508
 
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3509
 
 
3510
 
    ovs_assert(inited);
3511
 
    smap_destroy(&row->external_ids);
3512
 
}
3513
 
 
3514
 
static void
3515
 
ovsrec_flow_table_unparse_flow_limit(struct ovsdb_idl_row *row_)
3516
 
{
3517
 
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3518
 
 
3519
 
    ovs_assert(inited);
3520
 
    free(row->flow_limit);
3521
 
}
3522
 
 
3523
 
static void
3524
 
ovsrec_flow_table_unparse_groups(struct ovsdb_idl_row *row_)
3525
 
{
3526
 
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3527
 
 
3528
 
    ovs_assert(inited);
3529
 
    free(row->groups);
3530
 
}
3531
 
 
3532
 
static void
3533
 
ovsrec_flow_table_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
3534
 
{
3535
 
    /* Nothing to do. */
3536
 
}
3537
 
 
3538
 
static void
3539
 
ovsrec_flow_table_unparse_overflow_policy(struct ovsdb_idl_row *row OVS_UNUSED)
3540
 
{
3541
 
    /* Nothing to do. */
3542
 
}
3543
 
 
3544
 
static void
3545
 
ovsrec_flow_table_unparse_prefixes(struct ovsdb_idl_row *row_)
3546
 
{
3547
 
    struct ovsrec_flow_table *row = ovsrec_flow_table_cast(row_);
3548
 
 
3549
 
    ovs_assert(inited);
3550
 
    free(row->prefixes);
3551
 
}
3552
 
 
3553
 
static void
3554
 
ovsrec_flow_table_init__(struct ovsdb_idl_row *row)
3555
 
{
3556
 
    ovsrec_flow_table_init(ovsrec_flow_table_cast(row));
3557
 
}
3558
 
 
3559
 
void
3560
 
ovsrec_flow_table_init(struct ovsrec_flow_table *row)
3561
 
{
3562
 
    memset(row, 0, sizeof *row); 
3563
 
    smap_init(&row->external_ids);
3564
 
}
3565
 
 
3566
 
const struct ovsrec_flow_table *
3567
 
ovsrec_flow_table_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
3568
 
{
3569
 
    return ovsrec_flow_table_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE], uuid));
3570
 
}
3571
 
 
3572
 
const struct ovsrec_flow_table *
3573
 
ovsrec_flow_table_first(const struct ovsdb_idl *idl)
3574
 
{
3575
 
    return ovsrec_flow_table_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE]));
3576
 
}
3577
 
 
3578
 
const struct ovsrec_flow_table *
3579
 
ovsrec_flow_table_next(const struct ovsrec_flow_table *row)
3580
 
{
3581
 
    return ovsrec_flow_table_cast(ovsdb_idl_next_row(&row->header_));
3582
 
}
3583
 
 
3584
 
void
3585
 
ovsrec_flow_table_delete(const struct ovsrec_flow_table *row)
3586
 
{
3587
 
    ovsdb_idl_txn_delete(&row->header_);
3588
 
}
3589
 
 
3590
 
struct ovsrec_flow_table *
3591
 
ovsrec_flow_table_insert(struct ovsdb_idl_txn *txn)
3592
 
{
3593
 
    return ovsrec_flow_table_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_FLOW_TABLE], NULL));
3594
 
}
3595
 
 
3596
 
 
3597
 
void
3598
 
ovsrec_flow_table_verify_external_ids(const struct ovsrec_flow_table *row)
3599
 
{
3600
 
    ovs_assert(inited);
3601
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_EXTERNAL_IDS]);
3602
 
}
3603
 
 
3604
 
void
3605
 
ovsrec_flow_table_verify_flow_limit(const struct ovsrec_flow_table *row)
3606
 
{
3607
 
    ovs_assert(inited);
3608
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_FLOW_LIMIT]);
3609
 
}
3610
 
 
3611
 
void
3612
 
ovsrec_flow_table_verify_groups(const struct ovsrec_flow_table *row)
3613
 
{
3614
 
    ovs_assert(inited);
3615
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_GROUPS]);
3616
 
}
3617
 
 
3618
 
void
3619
 
ovsrec_flow_table_verify_name(const struct ovsrec_flow_table *row)
3620
 
{
3621
 
    ovs_assert(inited);
3622
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_NAME]);
3623
 
}
3624
 
 
3625
 
void
3626
 
ovsrec_flow_table_verify_overflow_policy(const struct ovsrec_flow_table *row)
3627
 
{
3628
 
    ovs_assert(inited);
3629
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_OVERFLOW_POLICY]);
3630
 
}
3631
 
 
3632
 
void
3633
 
ovsrec_flow_table_verify_prefixes(const struct ovsrec_flow_table *row)
3634
 
{
3635
 
    ovs_assert(inited);
3636
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_PREFIXES]);
3637
 
}
3638
 
 
3639
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
3640
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
3641
 
 * easier and more efficient way to search for a given key than implementing
3642
 
 * the same operation on the "cooked" form in 'row'.
3643
 
 *
3644
 
 * 'key_type' must be OVSDB_TYPE_STRING.
3645
 
 * 'value_type' must be OVSDB_TYPE_STRING.
3646
 
 * (This helps to avoid silent bugs if someone changes external_ids's
3647
 
 * type without updating the caller.)
3648
 
 *
3649
 
 * The caller must not modify or free the returned value.
3650
 
 *
3651
 
 * Various kinds of changes can invalidate the returned value: modifying
3652
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3653
 
 * If the returned value is needed for a long time, it is best to make a copy
3654
 
 * of it with ovsdb_datum_clone(). */
3655
 
const struct ovsdb_datum *
3656
 
ovsrec_flow_table_get_external_ids(const struct ovsrec_flow_table *row,
3657
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
3658
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
3659
 
{
3660
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
3661
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
3662
 
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_external_ids);
3663
 
}
3664
 
 
3665
 
/* Returns the flow_limit column's value in 'row' as a struct ovsdb_datum.
3666
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
3667
 
 * easier and more efficient way to search for a given key than implementing
3668
 
 * the same operation on the "cooked" form in 'row'.
3669
 
 *
3670
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
3671
 
 * (This helps to avoid silent bugs if someone changes flow_limit's
3672
 
 * type without updating the caller.)
3673
 
 *
3674
 
 * The caller must not modify or free the returned value.
3675
 
 *
3676
 
 * Various kinds of changes can invalidate the returned value: modifying
3677
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3678
 
 * If the returned value is needed for a long time, it is best to make a copy
3679
 
 * of it with ovsdb_datum_clone(). */
3680
 
const struct ovsdb_datum *
3681
 
ovsrec_flow_table_get_flow_limit(const struct ovsrec_flow_table *row,
3682
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
3683
 
{
3684
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
3685
 
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_flow_limit);
3686
 
}
3687
 
 
3688
 
/* Returns the groups column's value in 'row' as a struct ovsdb_datum.
3689
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
3690
 
 * easier and more efficient way to search for a given key than implementing
3691
 
 * the same operation on the "cooked" form in 'row'.
3692
 
 *
3693
 
 * 'key_type' must be OVSDB_TYPE_STRING.
3694
 
 * (This helps to avoid silent bugs if someone changes groups's
3695
 
 * type without updating the caller.)
3696
 
 *
3697
 
 * The caller must not modify or free the returned value.
3698
 
 *
3699
 
 * Various kinds of changes can invalidate the returned value: modifying
3700
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3701
 
 * If the returned value is needed for a long time, it is best to make a copy
3702
 
 * of it with ovsdb_datum_clone(). */
3703
 
const struct ovsdb_datum *
3704
 
ovsrec_flow_table_get_groups(const struct ovsrec_flow_table *row,
3705
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
3706
 
{
3707
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
3708
 
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_groups);
3709
 
}
3710
 
 
3711
 
/* Returns the name column's value in 'row' as a struct ovsdb_datum.
3712
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
3713
 
 * easier and more efficient way to search for a given key than implementing
3714
 
 * the same operation on the "cooked" form in 'row'.
3715
 
 *
3716
 
 * 'key_type' must be OVSDB_TYPE_STRING.
3717
 
 * (This helps to avoid silent bugs if someone changes name's
3718
 
 * type without updating the caller.)
3719
 
 *
3720
 
 * The caller must not modify or free the returned value.
3721
 
 *
3722
 
 * Various kinds of changes can invalidate the returned value: modifying
3723
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3724
 
 * If the returned value is needed for a long time, it is best to make a copy
3725
 
 * of it with ovsdb_datum_clone(). */
3726
 
const struct ovsdb_datum *
3727
 
ovsrec_flow_table_get_name(const struct ovsrec_flow_table *row,
3728
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
3729
 
{
3730
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
3731
 
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_name);
3732
 
}
3733
 
 
3734
 
/* Returns the overflow_policy column's value in 'row' as a struct ovsdb_datum.
3735
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
3736
 
 * easier and more efficient way to search for a given key than implementing
3737
 
 * the same operation on the "cooked" form in 'row'.
3738
 
 *
3739
 
 * 'key_type' must be OVSDB_TYPE_STRING.
3740
 
 * (This helps to avoid silent bugs if someone changes overflow_policy's
3741
 
 * type without updating the caller.)
3742
 
 *
3743
 
 * The caller must not modify or free the returned value.
3744
 
 *
3745
 
 * Various kinds of changes can invalidate the returned value: modifying
3746
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3747
 
 * If the returned value is needed for a long time, it is best to make a copy
3748
 
 * of it with ovsdb_datum_clone(). */
3749
 
const struct ovsdb_datum *
3750
 
ovsrec_flow_table_get_overflow_policy(const struct ovsrec_flow_table *row,
3751
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
3752
 
{
3753
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
3754
 
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_overflow_policy);
3755
 
}
3756
 
 
3757
 
/* Returns the prefixes column's value in 'row' as a struct ovsdb_datum.
3758
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
3759
 
 * easier and more efficient way to search for a given key than implementing
3760
 
 * the same operation on the "cooked" form in 'row'.
3761
 
 *
3762
 
 * 'key_type' must be OVSDB_TYPE_STRING.
3763
 
 * (This helps to avoid silent bugs if someone changes prefixes's
3764
 
 * type without updating the caller.)
3765
 
 *
3766
 
 * The caller must not modify or free the returned value.
3767
 
 *
3768
 
 * Various kinds of changes can invalidate the returned value: modifying
3769
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
3770
 
 * If the returned value is needed for a long time, it is best to make a copy
3771
 
 * of it with ovsdb_datum_clone(). */
3772
 
const struct ovsdb_datum *
3773
 
ovsrec_flow_table_get_prefixes(const struct ovsrec_flow_table *row,
3774
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
3775
 
{
3776
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
3777
 
    return ovsdb_idl_read(&row->header_, &ovsrec_flow_table_col_prefixes);
3778
 
}
3779
 
 
3780
 
void
3781
 
ovsrec_flow_table_set_external_ids(const struct ovsrec_flow_table *row, const struct smap *smap)
3782
 
{
3783
 
    struct ovsdb_datum datum;
3784
 
 
3785
 
    ovs_assert(inited);
3786
 
    if (smap) {
3787
 
        struct smap_node *node;
3788
 
        size_t i;
3789
 
 
3790
 
        datum.n = smap_count(smap);
3791
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
3792
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
3793
 
 
3794
 
        i = 0;
3795
 
        SMAP_FOR_EACH (node, smap) {
3796
 
            datum.keys[i].string = xstrdup(node->key);
3797
 
            datum.values[i].string = xstrdup(node->value);
3798
 
            i++;
3799
 
        }
3800
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
3801
 
    } else {
3802
 
        ovsdb_datum_init_empty(&datum);
3803
 
    }
3804
 
    ovsdb_idl_txn_write(&row->header_,
3805
 
                        &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_EXTERNAL_IDS],
3806
 
                        &datum);
3807
 
}
3808
 
 
3809
 
 
3810
 
void
3811
 
ovsrec_flow_table_set_flow_limit(const struct ovsrec_flow_table *row, const int64_t *flow_limit, size_t n_flow_limit)
3812
 
{
3813
 
    struct ovsdb_datum datum;
3814
 
    union ovsdb_atom key;
3815
 
 
3816
 
    ovs_assert(inited);
3817
 
    if (n_flow_limit) {
3818
 
        datum.n = 1;
3819
 
        datum.keys = &key;
3820
 
        key.integer = *flow_limit;
3821
 
    } else {
3822
 
        datum.n = 0;
3823
 
        datum.keys = NULL;
3824
 
    }
3825
 
    datum.values = NULL;
3826
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_FLOW_LIMIT], &datum);
3827
 
}
3828
 
 
3829
 
void
3830
 
ovsrec_flow_table_set_groups(const struct ovsrec_flow_table *row, char **groups, size_t n_groups)
3831
 
{
3832
 
    struct ovsdb_datum datum;
3833
 
    size_t i;
3834
 
 
3835
 
    ovs_assert(inited);
3836
 
    datum.n = n_groups;
3837
 
    datum.keys = n_groups ? xmalloc(n_groups * sizeof *datum.keys) : NULL;
3838
 
    datum.values = NULL;
3839
 
    for (i = 0; i < n_groups; i++) {
3840
 
        datum.keys[i].string = xstrdup(groups[i]);
3841
 
    }
3842
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
3843
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_GROUPS], &datum);
3844
 
}
3845
 
 
3846
 
void
3847
 
ovsrec_flow_table_set_name(const struct ovsrec_flow_table *row, const char *name)
3848
 
{
3849
 
    struct ovsdb_datum datum;
3850
 
    union ovsdb_atom key;
3851
 
 
3852
 
    ovs_assert(inited);
3853
 
    if (name) {
3854
 
        datum.n = 1;
3855
 
        datum.keys = &key;
3856
 
        key.string = CONST_CAST(char *, name);
3857
 
    } else {
3858
 
        datum.n = 0;
3859
 
        datum.keys = NULL;
3860
 
    }
3861
 
    datum.values = NULL;
3862
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_NAME], &datum);
3863
 
}
3864
 
 
3865
 
void
3866
 
ovsrec_flow_table_set_overflow_policy(const struct ovsrec_flow_table *row, const char *overflow_policy)
3867
 
{
3868
 
    struct ovsdb_datum datum;
3869
 
    union ovsdb_atom key;
3870
 
 
3871
 
    ovs_assert(inited);
3872
 
    if (overflow_policy) {
3873
 
        datum.n = 1;
3874
 
        datum.keys = &key;
3875
 
        key.string = CONST_CAST(char *, overflow_policy);
3876
 
    } else {
3877
 
        datum.n = 0;
3878
 
        datum.keys = NULL;
3879
 
    }
3880
 
    datum.values = NULL;
3881
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_OVERFLOW_POLICY], &datum);
3882
 
}
3883
 
 
3884
 
void
3885
 
ovsrec_flow_table_set_prefixes(const struct ovsrec_flow_table *row, char **prefixes, size_t n_prefixes)
3886
 
{
3887
 
    struct ovsdb_datum datum;
3888
 
    size_t i;
3889
 
 
3890
 
    ovs_assert(inited);
3891
 
    datum.n = n_prefixes;
3892
 
    datum.keys = n_prefixes ? xmalloc(n_prefixes * sizeof *datum.keys) : NULL;
3893
 
    datum.values = NULL;
3894
 
    for (i = 0; i < n_prefixes; i++) {
3895
 
        datum.keys[i].string = xstrdup(prefixes[i]);
3896
 
    }
3897
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
3898
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_COL_PREFIXES], &datum);
3899
 
}
3900
 
 
3901
 
struct ovsdb_idl_column ovsrec_flow_table_columns[OVSREC_FLOW_TABLE_N_COLUMNS];
3902
 
 
3903
 
static void
3904
 
ovsrec_flow_table_columns_init(void)
3905
 
{
3906
 
    struct ovsdb_idl_column *c;
3907
 
 
3908
 
    /* Initialize ovsrec_flow_table_col_external_ids. */
3909
 
    c = &ovsrec_flow_table_col_external_ids;
3910
 
    c->name = "external_ids";
3911
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3912
 
    c->type.key.u.string.minLen = 0;
3913
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
3914
 
    c->type.value.u.string.minLen = 0;
3915
 
    c->type.n_min = 0;
3916
 
    c->type.n_max = UINT_MAX;
3917
 
    c->mutable = true;
3918
 
    c->parse = ovsrec_flow_table_parse_external_ids;
3919
 
    c->unparse = ovsrec_flow_table_unparse_external_ids;
3920
 
 
3921
 
    /* Initialize ovsrec_flow_table_col_flow_limit. */
3922
 
    c = &ovsrec_flow_table_col_flow_limit;
3923
 
    c->name = "flow_limit";
3924
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
3925
 
    c->type.key.u.integer.min = INT64_C(0);
3926
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3927
 
    c->type.n_min = 0;
3928
 
    c->type.n_max = 1;
3929
 
    c->mutable = true;
3930
 
    c->parse = ovsrec_flow_table_parse_flow_limit;
3931
 
    c->unparse = ovsrec_flow_table_unparse_flow_limit;
3932
 
 
3933
 
    /* Initialize ovsrec_flow_table_col_groups. */
3934
 
    c = &ovsrec_flow_table_col_groups;
3935
 
    c->name = "groups";
3936
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3937
 
    c->type.key.u.string.minLen = 0;
3938
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3939
 
    c->type.n_min = 0;
3940
 
    c->type.n_max = UINT_MAX;
3941
 
    c->mutable = true;
3942
 
    c->parse = ovsrec_flow_table_parse_groups;
3943
 
    c->unparse = ovsrec_flow_table_unparse_groups;
3944
 
 
3945
 
    /* Initialize ovsrec_flow_table_col_name. */
3946
 
    c = &ovsrec_flow_table_col_name;
3947
 
    c->name = "name";
3948
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3949
 
    c->type.key.u.string.minLen = 0;
3950
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3951
 
    c->type.n_min = 0;
3952
 
    c->type.n_max = 1;
3953
 
    c->mutable = true;
3954
 
    c->parse = ovsrec_flow_table_parse_name;
3955
 
    c->unparse = ovsrec_flow_table_unparse_name;
3956
 
 
3957
 
    /* Initialize ovsrec_flow_table_col_overflow_policy. */
3958
 
    c = &ovsrec_flow_table_col_overflow_policy;
3959
 
    c->name = "overflow_policy";
3960
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3961
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
3962
 
    c->type.key.enum_->n = 2;
3963
 
    c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
3964
 
    c->type.key.enum_->keys[0].string = xstrdup("evict");
3965
 
    c->type.key.enum_->keys[1].string = xstrdup("refuse");
3966
 
    c->type.key.enum_->values = NULL;
3967
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
3968
 
    c->type.key.u.string.minLen = 0;
3969
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3970
 
    c->type.n_min = 0;
3971
 
    c->type.n_max = 1;
3972
 
    c->mutable = true;
3973
 
    c->parse = ovsrec_flow_table_parse_overflow_policy;
3974
 
    c->unparse = ovsrec_flow_table_unparse_overflow_policy;
3975
 
 
3976
 
    /* Initialize ovsrec_flow_table_col_prefixes. */
3977
 
    c = &ovsrec_flow_table_col_prefixes;
3978
 
    c->name = "prefixes";
3979
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
3980
 
    c->type.key.u.string.minLen = 0;
3981
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
3982
 
    c->type.n_min = 0;
3983
 
    c->type.n_max = 3;
3984
 
    c->mutable = true;
3985
 
    c->parse = ovsrec_flow_table_parse_prefixes;
3986
 
    c->unparse = ovsrec_flow_table_unparse_prefixes;
3987
 
}
3988
 
 
3989
 
/* IPFIX table. */
3990
 
 
3991
 
static void
3992
 
ovsrec_ipfix_parse_cache_active_timeout(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
3993
 
{
3994
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
3995
 
    size_t n = MIN(1, datum->n);
3996
 
    size_t i;
3997
 
 
3998
 
    ovs_assert(inited);
3999
 
    row->cache_active_timeout = NULL;
4000
 
    row->n_cache_active_timeout = 0;
4001
 
    for (i = 0; i < n; i++) {
4002
 
        if (!row->n_cache_active_timeout) {
4003
 
            row->cache_active_timeout = xmalloc(n * sizeof *row->cache_active_timeout);
4004
 
        }
4005
 
        row->cache_active_timeout[row->n_cache_active_timeout] = datum->keys[i].integer;
4006
 
        row->n_cache_active_timeout++;
4007
 
    }
4008
 
}
4009
 
 
4010
 
static void
4011
 
ovsrec_ipfix_parse_cache_max_flows(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4012
 
{
4013
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4014
 
    size_t n = MIN(1, datum->n);
4015
 
    size_t i;
4016
 
 
4017
 
    ovs_assert(inited);
4018
 
    row->cache_max_flows = NULL;
4019
 
    row->n_cache_max_flows = 0;
4020
 
    for (i = 0; i < n; i++) {
4021
 
        if (!row->n_cache_max_flows) {
4022
 
            row->cache_max_flows = xmalloc(n * sizeof *row->cache_max_flows);
4023
 
        }
4024
 
        row->cache_max_flows[row->n_cache_max_flows] = datum->keys[i].integer;
4025
 
        row->n_cache_max_flows++;
4026
 
    }
4027
 
}
4028
 
 
4029
 
static void
4030
 
ovsrec_ipfix_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4031
 
{
4032
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4033
 
    size_t i;
4034
 
 
4035
 
    ovs_assert(inited);
4036
 
    smap_init(&row->external_ids);
4037
 
    for (i = 0; i < datum->n; i++) {
4038
 
        smap_add(&row->external_ids,
4039
 
                 datum->keys[i].string,
4040
 
                 datum->values[i].string);
4041
 
    }
4042
 
}
4043
 
 
4044
 
static void
4045
 
ovsrec_ipfix_parse_obs_domain_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4046
 
{
4047
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4048
 
    size_t n = MIN(1, datum->n);
4049
 
    size_t i;
4050
 
 
4051
 
    ovs_assert(inited);
4052
 
    row->obs_domain_id = NULL;
4053
 
    row->n_obs_domain_id = 0;
4054
 
    for (i = 0; i < n; i++) {
4055
 
        if (!row->n_obs_domain_id) {
4056
 
            row->obs_domain_id = xmalloc(n * sizeof *row->obs_domain_id);
4057
 
        }
4058
 
        row->obs_domain_id[row->n_obs_domain_id] = datum->keys[i].integer;
4059
 
        row->n_obs_domain_id++;
4060
 
    }
4061
 
}
4062
 
 
4063
 
static void
4064
 
ovsrec_ipfix_parse_obs_point_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4065
 
{
4066
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4067
 
    size_t n = MIN(1, datum->n);
4068
 
    size_t i;
4069
 
 
4070
 
    ovs_assert(inited);
4071
 
    row->obs_point_id = NULL;
4072
 
    row->n_obs_point_id = 0;
4073
 
    for (i = 0; i < n; i++) {
4074
 
        if (!row->n_obs_point_id) {
4075
 
            row->obs_point_id = xmalloc(n * sizeof *row->obs_point_id);
4076
 
        }
4077
 
        row->obs_point_id[row->n_obs_point_id] = datum->keys[i].integer;
4078
 
        row->n_obs_point_id++;
4079
 
    }
4080
 
}
4081
 
 
4082
 
static void
4083
 
ovsrec_ipfix_parse_sampling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4084
 
{
4085
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4086
 
    size_t n = MIN(1, datum->n);
4087
 
    size_t i;
4088
 
 
4089
 
    ovs_assert(inited);
4090
 
    row->sampling = NULL;
4091
 
    row->n_sampling = 0;
4092
 
    for (i = 0; i < n; i++) {
4093
 
        if (!row->n_sampling) {
4094
 
            row->sampling = xmalloc(n * sizeof *row->sampling);
4095
 
        }
4096
 
        row->sampling[row->n_sampling] = datum->keys[i].integer;
4097
 
        row->n_sampling++;
4098
 
    }
4099
 
}
4100
 
 
4101
 
static void
4102
 
ovsrec_ipfix_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4103
 
{
4104
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4105
 
    size_t i;
4106
 
 
4107
 
    ovs_assert(inited);
4108
 
    row->targets = NULL;
4109
 
    row->n_targets = 0;
4110
 
    for (i = 0; i < datum->n; i++) {
4111
 
        if (!row->n_targets) {
4112
 
            row->targets = xmalloc(datum->n * sizeof *row->targets);
4113
 
        }
4114
 
        row->targets[row->n_targets] = datum->keys[i].string;
4115
 
        row->n_targets++;
4116
 
    }
4117
 
}
4118
 
 
4119
 
static void
4120
 
ovsrec_ipfix_unparse_cache_active_timeout(struct ovsdb_idl_row *row_)
4121
 
{
4122
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4123
 
 
4124
 
    ovs_assert(inited);
4125
 
    free(row->cache_active_timeout);
4126
 
}
4127
 
 
4128
 
static void
4129
 
ovsrec_ipfix_unparse_cache_max_flows(struct ovsdb_idl_row *row_)
4130
 
{
4131
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4132
 
 
4133
 
    ovs_assert(inited);
4134
 
    free(row->cache_max_flows);
4135
 
}
4136
 
 
4137
 
static void
4138
 
ovsrec_ipfix_unparse_external_ids(struct ovsdb_idl_row *row_)
4139
 
{
4140
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4141
 
 
4142
 
    ovs_assert(inited);
4143
 
    smap_destroy(&row->external_ids);
4144
 
}
4145
 
 
4146
 
static void
4147
 
ovsrec_ipfix_unparse_obs_domain_id(struct ovsdb_idl_row *row_)
4148
 
{
4149
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4150
 
 
4151
 
    ovs_assert(inited);
4152
 
    free(row->obs_domain_id);
4153
 
}
4154
 
 
4155
 
static void
4156
 
ovsrec_ipfix_unparse_obs_point_id(struct ovsdb_idl_row *row_)
4157
 
{
4158
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4159
 
 
4160
 
    ovs_assert(inited);
4161
 
    free(row->obs_point_id);
4162
 
}
4163
 
 
4164
 
static void
4165
 
ovsrec_ipfix_unparse_sampling(struct ovsdb_idl_row *row_)
4166
 
{
4167
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4168
 
 
4169
 
    ovs_assert(inited);
4170
 
    free(row->sampling);
4171
 
}
4172
 
 
4173
 
static void
4174
 
ovsrec_ipfix_unparse_targets(struct ovsdb_idl_row *row_)
4175
 
{
4176
 
    struct ovsrec_ipfix *row = ovsrec_ipfix_cast(row_);
4177
 
 
4178
 
    ovs_assert(inited);
4179
 
    free(row->targets);
4180
 
}
4181
 
 
4182
 
static void
4183
 
ovsrec_ipfix_init__(struct ovsdb_idl_row *row)
4184
 
{
4185
 
    ovsrec_ipfix_init(ovsrec_ipfix_cast(row));
4186
 
}
4187
 
 
4188
 
void
4189
 
ovsrec_ipfix_init(struct ovsrec_ipfix *row)
4190
 
{
4191
 
    memset(row, 0, sizeof *row); 
4192
 
    smap_init(&row->external_ids);
4193
 
}
4194
 
 
4195
 
const struct ovsrec_ipfix *
4196
 
ovsrec_ipfix_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
4197
 
{
4198
 
    return ovsrec_ipfix_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_IPFIX], uuid));
4199
 
}
4200
 
 
4201
 
const struct ovsrec_ipfix *
4202
 
ovsrec_ipfix_first(const struct ovsdb_idl *idl)
4203
 
{
4204
 
    return ovsrec_ipfix_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_IPFIX]));
4205
 
}
4206
 
 
4207
 
const struct ovsrec_ipfix *
4208
 
ovsrec_ipfix_next(const struct ovsrec_ipfix *row)
4209
 
{
4210
 
    return ovsrec_ipfix_cast(ovsdb_idl_next_row(&row->header_));
4211
 
}
4212
 
 
4213
 
void
4214
 
ovsrec_ipfix_delete(const struct ovsrec_ipfix *row)
4215
 
{
4216
 
    ovsdb_idl_txn_delete(&row->header_);
4217
 
}
4218
 
 
4219
 
struct ovsrec_ipfix *
4220
 
ovsrec_ipfix_insert(struct ovsdb_idl_txn *txn)
4221
 
{
4222
 
    return ovsrec_ipfix_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_IPFIX], NULL));
4223
 
}
4224
 
 
4225
 
 
4226
 
void
4227
 
ovsrec_ipfix_verify_cache_active_timeout(const struct ovsrec_ipfix *row)
4228
 
{
4229
 
    ovs_assert(inited);
4230
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_CACHE_ACTIVE_TIMEOUT]);
4231
 
}
4232
 
 
4233
 
void
4234
 
ovsrec_ipfix_verify_cache_max_flows(const struct ovsrec_ipfix *row)
4235
 
{
4236
 
    ovs_assert(inited);
4237
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_CACHE_MAX_FLOWS]);
4238
 
}
4239
 
 
4240
 
void
4241
 
ovsrec_ipfix_verify_external_ids(const struct ovsrec_ipfix *row)
4242
 
{
4243
 
    ovs_assert(inited);
4244
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_EXTERNAL_IDS]);
4245
 
}
4246
 
 
4247
 
void
4248
 
ovsrec_ipfix_verify_obs_domain_id(const struct ovsrec_ipfix *row)
4249
 
{
4250
 
    ovs_assert(inited);
4251
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_OBS_DOMAIN_ID]);
4252
 
}
4253
 
 
4254
 
void
4255
 
ovsrec_ipfix_verify_obs_point_id(const struct ovsrec_ipfix *row)
4256
 
{
4257
 
    ovs_assert(inited);
4258
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_OBS_POINT_ID]);
4259
 
}
4260
 
 
4261
 
void
4262
 
ovsrec_ipfix_verify_sampling(const struct ovsrec_ipfix *row)
4263
 
{
4264
 
    ovs_assert(inited);
4265
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_SAMPLING]);
4266
 
}
4267
 
 
4268
 
void
4269
 
ovsrec_ipfix_verify_targets(const struct ovsrec_ipfix *row)
4270
 
{
4271
 
    ovs_assert(inited);
4272
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_TARGETS]);
4273
 
}
4274
 
 
4275
 
/* Returns the cache_active_timeout column's value in 'row' as a struct ovsdb_datum.
4276
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
4277
 
 * easier and more efficient way to search for a given key than implementing
4278
 
 * the same operation on the "cooked" form in 'row'.
4279
 
 *
4280
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
4281
 
 * (This helps to avoid silent bugs if someone changes cache_active_timeout's
4282
 
 * type without updating the caller.)
4283
 
 *
4284
 
 * The caller must not modify or free the returned value.
4285
 
 *
4286
 
 * Various kinds of changes can invalidate the returned value: modifying
4287
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4288
 
 * If the returned value is needed for a long time, it is best to make a copy
4289
 
 * of it with ovsdb_datum_clone(). */
4290
 
const struct ovsdb_datum *
4291
 
ovsrec_ipfix_get_cache_active_timeout(const struct ovsrec_ipfix *row,
4292
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
4293
 
{
4294
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4295
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_cache_active_timeout);
4296
 
}
4297
 
 
4298
 
/* Returns the cache_max_flows column's value in 'row' as a struct ovsdb_datum.
4299
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
4300
 
 * easier and more efficient way to search for a given key than implementing
4301
 
 * the same operation on the "cooked" form in 'row'.
4302
 
 *
4303
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
4304
 
 * (This helps to avoid silent bugs if someone changes cache_max_flows's
4305
 
 * type without updating the caller.)
4306
 
 *
4307
 
 * The caller must not modify or free the returned value.
4308
 
 *
4309
 
 * Various kinds of changes can invalidate the returned value: modifying
4310
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4311
 
 * If the returned value is needed for a long time, it is best to make a copy
4312
 
 * of it with ovsdb_datum_clone(). */
4313
 
const struct ovsdb_datum *
4314
 
ovsrec_ipfix_get_cache_max_flows(const struct ovsrec_ipfix *row,
4315
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
4316
 
{
4317
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4318
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_cache_max_flows);
4319
 
}
4320
 
 
4321
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
4322
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
4323
 
 * easier and more efficient way to search for a given key than implementing
4324
 
 * the same operation on the "cooked" form in 'row'.
4325
 
 *
4326
 
 * 'key_type' must be OVSDB_TYPE_STRING.
4327
 
 * 'value_type' must be OVSDB_TYPE_STRING.
4328
 
 * (This helps to avoid silent bugs if someone changes external_ids's
4329
 
 * type without updating the caller.)
4330
 
 *
4331
 
 * The caller must not modify or free the returned value.
4332
 
 *
4333
 
 * Various kinds of changes can invalidate the returned value: modifying
4334
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4335
 
 * If the returned value is needed for a long time, it is best to make a copy
4336
 
 * of it with ovsdb_datum_clone(). */
4337
 
const struct ovsdb_datum *
4338
 
ovsrec_ipfix_get_external_ids(const struct ovsrec_ipfix *row,
4339
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
4340
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
4341
 
{
4342
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
4343
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
4344
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_external_ids);
4345
 
}
4346
 
 
4347
 
/* Returns the obs_domain_id column's value in 'row' as a struct ovsdb_datum.
4348
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
4349
 
 * easier and more efficient way to search for a given key than implementing
4350
 
 * the same operation on the "cooked" form in 'row'.
4351
 
 *
4352
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
4353
 
 * (This helps to avoid silent bugs if someone changes obs_domain_id's
4354
 
 * type without updating the caller.)
4355
 
 *
4356
 
 * The caller must not modify or free the returned value.
4357
 
 *
4358
 
 * Various kinds of changes can invalidate the returned value: modifying
4359
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4360
 
 * If the returned value is needed for a long time, it is best to make a copy
4361
 
 * of it with ovsdb_datum_clone(). */
4362
 
const struct ovsdb_datum *
4363
 
ovsrec_ipfix_get_obs_domain_id(const struct ovsrec_ipfix *row,
4364
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
4365
 
{
4366
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4367
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_obs_domain_id);
4368
 
}
4369
 
 
4370
 
/* Returns the obs_point_id column's value in 'row' as a struct ovsdb_datum.
4371
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
4372
 
 * easier and more efficient way to search for a given key than implementing
4373
 
 * the same operation on the "cooked" form in 'row'.
4374
 
 *
4375
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
4376
 
 * (This helps to avoid silent bugs if someone changes obs_point_id's
4377
 
 * type without updating the caller.)
4378
 
 *
4379
 
 * The caller must not modify or free the returned value.
4380
 
 *
4381
 
 * Various kinds of changes can invalidate the returned value: modifying
4382
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4383
 
 * If the returned value is needed for a long time, it is best to make a copy
4384
 
 * of it with ovsdb_datum_clone(). */
4385
 
const struct ovsdb_datum *
4386
 
ovsrec_ipfix_get_obs_point_id(const struct ovsrec_ipfix *row,
4387
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
4388
 
{
4389
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4390
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_obs_point_id);
4391
 
}
4392
 
 
4393
 
/* Returns the sampling column's value in 'row' as a struct ovsdb_datum.
4394
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
4395
 
 * easier and more efficient way to search for a given key than implementing
4396
 
 * the same operation on the "cooked" form in 'row'.
4397
 
 *
4398
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
4399
 
 * (This helps to avoid silent bugs if someone changes sampling's
4400
 
 * type without updating the caller.)
4401
 
 *
4402
 
 * The caller must not modify or free the returned value.
4403
 
 *
4404
 
 * Various kinds of changes can invalidate the returned value: modifying
4405
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4406
 
 * If the returned value is needed for a long time, it is best to make a copy
4407
 
 * of it with ovsdb_datum_clone(). */
4408
 
const struct ovsdb_datum *
4409
 
ovsrec_ipfix_get_sampling(const struct ovsrec_ipfix *row,
4410
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
4411
 
{
4412
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
4413
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_sampling);
4414
 
}
4415
 
 
4416
 
/* Returns the targets column's value in 'row' as a struct ovsdb_datum.
4417
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
4418
 
 * easier and more efficient way to search for a given key than implementing
4419
 
 * the same operation on the "cooked" form in 'row'.
4420
 
 *
4421
 
 * 'key_type' must be OVSDB_TYPE_STRING.
4422
 
 * (This helps to avoid silent bugs if someone changes targets's
4423
 
 * type without updating the caller.)
4424
 
 *
4425
 
 * The caller must not modify or free the returned value.
4426
 
 *
4427
 
 * Various kinds of changes can invalidate the returned value: modifying
4428
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
4429
 
 * If the returned value is needed for a long time, it is best to make a copy
4430
 
 * of it with ovsdb_datum_clone(). */
4431
 
const struct ovsdb_datum *
4432
 
ovsrec_ipfix_get_targets(const struct ovsrec_ipfix *row,
4433
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
4434
 
{
4435
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
4436
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ipfix_col_targets);
4437
 
}
4438
 
 
4439
 
void
4440
 
ovsrec_ipfix_set_cache_active_timeout(const struct ovsrec_ipfix *row, const int64_t *cache_active_timeout, size_t n_cache_active_timeout)
4441
 
{
4442
 
    struct ovsdb_datum datum;
4443
 
    union ovsdb_atom key;
4444
 
 
4445
 
    ovs_assert(inited);
4446
 
    if (n_cache_active_timeout) {
4447
 
        datum.n = 1;
4448
 
        datum.keys = &key;
4449
 
        key.integer = *cache_active_timeout;
4450
 
    } else {
4451
 
        datum.n = 0;
4452
 
        datum.keys = NULL;
4453
 
    }
4454
 
    datum.values = NULL;
4455
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_CACHE_ACTIVE_TIMEOUT], &datum);
4456
 
}
4457
 
 
4458
 
void
4459
 
ovsrec_ipfix_set_cache_max_flows(const struct ovsrec_ipfix *row, const int64_t *cache_max_flows, size_t n_cache_max_flows)
4460
 
{
4461
 
    struct ovsdb_datum datum;
4462
 
    union ovsdb_atom key;
4463
 
 
4464
 
    ovs_assert(inited);
4465
 
    if (n_cache_max_flows) {
4466
 
        datum.n = 1;
4467
 
        datum.keys = &key;
4468
 
        key.integer = *cache_max_flows;
4469
 
    } else {
4470
 
        datum.n = 0;
4471
 
        datum.keys = NULL;
4472
 
    }
4473
 
    datum.values = NULL;
4474
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_CACHE_MAX_FLOWS], &datum);
4475
 
}
4476
 
 
4477
 
void
4478
 
ovsrec_ipfix_set_external_ids(const struct ovsrec_ipfix *row, const struct smap *smap)
4479
 
{
4480
 
    struct ovsdb_datum datum;
4481
 
 
4482
 
    ovs_assert(inited);
4483
 
    if (smap) {
4484
 
        struct smap_node *node;
4485
 
        size_t i;
4486
 
 
4487
 
        datum.n = smap_count(smap);
4488
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
4489
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
4490
 
 
4491
 
        i = 0;
4492
 
        SMAP_FOR_EACH (node, smap) {
4493
 
            datum.keys[i].string = xstrdup(node->key);
4494
 
            datum.values[i].string = xstrdup(node->value);
4495
 
            i++;
4496
 
        }
4497
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
4498
 
    } else {
4499
 
        ovsdb_datum_init_empty(&datum);
4500
 
    }
4501
 
    ovsdb_idl_txn_write(&row->header_,
4502
 
                        &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_EXTERNAL_IDS],
4503
 
                        &datum);
4504
 
}
4505
 
 
4506
 
 
4507
 
void
4508
 
ovsrec_ipfix_set_obs_domain_id(const struct ovsrec_ipfix *row, const int64_t *obs_domain_id, size_t n_obs_domain_id)
4509
 
{
4510
 
    struct ovsdb_datum datum;
4511
 
    union ovsdb_atom key;
4512
 
 
4513
 
    ovs_assert(inited);
4514
 
    if (n_obs_domain_id) {
4515
 
        datum.n = 1;
4516
 
        datum.keys = &key;
4517
 
        key.integer = *obs_domain_id;
4518
 
    } else {
4519
 
        datum.n = 0;
4520
 
        datum.keys = NULL;
4521
 
    }
4522
 
    datum.values = NULL;
4523
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_OBS_DOMAIN_ID], &datum);
4524
 
}
4525
 
 
4526
 
void
4527
 
ovsrec_ipfix_set_obs_point_id(const struct ovsrec_ipfix *row, const int64_t *obs_point_id, size_t n_obs_point_id)
4528
 
{
4529
 
    struct ovsdb_datum datum;
4530
 
    union ovsdb_atom key;
4531
 
 
4532
 
    ovs_assert(inited);
4533
 
    if (n_obs_point_id) {
4534
 
        datum.n = 1;
4535
 
        datum.keys = &key;
4536
 
        key.integer = *obs_point_id;
4537
 
    } else {
4538
 
        datum.n = 0;
4539
 
        datum.keys = NULL;
4540
 
    }
4541
 
    datum.values = NULL;
4542
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_OBS_POINT_ID], &datum);
4543
 
}
4544
 
 
4545
 
void
4546
 
ovsrec_ipfix_set_sampling(const struct ovsrec_ipfix *row, const int64_t *sampling, size_t n_sampling)
4547
 
{
4548
 
    struct ovsdb_datum datum;
4549
 
    union ovsdb_atom key;
4550
 
 
4551
 
    ovs_assert(inited);
4552
 
    if (n_sampling) {
4553
 
        datum.n = 1;
4554
 
        datum.keys = &key;
4555
 
        key.integer = *sampling;
4556
 
    } else {
4557
 
        datum.n = 0;
4558
 
        datum.keys = NULL;
4559
 
    }
4560
 
    datum.values = NULL;
4561
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_SAMPLING], &datum);
4562
 
}
4563
 
 
4564
 
void
4565
 
ovsrec_ipfix_set_targets(const struct ovsrec_ipfix *row, char **targets, size_t n_targets)
4566
 
{
4567
 
    struct ovsdb_datum datum;
4568
 
    size_t i;
4569
 
 
4570
 
    ovs_assert(inited);
4571
 
    datum.n = n_targets;
4572
 
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
4573
 
    datum.values = NULL;
4574
 
    for (i = 0; i < n_targets; i++) {
4575
 
        datum.keys[i].string = xstrdup(targets[i]);
4576
 
    }
4577
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
4578
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_ipfix_columns[OVSREC_IPFIX_COL_TARGETS], &datum);
4579
 
}
4580
 
 
4581
 
struct ovsdb_idl_column ovsrec_ipfix_columns[OVSREC_IPFIX_N_COLUMNS];
4582
 
 
4583
 
static void
4584
 
ovsrec_ipfix_columns_init(void)
4585
 
{
4586
 
    struct ovsdb_idl_column *c;
4587
 
 
4588
 
    /* Initialize ovsrec_ipfix_col_cache_active_timeout. */
4589
 
    c = &ovsrec_ipfix_col_cache_active_timeout;
4590
 
    c->name = "cache_active_timeout";
4591
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
4592
 
    c->type.key.u.integer.min = INT64_C(0);
4593
 
    c->type.key.u.integer.max = INT64_C(4200);
4594
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4595
 
    c->type.n_min = 0;
4596
 
    c->type.n_max = 1;
4597
 
    c->mutable = true;
4598
 
    c->parse = ovsrec_ipfix_parse_cache_active_timeout;
4599
 
    c->unparse = ovsrec_ipfix_unparse_cache_active_timeout;
4600
 
 
4601
 
    /* Initialize ovsrec_ipfix_col_cache_max_flows. */
4602
 
    c = &ovsrec_ipfix_col_cache_max_flows;
4603
 
    c->name = "cache_max_flows";
4604
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
4605
 
    c->type.key.u.integer.min = INT64_C(0);
4606
 
    c->type.key.u.integer.max = INT64_C(4294967295);
4607
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4608
 
    c->type.n_min = 0;
4609
 
    c->type.n_max = 1;
4610
 
    c->mutable = true;
4611
 
    c->parse = ovsrec_ipfix_parse_cache_max_flows;
4612
 
    c->unparse = ovsrec_ipfix_unparse_cache_max_flows;
4613
 
 
4614
 
    /* Initialize ovsrec_ipfix_col_external_ids. */
4615
 
    c = &ovsrec_ipfix_col_external_ids;
4616
 
    c->name = "external_ids";
4617
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
4618
 
    c->type.key.u.string.minLen = 0;
4619
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
4620
 
    c->type.value.u.string.minLen = 0;
4621
 
    c->type.n_min = 0;
4622
 
    c->type.n_max = UINT_MAX;
4623
 
    c->mutable = true;
4624
 
    c->parse = ovsrec_ipfix_parse_external_ids;
4625
 
    c->unparse = ovsrec_ipfix_unparse_external_ids;
4626
 
 
4627
 
    /* Initialize ovsrec_ipfix_col_obs_domain_id. */
4628
 
    c = &ovsrec_ipfix_col_obs_domain_id;
4629
 
    c->name = "obs_domain_id";
4630
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
4631
 
    c->type.key.u.integer.min = INT64_C(0);
4632
 
    c->type.key.u.integer.max = INT64_C(4294967295);
4633
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4634
 
    c->type.n_min = 0;
4635
 
    c->type.n_max = 1;
4636
 
    c->mutable = true;
4637
 
    c->parse = ovsrec_ipfix_parse_obs_domain_id;
4638
 
    c->unparse = ovsrec_ipfix_unparse_obs_domain_id;
4639
 
 
4640
 
    /* Initialize ovsrec_ipfix_col_obs_point_id. */
4641
 
    c = &ovsrec_ipfix_col_obs_point_id;
4642
 
    c->name = "obs_point_id";
4643
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
4644
 
    c->type.key.u.integer.min = INT64_C(0);
4645
 
    c->type.key.u.integer.max = INT64_C(4294967295);
4646
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4647
 
    c->type.n_min = 0;
4648
 
    c->type.n_max = 1;
4649
 
    c->mutable = true;
4650
 
    c->parse = ovsrec_ipfix_parse_obs_point_id;
4651
 
    c->unparse = ovsrec_ipfix_unparse_obs_point_id;
4652
 
 
4653
 
    /* Initialize ovsrec_ipfix_col_sampling. */
4654
 
    c = &ovsrec_ipfix_col_sampling;
4655
 
    c->name = "sampling";
4656
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
4657
 
    c->type.key.u.integer.min = INT64_C(1);
4658
 
    c->type.key.u.integer.max = INT64_C(4294967295);
4659
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4660
 
    c->type.n_min = 0;
4661
 
    c->type.n_max = 1;
4662
 
    c->mutable = true;
4663
 
    c->parse = ovsrec_ipfix_parse_sampling;
4664
 
    c->unparse = ovsrec_ipfix_unparse_sampling;
4665
 
 
4666
 
    /* Initialize ovsrec_ipfix_col_targets. */
4667
 
    c = &ovsrec_ipfix_col_targets;
4668
 
    c->name = "targets";
4669
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
4670
 
    c->type.key.u.string.minLen = 0;
4671
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
4672
 
    c->type.n_min = 0;
4673
 
    c->type.n_max = UINT_MAX;
4674
 
    c->mutable = true;
4675
 
    c->parse = ovsrec_ipfix_parse_targets;
4676
 
    c->unparse = ovsrec_ipfix_unparse_targets;
4677
 
}
4678
 
 
4679
 
/* Interface table. */
4680
 
 
4681
 
static void
4682
 
ovsrec_interface_parse_admin_state(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4683
 
{
4684
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4685
 
 
4686
 
    ovs_assert(inited);
4687
 
    if (datum->n >= 1) {
4688
 
        row->admin_state = datum->keys[0].string;
4689
 
    } else {
4690
 
        row->admin_state = NULL;
4691
 
    }
4692
 
}
4693
 
 
4694
 
static void
4695
 
ovsrec_interface_parse_bfd(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4696
 
{
4697
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4698
 
    size_t i;
4699
 
 
4700
 
    ovs_assert(inited);
4701
 
    smap_init(&row->bfd);
4702
 
    for (i = 0; i < datum->n; i++) {
4703
 
        smap_add(&row->bfd,
4704
 
                 datum->keys[i].string,
4705
 
                 datum->values[i].string);
4706
 
    }
4707
 
}
4708
 
 
4709
 
static void
4710
 
ovsrec_interface_parse_bfd_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4711
 
{
4712
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4713
 
    size_t i;
4714
 
 
4715
 
    ovs_assert(inited);
4716
 
    smap_init(&row->bfd_status);
4717
 
    for (i = 0; i < datum->n; i++) {
4718
 
        smap_add(&row->bfd_status,
4719
 
                 datum->keys[i].string,
4720
 
                 datum->values[i].string);
4721
 
    }
4722
 
}
4723
 
 
4724
 
static void
4725
 
ovsrec_interface_parse_cfm_fault(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4726
 
{
4727
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4728
 
    size_t n = MIN(1, datum->n);
4729
 
    size_t i;
4730
 
 
4731
 
    ovs_assert(inited);
4732
 
    row->cfm_fault = NULL;
4733
 
    row->n_cfm_fault = 0;
4734
 
    for (i = 0; i < n; i++) {
4735
 
        if (!row->n_cfm_fault) {
4736
 
            row->cfm_fault = xmalloc(n * sizeof_bool);
4737
 
        }
4738
 
        row->cfm_fault[row->n_cfm_fault] = datum->keys[i].boolean;
4739
 
        row->n_cfm_fault++;
4740
 
    }
4741
 
}
4742
 
 
4743
 
static void
4744
 
ovsrec_interface_parse_cfm_fault_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4745
 
{
4746
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4747
 
    size_t i;
4748
 
 
4749
 
    ovs_assert(inited);
4750
 
    row->cfm_fault_status = NULL;
4751
 
    row->n_cfm_fault_status = 0;
4752
 
    for (i = 0; i < datum->n; i++) {
4753
 
        if (!row->n_cfm_fault_status) {
4754
 
            row->cfm_fault_status = xmalloc(datum->n * sizeof *row->cfm_fault_status);
4755
 
        }
4756
 
        row->cfm_fault_status[row->n_cfm_fault_status] = datum->keys[i].string;
4757
 
        row->n_cfm_fault_status++;
4758
 
    }
4759
 
}
4760
 
 
4761
 
static void
4762
 
ovsrec_interface_parse_cfm_flap_count(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4763
 
{
4764
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4765
 
    size_t n = MIN(1, datum->n);
4766
 
    size_t i;
4767
 
 
4768
 
    ovs_assert(inited);
4769
 
    row->cfm_flap_count = NULL;
4770
 
    row->n_cfm_flap_count = 0;
4771
 
    for (i = 0; i < n; i++) {
4772
 
        if (!row->n_cfm_flap_count) {
4773
 
            row->cfm_flap_count = xmalloc(n * sizeof *row->cfm_flap_count);
4774
 
        }
4775
 
        row->cfm_flap_count[row->n_cfm_flap_count] = datum->keys[i].integer;
4776
 
        row->n_cfm_flap_count++;
4777
 
    }
4778
 
}
4779
 
 
4780
 
static void
4781
 
ovsrec_interface_parse_cfm_health(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4782
 
{
4783
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4784
 
    size_t n = MIN(1, datum->n);
4785
 
    size_t i;
4786
 
 
4787
 
    ovs_assert(inited);
4788
 
    row->cfm_health = NULL;
4789
 
    row->n_cfm_health = 0;
4790
 
    for (i = 0; i < n; i++) {
4791
 
        if (!row->n_cfm_health) {
4792
 
            row->cfm_health = xmalloc(n * sizeof *row->cfm_health);
4793
 
        }
4794
 
        row->cfm_health[row->n_cfm_health] = datum->keys[i].integer;
4795
 
        row->n_cfm_health++;
4796
 
    }
4797
 
}
4798
 
 
4799
 
static void
4800
 
ovsrec_interface_parse_cfm_mpid(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4801
 
{
4802
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4803
 
    size_t n = MIN(1, datum->n);
4804
 
    size_t i;
4805
 
 
4806
 
    ovs_assert(inited);
4807
 
    row->cfm_mpid = NULL;
4808
 
    row->n_cfm_mpid = 0;
4809
 
    for (i = 0; i < n; i++) {
4810
 
        if (!row->n_cfm_mpid) {
4811
 
            row->cfm_mpid = xmalloc(n * sizeof *row->cfm_mpid);
4812
 
        }
4813
 
        row->cfm_mpid[row->n_cfm_mpid] = datum->keys[i].integer;
4814
 
        row->n_cfm_mpid++;
4815
 
    }
4816
 
}
4817
 
 
4818
 
static void
4819
 
ovsrec_interface_parse_cfm_remote_mpids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4820
 
{
4821
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4822
 
    size_t i;
4823
 
 
4824
 
    ovs_assert(inited);
4825
 
    row->cfm_remote_mpids = NULL;
4826
 
    row->n_cfm_remote_mpids = 0;
4827
 
    for (i = 0; i < datum->n; i++) {
4828
 
        if (!row->n_cfm_remote_mpids) {
4829
 
            row->cfm_remote_mpids = xmalloc(datum->n * sizeof *row->cfm_remote_mpids);
4830
 
        }
4831
 
        row->cfm_remote_mpids[row->n_cfm_remote_mpids] = datum->keys[i].integer;
4832
 
        row->n_cfm_remote_mpids++;
4833
 
    }
4834
 
}
4835
 
 
4836
 
static void
4837
 
ovsrec_interface_parse_cfm_remote_opstate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4838
 
{
4839
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4840
 
 
4841
 
    ovs_assert(inited);
4842
 
    if (datum->n >= 1) {
4843
 
        row->cfm_remote_opstate = datum->keys[0].string;
4844
 
    } else {
4845
 
        row->cfm_remote_opstate = NULL;
4846
 
    }
4847
 
}
4848
 
 
4849
 
static void
4850
 
ovsrec_interface_parse_duplex(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4851
 
{
4852
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4853
 
 
4854
 
    ovs_assert(inited);
4855
 
    if (datum->n >= 1) {
4856
 
        row->duplex = datum->keys[0].string;
4857
 
    } else {
4858
 
        row->duplex = NULL;
4859
 
    }
4860
 
}
4861
 
 
4862
 
static void
4863
 
ovsrec_interface_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4864
 
{
4865
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4866
 
    size_t i;
4867
 
 
4868
 
    ovs_assert(inited);
4869
 
    smap_init(&row->external_ids);
4870
 
    for (i = 0; i < datum->n; i++) {
4871
 
        smap_add(&row->external_ids,
4872
 
                 datum->keys[i].string,
4873
 
                 datum->values[i].string);
4874
 
    }
4875
 
}
4876
 
 
4877
 
static void
4878
 
ovsrec_interface_parse_ifindex(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4879
 
{
4880
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4881
 
    size_t n = MIN(1, datum->n);
4882
 
    size_t i;
4883
 
 
4884
 
    ovs_assert(inited);
4885
 
    row->ifindex = NULL;
4886
 
    row->n_ifindex = 0;
4887
 
    for (i = 0; i < n; i++) {
4888
 
        if (!row->n_ifindex) {
4889
 
            row->ifindex = xmalloc(n * sizeof *row->ifindex);
4890
 
        }
4891
 
        row->ifindex[row->n_ifindex] = datum->keys[i].integer;
4892
 
        row->n_ifindex++;
4893
 
    }
4894
 
}
4895
 
 
4896
 
static void
4897
 
ovsrec_interface_parse_ingress_policing_burst(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4898
 
{
4899
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4900
 
 
4901
 
    ovs_assert(inited);
4902
 
    if (datum->n >= 1) {
4903
 
        row->ingress_policing_burst = datum->keys[0].integer;
4904
 
    } else {
4905
 
        row->ingress_policing_burst = 0;
4906
 
    }
4907
 
}
4908
 
 
4909
 
static void
4910
 
ovsrec_interface_parse_ingress_policing_rate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4911
 
{
4912
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4913
 
 
4914
 
    ovs_assert(inited);
4915
 
    if (datum->n >= 1) {
4916
 
        row->ingress_policing_rate = datum->keys[0].integer;
4917
 
    } else {
4918
 
        row->ingress_policing_rate = 0;
4919
 
    }
4920
 
}
4921
 
 
4922
 
static void
4923
 
ovsrec_interface_parse_lacp_current(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4924
 
{
4925
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4926
 
    size_t n = MIN(1, datum->n);
4927
 
    size_t i;
4928
 
 
4929
 
    ovs_assert(inited);
4930
 
    row->lacp_current = NULL;
4931
 
    row->n_lacp_current = 0;
4932
 
    for (i = 0; i < n; i++) {
4933
 
        if (!row->n_lacp_current) {
4934
 
            row->lacp_current = xmalloc(n * sizeof_bool);
4935
 
        }
4936
 
        row->lacp_current[row->n_lacp_current] = datum->keys[i].boolean;
4937
 
        row->n_lacp_current++;
4938
 
    }
4939
 
}
4940
 
 
4941
 
static void
4942
 
ovsrec_interface_parse_link_resets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4943
 
{
4944
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4945
 
    size_t n = MIN(1, datum->n);
4946
 
    size_t i;
4947
 
 
4948
 
    ovs_assert(inited);
4949
 
    row->link_resets = NULL;
4950
 
    row->n_link_resets = 0;
4951
 
    for (i = 0; i < n; i++) {
4952
 
        if (!row->n_link_resets) {
4953
 
            row->link_resets = xmalloc(n * sizeof *row->link_resets);
4954
 
        }
4955
 
        row->link_resets[row->n_link_resets] = datum->keys[i].integer;
4956
 
        row->n_link_resets++;
4957
 
    }
4958
 
}
4959
 
 
4960
 
static void
4961
 
ovsrec_interface_parse_link_speed(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4962
 
{
4963
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4964
 
    size_t n = MIN(1, datum->n);
4965
 
    size_t i;
4966
 
 
4967
 
    ovs_assert(inited);
4968
 
    row->link_speed = NULL;
4969
 
    row->n_link_speed = 0;
4970
 
    for (i = 0; i < n; i++) {
4971
 
        if (!row->n_link_speed) {
4972
 
            row->link_speed = xmalloc(n * sizeof *row->link_speed);
4973
 
        }
4974
 
        row->link_speed[row->n_link_speed] = datum->keys[i].integer;
4975
 
        row->n_link_speed++;
4976
 
    }
4977
 
}
4978
 
 
4979
 
static void
4980
 
ovsrec_interface_parse_link_state(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4981
 
{
4982
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4983
 
 
4984
 
    ovs_assert(inited);
4985
 
    if (datum->n >= 1) {
4986
 
        row->link_state = datum->keys[0].string;
4987
 
    } else {
4988
 
        row->link_state = NULL;
4989
 
    }
4990
 
}
4991
 
 
4992
 
static void
4993
 
ovsrec_interface_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
4994
 
{
4995
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
4996
 
 
4997
 
    ovs_assert(inited);
4998
 
    if (datum->n >= 1) {
4999
 
        row->mac = datum->keys[0].string;
5000
 
    } else {
5001
 
        row->mac = NULL;
5002
 
    }
5003
 
}
5004
 
 
5005
 
static void
5006
 
ovsrec_interface_parse_mac_in_use(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5007
 
{
5008
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5009
 
 
5010
 
    ovs_assert(inited);
5011
 
    if (datum->n >= 1) {
5012
 
        row->mac_in_use = datum->keys[0].string;
5013
 
    } else {
5014
 
        row->mac_in_use = NULL;
5015
 
    }
5016
 
}
5017
 
 
5018
 
static void
5019
 
ovsrec_interface_parse_mtu(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5020
 
{
5021
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5022
 
    size_t n = MIN(1, datum->n);
5023
 
    size_t i;
5024
 
 
5025
 
    ovs_assert(inited);
5026
 
    row->mtu = NULL;
5027
 
    row->n_mtu = 0;
5028
 
    for (i = 0; i < n; i++) {
5029
 
        if (!row->n_mtu) {
5030
 
            row->mtu = xmalloc(n * sizeof *row->mtu);
5031
 
        }
5032
 
        row->mtu[row->n_mtu] = datum->keys[i].integer;
5033
 
        row->n_mtu++;
5034
 
    }
5035
 
}
5036
 
 
5037
 
static void
5038
 
ovsrec_interface_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5039
 
{
5040
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5041
 
 
5042
 
    ovs_assert(inited);
5043
 
    if (datum->n >= 1) {
5044
 
        row->name = datum->keys[0].string;
5045
 
    } else {
5046
 
        row->name = "";
5047
 
    }
5048
 
}
5049
 
 
5050
 
static void
5051
 
ovsrec_interface_parse_ofport(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5052
 
{
5053
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5054
 
    size_t n = MIN(1, datum->n);
5055
 
    size_t i;
5056
 
 
5057
 
    ovs_assert(inited);
5058
 
    row->ofport = NULL;
5059
 
    row->n_ofport = 0;
5060
 
    for (i = 0; i < n; i++) {
5061
 
        if (!row->n_ofport) {
5062
 
            row->ofport = xmalloc(n * sizeof *row->ofport);
5063
 
        }
5064
 
        row->ofport[row->n_ofport] = datum->keys[i].integer;
5065
 
        row->n_ofport++;
5066
 
    }
5067
 
}
5068
 
 
5069
 
static void
5070
 
ovsrec_interface_parse_ofport_request(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5071
 
{
5072
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5073
 
    size_t n = MIN(1, datum->n);
5074
 
    size_t i;
5075
 
 
5076
 
    ovs_assert(inited);
5077
 
    row->ofport_request = NULL;
5078
 
    row->n_ofport_request = 0;
5079
 
    for (i = 0; i < n; i++) {
5080
 
        if (!row->n_ofport_request) {
5081
 
            row->ofport_request = xmalloc(n * sizeof *row->ofport_request);
5082
 
        }
5083
 
        row->ofport_request[row->n_ofport_request] = datum->keys[i].integer;
5084
 
        row->n_ofport_request++;
5085
 
    }
5086
 
}
5087
 
 
5088
 
static void
5089
 
ovsrec_interface_parse_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5090
 
{
5091
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5092
 
    size_t i;
5093
 
 
5094
 
    ovs_assert(inited);
5095
 
    smap_init(&row->options);
5096
 
    for (i = 0; i < datum->n; i++) {
5097
 
        smap_add(&row->options,
5098
 
                 datum->keys[i].string,
5099
 
                 datum->values[i].string);
5100
 
    }
5101
 
}
5102
 
 
5103
 
static void
5104
 
ovsrec_interface_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5105
 
{
5106
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5107
 
    size_t i;
5108
 
 
5109
 
    ovs_assert(inited);
5110
 
    smap_init(&row->other_config);
5111
 
    for (i = 0; i < datum->n; i++) {
5112
 
        smap_add(&row->other_config,
5113
 
                 datum->keys[i].string,
5114
 
                 datum->values[i].string);
5115
 
    }
5116
 
}
5117
 
 
5118
 
static void
5119
 
ovsrec_interface_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5120
 
{
5121
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5122
 
    size_t i;
5123
 
 
5124
 
    ovs_assert(inited);
5125
 
    row->key_statistics = NULL;
5126
 
    row->value_statistics = NULL;
5127
 
    row->n_statistics = 0;
5128
 
    for (i = 0; i < datum->n; i++) {
5129
 
        if (!row->n_statistics) {
5130
 
            row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
5131
 
            row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
5132
 
        }
5133
 
        row->key_statistics[row->n_statistics] = datum->keys[i].string;
5134
 
        row->value_statistics[row->n_statistics] = datum->values[i].integer;
5135
 
        row->n_statistics++;
5136
 
    }
5137
 
}
5138
 
 
5139
 
static void
5140
 
ovsrec_interface_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5141
 
{
5142
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5143
 
    size_t i;
5144
 
 
5145
 
    ovs_assert(inited);
5146
 
    smap_init(&row->status);
5147
 
    for (i = 0; i < datum->n; i++) {
5148
 
        smap_add(&row->status,
5149
 
                 datum->keys[i].string,
5150
 
                 datum->values[i].string);
5151
 
    }
5152
 
}
5153
 
 
5154
 
static void
5155
 
ovsrec_interface_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
5156
 
{
5157
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5158
 
 
5159
 
    ovs_assert(inited);
5160
 
    if (datum->n >= 1) {
5161
 
        row->type = datum->keys[0].string;
5162
 
    } else {
5163
 
        row->type = "";
5164
 
    }
5165
 
}
5166
 
 
5167
 
static void
5168
 
ovsrec_interface_unparse_admin_state(struct ovsdb_idl_row *row OVS_UNUSED)
5169
 
{
5170
 
    /* Nothing to do. */
5171
 
}
5172
 
 
5173
 
static void
5174
 
ovsrec_interface_unparse_bfd(struct ovsdb_idl_row *row_)
5175
 
{
5176
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5177
 
 
5178
 
    ovs_assert(inited);
5179
 
    smap_destroy(&row->bfd);
5180
 
}
5181
 
 
5182
 
static void
5183
 
ovsrec_interface_unparse_bfd_status(struct ovsdb_idl_row *row_)
5184
 
{
5185
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5186
 
 
5187
 
    ovs_assert(inited);
5188
 
    smap_destroy(&row->bfd_status);
5189
 
}
5190
 
 
5191
 
static void
5192
 
ovsrec_interface_unparse_cfm_fault(struct ovsdb_idl_row *row_)
5193
 
{
5194
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5195
 
 
5196
 
    ovs_assert(inited);
5197
 
    free(row->cfm_fault);
5198
 
}
5199
 
 
5200
 
static void
5201
 
ovsrec_interface_unparse_cfm_fault_status(struct ovsdb_idl_row *row_)
5202
 
{
5203
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5204
 
 
5205
 
    ovs_assert(inited);
5206
 
    free(row->cfm_fault_status);
5207
 
}
5208
 
 
5209
 
static void
5210
 
ovsrec_interface_unparse_cfm_flap_count(struct ovsdb_idl_row *row_)
5211
 
{
5212
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5213
 
 
5214
 
    ovs_assert(inited);
5215
 
    free(row->cfm_flap_count);
5216
 
}
5217
 
 
5218
 
static void
5219
 
ovsrec_interface_unparse_cfm_health(struct ovsdb_idl_row *row_)
5220
 
{
5221
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5222
 
 
5223
 
    ovs_assert(inited);
5224
 
    free(row->cfm_health);
5225
 
}
5226
 
 
5227
 
static void
5228
 
ovsrec_interface_unparse_cfm_mpid(struct ovsdb_idl_row *row_)
5229
 
{
5230
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5231
 
 
5232
 
    ovs_assert(inited);
5233
 
    free(row->cfm_mpid);
5234
 
}
5235
 
 
5236
 
static void
5237
 
ovsrec_interface_unparse_cfm_remote_mpids(struct ovsdb_idl_row *row_)
5238
 
{
5239
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5240
 
 
5241
 
    ovs_assert(inited);
5242
 
    free(row->cfm_remote_mpids);
5243
 
}
5244
 
 
5245
 
static void
5246
 
ovsrec_interface_unparse_cfm_remote_opstate(struct ovsdb_idl_row *row OVS_UNUSED)
5247
 
{
5248
 
    /* Nothing to do. */
5249
 
}
5250
 
 
5251
 
static void
5252
 
ovsrec_interface_unparse_duplex(struct ovsdb_idl_row *row OVS_UNUSED)
5253
 
{
5254
 
    /* Nothing to do. */
5255
 
}
5256
 
 
5257
 
static void
5258
 
ovsrec_interface_unparse_external_ids(struct ovsdb_idl_row *row_)
5259
 
{
5260
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5261
 
 
5262
 
    ovs_assert(inited);
5263
 
    smap_destroy(&row->external_ids);
5264
 
}
5265
 
 
5266
 
static void
5267
 
ovsrec_interface_unparse_ifindex(struct ovsdb_idl_row *row_)
5268
 
{
5269
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5270
 
 
5271
 
    ovs_assert(inited);
5272
 
    free(row->ifindex);
5273
 
}
5274
 
 
5275
 
static void
5276
 
ovsrec_interface_unparse_ingress_policing_burst(struct ovsdb_idl_row *row OVS_UNUSED)
5277
 
{
5278
 
    /* Nothing to do. */
5279
 
}
5280
 
 
5281
 
static void
5282
 
ovsrec_interface_unparse_ingress_policing_rate(struct ovsdb_idl_row *row OVS_UNUSED)
5283
 
{
5284
 
    /* Nothing to do. */
5285
 
}
5286
 
 
5287
 
static void
5288
 
ovsrec_interface_unparse_lacp_current(struct ovsdb_idl_row *row_)
5289
 
{
5290
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5291
 
 
5292
 
    ovs_assert(inited);
5293
 
    free(row->lacp_current);
5294
 
}
5295
 
 
5296
 
static void
5297
 
ovsrec_interface_unparse_link_resets(struct ovsdb_idl_row *row_)
5298
 
{
5299
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5300
 
 
5301
 
    ovs_assert(inited);
5302
 
    free(row->link_resets);
5303
 
}
5304
 
 
5305
 
static void
5306
 
ovsrec_interface_unparse_link_speed(struct ovsdb_idl_row *row_)
5307
 
{
5308
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5309
 
 
5310
 
    ovs_assert(inited);
5311
 
    free(row->link_speed);
5312
 
}
5313
 
 
5314
 
static void
5315
 
ovsrec_interface_unparse_link_state(struct ovsdb_idl_row *row OVS_UNUSED)
5316
 
{
5317
 
    /* Nothing to do. */
5318
 
}
5319
 
 
5320
 
static void
5321
 
ovsrec_interface_unparse_mac(struct ovsdb_idl_row *row OVS_UNUSED)
5322
 
{
5323
 
    /* Nothing to do. */
5324
 
}
5325
 
 
5326
 
static void
5327
 
ovsrec_interface_unparse_mac_in_use(struct ovsdb_idl_row *row OVS_UNUSED)
5328
 
{
5329
 
    /* Nothing to do. */
5330
 
}
5331
 
 
5332
 
static void
5333
 
ovsrec_interface_unparse_mtu(struct ovsdb_idl_row *row_)
5334
 
{
5335
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5336
 
 
5337
 
    ovs_assert(inited);
5338
 
    free(row->mtu);
5339
 
}
5340
 
 
5341
 
static void
5342
 
ovsrec_interface_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
5343
 
{
5344
 
    /* Nothing to do. */
5345
 
}
5346
 
 
5347
 
static void
5348
 
ovsrec_interface_unparse_ofport(struct ovsdb_idl_row *row_)
5349
 
{
5350
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5351
 
 
5352
 
    ovs_assert(inited);
5353
 
    free(row->ofport);
5354
 
}
5355
 
 
5356
 
static void
5357
 
ovsrec_interface_unparse_ofport_request(struct ovsdb_idl_row *row_)
5358
 
{
5359
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5360
 
 
5361
 
    ovs_assert(inited);
5362
 
    free(row->ofport_request);
5363
 
}
5364
 
 
5365
 
static void
5366
 
ovsrec_interface_unparse_options(struct ovsdb_idl_row *row_)
5367
 
{
5368
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5369
 
 
5370
 
    ovs_assert(inited);
5371
 
    smap_destroy(&row->options);
5372
 
}
5373
 
 
5374
 
static void
5375
 
ovsrec_interface_unparse_other_config(struct ovsdb_idl_row *row_)
5376
 
{
5377
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5378
 
 
5379
 
    ovs_assert(inited);
5380
 
    smap_destroy(&row->other_config);
5381
 
}
5382
 
 
5383
 
static void
5384
 
ovsrec_interface_unparse_statistics(struct ovsdb_idl_row *row_)
5385
 
{
5386
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5387
 
 
5388
 
    ovs_assert(inited);
5389
 
    free(row->key_statistics);
5390
 
    free(row->value_statistics);
5391
 
}
5392
 
 
5393
 
static void
5394
 
ovsrec_interface_unparse_status(struct ovsdb_idl_row *row_)
5395
 
{
5396
 
    struct ovsrec_interface *row = ovsrec_interface_cast(row_);
5397
 
 
5398
 
    ovs_assert(inited);
5399
 
    smap_destroy(&row->status);
5400
 
}
5401
 
 
5402
 
static void
5403
 
ovsrec_interface_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
5404
 
{
5405
 
    /* Nothing to do. */
5406
 
}
5407
 
 
5408
 
static void
5409
 
ovsrec_interface_init__(struct ovsdb_idl_row *row)
5410
 
{
5411
 
    ovsrec_interface_init(ovsrec_interface_cast(row));
5412
 
}
5413
 
 
5414
 
void
5415
 
ovsrec_interface_init(struct ovsrec_interface *row)
5416
 
{
5417
 
    memset(row, 0, sizeof *row); 
5418
 
    smap_init(&row->bfd);
5419
 
    smap_init(&row->bfd_status);
5420
 
    smap_init(&row->external_ids);
5421
 
    smap_init(&row->options);
5422
 
    smap_init(&row->other_config);
5423
 
    smap_init(&row->status);
5424
 
}
5425
 
 
5426
 
const struct ovsrec_interface *
5427
 
ovsrec_interface_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
5428
 
{
5429
 
    return ovsrec_interface_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE], uuid));
5430
 
}
5431
 
 
5432
 
const struct ovsrec_interface *
5433
 
ovsrec_interface_first(const struct ovsdb_idl *idl)
5434
 
{
5435
 
    return ovsrec_interface_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE]));
5436
 
}
5437
 
 
5438
 
const struct ovsrec_interface *
5439
 
ovsrec_interface_next(const struct ovsrec_interface *row)
5440
 
{
5441
 
    return ovsrec_interface_cast(ovsdb_idl_next_row(&row->header_));
5442
 
}
5443
 
 
5444
 
void
5445
 
ovsrec_interface_delete(const struct ovsrec_interface *row)
5446
 
{
5447
 
    ovsdb_idl_txn_delete(&row->header_);
5448
 
}
5449
 
 
5450
 
struct ovsrec_interface *
5451
 
ovsrec_interface_insert(struct ovsdb_idl_txn *txn)
5452
 
{
5453
 
    return ovsrec_interface_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE], NULL));
5454
 
}
5455
 
 
5456
 
 
5457
 
void
5458
 
ovsrec_interface_verify_admin_state(const struct ovsrec_interface *row)
5459
 
{
5460
 
    ovs_assert(inited);
5461
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_ADMIN_STATE]);
5462
 
}
5463
 
 
5464
 
void
5465
 
ovsrec_interface_verify_bfd(const struct ovsrec_interface *row)
5466
 
{
5467
 
    ovs_assert(inited);
5468
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD]);
5469
 
}
5470
 
 
5471
 
void
5472
 
ovsrec_interface_verify_bfd_status(const struct ovsrec_interface *row)
5473
 
{
5474
 
    ovs_assert(inited);
5475
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD_STATUS]);
5476
 
}
5477
 
 
5478
 
void
5479
 
ovsrec_interface_verify_cfm_fault(const struct ovsrec_interface *row)
5480
 
{
5481
 
    ovs_assert(inited);
5482
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FAULT]);
5483
 
}
5484
 
 
5485
 
void
5486
 
ovsrec_interface_verify_cfm_fault_status(const struct ovsrec_interface *row)
5487
 
{
5488
 
    ovs_assert(inited);
5489
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FAULT_STATUS]);
5490
 
}
5491
 
 
5492
 
void
5493
 
ovsrec_interface_verify_cfm_flap_count(const struct ovsrec_interface *row)
5494
 
{
5495
 
    ovs_assert(inited);
5496
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FLAP_COUNT]);
5497
 
}
5498
 
 
5499
 
void
5500
 
ovsrec_interface_verify_cfm_health(const struct ovsrec_interface *row)
5501
 
{
5502
 
    ovs_assert(inited);
5503
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_HEALTH]);
5504
 
}
5505
 
 
5506
 
void
5507
 
ovsrec_interface_verify_cfm_mpid(const struct ovsrec_interface *row)
5508
 
{
5509
 
    ovs_assert(inited);
5510
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_MPID]);
5511
 
}
5512
 
 
5513
 
void
5514
 
ovsrec_interface_verify_cfm_remote_mpids(const struct ovsrec_interface *row)
5515
 
{
5516
 
    ovs_assert(inited);
5517
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_REMOTE_MPIDS]);
5518
 
}
5519
 
 
5520
 
void
5521
 
ovsrec_interface_verify_cfm_remote_opstate(const struct ovsrec_interface *row)
5522
 
{
5523
 
    ovs_assert(inited);
5524
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_REMOTE_OPSTATE]);
5525
 
}
5526
 
 
5527
 
void
5528
 
ovsrec_interface_verify_duplex(const struct ovsrec_interface *row)
5529
 
{
5530
 
    ovs_assert(inited);
5531
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_DUPLEX]);
5532
 
}
5533
 
 
5534
 
void
5535
 
ovsrec_interface_verify_external_ids(const struct ovsrec_interface *row)
5536
 
{
5537
 
    ovs_assert(inited);
5538
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_EXTERNAL_IDS]);
5539
 
}
5540
 
 
5541
 
void
5542
 
ovsrec_interface_verify_ifindex(const struct ovsrec_interface *row)
5543
 
{
5544
 
    ovs_assert(inited);
5545
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_IFINDEX]);
5546
 
}
5547
 
 
5548
 
void
5549
 
ovsrec_interface_verify_ingress_policing_burst(const struct ovsrec_interface *row)
5550
 
{
5551
 
    ovs_assert(inited);
5552
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_INGRESS_POLICING_BURST]);
5553
 
}
5554
 
 
5555
 
void
5556
 
ovsrec_interface_verify_ingress_policing_rate(const struct ovsrec_interface *row)
5557
 
{
5558
 
    ovs_assert(inited);
5559
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_INGRESS_POLICING_RATE]);
5560
 
}
5561
 
 
5562
 
void
5563
 
ovsrec_interface_verify_lacp_current(const struct ovsrec_interface *row)
5564
 
{
5565
 
    ovs_assert(inited);
5566
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LACP_CURRENT]);
5567
 
}
5568
 
 
5569
 
void
5570
 
ovsrec_interface_verify_link_resets(const struct ovsrec_interface *row)
5571
 
{
5572
 
    ovs_assert(inited);
5573
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_RESETS]);
5574
 
}
5575
 
 
5576
 
void
5577
 
ovsrec_interface_verify_link_speed(const struct ovsrec_interface *row)
5578
 
{
5579
 
    ovs_assert(inited);
5580
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_SPEED]);
5581
 
}
5582
 
 
5583
 
void
5584
 
ovsrec_interface_verify_link_state(const struct ovsrec_interface *row)
5585
 
{
5586
 
    ovs_assert(inited);
5587
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_STATE]);
5588
 
}
5589
 
 
5590
 
void
5591
 
ovsrec_interface_verify_mac(const struct ovsrec_interface *row)
5592
 
{
5593
 
    ovs_assert(inited);
5594
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MAC]);
5595
 
}
5596
 
 
5597
 
void
5598
 
ovsrec_interface_verify_mac_in_use(const struct ovsrec_interface *row)
5599
 
{
5600
 
    ovs_assert(inited);
5601
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MAC_IN_USE]);
5602
 
}
5603
 
 
5604
 
void
5605
 
ovsrec_interface_verify_mtu(const struct ovsrec_interface *row)
5606
 
{
5607
 
    ovs_assert(inited);
5608
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MTU]);
5609
 
}
5610
 
 
5611
 
void
5612
 
ovsrec_interface_verify_name(const struct ovsrec_interface *row)
5613
 
{
5614
 
    ovs_assert(inited);
5615
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_NAME]);
5616
 
}
5617
 
 
5618
 
void
5619
 
ovsrec_interface_verify_ofport(const struct ovsrec_interface *row)
5620
 
{
5621
 
    ovs_assert(inited);
5622
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OFPORT]);
5623
 
}
5624
 
 
5625
 
void
5626
 
ovsrec_interface_verify_ofport_request(const struct ovsrec_interface *row)
5627
 
{
5628
 
    ovs_assert(inited);
5629
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OFPORT_REQUEST]);
5630
 
}
5631
 
 
5632
 
void
5633
 
ovsrec_interface_verify_options(const struct ovsrec_interface *row)
5634
 
{
5635
 
    ovs_assert(inited);
5636
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OPTIONS]);
5637
 
}
5638
 
 
5639
 
void
5640
 
ovsrec_interface_verify_other_config(const struct ovsrec_interface *row)
5641
 
{
5642
 
    ovs_assert(inited);
5643
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OTHER_CONFIG]);
5644
 
}
5645
 
 
5646
 
void
5647
 
ovsrec_interface_verify_statistics(const struct ovsrec_interface *row)
5648
 
{
5649
 
    ovs_assert(inited);
5650
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_STATISTICS]);
5651
 
}
5652
 
 
5653
 
void
5654
 
ovsrec_interface_verify_status(const struct ovsrec_interface *row)
5655
 
{
5656
 
    ovs_assert(inited);
5657
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_STATUS]);
5658
 
}
5659
 
 
5660
 
void
5661
 
ovsrec_interface_verify_type(const struct ovsrec_interface *row)
5662
 
{
5663
 
    ovs_assert(inited);
5664
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_TYPE]);
5665
 
}
5666
 
 
5667
 
/* Returns the admin_state column's value in 'row' as a struct ovsdb_datum.
5668
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5669
 
 * easier and more efficient way to search for a given key than implementing
5670
 
 * the same operation on the "cooked" form in 'row'.
5671
 
 *
5672
 
 * 'key_type' must be OVSDB_TYPE_STRING.
5673
 
 * (This helps to avoid silent bugs if someone changes admin_state's
5674
 
 * type without updating the caller.)
5675
 
 *
5676
 
 * The caller must not modify or free the returned value.
5677
 
 *
5678
 
 * Various kinds of changes can invalidate the returned value: modifying
5679
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5680
 
 * If the returned value is needed for a long time, it is best to make a copy
5681
 
 * of it with ovsdb_datum_clone(). */
5682
 
const struct ovsdb_datum *
5683
 
ovsrec_interface_get_admin_state(const struct ovsrec_interface *row,
5684
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5685
 
{
5686
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
5687
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_admin_state);
5688
 
}
5689
 
 
5690
 
/* Returns the bfd column's value in 'row' as a struct ovsdb_datum.
5691
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5692
 
 * easier and more efficient way to search for a given key than implementing
5693
 
 * the same operation on the "cooked" form in 'row'.
5694
 
 *
5695
 
 * 'key_type' must be OVSDB_TYPE_STRING.
5696
 
 * 'value_type' must be OVSDB_TYPE_STRING.
5697
 
 * (This helps to avoid silent bugs if someone changes bfd's
5698
 
 * type without updating the caller.)
5699
 
 *
5700
 
 * The caller must not modify or free the returned value.
5701
 
 *
5702
 
 * Various kinds of changes can invalidate the returned value: modifying
5703
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5704
 
 * If the returned value is needed for a long time, it is best to make a copy
5705
 
 * of it with ovsdb_datum_clone(). */
5706
 
const struct ovsdb_datum *
5707
 
ovsrec_interface_get_bfd(const struct ovsrec_interface *row,
5708
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
5709
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
5710
 
{
5711
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
5712
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
5713
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_bfd);
5714
 
}
5715
 
 
5716
 
/* Returns the bfd_status column's value in 'row' as a struct ovsdb_datum.
5717
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5718
 
 * easier and more efficient way to search for a given key than implementing
5719
 
 * the same operation on the "cooked" form in 'row'.
5720
 
 *
5721
 
 * 'key_type' must be OVSDB_TYPE_STRING.
5722
 
 * 'value_type' must be OVSDB_TYPE_STRING.
5723
 
 * (This helps to avoid silent bugs if someone changes bfd_status's
5724
 
 * type without updating the caller.)
5725
 
 *
5726
 
 * The caller must not modify or free the returned value.
5727
 
 *
5728
 
 * Various kinds of changes can invalidate the returned value: modifying
5729
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5730
 
 * If the returned value is needed for a long time, it is best to make a copy
5731
 
 * of it with ovsdb_datum_clone(). */
5732
 
const struct ovsdb_datum *
5733
 
ovsrec_interface_get_bfd_status(const struct ovsrec_interface *row,
5734
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
5735
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
5736
 
{
5737
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
5738
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
5739
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_bfd_status);
5740
 
}
5741
 
 
5742
 
/* Returns the cfm_fault column's value in 'row' as a struct ovsdb_datum.
5743
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5744
 
 * easier and more efficient way to search for a given key than implementing
5745
 
 * the same operation on the "cooked" form in 'row'.
5746
 
 *
5747
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
5748
 
 * (This helps to avoid silent bugs if someone changes cfm_fault's
5749
 
 * type without updating the caller.)
5750
 
 *
5751
 
 * The caller must not modify or free the returned value.
5752
 
 *
5753
 
 * Various kinds of changes can invalidate the returned value: modifying
5754
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5755
 
 * If the returned value is needed for a long time, it is best to make a copy
5756
 
 * of it with ovsdb_datum_clone(). */
5757
 
const struct ovsdb_datum *
5758
 
ovsrec_interface_get_cfm_fault(const struct ovsrec_interface *row,
5759
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5760
 
{
5761
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
5762
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_fault);
5763
 
}
5764
 
 
5765
 
/* Returns the cfm_fault_status column's value in 'row' as a struct ovsdb_datum.
5766
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5767
 
 * easier and more efficient way to search for a given key than implementing
5768
 
 * the same operation on the "cooked" form in 'row'.
5769
 
 *
5770
 
 * 'key_type' must be OVSDB_TYPE_STRING.
5771
 
 * (This helps to avoid silent bugs if someone changes cfm_fault_status's
5772
 
 * type without updating the caller.)
5773
 
 *
5774
 
 * The caller must not modify or free the returned value.
5775
 
 *
5776
 
 * Various kinds of changes can invalidate the returned value: modifying
5777
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5778
 
 * If the returned value is needed for a long time, it is best to make a copy
5779
 
 * of it with ovsdb_datum_clone(). */
5780
 
const struct ovsdb_datum *
5781
 
ovsrec_interface_get_cfm_fault_status(const struct ovsrec_interface *row,
5782
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5783
 
{
5784
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
5785
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_fault_status);
5786
 
}
5787
 
 
5788
 
/* Returns the cfm_flap_count column's value in 'row' as a struct ovsdb_datum.
5789
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5790
 
 * easier and more efficient way to search for a given key than implementing
5791
 
 * the same operation on the "cooked" form in 'row'.
5792
 
 *
5793
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
5794
 
 * (This helps to avoid silent bugs if someone changes cfm_flap_count's
5795
 
 * type without updating the caller.)
5796
 
 *
5797
 
 * The caller must not modify or free the returned value.
5798
 
 *
5799
 
 * Various kinds of changes can invalidate the returned value: modifying
5800
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5801
 
 * If the returned value is needed for a long time, it is best to make a copy
5802
 
 * of it with ovsdb_datum_clone(). */
5803
 
const struct ovsdb_datum *
5804
 
ovsrec_interface_get_cfm_flap_count(const struct ovsrec_interface *row,
5805
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5806
 
{
5807
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5808
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_flap_count);
5809
 
}
5810
 
 
5811
 
/* Returns the cfm_health column's value in 'row' as a struct ovsdb_datum.
5812
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5813
 
 * easier and more efficient way to search for a given key than implementing
5814
 
 * the same operation on the "cooked" form in 'row'.
5815
 
 *
5816
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
5817
 
 * (This helps to avoid silent bugs if someone changes cfm_health's
5818
 
 * type without updating the caller.)
5819
 
 *
5820
 
 * The caller must not modify or free the returned value.
5821
 
 *
5822
 
 * Various kinds of changes can invalidate the returned value: modifying
5823
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5824
 
 * If the returned value is needed for a long time, it is best to make a copy
5825
 
 * of it with ovsdb_datum_clone(). */
5826
 
const struct ovsdb_datum *
5827
 
ovsrec_interface_get_cfm_health(const struct ovsrec_interface *row,
5828
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5829
 
{
5830
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5831
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_health);
5832
 
}
5833
 
 
5834
 
/* Returns the cfm_mpid column's value in 'row' as a struct ovsdb_datum.
5835
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5836
 
 * easier and more efficient way to search for a given key than implementing
5837
 
 * the same operation on the "cooked" form in 'row'.
5838
 
 *
5839
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
5840
 
 * (This helps to avoid silent bugs if someone changes cfm_mpid's
5841
 
 * type without updating the caller.)
5842
 
 *
5843
 
 * The caller must not modify or free the returned value.
5844
 
 *
5845
 
 * Various kinds of changes can invalidate the returned value: modifying
5846
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5847
 
 * If the returned value is needed for a long time, it is best to make a copy
5848
 
 * of it with ovsdb_datum_clone(). */
5849
 
const struct ovsdb_datum *
5850
 
ovsrec_interface_get_cfm_mpid(const struct ovsrec_interface *row,
5851
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5852
 
{
5853
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5854
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_mpid);
5855
 
}
5856
 
 
5857
 
/* Returns the cfm_remote_mpids column's value in 'row' as a struct ovsdb_datum.
5858
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5859
 
 * easier and more efficient way to search for a given key than implementing
5860
 
 * the same operation on the "cooked" form in 'row'.
5861
 
 *
5862
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
5863
 
 * (This helps to avoid silent bugs if someone changes cfm_remote_mpids's
5864
 
 * type without updating the caller.)
5865
 
 *
5866
 
 * The caller must not modify or free the returned value.
5867
 
 *
5868
 
 * Various kinds of changes can invalidate the returned value: modifying
5869
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5870
 
 * If the returned value is needed for a long time, it is best to make a copy
5871
 
 * of it with ovsdb_datum_clone(). */
5872
 
const struct ovsdb_datum *
5873
 
ovsrec_interface_get_cfm_remote_mpids(const struct ovsrec_interface *row,
5874
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5875
 
{
5876
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5877
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_remote_mpids);
5878
 
}
5879
 
 
5880
 
/* Returns the cfm_remote_opstate column's value in 'row' as a struct ovsdb_datum.
5881
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5882
 
 * easier and more efficient way to search for a given key than implementing
5883
 
 * the same operation on the "cooked" form in 'row'.
5884
 
 *
5885
 
 * 'key_type' must be OVSDB_TYPE_STRING.
5886
 
 * (This helps to avoid silent bugs if someone changes cfm_remote_opstate's
5887
 
 * type without updating the caller.)
5888
 
 *
5889
 
 * The caller must not modify or free the returned value.
5890
 
 *
5891
 
 * Various kinds of changes can invalidate the returned value: modifying
5892
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5893
 
 * If the returned value is needed for a long time, it is best to make a copy
5894
 
 * of it with ovsdb_datum_clone(). */
5895
 
const struct ovsdb_datum *
5896
 
ovsrec_interface_get_cfm_remote_opstate(const struct ovsrec_interface *row,
5897
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5898
 
{
5899
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
5900
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_cfm_remote_opstate);
5901
 
}
5902
 
 
5903
 
/* Returns the duplex column's value in 'row' as a struct ovsdb_datum.
5904
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5905
 
 * easier and more efficient way to search for a given key than implementing
5906
 
 * the same operation on the "cooked" form in 'row'.
5907
 
 *
5908
 
 * 'key_type' must be OVSDB_TYPE_STRING.
5909
 
 * (This helps to avoid silent bugs if someone changes duplex's
5910
 
 * type without updating the caller.)
5911
 
 *
5912
 
 * The caller must not modify or free the returned value.
5913
 
 *
5914
 
 * Various kinds of changes can invalidate the returned value: modifying
5915
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5916
 
 * If the returned value is needed for a long time, it is best to make a copy
5917
 
 * of it with ovsdb_datum_clone(). */
5918
 
const struct ovsdb_datum *
5919
 
ovsrec_interface_get_duplex(const struct ovsrec_interface *row,
5920
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5921
 
{
5922
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
5923
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_duplex);
5924
 
}
5925
 
 
5926
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
5927
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5928
 
 * easier and more efficient way to search for a given key than implementing
5929
 
 * the same operation on the "cooked" form in 'row'.
5930
 
 *
5931
 
 * 'key_type' must be OVSDB_TYPE_STRING.
5932
 
 * 'value_type' must be OVSDB_TYPE_STRING.
5933
 
 * (This helps to avoid silent bugs if someone changes external_ids's
5934
 
 * type without updating the caller.)
5935
 
 *
5936
 
 * The caller must not modify or free the returned value.
5937
 
 *
5938
 
 * Various kinds of changes can invalidate the returned value: modifying
5939
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5940
 
 * If the returned value is needed for a long time, it is best to make a copy
5941
 
 * of it with ovsdb_datum_clone(). */
5942
 
const struct ovsdb_datum *
5943
 
ovsrec_interface_get_external_ids(const struct ovsrec_interface *row,
5944
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
5945
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
5946
 
{
5947
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
5948
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
5949
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_external_ids);
5950
 
}
5951
 
 
5952
 
/* Returns the ifindex column's value in 'row' as a struct ovsdb_datum.
5953
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5954
 
 * easier and more efficient way to search for a given key than implementing
5955
 
 * the same operation on the "cooked" form in 'row'.
5956
 
 *
5957
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
5958
 
 * (This helps to avoid silent bugs if someone changes ifindex's
5959
 
 * type without updating the caller.)
5960
 
 *
5961
 
 * The caller must not modify or free the returned value.
5962
 
 *
5963
 
 * Various kinds of changes can invalidate the returned value: modifying
5964
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5965
 
 * If the returned value is needed for a long time, it is best to make a copy
5966
 
 * of it with ovsdb_datum_clone(). */
5967
 
const struct ovsdb_datum *
5968
 
ovsrec_interface_get_ifindex(const struct ovsrec_interface *row,
5969
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5970
 
{
5971
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5972
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ifindex);
5973
 
}
5974
 
 
5975
 
/* Returns the ingress_policing_burst column's value in 'row' as a struct ovsdb_datum.
5976
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
5977
 
 * easier and more efficient way to search for a given key than implementing
5978
 
 * the same operation on the "cooked" form in 'row'.
5979
 
 *
5980
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
5981
 
 * (This helps to avoid silent bugs if someone changes ingress_policing_burst's
5982
 
 * type without updating the caller.)
5983
 
 *
5984
 
 * The caller must not modify or free the returned value.
5985
 
 *
5986
 
 * Various kinds of changes can invalidate the returned value: modifying
5987
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
5988
 
 * If the returned value is needed for a long time, it is best to make a copy
5989
 
 * of it with ovsdb_datum_clone(). */
5990
 
const struct ovsdb_datum *
5991
 
ovsrec_interface_get_ingress_policing_burst(const struct ovsrec_interface *row,
5992
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
5993
 
{
5994
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
5995
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_burst);
5996
 
}
5997
 
 
5998
 
/* Returns the ingress_policing_rate column's value in 'row' as a struct ovsdb_datum.
5999
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6000
 
 * easier and more efficient way to search for a given key than implementing
6001
 
 * the same operation on the "cooked" form in 'row'.
6002
 
 *
6003
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
6004
 
 * (This helps to avoid silent bugs if someone changes ingress_policing_rate's
6005
 
 * type without updating the caller.)
6006
 
 *
6007
 
 * The caller must not modify or free the returned value.
6008
 
 *
6009
 
 * Various kinds of changes can invalidate the returned value: modifying
6010
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6011
 
 * If the returned value is needed for a long time, it is best to make a copy
6012
 
 * of it with ovsdb_datum_clone(). */
6013
 
const struct ovsdb_datum *
6014
 
ovsrec_interface_get_ingress_policing_rate(const struct ovsrec_interface *row,
6015
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6016
 
{
6017
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6018
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ingress_policing_rate);
6019
 
}
6020
 
 
6021
 
/* Returns the lacp_current column's value in 'row' as a struct ovsdb_datum.
6022
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6023
 
 * easier and more efficient way to search for a given key than implementing
6024
 
 * the same operation on the "cooked" form in 'row'.
6025
 
 *
6026
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
6027
 
 * (This helps to avoid silent bugs if someone changes lacp_current's
6028
 
 * type without updating the caller.)
6029
 
 *
6030
 
 * The caller must not modify or free the returned value.
6031
 
 *
6032
 
 * Various kinds of changes can invalidate the returned value: modifying
6033
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6034
 
 * If the returned value is needed for a long time, it is best to make a copy
6035
 
 * of it with ovsdb_datum_clone(). */
6036
 
const struct ovsdb_datum *
6037
 
ovsrec_interface_get_lacp_current(const struct ovsrec_interface *row,
6038
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6039
 
{
6040
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
6041
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_lacp_current);
6042
 
}
6043
 
 
6044
 
/* Returns the link_resets column's value in 'row' as a struct ovsdb_datum.
6045
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6046
 
 * easier and more efficient way to search for a given key than implementing
6047
 
 * the same operation on the "cooked" form in 'row'.
6048
 
 *
6049
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
6050
 
 * (This helps to avoid silent bugs if someone changes link_resets's
6051
 
 * type without updating the caller.)
6052
 
 *
6053
 
 * The caller must not modify or free the returned value.
6054
 
 *
6055
 
 * Various kinds of changes can invalidate the returned value: modifying
6056
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6057
 
 * If the returned value is needed for a long time, it is best to make a copy
6058
 
 * of it with ovsdb_datum_clone(). */
6059
 
const struct ovsdb_datum *
6060
 
ovsrec_interface_get_link_resets(const struct ovsrec_interface *row,
6061
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6062
 
{
6063
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6064
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_resets);
6065
 
}
6066
 
 
6067
 
/* Returns the link_speed column's value in 'row' as a struct ovsdb_datum.
6068
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6069
 
 * easier and more efficient way to search for a given key than implementing
6070
 
 * the same operation on the "cooked" form in 'row'.
6071
 
 *
6072
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
6073
 
 * (This helps to avoid silent bugs if someone changes link_speed's
6074
 
 * type without updating the caller.)
6075
 
 *
6076
 
 * The caller must not modify or free the returned value.
6077
 
 *
6078
 
 * Various kinds of changes can invalidate the returned value: modifying
6079
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6080
 
 * If the returned value is needed for a long time, it is best to make a copy
6081
 
 * of it with ovsdb_datum_clone(). */
6082
 
const struct ovsdb_datum *
6083
 
ovsrec_interface_get_link_speed(const struct ovsrec_interface *row,
6084
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6085
 
{
6086
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6087
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_speed);
6088
 
}
6089
 
 
6090
 
/* Returns the link_state column's value in 'row' as a struct ovsdb_datum.
6091
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6092
 
 * easier and more efficient way to search for a given key than implementing
6093
 
 * the same operation on the "cooked" form in 'row'.
6094
 
 *
6095
 
 * 'key_type' must be OVSDB_TYPE_STRING.
6096
 
 * (This helps to avoid silent bugs if someone changes link_state's
6097
 
 * type without updating the caller.)
6098
 
 *
6099
 
 * The caller must not modify or free the returned value.
6100
 
 *
6101
 
 * Various kinds of changes can invalidate the returned value: modifying
6102
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6103
 
 * If the returned value is needed for a long time, it is best to make a copy
6104
 
 * of it with ovsdb_datum_clone(). */
6105
 
const struct ovsdb_datum *
6106
 
ovsrec_interface_get_link_state(const struct ovsrec_interface *row,
6107
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6108
 
{
6109
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6110
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_link_state);
6111
 
}
6112
 
 
6113
 
/* Returns the mac column's value in 'row' as a struct ovsdb_datum.
6114
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6115
 
 * easier and more efficient way to search for a given key than implementing
6116
 
 * the same operation on the "cooked" form in 'row'.
6117
 
 *
6118
 
 * 'key_type' must be OVSDB_TYPE_STRING.
6119
 
 * (This helps to avoid silent bugs if someone changes mac's
6120
 
 * type without updating the caller.)
6121
 
 *
6122
 
 * The caller must not modify or free the returned value.
6123
 
 *
6124
 
 * Various kinds of changes can invalidate the returned value: modifying
6125
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6126
 
 * If the returned value is needed for a long time, it is best to make a copy
6127
 
 * of it with ovsdb_datum_clone(). */
6128
 
const struct ovsdb_datum *
6129
 
ovsrec_interface_get_mac(const struct ovsrec_interface *row,
6130
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6131
 
{
6132
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6133
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mac);
6134
 
}
6135
 
 
6136
 
/* Returns the mac_in_use column's value in 'row' as a struct ovsdb_datum.
6137
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6138
 
 * easier and more efficient way to search for a given key than implementing
6139
 
 * the same operation on the "cooked" form in 'row'.
6140
 
 *
6141
 
 * 'key_type' must be OVSDB_TYPE_STRING.
6142
 
 * (This helps to avoid silent bugs if someone changes mac_in_use's
6143
 
 * type without updating the caller.)
6144
 
 *
6145
 
 * The caller must not modify or free the returned value.
6146
 
 *
6147
 
 * Various kinds of changes can invalidate the returned value: modifying
6148
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6149
 
 * If the returned value is needed for a long time, it is best to make a copy
6150
 
 * of it with ovsdb_datum_clone(). */
6151
 
const struct ovsdb_datum *
6152
 
ovsrec_interface_get_mac_in_use(const struct ovsrec_interface *row,
6153
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6154
 
{
6155
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6156
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mac_in_use);
6157
 
}
6158
 
 
6159
 
/* Returns the mtu column's value in 'row' as a struct ovsdb_datum.
6160
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6161
 
 * easier and more efficient way to search for a given key than implementing
6162
 
 * the same operation on the "cooked" form in 'row'.
6163
 
 *
6164
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
6165
 
 * (This helps to avoid silent bugs if someone changes mtu's
6166
 
 * type without updating the caller.)
6167
 
 *
6168
 
 * The caller must not modify or free the returned value.
6169
 
 *
6170
 
 * Various kinds of changes can invalidate the returned value: modifying
6171
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6172
 
 * If the returned value is needed for a long time, it is best to make a copy
6173
 
 * of it with ovsdb_datum_clone(). */
6174
 
const struct ovsdb_datum *
6175
 
ovsrec_interface_get_mtu(const struct ovsrec_interface *row,
6176
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6177
 
{
6178
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6179
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_mtu);
6180
 
}
6181
 
 
6182
 
/* Returns the name column's value in 'row' as a struct ovsdb_datum.
6183
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6184
 
 * easier and more efficient way to search for a given key than implementing
6185
 
 * the same operation on the "cooked" form in 'row'.
6186
 
 *
6187
 
 * 'key_type' must be OVSDB_TYPE_STRING.
6188
 
 * (This helps to avoid silent bugs if someone changes name's
6189
 
 * type without updating the caller.)
6190
 
 *
6191
 
 * The caller must not modify or free the returned value.
6192
 
 *
6193
 
 * Various kinds of changes can invalidate the returned value: modifying
6194
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6195
 
 * If the returned value is needed for a long time, it is best to make a copy
6196
 
 * of it with ovsdb_datum_clone(). */
6197
 
const struct ovsdb_datum *
6198
 
ovsrec_interface_get_name(const struct ovsrec_interface *row,
6199
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6200
 
{
6201
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6202
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_name);
6203
 
}
6204
 
 
6205
 
/* Returns the ofport column's value in 'row' as a struct ovsdb_datum.
6206
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6207
 
 * easier and more efficient way to search for a given key than implementing
6208
 
 * the same operation on the "cooked" form in 'row'.
6209
 
 *
6210
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
6211
 
 * (This helps to avoid silent bugs if someone changes ofport's
6212
 
 * type without updating the caller.)
6213
 
 *
6214
 
 * The caller must not modify or free the returned value.
6215
 
 *
6216
 
 * Various kinds of changes can invalidate the returned value: modifying
6217
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6218
 
 * If the returned value is needed for a long time, it is best to make a copy
6219
 
 * of it with ovsdb_datum_clone(). */
6220
 
const struct ovsdb_datum *
6221
 
ovsrec_interface_get_ofport(const struct ovsrec_interface *row,
6222
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6223
 
{
6224
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6225
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ofport);
6226
 
}
6227
 
 
6228
 
/* Returns the ofport_request column's value in 'row' as a struct ovsdb_datum.
6229
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6230
 
 * easier and more efficient way to search for a given key than implementing
6231
 
 * the same operation on the "cooked" form in 'row'.
6232
 
 *
6233
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
6234
 
 * (This helps to avoid silent bugs if someone changes ofport_request's
6235
 
 * type without updating the caller.)
6236
 
 *
6237
 
 * The caller must not modify or free the returned value.
6238
 
 *
6239
 
 * Various kinds of changes can invalidate the returned value: modifying
6240
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6241
 
 * If the returned value is needed for a long time, it is best to make a copy
6242
 
 * of it with ovsdb_datum_clone(). */
6243
 
const struct ovsdb_datum *
6244
 
ovsrec_interface_get_ofport_request(const struct ovsrec_interface *row,
6245
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6246
 
{
6247
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
6248
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_ofport_request);
6249
 
}
6250
 
 
6251
 
/* Returns the options column's value in 'row' as a struct ovsdb_datum.
6252
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6253
 
 * easier and more efficient way to search for a given key than implementing
6254
 
 * the same operation on the "cooked" form in 'row'.
6255
 
 *
6256
 
 * 'key_type' must be OVSDB_TYPE_STRING.
6257
 
 * 'value_type' must be OVSDB_TYPE_STRING.
6258
 
 * (This helps to avoid silent bugs if someone changes options's
6259
 
 * type without updating the caller.)
6260
 
 *
6261
 
 * The caller must not modify or free the returned value.
6262
 
 *
6263
 
 * Various kinds of changes can invalidate the returned value: modifying
6264
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6265
 
 * If the returned value is needed for a long time, it is best to make a copy
6266
 
 * of it with ovsdb_datum_clone(). */
6267
 
const struct ovsdb_datum *
6268
 
ovsrec_interface_get_options(const struct ovsrec_interface *row,
6269
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
6270
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
6271
 
{
6272
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6273
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
6274
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_options);
6275
 
}
6276
 
 
6277
 
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
6278
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6279
 
 * easier and more efficient way to search for a given key than implementing
6280
 
 * the same operation on the "cooked" form in 'row'.
6281
 
 *
6282
 
 * 'key_type' must be OVSDB_TYPE_STRING.
6283
 
 * 'value_type' must be OVSDB_TYPE_STRING.
6284
 
 * (This helps to avoid silent bugs if someone changes other_config's
6285
 
 * type without updating the caller.)
6286
 
 *
6287
 
 * The caller must not modify or free the returned value.
6288
 
 *
6289
 
 * Various kinds of changes can invalidate the returned value: modifying
6290
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6291
 
 * If the returned value is needed for a long time, it is best to make a copy
6292
 
 * of it with ovsdb_datum_clone(). */
6293
 
const struct ovsdb_datum *
6294
 
ovsrec_interface_get_other_config(const struct ovsrec_interface *row,
6295
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
6296
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
6297
 
{
6298
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6299
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
6300
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_other_config);
6301
 
}
6302
 
 
6303
 
/* Returns the statistics column's value in 'row' as a struct ovsdb_datum.
6304
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6305
 
 * easier and more efficient way to search for a given key than implementing
6306
 
 * the same operation on the "cooked" form in 'row'.
6307
 
 *
6308
 
 * 'key_type' must be OVSDB_TYPE_STRING.
6309
 
 * 'value_type' must be OVSDB_TYPE_INTEGER.
6310
 
 * (This helps to avoid silent bugs if someone changes statistics's
6311
 
 * type without updating the caller.)
6312
 
 *
6313
 
 * The caller must not modify or free the returned value.
6314
 
 *
6315
 
 * Various kinds of changes can invalidate the returned value: modifying
6316
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6317
 
 * If the returned value is needed for a long time, it is best to make a copy
6318
 
 * of it with ovsdb_datum_clone(). */
6319
 
const struct ovsdb_datum *
6320
 
ovsrec_interface_get_statistics(const struct ovsrec_interface *row,
6321
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
6322
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
6323
 
{
6324
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6325
 
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
6326
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_statistics);
6327
 
}
6328
 
 
6329
 
/* Returns the status column's value in 'row' as a struct ovsdb_datum.
6330
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6331
 
 * easier and more efficient way to search for a given key than implementing
6332
 
 * the same operation on the "cooked" form in 'row'.
6333
 
 *
6334
 
 * 'key_type' must be OVSDB_TYPE_STRING.
6335
 
 * 'value_type' must be OVSDB_TYPE_STRING.
6336
 
 * (This helps to avoid silent bugs if someone changes status's
6337
 
 * type without updating the caller.)
6338
 
 *
6339
 
 * The caller must not modify or free the returned value.
6340
 
 *
6341
 
 * Various kinds of changes can invalidate the returned value: modifying
6342
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6343
 
 * If the returned value is needed for a long time, it is best to make a copy
6344
 
 * of it with ovsdb_datum_clone(). */
6345
 
const struct ovsdb_datum *
6346
 
ovsrec_interface_get_status(const struct ovsrec_interface *row,
6347
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
6348
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
6349
 
{
6350
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6351
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
6352
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_status);
6353
 
}
6354
 
 
6355
 
/* Returns the type column's value in 'row' as a struct ovsdb_datum.
6356
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
6357
 
 * easier and more efficient way to search for a given key than implementing
6358
 
 * the same operation on the "cooked" form in 'row'.
6359
 
 *
6360
 
 * 'key_type' must be OVSDB_TYPE_STRING.
6361
 
 * (This helps to avoid silent bugs if someone changes type's
6362
 
 * type without updating the caller.)
6363
 
 *
6364
 
 * The caller must not modify or free the returned value.
6365
 
 *
6366
 
 * Various kinds of changes can invalidate the returned value: modifying
6367
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
6368
 
 * If the returned value is needed for a long time, it is best to make a copy
6369
 
 * of it with ovsdb_datum_clone(). */
6370
 
const struct ovsdb_datum *
6371
 
ovsrec_interface_get_type(const struct ovsrec_interface *row,
6372
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
6373
 
{
6374
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
6375
 
    return ovsdb_idl_read(&row->header_, &ovsrec_interface_col_type);
6376
 
}
6377
 
 
6378
 
void
6379
 
ovsrec_interface_set_admin_state(const struct ovsrec_interface *row, const char *admin_state)
6380
 
{
6381
 
    struct ovsdb_datum datum;
6382
 
    union ovsdb_atom key;
6383
 
 
6384
 
    ovs_assert(inited);
6385
 
    if (admin_state) {
6386
 
        datum.n = 1;
6387
 
        datum.keys = &key;
6388
 
        key.string = CONST_CAST(char *, admin_state);
6389
 
    } else {
6390
 
        datum.n = 0;
6391
 
        datum.keys = NULL;
6392
 
    }
6393
 
    datum.values = NULL;
6394
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_ADMIN_STATE], &datum);
6395
 
}
6396
 
 
6397
 
void
6398
 
ovsrec_interface_set_bfd(const struct ovsrec_interface *row, const struct smap *smap)
6399
 
{
6400
 
    struct ovsdb_datum datum;
6401
 
 
6402
 
    ovs_assert(inited);
6403
 
    if (smap) {
6404
 
        struct smap_node *node;
6405
 
        size_t i;
6406
 
 
6407
 
        datum.n = smap_count(smap);
6408
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6409
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
6410
 
 
6411
 
        i = 0;
6412
 
        SMAP_FOR_EACH (node, smap) {
6413
 
            datum.keys[i].string = xstrdup(node->key);
6414
 
            datum.values[i].string = xstrdup(node->value);
6415
 
            i++;
6416
 
        }
6417
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6418
 
    } else {
6419
 
        ovsdb_datum_init_empty(&datum);
6420
 
    }
6421
 
    ovsdb_idl_txn_write(&row->header_,
6422
 
                        &ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD],
6423
 
                        &datum);
6424
 
}
6425
 
 
6426
 
 
6427
 
void
6428
 
ovsrec_interface_set_bfd_status(const struct ovsrec_interface *row, const struct smap *smap)
6429
 
{
6430
 
    struct ovsdb_datum datum;
6431
 
 
6432
 
    ovs_assert(inited);
6433
 
    if (smap) {
6434
 
        struct smap_node *node;
6435
 
        size_t i;
6436
 
 
6437
 
        datum.n = smap_count(smap);
6438
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6439
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
6440
 
 
6441
 
        i = 0;
6442
 
        SMAP_FOR_EACH (node, smap) {
6443
 
            datum.keys[i].string = xstrdup(node->key);
6444
 
            datum.values[i].string = xstrdup(node->value);
6445
 
            i++;
6446
 
        }
6447
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6448
 
    } else {
6449
 
        ovsdb_datum_init_empty(&datum);
6450
 
    }
6451
 
    ovsdb_idl_txn_write(&row->header_,
6452
 
                        &ovsrec_interface_columns[OVSREC_INTERFACE_COL_BFD_STATUS],
6453
 
                        &datum);
6454
 
}
6455
 
 
6456
 
 
6457
 
void
6458
 
ovsrec_interface_set_cfm_fault(const struct ovsrec_interface *row, const bool *cfm_fault, size_t n_cfm_fault)
6459
 
{
6460
 
    struct ovsdb_datum datum;
6461
 
    union ovsdb_atom key;
6462
 
 
6463
 
    ovs_assert(inited);
6464
 
    if (n_cfm_fault) {
6465
 
        datum.n = 1;
6466
 
        datum.keys = &key;
6467
 
        key.boolean = *cfm_fault;
6468
 
    } else {
6469
 
        datum.n = 0;
6470
 
        datum.keys = NULL;
6471
 
    }
6472
 
    datum.values = NULL;
6473
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FAULT], &datum);
6474
 
}
6475
 
 
6476
 
void
6477
 
ovsrec_interface_set_cfm_fault_status(const struct ovsrec_interface *row, char **cfm_fault_status, size_t n_cfm_fault_status)
6478
 
{
6479
 
    struct ovsdb_datum datum;
6480
 
    size_t i;
6481
 
 
6482
 
    ovs_assert(inited);
6483
 
    datum.n = n_cfm_fault_status;
6484
 
    datum.keys = n_cfm_fault_status ? xmalloc(n_cfm_fault_status * sizeof *datum.keys) : NULL;
6485
 
    datum.values = NULL;
6486
 
    for (i = 0; i < n_cfm_fault_status; i++) {
6487
 
        datum.keys[i].string = xstrdup(cfm_fault_status[i]);
6488
 
    }
6489
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
6490
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FAULT_STATUS], &datum);
6491
 
}
6492
 
 
6493
 
void
6494
 
ovsrec_interface_set_cfm_flap_count(const struct ovsrec_interface *row, const int64_t *cfm_flap_count, size_t n_cfm_flap_count)
6495
 
{
6496
 
    struct ovsdb_datum datum;
6497
 
    union ovsdb_atom key;
6498
 
 
6499
 
    ovs_assert(inited);
6500
 
    if (n_cfm_flap_count) {
6501
 
        datum.n = 1;
6502
 
        datum.keys = &key;
6503
 
        key.integer = *cfm_flap_count;
6504
 
    } else {
6505
 
        datum.n = 0;
6506
 
        datum.keys = NULL;
6507
 
    }
6508
 
    datum.values = NULL;
6509
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_FLAP_COUNT], &datum);
6510
 
}
6511
 
 
6512
 
void
6513
 
ovsrec_interface_set_cfm_health(const struct ovsrec_interface *row, const int64_t *cfm_health, size_t n_cfm_health)
6514
 
{
6515
 
    struct ovsdb_datum datum;
6516
 
    union ovsdb_atom key;
6517
 
 
6518
 
    ovs_assert(inited);
6519
 
    if (n_cfm_health) {
6520
 
        datum.n = 1;
6521
 
        datum.keys = &key;
6522
 
        key.integer = *cfm_health;
6523
 
    } else {
6524
 
        datum.n = 0;
6525
 
        datum.keys = NULL;
6526
 
    }
6527
 
    datum.values = NULL;
6528
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_HEALTH], &datum);
6529
 
}
6530
 
 
6531
 
void
6532
 
ovsrec_interface_set_cfm_mpid(const struct ovsrec_interface *row, const int64_t *cfm_mpid, size_t n_cfm_mpid)
6533
 
{
6534
 
    struct ovsdb_datum datum;
6535
 
    union ovsdb_atom key;
6536
 
 
6537
 
    ovs_assert(inited);
6538
 
    if (n_cfm_mpid) {
6539
 
        datum.n = 1;
6540
 
        datum.keys = &key;
6541
 
        key.integer = *cfm_mpid;
6542
 
    } else {
6543
 
        datum.n = 0;
6544
 
        datum.keys = NULL;
6545
 
    }
6546
 
    datum.values = NULL;
6547
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_MPID], &datum);
6548
 
}
6549
 
 
6550
 
void
6551
 
ovsrec_interface_set_cfm_remote_mpids(const struct ovsrec_interface *row, const int64_t *cfm_remote_mpids, size_t n_cfm_remote_mpids)
6552
 
{
6553
 
    struct ovsdb_datum datum;
6554
 
    size_t i;
6555
 
 
6556
 
    ovs_assert(inited);
6557
 
    datum.n = n_cfm_remote_mpids;
6558
 
    datum.keys = n_cfm_remote_mpids ? xmalloc(n_cfm_remote_mpids * sizeof *datum.keys) : NULL;
6559
 
    datum.values = NULL;
6560
 
    for (i = 0; i < n_cfm_remote_mpids; i++) {
6561
 
        datum.keys[i].integer = cfm_remote_mpids[i];
6562
 
    }
6563
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_VOID);
6564
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_REMOTE_MPIDS], &datum);
6565
 
}
6566
 
 
6567
 
void
6568
 
ovsrec_interface_set_cfm_remote_opstate(const struct ovsrec_interface *row, const char *cfm_remote_opstate)
6569
 
{
6570
 
    struct ovsdb_datum datum;
6571
 
    union ovsdb_atom key;
6572
 
 
6573
 
    ovs_assert(inited);
6574
 
    if (cfm_remote_opstate) {
6575
 
        datum.n = 1;
6576
 
        datum.keys = &key;
6577
 
        key.string = CONST_CAST(char *, cfm_remote_opstate);
6578
 
    } else {
6579
 
        datum.n = 0;
6580
 
        datum.keys = NULL;
6581
 
    }
6582
 
    datum.values = NULL;
6583
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_CFM_REMOTE_OPSTATE], &datum);
6584
 
}
6585
 
 
6586
 
void
6587
 
ovsrec_interface_set_duplex(const struct ovsrec_interface *row, const char *duplex)
6588
 
{
6589
 
    struct ovsdb_datum datum;
6590
 
    union ovsdb_atom key;
6591
 
 
6592
 
    ovs_assert(inited);
6593
 
    if (duplex) {
6594
 
        datum.n = 1;
6595
 
        datum.keys = &key;
6596
 
        key.string = CONST_CAST(char *, duplex);
6597
 
    } else {
6598
 
        datum.n = 0;
6599
 
        datum.keys = NULL;
6600
 
    }
6601
 
    datum.values = NULL;
6602
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_DUPLEX], &datum);
6603
 
}
6604
 
 
6605
 
void
6606
 
ovsrec_interface_set_external_ids(const struct ovsrec_interface *row, const struct smap *smap)
6607
 
{
6608
 
    struct ovsdb_datum datum;
6609
 
 
6610
 
    ovs_assert(inited);
6611
 
    if (smap) {
6612
 
        struct smap_node *node;
6613
 
        size_t i;
6614
 
 
6615
 
        datum.n = smap_count(smap);
6616
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6617
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
6618
 
 
6619
 
        i = 0;
6620
 
        SMAP_FOR_EACH (node, smap) {
6621
 
            datum.keys[i].string = xstrdup(node->key);
6622
 
            datum.values[i].string = xstrdup(node->value);
6623
 
            i++;
6624
 
        }
6625
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6626
 
    } else {
6627
 
        ovsdb_datum_init_empty(&datum);
6628
 
    }
6629
 
    ovsdb_idl_txn_write(&row->header_,
6630
 
                        &ovsrec_interface_columns[OVSREC_INTERFACE_COL_EXTERNAL_IDS],
6631
 
                        &datum);
6632
 
}
6633
 
 
6634
 
 
6635
 
void
6636
 
ovsrec_interface_set_ifindex(const struct ovsrec_interface *row, const int64_t *ifindex, size_t n_ifindex)
6637
 
{
6638
 
    struct ovsdb_datum datum;
6639
 
    union ovsdb_atom key;
6640
 
 
6641
 
    ovs_assert(inited);
6642
 
    if (n_ifindex) {
6643
 
        datum.n = 1;
6644
 
        datum.keys = &key;
6645
 
        key.integer = *ifindex;
6646
 
    } else {
6647
 
        datum.n = 0;
6648
 
        datum.keys = NULL;
6649
 
    }
6650
 
    datum.values = NULL;
6651
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_IFINDEX], &datum);
6652
 
}
6653
 
 
6654
 
void
6655
 
ovsrec_interface_set_ingress_policing_burst(const struct ovsrec_interface *row, int64_t ingress_policing_burst)
6656
 
{
6657
 
    struct ovsdb_datum datum;
6658
 
    union ovsdb_atom key;
6659
 
 
6660
 
    ovs_assert(inited);
6661
 
    datum.n = 1;
6662
 
    datum.keys = &key;
6663
 
    key.integer = ingress_policing_burst;
6664
 
    datum.values = NULL;
6665
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_INGRESS_POLICING_BURST], &datum);
6666
 
}
6667
 
 
6668
 
void
6669
 
ovsrec_interface_set_ingress_policing_rate(const struct ovsrec_interface *row, int64_t ingress_policing_rate)
6670
 
{
6671
 
    struct ovsdb_datum datum;
6672
 
    union ovsdb_atom key;
6673
 
 
6674
 
    ovs_assert(inited);
6675
 
    datum.n = 1;
6676
 
    datum.keys = &key;
6677
 
    key.integer = ingress_policing_rate;
6678
 
    datum.values = NULL;
6679
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_INGRESS_POLICING_RATE], &datum);
6680
 
}
6681
 
 
6682
 
void
6683
 
ovsrec_interface_set_lacp_current(const struct ovsrec_interface *row, const bool *lacp_current, size_t n_lacp_current)
6684
 
{
6685
 
    struct ovsdb_datum datum;
6686
 
    union ovsdb_atom key;
6687
 
 
6688
 
    ovs_assert(inited);
6689
 
    if (n_lacp_current) {
6690
 
        datum.n = 1;
6691
 
        datum.keys = &key;
6692
 
        key.boolean = *lacp_current;
6693
 
    } else {
6694
 
        datum.n = 0;
6695
 
        datum.keys = NULL;
6696
 
    }
6697
 
    datum.values = NULL;
6698
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LACP_CURRENT], &datum);
6699
 
}
6700
 
 
6701
 
void
6702
 
ovsrec_interface_set_link_resets(const struct ovsrec_interface *row, const int64_t *link_resets, size_t n_link_resets)
6703
 
{
6704
 
    struct ovsdb_datum datum;
6705
 
    union ovsdb_atom key;
6706
 
 
6707
 
    ovs_assert(inited);
6708
 
    if (n_link_resets) {
6709
 
        datum.n = 1;
6710
 
        datum.keys = &key;
6711
 
        key.integer = *link_resets;
6712
 
    } else {
6713
 
        datum.n = 0;
6714
 
        datum.keys = NULL;
6715
 
    }
6716
 
    datum.values = NULL;
6717
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_RESETS], &datum);
6718
 
}
6719
 
 
6720
 
void
6721
 
ovsrec_interface_set_link_speed(const struct ovsrec_interface *row, const int64_t *link_speed, size_t n_link_speed)
6722
 
{
6723
 
    struct ovsdb_datum datum;
6724
 
    union ovsdb_atom key;
6725
 
 
6726
 
    ovs_assert(inited);
6727
 
    if (n_link_speed) {
6728
 
        datum.n = 1;
6729
 
        datum.keys = &key;
6730
 
        key.integer = *link_speed;
6731
 
    } else {
6732
 
        datum.n = 0;
6733
 
        datum.keys = NULL;
6734
 
    }
6735
 
    datum.values = NULL;
6736
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_SPEED], &datum);
6737
 
}
6738
 
 
6739
 
void
6740
 
ovsrec_interface_set_link_state(const struct ovsrec_interface *row, const char *link_state)
6741
 
{
6742
 
    struct ovsdb_datum datum;
6743
 
    union ovsdb_atom key;
6744
 
 
6745
 
    ovs_assert(inited);
6746
 
    if (link_state) {
6747
 
        datum.n = 1;
6748
 
        datum.keys = &key;
6749
 
        key.string = CONST_CAST(char *, link_state);
6750
 
    } else {
6751
 
        datum.n = 0;
6752
 
        datum.keys = NULL;
6753
 
    }
6754
 
    datum.values = NULL;
6755
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_LINK_STATE], &datum);
6756
 
}
6757
 
 
6758
 
void
6759
 
ovsrec_interface_set_mac(const struct ovsrec_interface *row, const char *mac)
6760
 
{
6761
 
    struct ovsdb_datum datum;
6762
 
    union ovsdb_atom key;
6763
 
 
6764
 
    ovs_assert(inited);
6765
 
    if (mac) {
6766
 
        datum.n = 1;
6767
 
        datum.keys = &key;
6768
 
        key.string = CONST_CAST(char *, mac);
6769
 
    } else {
6770
 
        datum.n = 0;
6771
 
        datum.keys = NULL;
6772
 
    }
6773
 
    datum.values = NULL;
6774
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MAC], &datum);
6775
 
}
6776
 
 
6777
 
void
6778
 
ovsrec_interface_set_mac_in_use(const struct ovsrec_interface *row, const char *mac_in_use)
6779
 
{
6780
 
    struct ovsdb_datum datum;
6781
 
    union ovsdb_atom key;
6782
 
 
6783
 
    ovs_assert(inited);
6784
 
    if (mac_in_use) {
6785
 
        datum.n = 1;
6786
 
        datum.keys = &key;
6787
 
        key.string = CONST_CAST(char *, mac_in_use);
6788
 
    } else {
6789
 
        datum.n = 0;
6790
 
        datum.keys = NULL;
6791
 
    }
6792
 
    datum.values = NULL;
6793
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MAC_IN_USE], &datum);
6794
 
}
6795
 
 
6796
 
void
6797
 
ovsrec_interface_set_mtu(const struct ovsrec_interface *row, const int64_t *mtu, size_t n_mtu)
6798
 
{
6799
 
    struct ovsdb_datum datum;
6800
 
    union ovsdb_atom key;
6801
 
 
6802
 
    ovs_assert(inited);
6803
 
    if (n_mtu) {
6804
 
        datum.n = 1;
6805
 
        datum.keys = &key;
6806
 
        key.integer = *mtu;
6807
 
    } else {
6808
 
        datum.n = 0;
6809
 
        datum.keys = NULL;
6810
 
    }
6811
 
    datum.values = NULL;
6812
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_MTU], &datum);
6813
 
}
6814
 
 
6815
 
void
6816
 
ovsrec_interface_set_name(const struct ovsrec_interface *row, const char *name)
6817
 
{
6818
 
    struct ovsdb_datum datum;
6819
 
    union ovsdb_atom key;
6820
 
 
6821
 
    ovs_assert(inited);
6822
 
    datum.n = 1;
6823
 
    datum.keys = &key;
6824
 
    key.string = CONST_CAST(char *, name);
6825
 
    datum.values = NULL;
6826
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_NAME], &datum);
6827
 
}
6828
 
 
6829
 
void
6830
 
ovsrec_interface_set_ofport(const struct ovsrec_interface *row, const int64_t *ofport, size_t n_ofport)
6831
 
{
6832
 
    struct ovsdb_datum datum;
6833
 
    union ovsdb_atom key;
6834
 
 
6835
 
    ovs_assert(inited);
6836
 
    if (n_ofport) {
6837
 
        datum.n = 1;
6838
 
        datum.keys = &key;
6839
 
        key.integer = *ofport;
6840
 
    } else {
6841
 
        datum.n = 0;
6842
 
        datum.keys = NULL;
6843
 
    }
6844
 
    datum.values = NULL;
6845
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OFPORT], &datum);
6846
 
}
6847
 
 
6848
 
void
6849
 
ovsrec_interface_set_ofport_request(const struct ovsrec_interface *row, const int64_t *ofport_request, size_t n_ofport_request)
6850
 
{
6851
 
    struct ovsdb_datum datum;
6852
 
    union ovsdb_atom key;
6853
 
 
6854
 
    ovs_assert(inited);
6855
 
    if (n_ofport_request) {
6856
 
        datum.n = 1;
6857
 
        datum.keys = &key;
6858
 
        key.integer = *ofport_request;
6859
 
    } else {
6860
 
        datum.n = 0;
6861
 
        datum.keys = NULL;
6862
 
    }
6863
 
    datum.values = NULL;
6864
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OFPORT_REQUEST], &datum);
6865
 
}
6866
 
 
6867
 
void
6868
 
ovsrec_interface_set_options(const struct ovsrec_interface *row, const struct smap *smap)
6869
 
{
6870
 
    struct ovsdb_datum datum;
6871
 
 
6872
 
    ovs_assert(inited);
6873
 
    if (smap) {
6874
 
        struct smap_node *node;
6875
 
        size_t i;
6876
 
 
6877
 
        datum.n = smap_count(smap);
6878
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6879
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
6880
 
 
6881
 
        i = 0;
6882
 
        SMAP_FOR_EACH (node, smap) {
6883
 
            datum.keys[i].string = xstrdup(node->key);
6884
 
            datum.values[i].string = xstrdup(node->value);
6885
 
            i++;
6886
 
        }
6887
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6888
 
    } else {
6889
 
        ovsdb_datum_init_empty(&datum);
6890
 
    }
6891
 
    ovsdb_idl_txn_write(&row->header_,
6892
 
                        &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OPTIONS],
6893
 
                        &datum);
6894
 
}
6895
 
 
6896
 
 
6897
 
void
6898
 
ovsrec_interface_set_other_config(const struct ovsrec_interface *row, const struct smap *smap)
6899
 
{
6900
 
    struct ovsdb_datum datum;
6901
 
 
6902
 
    ovs_assert(inited);
6903
 
    if (smap) {
6904
 
        struct smap_node *node;
6905
 
        size_t i;
6906
 
 
6907
 
        datum.n = smap_count(smap);
6908
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6909
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
6910
 
 
6911
 
        i = 0;
6912
 
        SMAP_FOR_EACH (node, smap) {
6913
 
            datum.keys[i].string = xstrdup(node->key);
6914
 
            datum.values[i].string = xstrdup(node->value);
6915
 
            i++;
6916
 
        }
6917
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6918
 
    } else {
6919
 
        ovsdb_datum_init_empty(&datum);
6920
 
    }
6921
 
    ovsdb_idl_txn_write(&row->header_,
6922
 
                        &ovsrec_interface_columns[OVSREC_INTERFACE_COL_OTHER_CONFIG],
6923
 
                        &datum);
6924
 
}
6925
 
 
6926
 
 
6927
 
void
6928
 
ovsrec_interface_set_statistics(const struct ovsrec_interface *row, char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
6929
 
{
6930
 
    struct ovsdb_datum datum;
6931
 
    size_t i;
6932
 
 
6933
 
    ovs_assert(inited);
6934
 
    datum.n = n_statistics;
6935
 
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
6936
 
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
6937
 
    for (i = 0; i < n_statistics; i++) {
6938
 
        datum.keys[i].string = xstrdup(key_statistics[i]);
6939
 
        datum.values[i].integer = value_statistics[i];
6940
 
    }
6941
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_INTEGER);
6942
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_STATISTICS], &datum);
6943
 
}
6944
 
 
6945
 
void
6946
 
ovsrec_interface_set_status(const struct ovsrec_interface *row, const struct smap *smap)
6947
 
{
6948
 
    struct ovsdb_datum datum;
6949
 
 
6950
 
    ovs_assert(inited);
6951
 
    if (smap) {
6952
 
        struct smap_node *node;
6953
 
        size_t i;
6954
 
 
6955
 
        datum.n = smap_count(smap);
6956
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
6957
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
6958
 
 
6959
 
        i = 0;
6960
 
        SMAP_FOR_EACH (node, smap) {
6961
 
            datum.keys[i].string = xstrdup(node->key);
6962
 
            datum.values[i].string = xstrdup(node->value);
6963
 
            i++;
6964
 
        }
6965
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
6966
 
    } else {
6967
 
        ovsdb_datum_init_empty(&datum);
6968
 
    }
6969
 
    ovsdb_idl_txn_write(&row->header_,
6970
 
                        &ovsrec_interface_columns[OVSREC_INTERFACE_COL_STATUS],
6971
 
                        &datum);
6972
 
}
6973
 
 
6974
 
 
6975
 
void
6976
 
ovsrec_interface_set_type(const struct ovsrec_interface *row, const char *type)
6977
 
{
6978
 
    struct ovsdb_datum datum;
6979
 
    union ovsdb_atom key;
6980
 
 
6981
 
    ovs_assert(inited);
6982
 
    datum.n = 1;
6983
 
    datum.keys = &key;
6984
 
    key.string = CONST_CAST(char *, type);
6985
 
    datum.values = NULL;
6986
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_interface_columns[OVSREC_INTERFACE_COL_TYPE], &datum);
6987
 
}
6988
 
 
6989
 
struct ovsdb_idl_column ovsrec_interface_columns[OVSREC_INTERFACE_N_COLUMNS];
6990
 
 
6991
 
static void
6992
 
ovsrec_interface_columns_init(void)
6993
 
{
6994
 
    struct ovsdb_idl_column *c;
6995
 
 
6996
 
    /* Initialize ovsrec_interface_col_admin_state. */
6997
 
    c = &ovsrec_interface_col_admin_state;
6998
 
    c->name = "admin_state";
6999
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7000
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
7001
 
    c->type.key.enum_->n = 2;
7002
 
    c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
7003
 
    c->type.key.enum_->keys[0].string = xstrdup("down");
7004
 
    c->type.key.enum_->keys[1].string = xstrdup("up");
7005
 
    c->type.key.enum_->values = NULL;
7006
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
7007
 
    c->type.key.u.string.minLen = 0;
7008
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7009
 
    c->type.n_min = 0;
7010
 
    c->type.n_max = 1;
7011
 
    c->mutable = true;
7012
 
    c->parse = ovsrec_interface_parse_admin_state;
7013
 
    c->unparse = ovsrec_interface_unparse_admin_state;
7014
 
 
7015
 
    /* Initialize ovsrec_interface_col_bfd. */
7016
 
    c = &ovsrec_interface_col_bfd;
7017
 
    c->name = "bfd";
7018
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7019
 
    c->type.key.u.string.minLen = 0;
7020
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7021
 
    c->type.value.u.string.minLen = 0;
7022
 
    c->type.n_min = 0;
7023
 
    c->type.n_max = UINT_MAX;
7024
 
    c->mutable = true;
7025
 
    c->parse = ovsrec_interface_parse_bfd;
7026
 
    c->unparse = ovsrec_interface_unparse_bfd;
7027
 
 
7028
 
    /* Initialize ovsrec_interface_col_bfd_status. */
7029
 
    c = &ovsrec_interface_col_bfd_status;
7030
 
    c->name = "bfd_status";
7031
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7032
 
    c->type.key.u.string.minLen = 0;
7033
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7034
 
    c->type.value.u.string.minLen = 0;
7035
 
    c->type.n_min = 0;
7036
 
    c->type.n_max = UINT_MAX;
7037
 
    c->mutable = true;
7038
 
    c->parse = ovsrec_interface_parse_bfd_status;
7039
 
    c->unparse = ovsrec_interface_unparse_bfd_status;
7040
 
 
7041
 
    /* Initialize ovsrec_interface_col_cfm_fault. */
7042
 
    c = &ovsrec_interface_col_cfm_fault;
7043
 
    c->name = "cfm_fault";
7044
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
7045
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7046
 
    c->type.n_min = 0;
7047
 
    c->type.n_max = 1;
7048
 
    c->mutable = true;
7049
 
    c->parse = ovsrec_interface_parse_cfm_fault;
7050
 
    c->unparse = ovsrec_interface_unparse_cfm_fault;
7051
 
 
7052
 
    /* Initialize ovsrec_interface_col_cfm_fault_status. */
7053
 
    c = &ovsrec_interface_col_cfm_fault_status;
7054
 
    c->name = "cfm_fault_status";
7055
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7056
 
    c->type.key.u.string.minLen = 0;
7057
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7058
 
    c->type.n_min = 0;
7059
 
    c->type.n_max = UINT_MAX;
7060
 
    c->mutable = true;
7061
 
    c->parse = ovsrec_interface_parse_cfm_fault_status;
7062
 
    c->unparse = ovsrec_interface_unparse_cfm_fault_status;
7063
 
 
7064
 
    /* Initialize ovsrec_interface_col_cfm_flap_count. */
7065
 
    c = &ovsrec_interface_col_cfm_flap_count;
7066
 
    c->name = "cfm_flap_count";
7067
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7068
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7069
 
    c->type.n_min = 0;
7070
 
    c->type.n_max = 1;
7071
 
    c->mutable = true;
7072
 
    c->parse = ovsrec_interface_parse_cfm_flap_count;
7073
 
    c->unparse = ovsrec_interface_unparse_cfm_flap_count;
7074
 
 
7075
 
    /* Initialize ovsrec_interface_col_cfm_health. */
7076
 
    c = &ovsrec_interface_col_cfm_health;
7077
 
    c->name = "cfm_health";
7078
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7079
 
    c->type.key.u.integer.min = INT64_C(0);
7080
 
    c->type.key.u.integer.max = INT64_C(100);
7081
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7082
 
    c->type.n_min = 0;
7083
 
    c->type.n_max = 1;
7084
 
    c->mutable = true;
7085
 
    c->parse = ovsrec_interface_parse_cfm_health;
7086
 
    c->unparse = ovsrec_interface_unparse_cfm_health;
7087
 
 
7088
 
    /* Initialize ovsrec_interface_col_cfm_mpid. */
7089
 
    c = &ovsrec_interface_col_cfm_mpid;
7090
 
    c->name = "cfm_mpid";
7091
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7092
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7093
 
    c->type.n_min = 0;
7094
 
    c->type.n_max = 1;
7095
 
    c->mutable = true;
7096
 
    c->parse = ovsrec_interface_parse_cfm_mpid;
7097
 
    c->unparse = ovsrec_interface_unparse_cfm_mpid;
7098
 
 
7099
 
    /* Initialize ovsrec_interface_col_cfm_remote_mpids. */
7100
 
    c = &ovsrec_interface_col_cfm_remote_mpids;
7101
 
    c->name = "cfm_remote_mpids";
7102
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7103
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7104
 
    c->type.n_min = 0;
7105
 
    c->type.n_max = UINT_MAX;
7106
 
    c->mutable = true;
7107
 
    c->parse = ovsrec_interface_parse_cfm_remote_mpids;
7108
 
    c->unparse = ovsrec_interface_unparse_cfm_remote_mpids;
7109
 
 
7110
 
    /* Initialize ovsrec_interface_col_cfm_remote_opstate. */
7111
 
    c = &ovsrec_interface_col_cfm_remote_opstate;
7112
 
    c->name = "cfm_remote_opstate";
7113
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7114
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
7115
 
    c->type.key.enum_->n = 2;
7116
 
    c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
7117
 
    c->type.key.enum_->keys[0].string = xstrdup("down");
7118
 
    c->type.key.enum_->keys[1].string = xstrdup("up");
7119
 
    c->type.key.enum_->values = NULL;
7120
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
7121
 
    c->type.key.u.string.minLen = 0;
7122
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7123
 
    c->type.n_min = 0;
7124
 
    c->type.n_max = 1;
7125
 
    c->mutable = true;
7126
 
    c->parse = ovsrec_interface_parse_cfm_remote_opstate;
7127
 
    c->unparse = ovsrec_interface_unparse_cfm_remote_opstate;
7128
 
 
7129
 
    /* Initialize ovsrec_interface_col_duplex. */
7130
 
    c = &ovsrec_interface_col_duplex;
7131
 
    c->name = "duplex";
7132
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7133
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
7134
 
    c->type.key.enum_->n = 2;
7135
 
    c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
7136
 
    c->type.key.enum_->keys[0].string = xstrdup("full");
7137
 
    c->type.key.enum_->keys[1].string = xstrdup("half");
7138
 
    c->type.key.enum_->values = NULL;
7139
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
7140
 
    c->type.key.u.string.minLen = 0;
7141
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7142
 
    c->type.n_min = 0;
7143
 
    c->type.n_max = 1;
7144
 
    c->mutable = true;
7145
 
    c->parse = ovsrec_interface_parse_duplex;
7146
 
    c->unparse = ovsrec_interface_unparse_duplex;
7147
 
 
7148
 
    /* Initialize ovsrec_interface_col_external_ids. */
7149
 
    c = &ovsrec_interface_col_external_ids;
7150
 
    c->name = "external_ids";
7151
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7152
 
    c->type.key.u.string.minLen = 0;
7153
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7154
 
    c->type.value.u.string.minLen = 0;
7155
 
    c->type.n_min = 0;
7156
 
    c->type.n_max = UINT_MAX;
7157
 
    c->mutable = true;
7158
 
    c->parse = ovsrec_interface_parse_external_ids;
7159
 
    c->unparse = ovsrec_interface_unparse_external_ids;
7160
 
 
7161
 
    /* Initialize ovsrec_interface_col_ifindex. */
7162
 
    c = &ovsrec_interface_col_ifindex;
7163
 
    c->name = "ifindex";
7164
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7165
 
    c->type.key.u.integer.min = INT64_C(0);
7166
 
    c->type.key.u.integer.max = INT64_C(4294967295);
7167
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7168
 
    c->type.n_min = 0;
7169
 
    c->type.n_max = 1;
7170
 
    c->mutable = true;
7171
 
    c->parse = ovsrec_interface_parse_ifindex;
7172
 
    c->unparse = ovsrec_interface_unparse_ifindex;
7173
 
 
7174
 
    /* Initialize ovsrec_interface_col_ingress_policing_burst. */
7175
 
    c = &ovsrec_interface_col_ingress_policing_burst;
7176
 
    c->name = "ingress_policing_burst";
7177
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7178
 
    c->type.key.u.integer.min = INT64_C(0);
7179
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7180
 
    c->type.n_min = 1;
7181
 
    c->type.n_max = 1;
7182
 
    c->mutable = true;
7183
 
    c->parse = ovsrec_interface_parse_ingress_policing_burst;
7184
 
    c->unparse = ovsrec_interface_unparse_ingress_policing_burst;
7185
 
 
7186
 
    /* Initialize ovsrec_interface_col_ingress_policing_rate. */
7187
 
    c = &ovsrec_interface_col_ingress_policing_rate;
7188
 
    c->name = "ingress_policing_rate";
7189
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7190
 
    c->type.key.u.integer.min = INT64_C(0);
7191
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7192
 
    c->type.n_min = 1;
7193
 
    c->type.n_max = 1;
7194
 
    c->mutable = true;
7195
 
    c->parse = ovsrec_interface_parse_ingress_policing_rate;
7196
 
    c->unparse = ovsrec_interface_unparse_ingress_policing_rate;
7197
 
 
7198
 
    /* Initialize ovsrec_interface_col_lacp_current. */
7199
 
    c = &ovsrec_interface_col_lacp_current;
7200
 
    c->name = "lacp_current";
7201
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
7202
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7203
 
    c->type.n_min = 0;
7204
 
    c->type.n_max = 1;
7205
 
    c->mutable = true;
7206
 
    c->parse = ovsrec_interface_parse_lacp_current;
7207
 
    c->unparse = ovsrec_interface_unparse_lacp_current;
7208
 
 
7209
 
    /* Initialize ovsrec_interface_col_link_resets. */
7210
 
    c = &ovsrec_interface_col_link_resets;
7211
 
    c->name = "link_resets";
7212
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7213
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7214
 
    c->type.n_min = 0;
7215
 
    c->type.n_max = 1;
7216
 
    c->mutable = true;
7217
 
    c->parse = ovsrec_interface_parse_link_resets;
7218
 
    c->unparse = ovsrec_interface_unparse_link_resets;
7219
 
 
7220
 
    /* Initialize ovsrec_interface_col_link_speed. */
7221
 
    c = &ovsrec_interface_col_link_speed;
7222
 
    c->name = "link_speed";
7223
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7224
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7225
 
    c->type.n_min = 0;
7226
 
    c->type.n_max = 1;
7227
 
    c->mutable = true;
7228
 
    c->parse = ovsrec_interface_parse_link_speed;
7229
 
    c->unparse = ovsrec_interface_unparse_link_speed;
7230
 
 
7231
 
    /* Initialize ovsrec_interface_col_link_state. */
7232
 
    c = &ovsrec_interface_col_link_state;
7233
 
    c->name = "link_state";
7234
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7235
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
7236
 
    c->type.key.enum_->n = 2;
7237
 
    c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
7238
 
    c->type.key.enum_->keys[0].string = xstrdup("down");
7239
 
    c->type.key.enum_->keys[1].string = xstrdup("up");
7240
 
    c->type.key.enum_->values = NULL;
7241
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
7242
 
    c->type.key.u.string.minLen = 0;
7243
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7244
 
    c->type.n_min = 0;
7245
 
    c->type.n_max = 1;
7246
 
    c->mutable = true;
7247
 
    c->parse = ovsrec_interface_parse_link_state;
7248
 
    c->unparse = ovsrec_interface_unparse_link_state;
7249
 
 
7250
 
    /* Initialize ovsrec_interface_col_mac. */
7251
 
    c = &ovsrec_interface_col_mac;
7252
 
    c->name = "mac";
7253
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7254
 
    c->type.key.u.string.minLen = 0;
7255
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7256
 
    c->type.n_min = 0;
7257
 
    c->type.n_max = 1;
7258
 
    c->mutable = true;
7259
 
    c->parse = ovsrec_interface_parse_mac;
7260
 
    c->unparse = ovsrec_interface_unparse_mac;
7261
 
 
7262
 
    /* Initialize ovsrec_interface_col_mac_in_use. */
7263
 
    c = &ovsrec_interface_col_mac_in_use;
7264
 
    c->name = "mac_in_use";
7265
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7266
 
    c->type.key.u.string.minLen = 0;
7267
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7268
 
    c->type.n_min = 0;
7269
 
    c->type.n_max = 1;
7270
 
    c->mutable = true;
7271
 
    c->parse = ovsrec_interface_parse_mac_in_use;
7272
 
    c->unparse = ovsrec_interface_unparse_mac_in_use;
7273
 
 
7274
 
    /* Initialize ovsrec_interface_col_mtu. */
7275
 
    c = &ovsrec_interface_col_mtu;
7276
 
    c->name = "mtu";
7277
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7278
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7279
 
    c->type.n_min = 0;
7280
 
    c->type.n_max = 1;
7281
 
    c->mutable = true;
7282
 
    c->parse = ovsrec_interface_parse_mtu;
7283
 
    c->unparse = ovsrec_interface_unparse_mtu;
7284
 
 
7285
 
    /* Initialize ovsrec_interface_col_name. */
7286
 
    c = &ovsrec_interface_col_name;
7287
 
    c->name = "name";
7288
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7289
 
    c->type.key.u.string.minLen = 0;
7290
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7291
 
    c->type.n_min = 1;
7292
 
    c->type.n_max = 1;
7293
 
    c->mutable = false;
7294
 
    c->parse = ovsrec_interface_parse_name;
7295
 
    c->unparse = ovsrec_interface_unparse_name;
7296
 
 
7297
 
    /* Initialize ovsrec_interface_col_ofport. */
7298
 
    c = &ovsrec_interface_col_ofport;
7299
 
    c->name = "ofport";
7300
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7301
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7302
 
    c->type.n_min = 0;
7303
 
    c->type.n_max = 1;
7304
 
    c->mutable = true;
7305
 
    c->parse = ovsrec_interface_parse_ofport;
7306
 
    c->unparse = ovsrec_interface_unparse_ofport;
7307
 
 
7308
 
    /* Initialize ovsrec_interface_col_ofport_request. */
7309
 
    c = &ovsrec_interface_col_ofport_request;
7310
 
    c->name = "ofport_request";
7311
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
7312
 
    c->type.key.u.integer.min = INT64_C(1);
7313
 
    c->type.key.u.integer.max = INT64_C(65279);
7314
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7315
 
    c->type.n_min = 0;
7316
 
    c->type.n_max = 1;
7317
 
    c->mutable = true;
7318
 
    c->parse = ovsrec_interface_parse_ofport_request;
7319
 
    c->unparse = ovsrec_interface_unparse_ofport_request;
7320
 
 
7321
 
    /* Initialize ovsrec_interface_col_options. */
7322
 
    c = &ovsrec_interface_col_options;
7323
 
    c->name = "options";
7324
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7325
 
    c->type.key.u.string.minLen = 0;
7326
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7327
 
    c->type.value.u.string.minLen = 0;
7328
 
    c->type.n_min = 0;
7329
 
    c->type.n_max = UINT_MAX;
7330
 
    c->mutable = true;
7331
 
    c->parse = ovsrec_interface_parse_options;
7332
 
    c->unparse = ovsrec_interface_unparse_options;
7333
 
 
7334
 
    /* Initialize ovsrec_interface_col_other_config. */
7335
 
    c = &ovsrec_interface_col_other_config;
7336
 
    c->name = "other_config";
7337
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7338
 
    c->type.key.u.string.minLen = 0;
7339
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7340
 
    c->type.value.u.string.minLen = 0;
7341
 
    c->type.n_min = 0;
7342
 
    c->type.n_max = UINT_MAX;
7343
 
    c->mutable = true;
7344
 
    c->parse = ovsrec_interface_parse_other_config;
7345
 
    c->unparse = ovsrec_interface_unparse_other_config;
7346
 
 
7347
 
    /* Initialize ovsrec_interface_col_statistics. */
7348
 
    c = &ovsrec_interface_col_statistics;
7349
 
    c->name = "statistics";
7350
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7351
 
    c->type.key.u.string.minLen = 0;
7352
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_INTEGER);
7353
 
    c->type.n_min = 0;
7354
 
    c->type.n_max = UINT_MAX;
7355
 
    c->mutable = true;
7356
 
    c->parse = ovsrec_interface_parse_statistics;
7357
 
    c->unparse = ovsrec_interface_unparse_statistics;
7358
 
 
7359
 
    /* Initialize ovsrec_interface_col_status. */
7360
 
    c = &ovsrec_interface_col_status;
7361
 
    c->name = "status";
7362
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7363
 
    c->type.key.u.string.minLen = 0;
7364
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
7365
 
    c->type.value.u.string.minLen = 0;
7366
 
    c->type.n_min = 0;
7367
 
    c->type.n_max = UINT_MAX;
7368
 
    c->mutable = true;
7369
 
    c->parse = ovsrec_interface_parse_status;
7370
 
    c->unparse = ovsrec_interface_unparse_status;
7371
 
 
7372
 
    /* Initialize ovsrec_interface_col_type. */
7373
 
    c = &ovsrec_interface_col_type;
7374
 
    c->name = "type";
7375
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
7376
 
    c->type.key.u.string.minLen = 0;
7377
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
7378
 
    c->type.n_min = 1;
7379
 
    c->type.n_max = 1;
7380
 
    c->mutable = true;
7381
 
    c->parse = ovsrec_interface_parse_type;
7382
 
    c->unparse = ovsrec_interface_unparse_type;
7383
 
}
7384
 
 
7385
 
/* Manager table. */
7386
 
 
7387
 
static void
7388
 
ovsrec_manager_parse_connection_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7389
 
{
7390
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7391
 
 
7392
 
    ovs_assert(inited);
7393
 
    if (datum->n >= 1) {
7394
 
        row->connection_mode = datum->keys[0].string;
7395
 
    } else {
7396
 
        row->connection_mode = NULL;
7397
 
    }
7398
 
}
7399
 
 
7400
 
static void
7401
 
ovsrec_manager_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7402
 
{
7403
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7404
 
    size_t i;
7405
 
 
7406
 
    ovs_assert(inited);
7407
 
    smap_init(&row->external_ids);
7408
 
    for (i = 0; i < datum->n; i++) {
7409
 
        smap_add(&row->external_ids,
7410
 
                 datum->keys[i].string,
7411
 
                 datum->values[i].string);
7412
 
    }
7413
 
}
7414
 
 
7415
 
static void
7416
 
ovsrec_manager_parse_inactivity_probe(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7417
 
{
7418
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7419
 
    size_t n = MIN(1, datum->n);
7420
 
    size_t i;
7421
 
 
7422
 
    ovs_assert(inited);
7423
 
    row->inactivity_probe = NULL;
7424
 
    row->n_inactivity_probe = 0;
7425
 
    for (i = 0; i < n; i++) {
7426
 
        if (!row->n_inactivity_probe) {
7427
 
            row->inactivity_probe = xmalloc(n * sizeof *row->inactivity_probe);
7428
 
        }
7429
 
        row->inactivity_probe[row->n_inactivity_probe] = datum->keys[i].integer;
7430
 
        row->n_inactivity_probe++;
7431
 
    }
7432
 
}
7433
 
 
7434
 
static void
7435
 
ovsrec_manager_parse_is_connected(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7436
 
{
7437
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7438
 
 
7439
 
    ovs_assert(inited);
7440
 
    if (datum->n >= 1) {
7441
 
        row->is_connected = datum->keys[0].boolean;
7442
 
    } else {
7443
 
        row->is_connected = false;
7444
 
    }
7445
 
}
7446
 
 
7447
 
static void
7448
 
ovsrec_manager_parse_max_backoff(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7449
 
{
7450
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7451
 
    size_t n = MIN(1, datum->n);
7452
 
    size_t i;
7453
 
 
7454
 
    ovs_assert(inited);
7455
 
    row->max_backoff = NULL;
7456
 
    row->n_max_backoff = 0;
7457
 
    for (i = 0; i < n; i++) {
7458
 
        if (!row->n_max_backoff) {
7459
 
            row->max_backoff = xmalloc(n * sizeof *row->max_backoff);
7460
 
        }
7461
 
        row->max_backoff[row->n_max_backoff] = datum->keys[i].integer;
7462
 
        row->n_max_backoff++;
7463
 
    }
7464
 
}
7465
 
 
7466
 
static void
7467
 
ovsrec_manager_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7468
 
{
7469
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7470
 
    size_t i;
7471
 
 
7472
 
    ovs_assert(inited);
7473
 
    smap_init(&row->other_config);
7474
 
    for (i = 0; i < datum->n; i++) {
7475
 
        smap_add(&row->other_config,
7476
 
                 datum->keys[i].string,
7477
 
                 datum->values[i].string);
7478
 
    }
7479
 
}
7480
 
 
7481
 
static void
7482
 
ovsrec_manager_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7483
 
{
7484
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7485
 
    size_t i;
7486
 
 
7487
 
    ovs_assert(inited);
7488
 
    smap_init(&row->status);
7489
 
    for (i = 0; i < datum->n; i++) {
7490
 
        smap_add(&row->status,
7491
 
                 datum->keys[i].string,
7492
 
                 datum->values[i].string);
7493
 
    }
7494
 
}
7495
 
 
7496
 
static void
7497
 
ovsrec_manager_parse_target(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
7498
 
{
7499
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7500
 
 
7501
 
    ovs_assert(inited);
7502
 
    if (datum->n >= 1) {
7503
 
        row->target = datum->keys[0].string;
7504
 
    } else {
7505
 
        row->target = "";
7506
 
    }
7507
 
}
7508
 
 
7509
 
static void
7510
 
ovsrec_manager_unparse_connection_mode(struct ovsdb_idl_row *row OVS_UNUSED)
7511
 
{
7512
 
    /* Nothing to do. */
7513
 
}
7514
 
 
7515
 
static void
7516
 
ovsrec_manager_unparse_external_ids(struct ovsdb_idl_row *row_)
7517
 
{
7518
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7519
 
 
7520
 
    ovs_assert(inited);
7521
 
    smap_destroy(&row->external_ids);
7522
 
}
7523
 
 
7524
 
static void
7525
 
ovsrec_manager_unparse_inactivity_probe(struct ovsdb_idl_row *row_)
7526
 
{
7527
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7528
 
 
7529
 
    ovs_assert(inited);
7530
 
    free(row->inactivity_probe);
7531
 
}
7532
 
 
7533
 
static void
7534
 
ovsrec_manager_unparse_is_connected(struct ovsdb_idl_row *row OVS_UNUSED)
7535
 
{
7536
 
    /* Nothing to do. */
7537
 
}
7538
 
 
7539
 
static void
7540
 
ovsrec_manager_unparse_max_backoff(struct ovsdb_idl_row *row_)
7541
 
{
7542
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7543
 
 
7544
 
    ovs_assert(inited);
7545
 
    free(row->max_backoff);
7546
 
}
7547
 
 
7548
 
static void
7549
 
ovsrec_manager_unparse_other_config(struct ovsdb_idl_row *row_)
7550
 
{
7551
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7552
 
 
7553
 
    ovs_assert(inited);
7554
 
    smap_destroy(&row->other_config);
7555
 
}
7556
 
 
7557
 
static void
7558
 
ovsrec_manager_unparse_status(struct ovsdb_idl_row *row_)
7559
 
{
7560
 
    struct ovsrec_manager *row = ovsrec_manager_cast(row_);
7561
 
 
7562
 
    ovs_assert(inited);
7563
 
    smap_destroy(&row->status);
7564
 
}
7565
 
 
7566
 
static void
7567
 
ovsrec_manager_unparse_target(struct ovsdb_idl_row *row OVS_UNUSED)
7568
 
{
7569
 
    /* Nothing to do. */
7570
 
}
7571
 
 
7572
 
static void
7573
 
ovsrec_manager_init__(struct ovsdb_idl_row *row)
7574
 
{
7575
 
    ovsrec_manager_init(ovsrec_manager_cast(row));
7576
 
}
7577
 
 
7578
 
void
7579
 
ovsrec_manager_init(struct ovsrec_manager *row)
7580
 
{
7581
 
    memset(row, 0, sizeof *row); 
7582
 
    smap_init(&row->external_ids);
7583
 
    smap_init(&row->other_config);
7584
 
    smap_init(&row->status);
7585
 
}
7586
 
 
7587
 
const struct ovsrec_manager *
7588
 
ovsrec_manager_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
7589
 
{
7590
 
    return ovsrec_manager_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_MANAGER], uuid));
7591
 
}
7592
 
 
7593
 
const struct ovsrec_manager *
7594
 
ovsrec_manager_first(const struct ovsdb_idl *idl)
7595
 
{
7596
 
    return ovsrec_manager_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_MANAGER]));
7597
 
}
7598
 
 
7599
 
const struct ovsrec_manager *
7600
 
ovsrec_manager_next(const struct ovsrec_manager *row)
7601
 
{
7602
 
    return ovsrec_manager_cast(ovsdb_idl_next_row(&row->header_));
7603
 
}
7604
 
 
7605
 
void
7606
 
ovsrec_manager_delete(const struct ovsrec_manager *row)
7607
 
{
7608
 
    ovsdb_idl_txn_delete(&row->header_);
7609
 
}
7610
 
 
7611
 
struct ovsrec_manager *
7612
 
ovsrec_manager_insert(struct ovsdb_idl_txn *txn)
7613
 
{
7614
 
    return ovsrec_manager_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_MANAGER], NULL));
7615
 
}
7616
 
 
7617
 
 
7618
 
void
7619
 
ovsrec_manager_verify_connection_mode(const struct ovsrec_manager *row)
7620
 
{
7621
 
    ovs_assert(inited);
7622
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_CONNECTION_MODE]);
7623
 
}
7624
 
 
7625
 
void
7626
 
ovsrec_manager_verify_external_ids(const struct ovsrec_manager *row)
7627
 
{
7628
 
    ovs_assert(inited);
7629
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_EXTERNAL_IDS]);
7630
 
}
7631
 
 
7632
 
void
7633
 
ovsrec_manager_verify_inactivity_probe(const struct ovsrec_manager *row)
7634
 
{
7635
 
    ovs_assert(inited);
7636
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_INACTIVITY_PROBE]);
7637
 
}
7638
 
 
7639
 
void
7640
 
ovsrec_manager_verify_is_connected(const struct ovsrec_manager *row)
7641
 
{
7642
 
    ovs_assert(inited);
7643
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_IS_CONNECTED]);
7644
 
}
7645
 
 
7646
 
void
7647
 
ovsrec_manager_verify_max_backoff(const struct ovsrec_manager *row)
7648
 
{
7649
 
    ovs_assert(inited);
7650
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_MAX_BACKOFF]);
7651
 
}
7652
 
 
7653
 
void
7654
 
ovsrec_manager_verify_other_config(const struct ovsrec_manager *row)
7655
 
{
7656
 
    ovs_assert(inited);
7657
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_OTHER_CONFIG]);
7658
 
}
7659
 
 
7660
 
void
7661
 
ovsrec_manager_verify_status(const struct ovsrec_manager *row)
7662
 
{
7663
 
    ovs_assert(inited);
7664
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_STATUS]);
7665
 
}
7666
 
 
7667
 
void
7668
 
ovsrec_manager_verify_target(const struct ovsrec_manager *row)
7669
 
{
7670
 
    ovs_assert(inited);
7671
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_TARGET]);
7672
 
}
7673
 
 
7674
 
/* Returns the connection_mode column's value in 'row' as a struct ovsdb_datum.
7675
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
7676
 
 * easier and more efficient way to search for a given key than implementing
7677
 
 * the same operation on the "cooked" form in 'row'.
7678
 
 *
7679
 
 * 'key_type' must be OVSDB_TYPE_STRING.
7680
 
 * (This helps to avoid silent bugs if someone changes connection_mode's
7681
 
 * type without updating the caller.)
7682
 
 *
7683
 
 * The caller must not modify or free the returned value.
7684
 
 *
7685
 
 * Various kinds of changes can invalidate the returned value: modifying
7686
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7687
 
 * If the returned value is needed for a long time, it is best to make a copy
7688
 
 * of it with ovsdb_datum_clone(). */
7689
 
const struct ovsdb_datum *
7690
 
ovsrec_manager_get_connection_mode(const struct ovsrec_manager *row,
7691
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
7692
 
{
7693
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
7694
 
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_connection_mode);
7695
 
}
7696
 
 
7697
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
7698
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
7699
 
 * easier and more efficient way to search for a given key than implementing
7700
 
 * the same operation on the "cooked" form in 'row'.
7701
 
 *
7702
 
 * 'key_type' must be OVSDB_TYPE_STRING.
7703
 
 * 'value_type' must be OVSDB_TYPE_STRING.
7704
 
 * (This helps to avoid silent bugs if someone changes external_ids's
7705
 
 * type without updating the caller.)
7706
 
 *
7707
 
 * The caller must not modify or free the returned value.
7708
 
 *
7709
 
 * Various kinds of changes can invalidate the returned value: modifying
7710
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7711
 
 * If the returned value is needed for a long time, it is best to make a copy
7712
 
 * of it with ovsdb_datum_clone(). */
7713
 
const struct ovsdb_datum *
7714
 
ovsrec_manager_get_external_ids(const struct ovsrec_manager *row,
7715
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
7716
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
7717
 
{
7718
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
7719
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
7720
 
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_external_ids);
7721
 
}
7722
 
 
7723
 
/* Returns the inactivity_probe column's value in 'row' as a struct ovsdb_datum.
7724
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
7725
 
 * easier and more efficient way to search for a given key than implementing
7726
 
 * the same operation on the "cooked" form in 'row'.
7727
 
 *
7728
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
7729
 
 * (This helps to avoid silent bugs if someone changes inactivity_probe's
7730
 
 * type without updating the caller.)
7731
 
 *
7732
 
 * The caller must not modify or free the returned value.
7733
 
 *
7734
 
 * Various kinds of changes can invalidate the returned value: modifying
7735
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7736
 
 * If the returned value is needed for a long time, it is best to make a copy
7737
 
 * of it with ovsdb_datum_clone(). */
7738
 
const struct ovsdb_datum *
7739
 
ovsrec_manager_get_inactivity_probe(const struct ovsrec_manager *row,
7740
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
7741
 
{
7742
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
7743
 
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_inactivity_probe);
7744
 
}
7745
 
 
7746
 
/* Returns the is_connected column's value in 'row' as a struct ovsdb_datum.
7747
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
7748
 
 * easier and more efficient way to search for a given key than implementing
7749
 
 * the same operation on the "cooked" form in 'row'.
7750
 
 *
7751
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
7752
 
 * (This helps to avoid silent bugs if someone changes is_connected's
7753
 
 * type without updating the caller.)
7754
 
 *
7755
 
 * The caller must not modify or free the returned value.
7756
 
 *
7757
 
 * Various kinds of changes can invalidate the returned value: modifying
7758
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7759
 
 * If the returned value is needed for a long time, it is best to make a copy
7760
 
 * of it with ovsdb_datum_clone(). */
7761
 
const struct ovsdb_datum *
7762
 
ovsrec_manager_get_is_connected(const struct ovsrec_manager *row,
7763
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
7764
 
{
7765
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
7766
 
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_is_connected);
7767
 
}
7768
 
 
7769
 
/* Returns the max_backoff column's value in 'row' as a struct ovsdb_datum.
7770
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
7771
 
 * easier and more efficient way to search for a given key than implementing
7772
 
 * the same operation on the "cooked" form in 'row'.
7773
 
 *
7774
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
7775
 
 * (This helps to avoid silent bugs if someone changes max_backoff's
7776
 
 * type without updating the caller.)
7777
 
 *
7778
 
 * The caller must not modify or free the returned value.
7779
 
 *
7780
 
 * Various kinds of changes can invalidate the returned value: modifying
7781
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7782
 
 * If the returned value is needed for a long time, it is best to make a copy
7783
 
 * of it with ovsdb_datum_clone(). */
7784
 
const struct ovsdb_datum *
7785
 
ovsrec_manager_get_max_backoff(const struct ovsrec_manager *row,
7786
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
7787
 
{
7788
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
7789
 
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_max_backoff);
7790
 
}
7791
 
 
7792
 
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
7793
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
7794
 
 * easier and more efficient way to search for a given key than implementing
7795
 
 * the same operation on the "cooked" form in 'row'.
7796
 
 *
7797
 
 * 'key_type' must be OVSDB_TYPE_STRING.
7798
 
 * 'value_type' must be OVSDB_TYPE_STRING.
7799
 
 * (This helps to avoid silent bugs if someone changes other_config's
7800
 
 * type without updating the caller.)
7801
 
 *
7802
 
 * The caller must not modify or free the returned value.
7803
 
 *
7804
 
 * Various kinds of changes can invalidate the returned value: modifying
7805
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7806
 
 * If the returned value is needed for a long time, it is best to make a copy
7807
 
 * of it with ovsdb_datum_clone(). */
7808
 
const struct ovsdb_datum *
7809
 
ovsrec_manager_get_other_config(const struct ovsrec_manager *row,
7810
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
7811
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
7812
 
{
7813
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
7814
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
7815
 
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_other_config);
7816
 
}
7817
 
 
7818
 
/* Returns the status column's value in 'row' as a struct ovsdb_datum.
7819
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
7820
 
 * easier and more efficient way to search for a given key than implementing
7821
 
 * the same operation on the "cooked" form in 'row'.
7822
 
 *
7823
 
 * 'key_type' must be OVSDB_TYPE_STRING.
7824
 
 * 'value_type' must be OVSDB_TYPE_STRING.
7825
 
 * (This helps to avoid silent bugs if someone changes status's
7826
 
 * type without updating the caller.)
7827
 
 *
7828
 
 * The caller must not modify or free the returned value.
7829
 
 *
7830
 
 * Various kinds of changes can invalidate the returned value: modifying
7831
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7832
 
 * If the returned value is needed for a long time, it is best to make a copy
7833
 
 * of it with ovsdb_datum_clone(). */
7834
 
const struct ovsdb_datum *
7835
 
ovsrec_manager_get_status(const struct ovsrec_manager *row,
7836
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
7837
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
7838
 
{
7839
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
7840
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
7841
 
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_status);
7842
 
}
7843
 
 
7844
 
/* Returns the target column's value in 'row' as a struct ovsdb_datum.
7845
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
7846
 
 * easier and more efficient way to search for a given key than implementing
7847
 
 * the same operation on the "cooked" form in 'row'.
7848
 
 *
7849
 
 * 'key_type' must be OVSDB_TYPE_STRING.
7850
 
 * (This helps to avoid silent bugs if someone changes target's
7851
 
 * type without updating the caller.)
7852
 
 *
7853
 
 * The caller must not modify or free the returned value.
7854
 
 *
7855
 
 * Various kinds of changes can invalidate the returned value: modifying
7856
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
7857
 
 * If the returned value is needed for a long time, it is best to make a copy
7858
 
 * of it with ovsdb_datum_clone(). */
7859
 
const struct ovsdb_datum *
7860
 
ovsrec_manager_get_target(const struct ovsrec_manager *row,
7861
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
7862
 
{
7863
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
7864
 
    return ovsdb_idl_read(&row->header_, &ovsrec_manager_col_target);
7865
 
}
7866
 
 
7867
 
void
7868
 
ovsrec_manager_set_connection_mode(const struct ovsrec_manager *row, const char *connection_mode)
7869
 
{
7870
 
    struct ovsdb_datum datum;
7871
 
    union ovsdb_atom key;
7872
 
 
7873
 
    ovs_assert(inited);
7874
 
    if (connection_mode) {
7875
 
        datum.n = 1;
7876
 
        datum.keys = &key;
7877
 
        key.string = CONST_CAST(char *, connection_mode);
7878
 
    } else {
7879
 
        datum.n = 0;
7880
 
        datum.keys = NULL;
7881
 
    }
7882
 
    datum.values = NULL;
7883
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_CONNECTION_MODE], &datum);
7884
 
}
7885
 
 
7886
 
void
7887
 
ovsrec_manager_set_external_ids(const struct ovsrec_manager *row, const struct smap *smap)
7888
 
{
7889
 
    struct ovsdb_datum datum;
7890
 
 
7891
 
    ovs_assert(inited);
7892
 
    if (smap) {
7893
 
        struct smap_node *node;
7894
 
        size_t i;
7895
 
 
7896
 
        datum.n = smap_count(smap);
7897
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
7898
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
7899
 
 
7900
 
        i = 0;
7901
 
        SMAP_FOR_EACH (node, smap) {
7902
 
            datum.keys[i].string = xstrdup(node->key);
7903
 
            datum.values[i].string = xstrdup(node->value);
7904
 
            i++;
7905
 
        }
7906
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
7907
 
    } else {
7908
 
        ovsdb_datum_init_empty(&datum);
7909
 
    }
7910
 
    ovsdb_idl_txn_write(&row->header_,
7911
 
                        &ovsrec_manager_columns[OVSREC_MANAGER_COL_EXTERNAL_IDS],
7912
 
                        &datum);
7913
 
}
7914
 
 
7915
 
 
7916
 
void
7917
 
ovsrec_manager_set_inactivity_probe(const struct ovsrec_manager *row, const int64_t *inactivity_probe, size_t n_inactivity_probe)
7918
 
{
7919
 
    struct ovsdb_datum datum;
7920
 
    union ovsdb_atom key;
7921
 
 
7922
 
    ovs_assert(inited);
7923
 
    if (n_inactivity_probe) {
7924
 
        datum.n = 1;
7925
 
        datum.keys = &key;
7926
 
        key.integer = *inactivity_probe;
7927
 
    } else {
7928
 
        datum.n = 0;
7929
 
        datum.keys = NULL;
7930
 
    }
7931
 
    datum.values = NULL;
7932
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_INACTIVITY_PROBE], &datum);
7933
 
}
7934
 
 
7935
 
void
7936
 
ovsrec_manager_set_is_connected(const struct ovsrec_manager *row, bool is_connected)
7937
 
{
7938
 
    struct ovsdb_datum datum;
7939
 
    union ovsdb_atom key;
7940
 
 
7941
 
    ovs_assert(inited);
7942
 
    datum.n = 1;
7943
 
    datum.keys = &key;
7944
 
    key.boolean = is_connected;
7945
 
    datum.values = NULL;
7946
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_IS_CONNECTED], &datum);
7947
 
}
7948
 
 
7949
 
void
7950
 
ovsrec_manager_set_max_backoff(const struct ovsrec_manager *row, const int64_t *max_backoff, size_t n_max_backoff)
7951
 
{
7952
 
    struct ovsdb_datum datum;
7953
 
    union ovsdb_atom key;
7954
 
 
7955
 
    ovs_assert(inited);
7956
 
    if (n_max_backoff) {
7957
 
        datum.n = 1;
7958
 
        datum.keys = &key;
7959
 
        key.integer = *max_backoff;
7960
 
    } else {
7961
 
        datum.n = 0;
7962
 
        datum.keys = NULL;
7963
 
    }
7964
 
    datum.values = NULL;
7965
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_MAX_BACKOFF], &datum);
7966
 
}
7967
 
 
7968
 
void
7969
 
ovsrec_manager_set_other_config(const struct ovsrec_manager *row, const struct smap *smap)
7970
 
{
7971
 
    struct ovsdb_datum datum;
7972
 
 
7973
 
    ovs_assert(inited);
7974
 
    if (smap) {
7975
 
        struct smap_node *node;
7976
 
        size_t i;
7977
 
 
7978
 
        datum.n = smap_count(smap);
7979
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
7980
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
7981
 
 
7982
 
        i = 0;
7983
 
        SMAP_FOR_EACH (node, smap) {
7984
 
            datum.keys[i].string = xstrdup(node->key);
7985
 
            datum.values[i].string = xstrdup(node->value);
7986
 
            i++;
7987
 
        }
7988
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
7989
 
    } else {
7990
 
        ovsdb_datum_init_empty(&datum);
7991
 
    }
7992
 
    ovsdb_idl_txn_write(&row->header_,
7993
 
                        &ovsrec_manager_columns[OVSREC_MANAGER_COL_OTHER_CONFIG],
7994
 
                        &datum);
7995
 
}
7996
 
 
7997
 
 
7998
 
void
7999
 
ovsrec_manager_set_status(const struct ovsrec_manager *row, const struct smap *smap)
8000
 
{
8001
 
    struct ovsdb_datum datum;
8002
 
 
8003
 
    ovs_assert(inited);
8004
 
    if (smap) {
8005
 
        struct smap_node *node;
8006
 
        size_t i;
8007
 
 
8008
 
        datum.n = smap_count(smap);
8009
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8010
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
8011
 
 
8012
 
        i = 0;
8013
 
        SMAP_FOR_EACH (node, smap) {
8014
 
            datum.keys[i].string = xstrdup(node->key);
8015
 
            datum.values[i].string = xstrdup(node->value);
8016
 
            i++;
8017
 
        }
8018
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8019
 
    } else {
8020
 
        ovsdb_datum_init_empty(&datum);
8021
 
    }
8022
 
    ovsdb_idl_txn_write(&row->header_,
8023
 
                        &ovsrec_manager_columns[OVSREC_MANAGER_COL_STATUS],
8024
 
                        &datum);
8025
 
}
8026
 
 
8027
 
 
8028
 
void
8029
 
ovsrec_manager_set_target(const struct ovsrec_manager *row, const char *target)
8030
 
{
8031
 
    struct ovsdb_datum datum;
8032
 
    union ovsdb_atom key;
8033
 
 
8034
 
    ovs_assert(inited);
8035
 
    datum.n = 1;
8036
 
    datum.keys = &key;
8037
 
    key.string = CONST_CAST(char *, target);
8038
 
    datum.values = NULL;
8039
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_manager_columns[OVSREC_MANAGER_COL_TARGET], &datum);
8040
 
}
8041
 
 
8042
 
struct ovsdb_idl_column ovsrec_manager_columns[OVSREC_MANAGER_N_COLUMNS];
8043
 
 
8044
 
static void
8045
 
ovsrec_manager_columns_init(void)
8046
 
{
8047
 
    struct ovsdb_idl_column *c;
8048
 
 
8049
 
    /* Initialize ovsrec_manager_col_connection_mode. */
8050
 
    c = &ovsrec_manager_col_connection_mode;
8051
 
    c->name = "connection_mode";
8052
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8053
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
8054
 
    c->type.key.enum_->n = 2;
8055
 
    c->type.key.enum_->keys = xmalloc(2 * sizeof *c->type.key.enum_->keys);
8056
 
    c->type.key.enum_->keys[0].string = xstrdup("in-band");
8057
 
    c->type.key.enum_->keys[1].string = xstrdup("out-of-band");
8058
 
    c->type.key.enum_->values = NULL;
8059
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
8060
 
    c->type.key.u.string.minLen = 0;
8061
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8062
 
    c->type.n_min = 0;
8063
 
    c->type.n_max = 1;
8064
 
    c->mutable = true;
8065
 
    c->parse = ovsrec_manager_parse_connection_mode;
8066
 
    c->unparse = ovsrec_manager_unparse_connection_mode;
8067
 
 
8068
 
    /* Initialize ovsrec_manager_col_external_ids. */
8069
 
    c = &ovsrec_manager_col_external_ids;
8070
 
    c->name = "external_ids";
8071
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8072
 
    c->type.key.u.string.minLen = 0;
8073
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
8074
 
    c->type.value.u.string.minLen = 0;
8075
 
    c->type.n_min = 0;
8076
 
    c->type.n_max = UINT_MAX;
8077
 
    c->mutable = true;
8078
 
    c->parse = ovsrec_manager_parse_external_ids;
8079
 
    c->unparse = ovsrec_manager_unparse_external_ids;
8080
 
 
8081
 
    /* Initialize ovsrec_manager_col_inactivity_probe. */
8082
 
    c = &ovsrec_manager_col_inactivity_probe;
8083
 
    c->name = "inactivity_probe";
8084
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
8085
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8086
 
    c->type.n_min = 0;
8087
 
    c->type.n_max = 1;
8088
 
    c->mutable = true;
8089
 
    c->parse = ovsrec_manager_parse_inactivity_probe;
8090
 
    c->unparse = ovsrec_manager_unparse_inactivity_probe;
8091
 
 
8092
 
    /* Initialize ovsrec_manager_col_is_connected. */
8093
 
    c = &ovsrec_manager_col_is_connected;
8094
 
    c->name = "is_connected";
8095
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
8096
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8097
 
    c->type.n_min = 1;
8098
 
    c->type.n_max = 1;
8099
 
    c->mutable = true;
8100
 
    c->parse = ovsrec_manager_parse_is_connected;
8101
 
    c->unparse = ovsrec_manager_unparse_is_connected;
8102
 
 
8103
 
    /* Initialize ovsrec_manager_col_max_backoff. */
8104
 
    c = &ovsrec_manager_col_max_backoff;
8105
 
    c->name = "max_backoff";
8106
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
8107
 
    c->type.key.u.integer.min = INT64_C(1000);
8108
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8109
 
    c->type.n_min = 0;
8110
 
    c->type.n_max = 1;
8111
 
    c->mutable = true;
8112
 
    c->parse = ovsrec_manager_parse_max_backoff;
8113
 
    c->unparse = ovsrec_manager_unparse_max_backoff;
8114
 
 
8115
 
    /* Initialize ovsrec_manager_col_other_config. */
8116
 
    c = &ovsrec_manager_col_other_config;
8117
 
    c->name = "other_config";
8118
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8119
 
    c->type.key.u.string.minLen = 0;
8120
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
8121
 
    c->type.value.u.string.minLen = 0;
8122
 
    c->type.n_min = 0;
8123
 
    c->type.n_max = UINT_MAX;
8124
 
    c->mutable = true;
8125
 
    c->parse = ovsrec_manager_parse_other_config;
8126
 
    c->unparse = ovsrec_manager_unparse_other_config;
8127
 
 
8128
 
    /* Initialize ovsrec_manager_col_status. */
8129
 
    c = &ovsrec_manager_col_status;
8130
 
    c->name = "status";
8131
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8132
 
    c->type.key.u.string.minLen = 0;
8133
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
8134
 
    c->type.value.u.string.minLen = 0;
8135
 
    c->type.n_min = 0;
8136
 
    c->type.n_max = UINT_MAX;
8137
 
    c->mutable = true;
8138
 
    c->parse = ovsrec_manager_parse_status;
8139
 
    c->unparse = ovsrec_manager_unparse_status;
8140
 
 
8141
 
    /* Initialize ovsrec_manager_col_target. */
8142
 
    c = &ovsrec_manager_col_target;
8143
 
    c->name = "target";
8144
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8145
 
    c->type.key.u.string.minLen = 0;
8146
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8147
 
    c->type.n_min = 1;
8148
 
    c->type.n_max = 1;
8149
 
    c->mutable = true;
8150
 
    c->parse = ovsrec_manager_parse_target;
8151
 
    c->unparse = ovsrec_manager_unparse_target;
8152
 
}
8153
 
 
8154
 
/* Mirror table. */
8155
 
 
8156
 
static void
8157
 
ovsrec_mirror_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8158
 
{
8159
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8160
 
    size_t i;
8161
 
 
8162
 
    ovs_assert(inited);
8163
 
    smap_init(&row->external_ids);
8164
 
    for (i = 0; i < datum->n; i++) {
8165
 
        smap_add(&row->external_ids,
8166
 
                 datum->keys[i].string,
8167
 
                 datum->values[i].string);
8168
 
    }
8169
 
}
8170
 
 
8171
 
static void
8172
 
ovsrec_mirror_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8173
 
{
8174
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8175
 
 
8176
 
    ovs_assert(inited);
8177
 
    if (datum->n >= 1) {
8178
 
        row->name = datum->keys[0].string;
8179
 
    } else {
8180
 
        row->name = "";
8181
 
    }
8182
 
}
8183
 
 
8184
 
static void
8185
 
ovsrec_mirror_parse_output_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8186
 
{
8187
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8188
 
 
8189
 
    ovs_assert(inited);
8190
 
    if (datum->n >= 1) {
8191
 
        row->output_port = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_PORT], &datum->keys[0].uuid));
8192
 
    } else {
8193
 
        row->output_port = NULL;
8194
 
    }
8195
 
}
8196
 
 
8197
 
static void
8198
 
ovsrec_mirror_parse_output_vlan(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8199
 
{
8200
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8201
 
    size_t n = MIN(1, datum->n);
8202
 
    size_t i;
8203
 
 
8204
 
    ovs_assert(inited);
8205
 
    row->output_vlan = NULL;
8206
 
    row->n_output_vlan = 0;
8207
 
    for (i = 0; i < n; i++) {
8208
 
        if (!row->n_output_vlan) {
8209
 
            row->output_vlan = xmalloc(n * sizeof *row->output_vlan);
8210
 
        }
8211
 
        row->output_vlan[row->n_output_vlan] = datum->keys[i].integer;
8212
 
        row->n_output_vlan++;
8213
 
    }
8214
 
}
8215
 
 
8216
 
static void
8217
 
ovsrec_mirror_parse_select_all(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8218
 
{
8219
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8220
 
 
8221
 
    ovs_assert(inited);
8222
 
    if (datum->n >= 1) {
8223
 
        row->select_all = datum->keys[0].boolean;
8224
 
    } else {
8225
 
        row->select_all = false;
8226
 
    }
8227
 
}
8228
 
 
8229
 
static void
8230
 
ovsrec_mirror_parse_select_dst_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8231
 
{
8232
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8233
 
    size_t i;
8234
 
 
8235
 
    ovs_assert(inited);
8236
 
    row->select_dst_port = NULL;
8237
 
    row->n_select_dst_port = 0;
8238
 
    for (i = 0; i < datum->n; i++) {
8239
 
        struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_PORT], &datum->keys[i].uuid));
8240
 
        if (keyRow) {
8241
 
            if (!row->n_select_dst_port) {
8242
 
                row->select_dst_port = xmalloc(datum->n * sizeof *row->select_dst_port);
8243
 
            }
8244
 
            row->select_dst_port[row->n_select_dst_port] = keyRow;
8245
 
            row->n_select_dst_port++;
8246
 
        }
8247
 
    }
8248
 
}
8249
 
 
8250
 
static void
8251
 
ovsrec_mirror_parse_select_src_port(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8252
 
{
8253
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8254
 
    size_t i;
8255
 
 
8256
 
    ovs_assert(inited);
8257
 
    row->select_src_port = NULL;
8258
 
    row->n_select_src_port = 0;
8259
 
    for (i = 0; i < datum->n; i++) {
8260
 
        struct ovsrec_port *keyRow = ovsrec_port_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_PORT], &datum->keys[i].uuid));
8261
 
        if (keyRow) {
8262
 
            if (!row->n_select_src_port) {
8263
 
                row->select_src_port = xmalloc(datum->n * sizeof *row->select_src_port);
8264
 
            }
8265
 
            row->select_src_port[row->n_select_src_port] = keyRow;
8266
 
            row->n_select_src_port++;
8267
 
        }
8268
 
    }
8269
 
}
8270
 
 
8271
 
static void
8272
 
ovsrec_mirror_parse_select_vlan(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8273
 
{
8274
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8275
 
    size_t n = MIN(4096, datum->n);
8276
 
    size_t i;
8277
 
 
8278
 
    ovs_assert(inited);
8279
 
    row->select_vlan = NULL;
8280
 
    row->n_select_vlan = 0;
8281
 
    for (i = 0; i < n; i++) {
8282
 
        if (!row->n_select_vlan) {
8283
 
            row->select_vlan = xmalloc(n * sizeof *row->select_vlan);
8284
 
        }
8285
 
        row->select_vlan[row->n_select_vlan] = datum->keys[i].integer;
8286
 
        row->n_select_vlan++;
8287
 
    }
8288
 
}
8289
 
 
8290
 
static void
8291
 
ovsrec_mirror_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8292
 
{
8293
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8294
 
    size_t i;
8295
 
 
8296
 
    ovs_assert(inited);
8297
 
    row->key_statistics = NULL;
8298
 
    row->value_statistics = NULL;
8299
 
    row->n_statistics = 0;
8300
 
    for (i = 0; i < datum->n; i++) {
8301
 
        if (!row->n_statistics) {
8302
 
            row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
8303
 
            row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
8304
 
        }
8305
 
        row->key_statistics[row->n_statistics] = datum->keys[i].string;
8306
 
        row->value_statistics[row->n_statistics] = datum->values[i].integer;
8307
 
        row->n_statistics++;
8308
 
    }
8309
 
}
8310
 
 
8311
 
static void
8312
 
ovsrec_mirror_unparse_external_ids(struct ovsdb_idl_row *row_)
8313
 
{
8314
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8315
 
 
8316
 
    ovs_assert(inited);
8317
 
    smap_destroy(&row->external_ids);
8318
 
}
8319
 
 
8320
 
static void
8321
 
ovsrec_mirror_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
8322
 
{
8323
 
    /* Nothing to do. */
8324
 
}
8325
 
 
8326
 
static void
8327
 
ovsrec_mirror_unparse_output_port(struct ovsdb_idl_row *row OVS_UNUSED)
8328
 
{
8329
 
    /* Nothing to do. */
8330
 
}
8331
 
 
8332
 
static void
8333
 
ovsrec_mirror_unparse_output_vlan(struct ovsdb_idl_row *row_)
8334
 
{
8335
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8336
 
 
8337
 
    ovs_assert(inited);
8338
 
    free(row->output_vlan);
8339
 
}
8340
 
 
8341
 
static void
8342
 
ovsrec_mirror_unparse_select_all(struct ovsdb_idl_row *row OVS_UNUSED)
8343
 
{
8344
 
    /* Nothing to do. */
8345
 
}
8346
 
 
8347
 
static void
8348
 
ovsrec_mirror_unparse_select_dst_port(struct ovsdb_idl_row *row_)
8349
 
{
8350
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8351
 
 
8352
 
    ovs_assert(inited);
8353
 
    free(row->select_dst_port);
8354
 
}
8355
 
 
8356
 
static void
8357
 
ovsrec_mirror_unparse_select_src_port(struct ovsdb_idl_row *row_)
8358
 
{
8359
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8360
 
 
8361
 
    ovs_assert(inited);
8362
 
    free(row->select_src_port);
8363
 
}
8364
 
 
8365
 
static void
8366
 
ovsrec_mirror_unparse_select_vlan(struct ovsdb_idl_row *row_)
8367
 
{
8368
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8369
 
 
8370
 
    ovs_assert(inited);
8371
 
    free(row->select_vlan);
8372
 
}
8373
 
 
8374
 
static void
8375
 
ovsrec_mirror_unparse_statistics(struct ovsdb_idl_row *row_)
8376
 
{
8377
 
    struct ovsrec_mirror *row = ovsrec_mirror_cast(row_);
8378
 
 
8379
 
    ovs_assert(inited);
8380
 
    free(row->key_statistics);
8381
 
    free(row->value_statistics);
8382
 
}
8383
 
 
8384
 
static void
8385
 
ovsrec_mirror_init__(struct ovsdb_idl_row *row)
8386
 
{
8387
 
    ovsrec_mirror_init(ovsrec_mirror_cast(row));
8388
 
}
8389
 
 
8390
 
void
8391
 
ovsrec_mirror_init(struct ovsrec_mirror *row)
8392
 
{
8393
 
    memset(row, 0, sizeof *row); 
8394
 
    smap_init(&row->external_ids);
8395
 
}
8396
 
 
8397
 
const struct ovsrec_mirror *
8398
 
ovsrec_mirror_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
8399
 
{
8400
 
    return ovsrec_mirror_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_MIRROR], uuid));
8401
 
}
8402
 
 
8403
 
const struct ovsrec_mirror *
8404
 
ovsrec_mirror_first(const struct ovsdb_idl *idl)
8405
 
{
8406
 
    return ovsrec_mirror_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_MIRROR]));
8407
 
}
8408
 
 
8409
 
const struct ovsrec_mirror *
8410
 
ovsrec_mirror_next(const struct ovsrec_mirror *row)
8411
 
{
8412
 
    return ovsrec_mirror_cast(ovsdb_idl_next_row(&row->header_));
8413
 
}
8414
 
 
8415
 
void
8416
 
ovsrec_mirror_delete(const struct ovsrec_mirror *row)
8417
 
{
8418
 
    ovsdb_idl_txn_delete(&row->header_);
8419
 
}
8420
 
 
8421
 
struct ovsrec_mirror *
8422
 
ovsrec_mirror_insert(struct ovsdb_idl_txn *txn)
8423
 
{
8424
 
    return ovsrec_mirror_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_MIRROR], NULL));
8425
 
}
8426
 
 
8427
 
 
8428
 
void
8429
 
ovsrec_mirror_verify_external_ids(const struct ovsrec_mirror *row)
8430
 
{
8431
 
    ovs_assert(inited);
8432
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_EXTERNAL_IDS]);
8433
 
}
8434
 
 
8435
 
void
8436
 
ovsrec_mirror_verify_name(const struct ovsrec_mirror *row)
8437
 
{
8438
 
    ovs_assert(inited);
8439
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_NAME]);
8440
 
}
8441
 
 
8442
 
void
8443
 
ovsrec_mirror_verify_output_port(const struct ovsrec_mirror *row)
8444
 
{
8445
 
    ovs_assert(inited);
8446
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_OUTPUT_PORT]);
8447
 
}
8448
 
 
8449
 
void
8450
 
ovsrec_mirror_verify_output_vlan(const struct ovsrec_mirror *row)
8451
 
{
8452
 
    ovs_assert(inited);
8453
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_OUTPUT_VLAN]);
8454
 
}
8455
 
 
8456
 
void
8457
 
ovsrec_mirror_verify_select_all(const struct ovsrec_mirror *row)
8458
 
{
8459
 
    ovs_assert(inited);
8460
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_ALL]);
8461
 
}
8462
 
 
8463
 
void
8464
 
ovsrec_mirror_verify_select_dst_port(const struct ovsrec_mirror *row)
8465
 
{
8466
 
    ovs_assert(inited);
8467
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_DST_PORT]);
8468
 
}
8469
 
 
8470
 
void
8471
 
ovsrec_mirror_verify_select_src_port(const struct ovsrec_mirror *row)
8472
 
{
8473
 
    ovs_assert(inited);
8474
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_SRC_PORT]);
8475
 
}
8476
 
 
8477
 
void
8478
 
ovsrec_mirror_verify_select_vlan(const struct ovsrec_mirror *row)
8479
 
{
8480
 
    ovs_assert(inited);
8481
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_VLAN]);
8482
 
}
8483
 
 
8484
 
void
8485
 
ovsrec_mirror_verify_statistics(const struct ovsrec_mirror *row)
8486
 
{
8487
 
    ovs_assert(inited);
8488
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_STATISTICS]);
8489
 
}
8490
 
 
8491
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
8492
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
8493
 
 * easier and more efficient way to search for a given key than implementing
8494
 
 * the same operation on the "cooked" form in 'row'.
8495
 
 *
8496
 
 * 'key_type' must be OVSDB_TYPE_STRING.
8497
 
 * 'value_type' must be OVSDB_TYPE_STRING.
8498
 
 * (This helps to avoid silent bugs if someone changes external_ids's
8499
 
 * type without updating the caller.)
8500
 
 *
8501
 
 * The caller must not modify or free the returned value.
8502
 
 *
8503
 
 * Various kinds of changes can invalidate the returned value: modifying
8504
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8505
 
 * If the returned value is needed for a long time, it is best to make a copy
8506
 
 * of it with ovsdb_datum_clone(). */
8507
 
const struct ovsdb_datum *
8508
 
ovsrec_mirror_get_external_ids(const struct ovsrec_mirror *row,
8509
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
8510
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
8511
 
{
8512
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8513
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
8514
 
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_external_ids);
8515
 
}
8516
 
 
8517
 
/* Returns the name column's value in 'row' as a struct ovsdb_datum.
8518
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
8519
 
 * easier and more efficient way to search for a given key than implementing
8520
 
 * the same operation on the "cooked" form in 'row'.
8521
 
 *
8522
 
 * 'key_type' must be OVSDB_TYPE_STRING.
8523
 
 * (This helps to avoid silent bugs if someone changes name's
8524
 
 * type without updating the caller.)
8525
 
 *
8526
 
 * The caller must not modify or free the returned value.
8527
 
 *
8528
 
 * Various kinds of changes can invalidate the returned value: modifying
8529
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8530
 
 * If the returned value is needed for a long time, it is best to make a copy
8531
 
 * of it with ovsdb_datum_clone(). */
8532
 
const struct ovsdb_datum *
8533
 
ovsrec_mirror_get_name(const struct ovsrec_mirror *row,
8534
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
8535
 
{
8536
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8537
 
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_name);
8538
 
}
8539
 
 
8540
 
/* Returns the output_port column's value in 'row' as a struct ovsdb_datum.
8541
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
8542
 
 * easier and more efficient way to search for a given key than implementing
8543
 
 * the same operation on the "cooked" form in 'row'.
8544
 
 *
8545
 
 * 'key_type' must be OVSDB_TYPE_UUID.
8546
 
 * (This helps to avoid silent bugs if someone changes output_port's
8547
 
 * type without updating the caller.)
8548
 
 *
8549
 
 * The caller must not modify or free the returned value.
8550
 
 *
8551
 
 * Various kinds of changes can invalidate the returned value: modifying
8552
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8553
 
 * If the returned value is needed for a long time, it is best to make a copy
8554
 
 * of it with ovsdb_datum_clone(). */
8555
 
const struct ovsdb_datum *
8556
 
ovsrec_mirror_get_output_port(const struct ovsrec_mirror *row,
8557
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
8558
 
{
8559
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
8560
 
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_output_port);
8561
 
}
8562
 
 
8563
 
/* Returns the output_vlan column's value in 'row' as a struct ovsdb_datum.
8564
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
8565
 
 * easier and more efficient way to search for a given key than implementing
8566
 
 * the same operation on the "cooked" form in 'row'.
8567
 
 *
8568
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8569
 
 * (This helps to avoid silent bugs if someone changes output_vlan's
8570
 
 * type without updating the caller.)
8571
 
 *
8572
 
 * The caller must not modify or free the returned value.
8573
 
 *
8574
 
 * Various kinds of changes can invalidate the returned value: modifying
8575
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8576
 
 * If the returned value is needed for a long time, it is best to make a copy
8577
 
 * of it with ovsdb_datum_clone(). */
8578
 
const struct ovsdb_datum *
8579
 
ovsrec_mirror_get_output_vlan(const struct ovsrec_mirror *row,
8580
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
8581
 
{
8582
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8583
 
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_output_vlan);
8584
 
}
8585
 
 
8586
 
/* Returns the select_all column's value in 'row' as a struct ovsdb_datum.
8587
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
8588
 
 * easier and more efficient way to search for a given key than implementing
8589
 
 * the same operation on the "cooked" form in 'row'.
8590
 
 *
8591
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
8592
 
 * (This helps to avoid silent bugs if someone changes select_all's
8593
 
 * type without updating the caller.)
8594
 
 *
8595
 
 * The caller must not modify or free the returned value.
8596
 
 *
8597
 
 * Various kinds of changes can invalidate the returned value: modifying
8598
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8599
 
 * If the returned value is needed for a long time, it is best to make a copy
8600
 
 * of it with ovsdb_datum_clone(). */
8601
 
const struct ovsdb_datum *
8602
 
ovsrec_mirror_get_select_all(const struct ovsrec_mirror *row,
8603
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
8604
 
{
8605
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
8606
 
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_all);
8607
 
}
8608
 
 
8609
 
/* Returns the select_dst_port column's value in 'row' as a struct ovsdb_datum.
8610
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
8611
 
 * easier and more efficient way to search for a given key than implementing
8612
 
 * the same operation on the "cooked" form in 'row'.
8613
 
 *
8614
 
 * 'key_type' must be OVSDB_TYPE_UUID.
8615
 
 * (This helps to avoid silent bugs if someone changes select_dst_port's
8616
 
 * type without updating the caller.)
8617
 
 *
8618
 
 * The caller must not modify or free the returned value.
8619
 
 *
8620
 
 * Various kinds of changes can invalidate the returned value: modifying
8621
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8622
 
 * If the returned value is needed for a long time, it is best to make a copy
8623
 
 * of it with ovsdb_datum_clone(). */
8624
 
const struct ovsdb_datum *
8625
 
ovsrec_mirror_get_select_dst_port(const struct ovsrec_mirror *row,
8626
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
8627
 
{
8628
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
8629
 
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_dst_port);
8630
 
}
8631
 
 
8632
 
/* Returns the select_src_port column's value in 'row' as a struct ovsdb_datum.
8633
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
8634
 
 * easier and more efficient way to search for a given key than implementing
8635
 
 * the same operation on the "cooked" form in 'row'.
8636
 
 *
8637
 
 * 'key_type' must be OVSDB_TYPE_UUID.
8638
 
 * (This helps to avoid silent bugs if someone changes select_src_port's
8639
 
 * type without updating the caller.)
8640
 
 *
8641
 
 * The caller must not modify or free the returned value.
8642
 
 *
8643
 
 * Various kinds of changes can invalidate the returned value: modifying
8644
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8645
 
 * If the returned value is needed for a long time, it is best to make a copy
8646
 
 * of it with ovsdb_datum_clone(). */
8647
 
const struct ovsdb_datum *
8648
 
ovsrec_mirror_get_select_src_port(const struct ovsrec_mirror *row,
8649
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
8650
 
{
8651
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
8652
 
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_src_port);
8653
 
}
8654
 
 
8655
 
/* Returns the select_vlan column's value in 'row' as a struct ovsdb_datum.
8656
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
8657
 
 * easier and more efficient way to search for a given key than implementing
8658
 
 * the same operation on the "cooked" form in 'row'.
8659
 
 *
8660
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
8661
 
 * (This helps to avoid silent bugs if someone changes select_vlan's
8662
 
 * type without updating the caller.)
8663
 
 *
8664
 
 * The caller must not modify or free the returned value.
8665
 
 *
8666
 
 * Various kinds of changes can invalidate the returned value: modifying
8667
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8668
 
 * If the returned value is needed for a long time, it is best to make a copy
8669
 
 * of it with ovsdb_datum_clone(). */
8670
 
const struct ovsdb_datum *
8671
 
ovsrec_mirror_get_select_vlan(const struct ovsrec_mirror *row,
8672
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
8673
 
{
8674
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
8675
 
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_select_vlan);
8676
 
}
8677
 
 
8678
 
/* Returns the statistics column's value in 'row' as a struct ovsdb_datum.
8679
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
8680
 
 * easier and more efficient way to search for a given key than implementing
8681
 
 * the same operation on the "cooked" form in 'row'.
8682
 
 *
8683
 
 * 'key_type' must be OVSDB_TYPE_STRING.
8684
 
 * 'value_type' must be OVSDB_TYPE_INTEGER.
8685
 
 * (This helps to avoid silent bugs if someone changes statistics's
8686
 
 * type without updating the caller.)
8687
 
 *
8688
 
 * The caller must not modify or free the returned value.
8689
 
 *
8690
 
 * Various kinds of changes can invalidate the returned value: modifying
8691
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
8692
 
 * If the returned value is needed for a long time, it is best to make a copy
8693
 
 * of it with ovsdb_datum_clone(). */
8694
 
const struct ovsdb_datum *
8695
 
ovsrec_mirror_get_statistics(const struct ovsrec_mirror *row,
8696
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
8697
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
8698
 
{
8699
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
8700
 
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
8701
 
    return ovsdb_idl_read(&row->header_, &ovsrec_mirror_col_statistics);
8702
 
}
8703
 
 
8704
 
void
8705
 
ovsrec_mirror_set_external_ids(const struct ovsrec_mirror *row, const struct smap *smap)
8706
 
{
8707
 
    struct ovsdb_datum datum;
8708
 
 
8709
 
    ovs_assert(inited);
8710
 
    if (smap) {
8711
 
        struct smap_node *node;
8712
 
        size_t i;
8713
 
 
8714
 
        datum.n = smap_count(smap);
8715
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
8716
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
8717
 
 
8718
 
        i = 0;
8719
 
        SMAP_FOR_EACH (node, smap) {
8720
 
            datum.keys[i].string = xstrdup(node->key);
8721
 
            datum.values[i].string = xstrdup(node->value);
8722
 
            i++;
8723
 
        }
8724
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
8725
 
    } else {
8726
 
        ovsdb_datum_init_empty(&datum);
8727
 
    }
8728
 
    ovsdb_idl_txn_write(&row->header_,
8729
 
                        &ovsrec_mirror_columns[OVSREC_MIRROR_COL_EXTERNAL_IDS],
8730
 
                        &datum);
8731
 
}
8732
 
 
8733
 
 
8734
 
void
8735
 
ovsrec_mirror_set_name(const struct ovsrec_mirror *row, const char *name)
8736
 
{
8737
 
    struct ovsdb_datum datum;
8738
 
    union ovsdb_atom key;
8739
 
 
8740
 
    ovs_assert(inited);
8741
 
    datum.n = 1;
8742
 
    datum.keys = &key;
8743
 
    key.string = CONST_CAST(char *, name);
8744
 
    datum.values = NULL;
8745
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_NAME], &datum);
8746
 
}
8747
 
 
8748
 
void
8749
 
ovsrec_mirror_set_output_port(const struct ovsrec_mirror *row, const struct ovsrec_port *output_port)
8750
 
{
8751
 
    struct ovsdb_datum datum;
8752
 
    union ovsdb_atom key;
8753
 
 
8754
 
    ovs_assert(inited);
8755
 
    if (output_port) {
8756
 
        datum.n = 1;
8757
 
        datum.keys = &key;
8758
 
        key.uuid = output_port->header_.uuid;
8759
 
    } else {
8760
 
        datum.n = 0;
8761
 
        datum.keys = NULL;
8762
 
    }
8763
 
    datum.values = NULL;
8764
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_OUTPUT_PORT], &datum);
8765
 
}
8766
 
 
8767
 
void
8768
 
ovsrec_mirror_set_output_vlan(const struct ovsrec_mirror *row, const int64_t *output_vlan, size_t n_output_vlan)
8769
 
{
8770
 
    struct ovsdb_datum datum;
8771
 
    union ovsdb_atom key;
8772
 
 
8773
 
    ovs_assert(inited);
8774
 
    if (n_output_vlan) {
8775
 
        datum.n = 1;
8776
 
        datum.keys = &key;
8777
 
        key.integer = *output_vlan;
8778
 
    } else {
8779
 
        datum.n = 0;
8780
 
        datum.keys = NULL;
8781
 
    }
8782
 
    datum.values = NULL;
8783
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_OUTPUT_VLAN], &datum);
8784
 
}
8785
 
 
8786
 
void
8787
 
ovsrec_mirror_set_select_all(const struct ovsrec_mirror *row, bool select_all)
8788
 
{
8789
 
    struct ovsdb_datum datum;
8790
 
    union ovsdb_atom key;
8791
 
 
8792
 
    ovs_assert(inited);
8793
 
    datum.n = 1;
8794
 
    datum.keys = &key;
8795
 
    key.boolean = select_all;
8796
 
    datum.values = NULL;
8797
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_ALL], &datum);
8798
 
}
8799
 
 
8800
 
void
8801
 
ovsrec_mirror_set_select_dst_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_dst_port, size_t n_select_dst_port)
8802
 
{
8803
 
    struct ovsdb_datum datum;
8804
 
    size_t i;
8805
 
 
8806
 
    ovs_assert(inited);
8807
 
    datum.n = n_select_dst_port;
8808
 
    datum.keys = n_select_dst_port ? xmalloc(n_select_dst_port * sizeof *datum.keys) : NULL;
8809
 
    datum.values = NULL;
8810
 
    for (i = 0; i < n_select_dst_port; i++) {
8811
 
        datum.keys[i].uuid = select_dst_port[i]->header_.uuid;
8812
 
    }
8813
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8814
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_DST_PORT], &datum);
8815
 
}
8816
 
 
8817
 
void
8818
 
ovsrec_mirror_set_select_src_port(const struct ovsrec_mirror *row, struct ovsrec_port **select_src_port, size_t n_select_src_port)
8819
 
{
8820
 
    struct ovsdb_datum datum;
8821
 
    size_t i;
8822
 
 
8823
 
    ovs_assert(inited);
8824
 
    datum.n = n_select_src_port;
8825
 
    datum.keys = n_select_src_port ? xmalloc(n_select_src_port * sizeof *datum.keys) : NULL;
8826
 
    datum.values = NULL;
8827
 
    for (i = 0; i < n_select_src_port; i++) {
8828
 
        datum.keys[i].uuid = select_src_port[i]->header_.uuid;
8829
 
    }
8830
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
8831
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_SRC_PORT], &datum);
8832
 
}
8833
 
 
8834
 
void
8835
 
ovsrec_mirror_set_select_vlan(const struct ovsrec_mirror *row, const int64_t *select_vlan, size_t n_select_vlan)
8836
 
{
8837
 
    struct ovsdb_datum datum;
8838
 
    size_t i;
8839
 
 
8840
 
    ovs_assert(inited);
8841
 
    datum.n = n_select_vlan;
8842
 
    datum.keys = n_select_vlan ? xmalloc(n_select_vlan * sizeof *datum.keys) : NULL;
8843
 
    datum.values = NULL;
8844
 
    for (i = 0; i < n_select_vlan; i++) {
8845
 
        datum.keys[i].integer = select_vlan[i];
8846
 
    }
8847
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_VOID);
8848
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_SELECT_VLAN], &datum);
8849
 
}
8850
 
 
8851
 
void
8852
 
ovsrec_mirror_set_statistics(const struct ovsrec_mirror *row, char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
8853
 
{
8854
 
    struct ovsdb_datum datum;
8855
 
    size_t i;
8856
 
 
8857
 
    ovs_assert(inited);
8858
 
    datum.n = n_statistics;
8859
 
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
8860
 
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
8861
 
    for (i = 0; i < n_statistics; i++) {
8862
 
        datum.keys[i].string = xstrdup(key_statistics[i]);
8863
 
        datum.values[i].integer = value_statistics[i];
8864
 
    }
8865
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_INTEGER);
8866
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_mirror_columns[OVSREC_MIRROR_COL_STATISTICS], &datum);
8867
 
}
8868
 
 
8869
 
struct ovsdb_idl_column ovsrec_mirror_columns[OVSREC_MIRROR_N_COLUMNS];
8870
 
 
8871
 
static void
8872
 
ovsrec_mirror_columns_init(void)
8873
 
{
8874
 
    struct ovsdb_idl_column *c;
8875
 
 
8876
 
    /* Initialize ovsrec_mirror_col_external_ids. */
8877
 
    c = &ovsrec_mirror_col_external_ids;
8878
 
    c->name = "external_ids";
8879
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8880
 
    c->type.key.u.string.minLen = 0;
8881
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
8882
 
    c->type.value.u.string.minLen = 0;
8883
 
    c->type.n_min = 0;
8884
 
    c->type.n_max = UINT_MAX;
8885
 
    c->mutable = true;
8886
 
    c->parse = ovsrec_mirror_parse_external_ids;
8887
 
    c->unparse = ovsrec_mirror_unparse_external_ids;
8888
 
 
8889
 
    /* Initialize ovsrec_mirror_col_name. */
8890
 
    c = &ovsrec_mirror_col_name;
8891
 
    c->name = "name";
8892
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8893
 
    c->type.key.u.string.minLen = 0;
8894
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8895
 
    c->type.n_min = 1;
8896
 
    c->type.n_max = 1;
8897
 
    c->mutable = true;
8898
 
    c->parse = ovsrec_mirror_parse_name;
8899
 
    c->unparse = ovsrec_mirror_unparse_name;
8900
 
 
8901
 
    /* Initialize ovsrec_mirror_col_output_port. */
8902
 
    c = &ovsrec_mirror_col_output_port;
8903
 
    c->name = "output_port";
8904
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
8905
 
    c->type.key.u.uuid.refTableName = "Port";
8906
 
    c->type.key.u.uuid.refType = OVSDB_REF_WEAK;
8907
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8908
 
    c->type.n_min = 0;
8909
 
    c->type.n_max = 1;
8910
 
    c->mutable = true;
8911
 
    c->parse = ovsrec_mirror_parse_output_port;
8912
 
    c->unparse = ovsrec_mirror_unparse_output_port;
8913
 
 
8914
 
    /* Initialize ovsrec_mirror_col_output_vlan. */
8915
 
    c = &ovsrec_mirror_col_output_vlan;
8916
 
    c->name = "output_vlan";
8917
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
8918
 
    c->type.key.u.integer.min = INT64_C(1);
8919
 
    c->type.key.u.integer.max = INT64_C(4095);
8920
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8921
 
    c->type.n_min = 0;
8922
 
    c->type.n_max = 1;
8923
 
    c->mutable = true;
8924
 
    c->parse = ovsrec_mirror_parse_output_vlan;
8925
 
    c->unparse = ovsrec_mirror_unparse_output_vlan;
8926
 
 
8927
 
    /* Initialize ovsrec_mirror_col_select_all. */
8928
 
    c = &ovsrec_mirror_col_select_all;
8929
 
    c->name = "select_all";
8930
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
8931
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8932
 
    c->type.n_min = 1;
8933
 
    c->type.n_max = 1;
8934
 
    c->mutable = true;
8935
 
    c->parse = ovsrec_mirror_parse_select_all;
8936
 
    c->unparse = ovsrec_mirror_unparse_select_all;
8937
 
 
8938
 
    /* Initialize ovsrec_mirror_col_select_dst_port. */
8939
 
    c = &ovsrec_mirror_col_select_dst_port;
8940
 
    c->name = "select_dst_port";
8941
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
8942
 
    c->type.key.u.uuid.refTableName = "Port";
8943
 
    c->type.key.u.uuid.refType = OVSDB_REF_WEAK;
8944
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8945
 
    c->type.n_min = 0;
8946
 
    c->type.n_max = UINT_MAX;
8947
 
    c->mutable = true;
8948
 
    c->parse = ovsrec_mirror_parse_select_dst_port;
8949
 
    c->unparse = ovsrec_mirror_unparse_select_dst_port;
8950
 
 
8951
 
    /* Initialize ovsrec_mirror_col_select_src_port. */
8952
 
    c = &ovsrec_mirror_col_select_src_port;
8953
 
    c->name = "select_src_port";
8954
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
8955
 
    c->type.key.u.uuid.refTableName = "Port";
8956
 
    c->type.key.u.uuid.refType = OVSDB_REF_WEAK;
8957
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8958
 
    c->type.n_min = 0;
8959
 
    c->type.n_max = UINT_MAX;
8960
 
    c->mutable = true;
8961
 
    c->parse = ovsrec_mirror_parse_select_src_port;
8962
 
    c->unparse = ovsrec_mirror_unparse_select_src_port;
8963
 
 
8964
 
    /* Initialize ovsrec_mirror_col_select_vlan. */
8965
 
    c = &ovsrec_mirror_col_select_vlan;
8966
 
    c->name = "select_vlan";
8967
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
8968
 
    c->type.key.u.integer.min = INT64_C(0);
8969
 
    c->type.key.u.integer.max = INT64_C(4095);
8970
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
8971
 
    c->type.n_min = 0;
8972
 
    c->type.n_max = 4096;
8973
 
    c->mutable = true;
8974
 
    c->parse = ovsrec_mirror_parse_select_vlan;
8975
 
    c->unparse = ovsrec_mirror_unparse_select_vlan;
8976
 
 
8977
 
    /* Initialize ovsrec_mirror_col_statistics. */
8978
 
    c = &ovsrec_mirror_col_statistics;
8979
 
    c->name = "statistics";
8980
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
8981
 
    c->type.key.u.string.minLen = 0;
8982
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_INTEGER);
8983
 
    c->type.n_min = 0;
8984
 
    c->type.n_max = UINT_MAX;
8985
 
    c->mutable = true;
8986
 
    c->parse = ovsrec_mirror_parse_statistics;
8987
 
    c->unparse = ovsrec_mirror_unparse_statistics;
8988
 
}
8989
 
 
8990
 
/* NetFlow table. */
8991
 
 
8992
 
static void
8993
 
ovsrec_netflow_parse_active_timeout(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
8994
 
{
8995
 
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
8996
 
 
8997
 
    ovs_assert(inited);
8998
 
    if (datum->n >= 1) {
8999
 
        row->active_timeout = datum->keys[0].integer;
9000
 
    } else {
9001
 
        row->active_timeout = 0;
9002
 
    }
9003
 
}
9004
 
 
9005
 
static void
9006
 
ovsrec_netflow_parse_add_id_to_interface(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9007
 
{
9008
 
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9009
 
 
9010
 
    ovs_assert(inited);
9011
 
    if (datum->n >= 1) {
9012
 
        row->add_id_to_interface = datum->keys[0].boolean;
9013
 
    } else {
9014
 
        row->add_id_to_interface = false;
9015
 
    }
9016
 
}
9017
 
 
9018
 
static void
9019
 
ovsrec_netflow_parse_engine_id(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9020
 
{
9021
 
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9022
 
    size_t n = MIN(1, datum->n);
9023
 
    size_t i;
9024
 
 
9025
 
    ovs_assert(inited);
9026
 
    row->engine_id = NULL;
9027
 
    row->n_engine_id = 0;
9028
 
    for (i = 0; i < n; i++) {
9029
 
        if (!row->n_engine_id) {
9030
 
            row->engine_id = xmalloc(n * sizeof *row->engine_id);
9031
 
        }
9032
 
        row->engine_id[row->n_engine_id] = datum->keys[i].integer;
9033
 
        row->n_engine_id++;
9034
 
    }
9035
 
}
9036
 
 
9037
 
static void
9038
 
ovsrec_netflow_parse_engine_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9039
 
{
9040
 
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9041
 
    size_t n = MIN(1, datum->n);
9042
 
    size_t i;
9043
 
 
9044
 
    ovs_assert(inited);
9045
 
    row->engine_type = NULL;
9046
 
    row->n_engine_type = 0;
9047
 
    for (i = 0; i < n; i++) {
9048
 
        if (!row->n_engine_type) {
9049
 
            row->engine_type = xmalloc(n * sizeof *row->engine_type);
9050
 
        }
9051
 
        row->engine_type[row->n_engine_type] = datum->keys[i].integer;
9052
 
        row->n_engine_type++;
9053
 
    }
9054
 
}
9055
 
 
9056
 
static void
9057
 
ovsrec_netflow_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9058
 
{
9059
 
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9060
 
    size_t i;
9061
 
 
9062
 
    ovs_assert(inited);
9063
 
    smap_init(&row->external_ids);
9064
 
    for (i = 0; i < datum->n; i++) {
9065
 
        smap_add(&row->external_ids,
9066
 
                 datum->keys[i].string,
9067
 
                 datum->values[i].string);
9068
 
    }
9069
 
}
9070
 
 
9071
 
static void
9072
 
ovsrec_netflow_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9073
 
{
9074
 
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9075
 
    size_t i;
9076
 
 
9077
 
    ovs_assert(inited);
9078
 
    row->targets = NULL;
9079
 
    row->n_targets = 0;
9080
 
    for (i = 0; i < datum->n; i++) {
9081
 
        if (!row->n_targets) {
9082
 
            row->targets = xmalloc(datum->n * sizeof *row->targets);
9083
 
        }
9084
 
        row->targets[row->n_targets] = datum->keys[i].string;
9085
 
        row->n_targets++;
9086
 
    }
9087
 
}
9088
 
 
9089
 
static void
9090
 
ovsrec_netflow_unparse_active_timeout(struct ovsdb_idl_row *row OVS_UNUSED)
9091
 
{
9092
 
    /* Nothing to do. */
9093
 
}
9094
 
 
9095
 
static void
9096
 
ovsrec_netflow_unparse_add_id_to_interface(struct ovsdb_idl_row *row OVS_UNUSED)
9097
 
{
9098
 
    /* Nothing to do. */
9099
 
}
9100
 
 
9101
 
static void
9102
 
ovsrec_netflow_unparse_engine_id(struct ovsdb_idl_row *row_)
9103
 
{
9104
 
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9105
 
 
9106
 
    ovs_assert(inited);
9107
 
    free(row->engine_id);
9108
 
}
9109
 
 
9110
 
static void
9111
 
ovsrec_netflow_unparse_engine_type(struct ovsdb_idl_row *row_)
9112
 
{
9113
 
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9114
 
 
9115
 
    ovs_assert(inited);
9116
 
    free(row->engine_type);
9117
 
}
9118
 
 
9119
 
static void
9120
 
ovsrec_netflow_unparse_external_ids(struct ovsdb_idl_row *row_)
9121
 
{
9122
 
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9123
 
 
9124
 
    ovs_assert(inited);
9125
 
    smap_destroy(&row->external_ids);
9126
 
}
9127
 
 
9128
 
static void
9129
 
ovsrec_netflow_unparse_targets(struct ovsdb_idl_row *row_)
9130
 
{
9131
 
    struct ovsrec_netflow *row = ovsrec_netflow_cast(row_);
9132
 
 
9133
 
    ovs_assert(inited);
9134
 
    free(row->targets);
9135
 
}
9136
 
 
9137
 
static void
9138
 
ovsrec_netflow_init__(struct ovsdb_idl_row *row)
9139
 
{
9140
 
    ovsrec_netflow_init(ovsrec_netflow_cast(row));
9141
 
}
9142
 
 
9143
 
void
9144
 
ovsrec_netflow_init(struct ovsrec_netflow *row)
9145
 
{
9146
 
    memset(row, 0, sizeof *row); 
9147
 
    smap_init(&row->external_ids);
9148
 
}
9149
 
 
9150
 
const struct ovsrec_netflow *
9151
 
ovsrec_netflow_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
9152
 
{
9153
 
    return ovsrec_netflow_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW], uuid));
9154
 
}
9155
 
 
9156
 
const struct ovsrec_netflow *
9157
 
ovsrec_netflow_first(const struct ovsdb_idl *idl)
9158
 
{
9159
 
    return ovsrec_netflow_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW]));
9160
 
}
9161
 
 
9162
 
const struct ovsrec_netflow *
9163
 
ovsrec_netflow_next(const struct ovsrec_netflow *row)
9164
 
{
9165
 
    return ovsrec_netflow_cast(ovsdb_idl_next_row(&row->header_));
9166
 
}
9167
 
 
9168
 
void
9169
 
ovsrec_netflow_delete(const struct ovsrec_netflow *row)
9170
 
{
9171
 
    ovsdb_idl_txn_delete(&row->header_);
9172
 
}
9173
 
 
9174
 
struct ovsrec_netflow *
9175
 
ovsrec_netflow_insert(struct ovsdb_idl_txn *txn)
9176
 
{
9177
 
    return ovsrec_netflow_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_NETFLOW], NULL));
9178
 
}
9179
 
 
9180
 
 
9181
 
void
9182
 
ovsrec_netflow_verify_active_timeout(const struct ovsrec_netflow *row)
9183
 
{
9184
 
    ovs_assert(inited);
9185
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ACTIVE_TIMEOUT]);
9186
 
}
9187
 
 
9188
 
void
9189
 
ovsrec_netflow_verify_add_id_to_interface(const struct ovsrec_netflow *row)
9190
 
{
9191
 
    ovs_assert(inited);
9192
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ADD_ID_TO_INTERFACE]);
9193
 
}
9194
 
 
9195
 
void
9196
 
ovsrec_netflow_verify_engine_id(const struct ovsrec_netflow *row)
9197
 
{
9198
 
    ovs_assert(inited);
9199
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ENGINE_ID]);
9200
 
}
9201
 
 
9202
 
void
9203
 
ovsrec_netflow_verify_engine_type(const struct ovsrec_netflow *row)
9204
 
{
9205
 
    ovs_assert(inited);
9206
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ENGINE_TYPE]);
9207
 
}
9208
 
 
9209
 
void
9210
 
ovsrec_netflow_verify_external_ids(const struct ovsrec_netflow *row)
9211
 
{
9212
 
    ovs_assert(inited);
9213
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_EXTERNAL_IDS]);
9214
 
}
9215
 
 
9216
 
void
9217
 
ovsrec_netflow_verify_targets(const struct ovsrec_netflow *row)
9218
 
{
9219
 
    ovs_assert(inited);
9220
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_TARGETS]);
9221
 
}
9222
 
 
9223
 
/* Returns the active_timeout column's value in 'row' as a struct ovsdb_datum.
9224
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
9225
 
 * easier and more efficient way to search for a given key than implementing
9226
 
 * the same operation on the "cooked" form in 'row'.
9227
 
 *
9228
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
9229
 
 * (This helps to avoid silent bugs if someone changes active_timeout's
9230
 
 * type without updating the caller.)
9231
 
 *
9232
 
 * The caller must not modify or free the returned value.
9233
 
 *
9234
 
 * Various kinds of changes can invalidate the returned value: modifying
9235
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9236
 
 * If the returned value is needed for a long time, it is best to make a copy
9237
 
 * of it with ovsdb_datum_clone(). */
9238
 
const struct ovsdb_datum *
9239
 
ovsrec_netflow_get_active_timeout(const struct ovsrec_netflow *row,
9240
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
9241
 
{
9242
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
9243
 
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_active_timeout);
9244
 
}
9245
 
 
9246
 
/* Returns the add_id_to_interface column's value in 'row' as a struct ovsdb_datum.
9247
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
9248
 
 * easier and more efficient way to search for a given key than implementing
9249
 
 * the same operation on the "cooked" form in 'row'.
9250
 
 *
9251
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
9252
 
 * (This helps to avoid silent bugs if someone changes add_id_to_interface's
9253
 
 * type without updating the caller.)
9254
 
 *
9255
 
 * The caller must not modify or free the returned value.
9256
 
 *
9257
 
 * Various kinds of changes can invalidate the returned value: modifying
9258
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9259
 
 * If the returned value is needed for a long time, it is best to make a copy
9260
 
 * of it with ovsdb_datum_clone(). */
9261
 
const struct ovsdb_datum *
9262
 
ovsrec_netflow_get_add_id_to_interface(const struct ovsrec_netflow *row,
9263
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
9264
 
{
9265
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
9266
 
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_add_id_to_interface);
9267
 
}
9268
 
 
9269
 
/* Returns the engine_id column's value in 'row' as a struct ovsdb_datum.
9270
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
9271
 
 * easier and more efficient way to search for a given key than implementing
9272
 
 * the same operation on the "cooked" form in 'row'.
9273
 
 *
9274
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
9275
 
 * (This helps to avoid silent bugs if someone changes engine_id's
9276
 
 * type without updating the caller.)
9277
 
 *
9278
 
 * The caller must not modify or free the returned value.
9279
 
 *
9280
 
 * Various kinds of changes can invalidate the returned value: modifying
9281
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9282
 
 * If the returned value is needed for a long time, it is best to make a copy
9283
 
 * of it with ovsdb_datum_clone(). */
9284
 
const struct ovsdb_datum *
9285
 
ovsrec_netflow_get_engine_id(const struct ovsrec_netflow *row,
9286
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
9287
 
{
9288
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
9289
 
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_engine_id);
9290
 
}
9291
 
 
9292
 
/* Returns the engine_type column's value in 'row' as a struct ovsdb_datum.
9293
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
9294
 
 * easier and more efficient way to search for a given key than implementing
9295
 
 * the same operation on the "cooked" form in 'row'.
9296
 
 *
9297
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
9298
 
 * (This helps to avoid silent bugs if someone changes engine_type's
9299
 
 * type without updating the caller.)
9300
 
 *
9301
 
 * The caller must not modify or free the returned value.
9302
 
 *
9303
 
 * Various kinds of changes can invalidate the returned value: modifying
9304
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9305
 
 * If the returned value is needed for a long time, it is best to make a copy
9306
 
 * of it with ovsdb_datum_clone(). */
9307
 
const struct ovsdb_datum *
9308
 
ovsrec_netflow_get_engine_type(const struct ovsrec_netflow *row,
9309
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
9310
 
{
9311
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
9312
 
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_engine_type);
9313
 
}
9314
 
 
9315
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
9316
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
9317
 
 * easier and more efficient way to search for a given key than implementing
9318
 
 * the same operation on the "cooked" form in 'row'.
9319
 
 *
9320
 
 * 'key_type' must be OVSDB_TYPE_STRING.
9321
 
 * 'value_type' must be OVSDB_TYPE_STRING.
9322
 
 * (This helps to avoid silent bugs if someone changes external_ids's
9323
 
 * type without updating the caller.)
9324
 
 *
9325
 
 * The caller must not modify or free the returned value.
9326
 
 *
9327
 
 * Various kinds of changes can invalidate the returned value: modifying
9328
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9329
 
 * If the returned value is needed for a long time, it is best to make a copy
9330
 
 * of it with ovsdb_datum_clone(). */
9331
 
const struct ovsdb_datum *
9332
 
ovsrec_netflow_get_external_ids(const struct ovsrec_netflow *row,
9333
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
9334
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
9335
 
{
9336
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
9337
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
9338
 
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_external_ids);
9339
 
}
9340
 
 
9341
 
/* Returns the targets column's value in 'row' as a struct ovsdb_datum.
9342
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
9343
 
 * easier and more efficient way to search for a given key than implementing
9344
 
 * the same operation on the "cooked" form in 'row'.
9345
 
 *
9346
 
 * 'key_type' must be OVSDB_TYPE_STRING.
9347
 
 * (This helps to avoid silent bugs if someone changes targets's
9348
 
 * type without updating the caller.)
9349
 
 *
9350
 
 * The caller must not modify or free the returned value.
9351
 
 *
9352
 
 * Various kinds of changes can invalidate the returned value: modifying
9353
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9354
 
 * If the returned value is needed for a long time, it is best to make a copy
9355
 
 * of it with ovsdb_datum_clone(). */
9356
 
const struct ovsdb_datum *
9357
 
ovsrec_netflow_get_targets(const struct ovsrec_netflow *row,
9358
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
9359
 
{
9360
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
9361
 
    return ovsdb_idl_read(&row->header_, &ovsrec_netflow_col_targets);
9362
 
}
9363
 
 
9364
 
void
9365
 
ovsrec_netflow_set_active_timeout(const struct ovsrec_netflow *row, int64_t active_timeout)
9366
 
{
9367
 
    struct ovsdb_datum datum;
9368
 
    union ovsdb_atom key;
9369
 
 
9370
 
    ovs_assert(inited);
9371
 
    datum.n = 1;
9372
 
    datum.keys = &key;
9373
 
    key.integer = active_timeout;
9374
 
    datum.values = NULL;
9375
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ACTIVE_TIMEOUT], &datum);
9376
 
}
9377
 
 
9378
 
void
9379
 
ovsrec_netflow_set_add_id_to_interface(const struct ovsrec_netflow *row, bool add_id_to_interface)
9380
 
{
9381
 
    struct ovsdb_datum datum;
9382
 
    union ovsdb_atom key;
9383
 
 
9384
 
    ovs_assert(inited);
9385
 
    datum.n = 1;
9386
 
    datum.keys = &key;
9387
 
    key.boolean = add_id_to_interface;
9388
 
    datum.values = NULL;
9389
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ADD_ID_TO_INTERFACE], &datum);
9390
 
}
9391
 
 
9392
 
void
9393
 
ovsrec_netflow_set_engine_id(const struct ovsrec_netflow *row, const int64_t *engine_id, size_t n_engine_id)
9394
 
{
9395
 
    struct ovsdb_datum datum;
9396
 
    union ovsdb_atom key;
9397
 
 
9398
 
    ovs_assert(inited);
9399
 
    if (n_engine_id) {
9400
 
        datum.n = 1;
9401
 
        datum.keys = &key;
9402
 
        key.integer = *engine_id;
9403
 
    } else {
9404
 
        datum.n = 0;
9405
 
        datum.keys = NULL;
9406
 
    }
9407
 
    datum.values = NULL;
9408
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ENGINE_ID], &datum);
9409
 
}
9410
 
 
9411
 
void
9412
 
ovsrec_netflow_set_engine_type(const struct ovsrec_netflow *row, const int64_t *engine_type, size_t n_engine_type)
9413
 
{
9414
 
    struct ovsdb_datum datum;
9415
 
    union ovsdb_atom key;
9416
 
 
9417
 
    ovs_assert(inited);
9418
 
    if (n_engine_type) {
9419
 
        datum.n = 1;
9420
 
        datum.keys = &key;
9421
 
        key.integer = *engine_type;
9422
 
    } else {
9423
 
        datum.n = 0;
9424
 
        datum.keys = NULL;
9425
 
    }
9426
 
    datum.values = NULL;
9427
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_ENGINE_TYPE], &datum);
9428
 
}
9429
 
 
9430
 
void
9431
 
ovsrec_netflow_set_external_ids(const struct ovsrec_netflow *row, const struct smap *smap)
9432
 
{
9433
 
    struct ovsdb_datum datum;
9434
 
 
9435
 
    ovs_assert(inited);
9436
 
    if (smap) {
9437
 
        struct smap_node *node;
9438
 
        size_t i;
9439
 
 
9440
 
        datum.n = smap_count(smap);
9441
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
9442
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
9443
 
 
9444
 
        i = 0;
9445
 
        SMAP_FOR_EACH (node, smap) {
9446
 
            datum.keys[i].string = xstrdup(node->key);
9447
 
            datum.values[i].string = xstrdup(node->value);
9448
 
            i++;
9449
 
        }
9450
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
9451
 
    } else {
9452
 
        ovsdb_datum_init_empty(&datum);
9453
 
    }
9454
 
    ovsdb_idl_txn_write(&row->header_,
9455
 
                        &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_EXTERNAL_IDS],
9456
 
                        &datum);
9457
 
}
9458
 
 
9459
 
 
9460
 
void
9461
 
ovsrec_netflow_set_targets(const struct ovsrec_netflow *row, char **targets, size_t n_targets)
9462
 
{
9463
 
    struct ovsdb_datum datum;
9464
 
    size_t i;
9465
 
 
9466
 
    ovs_assert(inited);
9467
 
    datum.n = n_targets;
9468
 
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
9469
 
    datum.values = NULL;
9470
 
    for (i = 0; i < n_targets; i++) {
9471
 
        datum.keys[i].string = xstrdup(targets[i]);
9472
 
    }
9473
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
9474
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_netflow_columns[OVSREC_NETFLOW_COL_TARGETS], &datum);
9475
 
}
9476
 
 
9477
 
struct ovsdb_idl_column ovsrec_netflow_columns[OVSREC_NETFLOW_N_COLUMNS];
9478
 
 
9479
 
static void
9480
 
ovsrec_netflow_columns_init(void)
9481
 
{
9482
 
    struct ovsdb_idl_column *c;
9483
 
 
9484
 
    /* Initialize ovsrec_netflow_col_active_timeout. */
9485
 
    c = &ovsrec_netflow_col_active_timeout;
9486
 
    c->name = "active_timeout";
9487
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
9488
 
    c->type.key.u.integer.min = INT64_C(-1);
9489
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9490
 
    c->type.n_min = 1;
9491
 
    c->type.n_max = 1;
9492
 
    c->mutable = true;
9493
 
    c->parse = ovsrec_netflow_parse_active_timeout;
9494
 
    c->unparse = ovsrec_netflow_unparse_active_timeout;
9495
 
 
9496
 
    /* Initialize ovsrec_netflow_col_add_id_to_interface. */
9497
 
    c = &ovsrec_netflow_col_add_id_to_interface;
9498
 
    c->name = "add_id_to_interface";
9499
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
9500
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9501
 
    c->type.n_min = 1;
9502
 
    c->type.n_max = 1;
9503
 
    c->mutable = true;
9504
 
    c->parse = ovsrec_netflow_parse_add_id_to_interface;
9505
 
    c->unparse = ovsrec_netflow_unparse_add_id_to_interface;
9506
 
 
9507
 
    /* Initialize ovsrec_netflow_col_engine_id. */
9508
 
    c = &ovsrec_netflow_col_engine_id;
9509
 
    c->name = "engine_id";
9510
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
9511
 
    c->type.key.u.integer.min = INT64_C(0);
9512
 
    c->type.key.u.integer.max = INT64_C(255);
9513
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9514
 
    c->type.n_min = 0;
9515
 
    c->type.n_max = 1;
9516
 
    c->mutable = true;
9517
 
    c->parse = ovsrec_netflow_parse_engine_id;
9518
 
    c->unparse = ovsrec_netflow_unparse_engine_id;
9519
 
 
9520
 
    /* Initialize ovsrec_netflow_col_engine_type. */
9521
 
    c = &ovsrec_netflow_col_engine_type;
9522
 
    c->name = "engine_type";
9523
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
9524
 
    c->type.key.u.integer.min = INT64_C(0);
9525
 
    c->type.key.u.integer.max = INT64_C(255);
9526
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9527
 
    c->type.n_min = 0;
9528
 
    c->type.n_max = 1;
9529
 
    c->mutable = true;
9530
 
    c->parse = ovsrec_netflow_parse_engine_type;
9531
 
    c->unparse = ovsrec_netflow_unparse_engine_type;
9532
 
 
9533
 
    /* Initialize ovsrec_netflow_col_external_ids. */
9534
 
    c = &ovsrec_netflow_col_external_ids;
9535
 
    c->name = "external_ids";
9536
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9537
 
    c->type.key.u.string.minLen = 0;
9538
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
9539
 
    c->type.value.u.string.minLen = 0;
9540
 
    c->type.n_min = 0;
9541
 
    c->type.n_max = UINT_MAX;
9542
 
    c->mutable = true;
9543
 
    c->parse = ovsrec_netflow_parse_external_ids;
9544
 
    c->unparse = ovsrec_netflow_unparse_external_ids;
9545
 
 
9546
 
    /* Initialize ovsrec_netflow_col_targets. */
9547
 
    c = &ovsrec_netflow_col_targets;
9548
 
    c->name = "targets";
9549
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
9550
 
    c->type.key.u.string.minLen = 0;
9551
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
9552
 
    c->type.n_min = 1;
9553
 
    c->type.n_max = UINT_MAX;
9554
 
    c->mutable = true;
9555
 
    c->parse = ovsrec_netflow_parse_targets;
9556
 
    c->unparse = ovsrec_netflow_unparse_targets;
9557
 
}
9558
 
 
9559
 
/* Open_vSwitch table. */
9560
 
 
9561
 
static void
9562
 
ovsrec_open_vswitch_parse_bridges(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9563
 
{
9564
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9565
 
    size_t i;
9566
 
 
9567
 
    ovs_assert(inited);
9568
 
    row->bridges = NULL;
9569
 
    row->n_bridges = 0;
9570
 
    for (i = 0; i < datum->n; i++) {
9571
 
        struct ovsrec_bridge *keyRow = ovsrec_bridge_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_BRIDGE], &datum->keys[i].uuid));
9572
 
        if (keyRow) {
9573
 
            if (!row->n_bridges) {
9574
 
                row->bridges = xmalloc(datum->n * sizeof *row->bridges);
9575
 
            }
9576
 
            row->bridges[row->n_bridges] = keyRow;
9577
 
            row->n_bridges++;
9578
 
        }
9579
 
    }
9580
 
}
9581
 
 
9582
 
static void
9583
 
ovsrec_open_vswitch_parse_cur_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9584
 
{
9585
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9586
 
 
9587
 
    ovs_assert(inited);
9588
 
    if (datum->n >= 1) {
9589
 
        row->cur_cfg = datum->keys[0].integer;
9590
 
    } else {
9591
 
        row->cur_cfg = 0;
9592
 
    }
9593
 
}
9594
 
 
9595
 
static void
9596
 
ovsrec_open_vswitch_parse_db_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9597
 
{
9598
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9599
 
 
9600
 
    ovs_assert(inited);
9601
 
    if (datum->n >= 1) {
9602
 
        row->db_version = datum->keys[0].string;
9603
 
    } else {
9604
 
        row->db_version = NULL;
9605
 
    }
9606
 
}
9607
 
 
9608
 
static void
9609
 
ovsrec_open_vswitch_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9610
 
{
9611
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9612
 
    size_t i;
9613
 
 
9614
 
    ovs_assert(inited);
9615
 
    smap_init(&row->external_ids);
9616
 
    for (i = 0; i < datum->n; i++) {
9617
 
        smap_add(&row->external_ids,
9618
 
                 datum->keys[i].string,
9619
 
                 datum->values[i].string);
9620
 
    }
9621
 
}
9622
 
 
9623
 
static void
9624
 
ovsrec_open_vswitch_parse_manager_options(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9625
 
{
9626
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9627
 
    size_t i;
9628
 
 
9629
 
    ovs_assert(inited);
9630
 
    row->manager_options = NULL;
9631
 
    row->n_manager_options = 0;
9632
 
    for (i = 0; i < datum->n; i++) {
9633
 
        struct ovsrec_manager *keyRow = ovsrec_manager_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_MANAGER], &datum->keys[i].uuid));
9634
 
        if (keyRow) {
9635
 
            if (!row->n_manager_options) {
9636
 
                row->manager_options = xmalloc(datum->n * sizeof *row->manager_options);
9637
 
            }
9638
 
            row->manager_options[row->n_manager_options] = keyRow;
9639
 
            row->n_manager_options++;
9640
 
        }
9641
 
    }
9642
 
}
9643
 
 
9644
 
static void
9645
 
ovsrec_open_vswitch_parse_next_cfg(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9646
 
{
9647
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9648
 
 
9649
 
    ovs_assert(inited);
9650
 
    if (datum->n >= 1) {
9651
 
        row->next_cfg = datum->keys[0].integer;
9652
 
    } else {
9653
 
        row->next_cfg = 0;
9654
 
    }
9655
 
}
9656
 
 
9657
 
static void
9658
 
ovsrec_open_vswitch_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9659
 
{
9660
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9661
 
    size_t i;
9662
 
 
9663
 
    ovs_assert(inited);
9664
 
    smap_init(&row->other_config);
9665
 
    for (i = 0; i < datum->n; i++) {
9666
 
        smap_add(&row->other_config,
9667
 
                 datum->keys[i].string,
9668
 
                 datum->values[i].string);
9669
 
    }
9670
 
}
9671
 
 
9672
 
static void
9673
 
ovsrec_open_vswitch_parse_ovs_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9674
 
{
9675
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9676
 
 
9677
 
    ovs_assert(inited);
9678
 
    if (datum->n >= 1) {
9679
 
        row->ovs_version = datum->keys[0].string;
9680
 
    } else {
9681
 
        row->ovs_version = NULL;
9682
 
    }
9683
 
}
9684
 
 
9685
 
static void
9686
 
ovsrec_open_vswitch_parse_ssl(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9687
 
{
9688
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9689
 
 
9690
 
    ovs_assert(inited);
9691
 
    if (datum->n >= 1) {
9692
 
        row->ssl = ovsrec_ssl_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_SSL], &datum->keys[0].uuid));
9693
 
    } else {
9694
 
        row->ssl = NULL;
9695
 
    }
9696
 
}
9697
 
 
9698
 
static void
9699
 
ovsrec_open_vswitch_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9700
 
{
9701
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9702
 
    size_t i;
9703
 
 
9704
 
    ovs_assert(inited);
9705
 
    smap_init(&row->statistics);
9706
 
    for (i = 0; i < datum->n; i++) {
9707
 
        smap_add(&row->statistics,
9708
 
                 datum->keys[i].string,
9709
 
                 datum->values[i].string);
9710
 
    }
9711
 
}
9712
 
 
9713
 
static void
9714
 
ovsrec_open_vswitch_parse_system_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9715
 
{
9716
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9717
 
 
9718
 
    ovs_assert(inited);
9719
 
    if (datum->n >= 1) {
9720
 
        row->system_type = datum->keys[0].string;
9721
 
    } else {
9722
 
        row->system_type = NULL;
9723
 
    }
9724
 
}
9725
 
 
9726
 
static void
9727
 
ovsrec_open_vswitch_parse_system_version(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
9728
 
{
9729
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9730
 
 
9731
 
    ovs_assert(inited);
9732
 
    if (datum->n >= 1) {
9733
 
        row->system_version = datum->keys[0].string;
9734
 
    } else {
9735
 
        row->system_version = NULL;
9736
 
    }
9737
 
}
9738
 
 
9739
 
static void
9740
 
ovsrec_open_vswitch_unparse_bridges(struct ovsdb_idl_row *row_)
9741
 
{
9742
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9743
 
 
9744
 
    ovs_assert(inited);
9745
 
    free(row->bridges);
9746
 
}
9747
 
 
9748
 
static void
9749
 
ovsrec_open_vswitch_unparse_cur_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
9750
 
{
9751
 
    /* Nothing to do. */
9752
 
}
9753
 
 
9754
 
static void
9755
 
ovsrec_open_vswitch_unparse_db_version(struct ovsdb_idl_row *row OVS_UNUSED)
9756
 
{
9757
 
    /* Nothing to do. */
9758
 
}
9759
 
 
9760
 
static void
9761
 
ovsrec_open_vswitch_unparse_external_ids(struct ovsdb_idl_row *row_)
9762
 
{
9763
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9764
 
 
9765
 
    ovs_assert(inited);
9766
 
    smap_destroy(&row->external_ids);
9767
 
}
9768
 
 
9769
 
static void
9770
 
ovsrec_open_vswitch_unparse_manager_options(struct ovsdb_idl_row *row_)
9771
 
{
9772
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9773
 
 
9774
 
    ovs_assert(inited);
9775
 
    free(row->manager_options);
9776
 
}
9777
 
 
9778
 
static void
9779
 
ovsrec_open_vswitch_unparse_next_cfg(struct ovsdb_idl_row *row OVS_UNUSED)
9780
 
{
9781
 
    /* Nothing to do. */
9782
 
}
9783
 
 
9784
 
static void
9785
 
ovsrec_open_vswitch_unparse_other_config(struct ovsdb_idl_row *row_)
9786
 
{
9787
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9788
 
 
9789
 
    ovs_assert(inited);
9790
 
    smap_destroy(&row->other_config);
9791
 
}
9792
 
 
9793
 
static void
9794
 
ovsrec_open_vswitch_unparse_ovs_version(struct ovsdb_idl_row *row OVS_UNUSED)
9795
 
{
9796
 
    /* Nothing to do. */
9797
 
}
9798
 
 
9799
 
static void
9800
 
ovsrec_open_vswitch_unparse_ssl(struct ovsdb_idl_row *row OVS_UNUSED)
9801
 
{
9802
 
    /* Nothing to do. */
9803
 
}
9804
 
 
9805
 
static void
9806
 
ovsrec_open_vswitch_unparse_statistics(struct ovsdb_idl_row *row_)
9807
 
{
9808
 
    struct ovsrec_open_vswitch *row = ovsrec_open_vswitch_cast(row_);
9809
 
 
9810
 
    ovs_assert(inited);
9811
 
    smap_destroy(&row->statistics);
9812
 
}
9813
 
 
9814
 
static void
9815
 
ovsrec_open_vswitch_unparse_system_type(struct ovsdb_idl_row *row OVS_UNUSED)
9816
 
{
9817
 
    /* Nothing to do. */
9818
 
}
9819
 
 
9820
 
static void
9821
 
ovsrec_open_vswitch_unparse_system_version(struct ovsdb_idl_row *row OVS_UNUSED)
9822
 
{
9823
 
    /* Nothing to do. */
9824
 
}
9825
 
 
9826
 
static void
9827
 
ovsrec_open_vswitch_init__(struct ovsdb_idl_row *row)
9828
 
{
9829
 
    ovsrec_open_vswitch_init(ovsrec_open_vswitch_cast(row));
9830
 
}
9831
 
 
9832
 
void
9833
 
ovsrec_open_vswitch_init(struct ovsrec_open_vswitch *row)
9834
 
{
9835
 
    memset(row, 0, sizeof *row); 
9836
 
    smap_init(&row->external_ids);
9837
 
    smap_init(&row->other_config);
9838
 
    smap_init(&row->statistics);
9839
 
}
9840
 
 
9841
 
const struct ovsrec_open_vswitch *
9842
 
ovsrec_open_vswitch_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
9843
 
{
9844
 
    return ovsrec_open_vswitch_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH], uuid));
9845
 
}
9846
 
 
9847
 
const struct ovsrec_open_vswitch *
9848
 
ovsrec_open_vswitch_first(const struct ovsdb_idl *idl)
9849
 
{
9850
 
    return ovsrec_open_vswitch_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH]));
9851
 
}
9852
 
 
9853
 
const struct ovsrec_open_vswitch *
9854
 
ovsrec_open_vswitch_next(const struct ovsrec_open_vswitch *row)
9855
 
{
9856
 
    return ovsrec_open_vswitch_cast(ovsdb_idl_next_row(&row->header_));
9857
 
}
9858
 
 
9859
 
void
9860
 
ovsrec_open_vswitch_delete(const struct ovsrec_open_vswitch *row)
9861
 
{
9862
 
    ovsdb_idl_txn_delete(&row->header_);
9863
 
}
9864
 
 
9865
 
struct ovsrec_open_vswitch *
9866
 
ovsrec_open_vswitch_insert(struct ovsdb_idl_txn *txn)
9867
 
{
9868
 
    return ovsrec_open_vswitch_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_OPEN_VSWITCH], NULL));
9869
 
}
9870
 
 
9871
 
 
9872
 
void
9873
 
ovsrec_open_vswitch_verify_bridges(const struct ovsrec_open_vswitch *row)
9874
 
{
9875
 
    ovs_assert(inited);
9876
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_BRIDGES]);
9877
 
}
9878
 
 
9879
 
void
9880
 
ovsrec_open_vswitch_verify_cur_cfg(const struct ovsrec_open_vswitch *row)
9881
 
{
9882
 
    ovs_assert(inited);
9883
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_CUR_CFG]);
9884
 
}
9885
 
 
9886
 
void
9887
 
ovsrec_open_vswitch_verify_db_version(const struct ovsrec_open_vswitch *row)
9888
 
{
9889
 
    ovs_assert(inited);
9890
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_DB_VERSION]);
9891
 
}
9892
 
 
9893
 
void
9894
 
ovsrec_open_vswitch_verify_external_ids(const struct ovsrec_open_vswitch *row)
9895
 
{
9896
 
    ovs_assert(inited);
9897
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_EXTERNAL_IDS]);
9898
 
}
9899
 
 
9900
 
void
9901
 
ovsrec_open_vswitch_verify_manager_options(const struct ovsrec_open_vswitch *row)
9902
 
{
9903
 
    ovs_assert(inited);
9904
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_MANAGER_OPTIONS]);
9905
 
}
9906
 
 
9907
 
void
9908
 
ovsrec_open_vswitch_verify_next_cfg(const struct ovsrec_open_vswitch *row)
9909
 
{
9910
 
    ovs_assert(inited);
9911
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_NEXT_CFG]);
9912
 
}
9913
 
 
9914
 
void
9915
 
ovsrec_open_vswitch_verify_other_config(const struct ovsrec_open_vswitch *row)
9916
 
{
9917
 
    ovs_assert(inited);
9918
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_OTHER_CONFIG]);
9919
 
}
9920
 
 
9921
 
void
9922
 
ovsrec_open_vswitch_verify_ovs_version(const struct ovsrec_open_vswitch *row)
9923
 
{
9924
 
    ovs_assert(inited);
9925
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_OVS_VERSION]);
9926
 
}
9927
 
 
9928
 
void
9929
 
ovsrec_open_vswitch_verify_ssl(const struct ovsrec_open_vswitch *row)
9930
 
{
9931
 
    ovs_assert(inited);
9932
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SSL]);
9933
 
}
9934
 
 
9935
 
void
9936
 
ovsrec_open_vswitch_verify_statistics(const struct ovsrec_open_vswitch *row)
9937
 
{
9938
 
    ovs_assert(inited);
9939
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_STATISTICS]);
9940
 
}
9941
 
 
9942
 
void
9943
 
ovsrec_open_vswitch_verify_system_type(const struct ovsrec_open_vswitch *row)
9944
 
{
9945
 
    ovs_assert(inited);
9946
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SYSTEM_TYPE]);
9947
 
}
9948
 
 
9949
 
void
9950
 
ovsrec_open_vswitch_verify_system_version(const struct ovsrec_open_vswitch *row)
9951
 
{
9952
 
    ovs_assert(inited);
9953
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SYSTEM_VERSION]);
9954
 
}
9955
 
 
9956
 
/* Returns the bridges column's value in 'row' as a struct ovsdb_datum.
9957
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
9958
 
 * easier and more efficient way to search for a given key than implementing
9959
 
 * the same operation on the "cooked" form in 'row'.
9960
 
 *
9961
 
 * 'key_type' must be OVSDB_TYPE_UUID.
9962
 
 * (This helps to avoid silent bugs if someone changes bridges's
9963
 
 * type without updating the caller.)
9964
 
 *
9965
 
 * The caller must not modify or free the returned value.
9966
 
 *
9967
 
 * Various kinds of changes can invalidate the returned value: modifying
9968
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9969
 
 * If the returned value is needed for a long time, it is best to make a copy
9970
 
 * of it with ovsdb_datum_clone(). */
9971
 
const struct ovsdb_datum *
9972
 
ovsrec_open_vswitch_get_bridges(const struct ovsrec_open_vswitch *row,
9973
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
9974
 
{
9975
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
9976
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_bridges);
9977
 
}
9978
 
 
9979
 
/* Returns the cur_cfg column's value in 'row' as a struct ovsdb_datum.
9980
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
9981
 
 * easier and more efficient way to search for a given key than implementing
9982
 
 * the same operation on the "cooked" form in 'row'.
9983
 
 *
9984
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
9985
 
 * (This helps to avoid silent bugs if someone changes cur_cfg's
9986
 
 * type without updating the caller.)
9987
 
 *
9988
 
 * The caller must not modify or free the returned value.
9989
 
 *
9990
 
 * Various kinds of changes can invalidate the returned value: modifying
9991
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
9992
 
 * If the returned value is needed for a long time, it is best to make a copy
9993
 
 * of it with ovsdb_datum_clone(). */
9994
 
const struct ovsdb_datum *
9995
 
ovsrec_open_vswitch_get_cur_cfg(const struct ovsrec_open_vswitch *row,
9996
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
9997
 
{
9998
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
9999
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_cur_cfg);
10000
 
}
10001
 
 
10002
 
/* Returns the db_version column's value in 'row' as a struct ovsdb_datum.
10003
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
10004
 
 * easier and more efficient way to search for a given key than implementing
10005
 
 * the same operation on the "cooked" form in 'row'.
10006
 
 *
10007
 
 * 'key_type' must be OVSDB_TYPE_STRING.
10008
 
 * (This helps to avoid silent bugs if someone changes db_version's
10009
 
 * type without updating the caller.)
10010
 
 *
10011
 
 * The caller must not modify or free the returned value.
10012
 
 *
10013
 
 * Various kinds of changes can invalidate the returned value: modifying
10014
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10015
 
 * If the returned value is needed for a long time, it is best to make a copy
10016
 
 * of it with ovsdb_datum_clone(). */
10017
 
const struct ovsdb_datum *
10018
 
ovsrec_open_vswitch_get_db_version(const struct ovsrec_open_vswitch *row,
10019
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
10020
 
{
10021
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
10022
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_db_version);
10023
 
}
10024
 
 
10025
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
10026
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
10027
 
 * easier and more efficient way to search for a given key than implementing
10028
 
 * the same operation on the "cooked" form in 'row'.
10029
 
 *
10030
 
 * 'key_type' must be OVSDB_TYPE_STRING.
10031
 
 * 'value_type' must be OVSDB_TYPE_STRING.
10032
 
 * (This helps to avoid silent bugs if someone changes external_ids's
10033
 
 * type without updating the caller.)
10034
 
 *
10035
 
 * The caller must not modify or free the returned value.
10036
 
 *
10037
 
 * Various kinds of changes can invalidate the returned value: modifying
10038
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10039
 
 * If the returned value is needed for a long time, it is best to make a copy
10040
 
 * of it with ovsdb_datum_clone(). */
10041
 
const struct ovsdb_datum *
10042
 
ovsrec_open_vswitch_get_external_ids(const struct ovsrec_open_vswitch *row,
10043
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
10044
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
10045
 
{
10046
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
10047
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
10048
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_external_ids);
10049
 
}
10050
 
 
10051
 
/* Returns the manager_options column's value in 'row' as a struct ovsdb_datum.
10052
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
10053
 
 * easier and more efficient way to search for a given key than implementing
10054
 
 * the same operation on the "cooked" form in 'row'.
10055
 
 *
10056
 
 * 'key_type' must be OVSDB_TYPE_UUID.
10057
 
 * (This helps to avoid silent bugs if someone changes manager_options's
10058
 
 * type without updating the caller.)
10059
 
 *
10060
 
 * The caller must not modify or free the returned value.
10061
 
 *
10062
 
 * Various kinds of changes can invalidate the returned value: modifying
10063
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10064
 
 * If the returned value is needed for a long time, it is best to make a copy
10065
 
 * of it with ovsdb_datum_clone(). */
10066
 
const struct ovsdb_datum *
10067
 
ovsrec_open_vswitch_get_manager_options(const struct ovsrec_open_vswitch *row,
10068
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
10069
 
{
10070
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
10071
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_manager_options);
10072
 
}
10073
 
 
10074
 
/* Returns the next_cfg column's value in 'row' as a struct ovsdb_datum.
10075
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
10076
 
 * easier and more efficient way to search for a given key than implementing
10077
 
 * the same operation on the "cooked" form in 'row'.
10078
 
 *
10079
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
10080
 
 * (This helps to avoid silent bugs if someone changes next_cfg's
10081
 
 * type without updating the caller.)
10082
 
 *
10083
 
 * The caller must not modify or free the returned value.
10084
 
 *
10085
 
 * Various kinds of changes can invalidate the returned value: modifying
10086
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10087
 
 * If the returned value is needed for a long time, it is best to make a copy
10088
 
 * of it with ovsdb_datum_clone(). */
10089
 
const struct ovsdb_datum *
10090
 
ovsrec_open_vswitch_get_next_cfg(const struct ovsrec_open_vswitch *row,
10091
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
10092
 
{
10093
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
10094
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_next_cfg);
10095
 
}
10096
 
 
10097
 
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
10098
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
10099
 
 * easier and more efficient way to search for a given key than implementing
10100
 
 * the same operation on the "cooked" form in 'row'.
10101
 
 *
10102
 
 * 'key_type' must be OVSDB_TYPE_STRING.
10103
 
 * 'value_type' must be OVSDB_TYPE_STRING.
10104
 
 * (This helps to avoid silent bugs if someone changes other_config's
10105
 
 * type without updating the caller.)
10106
 
 *
10107
 
 * The caller must not modify or free the returned value.
10108
 
 *
10109
 
 * Various kinds of changes can invalidate the returned value: modifying
10110
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10111
 
 * If the returned value is needed for a long time, it is best to make a copy
10112
 
 * of it with ovsdb_datum_clone(). */
10113
 
const struct ovsdb_datum *
10114
 
ovsrec_open_vswitch_get_other_config(const struct ovsrec_open_vswitch *row,
10115
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
10116
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
10117
 
{
10118
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
10119
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
10120
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_other_config);
10121
 
}
10122
 
 
10123
 
/* Returns the ovs_version column's value in 'row' as a struct ovsdb_datum.
10124
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
10125
 
 * easier and more efficient way to search for a given key than implementing
10126
 
 * the same operation on the "cooked" form in 'row'.
10127
 
 *
10128
 
 * 'key_type' must be OVSDB_TYPE_STRING.
10129
 
 * (This helps to avoid silent bugs if someone changes ovs_version's
10130
 
 * type without updating the caller.)
10131
 
 *
10132
 
 * The caller must not modify or free the returned value.
10133
 
 *
10134
 
 * Various kinds of changes can invalidate the returned value: modifying
10135
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10136
 
 * If the returned value is needed for a long time, it is best to make a copy
10137
 
 * of it with ovsdb_datum_clone(). */
10138
 
const struct ovsdb_datum *
10139
 
ovsrec_open_vswitch_get_ovs_version(const struct ovsrec_open_vswitch *row,
10140
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
10141
 
{
10142
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
10143
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_ovs_version);
10144
 
}
10145
 
 
10146
 
/* Returns the ssl column's value in 'row' as a struct ovsdb_datum.
10147
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
10148
 
 * easier and more efficient way to search for a given key than implementing
10149
 
 * the same operation on the "cooked" form in 'row'.
10150
 
 *
10151
 
 * 'key_type' must be OVSDB_TYPE_UUID.
10152
 
 * (This helps to avoid silent bugs if someone changes ssl's
10153
 
 * type without updating the caller.)
10154
 
 *
10155
 
 * The caller must not modify or free the returned value.
10156
 
 *
10157
 
 * Various kinds of changes can invalidate the returned value: modifying
10158
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10159
 
 * If the returned value is needed for a long time, it is best to make a copy
10160
 
 * of it with ovsdb_datum_clone(). */
10161
 
const struct ovsdb_datum *
10162
 
ovsrec_open_vswitch_get_ssl(const struct ovsrec_open_vswitch *row,
10163
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
10164
 
{
10165
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
10166
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_ssl);
10167
 
}
10168
 
 
10169
 
/* Returns the statistics column's value in 'row' as a struct ovsdb_datum.
10170
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
10171
 
 * easier and more efficient way to search for a given key than implementing
10172
 
 * the same operation on the "cooked" form in 'row'.
10173
 
 *
10174
 
 * 'key_type' must be OVSDB_TYPE_STRING.
10175
 
 * 'value_type' must be OVSDB_TYPE_STRING.
10176
 
 * (This helps to avoid silent bugs if someone changes statistics's
10177
 
 * type without updating the caller.)
10178
 
 *
10179
 
 * The caller must not modify or free the returned value.
10180
 
 *
10181
 
 * Various kinds of changes can invalidate the returned value: modifying
10182
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10183
 
 * If the returned value is needed for a long time, it is best to make a copy
10184
 
 * of it with ovsdb_datum_clone(). */
10185
 
const struct ovsdb_datum *
10186
 
ovsrec_open_vswitch_get_statistics(const struct ovsrec_open_vswitch *row,
10187
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
10188
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
10189
 
{
10190
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
10191
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
10192
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_statistics);
10193
 
}
10194
 
 
10195
 
/* Returns the system_type column's value in 'row' as a struct ovsdb_datum.
10196
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
10197
 
 * easier and more efficient way to search for a given key than implementing
10198
 
 * the same operation on the "cooked" form in 'row'.
10199
 
 *
10200
 
 * 'key_type' must be OVSDB_TYPE_STRING.
10201
 
 * (This helps to avoid silent bugs if someone changes system_type's
10202
 
 * type without updating the caller.)
10203
 
 *
10204
 
 * The caller must not modify or free the returned value.
10205
 
 *
10206
 
 * Various kinds of changes can invalidate the returned value: modifying
10207
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10208
 
 * If the returned value is needed for a long time, it is best to make a copy
10209
 
 * of it with ovsdb_datum_clone(). */
10210
 
const struct ovsdb_datum *
10211
 
ovsrec_open_vswitch_get_system_type(const struct ovsrec_open_vswitch *row,
10212
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
10213
 
{
10214
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
10215
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_system_type);
10216
 
}
10217
 
 
10218
 
/* Returns the system_version column's value in 'row' as a struct ovsdb_datum.
10219
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
10220
 
 * easier and more efficient way to search for a given key than implementing
10221
 
 * the same operation on the "cooked" form in 'row'.
10222
 
 *
10223
 
 * 'key_type' must be OVSDB_TYPE_STRING.
10224
 
 * (This helps to avoid silent bugs if someone changes system_version's
10225
 
 * type without updating the caller.)
10226
 
 *
10227
 
 * The caller must not modify or free the returned value.
10228
 
 *
10229
 
 * Various kinds of changes can invalidate the returned value: modifying
10230
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
10231
 
 * If the returned value is needed for a long time, it is best to make a copy
10232
 
 * of it with ovsdb_datum_clone(). */
10233
 
const struct ovsdb_datum *
10234
 
ovsrec_open_vswitch_get_system_version(const struct ovsrec_open_vswitch *row,
10235
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
10236
 
{
10237
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
10238
 
    return ovsdb_idl_read(&row->header_, &ovsrec_open_vswitch_col_system_version);
10239
 
}
10240
 
 
10241
 
void
10242
 
ovsrec_open_vswitch_set_bridges(const struct ovsrec_open_vswitch *row, struct ovsrec_bridge **bridges, size_t n_bridges)
10243
 
{
10244
 
    struct ovsdb_datum datum;
10245
 
    size_t i;
10246
 
 
10247
 
    ovs_assert(inited);
10248
 
    datum.n = n_bridges;
10249
 
    datum.keys = n_bridges ? xmalloc(n_bridges * sizeof *datum.keys) : NULL;
10250
 
    datum.values = NULL;
10251
 
    for (i = 0; i < n_bridges; i++) {
10252
 
        datum.keys[i].uuid = bridges[i]->header_.uuid;
10253
 
    }
10254
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
10255
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_BRIDGES], &datum);
10256
 
}
10257
 
 
10258
 
void
10259
 
ovsrec_open_vswitch_set_cur_cfg(const struct ovsrec_open_vswitch *row, int64_t cur_cfg)
10260
 
{
10261
 
    struct ovsdb_datum datum;
10262
 
    union ovsdb_atom key;
10263
 
 
10264
 
    ovs_assert(inited);
10265
 
    datum.n = 1;
10266
 
    datum.keys = &key;
10267
 
    key.integer = cur_cfg;
10268
 
    datum.values = NULL;
10269
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_CUR_CFG], &datum);
10270
 
}
10271
 
 
10272
 
void
10273
 
ovsrec_open_vswitch_set_db_version(const struct ovsrec_open_vswitch *row, const char *db_version)
10274
 
{
10275
 
    struct ovsdb_datum datum;
10276
 
    union ovsdb_atom key;
10277
 
 
10278
 
    ovs_assert(inited);
10279
 
    if (db_version) {
10280
 
        datum.n = 1;
10281
 
        datum.keys = &key;
10282
 
        key.string = CONST_CAST(char *, db_version);
10283
 
    } else {
10284
 
        datum.n = 0;
10285
 
        datum.keys = NULL;
10286
 
    }
10287
 
    datum.values = NULL;
10288
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_DB_VERSION], &datum);
10289
 
}
10290
 
 
10291
 
void
10292
 
ovsrec_open_vswitch_set_external_ids(const struct ovsrec_open_vswitch *row, const struct smap *smap)
10293
 
{
10294
 
    struct ovsdb_datum datum;
10295
 
 
10296
 
    ovs_assert(inited);
10297
 
    if (smap) {
10298
 
        struct smap_node *node;
10299
 
        size_t i;
10300
 
 
10301
 
        datum.n = smap_count(smap);
10302
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
10303
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
10304
 
 
10305
 
        i = 0;
10306
 
        SMAP_FOR_EACH (node, smap) {
10307
 
            datum.keys[i].string = xstrdup(node->key);
10308
 
            datum.values[i].string = xstrdup(node->value);
10309
 
            i++;
10310
 
        }
10311
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
10312
 
    } else {
10313
 
        ovsdb_datum_init_empty(&datum);
10314
 
    }
10315
 
    ovsdb_idl_txn_write(&row->header_,
10316
 
                        &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_EXTERNAL_IDS],
10317
 
                        &datum);
10318
 
}
10319
 
 
10320
 
 
10321
 
void
10322
 
ovsrec_open_vswitch_set_manager_options(const struct ovsrec_open_vswitch *row, struct ovsrec_manager **manager_options, size_t n_manager_options)
10323
 
{
10324
 
    struct ovsdb_datum datum;
10325
 
    size_t i;
10326
 
 
10327
 
    ovs_assert(inited);
10328
 
    datum.n = n_manager_options;
10329
 
    datum.keys = n_manager_options ? xmalloc(n_manager_options * sizeof *datum.keys) : NULL;
10330
 
    datum.values = NULL;
10331
 
    for (i = 0; i < n_manager_options; i++) {
10332
 
        datum.keys[i].uuid = manager_options[i]->header_.uuid;
10333
 
    }
10334
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
10335
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_MANAGER_OPTIONS], &datum);
10336
 
}
10337
 
 
10338
 
void
10339
 
ovsrec_open_vswitch_set_next_cfg(const struct ovsrec_open_vswitch *row, int64_t next_cfg)
10340
 
{
10341
 
    struct ovsdb_datum datum;
10342
 
    union ovsdb_atom key;
10343
 
 
10344
 
    ovs_assert(inited);
10345
 
    datum.n = 1;
10346
 
    datum.keys = &key;
10347
 
    key.integer = next_cfg;
10348
 
    datum.values = NULL;
10349
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_NEXT_CFG], &datum);
10350
 
}
10351
 
 
10352
 
void
10353
 
ovsrec_open_vswitch_set_other_config(const struct ovsrec_open_vswitch *row, const struct smap *smap)
10354
 
{
10355
 
    struct ovsdb_datum datum;
10356
 
 
10357
 
    ovs_assert(inited);
10358
 
    if (smap) {
10359
 
        struct smap_node *node;
10360
 
        size_t i;
10361
 
 
10362
 
        datum.n = smap_count(smap);
10363
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
10364
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
10365
 
 
10366
 
        i = 0;
10367
 
        SMAP_FOR_EACH (node, smap) {
10368
 
            datum.keys[i].string = xstrdup(node->key);
10369
 
            datum.values[i].string = xstrdup(node->value);
10370
 
            i++;
10371
 
        }
10372
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
10373
 
    } else {
10374
 
        ovsdb_datum_init_empty(&datum);
10375
 
    }
10376
 
    ovsdb_idl_txn_write(&row->header_,
10377
 
                        &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_OTHER_CONFIG],
10378
 
                        &datum);
10379
 
}
10380
 
 
10381
 
 
10382
 
void
10383
 
ovsrec_open_vswitch_set_ovs_version(const struct ovsrec_open_vswitch *row, const char *ovs_version)
10384
 
{
10385
 
    struct ovsdb_datum datum;
10386
 
    union ovsdb_atom key;
10387
 
 
10388
 
    ovs_assert(inited);
10389
 
    if (ovs_version) {
10390
 
        datum.n = 1;
10391
 
        datum.keys = &key;
10392
 
        key.string = CONST_CAST(char *, ovs_version);
10393
 
    } else {
10394
 
        datum.n = 0;
10395
 
        datum.keys = NULL;
10396
 
    }
10397
 
    datum.values = NULL;
10398
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_OVS_VERSION], &datum);
10399
 
}
10400
 
 
10401
 
void
10402
 
ovsrec_open_vswitch_set_ssl(const struct ovsrec_open_vswitch *row, const struct ovsrec_ssl *ssl)
10403
 
{
10404
 
    struct ovsdb_datum datum;
10405
 
    union ovsdb_atom key;
10406
 
 
10407
 
    ovs_assert(inited);
10408
 
    if (ssl) {
10409
 
        datum.n = 1;
10410
 
        datum.keys = &key;
10411
 
        key.uuid = ssl->header_.uuid;
10412
 
    } else {
10413
 
        datum.n = 0;
10414
 
        datum.keys = NULL;
10415
 
    }
10416
 
    datum.values = NULL;
10417
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SSL], &datum);
10418
 
}
10419
 
 
10420
 
void
10421
 
ovsrec_open_vswitch_set_statistics(const struct ovsrec_open_vswitch *row, const struct smap *smap)
10422
 
{
10423
 
    struct ovsdb_datum datum;
10424
 
 
10425
 
    ovs_assert(inited);
10426
 
    if (smap) {
10427
 
        struct smap_node *node;
10428
 
        size_t i;
10429
 
 
10430
 
        datum.n = smap_count(smap);
10431
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
10432
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
10433
 
 
10434
 
        i = 0;
10435
 
        SMAP_FOR_EACH (node, smap) {
10436
 
            datum.keys[i].string = xstrdup(node->key);
10437
 
            datum.values[i].string = xstrdup(node->value);
10438
 
            i++;
10439
 
        }
10440
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
10441
 
    } else {
10442
 
        ovsdb_datum_init_empty(&datum);
10443
 
    }
10444
 
    ovsdb_idl_txn_write(&row->header_,
10445
 
                        &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_STATISTICS],
10446
 
                        &datum);
10447
 
}
10448
 
 
10449
 
 
10450
 
void
10451
 
ovsrec_open_vswitch_set_system_type(const struct ovsrec_open_vswitch *row, const char *system_type)
10452
 
{
10453
 
    struct ovsdb_datum datum;
10454
 
    union ovsdb_atom key;
10455
 
 
10456
 
    ovs_assert(inited);
10457
 
    if (system_type) {
10458
 
        datum.n = 1;
10459
 
        datum.keys = &key;
10460
 
        key.string = CONST_CAST(char *, system_type);
10461
 
    } else {
10462
 
        datum.n = 0;
10463
 
        datum.keys = NULL;
10464
 
    }
10465
 
    datum.values = NULL;
10466
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SYSTEM_TYPE], &datum);
10467
 
}
10468
 
 
10469
 
void
10470
 
ovsrec_open_vswitch_set_system_version(const struct ovsrec_open_vswitch *row, const char *system_version)
10471
 
{
10472
 
    struct ovsdb_datum datum;
10473
 
    union ovsdb_atom key;
10474
 
 
10475
 
    ovs_assert(inited);
10476
 
    if (system_version) {
10477
 
        datum.n = 1;
10478
 
        datum.keys = &key;
10479
 
        key.string = CONST_CAST(char *, system_version);
10480
 
    } else {
10481
 
        datum.n = 0;
10482
 
        datum.keys = NULL;
10483
 
    }
10484
 
    datum.values = NULL;
10485
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_COL_SYSTEM_VERSION], &datum);
10486
 
}
10487
 
 
10488
 
struct ovsdb_idl_column ovsrec_open_vswitch_columns[OVSREC_OPEN_VSWITCH_N_COLUMNS];
10489
 
 
10490
 
static void
10491
 
ovsrec_open_vswitch_columns_init(void)
10492
 
{
10493
 
    struct ovsdb_idl_column *c;
10494
 
 
10495
 
    /* Initialize ovsrec_open_vswitch_col_bridges. */
10496
 
    c = &ovsrec_open_vswitch_col_bridges;
10497
 
    c->name = "bridges";
10498
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
10499
 
    c->type.key.u.uuid.refTableName = "Bridge";
10500
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
10501
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10502
 
    c->type.n_min = 0;
10503
 
    c->type.n_max = UINT_MAX;
10504
 
    c->mutable = true;
10505
 
    c->parse = ovsrec_open_vswitch_parse_bridges;
10506
 
    c->unparse = ovsrec_open_vswitch_unparse_bridges;
10507
 
 
10508
 
    /* Initialize ovsrec_open_vswitch_col_cur_cfg. */
10509
 
    c = &ovsrec_open_vswitch_col_cur_cfg;
10510
 
    c->name = "cur_cfg";
10511
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
10512
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10513
 
    c->type.n_min = 1;
10514
 
    c->type.n_max = 1;
10515
 
    c->mutable = true;
10516
 
    c->parse = ovsrec_open_vswitch_parse_cur_cfg;
10517
 
    c->unparse = ovsrec_open_vswitch_unparse_cur_cfg;
10518
 
 
10519
 
    /* Initialize ovsrec_open_vswitch_col_db_version. */
10520
 
    c = &ovsrec_open_vswitch_col_db_version;
10521
 
    c->name = "db_version";
10522
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10523
 
    c->type.key.u.string.minLen = 0;
10524
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10525
 
    c->type.n_min = 0;
10526
 
    c->type.n_max = 1;
10527
 
    c->mutable = true;
10528
 
    c->parse = ovsrec_open_vswitch_parse_db_version;
10529
 
    c->unparse = ovsrec_open_vswitch_unparse_db_version;
10530
 
 
10531
 
    /* Initialize ovsrec_open_vswitch_col_external_ids. */
10532
 
    c = &ovsrec_open_vswitch_col_external_ids;
10533
 
    c->name = "external_ids";
10534
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10535
 
    c->type.key.u.string.minLen = 0;
10536
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
10537
 
    c->type.value.u.string.minLen = 0;
10538
 
    c->type.n_min = 0;
10539
 
    c->type.n_max = UINT_MAX;
10540
 
    c->mutable = true;
10541
 
    c->parse = ovsrec_open_vswitch_parse_external_ids;
10542
 
    c->unparse = ovsrec_open_vswitch_unparse_external_ids;
10543
 
 
10544
 
    /* Initialize ovsrec_open_vswitch_col_manager_options. */
10545
 
    c = &ovsrec_open_vswitch_col_manager_options;
10546
 
    c->name = "manager_options";
10547
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
10548
 
    c->type.key.u.uuid.refTableName = "Manager";
10549
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
10550
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10551
 
    c->type.n_min = 0;
10552
 
    c->type.n_max = UINT_MAX;
10553
 
    c->mutable = true;
10554
 
    c->parse = ovsrec_open_vswitch_parse_manager_options;
10555
 
    c->unparse = ovsrec_open_vswitch_unparse_manager_options;
10556
 
 
10557
 
    /* Initialize ovsrec_open_vswitch_col_next_cfg. */
10558
 
    c = &ovsrec_open_vswitch_col_next_cfg;
10559
 
    c->name = "next_cfg";
10560
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
10561
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10562
 
    c->type.n_min = 1;
10563
 
    c->type.n_max = 1;
10564
 
    c->mutable = true;
10565
 
    c->parse = ovsrec_open_vswitch_parse_next_cfg;
10566
 
    c->unparse = ovsrec_open_vswitch_unparse_next_cfg;
10567
 
 
10568
 
    /* Initialize ovsrec_open_vswitch_col_other_config. */
10569
 
    c = &ovsrec_open_vswitch_col_other_config;
10570
 
    c->name = "other_config";
10571
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10572
 
    c->type.key.u.string.minLen = 0;
10573
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
10574
 
    c->type.value.u.string.minLen = 0;
10575
 
    c->type.n_min = 0;
10576
 
    c->type.n_max = UINT_MAX;
10577
 
    c->mutable = true;
10578
 
    c->parse = ovsrec_open_vswitch_parse_other_config;
10579
 
    c->unparse = ovsrec_open_vswitch_unparse_other_config;
10580
 
 
10581
 
    /* Initialize ovsrec_open_vswitch_col_ovs_version. */
10582
 
    c = &ovsrec_open_vswitch_col_ovs_version;
10583
 
    c->name = "ovs_version";
10584
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10585
 
    c->type.key.u.string.minLen = 0;
10586
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10587
 
    c->type.n_min = 0;
10588
 
    c->type.n_max = 1;
10589
 
    c->mutable = true;
10590
 
    c->parse = ovsrec_open_vswitch_parse_ovs_version;
10591
 
    c->unparse = ovsrec_open_vswitch_unparse_ovs_version;
10592
 
 
10593
 
    /* Initialize ovsrec_open_vswitch_col_ssl. */
10594
 
    c = &ovsrec_open_vswitch_col_ssl;
10595
 
    c->name = "ssl";
10596
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
10597
 
    c->type.key.u.uuid.refTableName = "SSL";
10598
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
10599
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10600
 
    c->type.n_min = 0;
10601
 
    c->type.n_max = 1;
10602
 
    c->mutable = true;
10603
 
    c->parse = ovsrec_open_vswitch_parse_ssl;
10604
 
    c->unparse = ovsrec_open_vswitch_unparse_ssl;
10605
 
 
10606
 
    /* Initialize ovsrec_open_vswitch_col_statistics. */
10607
 
    c = &ovsrec_open_vswitch_col_statistics;
10608
 
    c->name = "statistics";
10609
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10610
 
    c->type.key.u.string.minLen = 0;
10611
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
10612
 
    c->type.value.u.string.minLen = 0;
10613
 
    c->type.n_min = 0;
10614
 
    c->type.n_max = UINT_MAX;
10615
 
    c->mutable = true;
10616
 
    c->parse = ovsrec_open_vswitch_parse_statistics;
10617
 
    c->unparse = ovsrec_open_vswitch_unparse_statistics;
10618
 
 
10619
 
    /* Initialize ovsrec_open_vswitch_col_system_type. */
10620
 
    c = &ovsrec_open_vswitch_col_system_type;
10621
 
    c->name = "system_type";
10622
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10623
 
    c->type.key.u.string.minLen = 0;
10624
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10625
 
    c->type.n_min = 0;
10626
 
    c->type.n_max = 1;
10627
 
    c->mutable = true;
10628
 
    c->parse = ovsrec_open_vswitch_parse_system_type;
10629
 
    c->unparse = ovsrec_open_vswitch_unparse_system_type;
10630
 
 
10631
 
    /* Initialize ovsrec_open_vswitch_col_system_version. */
10632
 
    c = &ovsrec_open_vswitch_col_system_version;
10633
 
    c->name = "system_version";
10634
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
10635
 
    c->type.key.u.string.minLen = 0;
10636
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
10637
 
    c->type.n_min = 0;
10638
 
    c->type.n_max = 1;
10639
 
    c->mutable = true;
10640
 
    c->parse = ovsrec_open_vswitch_parse_system_version;
10641
 
    c->unparse = ovsrec_open_vswitch_unparse_system_version;
10642
 
}
10643
 
 
10644
 
/* Port table. */
10645
 
 
10646
 
static void
10647
 
ovsrec_port_parse_bond_active_slave(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10648
 
{
10649
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10650
 
 
10651
 
    ovs_assert(inited);
10652
 
    if (datum->n >= 1) {
10653
 
        row->bond_active_slave = datum->keys[0].string;
10654
 
    } else {
10655
 
        row->bond_active_slave = NULL;
10656
 
    }
10657
 
}
10658
 
 
10659
 
static void
10660
 
ovsrec_port_parse_bond_downdelay(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10661
 
{
10662
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10663
 
 
10664
 
    ovs_assert(inited);
10665
 
    if (datum->n >= 1) {
10666
 
        row->bond_downdelay = datum->keys[0].integer;
10667
 
    } else {
10668
 
        row->bond_downdelay = 0;
10669
 
    }
10670
 
}
10671
 
 
10672
 
static void
10673
 
ovsrec_port_parse_bond_fake_iface(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10674
 
{
10675
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10676
 
 
10677
 
    ovs_assert(inited);
10678
 
    if (datum->n >= 1) {
10679
 
        row->bond_fake_iface = datum->keys[0].boolean;
10680
 
    } else {
10681
 
        row->bond_fake_iface = false;
10682
 
    }
10683
 
}
10684
 
 
10685
 
static void
10686
 
ovsrec_port_parse_bond_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10687
 
{
10688
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10689
 
 
10690
 
    ovs_assert(inited);
10691
 
    if (datum->n >= 1) {
10692
 
        row->bond_mode = datum->keys[0].string;
10693
 
    } else {
10694
 
        row->bond_mode = NULL;
10695
 
    }
10696
 
}
10697
 
 
10698
 
static void
10699
 
ovsrec_port_parse_bond_updelay(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10700
 
{
10701
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10702
 
 
10703
 
    ovs_assert(inited);
10704
 
    if (datum->n >= 1) {
10705
 
        row->bond_updelay = datum->keys[0].integer;
10706
 
    } else {
10707
 
        row->bond_updelay = 0;
10708
 
    }
10709
 
}
10710
 
 
10711
 
static void
10712
 
ovsrec_port_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10713
 
{
10714
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10715
 
    size_t i;
10716
 
 
10717
 
    ovs_assert(inited);
10718
 
    smap_init(&row->external_ids);
10719
 
    for (i = 0; i < datum->n; i++) {
10720
 
        smap_add(&row->external_ids,
10721
 
                 datum->keys[i].string,
10722
 
                 datum->values[i].string);
10723
 
    }
10724
 
}
10725
 
 
10726
 
static void
10727
 
ovsrec_port_parse_fake_bridge(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10728
 
{
10729
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10730
 
 
10731
 
    ovs_assert(inited);
10732
 
    if (datum->n >= 1) {
10733
 
        row->fake_bridge = datum->keys[0].boolean;
10734
 
    } else {
10735
 
        row->fake_bridge = false;
10736
 
    }
10737
 
}
10738
 
 
10739
 
static void
10740
 
ovsrec_port_parse_interfaces(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10741
 
{
10742
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10743
 
    size_t i;
10744
 
 
10745
 
    ovs_assert(inited);
10746
 
    row->interfaces = NULL;
10747
 
    row->n_interfaces = 0;
10748
 
    for (i = 0; i < datum->n; i++) {
10749
 
        struct ovsrec_interface *keyRow = ovsrec_interface_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_INTERFACE], &datum->keys[i].uuid));
10750
 
        if (keyRow) {
10751
 
            if (!row->n_interfaces) {
10752
 
                row->interfaces = xmalloc(datum->n * sizeof *row->interfaces);
10753
 
            }
10754
 
            row->interfaces[row->n_interfaces] = keyRow;
10755
 
            row->n_interfaces++;
10756
 
        }
10757
 
    }
10758
 
}
10759
 
 
10760
 
static void
10761
 
ovsrec_port_parse_lacp(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10762
 
{
10763
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10764
 
 
10765
 
    ovs_assert(inited);
10766
 
    if (datum->n >= 1) {
10767
 
        row->lacp = datum->keys[0].string;
10768
 
    } else {
10769
 
        row->lacp = NULL;
10770
 
    }
10771
 
}
10772
 
 
10773
 
static void
10774
 
ovsrec_port_parse_mac(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10775
 
{
10776
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10777
 
 
10778
 
    ovs_assert(inited);
10779
 
    if (datum->n >= 1) {
10780
 
        row->mac = datum->keys[0].string;
10781
 
    } else {
10782
 
        row->mac = NULL;
10783
 
    }
10784
 
}
10785
 
 
10786
 
static void
10787
 
ovsrec_port_parse_name(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10788
 
{
10789
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10790
 
 
10791
 
    ovs_assert(inited);
10792
 
    if (datum->n >= 1) {
10793
 
        row->name = datum->keys[0].string;
10794
 
    } else {
10795
 
        row->name = "";
10796
 
    }
10797
 
}
10798
 
 
10799
 
static void
10800
 
ovsrec_port_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10801
 
{
10802
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10803
 
    size_t i;
10804
 
 
10805
 
    ovs_assert(inited);
10806
 
    smap_init(&row->other_config);
10807
 
    for (i = 0; i < datum->n; i++) {
10808
 
        smap_add(&row->other_config,
10809
 
                 datum->keys[i].string,
10810
 
                 datum->values[i].string);
10811
 
    }
10812
 
}
10813
 
 
10814
 
static void
10815
 
ovsrec_port_parse_qos(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10816
 
{
10817
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10818
 
 
10819
 
    ovs_assert(inited);
10820
 
    if (datum->n >= 1) {
10821
 
        row->qos = ovsrec_qos_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_QOS], &datum->keys[0].uuid));
10822
 
    } else {
10823
 
        row->qos = NULL;
10824
 
    }
10825
 
}
10826
 
 
10827
 
static void
10828
 
ovsrec_port_parse_statistics(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10829
 
{
10830
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10831
 
    size_t i;
10832
 
 
10833
 
    ovs_assert(inited);
10834
 
    row->key_statistics = NULL;
10835
 
    row->value_statistics = NULL;
10836
 
    row->n_statistics = 0;
10837
 
    for (i = 0; i < datum->n; i++) {
10838
 
        if (!row->n_statistics) {
10839
 
            row->key_statistics = xmalloc(datum->n * sizeof *row->key_statistics);
10840
 
            row->value_statistics = xmalloc(datum->n * sizeof *row->value_statistics);
10841
 
        }
10842
 
        row->key_statistics[row->n_statistics] = datum->keys[i].string;
10843
 
        row->value_statistics[row->n_statistics] = datum->values[i].integer;
10844
 
        row->n_statistics++;
10845
 
    }
10846
 
}
10847
 
 
10848
 
static void
10849
 
ovsrec_port_parse_status(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10850
 
{
10851
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10852
 
    size_t i;
10853
 
 
10854
 
    ovs_assert(inited);
10855
 
    smap_init(&row->status);
10856
 
    for (i = 0; i < datum->n; i++) {
10857
 
        smap_add(&row->status,
10858
 
                 datum->keys[i].string,
10859
 
                 datum->values[i].string);
10860
 
    }
10861
 
}
10862
 
 
10863
 
static void
10864
 
ovsrec_port_parse_tag(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10865
 
{
10866
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10867
 
    size_t n = MIN(1, datum->n);
10868
 
    size_t i;
10869
 
 
10870
 
    ovs_assert(inited);
10871
 
    row->tag = NULL;
10872
 
    row->n_tag = 0;
10873
 
    for (i = 0; i < n; i++) {
10874
 
        if (!row->n_tag) {
10875
 
            row->tag = xmalloc(n * sizeof *row->tag);
10876
 
        }
10877
 
        row->tag[row->n_tag] = datum->keys[i].integer;
10878
 
        row->n_tag++;
10879
 
    }
10880
 
}
10881
 
 
10882
 
static void
10883
 
ovsrec_port_parse_trunks(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10884
 
{
10885
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10886
 
    size_t n = MIN(4096, datum->n);
10887
 
    size_t i;
10888
 
 
10889
 
    ovs_assert(inited);
10890
 
    row->trunks = NULL;
10891
 
    row->n_trunks = 0;
10892
 
    for (i = 0; i < n; i++) {
10893
 
        if (!row->n_trunks) {
10894
 
            row->trunks = xmalloc(n * sizeof *row->trunks);
10895
 
        }
10896
 
        row->trunks[row->n_trunks] = datum->keys[i].integer;
10897
 
        row->n_trunks++;
10898
 
    }
10899
 
}
10900
 
 
10901
 
static void
10902
 
ovsrec_port_parse_vlan_mode(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
10903
 
{
10904
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10905
 
 
10906
 
    ovs_assert(inited);
10907
 
    if (datum->n >= 1) {
10908
 
        row->vlan_mode = datum->keys[0].string;
10909
 
    } else {
10910
 
        row->vlan_mode = NULL;
10911
 
    }
10912
 
}
10913
 
 
10914
 
static void
10915
 
ovsrec_port_unparse_bond_active_slave(struct ovsdb_idl_row *row OVS_UNUSED)
10916
 
{
10917
 
    /* Nothing to do. */
10918
 
}
10919
 
 
10920
 
static void
10921
 
ovsrec_port_unparse_bond_downdelay(struct ovsdb_idl_row *row OVS_UNUSED)
10922
 
{
10923
 
    /* Nothing to do. */
10924
 
}
10925
 
 
10926
 
static void
10927
 
ovsrec_port_unparse_bond_fake_iface(struct ovsdb_idl_row *row OVS_UNUSED)
10928
 
{
10929
 
    /* Nothing to do. */
10930
 
}
10931
 
 
10932
 
static void
10933
 
ovsrec_port_unparse_bond_mode(struct ovsdb_idl_row *row OVS_UNUSED)
10934
 
{
10935
 
    /* Nothing to do. */
10936
 
}
10937
 
 
10938
 
static void
10939
 
ovsrec_port_unparse_bond_updelay(struct ovsdb_idl_row *row OVS_UNUSED)
10940
 
{
10941
 
    /* Nothing to do. */
10942
 
}
10943
 
 
10944
 
static void
10945
 
ovsrec_port_unparse_external_ids(struct ovsdb_idl_row *row_)
10946
 
{
10947
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10948
 
 
10949
 
    ovs_assert(inited);
10950
 
    smap_destroy(&row->external_ids);
10951
 
}
10952
 
 
10953
 
static void
10954
 
ovsrec_port_unparse_fake_bridge(struct ovsdb_idl_row *row OVS_UNUSED)
10955
 
{
10956
 
    /* Nothing to do. */
10957
 
}
10958
 
 
10959
 
static void
10960
 
ovsrec_port_unparse_interfaces(struct ovsdb_idl_row *row_)
10961
 
{
10962
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10963
 
 
10964
 
    ovs_assert(inited);
10965
 
    free(row->interfaces);
10966
 
}
10967
 
 
10968
 
static void
10969
 
ovsrec_port_unparse_lacp(struct ovsdb_idl_row *row OVS_UNUSED)
10970
 
{
10971
 
    /* Nothing to do. */
10972
 
}
10973
 
 
10974
 
static void
10975
 
ovsrec_port_unparse_mac(struct ovsdb_idl_row *row OVS_UNUSED)
10976
 
{
10977
 
    /* Nothing to do. */
10978
 
}
10979
 
 
10980
 
static void
10981
 
ovsrec_port_unparse_name(struct ovsdb_idl_row *row OVS_UNUSED)
10982
 
{
10983
 
    /* Nothing to do. */
10984
 
}
10985
 
 
10986
 
static void
10987
 
ovsrec_port_unparse_other_config(struct ovsdb_idl_row *row_)
10988
 
{
10989
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
10990
 
 
10991
 
    ovs_assert(inited);
10992
 
    smap_destroy(&row->other_config);
10993
 
}
10994
 
 
10995
 
static void
10996
 
ovsrec_port_unparse_qos(struct ovsdb_idl_row *row OVS_UNUSED)
10997
 
{
10998
 
    /* Nothing to do. */
10999
 
}
11000
 
 
11001
 
static void
11002
 
ovsrec_port_unparse_statistics(struct ovsdb_idl_row *row_)
11003
 
{
11004
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
11005
 
 
11006
 
    ovs_assert(inited);
11007
 
    free(row->key_statistics);
11008
 
    free(row->value_statistics);
11009
 
}
11010
 
 
11011
 
static void
11012
 
ovsrec_port_unparse_status(struct ovsdb_idl_row *row_)
11013
 
{
11014
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
11015
 
 
11016
 
    ovs_assert(inited);
11017
 
    smap_destroy(&row->status);
11018
 
}
11019
 
 
11020
 
static void
11021
 
ovsrec_port_unparse_tag(struct ovsdb_idl_row *row_)
11022
 
{
11023
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
11024
 
 
11025
 
    ovs_assert(inited);
11026
 
    free(row->tag);
11027
 
}
11028
 
 
11029
 
static void
11030
 
ovsrec_port_unparse_trunks(struct ovsdb_idl_row *row_)
11031
 
{
11032
 
    struct ovsrec_port *row = ovsrec_port_cast(row_);
11033
 
 
11034
 
    ovs_assert(inited);
11035
 
    free(row->trunks);
11036
 
}
11037
 
 
11038
 
static void
11039
 
ovsrec_port_unparse_vlan_mode(struct ovsdb_idl_row *row OVS_UNUSED)
11040
 
{
11041
 
    /* Nothing to do. */
11042
 
}
11043
 
 
11044
 
static void
11045
 
ovsrec_port_init__(struct ovsdb_idl_row *row)
11046
 
{
11047
 
    ovsrec_port_init(ovsrec_port_cast(row));
11048
 
}
11049
 
 
11050
 
void
11051
 
ovsrec_port_init(struct ovsrec_port *row)
11052
 
{
11053
 
    memset(row, 0, sizeof *row); 
11054
 
    smap_init(&row->external_ids);
11055
 
    smap_init(&row->other_config);
11056
 
    smap_init(&row->status);
11057
 
}
11058
 
 
11059
 
const struct ovsrec_port *
11060
 
ovsrec_port_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
11061
 
{
11062
 
    return ovsrec_port_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_PORT], uuid));
11063
 
}
11064
 
 
11065
 
const struct ovsrec_port *
11066
 
ovsrec_port_first(const struct ovsdb_idl *idl)
11067
 
{
11068
 
    return ovsrec_port_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_PORT]));
11069
 
}
11070
 
 
11071
 
const struct ovsrec_port *
11072
 
ovsrec_port_next(const struct ovsrec_port *row)
11073
 
{
11074
 
    return ovsrec_port_cast(ovsdb_idl_next_row(&row->header_));
11075
 
}
11076
 
 
11077
 
void
11078
 
ovsrec_port_delete(const struct ovsrec_port *row)
11079
 
{
11080
 
    ovsdb_idl_txn_delete(&row->header_);
11081
 
}
11082
 
 
11083
 
struct ovsrec_port *
11084
 
ovsrec_port_insert(struct ovsdb_idl_txn *txn)
11085
 
{
11086
 
    return ovsrec_port_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_PORT], NULL));
11087
 
}
11088
 
 
11089
 
 
11090
 
void
11091
 
ovsrec_port_verify_bond_active_slave(const struct ovsrec_port *row)
11092
 
{
11093
 
    ovs_assert(inited);
11094
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_ACTIVE_SLAVE]);
11095
 
}
11096
 
 
11097
 
void
11098
 
ovsrec_port_verify_bond_downdelay(const struct ovsrec_port *row)
11099
 
{
11100
 
    ovs_assert(inited);
11101
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_DOWNDELAY]);
11102
 
}
11103
 
 
11104
 
void
11105
 
ovsrec_port_verify_bond_fake_iface(const struct ovsrec_port *row)
11106
 
{
11107
 
    ovs_assert(inited);
11108
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_FAKE_IFACE]);
11109
 
}
11110
 
 
11111
 
void
11112
 
ovsrec_port_verify_bond_mode(const struct ovsrec_port *row)
11113
 
{
11114
 
    ovs_assert(inited);
11115
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_MODE]);
11116
 
}
11117
 
 
11118
 
void
11119
 
ovsrec_port_verify_bond_updelay(const struct ovsrec_port *row)
11120
 
{
11121
 
    ovs_assert(inited);
11122
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_UPDELAY]);
11123
 
}
11124
 
 
11125
 
void
11126
 
ovsrec_port_verify_external_ids(const struct ovsrec_port *row)
11127
 
{
11128
 
    ovs_assert(inited);
11129
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_EXTERNAL_IDS]);
11130
 
}
11131
 
 
11132
 
void
11133
 
ovsrec_port_verify_fake_bridge(const struct ovsrec_port *row)
11134
 
{
11135
 
    ovs_assert(inited);
11136
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_FAKE_BRIDGE]);
11137
 
}
11138
 
 
11139
 
void
11140
 
ovsrec_port_verify_interfaces(const struct ovsrec_port *row)
11141
 
{
11142
 
    ovs_assert(inited);
11143
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_INTERFACES]);
11144
 
}
11145
 
 
11146
 
void
11147
 
ovsrec_port_verify_lacp(const struct ovsrec_port *row)
11148
 
{
11149
 
    ovs_assert(inited);
11150
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_LACP]);
11151
 
}
11152
 
 
11153
 
void
11154
 
ovsrec_port_verify_mac(const struct ovsrec_port *row)
11155
 
{
11156
 
    ovs_assert(inited);
11157
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_MAC]);
11158
 
}
11159
 
 
11160
 
void
11161
 
ovsrec_port_verify_name(const struct ovsrec_port *row)
11162
 
{
11163
 
    ovs_assert(inited);
11164
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_NAME]);
11165
 
}
11166
 
 
11167
 
void
11168
 
ovsrec_port_verify_other_config(const struct ovsrec_port *row)
11169
 
{
11170
 
    ovs_assert(inited);
11171
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_OTHER_CONFIG]);
11172
 
}
11173
 
 
11174
 
void
11175
 
ovsrec_port_verify_qos(const struct ovsrec_port *row)
11176
 
{
11177
 
    ovs_assert(inited);
11178
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_QOS]);
11179
 
}
11180
 
 
11181
 
void
11182
 
ovsrec_port_verify_statistics(const struct ovsrec_port *row)
11183
 
{
11184
 
    ovs_assert(inited);
11185
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_STATISTICS]);
11186
 
}
11187
 
 
11188
 
void
11189
 
ovsrec_port_verify_status(const struct ovsrec_port *row)
11190
 
{
11191
 
    ovs_assert(inited);
11192
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_STATUS]);
11193
 
}
11194
 
 
11195
 
void
11196
 
ovsrec_port_verify_tag(const struct ovsrec_port *row)
11197
 
{
11198
 
    ovs_assert(inited);
11199
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_TAG]);
11200
 
}
11201
 
 
11202
 
void
11203
 
ovsrec_port_verify_trunks(const struct ovsrec_port *row)
11204
 
{
11205
 
    ovs_assert(inited);
11206
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_TRUNKS]);
11207
 
}
11208
 
 
11209
 
void
11210
 
ovsrec_port_verify_vlan_mode(const struct ovsrec_port *row)
11211
 
{
11212
 
    ovs_assert(inited);
11213
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_VLAN_MODE]);
11214
 
}
11215
 
 
11216
 
/* Returns the bond_active_slave column's value in 'row' as a struct ovsdb_datum.
11217
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11218
 
 * easier and more efficient way to search for a given key than implementing
11219
 
 * the same operation on the "cooked" form in 'row'.
11220
 
 *
11221
 
 * 'key_type' must be OVSDB_TYPE_STRING.
11222
 
 * (This helps to avoid silent bugs if someone changes bond_active_slave's
11223
 
 * type without updating the caller.)
11224
 
 *
11225
 
 * The caller must not modify or free the returned value.
11226
 
 *
11227
 
 * Various kinds of changes can invalidate the returned value: modifying
11228
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11229
 
 * If the returned value is needed for a long time, it is best to make a copy
11230
 
 * of it with ovsdb_datum_clone(). */
11231
 
const struct ovsdb_datum *
11232
 
ovsrec_port_get_bond_active_slave(const struct ovsrec_port *row,
11233
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11234
 
{
11235
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11236
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_active_slave);
11237
 
}
11238
 
 
11239
 
/* Returns the bond_downdelay column's value in 'row' as a struct ovsdb_datum.
11240
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11241
 
 * easier and more efficient way to search for a given key than implementing
11242
 
 * the same operation on the "cooked" form in 'row'.
11243
 
 *
11244
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
11245
 
 * (This helps to avoid silent bugs if someone changes bond_downdelay's
11246
 
 * type without updating the caller.)
11247
 
 *
11248
 
 * The caller must not modify or free the returned value.
11249
 
 *
11250
 
 * Various kinds of changes can invalidate the returned value: modifying
11251
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11252
 
 * If the returned value is needed for a long time, it is best to make a copy
11253
 
 * of it with ovsdb_datum_clone(). */
11254
 
const struct ovsdb_datum *
11255
 
ovsrec_port_get_bond_downdelay(const struct ovsrec_port *row,
11256
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11257
 
{
11258
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
11259
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_downdelay);
11260
 
}
11261
 
 
11262
 
/* Returns the bond_fake_iface column's value in 'row' as a struct ovsdb_datum.
11263
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11264
 
 * easier and more efficient way to search for a given key than implementing
11265
 
 * the same operation on the "cooked" form in 'row'.
11266
 
 *
11267
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
11268
 
 * (This helps to avoid silent bugs if someone changes bond_fake_iface's
11269
 
 * type without updating the caller.)
11270
 
 *
11271
 
 * The caller must not modify or free the returned value.
11272
 
 *
11273
 
 * Various kinds of changes can invalidate the returned value: modifying
11274
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11275
 
 * If the returned value is needed for a long time, it is best to make a copy
11276
 
 * of it with ovsdb_datum_clone(). */
11277
 
const struct ovsdb_datum *
11278
 
ovsrec_port_get_bond_fake_iface(const struct ovsrec_port *row,
11279
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11280
 
{
11281
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
11282
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_fake_iface);
11283
 
}
11284
 
 
11285
 
/* Returns the bond_mode column's value in 'row' as a struct ovsdb_datum.
11286
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11287
 
 * easier and more efficient way to search for a given key than implementing
11288
 
 * the same operation on the "cooked" form in 'row'.
11289
 
 *
11290
 
 * 'key_type' must be OVSDB_TYPE_STRING.
11291
 
 * (This helps to avoid silent bugs if someone changes bond_mode's
11292
 
 * type without updating the caller.)
11293
 
 *
11294
 
 * The caller must not modify or free the returned value.
11295
 
 *
11296
 
 * Various kinds of changes can invalidate the returned value: modifying
11297
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11298
 
 * If the returned value is needed for a long time, it is best to make a copy
11299
 
 * of it with ovsdb_datum_clone(). */
11300
 
const struct ovsdb_datum *
11301
 
ovsrec_port_get_bond_mode(const struct ovsrec_port *row,
11302
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11303
 
{
11304
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11305
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_mode);
11306
 
}
11307
 
 
11308
 
/* Returns the bond_updelay column's value in 'row' as a struct ovsdb_datum.
11309
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11310
 
 * easier and more efficient way to search for a given key than implementing
11311
 
 * the same operation on the "cooked" form in 'row'.
11312
 
 *
11313
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
11314
 
 * (This helps to avoid silent bugs if someone changes bond_updelay's
11315
 
 * type without updating the caller.)
11316
 
 *
11317
 
 * The caller must not modify or free the returned value.
11318
 
 *
11319
 
 * Various kinds of changes can invalidate the returned value: modifying
11320
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11321
 
 * If the returned value is needed for a long time, it is best to make a copy
11322
 
 * of it with ovsdb_datum_clone(). */
11323
 
const struct ovsdb_datum *
11324
 
ovsrec_port_get_bond_updelay(const struct ovsrec_port *row,
11325
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11326
 
{
11327
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
11328
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_bond_updelay);
11329
 
}
11330
 
 
11331
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
11332
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11333
 
 * easier and more efficient way to search for a given key than implementing
11334
 
 * the same operation on the "cooked" form in 'row'.
11335
 
 *
11336
 
 * 'key_type' must be OVSDB_TYPE_STRING.
11337
 
 * 'value_type' must be OVSDB_TYPE_STRING.
11338
 
 * (This helps to avoid silent bugs if someone changes external_ids's
11339
 
 * type without updating the caller.)
11340
 
 *
11341
 
 * The caller must not modify or free the returned value.
11342
 
 *
11343
 
 * Various kinds of changes can invalidate the returned value: modifying
11344
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11345
 
 * If the returned value is needed for a long time, it is best to make a copy
11346
 
 * of it with ovsdb_datum_clone(). */
11347
 
const struct ovsdb_datum *
11348
 
ovsrec_port_get_external_ids(const struct ovsrec_port *row,
11349
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
11350
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
11351
 
{
11352
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11353
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
11354
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_external_ids);
11355
 
}
11356
 
 
11357
 
/* Returns the fake_bridge column's value in 'row' as a struct ovsdb_datum.
11358
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11359
 
 * easier and more efficient way to search for a given key than implementing
11360
 
 * the same operation on the "cooked" form in 'row'.
11361
 
 *
11362
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
11363
 
 * (This helps to avoid silent bugs if someone changes fake_bridge's
11364
 
 * type without updating the caller.)
11365
 
 *
11366
 
 * The caller must not modify or free the returned value.
11367
 
 *
11368
 
 * Various kinds of changes can invalidate the returned value: modifying
11369
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11370
 
 * If the returned value is needed for a long time, it is best to make a copy
11371
 
 * of it with ovsdb_datum_clone(). */
11372
 
const struct ovsdb_datum *
11373
 
ovsrec_port_get_fake_bridge(const struct ovsrec_port *row,
11374
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11375
 
{
11376
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
11377
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_fake_bridge);
11378
 
}
11379
 
 
11380
 
/* Returns the interfaces column's value in 'row' as a struct ovsdb_datum.
11381
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11382
 
 * easier and more efficient way to search for a given key than implementing
11383
 
 * the same operation on the "cooked" form in 'row'.
11384
 
 *
11385
 
 * 'key_type' must be OVSDB_TYPE_UUID.
11386
 
 * (This helps to avoid silent bugs if someone changes interfaces's
11387
 
 * type without updating the caller.)
11388
 
 *
11389
 
 * The caller must not modify or free the returned value.
11390
 
 *
11391
 
 * Various kinds of changes can invalidate the returned value: modifying
11392
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11393
 
 * If the returned value is needed for a long time, it is best to make a copy
11394
 
 * of it with ovsdb_datum_clone(). */
11395
 
const struct ovsdb_datum *
11396
 
ovsrec_port_get_interfaces(const struct ovsrec_port *row,
11397
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11398
 
{
11399
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
11400
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_interfaces);
11401
 
}
11402
 
 
11403
 
/* Returns the lacp column's value in 'row' as a struct ovsdb_datum.
11404
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11405
 
 * easier and more efficient way to search for a given key than implementing
11406
 
 * the same operation on the "cooked" form in 'row'.
11407
 
 *
11408
 
 * 'key_type' must be OVSDB_TYPE_STRING.
11409
 
 * (This helps to avoid silent bugs if someone changes lacp's
11410
 
 * type without updating the caller.)
11411
 
 *
11412
 
 * The caller must not modify or free the returned value.
11413
 
 *
11414
 
 * Various kinds of changes can invalidate the returned value: modifying
11415
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11416
 
 * If the returned value is needed for a long time, it is best to make a copy
11417
 
 * of it with ovsdb_datum_clone(). */
11418
 
const struct ovsdb_datum *
11419
 
ovsrec_port_get_lacp(const struct ovsrec_port *row,
11420
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11421
 
{
11422
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11423
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_lacp);
11424
 
}
11425
 
 
11426
 
/* Returns the mac column's value in 'row' as a struct ovsdb_datum.
11427
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11428
 
 * easier and more efficient way to search for a given key than implementing
11429
 
 * the same operation on the "cooked" form in 'row'.
11430
 
 *
11431
 
 * 'key_type' must be OVSDB_TYPE_STRING.
11432
 
 * (This helps to avoid silent bugs if someone changes mac's
11433
 
 * type without updating the caller.)
11434
 
 *
11435
 
 * The caller must not modify or free the returned value.
11436
 
 *
11437
 
 * Various kinds of changes can invalidate the returned value: modifying
11438
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11439
 
 * If the returned value is needed for a long time, it is best to make a copy
11440
 
 * of it with ovsdb_datum_clone(). */
11441
 
const struct ovsdb_datum *
11442
 
ovsrec_port_get_mac(const struct ovsrec_port *row,
11443
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11444
 
{
11445
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11446
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_mac);
11447
 
}
11448
 
 
11449
 
/* Returns the name column's value in 'row' as a struct ovsdb_datum.
11450
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11451
 
 * easier and more efficient way to search for a given key than implementing
11452
 
 * the same operation on the "cooked" form in 'row'.
11453
 
 *
11454
 
 * 'key_type' must be OVSDB_TYPE_STRING.
11455
 
 * (This helps to avoid silent bugs if someone changes name's
11456
 
 * type without updating the caller.)
11457
 
 *
11458
 
 * The caller must not modify or free the returned value.
11459
 
 *
11460
 
 * Various kinds of changes can invalidate the returned value: modifying
11461
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11462
 
 * If the returned value is needed for a long time, it is best to make a copy
11463
 
 * of it with ovsdb_datum_clone(). */
11464
 
const struct ovsdb_datum *
11465
 
ovsrec_port_get_name(const struct ovsrec_port *row,
11466
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11467
 
{
11468
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11469
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_name);
11470
 
}
11471
 
 
11472
 
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
11473
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11474
 
 * easier and more efficient way to search for a given key than implementing
11475
 
 * the same operation on the "cooked" form in 'row'.
11476
 
 *
11477
 
 * 'key_type' must be OVSDB_TYPE_STRING.
11478
 
 * 'value_type' must be OVSDB_TYPE_STRING.
11479
 
 * (This helps to avoid silent bugs if someone changes other_config's
11480
 
 * type without updating the caller.)
11481
 
 *
11482
 
 * The caller must not modify or free the returned value.
11483
 
 *
11484
 
 * Various kinds of changes can invalidate the returned value: modifying
11485
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11486
 
 * If the returned value is needed for a long time, it is best to make a copy
11487
 
 * of it with ovsdb_datum_clone(). */
11488
 
const struct ovsdb_datum *
11489
 
ovsrec_port_get_other_config(const struct ovsrec_port *row,
11490
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
11491
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
11492
 
{
11493
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11494
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
11495
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_other_config);
11496
 
}
11497
 
 
11498
 
/* Returns the qos column's value in 'row' as a struct ovsdb_datum.
11499
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11500
 
 * easier and more efficient way to search for a given key than implementing
11501
 
 * the same operation on the "cooked" form in 'row'.
11502
 
 *
11503
 
 * 'key_type' must be OVSDB_TYPE_UUID.
11504
 
 * (This helps to avoid silent bugs if someone changes qos's
11505
 
 * type without updating the caller.)
11506
 
 *
11507
 
 * The caller must not modify or free the returned value.
11508
 
 *
11509
 
 * Various kinds of changes can invalidate the returned value: modifying
11510
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11511
 
 * If the returned value is needed for a long time, it is best to make a copy
11512
 
 * of it with ovsdb_datum_clone(). */
11513
 
const struct ovsdb_datum *
11514
 
ovsrec_port_get_qos(const struct ovsrec_port *row,
11515
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11516
 
{
11517
 
    ovs_assert(key_type == OVSDB_TYPE_UUID);
11518
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_qos);
11519
 
}
11520
 
 
11521
 
/* Returns the statistics column's value in 'row' as a struct ovsdb_datum.
11522
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11523
 
 * easier and more efficient way to search for a given key than implementing
11524
 
 * the same operation on the "cooked" form in 'row'.
11525
 
 *
11526
 
 * 'key_type' must be OVSDB_TYPE_STRING.
11527
 
 * 'value_type' must be OVSDB_TYPE_INTEGER.
11528
 
 * (This helps to avoid silent bugs if someone changes statistics's
11529
 
 * type without updating the caller.)
11530
 
 *
11531
 
 * The caller must not modify or free the returned value.
11532
 
 *
11533
 
 * Various kinds of changes can invalidate the returned value: modifying
11534
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11535
 
 * If the returned value is needed for a long time, it is best to make a copy
11536
 
 * of it with ovsdb_datum_clone(). */
11537
 
const struct ovsdb_datum *
11538
 
ovsrec_port_get_statistics(const struct ovsrec_port *row,
11539
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
11540
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
11541
 
{
11542
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11543
 
    ovs_assert(value_type == OVSDB_TYPE_INTEGER);
11544
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_statistics);
11545
 
}
11546
 
 
11547
 
/* Returns the status column's value in 'row' as a struct ovsdb_datum.
11548
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11549
 
 * easier and more efficient way to search for a given key than implementing
11550
 
 * the same operation on the "cooked" form in 'row'.
11551
 
 *
11552
 
 * 'key_type' must be OVSDB_TYPE_STRING.
11553
 
 * 'value_type' must be OVSDB_TYPE_STRING.
11554
 
 * (This helps to avoid silent bugs if someone changes status's
11555
 
 * type without updating the caller.)
11556
 
 *
11557
 
 * The caller must not modify or free the returned value.
11558
 
 *
11559
 
 * Various kinds of changes can invalidate the returned value: modifying
11560
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11561
 
 * If the returned value is needed for a long time, it is best to make a copy
11562
 
 * of it with ovsdb_datum_clone(). */
11563
 
const struct ovsdb_datum *
11564
 
ovsrec_port_get_status(const struct ovsrec_port *row,
11565
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
11566
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
11567
 
{
11568
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11569
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
11570
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_status);
11571
 
}
11572
 
 
11573
 
/* Returns the tag column's value in 'row' as a struct ovsdb_datum.
11574
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11575
 
 * easier and more efficient way to search for a given key than implementing
11576
 
 * the same operation on the "cooked" form in 'row'.
11577
 
 *
11578
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
11579
 
 * (This helps to avoid silent bugs if someone changes tag's
11580
 
 * type without updating the caller.)
11581
 
 *
11582
 
 * The caller must not modify or free the returned value.
11583
 
 *
11584
 
 * Various kinds of changes can invalidate the returned value: modifying
11585
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11586
 
 * If the returned value is needed for a long time, it is best to make a copy
11587
 
 * of it with ovsdb_datum_clone(). */
11588
 
const struct ovsdb_datum *
11589
 
ovsrec_port_get_tag(const struct ovsrec_port *row,
11590
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11591
 
{
11592
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
11593
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_tag);
11594
 
}
11595
 
 
11596
 
/* Returns the trunks column's value in 'row' as a struct ovsdb_datum.
11597
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11598
 
 * easier and more efficient way to search for a given key than implementing
11599
 
 * the same operation on the "cooked" form in 'row'.
11600
 
 *
11601
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
11602
 
 * (This helps to avoid silent bugs if someone changes trunks's
11603
 
 * type without updating the caller.)
11604
 
 *
11605
 
 * The caller must not modify or free the returned value.
11606
 
 *
11607
 
 * Various kinds of changes can invalidate the returned value: modifying
11608
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11609
 
 * If the returned value is needed for a long time, it is best to make a copy
11610
 
 * of it with ovsdb_datum_clone(). */
11611
 
const struct ovsdb_datum *
11612
 
ovsrec_port_get_trunks(const struct ovsrec_port *row,
11613
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11614
 
{
11615
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
11616
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_trunks);
11617
 
}
11618
 
 
11619
 
/* Returns the vlan_mode column's value in 'row' as a struct ovsdb_datum.
11620
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
11621
 
 * easier and more efficient way to search for a given key than implementing
11622
 
 * the same operation on the "cooked" form in 'row'.
11623
 
 *
11624
 
 * 'key_type' must be OVSDB_TYPE_STRING.
11625
 
 * (This helps to avoid silent bugs if someone changes vlan_mode's
11626
 
 * type without updating the caller.)
11627
 
 *
11628
 
 * The caller must not modify or free the returned value.
11629
 
 *
11630
 
 * Various kinds of changes can invalidate the returned value: modifying
11631
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
11632
 
 * If the returned value is needed for a long time, it is best to make a copy
11633
 
 * of it with ovsdb_datum_clone(). */
11634
 
const struct ovsdb_datum *
11635
 
ovsrec_port_get_vlan_mode(const struct ovsrec_port *row,
11636
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
11637
 
{
11638
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
11639
 
    return ovsdb_idl_read(&row->header_, &ovsrec_port_col_vlan_mode);
11640
 
}
11641
 
 
11642
 
void
11643
 
ovsrec_port_set_bond_active_slave(const struct ovsrec_port *row, const char *bond_active_slave)
11644
 
{
11645
 
    struct ovsdb_datum datum;
11646
 
    union ovsdb_atom key;
11647
 
 
11648
 
    ovs_assert(inited);
11649
 
    if (bond_active_slave) {
11650
 
        datum.n = 1;
11651
 
        datum.keys = &key;
11652
 
        key.string = CONST_CAST(char *, bond_active_slave);
11653
 
    } else {
11654
 
        datum.n = 0;
11655
 
        datum.keys = NULL;
11656
 
    }
11657
 
    datum.values = NULL;
11658
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_ACTIVE_SLAVE], &datum);
11659
 
}
11660
 
 
11661
 
void
11662
 
ovsrec_port_set_bond_downdelay(const struct ovsrec_port *row, int64_t bond_downdelay)
11663
 
{
11664
 
    struct ovsdb_datum datum;
11665
 
    union ovsdb_atom key;
11666
 
 
11667
 
    ovs_assert(inited);
11668
 
    datum.n = 1;
11669
 
    datum.keys = &key;
11670
 
    key.integer = bond_downdelay;
11671
 
    datum.values = NULL;
11672
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_DOWNDELAY], &datum);
11673
 
}
11674
 
 
11675
 
void
11676
 
ovsrec_port_set_bond_fake_iface(const struct ovsrec_port *row, bool bond_fake_iface)
11677
 
{
11678
 
    struct ovsdb_datum datum;
11679
 
    union ovsdb_atom key;
11680
 
 
11681
 
    ovs_assert(inited);
11682
 
    datum.n = 1;
11683
 
    datum.keys = &key;
11684
 
    key.boolean = bond_fake_iface;
11685
 
    datum.values = NULL;
11686
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_FAKE_IFACE], &datum);
11687
 
}
11688
 
 
11689
 
void
11690
 
ovsrec_port_set_bond_mode(const struct ovsrec_port *row, const char *bond_mode)
11691
 
{
11692
 
    struct ovsdb_datum datum;
11693
 
    union ovsdb_atom key;
11694
 
 
11695
 
    ovs_assert(inited);
11696
 
    if (bond_mode) {
11697
 
        datum.n = 1;
11698
 
        datum.keys = &key;
11699
 
        key.string = CONST_CAST(char *, bond_mode);
11700
 
    } else {
11701
 
        datum.n = 0;
11702
 
        datum.keys = NULL;
11703
 
    }
11704
 
    datum.values = NULL;
11705
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_MODE], &datum);
11706
 
}
11707
 
 
11708
 
void
11709
 
ovsrec_port_set_bond_updelay(const struct ovsrec_port *row, int64_t bond_updelay)
11710
 
{
11711
 
    struct ovsdb_datum datum;
11712
 
    union ovsdb_atom key;
11713
 
 
11714
 
    ovs_assert(inited);
11715
 
    datum.n = 1;
11716
 
    datum.keys = &key;
11717
 
    key.integer = bond_updelay;
11718
 
    datum.values = NULL;
11719
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_BOND_UPDELAY], &datum);
11720
 
}
11721
 
 
11722
 
void
11723
 
ovsrec_port_set_external_ids(const struct ovsrec_port *row, const struct smap *smap)
11724
 
{
11725
 
    struct ovsdb_datum datum;
11726
 
 
11727
 
    ovs_assert(inited);
11728
 
    if (smap) {
11729
 
        struct smap_node *node;
11730
 
        size_t i;
11731
 
 
11732
 
        datum.n = smap_count(smap);
11733
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
11734
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
11735
 
 
11736
 
        i = 0;
11737
 
        SMAP_FOR_EACH (node, smap) {
11738
 
            datum.keys[i].string = xstrdup(node->key);
11739
 
            datum.values[i].string = xstrdup(node->value);
11740
 
            i++;
11741
 
        }
11742
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
11743
 
    } else {
11744
 
        ovsdb_datum_init_empty(&datum);
11745
 
    }
11746
 
    ovsdb_idl_txn_write(&row->header_,
11747
 
                        &ovsrec_port_columns[OVSREC_PORT_COL_EXTERNAL_IDS],
11748
 
                        &datum);
11749
 
}
11750
 
 
11751
 
 
11752
 
void
11753
 
ovsrec_port_set_fake_bridge(const struct ovsrec_port *row, bool fake_bridge)
11754
 
{
11755
 
    struct ovsdb_datum datum;
11756
 
    union ovsdb_atom key;
11757
 
 
11758
 
    ovs_assert(inited);
11759
 
    datum.n = 1;
11760
 
    datum.keys = &key;
11761
 
    key.boolean = fake_bridge;
11762
 
    datum.values = NULL;
11763
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_FAKE_BRIDGE], &datum);
11764
 
}
11765
 
 
11766
 
void
11767
 
ovsrec_port_set_interfaces(const struct ovsrec_port *row, struct ovsrec_interface **interfaces, size_t n_interfaces)
11768
 
{
11769
 
    struct ovsdb_datum datum;
11770
 
    size_t i;
11771
 
 
11772
 
    ovs_assert(inited);
11773
 
    datum.n = n_interfaces;
11774
 
    datum.keys = n_interfaces ? xmalloc(n_interfaces * sizeof *datum.keys) : NULL;
11775
 
    datum.values = NULL;
11776
 
    for (i = 0; i < n_interfaces; i++) {
11777
 
        datum.keys[i].uuid = interfaces[i]->header_.uuid;
11778
 
    }
11779
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_UUID, OVSDB_TYPE_VOID);
11780
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_INTERFACES], &datum);
11781
 
}
11782
 
 
11783
 
void
11784
 
ovsrec_port_set_lacp(const struct ovsrec_port *row, const char *lacp)
11785
 
{
11786
 
    struct ovsdb_datum datum;
11787
 
    union ovsdb_atom key;
11788
 
 
11789
 
    ovs_assert(inited);
11790
 
    if (lacp) {
11791
 
        datum.n = 1;
11792
 
        datum.keys = &key;
11793
 
        key.string = CONST_CAST(char *, lacp);
11794
 
    } else {
11795
 
        datum.n = 0;
11796
 
        datum.keys = NULL;
11797
 
    }
11798
 
    datum.values = NULL;
11799
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_LACP], &datum);
11800
 
}
11801
 
 
11802
 
void
11803
 
ovsrec_port_set_mac(const struct ovsrec_port *row, const char *mac)
11804
 
{
11805
 
    struct ovsdb_datum datum;
11806
 
    union ovsdb_atom key;
11807
 
 
11808
 
    ovs_assert(inited);
11809
 
    if (mac) {
11810
 
        datum.n = 1;
11811
 
        datum.keys = &key;
11812
 
        key.string = CONST_CAST(char *, mac);
11813
 
    } else {
11814
 
        datum.n = 0;
11815
 
        datum.keys = NULL;
11816
 
    }
11817
 
    datum.values = NULL;
11818
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_MAC], &datum);
11819
 
}
11820
 
 
11821
 
void
11822
 
ovsrec_port_set_name(const struct ovsrec_port *row, const char *name)
11823
 
{
11824
 
    struct ovsdb_datum datum;
11825
 
    union ovsdb_atom key;
11826
 
 
11827
 
    ovs_assert(inited);
11828
 
    datum.n = 1;
11829
 
    datum.keys = &key;
11830
 
    key.string = CONST_CAST(char *, name);
11831
 
    datum.values = NULL;
11832
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_NAME], &datum);
11833
 
}
11834
 
 
11835
 
void
11836
 
ovsrec_port_set_other_config(const struct ovsrec_port *row, const struct smap *smap)
11837
 
{
11838
 
    struct ovsdb_datum datum;
11839
 
 
11840
 
    ovs_assert(inited);
11841
 
    if (smap) {
11842
 
        struct smap_node *node;
11843
 
        size_t i;
11844
 
 
11845
 
        datum.n = smap_count(smap);
11846
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
11847
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
11848
 
 
11849
 
        i = 0;
11850
 
        SMAP_FOR_EACH (node, smap) {
11851
 
            datum.keys[i].string = xstrdup(node->key);
11852
 
            datum.values[i].string = xstrdup(node->value);
11853
 
            i++;
11854
 
        }
11855
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
11856
 
    } else {
11857
 
        ovsdb_datum_init_empty(&datum);
11858
 
    }
11859
 
    ovsdb_idl_txn_write(&row->header_,
11860
 
                        &ovsrec_port_columns[OVSREC_PORT_COL_OTHER_CONFIG],
11861
 
                        &datum);
11862
 
}
11863
 
 
11864
 
 
11865
 
void
11866
 
ovsrec_port_set_qos(const struct ovsrec_port *row, const struct ovsrec_qos *qos)
11867
 
{
11868
 
    struct ovsdb_datum datum;
11869
 
    union ovsdb_atom key;
11870
 
 
11871
 
    ovs_assert(inited);
11872
 
    if (qos) {
11873
 
        datum.n = 1;
11874
 
        datum.keys = &key;
11875
 
        key.uuid = qos->header_.uuid;
11876
 
    } else {
11877
 
        datum.n = 0;
11878
 
        datum.keys = NULL;
11879
 
    }
11880
 
    datum.values = NULL;
11881
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_QOS], &datum);
11882
 
}
11883
 
 
11884
 
void
11885
 
ovsrec_port_set_statistics(const struct ovsrec_port *row, char **key_statistics, const int64_t *value_statistics, size_t n_statistics)
11886
 
{
11887
 
    struct ovsdb_datum datum;
11888
 
    size_t i;
11889
 
 
11890
 
    ovs_assert(inited);
11891
 
    datum.n = n_statistics;
11892
 
    datum.keys = n_statistics ? xmalloc(n_statistics * sizeof *datum.keys) : NULL;
11893
 
    datum.values = xmalloc(n_statistics * sizeof *datum.values);
11894
 
    for (i = 0; i < n_statistics; i++) {
11895
 
        datum.keys[i].string = xstrdup(key_statistics[i]);
11896
 
        datum.values[i].integer = value_statistics[i];
11897
 
    }
11898
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_INTEGER);
11899
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_STATISTICS], &datum);
11900
 
}
11901
 
 
11902
 
void
11903
 
ovsrec_port_set_status(const struct ovsrec_port *row, const struct smap *smap)
11904
 
{
11905
 
    struct ovsdb_datum datum;
11906
 
 
11907
 
    ovs_assert(inited);
11908
 
    if (smap) {
11909
 
        struct smap_node *node;
11910
 
        size_t i;
11911
 
 
11912
 
        datum.n = smap_count(smap);
11913
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
11914
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
11915
 
 
11916
 
        i = 0;
11917
 
        SMAP_FOR_EACH (node, smap) {
11918
 
            datum.keys[i].string = xstrdup(node->key);
11919
 
            datum.values[i].string = xstrdup(node->value);
11920
 
            i++;
11921
 
        }
11922
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
11923
 
    } else {
11924
 
        ovsdb_datum_init_empty(&datum);
11925
 
    }
11926
 
    ovsdb_idl_txn_write(&row->header_,
11927
 
                        &ovsrec_port_columns[OVSREC_PORT_COL_STATUS],
11928
 
                        &datum);
11929
 
}
11930
 
 
11931
 
 
11932
 
void
11933
 
ovsrec_port_set_tag(const struct ovsrec_port *row, const int64_t *tag, size_t n_tag)
11934
 
{
11935
 
    struct ovsdb_datum datum;
11936
 
    union ovsdb_atom key;
11937
 
 
11938
 
    ovs_assert(inited);
11939
 
    if (n_tag) {
11940
 
        datum.n = 1;
11941
 
        datum.keys = &key;
11942
 
        key.integer = *tag;
11943
 
    } else {
11944
 
        datum.n = 0;
11945
 
        datum.keys = NULL;
11946
 
    }
11947
 
    datum.values = NULL;
11948
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_TAG], &datum);
11949
 
}
11950
 
 
11951
 
void
11952
 
ovsrec_port_set_trunks(const struct ovsrec_port *row, const int64_t *trunks, size_t n_trunks)
11953
 
{
11954
 
    struct ovsdb_datum datum;
11955
 
    size_t i;
11956
 
 
11957
 
    ovs_assert(inited);
11958
 
    datum.n = n_trunks;
11959
 
    datum.keys = n_trunks ? xmalloc(n_trunks * sizeof *datum.keys) : NULL;
11960
 
    datum.values = NULL;
11961
 
    for (i = 0; i < n_trunks; i++) {
11962
 
        datum.keys[i].integer = trunks[i];
11963
 
    }
11964
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_VOID);
11965
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_TRUNKS], &datum);
11966
 
}
11967
 
 
11968
 
void
11969
 
ovsrec_port_set_vlan_mode(const struct ovsrec_port *row, const char *vlan_mode)
11970
 
{
11971
 
    struct ovsdb_datum datum;
11972
 
    union ovsdb_atom key;
11973
 
 
11974
 
    ovs_assert(inited);
11975
 
    if (vlan_mode) {
11976
 
        datum.n = 1;
11977
 
        datum.keys = &key;
11978
 
        key.string = CONST_CAST(char *, vlan_mode);
11979
 
    } else {
11980
 
        datum.n = 0;
11981
 
        datum.keys = NULL;
11982
 
    }
11983
 
    datum.values = NULL;
11984
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_port_columns[OVSREC_PORT_COL_VLAN_MODE], &datum);
11985
 
}
11986
 
 
11987
 
struct ovsdb_idl_column ovsrec_port_columns[OVSREC_PORT_N_COLUMNS];
11988
 
 
11989
 
static void
11990
 
ovsrec_port_columns_init(void)
11991
 
{
11992
 
    struct ovsdb_idl_column *c;
11993
 
 
11994
 
    /* Initialize ovsrec_port_col_bond_active_slave. */
11995
 
    c = &ovsrec_port_col_bond_active_slave;
11996
 
    c->name = "bond_active_slave";
11997
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
11998
 
    c->type.key.u.string.minLen = 0;
11999
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12000
 
    c->type.n_min = 0;
12001
 
    c->type.n_max = 1;
12002
 
    c->mutable = true;
12003
 
    c->parse = ovsrec_port_parse_bond_active_slave;
12004
 
    c->unparse = ovsrec_port_unparse_bond_active_slave;
12005
 
 
12006
 
    /* Initialize ovsrec_port_col_bond_downdelay. */
12007
 
    c = &ovsrec_port_col_bond_downdelay;
12008
 
    c->name = "bond_downdelay";
12009
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12010
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12011
 
    c->type.n_min = 1;
12012
 
    c->type.n_max = 1;
12013
 
    c->mutable = true;
12014
 
    c->parse = ovsrec_port_parse_bond_downdelay;
12015
 
    c->unparse = ovsrec_port_unparse_bond_downdelay;
12016
 
 
12017
 
    /* Initialize ovsrec_port_col_bond_fake_iface. */
12018
 
    c = &ovsrec_port_col_bond_fake_iface;
12019
 
    c->name = "bond_fake_iface";
12020
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
12021
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12022
 
    c->type.n_min = 1;
12023
 
    c->type.n_max = 1;
12024
 
    c->mutable = true;
12025
 
    c->parse = ovsrec_port_parse_bond_fake_iface;
12026
 
    c->unparse = ovsrec_port_unparse_bond_fake_iface;
12027
 
 
12028
 
    /* Initialize ovsrec_port_col_bond_mode. */
12029
 
    c = &ovsrec_port_col_bond_mode;
12030
 
    c->name = "bond_mode";
12031
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12032
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
12033
 
    c->type.key.enum_->n = 3;
12034
 
    c->type.key.enum_->keys = xmalloc(3 * sizeof *c->type.key.enum_->keys);
12035
 
    c->type.key.enum_->keys[0].string = xstrdup("active-backup");
12036
 
    c->type.key.enum_->keys[1].string = xstrdup("balance-slb");
12037
 
    c->type.key.enum_->keys[2].string = xstrdup("balance-tcp");
12038
 
    c->type.key.enum_->values = NULL;
12039
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
12040
 
    c->type.key.u.string.minLen = 0;
12041
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12042
 
    c->type.n_min = 0;
12043
 
    c->type.n_max = 1;
12044
 
    c->mutable = true;
12045
 
    c->parse = ovsrec_port_parse_bond_mode;
12046
 
    c->unparse = ovsrec_port_unparse_bond_mode;
12047
 
 
12048
 
    /* Initialize ovsrec_port_col_bond_updelay. */
12049
 
    c = &ovsrec_port_col_bond_updelay;
12050
 
    c->name = "bond_updelay";
12051
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12052
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12053
 
    c->type.n_min = 1;
12054
 
    c->type.n_max = 1;
12055
 
    c->mutable = true;
12056
 
    c->parse = ovsrec_port_parse_bond_updelay;
12057
 
    c->unparse = ovsrec_port_unparse_bond_updelay;
12058
 
 
12059
 
    /* Initialize ovsrec_port_col_external_ids. */
12060
 
    c = &ovsrec_port_col_external_ids;
12061
 
    c->name = "external_ids";
12062
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12063
 
    c->type.key.u.string.minLen = 0;
12064
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12065
 
    c->type.value.u.string.minLen = 0;
12066
 
    c->type.n_min = 0;
12067
 
    c->type.n_max = UINT_MAX;
12068
 
    c->mutable = true;
12069
 
    c->parse = ovsrec_port_parse_external_ids;
12070
 
    c->unparse = ovsrec_port_unparse_external_ids;
12071
 
 
12072
 
    /* Initialize ovsrec_port_col_fake_bridge. */
12073
 
    c = &ovsrec_port_col_fake_bridge;
12074
 
    c->name = "fake_bridge";
12075
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
12076
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12077
 
    c->type.n_min = 1;
12078
 
    c->type.n_max = 1;
12079
 
    c->mutable = true;
12080
 
    c->parse = ovsrec_port_parse_fake_bridge;
12081
 
    c->unparse = ovsrec_port_unparse_fake_bridge;
12082
 
 
12083
 
    /* Initialize ovsrec_port_col_interfaces. */
12084
 
    c = &ovsrec_port_col_interfaces;
12085
 
    c->name = "interfaces";
12086
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
12087
 
    c->type.key.u.uuid.refTableName = "Interface";
12088
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
12089
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12090
 
    c->type.n_min = 1;
12091
 
    c->type.n_max = UINT_MAX;
12092
 
    c->mutable = true;
12093
 
    c->parse = ovsrec_port_parse_interfaces;
12094
 
    c->unparse = ovsrec_port_unparse_interfaces;
12095
 
 
12096
 
    /* Initialize ovsrec_port_col_lacp. */
12097
 
    c = &ovsrec_port_col_lacp;
12098
 
    c->name = "lacp";
12099
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12100
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
12101
 
    c->type.key.enum_->n = 3;
12102
 
    c->type.key.enum_->keys = xmalloc(3 * sizeof *c->type.key.enum_->keys);
12103
 
    c->type.key.enum_->keys[0].string = xstrdup("active");
12104
 
    c->type.key.enum_->keys[1].string = xstrdup("off");
12105
 
    c->type.key.enum_->keys[2].string = xstrdup("passive");
12106
 
    c->type.key.enum_->values = NULL;
12107
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
12108
 
    c->type.key.u.string.minLen = 0;
12109
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12110
 
    c->type.n_min = 0;
12111
 
    c->type.n_max = 1;
12112
 
    c->mutable = true;
12113
 
    c->parse = ovsrec_port_parse_lacp;
12114
 
    c->unparse = ovsrec_port_unparse_lacp;
12115
 
 
12116
 
    /* Initialize ovsrec_port_col_mac. */
12117
 
    c = &ovsrec_port_col_mac;
12118
 
    c->name = "mac";
12119
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12120
 
    c->type.key.u.string.minLen = 0;
12121
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12122
 
    c->type.n_min = 0;
12123
 
    c->type.n_max = 1;
12124
 
    c->mutable = true;
12125
 
    c->parse = ovsrec_port_parse_mac;
12126
 
    c->unparse = ovsrec_port_unparse_mac;
12127
 
 
12128
 
    /* Initialize ovsrec_port_col_name. */
12129
 
    c = &ovsrec_port_col_name;
12130
 
    c->name = "name";
12131
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12132
 
    c->type.key.u.string.minLen = 0;
12133
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12134
 
    c->type.n_min = 1;
12135
 
    c->type.n_max = 1;
12136
 
    c->mutable = false;
12137
 
    c->parse = ovsrec_port_parse_name;
12138
 
    c->unparse = ovsrec_port_unparse_name;
12139
 
 
12140
 
    /* Initialize ovsrec_port_col_other_config. */
12141
 
    c = &ovsrec_port_col_other_config;
12142
 
    c->name = "other_config";
12143
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12144
 
    c->type.key.u.string.minLen = 0;
12145
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12146
 
    c->type.value.u.string.minLen = 0;
12147
 
    c->type.n_min = 0;
12148
 
    c->type.n_max = UINT_MAX;
12149
 
    c->mutable = true;
12150
 
    c->parse = ovsrec_port_parse_other_config;
12151
 
    c->unparse = ovsrec_port_unparse_other_config;
12152
 
 
12153
 
    /* Initialize ovsrec_port_col_qos. */
12154
 
    c = &ovsrec_port_col_qos;
12155
 
    c->name = "qos";
12156
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_UUID);
12157
 
    c->type.key.u.uuid.refTableName = "QoS";
12158
 
    c->type.key.u.uuid.refType = OVSDB_REF_STRONG;
12159
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12160
 
    c->type.n_min = 0;
12161
 
    c->type.n_max = 1;
12162
 
    c->mutable = true;
12163
 
    c->parse = ovsrec_port_parse_qos;
12164
 
    c->unparse = ovsrec_port_unparse_qos;
12165
 
 
12166
 
    /* Initialize ovsrec_port_col_statistics. */
12167
 
    c = &ovsrec_port_col_statistics;
12168
 
    c->name = "statistics";
12169
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12170
 
    c->type.key.u.string.minLen = 0;
12171
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_INTEGER);
12172
 
    c->type.n_min = 0;
12173
 
    c->type.n_max = UINT_MAX;
12174
 
    c->mutable = true;
12175
 
    c->parse = ovsrec_port_parse_statistics;
12176
 
    c->unparse = ovsrec_port_unparse_statistics;
12177
 
 
12178
 
    /* Initialize ovsrec_port_col_status. */
12179
 
    c = &ovsrec_port_col_status;
12180
 
    c->name = "status";
12181
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12182
 
    c->type.key.u.string.minLen = 0;
12183
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12184
 
    c->type.value.u.string.minLen = 0;
12185
 
    c->type.n_min = 0;
12186
 
    c->type.n_max = UINT_MAX;
12187
 
    c->mutable = true;
12188
 
    c->parse = ovsrec_port_parse_status;
12189
 
    c->unparse = ovsrec_port_unparse_status;
12190
 
 
12191
 
    /* Initialize ovsrec_port_col_tag. */
12192
 
    c = &ovsrec_port_col_tag;
12193
 
    c->name = "tag";
12194
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12195
 
    c->type.key.u.integer.min = INT64_C(0);
12196
 
    c->type.key.u.integer.max = INT64_C(4095);
12197
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12198
 
    c->type.n_min = 0;
12199
 
    c->type.n_max = 1;
12200
 
    c->mutable = true;
12201
 
    c->parse = ovsrec_port_parse_tag;
12202
 
    c->unparse = ovsrec_port_unparse_tag;
12203
 
 
12204
 
    /* Initialize ovsrec_port_col_trunks. */
12205
 
    c = &ovsrec_port_col_trunks;
12206
 
    c->name = "trunks";
12207
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12208
 
    c->type.key.u.integer.min = INT64_C(0);
12209
 
    c->type.key.u.integer.max = INT64_C(4095);
12210
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12211
 
    c->type.n_min = 0;
12212
 
    c->type.n_max = 4096;
12213
 
    c->mutable = true;
12214
 
    c->parse = ovsrec_port_parse_trunks;
12215
 
    c->unparse = ovsrec_port_unparse_trunks;
12216
 
 
12217
 
    /* Initialize ovsrec_port_col_vlan_mode. */
12218
 
    c = &ovsrec_port_col_vlan_mode;
12219
 
    c->name = "vlan_mode";
12220
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12221
 
    c->type.key.enum_ = xmalloc(sizeof *c->type.key.enum_);
12222
 
    c->type.key.enum_->n = 4;
12223
 
    c->type.key.enum_->keys = xmalloc(4 * sizeof *c->type.key.enum_->keys);
12224
 
    c->type.key.enum_->keys[0].string = xstrdup("access");
12225
 
    c->type.key.enum_->keys[1].string = xstrdup("native-tagged");
12226
 
    c->type.key.enum_->keys[2].string = xstrdup("native-untagged");
12227
 
    c->type.key.enum_->keys[3].string = xstrdup("trunk");
12228
 
    c->type.key.enum_->values = NULL;
12229
 
    ovsdb_datum_sort_assert(c->type.key.enum_, OVSDB_TYPE_STRING);
12230
 
    c->type.key.u.string.minLen = 0;
12231
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12232
 
    c->type.n_min = 0;
12233
 
    c->type.n_max = 1;
12234
 
    c->mutable = true;
12235
 
    c->parse = ovsrec_port_parse_vlan_mode;
12236
 
    c->unparse = ovsrec_port_unparse_vlan_mode;
12237
 
}
12238
 
 
12239
 
/* QoS table. */
12240
 
 
12241
 
static void
12242
 
ovsrec_qos_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12243
 
{
12244
 
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12245
 
    size_t i;
12246
 
 
12247
 
    ovs_assert(inited);
12248
 
    smap_init(&row->external_ids);
12249
 
    for (i = 0; i < datum->n; i++) {
12250
 
        smap_add(&row->external_ids,
12251
 
                 datum->keys[i].string,
12252
 
                 datum->values[i].string);
12253
 
    }
12254
 
}
12255
 
 
12256
 
static void
12257
 
ovsrec_qos_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12258
 
{
12259
 
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12260
 
    size_t i;
12261
 
 
12262
 
    ovs_assert(inited);
12263
 
    smap_init(&row->other_config);
12264
 
    for (i = 0; i < datum->n; i++) {
12265
 
        smap_add(&row->other_config,
12266
 
                 datum->keys[i].string,
12267
 
                 datum->values[i].string);
12268
 
    }
12269
 
}
12270
 
 
12271
 
static void
12272
 
ovsrec_qos_parse_queues(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12273
 
{
12274
 
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12275
 
    size_t i;
12276
 
 
12277
 
    ovs_assert(inited);
12278
 
    row->key_queues = NULL;
12279
 
    row->value_queues = NULL;
12280
 
    row->n_queues = 0;
12281
 
    for (i = 0; i < datum->n; i++) {
12282
 
        struct ovsrec_queue *valueRow = ovsrec_queue_cast(ovsdb_idl_get_row_arc(row_, &ovsrec_table_classes[OVSREC_TABLE_QUEUE], &datum->values[i].uuid));
12283
 
        if (valueRow) {
12284
 
            if (!row->n_queues) {
12285
 
                row->key_queues = xmalloc(datum->n * sizeof *row->key_queues);
12286
 
                row->value_queues = xmalloc(datum->n * sizeof *row->value_queues);
12287
 
            }
12288
 
            row->key_queues[row->n_queues] = datum->keys[i].integer;
12289
 
            row->value_queues[row->n_queues] = valueRow;
12290
 
            row->n_queues++;
12291
 
        }
12292
 
    }
12293
 
}
12294
 
 
12295
 
static void
12296
 
ovsrec_qos_parse_type(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12297
 
{
12298
 
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12299
 
 
12300
 
    ovs_assert(inited);
12301
 
    if (datum->n >= 1) {
12302
 
        row->type = datum->keys[0].string;
12303
 
    } else {
12304
 
        row->type = "";
12305
 
    }
12306
 
}
12307
 
 
12308
 
static void
12309
 
ovsrec_qos_unparse_external_ids(struct ovsdb_idl_row *row_)
12310
 
{
12311
 
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12312
 
 
12313
 
    ovs_assert(inited);
12314
 
    smap_destroy(&row->external_ids);
12315
 
}
12316
 
 
12317
 
static void
12318
 
ovsrec_qos_unparse_other_config(struct ovsdb_idl_row *row_)
12319
 
{
12320
 
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12321
 
 
12322
 
    ovs_assert(inited);
12323
 
    smap_destroy(&row->other_config);
12324
 
}
12325
 
 
12326
 
static void
12327
 
ovsrec_qos_unparse_queues(struct ovsdb_idl_row *row_)
12328
 
{
12329
 
    struct ovsrec_qos *row = ovsrec_qos_cast(row_);
12330
 
 
12331
 
    ovs_assert(inited);
12332
 
    free(row->key_queues);
12333
 
    free(row->value_queues);
12334
 
}
12335
 
 
12336
 
static void
12337
 
ovsrec_qos_unparse_type(struct ovsdb_idl_row *row OVS_UNUSED)
12338
 
{
12339
 
    /* Nothing to do. */
12340
 
}
12341
 
 
12342
 
static void
12343
 
ovsrec_qos_init__(struct ovsdb_idl_row *row)
12344
 
{
12345
 
    ovsrec_qos_init(ovsrec_qos_cast(row));
12346
 
}
12347
 
 
12348
 
void
12349
 
ovsrec_qos_init(struct ovsrec_qos *row)
12350
 
{
12351
 
    memset(row, 0, sizeof *row); 
12352
 
    smap_init(&row->external_ids);
12353
 
    smap_init(&row->other_config);
12354
 
}
12355
 
 
12356
 
const struct ovsrec_qos *
12357
 
ovsrec_qos_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
12358
 
{
12359
 
    return ovsrec_qos_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_QOS], uuid));
12360
 
}
12361
 
 
12362
 
const struct ovsrec_qos *
12363
 
ovsrec_qos_first(const struct ovsdb_idl *idl)
12364
 
{
12365
 
    return ovsrec_qos_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_QOS]));
12366
 
}
12367
 
 
12368
 
const struct ovsrec_qos *
12369
 
ovsrec_qos_next(const struct ovsrec_qos *row)
12370
 
{
12371
 
    return ovsrec_qos_cast(ovsdb_idl_next_row(&row->header_));
12372
 
}
12373
 
 
12374
 
void
12375
 
ovsrec_qos_delete(const struct ovsrec_qos *row)
12376
 
{
12377
 
    ovsdb_idl_txn_delete(&row->header_);
12378
 
}
12379
 
 
12380
 
struct ovsrec_qos *
12381
 
ovsrec_qos_insert(struct ovsdb_idl_txn *txn)
12382
 
{
12383
 
    return ovsrec_qos_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_QOS], NULL));
12384
 
}
12385
 
 
12386
 
 
12387
 
void
12388
 
ovsrec_qos_verify_external_ids(const struct ovsrec_qos *row)
12389
 
{
12390
 
    ovs_assert(inited);
12391
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_EXTERNAL_IDS]);
12392
 
}
12393
 
 
12394
 
void
12395
 
ovsrec_qos_verify_other_config(const struct ovsrec_qos *row)
12396
 
{
12397
 
    ovs_assert(inited);
12398
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_OTHER_CONFIG]);
12399
 
}
12400
 
 
12401
 
void
12402
 
ovsrec_qos_verify_queues(const struct ovsrec_qos *row)
12403
 
{
12404
 
    ovs_assert(inited);
12405
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_QUEUES]);
12406
 
}
12407
 
 
12408
 
void
12409
 
ovsrec_qos_verify_type(const struct ovsrec_qos *row)
12410
 
{
12411
 
    ovs_assert(inited);
12412
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_TYPE]);
12413
 
}
12414
 
 
12415
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
12416
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
12417
 
 * easier and more efficient way to search for a given key than implementing
12418
 
 * the same operation on the "cooked" form in 'row'.
12419
 
 *
12420
 
 * 'key_type' must be OVSDB_TYPE_STRING.
12421
 
 * 'value_type' must be OVSDB_TYPE_STRING.
12422
 
 * (This helps to avoid silent bugs if someone changes external_ids's
12423
 
 * type without updating the caller.)
12424
 
 *
12425
 
 * The caller must not modify or free the returned value.
12426
 
 *
12427
 
 * Various kinds of changes can invalidate the returned value: modifying
12428
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12429
 
 * If the returned value is needed for a long time, it is best to make a copy
12430
 
 * of it with ovsdb_datum_clone(). */
12431
 
const struct ovsdb_datum *
12432
 
ovsrec_qos_get_external_ids(const struct ovsrec_qos *row,
12433
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
12434
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
12435
 
{
12436
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
12437
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
12438
 
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_external_ids);
12439
 
}
12440
 
 
12441
 
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
12442
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
12443
 
 * easier and more efficient way to search for a given key than implementing
12444
 
 * the same operation on the "cooked" form in 'row'.
12445
 
 *
12446
 
 * 'key_type' must be OVSDB_TYPE_STRING.
12447
 
 * 'value_type' must be OVSDB_TYPE_STRING.
12448
 
 * (This helps to avoid silent bugs if someone changes other_config's
12449
 
 * type without updating the caller.)
12450
 
 *
12451
 
 * The caller must not modify or free the returned value.
12452
 
 *
12453
 
 * Various kinds of changes can invalidate the returned value: modifying
12454
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12455
 
 * If the returned value is needed for a long time, it is best to make a copy
12456
 
 * of it with ovsdb_datum_clone(). */
12457
 
const struct ovsdb_datum *
12458
 
ovsrec_qos_get_other_config(const struct ovsrec_qos *row,
12459
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
12460
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
12461
 
{
12462
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
12463
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
12464
 
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_other_config);
12465
 
}
12466
 
 
12467
 
/* Returns the queues column's value in 'row' as a struct ovsdb_datum.
12468
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
12469
 
 * easier and more efficient way to search for a given key than implementing
12470
 
 * the same operation on the "cooked" form in 'row'.
12471
 
 *
12472
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
12473
 
 * 'value_type' must be OVSDB_TYPE_UUID.
12474
 
 * (This helps to avoid silent bugs if someone changes queues's
12475
 
 * type without updating the caller.)
12476
 
 *
12477
 
 * The caller must not modify or free the returned value.
12478
 
 *
12479
 
 * Various kinds of changes can invalidate the returned value: modifying
12480
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12481
 
 * If the returned value is needed for a long time, it is best to make a copy
12482
 
 * of it with ovsdb_datum_clone(). */
12483
 
const struct ovsdb_datum *
12484
 
ovsrec_qos_get_queues(const struct ovsrec_qos *row,
12485
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
12486
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
12487
 
{
12488
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
12489
 
    ovs_assert(value_type == OVSDB_TYPE_UUID);
12490
 
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_queues);
12491
 
}
12492
 
 
12493
 
/* Returns the type column's value in 'row' as a struct ovsdb_datum.
12494
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
12495
 
 * easier and more efficient way to search for a given key than implementing
12496
 
 * the same operation on the "cooked" form in 'row'.
12497
 
 *
12498
 
 * 'key_type' must be OVSDB_TYPE_STRING.
12499
 
 * (This helps to avoid silent bugs if someone changes type's
12500
 
 * type without updating the caller.)
12501
 
 *
12502
 
 * The caller must not modify or free the returned value.
12503
 
 *
12504
 
 * Various kinds of changes can invalidate the returned value: modifying
12505
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12506
 
 * If the returned value is needed for a long time, it is best to make a copy
12507
 
 * of it with ovsdb_datum_clone(). */
12508
 
const struct ovsdb_datum *
12509
 
ovsrec_qos_get_type(const struct ovsrec_qos *row,
12510
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
12511
 
{
12512
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
12513
 
    return ovsdb_idl_read(&row->header_, &ovsrec_qos_col_type);
12514
 
}
12515
 
 
12516
 
void
12517
 
ovsrec_qos_set_external_ids(const struct ovsrec_qos *row, const struct smap *smap)
12518
 
{
12519
 
    struct ovsdb_datum datum;
12520
 
 
12521
 
    ovs_assert(inited);
12522
 
    if (smap) {
12523
 
        struct smap_node *node;
12524
 
        size_t i;
12525
 
 
12526
 
        datum.n = smap_count(smap);
12527
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
12528
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
12529
 
 
12530
 
        i = 0;
12531
 
        SMAP_FOR_EACH (node, smap) {
12532
 
            datum.keys[i].string = xstrdup(node->key);
12533
 
            datum.values[i].string = xstrdup(node->value);
12534
 
            i++;
12535
 
        }
12536
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
12537
 
    } else {
12538
 
        ovsdb_datum_init_empty(&datum);
12539
 
    }
12540
 
    ovsdb_idl_txn_write(&row->header_,
12541
 
                        &ovsrec_qos_columns[OVSREC_QOS_COL_EXTERNAL_IDS],
12542
 
                        &datum);
12543
 
}
12544
 
 
12545
 
 
12546
 
void
12547
 
ovsrec_qos_set_other_config(const struct ovsrec_qos *row, const struct smap *smap)
12548
 
{
12549
 
    struct ovsdb_datum datum;
12550
 
 
12551
 
    ovs_assert(inited);
12552
 
    if (smap) {
12553
 
        struct smap_node *node;
12554
 
        size_t i;
12555
 
 
12556
 
        datum.n = smap_count(smap);
12557
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
12558
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
12559
 
 
12560
 
        i = 0;
12561
 
        SMAP_FOR_EACH (node, smap) {
12562
 
            datum.keys[i].string = xstrdup(node->key);
12563
 
            datum.values[i].string = xstrdup(node->value);
12564
 
            i++;
12565
 
        }
12566
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
12567
 
    } else {
12568
 
        ovsdb_datum_init_empty(&datum);
12569
 
    }
12570
 
    ovsdb_idl_txn_write(&row->header_,
12571
 
                        &ovsrec_qos_columns[OVSREC_QOS_COL_OTHER_CONFIG],
12572
 
                        &datum);
12573
 
}
12574
 
 
12575
 
 
12576
 
void
12577
 
ovsrec_qos_set_queues(const struct ovsrec_qos *row, const int64_t *key_queues, struct ovsrec_queue **value_queues, size_t n_queues)
12578
 
{
12579
 
    struct ovsdb_datum datum;
12580
 
    size_t i;
12581
 
 
12582
 
    ovs_assert(inited);
12583
 
    datum.n = n_queues;
12584
 
    datum.keys = n_queues ? xmalloc(n_queues * sizeof *datum.keys) : NULL;
12585
 
    datum.values = xmalloc(n_queues * sizeof *datum.values);
12586
 
    for (i = 0; i < n_queues; i++) {
12587
 
        datum.keys[i].integer = key_queues[i];
12588
 
        datum.values[i].uuid = value_queues[i]->header_.uuid;
12589
 
    }
12590
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_INTEGER, OVSDB_TYPE_UUID);
12591
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_QUEUES], &datum);
12592
 
}
12593
 
 
12594
 
void
12595
 
ovsrec_qos_set_type(const struct ovsrec_qos *row, const char *type)
12596
 
{
12597
 
    struct ovsdb_datum datum;
12598
 
    union ovsdb_atom key;
12599
 
 
12600
 
    ovs_assert(inited);
12601
 
    datum.n = 1;
12602
 
    datum.keys = &key;
12603
 
    key.string = CONST_CAST(char *, type);
12604
 
    datum.values = NULL;
12605
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_qos_columns[OVSREC_QOS_COL_TYPE], &datum);
12606
 
}
12607
 
 
12608
 
struct ovsdb_idl_column ovsrec_qos_columns[OVSREC_QOS_N_COLUMNS];
12609
 
 
12610
 
static void
12611
 
ovsrec_qos_columns_init(void)
12612
 
{
12613
 
    struct ovsdb_idl_column *c;
12614
 
 
12615
 
    /* Initialize ovsrec_qos_col_external_ids. */
12616
 
    c = &ovsrec_qos_col_external_ids;
12617
 
    c->name = "external_ids";
12618
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12619
 
    c->type.key.u.string.minLen = 0;
12620
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12621
 
    c->type.value.u.string.minLen = 0;
12622
 
    c->type.n_min = 0;
12623
 
    c->type.n_max = UINT_MAX;
12624
 
    c->mutable = true;
12625
 
    c->parse = ovsrec_qos_parse_external_ids;
12626
 
    c->unparse = ovsrec_qos_unparse_external_ids;
12627
 
 
12628
 
    /* Initialize ovsrec_qos_col_other_config. */
12629
 
    c = &ovsrec_qos_col_other_config;
12630
 
    c->name = "other_config";
12631
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12632
 
    c->type.key.u.string.minLen = 0;
12633
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12634
 
    c->type.value.u.string.minLen = 0;
12635
 
    c->type.n_min = 0;
12636
 
    c->type.n_max = UINT_MAX;
12637
 
    c->mutable = true;
12638
 
    c->parse = ovsrec_qos_parse_other_config;
12639
 
    c->unparse = ovsrec_qos_unparse_other_config;
12640
 
 
12641
 
    /* Initialize ovsrec_qos_col_queues. */
12642
 
    c = &ovsrec_qos_col_queues;
12643
 
    c->name = "queues";
12644
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12645
 
    c->type.key.u.integer.min = INT64_C(0);
12646
 
    c->type.key.u.integer.max = INT64_C(4294967295);
12647
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_UUID);
12648
 
    c->type.value.u.uuid.refTableName = "Queue";
12649
 
    c->type.value.u.uuid.refType = OVSDB_REF_STRONG;
12650
 
    c->type.n_min = 0;
12651
 
    c->type.n_max = UINT_MAX;
12652
 
    c->mutable = true;
12653
 
    c->parse = ovsrec_qos_parse_queues;
12654
 
    c->unparse = ovsrec_qos_unparse_queues;
12655
 
 
12656
 
    /* Initialize ovsrec_qos_col_type. */
12657
 
    c = &ovsrec_qos_col_type;
12658
 
    c->name = "type";
12659
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12660
 
    c->type.key.u.string.minLen = 0;
12661
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12662
 
    c->type.n_min = 1;
12663
 
    c->type.n_max = 1;
12664
 
    c->mutable = true;
12665
 
    c->parse = ovsrec_qos_parse_type;
12666
 
    c->unparse = ovsrec_qos_unparse_type;
12667
 
}
12668
 
 
12669
 
/* Queue table. */
12670
 
 
12671
 
static void
12672
 
ovsrec_queue_parse_dscp(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12673
 
{
12674
 
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12675
 
    size_t n = MIN(1, datum->n);
12676
 
    size_t i;
12677
 
 
12678
 
    ovs_assert(inited);
12679
 
    row->dscp = NULL;
12680
 
    row->n_dscp = 0;
12681
 
    for (i = 0; i < n; i++) {
12682
 
        if (!row->n_dscp) {
12683
 
            row->dscp = xmalloc(n * sizeof *row->dscp);
12684
 
        }
12685
 
        row->dscp[row->n_dscp] = datum->keys[i].integer;
12686
 
        row->n_dscp++;
12687
 
    }
12688
 
}
12689
 
 
12690
 
static void
12691
 
ovsrec_queue_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12692
 
{
12693
 
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12694
 
    size_t i;
12695
 
 
12696
 
    ovs_assert(inited);
12697
 
    smap_init(&row->external_ids);
12698
 
    for (i = 0; i < datum->n; i++) {
12699
 
        smap_add(&row->external_ids,
12700
 
                 datum->keys[i].string,
12701
 
                 datum->values[i].string);
12702
 
    }
12703
 
}
12704
 
 
12705
 
static void
12706
 
ovsrec_queue_parse_other_config(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
12707
 
{
12708
 
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12709
 
    size_t i;
12710
 
 
12711
 
    ovs_assert(inited);
12712
 
    smap_init(&row->other_config);
12713
 
    for (i = 0; i < datum->n; i++) {
12714
 
        smap_add(&row->other_config,
12715
 
                 datum->keys[i].string,
12716
 
                 datum->values[i].string);
12717
 
    }
12718
 
}
12719
 
 
12720
 
static void
12721
 
ovsrec_queue_unparse_dscp(struct ovsdb_idl_row *row_)
12722
 
{
12723
 
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12724
 
 
12725
 
    ovs_assert(inited);
12726
 
    free(row->dscp);
12727
 
}
12728
 
 
12729
 
static void
12730
 
ovsrec_queue_unparse_external_ids(struct ovsdb_idl_row *row_)
12731
 
{
12732
 
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12733
 
 
12734
 
    ovs_assert(inited);
12735
 
    smap_destroy(&row->external_ids);
12736
 
}
12737
 
 
12738
 
static void
12739
 
ovsrec_queue_unparse_other_config(struct ovsdb_idl_row *row_)
12740
 
{
12741
 
    struct ovsrec_queue *row = ovsrec_queue_cast(row_);
12742
 
 
12743
 
    ovs_assert(inited);
12744
 
    smap_destroy(&row->other_config);
12745
 
}
12746
 
 
12747
 
static void
12748
 
ovsrec_queue_init__(struct ovsdb_idl_row *row)
12749
 
{
12750
 
    ovsrec_queue_init(ovsrec_queue_cast(row));
12751
 
}
12752
 
 
12753
 
void
12754
 
ovsrec_queue_init(struct ovsrec_queue *row)
12755
 
{
12756
 
    memset(row, 0, sizeof *row); 
12757
 
    smap_init(&row->external_ids);
12758
 
    smap_init(&row->other_config);
12759
 
}
12760
 
 
12761
 
const struct ovsrec_queue *
12762
 
ovsrec_queue_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
12763
 
{
12764
 
    return ovsrec_queue_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_QUEUE], uuid));
12765
 
}
12766
 
 
12767
 
const struct ovsrec_queue *
12768
 
ovsrec_queue_first(const struct ovsdb_idl *idl)
12769
 
{
12770
 
    return ovsrec_queue_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_QUEUE]));
12771
 
}
12772
 
 
12773
 
const struct ovsrec_queue *
12774
 
ovsrec_queue_next(const struct ovsrec_queue *row)
12775
 
{
12776
 
    return ovsrec_queue_cast(ovsdb_idl_next_row(&row->header_));
12777
 
}
12778
 
 
12779
 
void
12780
 
ovsrec_queue_delete(const struct ovsrec_queue *row)
12781
 
{
12782
 
    ovsdb_idl_txn_delete(&row->header_);
12783
 
}
12784
 
 
12785
 
struct ovsrec_queue *
12786
 
ovsrec_queue_insert(struct ovsdb_idl_txn *txn)
12787
 
{
12788
 
    return ovsrec_queue_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_QUEUE], NULL));
12789
 
}
12790
 
 
12791
 
 
12792
 
void
12793
 
ovsrec_queue_verify_dscp(const struct ovsrec_queue *row)
12794
 
{
12795
 
    ovs_assert(inited);
12796
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_columns[OVSREC_QUEUE_COL_DSCP]);
12797
 
}
12798
 
 
12799
 
void
12800
 
ovsrec_queue_verify_external_ids(const struct ovsrec_queue *row)
12801
 
{
12802
 
    ovs_assert(inited);
12803
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_columns[OVSREC_QUEUE_COL_EXTERNAL_IDS]);
12804
 
}
12805
 
 
12806
 
void
12807
 
ovsrec_queue_verify_other_config(const struct ovsrec_queue *row)
12808
 
{
12809
 
    ovs_assert(inited);
12810
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_queue_columns[OVSREC_QUEUE_COL_OTHER_CONFIG]);
12811
 
}
12812
 
 
12813
 
/* Returns the dscp column's value in 'row' as a struct ovsdb_datum.
12814
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
12815
 
 * easier and more efficient way to search for a given key than implementing
12816
 
 * the same operation on the "cooked" form in 'row'.
12817
 
 *
12818
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
12819
 
 * (This helps to avoid silent bugs if someone changes dscp's
12820
 
 * type without updating the caller.)
12821
 
 *
12822
 
 * The caller must not modify or free the returned value.
12823
 
 *
12824
 
 * Various kinds of changes can invalidate the returned value: modifying
12825
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12826
 
 * If the returned value is needed for a long time, it is best to make a copy
12827
 
 * of it with ovsdb_datum_clone(). */
12828
 
const struct ovsdb_datum *
12829
 
ovsrec_queue_get_dscp(const struct ovsrec_queue *row,
12830
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
12831
 
{
12832
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
12833
 
    return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_dscp);
12834
 
}
12835
 
 
12836
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
12837
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
12838
 
 * easier and more efficient way to search for a given key than implementing
12839
 
 * the same operation on the "cooked" form in 'row'.
12840
 
 *
12841
 
 * 'key_type' must be OVSDB_TYPE_STRING.
12842
 
 * 'value_type' must be OVSDB_TYPE_STRING.
12843
 
 * (This helps to avoid silent bugs if someone changes external_ids's
12844
 
 * type without updating the caller.)
12845
 
 *
12846
 
 * The caller must not modify or free the returned value.
12847
 
 *
12848
 
 * Various kinds of changes can invalidate the returned value: modifying
12849
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12850
 
 * If the returned value is needed for a long time, it is best to make a copy
12851
 
 * of it with ovsdb_datum_clone(). */
12852
 
const struct ovsdb_datum *
12853
 
ovsrec_queue_get_external_ids(const struct ovsrec_queue *row,
12854
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
12855
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
12856
 
{
12857
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
12858
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
12859
 
    return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_external_ids);
12860
 
}
12861
 
 
12862
 
/* Returns the other_config column's value in 'row' as a struct ovsdb_datum.
12863
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
12864
 
 * easier and more efficient way to search for a given key than implementing
12865
 
 * the same operation on the "cooked" form in 'row'.
12866
 
 *
12867
 
 * 'key_type' must be OVSDB_TYPE_STRING.
12868
 
 * 'value_type' must be OVSDB_TYPE_STRING.
12869
 
 * (This helps to avoid silent bugs if someone changes other_config's
12870
 
 * type without updating the caller.)
12871
 
 *
12872
 
 * The caller must not modify or free the returned value.
12873
 
 *
12874
 
 * Various kinds of changes can invalidate the returned value: modifying
12875
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
12876
 
 * If the returned value is needed for a long time, it is best to make a copy
12877
 
 * of it with ovsdb_datum_clone(). */
12878
 
const struct ovsdb_datum *
12879
 
ovsrec_queue_get_other_config(const struct ovsrec_queue *row,
12880
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
12881
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
12882
 
{
12883
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
12884
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
12885
 
    return ovsdb_idl_read(&row->header_, &ovsrec_queue_col_other_config);
12886
 
}
12887
 
 
12888
 
void
12889
 
ovsrec_queue_set_dscp(const struct ovsrec_queue *row, const int64_t *dscp, size_t n_dscp)
12890
 
{
12891
 
    struct ovsdb_datum datum;
12892
 
    union ovsdb_atom key;
12893
 
 
12894
 
    ovs_assert(inited);
12895
 
    if (n_dscp) {
12896
 
        datum.n = 1;
12897
 
        datum.keys = &key;
12898
 
        key.integer = *dscp;
12899
 
    } else {
12900
 
        datum.n = 0;
12901
 
        datum.keys = NULL;
12902
 
    }
12903
 
    datum.values = NULL;
12904
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_queue_columns[OVSREC_QUEUE_COL_DSCP], &datum);
12905
 
}
12906
 
 
12907
 
void
12908
 
ovsrec_queue_set_external_ids(const struct ovsrec_queue *row, const struct smap *smap)
12909
 
{
12910
 
    struct ovsdb_datum datum;
12911
 
 
12912
 
    ovs_assert(inited);
12913
 
    if (smap) {
12914
 
        struct smap_node *node;
12915
 
        size_t i;
12916
 
 
12917
 
        datum.n = smap_count(smap);
12918
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
12919
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
12920
 
 
12921
 
        i = 0;
12922
 
        SMAP_FOR_EACH (node, smap) {
12923
 
            datum.keys[i].string = xstrdup(node->key);
12924
 
            datum.values[i].string = xstrdup(node->value);
12925
 
            i++;
12926
 
        }
12927
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
12928
 
    } else {
12929
 
        ovsdb_datum_init_empty(&datum);
12930
 
    }
12931
 
    ovsdb_idl_txn_write(&row->header_,
12932
 
                        &ovsrec_queue_columns[OVSREC_QUEUE_COL_EXTERNAL_IDS],
12933
 
                        &datum);
12934
 
}
12935
 
 
12936
 
 
12937
 
void
12938
 
ovsrec_queue_set_other_config(const struct ovsrec_queue *row, const struct smap *smap)
12939
 
{
12940
 
    struct ovsdb_datum datum;
12941
 
 
12942
 
    ovs_assert(inited);
12943
 
    if (smap) {
12944
 
        struct smap_node *node;
12945
 
        size_t i;
12946
 
 
12947
 
        datum.n = smap_count(smap);
12948
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
12949
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
12950
 
 
12951
 
        i = 0;
12952
 
        SMAP_FOR_EACH (node, smap) {
12953
 
            datum.keys[i].string = xstrdup(node->key);
12954
 
            datum.values[i].string = xstrdup(node->value);
12955
 
            i++;
12956
 
        }
12957
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
12958
 
    } else {
12959
 
        ovsdb_datum_init_empty(&datum);
12960
 
    }
12961
 
    ovsdb_idl_txn_write(&row->header_,
12962
 
                        &ovsrec_queue_columns[OVSREC_QUEUE_COL_OTHER_CONFIG],
12963
 
                        &datum);
12964
 
}
12965
 
 
12966
 
 
12967
 
struct ovsdb_idl_column ovsrec_queue_columns[OVSREC_QUEUE_N_COLUMNS];
12968
 
 
12969
 
static void
12970
 
ovsrec_queue_columns_init(void)
12971
 
{
12972
 
    struct ovsdb_idl_column *c;
12973
 
 
12974
 
    /* Initialize ovsrec_queue_col_dscp. */
12975
 
    c = &ovsrec_queue_col_dscp;
12976
 
    c->name = "dscp";
12977
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
12978
 
    c->type.key.u.integer.min = INT64_C(0);
12979
 
    c->type.key.u.integer.max = INT64_C(63);
12980
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
12981
 
    c->type.n_min = 0;
12982
 
    c->type.n_max = 1;
12983
 
    c->mutable = true;
12984
 
    c->parse = ovsrec_queue_parse_dscp;
12985
 
    c->unparse = ovsrec_queue_unparse_dscp;
12986
 
 
12987
 
    /* Initialize ovsrec_queue_col_external_ids. */
12988
 
    c = &ovsrec_queue_col_external_ids;
12989
 
    c->name = "external_ids";
12990
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
12991
 
    c->type.key.u.string.minLen = 0;
12992
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
12993
 
    c->type.value.u.string.minLen = 0;
12994
 
    c->type.n_min = 0;
12995
 
    c->type.n_max = UINT_MAX;
12996
 
    c->mutable = true;
12997
 
    c->parse = ovsrec_queue_parse_external_ids;
12998
 
    c->unparse = ovsrec_queue_unparse_external_ids;
12999
 
 
13000
 
    /* Initialize ovsrec_queue_col_other_config. */
13001
 
    c = &ovsrec_queue_col_other_config;
13002
 
    c->name = "other_config";
13003
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13004
 
    c->type.key.u.string.minLen = 0;
13005
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
13006
 
    c->type.value.u.string.minLen = 0;
13007
 
    c->type.n_min = 0;
13008
 
    c->type.n_max = UINT_MAX;
13009
 
    c->mutable = true;
13010
 
    c->parse = ovsrec_queue_parse_other_config;
13011
 
    c->unparse = ovsrec_queue_unparse_other_config;
13012
 
}
13013
 
 
13014
 
/* SSL table. */
13015
 
 
13016
 
static void
13017
 
ovsrec_ssl_parse_bootstrap_ca_cert(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13018
 
{
13019
 
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13020
 
 
13021
 
    ovs_assert(inited);
13022
 
    if (datum->n >= 1) {
13023
 
        row->bootstrap_ca_cert = datum->keys[0].boolean;
13024
 
    } else {
13025
 
        row->bootstrap_ca_cert = false;
13026
 
    }
13027
 
}
13028
 
 
13029
 
static void
13030
 
ovsrec_ssl_parse_ca_cert(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13031
 
{
13032
 
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13033
 
 
13034
 
    ovs_assert(inited);
13035
 
    if (datum->n >= 1) {
13036
 
        row->ca_cert = datum->keys[0].string;
13037
 
    } else {
13038
 
        row->ca_cert = "";
13039
 
    }
13040
 
}
13041
 
 
13042
 
static void
13043
 
ovsrec_ssl_parse_certificate(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13044
 
{
13045
 
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13046
 
 
13047
 
    ovs_assert(inited);
13048
 
    if (datum->n >= 1) {
13049
 
        row->certificate = datum->keys[0].string;
13050
 
    } else {
13051
 
        row->certificate = "";
13052
 
    }
13053
 
}
13054
 
 
13055
 
static void
13056
 
ovsrec_ssl_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13057
 
{
13058
 
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13059
 
    size_t i;
13060
 
 
13061
 
    ovs_assert(inited);
13062
 
    smap_init(&row->external_ids);
13063
 
    for (i = 0; i < datum->n; i++) {
13064
 
        smap_add(&row->external_ids,
13065
 
                 datum->keys[i].string,
13066
 
                 datum->values[i].string);
13067
 
    }
13068
 
}
13069
 
 
13070
 
static void
13071
 
ovsrec_ssl_parse_private_key(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13072
 
{
13073
 
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13074
 
 
13075
 
    ovs_assert(inited);
13076
 
    if (datum->n >= 1) {
13077
 
        row->private_key = datum->keys[0].string;
13078
 
    } else {
13079
 
        row->private_key = "";
13080
 
    }
13081
 
}
13082
 
 
13083
 
static void
13084
 
ovsrec_ssl_unparse_bootstrap_ca_cert(struct ovsdb_idl_row *row OVS_UNUSED)
13085
 
{
13086
 
    /* Nothing to do. */
13087
 
}
13088
 
 
13089
 
static void
13090
 
ovsrec_ssl_unparse_ca_cert(struct ovsdb_idl_row *row OVS_UNUSED)
13091
 
{
13092
 
    /* Nothing to do. */
13093
 
}
13094
 
 
13095
 
static void
13096
 
ovsrec_ssl_unparse_certificate(struct ovsdb_idl_row *row OVS_UNUSED)
13097
 
{
13098
 
    /* Nothing to do. */
13099
 
}
13100
 
 
13101
 
static void
13102
 
ovsrec_ssl_unparse_external_ids(struct ovsdb_idl_row *row_)
13103
 
{
13104
 
    struct ovsrec_ssl *row = ovsrec_ssl_cast(row_);
13105
 
 
13106
 
    ovs_assert(inited);
13107
 
    smap_destroy(&row->external_ids);
13108
 
}
13109
 
 
13110
 
static void
13111
 
ovsrec_ssl_unparse_private_key(struct ovsdb_idl_row *row OVS_UNUSED)
13112
 
{
13113
 
    /* Nothing to do. */
13114
 
}
13115
 
 
13116
 
static void
13117
 
ovsrec_ssl_init__(struct ovsdb_idl_row *row)
13118
 
{
13119
 
    ovsrec_ssl_init(ovsrec_ssl_cast(row));
13120
 
}
13121
 
 
13122
 
void
13123
 
ovsrec_ssl_init(struct ovsrec_ssl *row)
13124
 
{
13125
 
    memset(row, 0, sizeof *row); 
13126
 
    smap_init(&row->external_ids);
13127
 
}
13128
 
 
13129
 
const struct ovsrec_ssl *
13130
 
ovsrec_ssl_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
13131
 
{
13132
 
    return ovsrec_ssl_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_SSL], uuid));
13133
 
}
13134
 
 
13135
 
const struct ovsrec_ssl *
13136
 
ovsrec_ssl_first(const struct ovsdb_idl *idl)
13137
 
{
13138
 
    return ovsrec_ssl_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_SSL]));
13139
 
}
13140
 
 
13141
 
const struct ovsrec_ssl *
13142
 
ovsrec_ssl_next(const struct ovsrec_ssl *row)
13143
 
{
13144
 
    return ovsrec_ssl_cast(ovsdb_idl_next_row(&row->header_));
13145
 
}
13146
 
 
13147
 
void
13148
 
ovsrec_ssl_delete(const struct ovsrec_ssl *row)
13149
 
{
13150
 
    ovsdb_idl_txn_delete(&row->header_);
13151
 
}
13152
 
 
13153
 
struct ovsrec_ssl *
13154
 
ovsrec_ssl_insert(struct ovsdb_idl_txn *txn)
13155
 
{
13156
 
    return ovsrec_ssl_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_SSL], NULL));
13157
 
}
13158
 
 
13159
 
 
13160
 
void
13161
 
ovsrec_ssl_verify_bootstrap_ca_cert(const struct ovsrec_ssl *row)
13162
 
{
13163
 
    ovs_assert(inited);
13164
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_BOOTSTRAP_CA_CERT]);
13165
 
}
13166
 
 
13167
 
void
13168
 
ovsrec_ssl_verify_ca_cert(const struct ovsrec_ssl *row)
13169
 
{
13170
 
    ovs_assert(inited);
13171
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_CA_CERT]);
13172
 
}
13173
 
 
13174
 
void
13175
 
ovsrec_ssl_verify_certificate(const struct ovsrec_ssl *row)
13176
 
{
13177
 
    ovs_assert(inited);
13178
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_CERTIFICATE]);
13179
 
}
13180
 
 
13181
 
void
13182
 
ovsrec_ssl_verify_external_ids(const struct ovsrec_ssl *row)
13183
 
{
13184
 
    ovs_assert(inited);
13185
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_EXTERNAL_IDS]);
13186
 
}
13187
 
 
13188
 
void
13189
 
ovsrec_ssl_verify_private_key(const struct ovsrec_ssl *row)
13190
 
{
13191
 
    ovs_assert(inited);
13192
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_PRIVATE_KEY]);
13193
 
}
13194
 
 
13195
 
/* Returns the bootstrap_ca_cert column's value in 'row' as a struct ovsdb_datum.
13196
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13197
 
 * easier and more efficient way to search for a given key than implementing
13198
 
 * the same operation on the "cooked" form in 'row'.
13199
 
 *
13200
 
 * 'key_type' must be OVSDB_TYPE_BOOLEAN.
13201
 
 * (This helps to avoid silent bugs if someone changes bootstrap_ca_cert's
13202
 
 * type without updating the caller.)
13203
 
 *
13204
 
 * The caller must not modify or free the returned value.
13205
 
 *
13206
 
 * Various kinds of changes can invalidate the returned value: modifying
13207
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13208
 
 * If the returned value is needed for a long time, it is best to make a copy
13209
 
 * of it with ovsdb_datum_clone(). */
13210
 
const struct ovsdb_datum *
13211
 
ovsrec_ssl_get_bootstrap_ca_cert(const struct ovsrec_ssl *row,
13212
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
13213
 
{
13214
 
    ovs_assert(key_type == OVSDB_TYPE_BOOLEAN);
13215
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_bootstrap_ca_cert);
13216
 
}
13217
 
 
13218
 
/* Returns the ca_cert column's value in 'row' as a struct ovsdb_datum.
13219
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13220
 
 * easier and more efficient way to search for a given key than implementing
13221
 
 * the same operation on the "cooked" form in 'row'.
13222
 
 *
13223
 
 * 'key_type' must be OVSDB_TYPE_STRING.
13224
 
 * (This helps to avoid silent bugs if someone changes ca_cert's
13225
 
 * type without updating the caller.)
13226
 
 *
13227
 
 * The caller must not modify or free the returned value.
13228
 
 *
13229
 
 * Various kinds of changes can invalidate the returned value: modifying
13230
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13231
 
 * If the returned value is needed for a long time, it is best to make a copy
13232
 
 * of it with ovsdb_datum_clone(). */
13233
 
const struct ovsdb_datum *
13234
 
ovsrec_ssl_get_ca_cert(const struct ovsrec_ssl *row,
13235
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
13236
 
{
13237
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13238
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_ca_cert);
13239
 
}
13240
 
 
13241
 
/* Returns the certificate column's value in 'row' as a struct ovsdb_datum.
13242
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13243
 
 * easier and more efficient way to search for a given key than implementing
13244
 
 * the same operation on the "cooked" form in 'row'.
13245
 
 *
13246
 
 * 'key_type' must be OVSDB_TYPE_STRING.
13247
 
 * (This helps to avoid silent bugs if someone changes certificate's
13248
 
 * type without updating the caller.)
13249
 
 *
13250
 
 * The caller must not modify or free the returned value.
13251
 
 *
13252
 
 * Various kinds of changes can invalidate the returned value: modifying
13253
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13254
 
 * If the returned value is needed for a long time, it is best to make a copy
13255
 
 * of it with ovsdb_datum_clone(). */
13256
 
const struct ovsdb_datum *
13257
 
ovsrec_ssl_get_certificate(const struct ovsrec_ssl *row,
13258
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
13259
 
{
13260
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13261
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_certificate);
13262
 
}
13263
 
 
13264
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
13265
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13266
 
 * easier and more efficient way to search for a given key than implementing
13267
 
 * the same operation on the "cooked" form in 'row'.
13268
 
 *
13269
 
 * 'key_type' must be OVSDB_TYPE_STRING.
13270
 
 * 'value_type' must be OVSDB_TYPE_STRING.
13271
 
 * (This helps to avoid silent bugs if someone changes external_ids's
13272
 
 * type without updating the caller.)
13273
 
 *
13274
 
 * The caller must not modify or free the returned value.
13275
 
 *
13276
 
 * Various kinds of changes can invalidate the returned value: modifying
13277
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13278
 
 * If the returned value is needed for a long time, it is best to make a copy
13279
 
 * of it with ovsdb_datum_clone(). */
13280
 
const struct ovsdb_datum *
13281
 
ovsrec_ssl_get_external_ids(const struct ovsrec_ssl *row,
13282
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
13283
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
13284
 
{
13285
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13286
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
13287
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_external_ids);
13288
 
}
13289
 
 
13290
 
/* Returns the private_key column's value in 'row' as a struct ovsdb_datum.
13291
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13292
 
 * easier and more efficient way to search for a given key than implementing
13293
 
 * the same operation on the "cooked" form in 'row'.
13294
 
 *
13295
 
 * 'key_type' must be OVSDB_TYPE_STRING.
13296
 
 * (This helps to avoid silent bugs if someone changes private_key's
13297
 
 * type without updating the caller.)
13298
 
 *
13299
 
 * The caller must not modify or free the returned value.
13300
 
 *
13301
 
 * Various kinds of changes can invalidate the returned value: modifying
13302
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13303
 
 * If the returned value is needed for a long time, it is best to make a copy
13304
 
 * of it with ovsdb_datum_clone(). */
13305
 
const struct ovsdb_datum *
13306
 
ovsrec_ssl_get_private_key(const struct ovsrec_ssl *row,
13307
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
13308
 
{
13309
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13310
 
    return ovsdb_idl_read(&row->header_, &ovsrec_ssl_col_private_key);
13311
 
}
13312
 
 
13313
 
void
13314
 
ovsrec_ssl_set_bootstrap_ca_cert(const struct ovsrec_ssl *row, bool bootstrap_ca_cert)
13315
 
{
13316
 
    struct ovsdb_datum datum;
13317
 
    union ovsdb_atom key;
13318
 
 
13319
 
    ovs_assert(inited);
13320
 
    datum.n = 1;
13321
 
    datum.keys = &key;
13322
 
    key.boolean = bootstrap_ca_cert;
13323
 
    datum.values = NULL;
13324
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_BOOTSTRAP_CA_CERT], &datum);
13325
 
}
13326
 
 
13327
 
void
13328
 
ovsrec_ssl_set_ca_cert(const struct ovsrec_ssl *row, const char *ca_cert)
13329
 
{
13330
 
    struct ovsdb_datum datum;
13331
 
    union ovsdb_atom key;
13332
 
 
13333
 
    ovs_assert(inited);
13334
 
    datum.n = 1;
13335
 
    datum.keys = &key;
13336
 
    key.string = CONST_CAST(char *, ca_cert);
13337
 
    datum.values = NULL;
13338
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_CA_CERT], &datum);
13339
 
}
13340
 
 
13341
 
void
13342
 
ovsrec_ssl_set_certificate(const struct ovsrec_ssl *row, const char *certificate)
13343
 
{
13344
 
    struct ovsdb_datum datum;
13345
 
    union ovsdb_atom key;
13346
 
 
13347
 
    ovs_assert(inited);
13348
 
    datum.n = 1;
13349
 
    datum.keys = &key;
13350
 
    key.string = CONST_CAST(char *, certificate);
13351
 
    datum.values = NULL;
13352
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_CERTIFICATE], &datum);
13353
 
}
13354
 
 
13355
 
void
13356
 
ovsrec_ssl_set_external_ids(const struct ovsrec_ssl *row, const struct smap *smap)
13357
 
{
13358
 
    struct ovsdb_datum datum;
13359
 
 
13360
 
    ovs_assert(inited);
13361
 
    if (smap) {
13362
 
        struct smap_node *node;
13363
 
        size_t i;
13364
 
 
13365
 
        datum.n = smap_count(smap);
13366
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
13367
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
13368
 
 
13369
 
        i = 0;
13370
 
        SMAP_FOR_EACH (node, smap) {
13371
 
            datum.keys[i].string = xstrdup(node->key);
13372
 
            datum.values[i].string = xstrdup(node->value);
13373
 
            i++;
13374
 
        }
13375
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
13376
 
    } else {
13377
 
        ovsdb_datum_init_empty(&datum);
13378
 
    }
13379
 
    ovsdb_idl_txn_write(&row->header_,
13380
 
                        &ovsrec_ssl_columns[OVSREC_SSL_COL_EXTERNAL_IDS],
13381
 
                        &datum);
13382
 
}
13383
 
 
13384
 
 
13385
 
void
13386
 
ovsrec_ssl_set_private_key(const struct ovsrec_ssl *row, const char *private_key)
13387
 
{
13388
 
    struct ovsdb_datum datum;
13389
 
    union ovsdb_atom key;
13390
 
 
13391
 
    ovs_assert(inited);
13392
 
    datum.n = 1;
13393
 
    datum.keys = &key;
13394
 
    key.string = CONST_CAST(char *, private_key);
13395
 
    datum.values = NULL;
13396
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_ssl_columns[OVSREC_SSL_COL_PRIVATE_KEY], &datum);
13397
 
}
13398
 
 
13399
 
struct ovsdb_idl_column ovsrec_ssl_columns[OVSREC_SSL_N_COLUMNS];
13400
 
 
13401
 
static void
13402
 
ovsrec_ssl_columns_init(void)
13403
 
{
13404
 
    struct ovsdb_idl_column *c;
13405
 
 
13406
 
    /* Initialize ovsrec_ssl_col_bootstrap_ca_cert. */
13407
 
    c = &ovsrec_ssl_col_bootstrap_ca_cert;
13408
 
    c->name = "bootstrap_ca_cert";
13409
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_BOOLEAN);
13410
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13411
 
    c->type.n_min = 1;
13412
 
    c->type.n_max = 1;
13413
 
    c->mutable = true;
13414
 
    c->parse = ovsrec_ssl_parse_bootstrap_ca_cert;
13415
 
    c->unparse = ovsrec_ssl_unparse_bootstrap_ca_cert;
13416
 
 
13417
 
    /* Initialize ovsrec_ssl_col_ca_cert. */
13418
 
    c = &ovsrec_ssl_col_ca_cert;
13419
 
    c->name = "ca_cert";
13420
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13421
 
    c->type.key.u.string.minLen = 0;
13422
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13423
 
    c->type.n_min = 1;
13424
 
    c->type.n_max = 1;
13425
 
    c->mutable = true;
13426
 
    c->parse = ovsrec_ssl_parse_ca_cert;
13427
 
    c->unparse = ovsrec_ssl_unparse_ca_cert;
13428
 
 
13429
 
    /* Initialize ovsrec_ssl_col_certificate. */
13430
 
    c = &ovsrec_ssl_col_certificate;
13431
 
    c->name = "certificate";
13432
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13433
 
    c->type.key.u.string.minLen = 0;
13434
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13435
 
    c->type.n_min = 1;
13436
 
    c->type.n_max = 1;
13437
 
    c->mutable = true;
13438
 
    c->parse = ovsrec_ssl_parse_certificate;
13439
 
    c->unparse = ovsrec_ssl_unparse_certificate;
13440
 
 
13441
 
    /* Initialize ovsrec_ssl_col_external_ids. */
13442
 
    c = &ovsrec_ssl_col_external_ids;
13443
 
    c->name = "external_ids";
13444
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13445
 
    c->type.key.u.string.minLen = 0;
13446
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
13447
 
    c->type.value.u.string.minLen = 0;
13448
 
    c->type.n_min = 0;
13449
 
    c->type.n_max = UINT_MAX;
13450
 
    c->mutable = true;
13451
 
    c->parse = ovsrec_ssl_parse_external_ids;
13452
 
    c->unparse = ovsrec_ssl_unparse_external_ids;
13453
 
 
13454
 
    /* Initialize ovsrec_ssl_col_private_key. */
13455
 
    c = &ovsrec_ssl_col_private_key;
13456
 
    c->name = "private_key";
13457
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13458
 
    c->type.key.u.string.minLen = 0;
13459
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13460
 
    c->type.n_min = 1;
13461
 
    c->type.n_max = 1;
13462
 
    c->mutable = true;
13463
 
    c->parse = ovsrec_ssl_parse_private_key;
13464
 
    c->unparse = ovsrec_ssl_unparse_private_key;
13465
 
}
13466
 
 
13467
 
/* sFlow table. */
13468
 
 
13469
 
static void
13470
 
ovsrec_sflow_parse_agent(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13471
 
{
13472
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13473
 
 
13474
 
    ovs_assert(inited);
13475
 
    if (datum->n >= 1) {
13476
 
        row->agent = datum->keys[0].string;
13477
 
    } else {
13478
 
        row->agent = NULL;
13479
 
    }
13480
 
}
13481
 
 
13482
 
static void
13483
 
ovsrec_sflow_parse_external_ids(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13484
 
{
13485
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13486
 
    size_t i;
13487
 
 
13488
 
    ovs_assert(inited);
13489
 
    smap_init(&row->external_ids);
13490
 
    for (i = 0; i < datum->n; i++) {
13491
 
        smap_add(&row->external_ids,
13492
 
                 datum->keys[i].string,
13493
 
                 datum->values[i].string);
13494
 
    }
13495
 
}
13496
 
 
13497
 
static void
13498
 
ovsrec_sflow_parse_header(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13499
 
{
13500
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13501
 
    size_t n = MIN(1, datum->n);
13502
 
    size_t i;
13503
 
 
13504
 
    ovs_assert(inited);
13505
 
    row->header = NULL;
13506
 
    row->n_header = 0;
13507
 
    for (i = 0; i < n; i++) {
13508
 
        if (!row->n_header) {
13509
 
            row->header = xmalloc(n * sizeof *row->header);
13510
 
        }
13511
 
        row->header[row->n_header] = datum->keys[i].integer;
13512
 
        row->n_header++;
13513
 
    }
13514
 
}
13515
 
 
13516
 
static void
13517
 
ovsrec_sflow_parse_polling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13518
 
{
13519
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13520
 
    size_t n = MIN(1, datum->n);
13521
 
    size_t i;
13522
 
 
13523
 
    ovs_assert(inited);
13524
 
    row->polling = NULL;
13525
 
    row->n_polling = 0;
13526
 
    for (i = 0; i < n; i++) {
13527
 
        if (!row->n_polling) {
13528
 
            row->polling = xmalloc(n * sizeof *row->polling);
13529
 
        }
13530
 
        row->polling[row->n_polling] = datum->keys[i].integer;
13531
 
        row->n_polling++;
13532
 
    }
13533
 
}
13534
 
 
13535
 
static void
13536
 
ovsrec_sflow_parse_sampling(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13537
 
{
13538
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13539
 
    size_t n = MIN(1, datum->n);
13540
 
    size_t i;
13541
 
 
13542
 
    ovs_assert(inited);
13543
 
    row->sampling = NULL;
13544
 
    row->n_sampling = 0;
13545
 
    for (i = 0; i < n; i++) {
13546
 
        if (!row->n_sampling) {
13547
 
            row->sampling = xmalloc(n * sizeof *row->sampling);
13548
 
        }
13549
 
        row->sampling[row->n_sampling] = datum->keys[i].integer;
13550
 
        row->n_sampling++;
13551
 
    }
13552
 
}
13553
 
 
13554
 
static void
13555
 
ovsrec_sflow_parse_targets(struct ovsdb_idl_row *row_, const struct ovsdb_datum *datum)
13556
 
{
13557
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13558
 
    size_t i;
13559
 
 
13560
 
    ovs_assert(inited);
13561
 
    row->targets = NULL;
13562
 
    row->n_targets = 0;
13563
 
    for (i = 0; i < datum->n; i++) {
13564
 
        if (!row->n_targets) {
13565
 
            row->targets = xmalloc(datum->n * sizeof *row->targets);
13566
 
        }
13567
 
        row->targets[row->n_targets] = datum->keys[i].string;
13568
 
        row->n_targets++;
13569
 
    }
13570
 
}
13571
 
 
13572
 
static void
13573
 
ovsrec_sflow_unparse_agent(struct ovsdb_idl_row *row OVS_UNUSED)
13574
 
{
13575
 
    /* Nothing to do. */
13576
 
}
13577
 
 
13578
 
static void
13579
 
ovsrec_sflow_unparse_external_ids(struct ovsdb_idl_row *row_)
13580
 
{
13581
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13582
 
 
13583
 
    ovs_assert(inited);
13584
 
    smap_destroy(&row->external_ids);
13585
 
}
13586
 
 
13587
 
static void
13588
 
ovsrec_sflow_unparse_header(struct ovsdb_idl_row *row_)
13589
 
{
13590
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13591
 
 
13592
 
    ovs_assert(inited);
13593
 
    free(row->header);
13594
 
}
13595
 
 
13596
 
static void
13597
 
ovsrec_sflow_unparse_polling(struct ovsdb_idl_row *row_)
13598
 
{
13599
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13600
 
 
13601
 
    ovs_assert(inited);
13602
 
    free(row->polling);
13603
 
}
13604
 
 
13605
 
static void
13606
 
ovsrec_sflow_unparse_sampling(struct ovsdb_idl_row *row_)
13607
 
{
13608
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13609
 
 
13610
 
    ovs_assert(inited);
13611
 
    free(row->sampling);
13612
 
}
13613
 
 
13614
 
static void
13615
 
ovsrec_sflow_unparse_targets(struct ovsdb_idl_row *row_)
13616
 
{
13617
 
    struct ovsrec_sflow *row = ovsrec_sflow_cast(row_);
13618
 
 
13619
 
    ovs_assert(inited);
13620
 
    free(row->targets);
13621
 
}
13622
 
 
13623
 
static void
13624
 
ovsrec_sflow_init__(struct ovsdb_idl_row *row)
13625
 
{
13626
 
    ovsrec_sflow_init(ovsrec_sflow_cast(row));
13627
 
}
13628
 
 
13629
 
void
13630
 
ovsrec_sflow_init(struct ovsrec_sflow *row)
13631
 
{
13632
 
    memset(row, 0, sizeof *row); 
13633
 
    smap_init(&row->external_ids);
13634
 
}
13635
 
 
13636
 
const struct ovsrec_sflow *
13637
 
ovsrec_sflow_get_for_uuid(const struct ovsdb_idl *idl, const struct uuid *uuid)
13638
 
{
13639
 
    return ovsrec_sflow_cast(ovsdb_idl_get_row_for_uuid(idl, &ovsrec_table_classes[OVSREC_TABLE_SFLOW], uuid));
13640
 
}
13641
 
 
13642
 
const struct ovsrec_sflow *
13643
 
ovsrec_sflow_first(const struct ovsdb_idl *idl)
13644
 
{
13645
 
    return ovsrec_sflow_cast(ovsdb_idl_first_row(idl, &ovsrec_table_classes[OVSREC_TABLE_SFLOW]));
13646
 
}
13647
 
 
13648
 
const struct ovsrec_sflow *
13649
 
ovsrec_sflow_next(const struct ovsrec_sflow *row)
13650
 
{
13651
 
    return ovsrec_sflow_cast(ovsdb_idl_next_row(&row->header_));
13652
 
}
13653
 
 
13654
 
void
13655
 
ovsrec_sflow_delete(const struct ovsrec_sflow *row)
13656
 
{
13657
 
    ovsdb_idl_txn_delete(&row->header_);
13658
 
}
13659
 
 
13660
 
struct ovsrec_sflow *
13661
 
ovsrec_sflow_insert(struct ovsdb_idl_txn *txn)
13662
 
{
13663
 
    return ovsrec_sflow_cast(ovsdb_idl_txn_insert(txn, &ovsrec_table_classes[OVSREC_TABLE_SFLOW], NULL));
13664
 
}
13665
 
 
13666
 
 
13667
 
void
13668
 
ovsrec_sflow_verify_agent(const struct ovsrec_sflow *row)
13669
 
{
13670
 
    ovs_assert(inited);
13671
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_AGENT]);
13672
 
}
13673
 
 
13674
 
void
13675
 
ovsrec_sflow_verify_external_ids(const struct ovsrec_sflow *row)
13676
 
{
13677
 
    ovs_assert(inited);
13678
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_EXTERNAL_IDS]);
13679
 
}
13680
 
 
13681
 
void
13682
 
ovsrec_sflow_verify_header(const struct ovsrec_sflow *row)
13683
 
{
13684
 
    ovs_assert(inited);
13685
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_HEADER]);
13686
 
}
13687
 
 
13688
 
void
13689
 
ovsrec_sflow_verify_polling(const struct ovsrec_sflow *row)
13690
 
{
13691
 
    ovs_assert(inited);
13692
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_POLLING]);
13693
 
}
13694
 
 
13695
 
void
13696
 
ovsrec_sflow_verify_sampling(const struct ovsrec_sflow *row)
13697
 
{
13698
 
    ovs_assert(inited);
13699
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_SAMPLING]);
13700
 
}
13701
 
 
13702
 
void
13703
 
ovsrec_sflow_verify_targets(const struct ovsrec_sflow *row)
13704
 
{
13705
 
    ovs_assert(inited);
13706
 
    ovsdb_idl_txn_verify(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_TARGETS]);
13707
 
}
13708
 
 
13709
 
/* Returns the agent column's value in 'row' as a struct ovsdb_datum.
13710
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13711
 
 * easier and more efficient way to search for a given key than implementing
13712
 
 * the same operation on the "cooked" form in 'row'.
13713
 
 *
13714
 
 * 'key_type' must be OVSDB_TYPE_STRING.
13715
 
 * (This helps to avoid silent bugs if someone changes agent's
13716
 
 * type without updating the caller.)
13717
 
 *
13718
 
 * The caller must not modify or free the returned value.
13719
 
 *
13720
 
 * Various kinds of changes can invalidate the returned value: modifying
13721
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13722
 
 * If the returned value is needed for a long time, it is best to make a copy
13723
 
 * of it with ovsdb_datum_clone(). */
13724
 
const struct ovsdb_datum *
13725
 
ovsrec_sflow_get_agent(const struct ovsrec_sflow *row,
13726
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
13727
 
{
13728
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13729
 
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_agent);
13730
 
}
13731
 
 
13732
 
/* Returns the external_ids column's value in 'row' as a struct ovsdb_datum.
13733
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13734
 
 * easier and more efficient way to search for a given key than implementing
13735
 
 * the same operation on the "cooked" form in 'row'.
13736
 
 *
13737
 
 * 'key_type' must be OVSDB_TYPE_STRING.
13738
 
 * 'value_type' must be OVSDB_TYPE_STRING.
13739
 
 * (This helps to avoid silent bugs if someone changes external_ids's
13740
 
 * type without updating the caller.)
13741
 
 *
13742
 
 * The caller must not modify or free the returned value.
13743
 
 *
13744
 
 * Various kinds of changes can invalidate the returned value: modifying
13745
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13746
 
 * If the returned value is needed for a long time, it is best to make a copy
13747
 
 * of it with ovsdb_datum_clone(). */
13748
 
const struct ovsdb_datum *
13749
 
ovsrec_sflow_get_external_ids(const struct ovsrec_sflow *row,
13750
 
        enum ovsdb_atomic_type key_type OVS_UNUSED,
13751
 
        enum ovsdb_atomic_type value_type OVS_UNUSED)
13752
 
{
13753
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13754
 
    ovs_assert(value_type == OVSDB_TYPE_STRING);
13755
 
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_external_ids);
13756
 
}
13757
 
 
13758
 
/* Returns the header column's value in 'row' as a struct ovsdb_datum.
13759
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13760
 
 * easier and more efficient way to search for a given key than implementing
13761
 
 * the same operation on the "cooked" form in 'row'.
13762
 
 *
13763
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
13764
 
 * (This helps to avoid silent bugs if someone changes header's
13765
 
 * type without updating the caller.)
13766
 
 *
13767
 
 * The caller must not modify or free the returned value.
13768
 
 *
13769
 
 * Various kinds of changes can invalidate the returned value: modifying
13770
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13771
 
 * If the returned value is needed for a long time, it is best to make a copy
13772
 
 * of it with ovsdb_datum_clone(). */
13773
 
const struct ovsdb_datum *
13774
 
ovsrec_sflow_get_header(const struct ovsrec_sflow *row,
13775
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
13776
 
{
13777
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13778
 
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_header);
13779
 
}
13780
 
 
13781
 
/* Returns the polling column's value in 'row' as a struct ovsdb_datum.
13782
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13783
 
 * easier and more efficient way to search for a given key than implementing
13784
 
 * the same operation on the "cooked" form in 'row'.
13785
 
 *
13786
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
13787
 
 * (This helps to avoid silent bugs if someone changes polling's
13788
 
 * type without updating the caller.)
13789
 
 *
13790
 
 * The caller must not modify or free the returned value.
13791
 
 *
13792
 
 * Various kinds of changes can invalidate the returned value: modifying
13793
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13794
 
 * If the returned value is needed for a long time, it is best to make a copy
13795
 
 * of it with ovsdb_datum_clone(). */
13796
 
const struct ovsdb_datum *
13797
 
ovsrec_sflow_get_polling(const struct ovsrec_sflow *row,
13798
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
13799
 
{
13800
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13801
 
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_polling);
13802
 
}
13803
 
 
13804
 
/* Returns the sampling column's value in 'row' as a struct ovsdb_datum.
13805
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13806
 
 * easier and more efficient way to search for a given key than implementing
13807
 
 * the same operation on the "cooked" form in 'row'.
13808
 
 *
13809
 
 * 'key_type' must be OVSDB_TYPE_INTEGER.
13810
 
 * (This helps to avoid silent bugs if someone changes sampling's
13811
 
 * type without updating the caller.)
13812
 
 *
13813
 
 * The caller must not modify or free the returned value.
13814
 
 *
13815
 
 * Various kinds of changes can invalidate the returned value: modifying
13816
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13817
 
 * If the returned value is needed for a long time, it is best to make a copy
13818
 
 * of it with ovsdb_datum_clone(). */
13819
 
const struct ovsdb_datum *
13820
 
ovsrec_sflow_get_sampling(const struct ovsrec_sflow *row,
13821
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
13822
 
{
13823
 
    ovs_assert(key_type == OVSDB_TYPE_INTEGER);
13824
 
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_sampling);
13825
 
}
13826
 
 
13827
 
/* Returns the targets column's value in 'row' as a struct ovsdb_datum.
13828
 
 * This is useful occasionally: for example, ovsdb_datum_find_key() is an
13829
 
 * easier and more efficient way to search for a given key than implementing
13830
 
 * the same operation on the "cooked" form in 'row'.
13831
 
 *
13832
 
 * 'key_type' must be OVSDB_TYPE_STRING.
13833
 
 * (This helps to avoid silent bugs if someone changes targets's
13834
 
 * type without updating the caller.)
13835
 
 *
13836
 
 * The caller must not modify or free the returned value.
13837
 
 *
13838
 
 * Various kinds of changes can invalidate the returned value: modifying
13839
 
 * 'column' within 'row', deleting 'row', or completing an ongoing transaction.
13840
 
 * If the returned value is needed for a long time, it is best to make a copy
13841
 
 * of it with ovsdb_datum_clone(). */
13842
 
const struct ovsdb_datum *
13843
 
ovsrec_sflow_get_targets(const struct ovsrec_sflow *row,
13844
 
        enum ovsdb_atomic_type key_type OVS_UNUSED)
13845
 
{
13846
 
    ovs_assert(key_type == OVSDB_TYPE_STRING);
13847
 
    return ovsdb_idl_read(&row->header_, &ovsrec_sflow_col_targets);
13848
 
}
13849
 
 
13850
 
void
13851
 
ovsrec_sflow_set_agent(const struct ovsrec_sflow *row, const char *agent)
13852
 
{
13853
 
    struct ovsdb_datum datum;
13854
 
    union ovsdb_atom key;
13855
 
 
13856
 
    ovs_assert(inited);
13857
 
    if (agent) {
13858
 
        datum.n = 1;
13859
 
        datum.keys = &key;
13860
 
        key.string = CONST_CAST(char *, agent);
13861
 
    } else {
13862
 
        datum.n = 0;
13863
 
        datum.keys = NULL;
13864
 
    }
13865
 
    datum.values = NULL;
13866
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_AGENT], &datum);
13867
 
}
13868
 
 
13869
 
void
13870
 
ovsrec_sflow_set_external_ids(const struct ovsrec_sflow *row, const struct smap *smap)
13871
 
{
13872
 
    struct ovsdb_datum datum;
13873
 
 
13874
 
    ovs_assert(inited);
13875
 
    if (smap) {
13876
 
        struct smap_node *node;
13877
 
        size_t i;
13878
 
 
13879
 
        datum.n = smap_count(smap);
13880
 
        datum.keys = xmalloc(datum.n * sizeof *datum.keys);
13881
 
        datum.values = xmalloc(datum.n * sizeof *datum.values);
13882
 
 
13883
 
        i = 0;
13884
 
        SMAP_FOR_EACH (node, smap) {
13885
 
            datum.keys[i].string = xstrdup(node->key);
13886
 
            datum.values[i].string = xstrdup(node->value);
13887
 
            i++;
13888
 
        }
13889
 
        ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
13890
 
    } else {
13891
 
        ovsdb_datum_init_empty(&datum);
13892
 
    }
13893
 
    ovsdb_idl_txn_write(&row->header_,
13894
 
                        &ovsrec_sflow_columns[OVSREC_SFLOW_COL_EXTERNAL_IDS],
13895
 
                        &datum);
13896
 
}
13897
 
 
13898
 
 
13899
 
void
13900
 
ovsrec_sflow_set_header(const struct ovsrec_sflow *row, const int64_t *header, size_t n_header)
13901
 
{
13902
 
    struct ovsdb_datum datum;
13903
 
    union ovsdb_atom key;
13904
 
 
13905
 
    ovs_assert(inited);
13906
 
    if (n_header) {
13907
 
        datum.n = 1;
13908
 
        datum.keys = &key;
13909
 
        key.integer = *header;
13910
 
    } else {
13911
 
        datum.n = 0;
13912
 
        datum.keys = NULL;
13913
 
    }
13914
 
    datum.values = NULL;
13915
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_HEADER], &datum);
13916
 
}
13917
 
 
13918
 
void
13919
 
ovsrec_sflow_set_polling(const struct ovsrec_sflow *row, const int64_t *polling, size_t n_polling)
13920
 
{
13921
 
    struct ovsdb_datum datum;
13922
 
    union ovsdb_atom key;
13923
 
 
13924
 
    ovs_assert(inited);
13925
 
    if (n_polling) {
13926
 
        datum.n = 1;
13927
 
        datum.keys = &key;
13928
 
        key.integer = *polling;
13929
 
    } else {
13930
 
        datum.n = 0;
13931
 
        datum.keys = NULL;
13932
 
    }
13933
 
    datum.values = NULL;
13934
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_POLLING], &datum);
13935
 
}
13936
 
 
13937
 
void
13938
 
ovsrec_sflow_set_sampling(const struct ovsrec_sflow *row, const int64_t *sampling, size_t n_sampling)
13939
 
{
13940
 
    struct ovsdb_datum datum;
13941
 
    union ovsdb_atom key;
13942
 
 
13943
 
    ovs_assert(inited);
13944
 
    if (n_sampling) {
13945
 
        datum.n = 1;
13946
 
        datum.keys = &key;
13947
 
        key.integer = *sampling;
13948
 
    } else {
13949
 
        datum.n = 0;
13950
 
        datum.keys = NULL;
13951
 
    }
13952
 
    datum.values = NULL;
13953
 
    ovsdb_idl_txn_write_clone(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_SAMPLING], &datum);
13954
 
}
13955
 
 
13956
 
void
13957
 
ovsrec_sflow_set_targets(const struct ovsrec_sflow *row, char **targets, size_t n_targets)
13958
 
{
13959
 
    struct ovsdb_datum datum;
13960
 
    size_t i;
13961
 
 
13962
 
    ovs_assert(inited);
13963
 
    datum.n = n_targets;
13964
 
    datum.keys = n_targets ? xmalloc(n_targets * sizeof *datum.keys) : NULL;
13965
 
    datum.values = NULL;
13966
 
    for (i = 0; i < n_targets; i++) {
13967
 
        datum.keys[i].string = xstrdup(targets[i]);
13968
 
    }
13969
 
    ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
13970
 
    ovsdb_idl_txn_write(&row->header_, &ovsrec_sflow_columns[OVSREC_SFLOW_COL_TARGETS], &datum);
13971
 
}
13972
 
 
13973
 
struct ovsdb_idl_column ovsrec_sflow_columns[OVSREC_SFLOW_N_COLUMNS];
13974
 
 
13975
 
static void
13976
 
ovsrec_sflow_columns_init(void)
13977
 
{
13978
 
    struct ovsdb_idl_column *c;
13979
 
 
13980
 
    /* Initialize ovsrec_sflow_col_agent. */
13981
 
    c = &ovsrec_sflow_col_agent;
13982
 
    c->name = "agent";
13983
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13984
 
    c->type.key.u.string.minLen = 0;
13985
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
13986
 
    c->type.n_min = 0;
13987
 
    c->type.n_max = 1;
13988
 
    c->mutable = true;
13989
 
    c->parse = ovsrec_sflow_parse_agent;
13990
 
    c->unparse = ovsrec_sflow_unparse_agent;
13991
 
 
13992
 
    /* Initialize ovsrec_sflow_col_external_ids. */
13993
 
    c = &ovsrec_sflow_col_external_ids;
13994
 
    c->name = "external_ids";
13995
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
13996
 
    c->type.key.u.string.minLen = 0;
13997
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_STRING);
13998
 
    c->type.value.u.string.minLen = 0;
13999
 
    c->type.n_min = 0;
14000
 
    c->type.n_max = UINT_MAX;
14001
 
    c->mutable = true;
14002
 
    c->parse = ovsrec_sflow_parse_external_ids;
14003
 
    c->unparse = ovsrec_sflow_unparse_external_ids;
14004
 
 
14005
 
    /* Initialize ovsrec_sflow_col_header. */
14006
 
    c = &ovsrec_sflow_col_header;
14007
 
    c->name = "header";
14008
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
14009
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
14010
 
    c->type.n_min = 0;
14011
 
    c->type.n_max = 1;
14012
 
    c->mutable = true;
14013
 
    c->parse = ovsrec_sflow_parse_header;
14014
 
    c->unparse = ovsrec_sflow_unparse_header;
14015
 
 
14016
 
    /* Initialize ovsrec_sflow_col_polling. */
14017
 
    c = &ovsrec_sflow_col_polling;
14018
 
    c->name = "polling";
14019
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
14020
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
14021
 
    c->type.n_min = 0;
14022
 
    c->type.n_max = 1;
14023
 
    c->mutable = true;
14024
 
    c->parse = ovsrec_sflow_parse_polling;
14025
 
    c->unparse = ovsrec_sflow_unparse_polling;
14026
 
 
14027
 
    /* Initialize ovsrec_sflow_col_sampling. */
14028
 
    c = &ovsrec_sflow_col_sampling;
14029
 
    c->name = "sampling";
14030
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_INTEGER);
14031
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
14032
 
    c->type.n_min = 0;
14033
 
    c->type.n_max = 1;
14034
 
    c->mutable = true;
14035
 
    c->parse = ovsrec_sflow_parse_sampling;
14036
 
    c->unparse = ovsrec_sflow_unparse_sampling;
14037
 
 
14038
 
    /* Initialize ovsrec_sflow_col_targets. */
14039
 
    c = &ovsrec_sflow_col_targets;
14040
 
    c->name = "targets";
14041
 
    ovsdb_base_type_init(&c->type.key, OVSDB_TYPE_STRING);
14042
 
    c->type.key.u.string.minLen = 0;
14043
 
    ovsdb_base_type_init(&c->type.value, OVSDB_TYPE_VOID);
14044
 
    c->type.n_min = 1;
14045
 
    c->type.n_max = UINT_MAX;
14046
 
    c->mutable = true;
14047
 
    c->parse = ovsrec_sflow_parse_targets;
14048
 
    c->unparse = ovsrec_sflow_unparse_targets;
14049
 
}
14050
 
 
14051
 
struct ovsdb_idl_table_class ovsrec_table_classes[OVSREC_N_TABLES] = {
14052
 
    {"Bridge", false,
14053
 
     ovsrec_bridge_columns, ARRAY_SIZE(ovsrec_bridge_columns),
14054
 
     sizeof(struct ovsrec_bridge), ovsrec_bridge_init__},
14055
 
    {"Controller", false,
14056
 
     ovsrec_controller_columns, ARRAY_SIZE(ovsrec_controller_columns),
14057
 
     sizeof(struct ovsrec_controller), ovsrec_controller_init__},
14058
 
    {"Flow_Sample_Collector_Set", true,
14059
 
     ovsrec_flow_sample_collector_set_columns, ARRAY_SIZE(ovsrec_flow_sample_collector_set_columns),
14060
 
     sizeof(struct ovsrec_flow_sample_collector_set), ovsrec_flow_sample_collector_set_init__},
14061
 
    {"Flow_Table", false,
14062
 
     ovsrec_flow_table_columns, ARRAY_SIZE(ovsrec_flow_table_columns),
14063
 
     sizeof(struct ovsrec_flow_table), ovsrec_flow_table_init__},
14064
 
    {"IPFIX", false,
14065
 
     ovsrec_ipfix_columns, ARRAY_SIZE(ovsrec_ipfix_columns),
14066
 
     sizeof(struct ovsrec_ipfix), ovsrec_ipfix_init__},
14067
 
    {"Interface", false,
14068
 
     ovsrec_interface_columns, ARRAY_SIZE(ovsrec_interface_columns),
14069
 
     sizeof(struct ovsrec_interface), ovsrec_interface_init__},
14070
 
    {"Manager", false,
14071
 
     ovsrec_manager_columns, ARRAY_SIZE(ovsrec_manager_columns),
14072
 
     sizeof(struct ovsrec_manager), ovsrec_manager_init__},
14073
 
    {"Mirror", false,
14074
 
     ovsrec_mirror_columns, ARRAY_SIZE(ovsrec_mirror_columns),
14075
 
     sizeof(struct ovsrec_mirror), ovsrec_mirror_init__},
14076
 
    {"NetFlow", false,
14077
 
     ovsrec_netflow_columns, ARRAY_SIZE(ovsrec_netflow_columns),
14078
 
     sizeof(struct ovsrec_netflow), ovsrec_netflow_init__},
14079
 
    {"Open_vSwitch", true,
14080
 
     ovsrec_open_vswitch_columns, ARRAY_SIZE(ovsrec_open_vswitch_columns),
14081
 
     sizeof(struct ovsrec_open_vswitch), ovsrec_open_vswitch_init__},
14082
 
    {"Port", false,
14083
 
     ovsrec_port_columns, ARRAY_SIZE(ovsrec_port_columns),
14084
 
     sizeof(struct ovsrec_port), ovsrec_port_init__},
14085
 
    {"QoS", true,
14086
 
     ovsrec_qos_columns, ARRAY_SIZE(ovsrec_qos_columns),
14087
 
     sizeof(struct ovsrec_qos), ovsrec_qos_init__},
14088
 
    {"Queue", true,
14089
 
     ovsrec_queue_columns, ARRAY_SIZE(ovsrec_queue_columns),
14090
 
     sizeof(struct ovsrec_queue), ovsrec_queue_init__},
14091
 
    {"SSL", false,
14092
 
     ovsrec_ssl_columns, ARRAY_SIZE(ovsrec_ssl_columns),
14093
 
     sizeof(struct ovsrec_ssl), ovsrec_ssl_init__},
14094
 
    {"sFlow", false,
14095
 
     ovsrec_sflow_columns, ARRAY_SIZE(ovsrec_sflow_columns),
14096
 
     sizeof(struct ovsrec_sflow), ovsrec_sflow_init__},
14097
 
};
14098
 
 
14099
 
struct ovsdb_idl_class ovsrec_idl_class = {
14100
 
    "Open_vSwitch", ovsrec_table_classes, ARRAY_SIZE(ovsrec_table_classes)
14101
 
};
14102
 
 
14103
 
void
14104
 
ovsrec_init(void)
14105
 
{
14106
 
    if (inited) {
14107
 
        return;
14108
 
    }
14109
 
    assert_single_threaded();
14110
 
    inited = true;
14111
 
 
14112
 
    ovsrec_bridge_columns_init();
14113
 
    ovsrec_controller_columns_init();
14114
 
    ovsrec_flow_sample_collector_set_columns_init();
14115
 
    ovsrec_flow_table_columns_init();
14116
 
    ovsrec_ipfix_columns_init();
14117
 
    ovsrec_interface_columns_init();
14118
 
    ovsrec_manager_columns_init();
14119
 
    ovsrec_mirror_columns_init();
14120
 
    ovsrec_netflow_columns_init();
14121
 
    ovsrec_open_vswitch_columns_init();
14122
 
    ovsrec_port_columns_init();
14123
 
    ovsrec_qos_columns_init();
14124
 
    ovsrec_queue_columns_init();
14125
 
    ovsrec_ssl_columns_init();
14126
 
    ovsrec_sflow_columns_init();
14127
 
}
14128
 
 
14129
 
/* Return the schema version.  The caller must not free the returned value. */
14130
 
const char *
14131
 
ovsrec_get_db_version(void)
14132
 
{
14133
 
    return "7.6.2";
14134
 
}
14135