36 #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) 43 #define foreach_punt_api_msg \ 44 _(SET_PUNT, set_punt) \ 45 _(PUNT_SOCKET_REGISTER, punt_socket_register) \ 46 _(PUNT_SOCKET_DEREGISTER, punt_socket_deregister) \ 47 _(PUNT_SOCKET_DUMP, punt_socket_dump) \ 48 _(PUNT_REASON_DUMP, punt_reason_dump) 53 in = clib_net_to_host_u32 (in);
58 case PUNT_API_TYPE_##v: \ 59 *out = PUNT_TYPE_##v; \ 68 static vl_api_punt_type_t
77 pt = PUNT_API_TYPE_##v; \ 83 return (clib_host_to_net_u32 (pt));
93 out->
port = clib_net_to_host_u16 (in->port);
116 out->
reason = clib_net_to_host_u32 (in->id);
136 case PUNT_TYPE_EXCEPTION:
139 case PUNT_TYPE_IP_PROTO:
152 out->port = clib_net_to_host_u16 (in->
port);
157 vl_api_punt_ip_proto_t * out)
165 vl_api_punt_exception_t * out)
167 out->id = clib_host_to_net_u32 (in->
reason);
180 case PUNT_TYPE_IP_PROTO:
183 case PUNT_TYPE_EXCEPTION:
185 &out->punt.exception);
193 vl_api_set_punt_reply_t *rmp;
264 mp->_vl_msg_id = ntohs (VL_API_PUNT_SOCKET_DETAILS);
298 vl_api_punt_socket_deregister_reply_t *rmp;
346 mp->_vl_msg_id = ntohs (VL_API_PUNT_REASON_DETAILS);
349 mp->
reason.id = clib_host_to_net_u32 (
id);
377 #define vl_msg_name_crc_list 378 #include <vnet/ip/punt.api.h> 379 #undef vl_msg_name_crc_list 384 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 385 foreach_vl_msg_name_crc_punt;
395 vl_msg_api_set_handlers(VL_API_##N, #n, \ 396 vl_api_##n##_t_handler, \ 398 vl_api_##n##_t_endian, \ 399 vl_api_##n##_t_print, \ 400 sizeof(vl_api_##n##_t), 1);
int vl_api_to_api_string(u32 len, const char *buf, vl_api_string_t *str)
enum punt_type_t_ punt_type_t
A registration, by a client, to direct punted traffic to a given node.
static int punt_reason_dump_walk_cb(vlib_punt_reason_t id, const u8 *name, void *args)
int vlib_punt_reason_validate(vlib_punt_reason_t reason)
Validate that a punt reason is assigned.
struct punt_socket_send_ctx_t_ punt_socket_send_ctx_t
#define REPLY_MACRO2(t, body)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static void vl_api_send_msg(vl_api_registration_t *rp, u8 *elem)
clib_error_t * vnet_punt_socket_del(vlib_main_t *vm, const punt_reg_t *pr)
static void vl_api_punt_ip_proto_encode(const punt_ip_proto_t *in, vl_api_punt_ip_proto_t *out)
static void vl_api_punt_socket_register_t_handler(vl_api_punt_socket_register_t *mp)
void * vl_msg_api_alloc(int nbytes)
static int vl_api_punt_exception_decode(const vl_api_punt_exception_t *in, punt_exception_t *out)
clib_error_t * vnet_punt_socket_add(vlib_main_t *vm, u32 header_version, const punt_reg_t *pr, char *client_pathname)
int ip_proto_decode(int _ipp, ip_protocol_t *out)
Dump all or one of the exception punt reasons.
enum walk_rc_t_ walk_rc_t
Walk return code.
u8 * vl_api_from_api_to_vec(vl_api_string_t *astr)
static void vl_api_set_punt_t_handler(vl_api_set_punt_t *mp)
static void setup_message_id_table(api_main_t *am)
static walk_rc_t vl_api_punt_socket_send_details(const punt_client_t *pc, void *args)
static void vl_api_punt_l4_encode(const punt_l4_t *in, vl_api_punt_l4_t *out)
vl_api_registration_t * reg
static void vl_api_punt_encode(const punt_reg_t *in, vl_api_punt_t *out)
vl_api_registration_t * reg
int ip_address_family_encode(ip_address_family_t af)
static void vl_api_punt_socket_dump_t_handler(vl_api_punt_socket_dump_t *mp)
static void vl_api_punt_socket_deregister_t_handler(vl_api_punt_socket_deregister_t *mp)
static vl_api_punt_type_t vl_api_punt_type_encode(punt_type_t in)
struct punt_reason_dump_walk_ctx_t_ punt_reason_dump_walk_ctx_t
static void vl_api_punt_reason_dump_t_handler(vl_api_punt_reason_dump_t *mp)
static void vl_api_punt_exception_encode(const punt_exception_t *in, vl_api_punt_exception_t *out)
API main structure, used by both vpp and binary API clients.
punt_exception_t exception
An API client registration, only in vpp/vlib.
#define vec_free(V)
Free vector's memory (no header).
void punt_reason_walk(punt_reason_walk_cb_t cb, void *ctx)
static vl_api_registration_t * vl_api_client_index_to_registration(u32 index)
vl_api_punt_reason_t reason
static int vl_api_punt_type_decode(vl_api_punt_type_t in, punt_type_t *out)
int ip_proto_encode(ip_protocol_t ipp)
VLIB_API_INIT_FUNCTION(punt_api_hookup)
static clib_error_t * punt_api_hookup(vlib_main_t *vm)
#define clib_error_report(e)
#define vec_cmp(v1, v2)
Compare two vectors (only applicable to vectors of signed numbers).
Punt traffic to the host.
Punt traffic to the host via socket.
#define foreach_punt_api_msg
static int vl_api_punt_ip_proto_decode(const vl_api_punt_ip_proto_t *in, punt_ip_proto_t *out)
static vlib_main_t * vlib_get_main(void)
static int vl_api_punt_decode(const vl_api_punt_t *in, punt_reg_t *out)
vl_api_punt_reason_t reason
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static int vl_api_punt_l4_decode(const vl_api_punt_l4_t *in, punt_l4_t *out)
static api_main_t * vlibapi_get_main(void)
int ip_address_family_decode(int _af, ip_address_family_t *out)
Conversion functions to/from (decode/encode) API types to VPP internal types.
clib_error_t * vnet_punt_add_del(vlib_main_t *vm, const punt_reg_t *pr, bool is_add)
vlib_punt_reason_t reason
enum vlib_punt_reason_t_ vlib_punt_reason_t
The 'syatem' defined punt reasons.
char * vnet_punt_get_server_pathname(void)
void punt_client_walk(punt_type_t pt, punt_client_walk_cb_t cb, void *ctx)
Definitions for punt infrastructure.