This commit makes several library headers suitable for inclusion in C++.
It adds [extern "C"] guards and makes minor changes to fix casting and
keyword issues.
Andy Southgate andy.southgate@citrix.com
Ben Pfaff blp@nicira.com
Bryan Phillippe bp@toroki.com
+Casey Barker crbarker@google.com
Dan Wendlandt dan@nicira.com
David Erickson derickso@stanford.edu
Ethan Jackson ethan@nicira.com
#include "openflow/nicira-ext.h"
#include "openflow/openflow.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* A flow classifier. */
struct classifier {
int n_rules; /* Total number of rules. */
: 0); \
(RULE) = (NEXT))
+#ifdef __cplusplus
+}
+#endif
+
#endif /* classifier.h */
#include <string.h>
#include "util.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* This is the public domain lookup3 hash by Bob Jenkins from
* http://burtleburtle.net/bob/c/lookup3.c, modified for style. */
* quality. */
static inline uint32_t hash_boolean(bool x, uint32_t basis)
{
- enum { P0 = 0xc2b73583 }; /* This is hash_int(1, 0). */
- enum { P1 = 0xe90f1258 }; /* This is hash_int(2, 0). */
+ const uint32_t P0 = 0xc2b73583; /* This is hash_int(1, 0). */
+ const uint32_t P1 = 0xe90f1258; /* This is hash_int(2, 0). */
return (x ? P0 : P1) ^ HASH_ROT(basis, 1);
}
return hash_int((uint32_t) (uintptr_t) p, basis);
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* hash.h */
void hmap_node_moved(struct hmap *, struct hmap_node *, struct hmap_node *);
static inline void hmap_replace(struct hmap *, const struct hmap_node *old,
- struct hmap_node *new);
+ struct hmap_node *new_node);
struct hmap_node *hmap_random_node(const struct hmap *);
static inline union ofp_action *
ofputil_action_next(const union ofp_action *a)
{
- return (void *) ((uint8_t *) a + ntohs(a->header.len));
+ return ((union ofp_action *) (void *)
+ ((uint8_t *) a + ntohs(a->header.len)));
}
static inline bool
#include "hmap.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct sset_node {
struct hmap_node hmap_node;
char name[1];
SSET_NAME_FROM_HMAP_NODE( \
hmap_next(&(SSET)->map, &SSET_NODE_FROM_NAME(NAME)->hmap_node))
+#ifdef __cplusplus
+}
+#endif
+
#endif /* sset.h */
#include "flow.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct list;
struct ofpbuf;
struct ofp_action_header;
int pvconn_accept(struct pvconn *, int min_version, struct vconn **);
void pvconn_wait(struct pvconn *);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* vconn.h */