16 #ifndef __CNAT_TYPES_H__ 17 #define __CNAT_TYPES_H__ 25 #define CNAT_FIB_TABLE 0 28 #define CNAT_DEFAULT_SESSION_MAX_AGE 30 30 #define CNAT_DEFAULT_TCP_MAX_AGE 3600 32 #define CNAT_DEFAULT_TCP_RST_TIMEOUT 5 33 #define CNAT_DEFAULT_SCANNER_TIMEOUT (1.0) 35 #define CNAT_DEFAULT_SESSION_BUCKETS 1024 36 #define CNAT_DEFAULT_TRANSLATION_BUCKETS 1024 37 #define CNAT_DEFAULT_SNAT_BUCKETS 1024 39 #define CNAT_DEFAULT_SESSION_MEMORY (1 << 20) 40 #define CNAT_DEFAULT_TRANSLATION_MEMORY (256 << 10) 41 #define CNAT_DEFAULT_SNAT_MEMORY (64 << 20) 45 #define CNAT_FIB_SOURCE_PRIORITY 0x02 48 #define CNAT_TIMESTAMP_INIT_REFCNT 2 50 #define MIN_SRC_PORT ((u16) 0xC000) 68 u32 dst_address_length_refcounts[129];
80 ip6_address_t ip_masks[129];
164 #define cnat_error(n,s) CNAT_ERROR_##n, 254 *port = clib_net_to_host_u16 (*port);
260 *port = clib_bitmap_next_clear (cm->
src_ports, *port);
267 *port = clib_host_to_net_u16 (*port);
static void clib_rwlock_reader_lock(clib_rwlock_t *p)
#define CNAT_TIMESTAMP_INIT_REFCNT
enum fib_source_t_ fib_source_t
The different sources that can create a route.
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
static void cnat_timestamp_inc_refcnt(u32 index)
static void clib_rwlock_writer_lock(clib_rwlock_t *p)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
static uword clib_bitmap_get_no_check(uword *ai, uword i)
Gets the ith bit value from a bitmap Does not sanity-check the bit position.
cnat_timestamp_t * cnat_timestamps
static u32 cnat_timestamp_new(f64 t)
static uword clib_bitmap_set_no_check(uword *a, uword i, uword new_value)
Sets the ith bit of a bitmap to new_value.
clib_bihash_24_8_t ip_hash
struct cnat_node_ctx_t_ cnat_node_ctx_t
static void cnat_free_port(u16 port)
static f64 cnat_timestamp_exp(u32 index)
struct cnat_main_ cnat_main_t
uword unformat_cnat_ep_tuple(unformat_input_t *input, va_list *args)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
uword unformat_cnat_ep(unformat_input_t *input, va_list *args)
static void clib_rwlock_reader_unlock(clib_rwlock_t *p)
static int cnat_allocate_port(cnat_main_t *cm, u16 *port)
#define pool_put(P, E)
Free an object E in pool P.
clib_spinlock_t src_ports_lock
static void cnat_timestamp_free(u32 index)
A throttle Used in the data plane to decide if a given hash should be throttled, i.e.
char * cnat_error_strings[]
static void clib_rwlock_writer_unlock(clib_rwlock_t *p)
clib_bitmap_t * src_ports
static void cnat_timestamp_update(u32 index, f64 t)
uword session_hash_memory
cnat_snat_pfx_table_t snat_pfx_table
enum ip_address_family_t_ ip_address_family_t
u32 translation_hash_buckets
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
fib_source_t cnat_fib_source
uword translation_hash_memory
u8 * format_cnat_endpoint(u8 *s, va_list *args)
struct cnat_timestamp_t_ cnat_timestamp_t
static void cnat_timestamp_set_lifetime(u32 index, u16 lifetime)
struct cnat_endpoint_tuple_t_ cnat_endpoint_tuple_t
struct cnat_endpoint_t_ cnat_endpoint_t