1 /*
2  * Copyright 2021 Google LLC
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 PLATFORMS_NEMORA_PORTABLE_DEFAULT_ADDRESSES_H_
18 #define PLATFORMS_NEMORA_PORTABLE_DEFAULT_ADDRESSES_H_
19 //
20 // Nemora dedicated port. Filtered by NIC.
21 #define DEFAULT_ADDRESSES_RX_PORT 3959
22 
23 // NOTE: All the IPv4 addresses used in this file will be represented in the
24 //       CPU order and therefore must *not* be used to initialize LWIP
25 //       ip_addr types, unless the HTONL macro is used.
26 //
27 // Example: Given Nemora UDP collector VIP 172.20.0.197, the
28 //   DEFAULT_ADDRESSES_TARGET_IP macro expands to the 32-bit number 0xAC1408C5
29 //  (to help the reader: 172 is 0xAC), but with our little endian CPU that
30 //  32-bit number is represented in memory as:
31 //  0xC5 @ offset 0, 0x08 @ offset 1, 0x14 @ offset 2, 0xAC @ offset 3
32 //  Since LWIP uses network order, a correct initialization requires:
33 //  ip_addr collector = { .addr = HTONL(DEFAULT_ADDRESSES_TARGET_IP) };
34 //
35 #ifdef USE_LAB_UDP_DEST
36 // Currently targets the lab installer fdcorp1.mtv
37 #define DEFAULT_ADDRESSES_TARGET_IP ((172 << 24) | (18 << 16) | (107 << 8) | 1)
38 #define DEFAULT_ADDRESSES_TARGET_PORT 50201
39 #else
40 // DEFAULT : Point to production Nemora collector (via anycast VIP).
41 #define DEFAULT_ADDRESSES_TARGET_IP ((172 << 24) | (20 << 16) | (0 << 8) | 197)
42 #define DEFAULT_ADDRESSES_TARGET_PORT 3960
43 #endif
44 
45 // 2001:4860:f802::c5
46 #define DEFAULT_ADDRESSES_TARGET_IP6 {0x20014860, 0xf8020000, 0, 0xc5}
47 
48 #ifdef NETWORK_UNITTEST
49 #define DEFAULT_ADDRESSES_GATEWAY ((172 << 24) | (23 << 16) | (130 << 8) | 190)
50 #define DEFAULT_ADDRESSES_NETMASK ((255 << 24) | (255 << 16) | (255 << 8) | 192)
51 #define DEFAULT_ADDRESSES_LOCAL_IP ((172 << 24) | (23 << 16) | (130 << 8) | 141)
52 #define DEFAULT_ADDRESSES_MAC {0x00, 0x1a, 0x11, 0x30, 0xc9, 0x6f}
53 #define DEFAULT_ADDRESSES_GATEWAY6 {0, 0, 0, 0}
54 #define DEFAULT_ADDRESSES_GATEWAY6_MAC {0, 0, 0, 0, 0, 0}
55 #else
56 #define DEFAULT_ADDRESSES_GATEWAY 0
57 #define DEFAULT_ADDRESSES_NETMASK 0
58 #define DEFAULT_ADDRESSES_LOCAL_IP 0
59 #define DEFAULT_ADDRESSES_MAC {0, 0, 0, 0, 0, 0}
60 // fe80::1 -- as of 2016-10-13 this is guaranteed to be the GW in prod.
61 #define DEFAULT_ADDRESSES_GATEWAY6                                             \
62     {0xfe, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
63 // 02:32:00:00:00:00 -- as of 2016-10-13 this is guaranteed to be the
64 // GW MAC addr in prod.
65 #define DEFAULT_ADDRESSES_GATEWAY6_MAC {0x02, 0x32, 0, 0, 0, 0}
66 #endif
67 
68 #endif // PLATFORMS_NEMORA_PORTABLE_DEFAULT_ADDRESSES_H_
69