+/* An atomic type plus optional constraints. */
+
+enum ovsdb_ref_type {
+ OVSDB_REF_STRONG, /* Target must exist. */
+ OVSDB_REF_WEAK /* Delete reference if target disappears. */
+};
+
+struct ovsdb_base_type {
+ enum ovsdb_atomic_type type;
+
+ /* If nonnull, a datum with keys of type 'type' that expresses all the
+ * valid values for this base_type. */
+ struct ovsdb_datum *enum_;
+
+ union {
+ struct ovsdb_integer_constraints {
+ int64_t min; /* minInteger or INT64_MIN. */
+ int64_t max; /* maxInteger or INT64_MAX. */
+ } integer;
+
+ struct ovsdb_real_constraints {
+ double min; /* minReal or -DBL_MAX. */
+ double max; /* minReal or DBL_MAX. */
+ } real;
+
+ /* No constraints for Boolean types. */
+
+ struct ovsdb_string_constraints {
+ unsigned int minLen; /* minLength or 0. */
+ unsigned int maxLen; /* maxLength or UINT_MAX. */
+ } string;
+
+ struct ovsdb_uuid_constraints {
+ char *refTableName; /* Name of referenced table, or NULL. */
+ struct ovsdb_table *refTable; /* Referenced table, if available. */
+ enum ovsdb_ref_type refType; /* Reference type. */
+ } uuid;
+ } u;
+};
+
+#define OVSDB_BASE_VOID_INIT { .type = OVSDB_TYPE_VOID }
+#define OVSDB_BASE_INTEGER_INIT { .type = OVSDB_TYPE_INTEGER, \
+ .u.integer = { INT64_MIN, INT64_MAX } }
+#define OVSDB_BASE_REAL_INIT { .type = OVSDB_TYPE_REAL, \
+ .u.real = { -DBL_MAX, DBL_MAX } }
+#define OVSDB_BASE_BOOLEAN_INIT { .type = OVSDB_TYPE_BOOLEAN }
+#define OVSDB_BASE_STRING_INIT { .type = OVSDB_TYPE_STRING, \
+ .u.string = { 0, UINT_MAX } }
+#define OVSDB_BASE_UUID_INIT { .type = OVSDB_TYPE_UUID, \
+ .u.uuid = { NULL, NULL, 0 } }
+
+void ovsdb_base_type_init(struct ovsdb_base_type *, enum ovsdb_atomic_type);
+void ovsdb_base_type_clone(struct ovsdb_base_type *,
+ const struct ovsdb_base_type *);
+void ovsdb_base_type_destroy(struct ovsdb_base_type *);
+
+bool ovsdb_base_type_is_valid(const struct ovsdb_base_type *);
+bool ovsdb_base_type_has_constraints(const struct ovsdb_base_type *);
+void ovsdb_base_type_clear_constraints(struct ovsdb_base_type *);
+const struct ovsdb_type *ovsdb_base_type_get_enum_type(enum ovsdb_atomic_type);
+
+struct ovsdb_error *ovsdb_base_type_from_json(struct ovsdb_base_type *,
+ const struct json *)
+ WARN_UNUSED_RESULT;
+struct json *ovsdb_base_type_to_json(const struct ovsdb_base_type *);
+
+static inline bool ovsdb_base_type_is_ref(const struct ovsdb_base_type *);
+static inline bool ovsdb_base_type_is_strong_ref(
+ const struct ovsdb_base_type *);
+static inline bool ovsdb_base_type_is_weak_ref(const struct ovsdb_base_type *);
+\f