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));
97 out->
port = clib_net_to_host_u16 (in->port);
122 out->
reason = clib_net_to_host_u32 (in->id);
142 case PUNT_TYPE_EXCEPTION:
145 case PUNT_TYPE_IP_PROTO:
158 out->port = clib_net_to_host_u16 (in->
port);
163 vl_api_punt_ip_proto_t * out)
171 vl_api_punt_exception_t * out)
173 out->id = clib_host_to_net_u32 (in->
reason);
186 case PUNT_TYPE_IP_PROTO:
189 case PUNT_TYPE_EXCEPTION:
191 &out->punt.exception);
199 vl_api_set_punt_reply_t *rmp;
270 mp->_vl_msg_id = ntohs (VL_API_PUNT_SOCKET_DETAILS);
304 vl_api_punt_socket_deregister_reply_t *rmp;
352 mp->_vl_msg_id = ntohs (VL_API_PUNT_REASON_DETAILS);
355 mp->
reason.id = clib_host_to_net_u32 (
id);
383 #define vl_msg_name_crc_list 384 #include <vnet/ip/punt.api.h> 385 #undef vl_msg_name_crc_list 390 #define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); 391 foreach_vl_msg_name_crc_punt;
401 vl_msg_api_set_handlers(VL_API_##N, #n, \ 402 vl_api_##n##_t_handler, \ 404 vl_api_##n##_t_endian, \ 405 vl_api_##n##_t_print, \ 406 sizeof(vl_api_##n##_t), 1);
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.
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)
Dump all or one of the exception punt reasons.
enum walk_rc_t_ walk_rc_t
Walk return code.
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
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.
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)
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)
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)
clib_error_t * vnet_punt_add_del(vlib_main_t *vm, const punt_reg_t *pr, bool is_add)
int ip_proto_decode(vl_api_ip_proto_t ipp, ip_protocol_t *out)
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)
u8 * vl_api_from_api_to_new_vec(void *mp, vl_api_string_t *astr)
int vl_api_vec_to_api_string(const u8 *vec, vl_api_string_t *str)
void punt_client_walk(punt_type_t pt, punt_client_walk_cb_t cb, void *ctx)
Definitions for punt infrastructure.