18 #ifndef included_nat_inlines_h__ 19 #define included_nat_inlines_h__ 25 [IP_PROTOCOL_TCP] = NAT_PROTOCOL_TCP,
26 [IP_PROTOCOL_UDP] = NAT_PROTOCOL_UDP,
27 [IP_PROTOCOL_ICMP] = NAT_PROTOCOL_ICMP,
28 [IP_PROTOCOL_ICMP6] = NAT_PROTOCOL_ICMP,
37 ASSERT (nat_proto <= NAT_PROTOCOL_ICMP);
39 static const u8 lookup_table[256] = {
40 [NAT_PROTOCOL_OTHER] = ~0,
41 [NAT_PROTOCOL_TCP] = IP_PROTOCOL_TCP,
42 [NAT_PROTOCOL_UDP] = IP_PROTOCOL_UDP,
43 [NAT_PROTOCOL_ICMP] = IP_PROTOCOL_ICMP,
46 ASSERT (NAT_PROTOCOL_OTHER == nat_proto || NAT_PROTOCOL_TCP == nat_proto
47 || NAT_PROTOCOL_UDP == nat_proto || NAT_PROTOCOL_ICMP == nat_proto);
49 return lookup_table[nat_proto];
57 case ICMP4_destination_unreachable:
58 case ICMP4_time_exceeded:
59 case ICMP4_parameter_problem:
60 case ICMP4_source_quench:
62 case ICMP4_alternate_host_address:
#define static_always_inline
static nat_protocol_t ip_proto_to_nat_proto(u8 ip_proto)
Common NAT inline functions.
static_always_inline u8 icmp_type_is_error_message(u8 icmp_type)
static_always_inline u8 nat_proto_to_ip_proto(nat_protocol_t nat_proto)