FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
alloc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /**
16  * @file
17  * @brief NAT port/address allocation lib
18  */
19 
20 #ifndef included_nat_lib_alloc_h__
21 #define included_nat_lib_alloc_h__
22 
23 #include <vnet/ip/ip.h>
24 
28 
30  u8 is_add, void *opaque);
31 
33  u32 fib_index,
35  u32 nat_thread_index,
36  u16 port_per_thread,
37  u16 protocol,
38  nat_ip4_addr_port_t * out);
39 
41 {
44 /* *INDENT-OFF* */
45 #define _(N, i, n, s) \
46  u16 busy_##n##_ports; \
47  u16 * busy_##n##_ports_per_thread; \
48  uword * busy_##n##_port_bitmap;
50 #undef _
51 /* *INDENT-ON* */
52 };
53 
55 {
58 };
59 
61 {
66 };
67 
68 int
70  ip4_address_t addr, u8 is_add);
71 
72 int
75  u32 count, u8 is_add, void *opaque);
76 
77 int
79  u32 fib_index,
81  u32 nat_thread_index,
82  u16 port_per_thread,
83  u16 protocol,
84  nat_ip4_addr_port_t * out);
85 
86 int
88  u32 fib_index,
90  u32 nat_thread_index,
91  u16 port_per_thread,
93 
94 int
98 
99 #endif /* included_nat_lib_alloc_h__ */
100 
101 /*
102  * fd.io coding-style-patch-verification: ON
103  *
104  * Local Variables:
105  * eval: (c-set-style "gnu")
106  * End:
107  */
nat_ip4_pool_addr_s
Definition: alloc.h:40
thread_index
u32 thread_index
Definition: nat44_ei_hairpinning.c:492
nat_alloc_ip4_addr_and_port
int nat_alloc_ip4_addr_and_port(nat_ip4_pool_t *pool, u32 fib_index, u32 thread_index, u32 nat_thread_index, u16 port_per_thread, u16 protocol, nat_ip4_addr_port_t *out)
Definition: alloc.c:195
nat_alloc_ip4_addr_and_port_cb_default
int nat_alloc_ip4_addr_and_port_cb_default(nat_ip4_pool_t *pool, u32 fib_index, u32 thread_index, u32 nat_thread_index, u16 port_per_thread, u16 protocol, nat_ip4_addr_port_t *out)
Definition: alloc.c:112
nat_ip4_addr_port_s::port
u16 port
Definition: alloc.h:57
u16
unsigned short u16
Definition: types.h:57
nat_ip4_pool_addr_s::addr
ip4_address_t addr
Definition: alloc.h:42
addr
vhost_vring_addr_t addr
Definition: vhost_user.h:130
nat_alloc_ip4_addr_and_port_cb_t
int() nat_alloc_ip4_addr_and_port_cb_t(nat_ip4_pool_t *pool, u32 fib_index, u32 thread_index, u32 nat_thread_index, u16 port_per_thread, u16 protocol, nat_ip4_addr_port_t *out)
Definition: alloc.h:32
nat_ip4_pool_s::alloc_addr_and_port_cb
nat_alloc_ip4_addr_and_port_cb_t * alloc_addr_and_port_cb
Definition: alloc.h:63
nat_ip4_pool_s
Definition: alloc.h:60
foreach_nat_protocol
@ foreach_nat_protocol
Definition: lib.h:66
count
u8 count
Definition: dhcp.api:208
nat_ip4_addr_port_s::addr
ip4_address_t addr
Definition: alloc.h:56
nat_add_del_ip4_pool_addr_cb_t
void() nat_add_del_ip4_pool_addr_cb_t(ip4_address_t addr, u8 is_add, void *opaque)
Definition: alloc.h:29
nat_free_ip4_addr_and_port
int nat_free_ip4_addr_and_port(nat_ip4_pool_t *pool, u32 thread_index, u16 protocol, nat_ip4_addr_port_t *in)
Definition: alloc.c:211
nat_ip4_pool_addr_s::fib_index
u32 fib_index
Definition: alloc.h:43
nat_ip4_pool_s::add_del_pool_addr_cb
nat_add_del_ip4_pool_addr_cb_t * add_del_pool_addr_cb
Definition: alloc.h:62
ip4_address_t
Definition: ip4_packet.h:50
nat_add_del_ip4_pool_addrs
int nat_add_del_ip4_pool_addrs(nat_ip4_pool_t *pool, ip4_address_t addr, u32 count, u8 is_add, void *opaque)
Definition: alloc.c:76
nat_ip4_addr_port_s
Definition: alloc.h:54
nat_ip4_pool_s::pool_addr
nat_ip4_pool_addr_t * pool_addr
Definition: alloc.h:64
ip.h
u32
unsigned int u32
Definition: types.h:88
protocol
vl_api_ip_proto_t protocol
Definition: lb_types.api:72
nat_ip4_pool_s::random_seed
u32 random_seed
Definition: alloc.h:65
u8
unsigned char u8
Definition: types.h:56
nat_add_del_ip4_pool_addr
int nat_add_del_ip4_pool_addr(nat_ip4_pool_t *pool, ip4_address_t addr, u8 is_add)
Definition: alloc.c:32