|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
19 #ifndef included_nat_lib_h__
20 #define included_nat_lib_h__
25 #define foreach_nat_config_flag \
26 _(0x01, IS_TWICE_NAT) \
27 _(0x02, IS_SELF_TWICE_NAT) \
28 _(0x04, IS_OUT2IN_ONLY) \
29 _(0x08, IS_ADDR_ONLY) \
33 _(0x80, IS_EXT_HOST_VALID)
37 #define _(n,f) NAT_API_##f = n,
42 #define foreach_nat_counter _ (tcp) _ (udp) _ (icmp) _ (other) _ (drops)
44 #define foreach_nat_error \
45 _ (VALUE_EXIST, -1, "Value already exists") \
46 _ (NO_SUCH_ENTRY, -2, "No such entry") \
47 _ (UNKNOWN_PROTOCOL, -3, "Unknown protocol") \
48 _ (OUT_OF_TRANSLATIONS, -4, "Out of translations")
52 #define _(N, i, s) NAT_ERROR_##N = i,
57 #define foreach_nat_protocol \
58 _ (OTHER, 0, other, "other") \
59 _ (UDP, 1, udp, "udp") \
60 _ (TCP, 2, tcp, "tcp") \
61 _ (ICMP, 3, icmp, "icmp")
65 #define _(N, i, n, s) NAT_PROTOCOL_##N = i,
71 #define NAT_UDP_TIMEOUT 300
72 #define NAT_TCP_TRANSITORY_TIMEOUT 240
73 #define NAT_TCP_ESTABLISHED_TIMEOUT 7440
74 #define NAT_ICMP_TIMEOUT 60
104 case NAT_PROTOCOL_ICMP:
105 return timeouts->
icmp;
106 case NAT_PROTOCOL_UDP:
107 return timeouts->
udp;
108 case NAT_PROTOCOL_TCP:
116 return timeouts->
udp;
124 n_elts = n_elts / 2.5;
126 while (lower_pow2 * 2 < n_elts)
128 lower_pow2 = 2 * lower_pow2;
130 u64 upper_pow2 = 2 * lower_pow2;
131 if ((upper_pow2 - n_elts) < (n_elts - lower_pow2))
133 if (upper_pow2 <= UINT32_MAX)
#define NAT_TCP_TRANSITORY_TIMEOUT
struct nat_timeouts_t::@732 tcp
vl_api_dhcp_client_state_t state
#define foreach_nat_config_flag
enum nat_config_flags_t_ nat_config_flags_t
#define foreach_nat_error
uword unformat_nat_protocol(unformat_input_t *input, va_list *args)
#define static_always_inline
static_always_inline u32 nat_calc_bihash_buckets(u32 n_elts)
static_always_inline void nat_reset_timeouts(nat_timeouts_t *timeouts)
static_always_inline u32 nat_session_get_timeout(nat_timeouts_t *timeouts, nat_protocol_t proto, u8 state)
#define foreach_nat_protocol
u8 * format_nat_protocol(u8 *s, va_list *args)
#define NAT_TCP_ESTABLISHED_TIMEOUT