X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fovsdb-data.h;h=6ee5f9ac06b894fd03f7f83774bfc741ad82e911;hb=c7f7adb70cb34bb568f9b6327d6adb945326e029;hp=3f2d489437e5a42d067626a273382a11eae13029;hpb=e9f8f9367e9e654b9582279608af86ea3744a2a0;p=openvswitch diff --git a/lib/ovsdb-data.h b/lib/ovsdb-data.h index 3f2d4894..6ee5f9ac 100644 --- a/lib/ovsdb-data.h +++ b/lib/ovsdb-data.h @@ -1,4 +1,4 @@ -/* 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. @@ -32,6 +32,7 @@ union ovsdb_atom { }; 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 *); @@ -72,7 +73,21 @@ struct ovsdb_error *ovsdb_atom_from_json(union ovsdb_atom *, struct json *ovsdb_atom_to_json(const union ovsdb_atom *, enum ovsdb_atomic_type); -/* 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'. */ @@ -80,6 +95,8 @@ struct ovsdb_datum { }; 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 *);