summaryrefslogtreecommitdiff
path: root/build-aux/extract-odp-netlink-h
blob: bc1cc35a7e9b87940b24fdc93351a4547368f53f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# This is a "sed" script that transforms <linux/openvswitch.h> into a
# form that is suitable for inclusion within the Open vSwitch tree on
# both Linux and non-Linux systems.

# Add a header warning that this is a generated file.  It might save somebody
# some frustration (maybe even me!).
1i\
/* -*- mode: c; buffer-read-only: t -*- */\
/* Generated automatically from <linux/openvswitch.h> -- do not modify! */\
\
\


# Avoid using reserved names in header guards.
s/_LINUX_OPENVSWITCH_H/ODP_NETLINK_H/

# Include platform extensions header file on Win32.
$i\
#ifdef _WIN32\
#include "OvsDpInterfaceExt.h"\
#include "OvsDpInterfaceCtExt.h"\
#endif\
\
/* IPCT_* enums may not be defined in all platforms, so do not use them. */\
#define OVS_CT_EVENT_NEW	(1 << 0)   /* 1 << IPCT_NEW */\
#define OVS_CT_EVENT_RELATED	(1 << 1)   /* 1 << IPCT_RELATED */\
#define OVS_CT_EVENT_DESTROY	(1 << 2)   /* 1 << IPCT_DESTROY */\
#define OVS_CT_EVENT_REPLY	(1 << 3)   /* 1 << IPCT_REPLY */\
#define OVS_CT_EVENT_ASSURED	(1 << 4)   /* 1 << IPCT_ASSURED */\
#define OVS_CT_EVENT_PROTOINFO	(1 << 5)   /* 1 << IPCT_PROTOINFO */\
#define OVS_CT_EVENT_HELPER	(1 << 6)   /* 1 << IPCT_HELPER */\
#define OVS_CT_EVENT_MARK	(1 << 7)   /* 1 << IPCT_MARK */\
#define OVS_CT_EVENT_SEQADJ	(1 << 8)   /* 1 << IPCT_SEQADJ */\
#define OVS_CT_EVENT_SECMARK	(1 << 9)   /* 1 << IPCT_SECMARK */\
#define OVS_CT_EVENT_LABEL	(1 << 10)  /* 1 << IPCT_LABEL */\
\
#define OVS_CT_EVENTMASK_DEFAULT \\\
  (OVS_CT_EVENT_NEW | OVS_CT_EVENT_RELATED | OVS_CT_EVENT_DESTROY |\\\
   OVS_CT_EVENT_MARK | OVS_CT_EVENT_LABEL)\

# Use OVS's own struct eth_addr instead of a 6-byte char array.
s,<linux/types\.h>,"openvswitch/types.h"\
#include <netinet/in.h>,
s,#.*<linux/if_ether\.h>,,
s/__u8[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*\[[[:space:]]*ETH_ALEN[[:space:]]*\]/struct eth_addr \1/

# Transform IPv6 addresses from an array to struct in6_addr
#
# As a very special case, only transform member names with more than
# one character because struct ovs_key_nsh has a member "__be32 c[4];"
# that is not an IPv6 address.
s/__be32[[:space:]]*\([a-zA-Z0-9_]\{2,\}\)[[:space:]]*\[[[:space:]]*4[[:space:]]*\]/struct in6_addr \1/

# Transform most Linux-specific __u<N> types into C99 uint<N>_t types,
# and most Linux-specific __be<N> into Open vSwitch ovs_be<N>,
# and use the appropriate userspace header.
s/__u32/uint32_t/g
s/__u16/uint16_t/g
s/__u8/uint8_t/g
s/__be32/ovs_be32/g
s/__be16/ovs_be16/g

# Transform 64-bit Linux-specific types into Open vSwitch specialized
# types for 64-bit numbers that might only be aligned on a 32-bit
# boundary.
s/__u64/ovs_32aligned_u64/g
s/__be64/ovs_32aligned_be64/g