aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/hicn_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/hicn_api.c')
-rw-r--r--hicn-plugin/src/hicn_api.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/hicn-plugin/src/hicn_api.c b/hicn-plugin/src/hicn_api.c
index 85279eb0b..16e32dd9b 100644
--- a/hicn-plugin/src/hicn_api.c
+++ b/hicn-plugin/src/hicn_api.c
@@ -451,6 +451,28 @@ vl_api_hicn_api_strategies_get_t_handler (vl_api_hicn_api_strategies_get_t *mp)
}
static void
+vl_api_hicn_api_strategy_set_t_handler (vl_api_hicn_api_strategy_set_t *mp)
+{
+ vl_api_hicn_api_strategy_set_reply_t *rmp;
+ int rv = HICN_ERROR_NONE;
+ fib_prefix_t prefix;
+ vl_api_hicn_strategy_t strategy_id;
+
+ hicn_main_t *sm = &hicn_main;
+
+ // Decode prefix
+ ip_prefix_decode (&mp->prefix, &prefix);
+
+ // Decode strategy id
+ strategy_id = clib_net_to_host_u32 (mp->strategy_id);
+
+ // Try to set the strategy
+ rv = hicn_route_set_strategy (&prefix, strategy_id);
+
+ REPLY_MACRO (VL_API_HICN_API_STRATEGY_SET_REPLY);
+}
+
+static void
vl_api_hicn_api_strategy_get_t_handler (vl_api_hicn_api_strategy_get_t *mp)
{
vl_api_hicn_api_strategy_get_reply_t *rmp;
@@ -458,7 +480,7 @@ vl_api_hicn_api_strategy_get_t_handler (vl_api_hicn_api_strategy_get_t *mp)
hicn_main_t *sm = &hicn_main;
- u32 strategy_id = clib_net_to_host_u32 (mp->strategy_id);
+ vl_api_hicn_strategy_t strategy_id = clib_net_to_host_u32 (mp->strategy_id);
rv = hicn_dpo_strategy_id_is_valid (strategy_id);
REPLY_MACRO2 (VL_API_HICN_API_STRATEGY_GET_REPLY /* , rmp, mp, rv */, ({