summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi-Hung Wei <yihung.wei@gmail.com>2017-11-30 11:11:50 -0800
committerBen Pfaff <blp@ovn.org>2017-12-01 13:22:18 -0800
commit9131abe2236b4ed1685e76db9921115bcd8f05e3 (patch)
tree574d0cd596930a0eeee97c24a8ee7ab1add2af1e
parent936cca17923a75968844b43dba22c6e7421dda4b (diff)
downloadopenvswitch-9131abe2236b4ed1685e76db9921115bcd8f05e3.tar.gz
lib, ovsdb: Adapt headers for C++ usage
This patch adds 'extern "C"' in a couple of header files so that they can be compiled with C++ compilers. Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r--lib/dirs.h8
-rw-r--r--lib/ovsdb-data.h8
-rw-r--r--lib/ovsdb-idl-provider.h8
-rw-r--r--lib/ovsdb-idl.h9
-rw-r--r--lib/ovsdb-map-op.h8
-rw-r--r--lib/ovsdb-set-op.h8
-rw-r--r--lib/ovsdb-types.h8
-rw-r--r--lib/smap.h8
-rw-r--r--lib/uuid.h8
-rwxr-xr-xovsdb/ovsdb-idlc.in11
10 files changed, 83 insertions, 1 deletions
diff --git a/lib/dirs.h b/lib/dirs.h
index 811a51fce..26af4bc41 100644
--- a/lib/dirs.h
+++ b/lib/dirs.h
@@ -17,6 +17,10 @@
#ifndef DIRS_H
#define DIRS_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
const char *ovs_sysconfdir(void); /* /usr/local/etc */
const char *ovs_pkgdatadir(void); /* /usr/local/share/openvswitch */
const char *ovs_rundir(void); /* /usr/local/var/run/openvswitch */
@@ -24,4 +28,8 @@ const char *ovs_logdir(void); /* /usr/local/var/log/openvswitch */
const char *ovs_dbdir(void); /* /usr/local/etc/openvswitch */
const char *ovs_bindir(void); /* /usr/local/bin */
+#ifdef __cplusplus
+}
+#endif
+
#endif /* dirs.h */
diff --git a/lib/ovsdb-data.h b/lib/ovsdb-data.h
index 72c8fe35b..c7bb095cd 100644
--- a/lib/ovsdb-data.h
+++ b/lib/ovsdb-data.h
@@ -21,6 +21,10 @@
#include "ovsdb-types.h"
#include "openvswitch/shash.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MAX_OVSDB_ATOM_RANGE_SIZE 4096
struct ds;
@@ -282,4 +286,8 @@ bool ovsdb_token_is_delim(unsigned char);
struct ovsdb_error *ovsdb_atom_range_check_size(int64_t range_start,
int64_t range_end);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-data.h */
diff --git a/lib/ovsdb-idl-provider.h b/lib/ovsdb-idl-provider.h
index a3eccb4c0..d15ab1db5 100644
--- a/lib/ovsdb-idl-provider.h
+++ b/lib/ovsdb-idl-provider.h
@@ -26,6 +26,10 @@
#include "openvswitch/shash.h"
#include "uuid.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* A local copy of a row in an OVSDB table, replicated from an OVSDB server.
* This structure is used as a header for a larger structure that translates
* the "struct ovsdb_datum"s into easier-to-use forms, via the ->parse() and
@@ -161,4 +165,8 @@ void ovsdb_idl_txn_verify(const struct ovsdb_idl_row *,
struct ovsdb_idl_txn *ovsdb_idl_txn_get(const struct ovsdb_idl_row *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-idl-provider.h */
diff --git a/lib/ovsdb-idl.h b/lib/ovsdb-idl.h
index b00b10543..67d48cf0c 100644
--- a/lib/ovsdb-idl.h
+++ b/lib/ovsdb-idl.h
@@ -44,6 +44,10 @@
#include "ovsdb-condition.h"
#include "skiplist.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct json;
struct ovsdb_datum;
struct ovsdb_idl_class;
@@ -409,4 +413,9 @@ struct ovsdb_idl_row *ovsdb_idl_index_forward_to(
int ovsdb_idl_index_compare(struct ovsdb_idl_index_cursor *,
struct ovsdb_idl_row *a,
struct ovsdb_idl_row *b);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-idl.h */
diff --git a/lib/ovsdb-map-op.h b/lib/ovsdb-map-op.h
index 140b0f388..282f0534e 100644
--- a/lib/ovsdb-map-op.h
+++ b/lib/ovsdb-map-op.h
@@ -19,6 +19,10 @@
#include "ovsdb-data.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum map_op_type {
MAP_OP_UPDATE,
MAP_OP_INSERT,
@@ -42,4 +46,8 @@ void map_op_list_add(struct map_op_list *, struct map_op *,
struct map_op *map_op_list_first(struct map_op_list *);
struct map_op *map_op_list_next(struct map_op_list *, struct map_op *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-map-op.h */
diff --git a/lib/ovsdb-set-op.h b/lib/ovsdb-set-op.h
index 802cd7cf0..419080b8a 100644
--- a/lib/ovsdb-set-op.h
+++ b/lib/ovsdb-set-op.h
@@ -20,6 +20,10 @@
#include "ovsdb-data.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
enum set_op_type {
SET_OP_INSERT,
SET_OP_DELETE
@@ -42,4 +46,8 @@ void set_op_list_add(struct set_op_list *, struct set_op *,
struct set_op *set_op_list_first(struct set_op_list *);
struct set_op *set_op_list_next(struct set_op_list *, struct set_op *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-set-op.h */
diff --git a/lib/ovsdb-types.h b/lib/ovsdb-types.h
index 81cc86213..222d0ec15 100644
--- a/lib/ovsdb-types.h
+++ b/lib/ovsdb-types.h
@@ -22,6 +22,10 @@
#include "compiler.h"
#include "uuid.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct json;
/* An atomic type: one that OVSDB regards as a single unit of data. */
@@ -227,4 +231,8 @@ static inline bool ovsdb_type_is_map(const struct ovsdb_type *type)
return type->value.type != OVSDB_TYPE_VOID;
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* ovsdb-types.h */
diff --git a/lib/smap.h b/lib/smap.h
index edf591cf1..838e2e4bb 100644
--- a/lib/smap.h
+++ b/lib/smap.h
@@ -19,6 +19,10 @@
#include "hash.h"
#include "openvswitch/hmap.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct json;
struct uuid;
@@ -113,4 +117,8 @@ struct json *smap_to_json(const struct smap *);
bool smap_equal(const struct smap *, const struct smap *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* smap.h */
diff --git a/lib/uuid.h b/lib/uuid.h
index dba6e1c11..69a71cc60 100644
--- a/lib/uuid.h
+++ b/lib/uuid.h
@@ -18,6 +18,10 @@
#include "openvswitch/uuid.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* An initializer or expression for an all-zero UUID. */
#define UUID_ZERO ((struct uuid) { .parts = { 0, 0, 0, 0 } })
@@ -69,4 +73,8 @@ int uuid_is_partial_string(const char *);
int uuid_is_partial_match(const struct uuid *, const char *match);
void uuid_set_bits_v4(struct uuid *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* uuid.h */
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index 24e86b772..c3973e4f5 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -137,7 +137,12 @@ def printCIDLHeader(schemaFile):
#include "ovsdb-data.h"
#include "ovsdb-idl-provider.h"
#include "smap.h"
-#include "uuid.h"''' % {'prefix': prefix.upper()})
+#include "uuid.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+''' % {'prefix': prefix.upper()})
for tableName, table in sorted(schema.tables.items()):
structName = "%s%s" % (prefix, tableName.lower())
@@ -305,6 +310,10 @@ bool %(s)s_is_updated(const struct %(s)s *, enum %(s)s_column_id);
print("\nextern struct ovsdb_idl_class %sidl_class;" % prefix)
print("\nconst char * %sget_db_version(void);" % prefix)
+ print('''
+#ifdef __cplusplus
+}
+#endif''')
print("\n#endif /* %(prefix)sIDL_HEADER */" % {'prefix': prefix.upper()})
def printEnum(type, members):