1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2021 Intel Corporation
5 /* Log file related character defs. */
6 #define COMMENT_LEAD_CHAR ('#')
7 #define ROUTE_LEAD_CHAR ('R')
9 #define IPV6_ADDR_LEN 16
10 #define IPV6_ADDR_U16 (IPV6_ADDR_LEN / sizeof(uint16_t))
11 #define IPV6_ADDR_U32 (IPV6_ADDR_LEN / sizeof(uint32_t))
13 #define GET_CB_FIELD(in, fd, base, lim, dlm) do { \
17 val = strtoul((in), &end, (base)); \
18 if (errno != 0 || end[0] != (dlm) || val > (lim)) \
20 (fd) = (typeof(fd))val; \
24 struct ipv4_l3fwd_route {
30 struct ipv6_l3fwd_route {
45 uint8_t ip_dst[IPV6_ADDR_LEN];
46 uint8_t ip_src[IPV6_ADDR_LEN];
52 struct lpm_route_rule {
56 uint32_t ip_32[IPV6_ADDR_U32];
57 uint8_t ip_8[IPV6_ADDR_LEN];
64 struct ipv4_l3fwd_em_route {
65 struct ipv4_5tuple key;
69 struct ipv6_l3fwd_em_route {
70 struct ipv6_5tuple key;
76 struct ipv4_5tuple v4_key;
77 struct ipv6_5tuple v6_key;
82 extern struct lpm_route_rule *route_base_v4;
83 extern struct lpm_route_rule *route_base_v6;
84 extern int route_num_v4;
85 extern int route_num_v6;
87 extern const struct ipv4_l3fwd_route ipv4_l3fwd_route_array[16];
88 extern const struct ipv6_l3fwd_route ipv6_l3fwd_route_array[16];
90 extern const struct ipv4_l3fwd_em_route ipv4_l3fwd_em_route_array[16];
91 extern const struct ipv6_l3fwd_em_route ipv6_l3fwd_em_route_array[16];
94 read_config_files_lpm(void);
97 read_config_files_em(void);
100 em_free_routes(void);
103 lpm_free_routes(void);
106 is_bypass_line(const char *buff);