FD.io VPP  v20.09-64-g4f7b92f0a
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,
34  u32 thread_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,
80  u32 thread_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,
89  u32 thread_index,
90  u32 nat_thread_index,
91  u16 port_per_thread,
93 
94 int
96  u32 thread_index,
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  */
u8 count
Definition: dhcp.api:208
int nat_add_del_ip4_pool_addr(nat_ip4_pool_t *pool, ip4_address_t addr, u8 is_add)
Definition: alloc.c:32
ip4_address_t addr
Definition: alloc.h:56
vhost_vring_addr_t addr
Definition: vhost_user.h:111
unsigned char u8
Definition: types.h:56
u32 random_seed
Definition: alloc.h:65
vl_api_ip_proto_t protocol
Definition: lb_types.api:71
nat_alloc_ip4_addr_and_port_cb_t * alloc_addr_and_port_cb
Definition: alloc.h:63
unsigned int u32
Definition: types.h:88
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
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
unsigned short u16
Definition: types.h:57
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_add_del_ip4_pool_addr_cb_t * add_del_pool_addr_cb
Definition: alloc.h:62
nat_ip4_pool_addr_t * pool_addr
Definition: alloc.h:64
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
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
ip4_address_t addr
Definition: alloc.h:42
void() nat_add_del_ip4_pool_addr_cb_t(ip4_address_t addr, u8 is_add, void *opaque)
Definition: alloc.h:29