FD.io VPP
v20.09-64-g4f7b92f0a
Vector Packet Processing
|
Go to the source code of this file.
Data Structures | |
struct | cnat_session_t_ |
A session represents the memory of a translation. More... | |
Typedefs | |
typedef struct cnat_session_t_ | cnat_session_t |
A session represents the memory of a translation. More... | |
typedef enum cnat_session_flag_t_ | cnat_session_flag_t |
typedef walk_rc_t(* | cnat_session_walk_cb_t) (const cnat_session_t *session, void *ctx) |
Callback function invoked during a walk of all translations. More... | |
Enumerations | |
enum | cnat_session_flag_t_ { CNAT_SESSION_FLAG_HAS_SNAT = (1 << 0), CNAT_SESSION_FLAG_ALLOC_PORT = (1 << 1), CNAT_SESSION_FLAG_NO_CLIENT = (1 << 2) } |
Functions | |
u8 * | format_cnat_session (u8 *s, va_list *args) |
STATIC_ASSERT (STRUCT_OFFSET_OF(cnat_session_t, key)==STRUCT_OFFSET_OF(clib_bihash_kv_40_48_t, key), "key overlaps") | |
Ensure the session object correctly overlays the bihash key/value pair. More... | |
STATIC_ASSERT (STRUCT_OFFSET_OF(cnat_session_t, value)==STRUCT_OFFSET_OF(clib_bihash_kv_40_48_t, value), "value overlaps") | |
STATIC_ASSERT (sizeof(cnat_session_t)==sizeof(clib_bihash_kv_40_48_t), "session kvp") | |
void | cnat_session_walk (cnat_session_walk_cb_t cb, void *ctx) |
Walk/visit each of the cnat session. More... | |
u64 | cnat_session_scan (vlib_main_t *vm, f64 start_time, int i) |
Scan the session DB for expired sessions. More... | |
int | cnat_session_purge (void) |
Purge all the sessions. More... | |
Variables | |
clib_bihash_40_48_t | cnat_session_db |
The DB of sessions. More... | |
typedef enum cnat_session_flag_t_ cnat_session_flag_t |
typedef struct cnat_session_t_ cnat_session_t |
A session represents the memory of a translation.
In the tx direction (from behind to in front of the NAT), the session is preserved so subsequent packets follow the same path even if the translation has been updated. In the tx direction the session represents the swap from the VIP to the server address In the RX direction the swap is from the server address/port to VIP.
A session exists only as key and value in the bihash, there is no pool for this object. If there were a pool, one would need to be concerned about what worker is using it.
typedef walk_rc_t(* cnat_session_walk_cb_t) (const cnat_session_t *session, void *ctx) |
Callback function invoked during a walk of all translations.
Definition at line 131 of file cnat_session.h.
enum cnat_session_flag_t_ |
Enumerator | |
---|---|
CNAT_SESSION_FLAG_HAS_SNAT | |
CNAT_SESSION_FLAG_ALLOC_PORT | |
CNAT_SESSION_FLAG_NO_CLIENT |
Definition at line 102 of file cnat_session.h.
int cnat_session_purge | ( | void | ) |
Purge all the sessions.
Definition at line 140 of file cnat_session.c.
u64 cnat_session_scan | ( | vlib_main_t * | vm, |
f64 | start_time, | ||
int | i | ||
) |
Scan the session DB for expired sessions.
Definition at line 157 of file cnat_session.c.
void cnat_session_walk | ( | cnat_session_walk_cb_t | cb, |
void * | ctx | ||
) |
Walk/visit each of the cnat session.
Definition at line 44 of file cnat_session.c.
Definition at line 70 of file cnat_session.c.
STATIC_ASSERT | ( | STRUCT_OFFSET_OF(cnat_session_t, key) | = =STRUCT_OFFSET_OF(clib_bihash_kv_40_48_t, key) , |
"key overlaps" | |||
) |
Ensure the session object correctly overlays the bihash key/value pair.
STATIC_ASSERT | ( | STRUCT_OFFSET_OF(cnat_session_t, value) | = =STRUCT_OFFSET_OF(clib_bihash_kv_40_48_t, value) , |
"value overlaps" | |||
) |
STATIC_ASSERT | ( | sizeof(cnat_session_t) | = =sizeof(clib_bihash_kv_40_48_t) , |
"session kvp" | |||
) |
clib_bihash_40_48_t cnat_session_db |
The DB of sessions.
Definition at line 23 of file cnat_session.c.