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);
64 vl_api_cnat_endpoint_t * out)
67 out->port = clib_net_to_host_u16 (in->
ce_port);
108 rmp->
id = htonl (
id);
116 vl_api_cnat_translation_del_reply_t *rmp;
136 vl_api_cnat_endpoint_tuple_t *
path;
144 msg_size =
sizeof (*mp) +
sizeof (mp->
translation.paths[0]) * n_paths;
147 mp->_vl_msg_id =
ntohs (VL_API_CNAT_TRANSLATION_DETAILS + cnat_base_msg_id);
204 mp->_vl_msg_id =
ntohs (VL_API_CNAT_SESSION_DETAILS + cnat_base_msg_id);
251 vl_api_cnat_session_purge_reply_t *rmp;
265 vl_api_cnat_set_snat_addresses_reply_t *rmp;
271 REPLY_MACRO (VL_API_CNAT_SET_SNAT_ADDRESSES_REPLY);
278 vl_api_cnat_add_del_snat_prefix_reply_t *rmp;
288 REPLY_MACRO (VL_API_CNAT_ADD_DEL_SNAT_PREFIX_REPLY);
291 #include <cnat/cnat.api.c> 306 .version = VPP_BUILD_VER,
307 .description =
"CNat Translate",
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
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
static void cnat_endpoint_decode(const vl_api_cnat_endpoint_t *in, cnat_endpoint_t *out)
#define REPLY_MACRO2(t, body)
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.
vl_api_registration_t * rp
A Translation represents the translation of a VEP to one of a set of real server addresses.
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)
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)
u8 cs_af
The address family describing the IP addresses.
int cnat_session_purge(void)
Purge all the sessions.
cnat_endpoint_t ct_vip
The Virtual end point.
#define VLIB_INIT_FUNCTION(x)
u32 cnat_translation_update(const cnat_endpoint_t *vip, ip_protocol_t proto, const cnat_endpoint_tuple_t *paths, u8 flags)
create or update a translation
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
static void cnat_endpoint_tuple_decode(const vl_api_cnat_endpoint_tuple_t *in, cnat_endpoint_tuple_t *out)
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.
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).
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)
vl_api_fib_path_t paths[n_paths]
struct cnat_session_t_::@637 value
this value sits in the same memory location a 'value' in the bihash kvp
static void vl_api_cnat_translation_del_t_handler(vl_api_cnat_translation_del_t *mp)
vl_api_ip4_address_t snat_ip4
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
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)
void ip4_address_decode(const vl_api_ip4_address_t in, ip4_address_t *out)
struct cnat_session_t_::@636 key
this key sits in the same memory location a 'key' in the bihash kvp
vl_api_cnat_translation_t translation
#define vec_foreach(var, vec)
Vector iterator.
static void setup_message_id_table(snat_main_t *sm, api_main_t *am)
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)
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.