|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
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);
76 vl_api_cnat_endpoint_t * out)
78 out->port = clib_net_to_host_u16 (in->
ce_port);
109 for (pi = 0; pi <
n_paths; pi++)
133 rmp->
id = htonl (
id);
140 vl_api_cnat_translation_del_reply_t *rmp;
160 vl_api_cnat_endpoint_tuple_t *
path;
280 vl_api_cnat_session_purge_reply_t *rmp;
299 VL_API_CNAT_GET_SNAT_ADDRESSES_REPLY, ({
310 vl_api_cnat_set_snat_addresses_reply_t *rmp;
321 REPLY_MACRO (VL_API_CNAT_SET_SNAT_ADDRESSES_REPLY);
327 vl_api_cnat_set_snat_policy_reply_t *rmp;
340 vl_api_cnat_snat_policy_add_del_exclude_pfx_reply_t *rmp;
350 REPLY_MACRO (VL_API_CNAT_SNAT_POLICY_ADD_DEL_EXCLUDE_PFX_REPLY);
357 vl_api_cnat_snat_policy_add_del_if_reply_t *rmp;
370 REPLY_MACRO (VL_API_CNAT_SNAT_POLICY_ADD_DEL_IF_REPLY);
373 #include <cnat/cnat.api.c>
387 .version = VPP_BUILD_VER,
388 .description =
"CNat Translate",
static u32 cnat_base_msg_id
Base message ID fot the plugin.
int cnat_snat_policy_add_pfx(ip_prefix_t *pfx)
vl_api_interface_index_t sw_if_index
#define VALIDATE_SW_IF_INDEX(mp)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
static void vl_api_cnat_snat_policy_add_del_exclude_pfx_t_handler(vl_api_cnat_snat_policy_add_del_exclude_pfx_t *mp)
int cnat_translation_delete(u32 id)
Delete a translation.
ip46_address_t cs_ip[VLIB_N_DIR]
IP 4/6 address in the rx/tx direction.
#define REPLY_MACRO2(t, body)
void ip4_address_decode(const vl_api_ip4_address_t in, ip4_address_t *out)
ip_protocol_t ct_proto
The ip protocol for the translation.
cnat_endpoint_t ct_ep[VLIB_N_DIR]
The EP being tracked.
void cnat_client_throttle_pool_process()
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
vl_api_ipsec_spd_action_t policy
vl_api_ip4_address_t snat_ip4
static void vl_api_cnat_snat_policy_add_del_if_t_handler(vl_api_cnat_snat_policy_add_del_if_t *mp)
static void vl_api_cnat_translation_del_t_handler(vl_api_cnat_translation_del_t *mp)
void ip6_address_decode(const vl_api_ip6_address_t in, ip6_address_t *out)
vl_api_cnat_snat_policy_table_t table
int cnat_translation_purge(void)
Purge all the trahslations.
static int cnat_endpoint_tuple_decode(const vl_api_cnat_endpoint_tuple_t *in, cnat_endpoint_tuple_t *out)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static void vl_api_cnat_translation_update_t_handler(vl_api_cnat_translation_update_t *mp)
vl_api_cnat_session_t session
static walk_rc_t cnat_translation_send_details(u32 cti, void *args)
vl_api_ip_proto_t ip_proto_encode(ip_protocol_t ipp)
int cnat_session_purge(void)
Purge all the sessions.
static void vl_api_cnat_session_purge_t_handler(vl_api_cnat_session_purge_t *mp)
A session represents the memory of a translation.
void * vl_msg_api_alloc_zero(int nbytes)
static walk_rc_t cnat_session_send_details(const cnat_session_t *session, void *args)
u8 cs_af
The address family describing the IP addresses.
enum cnat_snat_interface_map_type_t_ cnat_snat_interface_map_type_t
static clib_error_t * cnat_api_init(vlib_main_t *vm)
void ip_address_encode2(const ip_address_t *in, vl_api_address_t *out)
int cnat_snat_policy_add_del_if(u32 sw_if_index, u8 is_add, cnat_snat_interface_map_type_t table)
static void setup_message_id_table(api_main_t *am)
u32 cnat_translation_update(cnat_endpoint_t *vip, ip_protocol_t proto, cnat_endpoint_tuple_t *paths, u8 flags, cnat_lb_type_t lb_type)
create or update a translation
#define ip_addr_version(_a)
void cnat_set_snat(ip4_address_t *ip4, ip6_address_t *ip6, u32 sw_if_index)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
cnat_endpoint_t ct_vip
The Virtual end point.
cnat_ep_trk_t * ct_paths
The vector of tracked back-ends.
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 void ip_address2_from_46(const ip46_address_t *nh, ip_address_family_t af, ip_address_t *ip)
cnat_lb_type_t lb_type
Type of load balancing.
void ip6_address_encode(const ip6_address_t *in, vl_api_ip6_address_t out)
ip_address_family_t version
u8 ct_flags
Allows to disable if not resolved yet.
vl_api_cnat_lb_type_t lb_type
An API client registration, only in vpp/vlib.
vl_api_cnat_snat_policies_t policy
static void vl_api_cnat_set_snat_addresses_t_handler(vl_api_cnat_set_snat_addresses_t *mp)
struct cnat_dump_walk_ctx_t_ cnat_dump_walk_ctx_t
vl_api_interface_index_t sw_if_index
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
static int cnat_endpoint_decode(const vl_api_cnat_endpoint_t *in, cnat_endpoint_t *out)
int cnat_set_snat_policy(cnat_snat_policy_type_t policy)
vl_api_address_family_t ip_address_family_encode(ip_address_family_t af)
static void cnat_endpoint_encode(const cnat_endpoint_t *in, vl_api_cnat_endpoint_t *out)
ip_protocol_t cs_proto
The IP protocol TCP or UDP only supported.
void ip_address_decode2(const vl_api_address_t *in, ip_address_t *out)
static void vl_api_cnat_translation_dump_t_handler(vl_api_cnat_translation_dump_t *mp)
#define BAD_SW_IF_INDEX_LABEL
vl_api_cnat_translation_t translation
struct cnat_session_t_::@635 key
this key sits in the same memory location a 'key' in the bihash kvp
#define vec_free(V)
Free vector's memory (no header).
static void vl_api_cnat_set_snat_policy_t_handler(vl_api_cnat_set_snat_policy_t *mp)
int cnat_snat_policy_del_pfx(ip_prefix_t *pfx)
struct cnat_session_t_::@636 value
this value sits in the same memory location a 'value' in the bihash kvp
u8 cs_loc
input / output / fib session
int ip_prefix_decode2(const vl_api_prefix_t *in, ip_prefix_t *out)
#define VLIB_INIT_FUNCTION(x)
#define vec_foreach(var, vec)
Vector iterator.
vl_api_cnat_translation_t translation
void ip4_address_encode(const ip4_address_t *in, vl_api_ip4_address_t out)
vl_api_registration_t * rp
enum ip_protocol ip_protocol_t
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void cnat_translation_walk(cnat_translation_walk_cb_t cb, void *ctx)
Walk/visit each of the translations.
static void vl_api_cnat_get_snat_addresses_t_handler(vl_api_cnat_get_snat_addresses_t *mp)
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
int ip_proto_decode(vl_api_ip_proto_t ipp, ip_protocol_t *out)
enum cnat_snat_policy_type_t_ cnat_snat_policy_type_t
cnat_snat_policy_main_t cnat_snat_policy_main
vl_api_ip6_address_t snat_ip6
#define INDEX_INVALID
Invalid index - used when no index is known blazoned capitals INVALID speak volumes where ~0 does not...
vl_api_interface_index_t sw_if_index
void cnat_session_walk(cnat_session_walk_cb_t cb, void *ctx)
Walk/visit each of the cnat session.
enum walk_rc_t_ walk_rc_t
Walk return code.
vl_api_ip6_address_t snat_ip6
vl_api_interface_index_t sw_if_index
vl_api_ip4_address_t snat_ip4
static_always_inline cnat_translation_t * cnat_translation_get(index_t cti)
static void vl_api_cnat_session_dump_t_handler(vl_api_cnat_session_dump_t *mp)
A Translation represents the translation of a VEP to one of a set of real server addresses.
Data used to track an EP in the FIB.
enum ip_address_family_t_ ip_address_family_t
u16 cs_port[VLIB_N_DIR]
ports in rx/tx
vl_api_wireguard_peer_flags_t flags