27 #include <vpp/app/version.h> 34 #include <cnat/cnat.api_enum.h> 35 #include <cnat/cnat.api_types.h> 42 #define REPLY_MSG_ID_BASE cnat_base_msg_id 51 out->
ce_port = clib_net_to_host_u16 (in->port);
75 vl_api_cnat_endpoint_t * out)
77 out->port = clib_net_to_host_u16 (in->
ce_port);
104 n_paths = clib_net_to_host_u32 (mp->
translation.n_paths);
107 for (pi = 0; pi <
n_paths; pi++)
130 rmp->
id = htonl (
id);
138 vl_api_cnat_translation_del_reply_t *rmp;
158 vl_api_cnat_endpoint_tuple_t *
path;
166 msg_size =
sizeof (*mp) +
sizeof (mp->
translation.paths[0]) * n_paths;
169 mp->_vl_msg_id =
ntohs (VL_API_CNAT_TRANSLATION_DETAILS + cnat_base_msg_id);
173 mp->
translation.n_paths = clib_host_to_net_u32 (n_paths);
226 mp->_vl_msg_id =
ntohs (VL_API_CNAT_SESSION_DETAILS + cnat_base_msg_id);
275 vl_api_cnat_session_purge_reply_t *rmp;
306 vl_api_cnat_set_snat_addresses_reply_t *rmp;
317 REPLY_MACRO (VL_API_CNAT_SET_SNAT_ADDRESSES_REPLY);
324 vl_api_cnat_add_del_snat_prefix_reply_t *rmp;
334 REPLY_MACRO (VL_API_CNAT_ADD_DEL_SNAT_PREFIX_REPLY);
337 #include <cnat/cnat.api.c> 352 .version = VPP_BUILD_VER,
353 .description =
"CNat Translate",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
int ip_address_family_decode(vl_api_address_family_t af, ip_address_family_t *out)
Conversion functions to/from (decode/encode) API types to VPP internal types.
static u32 cnat_base_msg_id
Base message ID fot the plugin.
static void ip_address2_from_46(const ip46_address_t *nh, ip_address_family_t af, ip_address_t *ip)
void ip_address_encode2(const ip_address_t *in, vl_api_address_t *out)
vl_api_wireguard_peer_flags_t flags
static_always_inline cnat_translation_t * cnat_translation_get(index_t cti)
vl_api_ip6_address_t snat_ip6
#define REPLY_MACRO2(t, body)
struct cnat_session_t_::@632 key
this key sits in the same memory location a 'key' in the bihash kvp
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
u16 cs_port[VLIB_N_DIR]
ports in rx/tx
void ip6_address_decode(const vl_api_ip6_address_t in, ip6_address_t *out)
ip_protocol_t ct_proto
The ip protocol for the translation.
static int cnat_endpoint_tuple_decode(const vl_api_cnat_endpoint_tuple_t *in, cnat_endpoint_tuple_t *out)
vl_api_registration_t * rp
A Translation represents the translation of a VEP to one of a set of real server addresses.
vl_api_ip6_address_t snat_ip6
int cnat_add_snat_prefix(ip_prefix_t *pfx)
struct cnat_dump_walk_ctx_t_ cnat_dump_walk_ctx_t
#define ip_addr_version(_a)
void * vl_msg_api_alloc_zero(int nbytes)
void cnat_set_snat(ip4_address_t *ip4, ip6_address_t *ip6, u32 sw_if_index)
vl_api_cnat_translation_t translation
static void cnat_endpoint_encode(const cnat_endpoint_t *in, vl_api_cnat_endpoint_t *out)
A session represents the memory of a translation.
enum walk_rc_t_ walk_rc_t
Walk return code.
int cnat_del_snat_prefix(ip_prefix_t *pfx)
static void vl_api_cnat_get_snat_addresses_t_handler(vl_api_cnat_get_snat_addresses_t *mp)
u8 cs_af
The address family describing the IP addresses.
int cnat_session_purge(void)
Purge all the sessions.
vl_api_ip4_address_t snat_ip4
cnat_endpoint_t ct_vip
The Virtual end point.
#define VLIB_INIT_FUNCTION(x)
vl_api_interface_index_t sw_if_index
static void vl_api_cnat_add_del_snat_prefix_t_handler(vl_api_cnat_add_del_snat_prefix_t *mp)
ip46_address_t cs_ip[VLIB_N_DIR]
IP 4/6 address in the rx/tx direction.
static walk_rc_t cnat_session_send_details(const cnat_session_t *session, void *args)
int cnat_translation_purge(void)
Purge all the trahslations.
vl_api_cnat_session_t session
static void vl_api_cnat_session_purge_t_handler(vl_api_cnat_session_purge_t *mp)
enum ip_protocol ip_protocol_t
int cnat_translation_delete(u32 id)
Delete a translation.
void cnat_client_throttle_pool_process()
static walk_rc_t cnat_translation_send_details(u32 cti, void *args)
cnat_ep_trk_t * ct_paths
The vector of tracked back-ends.
void ip_address_decode2(const vl_api_address_t *in, ip_address_t *out)
An API client registration, only in vpp/vlib.
static void setup_message_id_table(api_main_t *am)
int ip_prefix_decode2(const vl_api_prefix_t *in, ip_prefix_t *out)
vl_api_ip_proto_t ip_proto_encode(ip_protocol_t ipp)
#define vec_free(V)
Free vector's memory (no header).
vl_api_address_family_t ip_address_family_encode(ip_address_family_t af)
cnat_endpoint_t ct_ep[VLIB_N_DIR]
The EP being tracked.
static void vl_api_cnat_session_dump_t_handler(vl_api_cnat_session_dump_t *mp)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static void vl_api_cnat_translation_del_t_handler(vl_api_cnat_translation_del_t *mp)
vl_api_ip4_address_t snat_ip4
ip_address_family_t version
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
static void vl_api_cnat_translation_dump_t_handler(vl_api_cnat_translation_dump_t *mp)
enum ip_address_family_t_ ip_address_family_t
u32 cnat_translation_update(cnat_endpoint_t *vip, ip_protocol_t proto, cnat_endpoint_tuple_t *paths, u8 flags)
create or update a translation
void cnat_translation_walk(cnat_translation_walk_cb_t cb, void *ctx)
Walk/visit each of the translations.
ip_protocol_t cs_proto
The IP protocol TCP or UDP only supported.
static void vl_api_cnat_set_snat_addresses_t_handler(vl_api_cnat_set_snat_addresses_t *mp)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
void ip4_address_decode(const vl_api_ip4_address_t in, ip4_address_t *out)
static int cnat_endpoint_decode(const vl_api_cnat_endpoint_t *in, cnat_endpoint_t *out)
vl_api_cnat_translation_t translation
void ip4_address_encode(const ip4_address_t *in, vl_api_ip4_address_t out)
#define vec_foreach(var, vec)
Vector iterator.
static void vl_api_cnat_translation_update_t_handler(vl_api_cnat_translation_update_t *mp)
Data used to track an EP in the FIB.
int ip_proto_decode(vl_api_ip_proto_t ipp, ip_protocol_t *out)
vl_api_interface_index_t sw_if_index
vl_api_interface_index_t sw_if_index
struct cnat_session_t_::@633 value
this value sits in the same memory location a 'value' in the bihash kvp
static clib_error_t * cnat_api_init(vlib_main_t *vm)
void cnat_session_walk(cnat_session_walk_cb_t cb, void *ctx)
Walk/visit each of the cnat session.