X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Flacp%2Flacp_api.c;fp=src%2Fplugins%2Flacp%2Flacp_api.c;h=1a97baf3aba5a90faf3a51f981f2370ec04aad77;hb=4540b2f8cd09b7a36a45c752d751d8da1b1ee6b0;hp=f28f06cb2ca03f33ad1146c13169c4653de960fa;hpb=941185ae65203ace089a22d8979a2a1eb7fd3262;p=vpp.git diff --git a/src/plugins/lacp/lacp_api.c b/src/plugins/lacp/lacp_api.c index f28f06cb2ca..1a97baf3aba 100644 --- a/src/plugins/lacp/lacp_api.c +++ b/src/plugins/lacp/lacp_api.c @@ -27,26 +27,11 @@ /* define message IDs */ -#include +#include +#include -/* define message structures */ -#define vl_typedefs -#include -#undef vl_typedefs - -/* define generated endian-swappers */ -#define vl_endianfun -#include -#undef vl_endianfun - -/* instantiate all the print functions we know about */ #define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) -/* Get the API version number */ -#define vl_api_version(n,v) static u32 api_version=(v); -#include -#undef vl_api_version - /* Macro to finish up custom dump fns */ #define FINISH \ vec_add1 (s, 0); \ @@ -57,9 +42,6 @@ #define REPLY_MSG_ID_BASE lm->msg_id_base #include -#define foreach_lacp_plugin_api_msg \ -_(SW_INTERFACE_LACP_DUMP, sw_interface_lacp_dump) - static void lacp_send_sw_interface_details (vl_api_registration_t * reg, lacp_interface_details_t * lacp_if, @@ -130,78 +112,21 @@ vl_api_sw_interface_lacp_dump_t_handler (vl_api_sw_interface_lacp_dump_t * mp) vec_free (lacpifs); } -static void * -vl_api_sw_interface_lacp_dump_t_print (vl_api_sw_interface_lacp_dump_t * mp, - void *handle) -{ - u8 *s; - - s = format (0, "SCRIPT: sw_interface_lacp_dump "); - - FINISH; -} - -#define vl_msg_name_crc_list -#include -#undef vl_msg_name_crc_list - -static void -setup_message_id_table (lacp_main_t * lm, api_main_t * am) -{ -#define _(id,n,crc) \ - vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + lm->msg_id_base); - foreach_vl_msg_name_crc_lacp; -#undef _ -} - -static void -plugin_custom_dump_configure (lacp_main_t * lm) -{ -#define _(n,f) api_main.msg_print_handlers \ - [VL_API_##n + lm->msg_id_base] \ - = (void *) vl_api_##f##_t_print; - foreach_lacp_plugin_api_msg; -#undef _ -} - /* Set up the API message handling tables */ +#include clib_error_t * lacp_plugin_api_hookup (vlib_main_t * vm) { lacp_main_t *lm = &lacp_main; api_main_t *am = &api_main; - u8 *name; - - /* Construct the API name */ - name = format (0, "lacp_%08x%c", api_version, 0); /* Ask for a correctly-sized block of API message decode slots */ - lm->msg_id_base = vl_msg_api_get_msg_ids - ((char *) name, VL_MSG_FIRST_AVAILABLE); - -#define _(N,n) \ - vl_msg_api_set_handlers((VL_API_##N + lm->msg_id_base), \ - #n, \ - vl_api_##n##_t_handler, \ - vl_noop_handler, \ - vl_api_##n##_t_endian, \ - vl_api_##n##_t_print, \ - sizeof(vl_api_##n##_t), 1); - foreach_lacp_plugin_api_msg; -#undef _ + lm->msg_id_base = setup_message_id_table (); /* Mark these APIs as mp safe */ am->is_mp_safe[VL_API_SW_INTERFACE_LACP_DUMP] = 1; am->is_mp_safe[VL_API_SW_INTERFACE_LACP_DETAILS] = 1; - /* - * Set up the (msg_name, crc, message-id) table - */ - setup_message_id_table (lm, am); - - plugin_custom_dump_configure (lm); - - vec_free (name); return 0; }