X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fplugins%2Fnat%2Fnat64_db.h;h=f1b93cf8928780ee8358de6c338e00698bc9ec98;hb=74449b8b68801e0938f528f19d69e75644cb2ee9;hp=94d9a8bdebf4a89c1e1822dc8027ad9fbd83fb90;hpb=efcd1e9e1d7dda4e4ea3db5750925cd8f6894f4d;p=vpp.git diff --git a/src/plugins/nat/nat64_db.h b/src/plugins/nat/nat64_db.h index 94d9a8bdebf..f1b93cf8928 100644 --- a/src/plugins/nat/nat64_db.h +++ b/src/plugins/nat/nat64_db.h @@ -68,6 +68,9 @@ typedef struct /* BIB lookup */ clib_bihash_24_8_t in2out; clib_bihash_24_8_t out2in; + + u32 limit; + u32 bib_entries_num; } nat64_db_bib_t; typedef struct @@ -115,22 +118,44 @@ typedef struct /* session lookup */ clib_bihash_48_8_t in2out; clib_bihash_48_8_t out2in; + + u32 limit; + u32 st_entries_num; } nat64_db_st_t; -typedef struct +struct nat64_db_s; + +/** + * @brief Call back function to free NAT64 pool address and port when BIB + * entry is deleted. + */ +typedef void (*nat64_db_free_addr_port_function_t) (struct nat64_db_s * db, + ip4_address_t * addr, + u16 port, u8 proto); + +typedef struct nat64_db_s { nat64_db_bib_t bib; nat64_db_st_t st; + nat64_db_free_addr_port_function_t free_addr_port_cb; + u8 addr_free; } nat64_db_t; /** * @brief Initialize NAT64 DB. * * @param db NAT64 DB. + * @param bib_buckets Number of BIB hash buckets. + * @param bib_memory_size Memory size of BIB hash. + * @param st_buckets Number of session table hash buckets. + * @param st_memory_size Memory size of session table hash. + * @param free_addr_port_cb Call back function to free address and port. * * @returns 0 on success, non-zero value otherwise. */ -int nat64_db_init (nat64_db_t * db); +int nat64_db_init (nat64_db_t * db, u32 bib_buckets, u32 bib_memory_size, + u32 st_buckets, u32 st_memory_size, + nat64_db_free_addr_port_function_t free_addr_port_cb); /** * @brief Create new NAT64 BIB entry.