ovsdb-idl: Make ovsdb_idl_txn_add_comment() take a printf() format string.
[openvswitch] / lib / ovsdb-types.h
index 633b50f6616cce354a8bb4133ebd432edccdf8dd..6f1727ed158d5ab2bd0069bf832dcbc641b6fc33 100644 (file)
@@ -17,7 +17,6 @@
 #define OVSDB_TYPES_H 1
 
 #include <float.h>
-#include <pcre.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include "compiler.h"
@@ -47,6 +46,11 @@ struct json *ovsdb_atomic_type_to_json(enum ovsdb_atomic_type);
 
 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. */
@@ -61,12 +65,14 @@ struct ovsdb_base_type {
         /* No constraints for Boolean types. */
 
         struct ovsdb_string_constraints {
-            pcre *re;           /* Compiled regular expression. */
-            char *reMatch;      /* reMatch or NULL. */
-            char *reComment;    /* reComment or NULL. */
             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. */
+        } uuid;
     } u;
 };
 
@@ -76,10 +82,10 @@ struct ovsdb_base_type {
 #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 = { NULL, NULL, NULL,   \
-                                                0, UINT_MAX } }
-#define OVSDB_BASE_UUID_INIT    { .type = OVSDB_TYPE_UUID }
+#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 } }
 
 void ovsdb_base_type_init(struct ovsdb_base_type *, enum ovsdb_atomic_type);
 void ovsdb_base_type_clone(struct ovsdb_base_type *,
@@ -89,10 +95,7 @@ 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 *);
-struct ovsdb_error *ovsdb_base_type_set_regex(struct ovsdb_base_type *,
-                                              const char *reMatch,
-                                              const char *reComment)
-    WARN_UNUSED_RESULT;
+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 *)