FD.io VPP  v21.01.1
Vector Packet Processing
cnat_src_policy.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 #ifndef __CNAT_SRC_POLICY_H__
17 #define __CNAT_SRC_POLICY_H__
18 
19 // #include <vnet/udp/udp.h>
20 #include <cnat/cnat_types.h>
21 #include <cnat/cnat_session.h>
22 #include <cnat/cnat_translation.h>
23 
24 typedef enum
25 {
32 
34 {
38 
40 {
41  /* Source ports bitmap for snat */
43 
44  /* Lock for src_ports access */
47 
48 /* function to use to compute source (IP, port) for a new session to a vip */
51  u32 * rsession_flags, const cnat_translation_t * ct,
53 
54 typedef struct cnat_src_policy_main_
55 {
58 
59  /* Per proto source ports allocator for snat */
62 
64 
67 void cnat_free_port (u16 port, ip_protocol_t iproto);
68 
69 /*
70  * fd.io coding-style-patch-verification: ON
71  *
72  * Local Variables:
73  * eval: (c-set-style "gnu")
74  * End:
75  */
76 
77 #endif
cnat_source_policy_errors_
struct cnat_src_policy_main_ cnat_src_policy_main_t
A Translation represents the translation of a VEP to one of a set of real server addresses.
vlib_main_t * vm
Definition: in2out_ed.c:1580
enum cnat_source_policy_errors_ cnat_source_policy_errors_t
A session represents the memory of a translation.
Definition: cnat_session.h:38
const cJSON *const b
Definition: cJSON.h:255
cnat_source_policy_errors_t(* cnat_vip_source_policy_t)(vlib_main_t *vm, vlib_buffer_t *b, cnat_session_t *session, u32 *rsession_flags, const cnat_translation_t *ct, cnat_node_ctx_t *ctx)
unsigned int u32
Definition: types.h:88
cnat_src_port_allocator_t * src_ports
void cnat_register_vip_src_policy(cnat_vip_source_policy_t fp)
enum ip_protocol ip_protocol_t
int cnat_allocate_port(u16 *port, ip_protocol_t iproto)
long ctx[MAX_CONNS]
Definition: main.c:144
unsigned short u16
Definition: types.h:57
cnat_vip_source_policy_t default_policy
void cnat_free_port(u16 port, ip_protocol_t iproto)
cnat_src_policy_main_t cnat_src_policy_main
cnat_sport_proto_t
struct cnat_src_port_allocator_ cnat_src_port_allocator_t
VLIB buffer representation.
Definition: buffer.h:102
u16 port
Definition: lb_types.api:73
uword clib_bitmap_t
Definition: bitmap.h:50
cnat_vip_source_policy_t vip_policy