X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fplugins%2Flisp%2Flisp-gpe%2Flisp_gpe_api.c;fp=src%2Fvnet%2Flisp-gpe%2Flisp_gpe_api.c;h=df90ef544037d2abb5781b195985a37dd23374cd;hb=2b202bc4b;hp=e20347a46f68cc83f1aafe95443593a2a9ab458b;hpb=b468773aa4164bf52e0751fdf780f67248037cc0;p=vpp.git diff --git a/src/vnet/lisp-gpe/lisp_gpe_api.c b/src/plugins/lisp/lisp-gpe/lisp_gpe_api.c similarity index 83% rename from src/vnet/lisp-gpe/lisp_gpe_api.c rename to src/plugins/lisp/lisp-gpe/lisp_gpe_api.c index e20347a46f6..df90ef54403 100644 --- a/src/vnet/lisp-gpe/lisp_gpe_api.c +++ b/src/plugins/lisp/lisp-gpe/lisp_gpe_api.c @@ -22,50 +22,29 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include #include #include -#include +#include -#define vl_api_gpe_locator_pair_t_endian vl_noop_handler -#define vl_api_gpe_locator_pair_t_print vl_noop_handler -#define vl_api_gpe_add_del_fwd_entry_t_endian vl_noop_handler -#define vl_api_gpe_add_del_fwd_entry_t_print vl_noop_handler +/* define message IDs */ +#include +#include +#include -#define vl_typedefs /* define message structures */ -#include -#undef vl_typedefs - -#define vl_endianfun /* define message structures */ -#include -#undef vl_endianfun - -/* instantiate all the print functions we know about */ -#define vl_print(handle, ...) vlib_cli_output (handle, __VA_ARGS__) -#define vl_printfun -#include -#undef vl_printfun +/** + * Base message ID fot the plugin + */ +static u32 gpe_base_msg_id; +#define REPLY_MSG_ID_BASE gpe_base_msg_id #include -#define foreach_vpe_api_msg \ -_(GPE_ADD_DEL_FWD_ENTRY, gpe_add_del_fwd_entry) \ -_(GPE_FWD_ENTRIES_GET, gpe_fwd_entries_get) \ -_(GPE_FWD_ENTRY_PATH_DUMP, gpe_fwd_entry_path_dump) \ -_(GPE_ENABLE_DISABLE, gpe_enable_disable) \ -_(GPE_ADD_DEL_IFACE, gpe_add_del_iface) \ -_(GPE_FWD_ENTRY_VNIS_GET, gpe_fwd_entry_vnis_get) \ -_(GPE_SET_ENCAP_MODE, gpe_set_encap_mode) \ -_(GPE_GET_ENCAP_MODE, gpe_get_encap_mode) \ -_(GPE_ADD_DEL_NATIVE_FWD_RPATH, gpe_add_del_native_fwd_rpath) \ -_(GPE_NATIVE_FWD_RPATHS_GET, gpe_native_fwd_rpaths_get) - static locator_pair_t * unformat_gpe_loc_pairs (void *locs, u32 rloc_num) { @@ -497,45 +476,23 @@ vl_api_gpe_native_fwd_rpaths_get_t_handler (vl_api_gpe_native_fwd_rpaths_get_t } /* - * gpe_api_hookup + * lisp_api_hookup * Add vpe's API message handlers to the table. * vlib has already mapped shared memory and * added the client registration handlers. * See .../vlib-api/vlibmemory/memclnt_vlib.c:memclnt_process() */ -#define vl_msg_name_crc_list -#include -#undef vl_msg_name_crc_list - -static void -setup_message_id_table (api_main_t * am) -{ -#define _(id,n,crc) vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id); - foreach_vl_msg_name_crc_lisp_gpe; -#undef _ -} +#include static clib_error_t * gpe_api_hookup (vlib_main_t * vm) { - api_main_t *am = vlibapi_get_main (); - -#define _(N,n) \ - vl_msg_api_set_handlers(VL_API_##N, #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_vpe_api_msg; -#undef _ - /* * Set up the (msg_name, crc, message-id) table */ - setup_message_id_table (am); + gpe_base_msg_id = setup_message_id_table (); - return 0; + return NULL; } VLIB_API_INIT_FUNCTION (gpe_api_hookup);