-/* Copyright (c) 2009 Nicira Networks
+/* Copyright (c) 2009, 2010 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
};
void ovsdb_atom_init_default(union ovsdb_atom *, enum ovsdb_atomic_type);
+bool ovsdb_atom_is_default(const union ovsdb_atom *, enum ovsdb_atomic_type);
void ovsdb_atom_clone(union ovsdb_atom *, const union ovsdb_atom *,
enum ovsdb_atomic_type);
void ovsdb_atom_swap(union ovsdb_atom *, union ovsdb_atom *);
struct json *ovsdb_atom_to_json(const union ovsdb_atom *,
enum ovsdb_atomic_type);
\f
-/* One value of an OVSDB type (given by struct ovsdb_type). */
+/* An instance of an OVSDB type (given by struct ovsdb_type).
+ *
+ * 'n' is constrained by the ovsdb_type's 'n_min' and 'n_max'.
+ *
+ * If 'n' is nonzero, then 'keys' points to an array of 'n' atoms of the type
+ * specified by the ovsdb_type's 'key_type'. (Otherwise, 'keys' should be
+ * null.)
+ *
+ * If 'n' is nonzero and the ovsdb_type's 'value_type' is not OVSDB_TYPE_VOID,
+ * then 'values' points to an array of 'n' atoms of the type specified by the
+ * 'value_type'. (Otherwise, 'values' should be null.)
+ *
+ * Thus, for 'n' > 0, 'keys' will always be nonnull and 'values' will be
+ * nonnull only for "map" types.
+ */
struct ovsdb_datum {
unsigned int n; /* Number of 'keys' and 'values'. */
union ovsdb_atom *keys; /* Each of the ovsdb_type's 'key_type'. */
};
void ovsdb_datum_init_default(struct ovsdb_datum *, const struct ovsdb_type *);
+bool ovsdb_datum_is_default(const struct ovsdb_datum *,
+ const struct ovsdb_type *);
void ovsdb_datum_clone(struct ovsdb_datum *, const struct ovsdb_datum *,
const struct ovsdb_type *);
void ovsdb_datum_destroy(struct ovsdb_datum *, const struct ovsdb_type *);
void ovsdb_datum_swap(struct ovsdb_datum *, struct ovsdb_datum *);
+struct ovsdb_error *ovsdb_datum_sort(struct ovsdb_datum *,
+ const struct ovsdb_type *);
struct ovsdb_error *ovsdb_datum_from_json(struct ovsdb_datum *,
const struct ovsdb_type *,
const struct ovsdb_datum *,
const struct ovsdb_type *);
+void ovsdb_datum_union(struct ovsdb_datum *,
+ const struct ovsdb_datum *,
+ const struct ovsdb_type *);
+void ovsdb_datum_subtract(struct ovsdb_datum *a,
+ const struct ovsdb_type *a_type,
+ const struct ovsdb_datum *b,
+ const struct ovsdb_type *b_type);
+
static inline bool
ovsdb_datum_conforms_to_type(const struct ovsdb_datum *datum,
const struct ovsdb_type *type)
/* A table mapping from names to data items. Currently the data items are
* always UUIDs; perhaps this will be expanded in the future. */
+struct ovsdb_symbol {
+ struct uuid uuid; /* The UUID that the symbol represents. */
+ bool used; /* Already used as row UUID? */
+};
+
struct ovsdb_symbol_table *ovsdb_symbol_table_create(void);
void ovsdb_symbol_table_destroy(struct ovsdb_symbol_table *);
-const struct uuid *ovsdb_symbol_table_get(const struct ovsdb_symbol_table *,
- const char *name);
+struct ovsdb_symbol *ovsdb_symbol_table_get(const struct ovsdb_symbol_table *,
+ const char *name);
void ovsdb_symbol_table_put(struct ovsdb_symbol_table *, const char *name,
- const struct uuid *);
+ const struct uuid *, bool used);
#endif /* ovsdb-data.h */