FD.io VPP  v21.01.1
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  addr_resolution_t_
 Entry used to account for a translation's backend waiting for address resolution. 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 addr_resolution_t_ addr_resolution_t
 Entry used to account for a translation's backend waiting for address resolution. More...
 
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), CNAT_TRANSLATION_STACKED = (1 << 1) }
 
enum  cnat_addr_resol_type_t {
  CNAT_RESOLV_ADDR_ANY, CNAT_RESOLV_ADDR_BACKEND, CNAT_RESOLV_ADDR_SNAT, CNAT_RESOLV_ADDR_TRANSLATION,
  CNAT_ADDR_N_RESOLUTIONS
}
 

Functions

u8format_cnat_translation (u8 *s, va_list *args)
 
u32 cnat_translation_update (cnat_endpoint_t *vip, ip_protocol_t ip_proto, cnat_endpoint_tuple_t *backends, u8 flags)
 create or update a translation 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...
 
void cnat_translation_watch_addr (index_t cti, u64 opaque, cnat_endpoint_t *ep, cnat_addr_resol_type_t type)
 Add an address resolution request. More...
 
void cnat_translation_unwatch_addr (u32 cti, cnat_addr_resol_type_t type)
 Cleanup matching addr resolution requests. 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

◆ addr_resolution_t

Entry used to account for a translation's backend waiting for address resolution.

◆ 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 182 of file cnat_translation.h.

Enumeration Type Documentation

◆ cnat_addr_resol_type_t

Enumerator
CNAT_RESOLV_ADDR_ANY 
CNAT_RESOLV_ADDR_BACKEND 
CNAT_RESOLV_ADDR_SNAT 
CNAT_RESOLV_ADDR_TRANSLATION 
CNAT_ADDR_N_RESOLUTIONS 

Definition at line 69 of file cnat_translation.h.

◆ cnat_translation_flag_t_

Enumerator
CNAT_TRANSLATION_FLAG_ALLOCATE_PORT 
CNAT_TRANSLATION_STACKED 

Definition at line 59 of file cnat_translation.h.

Function Documentation

◆ cnat_find_translation()

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

Definition at line 219 of file cnat_translation.h.

+ 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 205 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 213 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 400 of file cnat_translation.c.

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

◆ cnat_translation_unwatch_addr()

void cnat_translation_unwatch_addr ( u32  cti,
cnat_addr_resol_type_t  type 
)

Cleanup matching addr resolution requests.

Definition at line 66 of file cnat_translation.c.

+ Here is the caller graph for this function:

◆ cnat_translation_update()

u32 cnat_translation_update ( cnat_endpoint_t vip,
ip_protocol_t  ip_proto,
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 228 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 311 of file cnat_translation.c.

+ Here is the caller graph for this function:

◆ cnat_translation_watch_addr()

void cnat_translation_watch_addr ( index_t  cti,
u64  opaque,
cnat_endpoint_t ep,
cnat_addr_resol_type_t  type 
)

Add an address resolution request.

Definition at line 42 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 340 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 36 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.