]> git.proxmox.com Git - mirror_ovs.git/blame - lib/ovsdb-idl-provider.h
dpif-netdev: Reorder elements in dp_netdev_port structure.
[mirror_ovs.git] / lib / ovsdb-idl-provider.h
CommitLineData
239fa5bb 1/* Copyright (c) 2009, 2010, 2011, 2012, 2016 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
ee89ea7b 19#include "openvswitch/hmap.h"
b19bab5b 20#include "openvswitch/list.h"
c3bb4bd7 21#include "ovsdb-idl.h"
f199df26 22#include "ovsdb-map-op.h"
f1ab6e06 23#include "ovsdb-set-op.h"
c3bb4bd7 24#include "ovsdb-types.h"
ee89ea7b 25#include "openvswitch/shash.h"
c3bb4bd7
BP
26#include "uuid.h"
27
28struct ovsdb_idl_row {
29 struct hmap_node hmap_node; /* In struct ovsdb_idl_table's 'rows'. */
30 struct uuid uuid; /* Row "_uuid" field. */
ca6ba700
TG
31 struct ovs_list src_arcs; /* Forward arcs (ovsdb_idl_arc.src_node). */
32 struct ovs_list dst_arcs; /* Backward arcs (ovsdb_idl_arc.dst_node). */
c3bb4bd7 33 struct ovsdb_idl_table *table; /* Containing table. */
475281c0
BP
34 struct ovsdb_datum *old; /* Committed data (null if orphaned). */
35
36 /* Transactional data. */
37 struct ovsdb_datum *new; /* Modified data (null to delete row). */
38 unsigned long int *prereqs; /* Bitmap of columns to verify in "old". */
39 unsigned long int *written; /* Bitmap of columns from "new" to write. */
40 struct hmap_node txn_node; /* Node in ovsdb_idl_txn's list. */
f199df26
EA
41 unsigned long int *map_op_written; /* Bitmap of columns pending map ops. */
42 struct map_op_list **map_op_lists; /* Per-column map operations. */
f1ab6e06
RM
43 unsigned long int *set_op_written; /* Bitmap of columns pending set ops. */
44 struct set_op_list **set_op_lists; /* Per-column set operations. */
932104f4 45
32d37ce8 46 /* Tracking data */
932104f4 47 unsigned int change_seqno[OVSDB_IDL_CHANGE_MAX];
32d37ce8
SA
48 struct ovs_list track_node; /* Rows modified/added/deleted by IDL */
49 unsigned long int *updated; /* Bitmap of columns updated by IDL */
c3bb4bd7
BP
50};
51
52struct ovsdb_idl_column {
53 char *name;
54 struct ovsdb_type type;
341c4e59 55 bool mutable;
979821c0
BP
56 void (*parse)(struct ovsdb_idl_row *, const struct ovsdb_datum *);
57 void (*unparse)(struct ovsdb_idl_row *);
c3bb4bd7
BP
58};
59
60struct ovsdb_idl_table_class {
61 char *name;
c5f341ab 62 bool is_root;
c3bb4bd7
BP
63 const struct ovsdb_idl_column *columns;
64 size_t n_columns;
65 size_t allocation_size;
a699f614 66 void (*row_init)(struct ovsdb_idl_row *);
c3bb4bd7
BP
67};
68
239fa5bb
BP
69struct ovsdb_idl_condition {
70 const struct ovsdb_idl_table_class *tc;
71 struct ovs_list clauses;
72};
73
c3bb4bd7
BP
74struct ovsdb_idl_table {
75 const struct ovsdb_idl_table_class *class;
ef73f86c 76 unsigned char *modes; /* OVSDB_IDL_* bitmasks, indexed by column. */
cd26c1dc
AE
77 bool need_table; /* Monitor table even if no columns are selected
78 * for replication. */
c3bb4bd7
BP
79 struct shash columns; /* Contains "const struct ovsdb_idl_column *"s. */
80 struct hmap rows; /* Contains "struct ovsdb_idl_row"s. */
81 struct ovsdb_idl *idl; /* Containing idl. */
932104f4
SA
82 unsigned int change_seqno[OVSDB_IDL_CHANGE_MAX];
83 struct ovs_list track_list; /* Tracked rows (ovsdb_idl_row.track_node). */
16ebb90e
LS
84 struct ovsdb_idl_condition condition;
85 bool cond_changed;
c3bb4bd7
BP
86};
87
88struct ovsdb_idl_class {
9cb53f26 89 const char *database; /* <db-name> for this database. */
c3bb4bd7
BP
90 const struct ovsdb_idl_table_class *tables;
91 size_t n_tables;
92};
93
94struct ovsdb_idl_row *ovsdb_idl_get_row_arc(
95 struct ovsdb_idl_row *src,
96 struct ovsdb_idl_table_class *dst_table,
97 const struct uuid *dst_uuid);
98
475281c0
BP
99void ovsdb_idl_txn_verify(const struct ovsdb_idl_row *,
100 const struct ovsdb_idl_column *);
475281c0 101
76c91af9
BP
102struct ovsdb_idl_txn *ovsdb_idl_txn_get(const struct ovsdb_idl_row *);
103
c3bb4bd7 104#endif /* ovsdb-idl-provider.h */