diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-02-14 12:14:51 +0100 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2019-02-14 13:05:16 +0100 |
commit | f8c0d76eaff9c256804a4825301af4b9056f77d3 (patch) | |
tree | 18bf6b2247eb5e86e034e0b027ff923e6b790226 /hicn-plugin/src/hicn_api.c | |
parent | 2f039d41169b95fa1ee9b1be9fbdc8e899707d25 (diff) |
- [HICN-65] Populating hash map of handler and crc in api_main
- Added possibility to start the forwarder from binary api without setting any parameters
- Changed pit lifetime values from seconds to milliseconds
Change-Id: I83706f22ddd8e825c1021fe70d4bf52e1b929be8
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
Diffstat (limited to 'hicn-plugin/src/hicn_api.c')
-rw-r--r-- | hicn-plugin/src/hicn_api.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/hicn-plugin/src/hicn_api.c b/hicn-plugin/src/hicn_api.c index 8becde12c..f06350959 100644 --- a/hicn-plugin/src/hicn_api.c +++ b/hicn-plugin/src/hicn_api.c @@ -106,12 +106,21 @@ vl_api_hicn_api_node_params_set_t_handler (vl_api_hicn_api_node_params_set_t * hicn_main_t *sm = &hicn_main; int pit_max_size = clib_net_to_host_i32 (mp->pit_max_size); + pit_max_size = pit_max_size == -1? HICN_PARAM_PIT_ENTRIES_DFLT : pit_max_size; + f64 pit_dflt_lifetime_sec = mp->pit_dflt_lifetime_sec; + pit_dflt_lifetime_sec = pit_dflt_lifetime_sec == -1? HICN_PARAM_PIT_LIFETIME_DFLT_DFLT_MS : pit_dflt_lifetime_sec; + f64 pit_min_lifetime_sec = mp->pit_min_lifetime_sec; + pit_min_lifetime_sec = pit_min_lifetime_sec == -1? HICN_PARAM_PIT_LIFETIME_DFLT_MIN_MS : pit_min_lifetime_sec; + f64 pit_max_lifetime_sec = mp->pit_max_lifetime_sec; + pit_max_lifetime_sec = pit_max_lifetime_sec == -1? HICN_PARAM_PIT_LIFETIME_DFLT_MAX_MS : pit_max_lifetime_sec; + int cs_max_size = clib_net_to_host_i32 (mp->cs_max_size); - int cs_reserved_app = clib_net_to_host_i32 (mp->cs_reserved_app); + cs_max_size = cs_max_size == -1? HICN_PARAM_CS_ENTRIES_DFLT : cs_max_size; + int cs_reserved_app = clib_net_to_host_i32 (mp->cs_reserved_app); cs_reserved_app = cs_reserved_app >= 0 && cs_reserved_app < 100 ? cs_reserved_app : HICN_PARAM_CS_RESERVED_APP; @@ -493,20 +502,35 @@ static void vl_api_hicn_api_register_cons_app_t_handler /************************************************************************************/ +#define vl_msg_name_crc_list +#include <hicn/hicn_all_api_h.h> +#undef vl_msg_name_crc_list + +static void +setup_message_id_table (hicn_main_t * hm, api_main_t * am) +{ +#define _(id,n,crc) \ + vl_msg_api_add_msg_name_crc (am, #n "_" #crc, id + hm->msg_id_base); + foreach_vl_msg_name_crc_hicn; +#undef _ +} + + /* Set up the API message handling tables */ clib_error_t * hicn_api_plugin_hookup (vlib_main_t * vm) { - hicn_main_t *sm = &hicn_main; + hicn_main_t *hm = &hicn_main; + api_main_t *am = &api_main; /* Get a correctly-sized block of API message decode slots */ u8 *name = format (0, "hicn_%08x%c", api_version, 0); - sm->msg_id_base = vl_msg_api_get_msg_ids ((char *) name, + hm->msg_id_base = vl_msg_api_get_msg_ids ((char *) name, VL_MSG_FIRST_AVAILABLE); vec_free (name); #define _(N, n) \ - vl_msg_api_set_handlers(sm->msg_id_base + VL_API_##N, \ + vl_msg_api_set_handlers(hm->msg_id_base + VL_API_##N, \ #n, \ vl_api_##n##_t_handler, \ vl_noop_handler, \ @@ -516,15 +540,16 @@ hicn_api_plugin_hookup (vlib_main_t * vm) foreach_hicn_plugin_api_msg; #undef _ + /* + * Set up the (msg_name, crc, message-id) table + */ + setup_message_id_table (hm, am); + return 0; } - - - - /******************* SUPPORTING FUNCTIONS *******************/ /* |