1 /* Copyright (c) 2009, 2010 Nicira Networks
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef OVSDB_COLUMN_H
17 #define OVSDB_COLUMN_H 1
21 #include "ovsdb-types.h"
25 /* A column or a column schema (currently there is no distinction). */
32 struct ovsdb_type type;
35 /* A few columns appear in every table with standardized column indexes.
36 * These macros define those columns' indexes.
38 * Don't change these values, because ovsdb_query() depends on OVSDB_COL_UUID
41 OVSDB_COL_UUID = 0, /* UUID for the row. */
42 OVSDB_COL_VERSION = 1, /* Version number for the row. */
46 struct ovsdb_column *ovsdb_column_create(
47 const char *name, bool mutable, bool persistent,
48 const struct ovsdb_type *);
49 struct ovsdb_column *ovsdb_column_clone(const struct ovsdb_column *);
50 void ovsdb_column_destroy(struct ovsdb_column *);
52 struct ovsdb_error *ovsdb_column_from_json(const struct json *,
54 struct ovsdb_column **)
56 struct json *ovsdb_column_to_json(const struct ovsdb_column *);
58 /* An unordered set of distinct columns. */
60 struct ovsdb_column_set {
61 const struct ovsdb_column **columns;
62 size_t n_columns, allocated_columns;
65 #define OVSDB_COLUMN_SET_INITIALIZER { NULL, 0, 0 }
67 void ovsdb_column_set_init(struct ovsdb_column_set *);
68 void ovsdb_column_set_destroy(struct ovsdb_column_set *);
69 void ovsdb_column_set_clone(struct ovsdb_column_set *,
70 const struct ovsdb_column_set *);
71 struct ovsdb_error *ovsdb_column_set_from_json(const struct json *,
72 const struct ovsdb_table *,
73 struct ovsdb_column_set *);
74 struct json *ovsdb_column_set_to_json(const struct ovsdb_column_set *);
76 void ovsdb_column_set_add(struct ovsdb_column_set *,
77 const struct ovsdb_column *);
78 void ovsdb_column_set_add_all(struct ovsdb_column_set *,
79 const struct ovsdb_table *);
80 bool ovsdb_column_set_contains(const struct ovsdb_column_set *,
81 unsigned int column_index);
82 bool ovsdb_column_set_equals(const struct ovsdb_column_set *,
83 const struct ovsdb_column_set *);