forked from openvswitch/ovs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
column.h
87 lines (73 loc) · 3.04 KB
/
column.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* Copyright (c) 2009, 2010, 2011 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OVSDB_COLUMN_H
#define OVSDB_COLUMN_H 1
#include <stdbool.h>
#include "compiler.h"
#include "ovsdb-types.h"
struct ovsdb_table;
struct ovsdb_table_schema;
/* A column or a column schema (currently there is no distinction). */
struct ovsdb_column {
unsigned int index;
char *name;
bool mutable;
bool persistent;
struct ovsdb_type type;
};
/* A few columns appear in every table with standardized column indexes.
* These macros define those columns' indexes.
*
* Don't change these values, because ovsdb_query() depends on OVSDB_COL_UUID
* having value 0. */
enum {
OVSDB_COL_UUID = 0, /* UUID for the row. */
OVSDB_COL_VERSION = 1, /* Version number for the row. */
OVSDB_N_STD_COLUMNS
};
struct ovsdb_column *ovsdb_column_create(
const char *name, bool mutable, bool persistent,
const struct ovsdb_type *);
struct ovsdb_column *ovsdb_column_clone(const struct ovsdb_column *);
void ovsdb_column_destroy(struct ovsdb_column *);
struct ovsdb_error *ovsdb_column_from_json(const struct json *,
const char *name,
struct ovsdb_column **)
WARN_UNUSED_RESULT;
struct json *ovsdb_column_to_json(const struct ovsdb_column *);
/* An unordered set of distinct columns. */
struct ovsdb_column_set {
const struct ovsdb_column **columns;
size_t n_columns, allocated_columns;
};
#define OVSDB_COLUMN_SET_INITIALIZER { NULL, 0, 0 }
void ovsdb_column_set_init(struct ovsdb_column_set *);
void ovsdb_column_set_destroy(struct ovsdb_column_set *);
void ovsdb_column_set_clone(struct ovsdb_column_set *,
const struct ovsdb_column_set *);
struct ovsdb_error *ovsdb_column_set_from_json(
const struct json *, const struct ovsdb_table_schema *,
struct ovsdb_column_set *);
struct json *ovsdb_column_set_to_json(const struct ovsdb_column_set *);
char *ovsdb_column_set_to_string(const struct ovsdb_column_set *);
void ovsdb_column_set_add(struct ovsdb_column_set *,
const struct ovsdb_column *);
void ovsdb_column_set_add_all(struct ovsdb_column_set *,
const struct ovsdb_table *);
bool ovsdb_column_set_contains(const struct ovsdb_column_set *,
unsigned int column_index);
bool ovsdb_column_set_equals(const struct ovsdb_column_set *,
const struct ovsdb_column_set *);
#endif /* column.h */