]> git.proxmox.com Git - ovs.git/blame - lib/ovsdb-idl-provider.h
json: Fix error message for corner case in json_string_unescape().
[ovs.git] / lib / ovsdb-idl-provider.h
CommitLineData
341c4e59 1/* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
c3bb4bd7
BP
2 *
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:
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
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.
14 */
15
16#ifndef OVSDB_IDL_PROVIDER_H
17#define OVSDB_IDL_PROVIDER_H 1
18
19#include "hmap.h"
20#include "list.h"
21#include "ovsdb-idl.h"
22#include "ovsdb-types.h"
23#include "shash.h"
24#include "uuid.h"
25
26struct ovsdb_idl_row {
27 struct hmap_node hmap_node; /* In struct ovsdb_idl_table's 'rows'. */
28 struct uuid uuid; /* Row "_uuid" field. */
ca6ba700
TG
29 struct ovs_list src_arcs; /* Forward arcs (ovsdb_idl_arc.src_node). */
30 struct ovs_list dst_arcs; /* Backward arcs (ovsdb_idl_arc.dst_node). */
c3bb4bd7 31 struct ovsdb_idl_table *table; /* Containing table. */
475281c0
BP
32 struct ovsdb_datum *old; /* Committed data (null if orphaned). */
33
34 /* Transactional data. */
35 struct ovsdb_datum *new; /* Modified data (null to delete row). */
36 unsigned long int *prereqs; /* Bitmap of columns to verify in "old". */
37 unsigned long int *written; /* Bitmap of columns from "new" to write. */
38 struct hmap_node txn_node; /* Node in ovsdb_idl_txn's list. */
c3bb4bd7
BP
39};
40
41struct ovsdb_idl_column {
42 char *name;
43 struct ovsdb_type type;
341c4e59 44 bool mutable;
979821c0
BP
45 void (*parse)(struct ovsdb_idl_row *, const struct ovsdb_datum *);
46 void (*unparse)(struct ovsdb_idl_row *);
c3bb4bd7
BP
47};
48
49struct ovsdb_idl_table_class {
50 char *name;
c5f341ab 51 bool is_root;
c3bb4bd7
BP
52 const struct ovsdb_idl_column *columns;
53 size_t n_columns;
54 size_t allocation_size;
a699f614 55 void (*row_init)(struct ovsdb_idl_row *);
c3bb4bd7
BP
56};
57
58struct ovsdb_idl_table {
59 const struct ovsdb_idl_table_class *class;
ef73f86c
BP
60 unsigned char *modes; /* OVSDB_IDL_* bitmasks, indexed by column. */
61 bool need_table; /* Monitor table even if no columns? */
c3bb4bd7
BP
62 struct shash columns; /* Contains "const struct ovsdb_idl_column *"s. */
63 struct hmap rows; /* Contains "struct ovsdb_idl_row"s. */
64 struct ovsdb_idl *idl; /* Containing idl. */
65};
66
67struct ovsdb_idl_class {
9cb53f26 68 const char *database; /* <db-name> for this database. */
c3bb4bd7
BP
69 const struct ovsdb_idl_table_class *tables;
70 size_t n_tables;
71};
72
73struct ovsdb_idl_row *ovsdb_idl_get_row_arc(
74 struct ovsdb_idl_row *src,
75 struct ovsdb_idl_table_class *dst_table,
76 const struct uuid *dst_uuid);
77
475281c0
BP
78void ovsdb_idl_txn_verify(const struct ovsdb_idl_row *,
79 const struct ovsdb_idl_column *);
475281c0 80
76c91af9
BP
81struct ovsdb_idl_txn *ovsdb_idl_txn_get(const struct ovsdb_idl_row *);
82
c3bb4bd7 83#endif /* ovsdb-idl-provider.h */