X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fplugins%2Fikev2%2Fikev2_api.c;h=d85b2f5f99963c8147117e9de5cea1b01cfc4ca2;hb=fc7b77db7e651505aa8c3a9c5cff7191334f91bd;hp=ace28c5aa20ec0ba9ef029d8ea30f876bc0edf61;hpb=7c44d78ef2e7bf0c8714be4184511ed8f23ff239;p=vpp.git diff --git a/src/plugins/ikev2/ikev2_api.c b/src/plugins/ikev2/ikev2_api.c index ace28c5aa20..d85b2f5f999 100644 --- a/src/plugins/ikev2/ikev2_api.c +++ b/src/plugins/ikev2/ikev2_api.c @@ -26,26 +26,8 @@ #include /* define message IDs */ -#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 - -/* Get the API version number */ -#define vl_api_version(n,v) static u32 api_version=(v); -#include -#undef vl_api_version +#include +#include extern ikev2_main_t ikev2_main; @@ -54,22 +36,6 @@ extern ikev2_main_t ikev2_main; #define REPLY_MSG_ID_BASE ikev2_main.msg_id_base #include -#define foreach_ikev2_api_msg \ -_(IKEV2_PLUGIN_GET_VERSION, ikev2_plugin_get_version) \ -_(IKEV2_PROFILE_ADD_DEL, ikev2_profile_add_del) \ -_(IKEV2_PROFILE_SET_AUTH, ikev2_profile_set_auth) \ -_(IKEV2_PROFILE_SET_ID, ikev2_profile_set_id) \ -_(IKEV2_PROFILE_SET_TS, ikev2_profile_set_ts) \ -_(IKEV2_SET_LOCAL_KEY, ikev2_set_local_key) \ -_(IKEV2_SET_RESPONDER, ikev2_set_responder) \ -_(IKEV2_SET_IKE_TRANSFORMS, ikev2_set_ike_transforms) \ -_(IKEV2_SET_ESP_TRANSFORMS, ikev2_set_esp_transforms) \ -_(IKEV2_SET_SA_LIFETIME, ikev2_set_sa_lifetime) \ -_(IKEV2_INITIATE_SA_INIT, ikev2_initiate_sa_init) \ -_(IKEV2_INITIATE_DEL_IKE_SA, ikev2_initiate_del_ike_sa) \ -_(IKEV2_INITIATE_DEL_CHILD_SA, ikev2_initiate_del_child_sa) \ -_(IKEV2_INITIATE_REKEY_CHILD_SA, ikev2_initiate_rekey_child_sa) - static void vl_api_ikev2_plugin_get_version_t_handler (vl_api_ikev2_plugin_get_version_t * mp) @@ -397,64 +363,16 @@ static void REPLY_MACRO (VL_API_IKEV2_INITIATE_REKEY_CHILD_SA_REPLY); } -/* - * ikev2_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 (ikev2_main_t * im, api_main_t * am) -{ -#define _(id,n,crc) \ - vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + im->msg_id_base); - foreach_vl_msg_name_crc_ikev2; -#undef _ -} - -static clib_error_t * -ikev2_plugin_api_hookup (vlib_main_t * vm) -{ - ikev2_main_t *im = &ikev2_main; -#define _(N,n) \ - vl_msg_api_set_handlers(VL_API_##N + im->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_ikev2_api_msg; -#undef _ - - return (NULL); -} - +#include static clib_error_t * ikev2_api_init (vlib_main_t * vm) { ikev2_main_t *im = &ikev2_main; - clib_error_t *error = 0; - u8 *name; - - name = format (0, "ikev2_%08x%c", api_version, 0); /* Ask for a correctly-sized block of API message decode slots */ - im->msg_id_base = vl_msg_api_get_msg_ids ((char *) name, - VL_MSG_FIRST_AVAILABLE); - - error = ikev2_plugin_api_hookup (vm); - - /* Add our API messages to the global name_crc hash table */ - setup_message_id_table (im, &api_main); - - vec_free (name); + im->msg_id_base = setup_message_id_table (); - return (error); + return 0; } VLIB_INIT_FUNCTION (ikev2_api_init);