summaryrefslogtreecommitdiff
path: root/include/openvswitch/types.h
diff options
context:
space:
mode:
authorJoe Stringer <joestringer@nicira.com>2015-09-22 23:24:11 -0700
committerJoe Stringer <joestringer@nicira.com>2015-10-13 15:34:14 -0700
commit557344e3fe9d90c7f477d9fc26bb1baddcf248a5 (patch)
tree38b43a03c3b245f426e617e77b4196ea120c1abc /include/openvswitch/types.h
parent81270993ab95b463ffc3a7779a352ee5a6a27f21 (diff)
downloadopenvswitch-557344e3fe9d90c7f477d9fc26bb1baddcf248a5.tar.gz
types: Add big-endian 128-bit types and helpers.
These types will be used by the following patches to ensure a consistent wire format for 128-bit connection tracking labels. Common functions for comparison, endian translation, etc. are provided. Signed-off-by: Joe Stringer <joestringer@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'include/openvswitch/types.h')
-rw-r--r--include/openvswitch/types.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/openvswitch/types.h b/include/openvswitch/types.h
index c138b9c63..64d90121a 100644
--- a/include/openvswitch/types.h
+++ b/include/openvswitch/types.h
@@ -84,10 +84,24 @@ typedef struct {
typedef union {
uint32_t u32[4];
struct {
+#ifdef WORDS_BIGENDIAN
+ uint64_t hi, lo;
+#else
uint64_t lo, hi;
+#endif
} u64;
} ovs_u128;
+typedef union {
+ ovs_be32 be32[4];
+ struct {
+ ovs_be64 hi, lo;
+ } be64;
+} ovs_be128;
+
+#define OVS_U128_MAX (ovs_u128) { .u64 = { UINT64_MAX, UINT64_MAX } }
+#define OVS_BE128_MAX (ovs_be128) { .be64 = { OVS_BE64_MAX, OVS_BE64_MAX } }
+
/* A 64-bit value, in network byte order, that is only aligned on a 32-bit
* boundary. */
typedef struct {