From 0046e97eb94cbcf278be2c892e4b686da670a414 Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Sat, 26 Jun 2021 22:12:08 +0000 Subject: session: api cleanup Use autogenerated code. Does not change API definitions. Type: improvement Signed-off-by: Filip Tehlar Change-Id: Iacc58d27ac51c8a1c571087f98297e046b3477c2 --- src/vnet/session/session_api.c | 106 +++++++++++++---------------------------- 1 file changed, 33 insertions(+), 73 deletions(-) (limited to 'src/vnet/session/session_api.c') diff --git a/src/vnet/session/session_api.c b/src/vnet/session/session_api.c index fe9ebc15db3..31022294be5 100644 --- a/src/vnet/session/session_api.c +++ b/src/vnet/session/session_api.c @@ -21,38 +21,15 @@ #include #include #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 +#include +#include +#include +#define REPLY_MSG_ID_BASE session_main.msg_id_base #include -#define foreach_session_api_msg \ -_(APP_ATTACH, app_attach) \ -_(APPLICATION_DETACH, application_detach) \ -_(SESSION_ENABLE_DISABLE, session_enable_disable) \ -_(APP_NAMESPACE_ADD_DEL, app_namespace_add_del) \ -_(SESSION_RULE_ADD_DEL, session_rule_add_del) \ -_(SESSION_RULES_DUMP, session_rules_dump) \ -_(APP_ADD_CERT_KEY_PAIR, app_add_cert_key_pair) \ -_(APP_DEL_CERT_KEY_PAIR, app_del_cert_key_pair) \ -_(APP_WORKER_ADD_DEL, app_worker_add_del) \ - static transport_proto_t api_session_transport_proto_decode (const vl_api_transport_proto_t * api_tp) { @@ -921,7 +898,7 @@ send_session_rule_details4 (mma_rule_16_t * rule, u8 is_local, rmp = vl_msg_api_alloc (sizeof (*rmp)); clib_memset (rmp, 0, sizeof (*rmp)); - rmp->_vl_msg_id = ntohs (VL_API_SESSION_RULES_DETAILS); + rmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_SESSION_RULES_DETAILS); rmp->context = context; clib_memset (&lcl, 0, sizeof (lcl)); @@ -963,7 +940,7 @@ send_session_rule_details6 (mma_rule_40_t * rule, u8 is_local, rmp = vl_msg_api_alloc (sizeof (*rmp)); clib_memset (rmp, 0, sizeof (*rmp)); - rmp->_vl_msg_id = ntohs (VL_API_SESSION_RULES_DETAILS); + rmp->_vl_msg_id = ntohs (REPLY_MSG_ID_BASE + VL_API_SESSION_RULES_DETAILS); rmp->context = context; clib_memset (&lcl, 0, sizeof (lcl)); @@ -1138,50 +1115,6 @@ application_reaper_cb (u32 client_index) VL_MSG_API_REAPER_FUNCTION (application_reaper_cb); -#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_session; -#undef _ -} - -/* - * session_api_hookup - * Add uri's API message handlers to the table. - * vlib has already mapped shared memory and - * added the client registration handlers. - * See .../open-repo/vlib/memclnt_vlib.c:memclnt_process() - */ -static clib_error_t * -session_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_session_api_msg; -#undef _ - - /* - * Set up the (msg_name, crc, message-id) table - */ - setup_message_id_table (am); - - return 0; -} - -VLIB_API_INIT_FUNCTION (session_api_hookup); - /* * Socket api functions */ @@ -1713,6 +1646,33 @@ error: return rv; } +static void +vl_api_application_tls_cert_add_t_handler ( + vl_api_application_tls_cert_add_t *mp) +{ + /* deprecated */ +} + +static void +vl_api_application_tls_key_add_t_handler (vl_api_application_tls_key_add_t *mp) +{ + /* deprecated */ +} + +#include +static clib_error_t * +session_api_hookup (vlib_main_t *vm) +{ + /* + * Set up the (msg_name, crc, message-id) table + */ + REPLY_MSG_ID_BASE = setup_message_id_table (); + + return 0; +} + +VLIB_API_INIT_FUNCTION (session_api_hookup); + /* * fd.io coding-style-patch-verification: ON * -- cgit 1.2.3-korg