From: Ben Pfaff Date: Mon, 21 Jul 2008 18:39:39 +0000 (-0700) Subject: Make openflow.h SWIG-friendly. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67a603dde8e4a58cc2cadf7740cdf57d7a7cf1ab;p=openvswitch Make openflow.h SWIG-friendly. --- diff --git a/include/openflow.h b/include/openflow.h index 3525e166..2c4746c6 100644 --- a/include/openflow.h +++ b/include/openflow.h @@ -42,7 +42,9 @@ #include #endif -#ifndef __cplusplus +#ifdef SWIG +#define OFP_ASSERT(EXPR) /* SWIG can't handle OFP_ASSERT. */ +#elif !defined(__cplusplus) /* Build-time assertion for use in a declaration context. */ #define OFP_ASSERT(EXPR) \ extern int (*build_assert(void))[ sizeof(struct { \ @@ -52,6 +54,12 @@ #define OFP_ASSERT BOOST_STATIC_ASSERT #endif /* __cplusplus */ +#ifndef SWIG +#define OFP_PACKED __attribute__((packed)) +#else +#define OFP_PACKED /* SWIG doesn't understand __attribute. */ +#endif + /* Maximum length of a OpenFlow packet. */ #define OFP_MAXLEN (sizeof(struct ofp_switch_features) \ + (sizeof(struct ofp_phy_port) * OFPP_MAX) + 200) @@ -280,7 +288,7 @@ struct ofp_action { struct ofp_action_output output; /* OFPAT_OUTPUT: output struct. */ uint16_t vlan_id; /* OFPAT_SET_DL_VLAN: VLAN id. */ uint8_t dl_addr[OFP_ETH_ALEN]; /* OFPAT_SET_DL_SRC/DST */ - uint32_t nw_addr __attribute__((packed)); /* OFPAT_SET_NW_SRC/DST */ + uint32_t nw_addr OFP_PACKED; /* OFPAT_SET_NW_SRC/DST */ uint16_t tp; /* OFPAT_SET_TP_SRC/DST */ } arg; };