summaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src
diff options
context:
space:
mode:
authorAlberto Compagno <acompagn+fdio@cisco.com>2019-02-14 12:14:51 +0100
committerAlberto Compagno <acompagn+fdio@cisco.com>2019-02-14 13:05:16 +0100
commitf8c0d76eaff9c256804a4825301af4b9056f77d3 (patch)
tree18bf6b2247eb5e86e034e0b027ff923e6b790226 /hicn-plugin/src
parent2f039d41169b95fa1ee9b1be9fbdc8e899707d25 (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')
-rw-r--r--hicn-plugin/src/hicn.api6
-rw-r--r--hicn-plugin/src/hicn_api.c41
-rw-r--r--hicn-plugin/src/params.h6
3 files changed, 39 insertions, 14 deletions
diff --git a/hicn-plugin/src/hicn.api b/hicn-plugin/src/hicn.api
index e7d7d33c4..a6be15a92 100644
--- a/hicn-plugin/src/hicn.api
+++ b/hicn-plugin/src/hicn.api
@@ -33,13 +33,13 @@ define hicn_api_node_params_set
/* Portion of CS reserved to application, otherwise -1 to assign default value */
i32 cs_reserved_app;
- /* Default PIT entry lifetime */
+ /* Default PIT entry lifetime, otherwise -1 to assign default value */
f64 pit_dflt_lifetime_sec;
- /* Lower bound on PIT entry lifetime */
+ /* Lower bound on PIT entry lifetime, otherwise -1 to assign default value */
f64 pit_min_lifetime_sec;
- /* Upper bound on PIT entry lifetime */
+ /* Upper bound on PIT entry lifetime, otherwise -1 to assign default value */
f64 pit_max_lifetime_sec;
};
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 *******************/
/*
diff --git a/hicn-plugin/src/params.h b/hicn-plugin/src/params.h
index 9e6ef5dbd..5adafd7e6 100644
--- a/hicn-plugin/src/params.h
+++ b/hicn-plugin/src/params.h
@@ -56,9 +56,9 @@ STATIC_ASSERT ((HICN_PARAM_FACES_MAX & (HICN_PARAM_FACES_MAX - 1)) == 0,
STATIC_ASSERT ((HICN_PARAM_PIT_ENTRY_PHOPS_MAX <= HICN_PARAM_FACES_MAX),
"HICN_PARAM_PIT_ENTRY_PHOP_MAX must be <= than HICN_PARAM_FACES_MAX");
-// PIT lifetime limits on API override this(in seconds, long -float type)
-#define HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC 0.100L
-#define HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC 20.000L
+// PIT lifetime limits on API override this(in mseconds, integer type)
+#define HICN_PARAM_PIT_LIFETIME_BOUND_MIN_SEC 100
+#define HICN_PARAM_PIT_LIFETIME_BOUND_MAX_SEC 20000
//PIT lifetime params if not set at API(in mseconds, integer type)
#define HICN_PARAM_PIT_LIFETIME_DFLT_MIN_MS 200