summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ovsdb-data.c19
-rw-r--r--lib/ovsdb-data.h5
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c
index a62e92e06..f7d0b06e7 100644
--- a/lib/ovsdb-data.c
+++ b/lib/ovsdb-data.c
@@ -1268,6 +1268,25 @@ ovsdb_datum_from_json(struct ovsdb_datum *datum,
return error;
}
+/* Parses 'json' as a datum of the type described by 'type' for internal
+ * use. This function is similar to 'ovsdb_datum_from_json', except the
+ * member size of set or map is not checked.
+ *
+ * The datum generated should be used then discard. It is not suitable
+ * for storing into IDL because of the possible member size violation. */
+struct ovsdb_error *
+ovsdb_transient_datum_from_json(struct ovsdb_datum *datum,
+ const struct ovsdb_type *type,
+ const struct json *json)
+{
+ struct ovsdb_type relaxed_type = *type;
+
+ relaxed_type.n_min = 0;
+ relaxed_type.n_max = UINT_MAX;
+
+ return ovsdb_datum_from_json(datum, &relaxed_type, json, NULL);
+}
+
/* Converts 'datum', of the specified 'type', to JSON format, and returns the
* JSON. The caller is responsible for freeing the returned JSON.
*
diff --git a/lib/ovsdb-data.h b/lib/ovsdb-data.h
index e144c70d0..802f7184c 100644
--- a/lib/ovsdb-data.h
+++ b/lib/ovsdb-data.h
@@ -161,6 +161,11 @@ struct ovsdb_error *ovsdb_datum_from_json(struct ovsdb_datum *,
const struct json *,
struct ovsdb_symbol_table *)
OVS_WARN_UNUSED_RESULT;
+struct ovsdb_error *ovsdb_transient_datum_from_json(
+ struct ovsdb_datum *,
+ const struct ovsdb_type *,
+ const struct json *)
+ OVS_WARN_UNUSED_RESULT;
struct json *ovsdb_datum_to_json(const struct ovsdb_datum *,
const struct ovsdb_type *);