Fix linker errors with recent GNU ld
[samplevnf.git] / VNFs / DPPD-PROX / defines.h
1 /*
2 // Copyright (c) 2010-2020 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16
17 #ifndef _DEFINES_H_
18 #define _DEFINES_H_
19
20 // with 3GHz CPU
21 #define DRAIN_TIMEOUT  __UINT64_C(6000000)             // drain TX buffer every 2ms
22 #define TERM_TIMEOUT   __UINT64_C(3000000000)          // check if terminated every 1s
23
24 /* DRAIN_TIMEOUT should be smaller than TERM_TIMEOUT as TERM_TIMEOUT
25    is only checked after DRAIN_TIMEOUT */
26 #if TERM_TIMEOUT < DRAIN_TIMEOUT
27 #error TERM_TIMEOUT < DRAIN_TIMEOUT
28 #endif
29
30 #ifndef IPv4_BYTES
31 #define IPv4_BYTES_FMT  "%d.%d.%d.%d"
32 #define IPv4_BYTES(addr)                        \
33         addr[0],  addr[1],  addr[2],  addr[3]
34 #endif
35
36 #ifndef IPv6_BYTES
37 #define IPv6_BYTES_FMT  "%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x"
38 #define IPv6_BYTES(addr)                        \
39         addr[0],  addr[1],  addr[2],  addr[3],  \
40         addr[4],  addr[5],  addr[6],  addr[7],  \
41         addr[8],  addr[9],  addr[10], addr[11], \
42         addr[12], addr[13], addr[14], addr[15]
43 #endif
44
45 #ifndef IPv6_PREFIX
46 #define IPv6_PREFIX_FMT  "%02x%02x:%02x%02x:%02x%02x:%02x%02x"
47 #define IPv6_PREFIX(addr)                        \
48         addr[0],  addr[1],  addr[2],  addr[3],  \
49         addr[4],  addr[5],  addr[6],  addr[7]
50 #endif
51
52 #ifndef MAC_BYTES
53 #define MAC_BYTES_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
54
55 #define MAC_BYTES(addr)   \
56         addr[0], addr[1], \
57         addr[2], addr[3], \
58         addr[4], addr[5]
59 #endif
60
61 /* assume cpu byte order is little endian */
62 #define PKT_TO_LUTQINQ(svlan, cvlan) ((((uint32_t)svlan) & 0x000F) << 4 | (((uint32_t)svlan) & 0xFF00) << 8 | (((uint32_t)cvlan) & 0xFF0F))
63
64 #define ROUTE_ERR 254
65
66 #endif /* _DEFINES_H_ */