FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
cnat_translation.h File Reference
+ Include dependency graph for cnat_translation.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cnat_ep_trk_t_
 Data used to track an EP in the FIB. More...
 
struct  cnat_translation_t_
 A Translation represents the translation of a VEP to one of a set of real server addresses. More...
 

Typedefs

typedef struct cnat_ep_trk_t_ cnat_ep_trk_t
 Data used to track an EP in the FIB. More...
 
typedef enum cnat_translation_flag_t_ cnat_translation_flag_t
 
typedef struct cnat_translation_t_ cnat_translation_t
 A Translation represents the translation of a VEP to one of a set of real server addresses. More...
 
typedef walk_rc_t(* cnat_translation_walk_cb_t) (index_t index, void *ctx)
 Callback function invoked during a walk of all translations. More...
 

Enumerations

enum  cnat_translation_flag_t_ { CNAT_TRANSLATION_FLAG_ALLOCATE_PORT = (1 << 0) }
 

Functions

u8format_cnat_translation (u8 *s, va_list *args)
 
u32 cnat_translation_update (const cnat_endpoint_t *vip, ip_protocol_t ip_proto, const cnat_endpoint_tuple_t *backends, u8 flags)
 create or update a translation More...
 
void cnat_add_translation_to_db (index_t cci, u16 port, ip_protocol_t proto, index_t cti)
 Add a translation to the bihash. More...
 
void cnat_remove_translation_from_db (index_t cci, u16 port, ip_protocol_t proto)
 Remove a translation from the bihash. More...
 
int cnat_translation_delete (u32 id)
 Delete a translation. More...
 
void cnat_translation_walk (cnat_translation_walk_cb_t cb, void *ctx)
 Walk/visit each of the translations. More...
 
int cnat_translation_purge (void)
 Purge all the trahslations. More...
 
static_always_inline cnat_translation_tcnat_translation_get (index_t cti)
 
static_always_inline cnat_translation_tcnat_find_translation (index_t cti, u16 port, ip_protocol_t proto)
 

Variables

vlib_combined_counter_main_t cnat_translation_counters
 Counters for each translation. More...
 
cnat_translation_tcnat_translation_pool
 
clib_bihash_8_8_t cnat_translation_db
 

Typedef Documentation

◆ cnat_ep_trk_t

typedef struct cnat_ep_trk_t_ cnat_ep_trk_t

Data used to track an EP in the FIB.

◆ cnat_translation_flag_t

◆ cnat_translation_t

A Translation represents the translation of a VEP to one of a set of real server addresses.

◆ cnat_translation_walk_cb_t

typedef walk_rc_t(* cnat_translation_walk_cb_t) (index_t index, void *ctx)

Callback function invoked during a walk of all translations.

Definition at line 155 of file cnat_translation.h.

Enumeration Type Documentation

◆ cnat_translation_flag_t_

Enumerator
CNAT_TRANSLATION_FLAG_ALLOCATE_PORT 

Definition at line 54 of file cnat_translation.h.

Function Documentation

◆ cnat_add_translation_to_db()

void cnat_add_translation_to_db ( index_t  cci,
u16  port,
ip_protocol_t  proto,
index_t  cti 
)

Add a translation to the bihash.

Parameters
ccithe ID of the parent client
portthe translation port
protothe translation proto
ctithe translation index to be used as value

Definition at line 66 of file cnat_translation.c.

+ Here is the caller graph for this function:

◆ cnat_find_translation()

static_always_inline cnat_translation_t* cnat_find_translation ( index_t  cti,
u16  port,
ip_protocol_t  proto 
)

Definition at line 179 of file cnat_translation.h.

+ Here is the caller graph for this function:

◆ cnat_remove_translation_from_db()

void cnat_remove_translation_from_db ( index_t  cci,
u16  port,
ip_protocol_t  proto 
)

Remove a translation from the bihash.

Parameters
ccithe ID of the parent client
portthe translation port
protothe translation proto

Definition at line 82 of file cnat_translation.c.

+ Here is the caller graph for this function:

◆ cnat_translation_delete()

int cnat_translation_delete ( u32  id)

Delete a translation.

Parameters
idthe ID as returned from the create

Definition at line 117 of file cnat_translation.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cnat_translation_get()

static_always_inline cnat_translation_t* cnat_translation_get ( index_t  cti)

Definition at line 173 of file cnat_translation.h.

+ Here is the caller graph for this function:

◆ cnat_translation_purge()

int cnat_translation_purge ( void  )

Purge all the trahslations.

Definition at line 283 of file cnat_translation.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cnat_translation_update()

u32 cnat_translation_update ( const cnat_endpoint_t vip,
ip_protocol_t  ip_proto,
const cnat_endpoint_tuple_t backends,
u8  flags 
)

create or update a translation

Parameters
vipThe Virtual Endpoint
ip_protoThe ip protocol to translate
backendsthe backends to choose from
Returns
the ID of the translation. used to delete and gather stats

Definition at line 140 of file cnat_translation.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cnat_translation_walk()

void cnat_translation_walk ( cnat_translation_walk_cb_t  cb,
void *  ctx 
)

Walk/visit each of the translations.

Definition at line 194 of file cnat_translation.c.

+ Here is the caller graph for this function:

◆ format_cnat_translation()

u8* format_cnat_translation ( u8 s,
va_list *  args 
)

Definition at line 223 of file cnat_translation.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ cnat_translation_counters

vlib_combined_counter_main_t cnat_translation_counters

Counters for each translation.

Definition at line 31 of file cnat_translation.c.

◆ cnat_translation_db

clib_bihash_8_8_t cnat_translation_db

Definition at line 27 of file cnat_translation.c.

◆ cnat_translation_pool

cnat_translation_t* cnat_translation_pool

Definition at line 26 of file cnat_translation.c.