From e6a120973cca65ca464d1323a6f7f4308dcb4717 Mon Sep 17 00:00:00 2001 From: Alberto Compagno Date: Mon, 9 Mar 2020 11:39:59 +0100 Subject: [HICN-547] Removing punting through acl for interests Change-Id: I71767f732ec6ede1efc66e5a99f09c3207367dcb Signed-off-by: Alberto Compagno --- hicn-plugin/src/strategies/dpo_mw.h | 56 ++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 23 deletions(-) (limited to 'hicn-plugin/src/strategies/dpo_mw.h') diff --git a/hicn-plugin/src/strategies/dpo_mw.h b/hicn-plugin/src/strategies/dpo_mw.h index a8c0a3b43..ccc8d044f 100644 --- a/hicn-plugin/src/strategies/dpo_mw.h +++ b/hicn-plugin/src/strategies/dpo_mw.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 Cisco and/or its affiliates. + * Copyright (c) 2017-2020 Cisco and/or its affiliates. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at: @@ -19,27 +19,13 @@ #include #include "../strategy_dpo_ctx.h" +#define DEFAULT_WEIGHT 0 + typedef struct hicn_strategy_mw_ctx_s { - hicn_dpo_ctx_t default_ctx; - u8 weight[HICN_PARAM_FIB_ENTRY_NHOPS_MAX]; } hicn_strategy_mw_ctx_t; -/** - * @brief Lock the mw ctx - * - * @param dpo Identifier of the dpo of the mw ctx - */ -void hicn_strategy_mw_ctx_lock (dpo_id_t * dpo); - -/** - * @brief Unlock the mw ctx - * - * @param dpo Identifier of the dpo of the mw ctx - */ -void hicn_strategy_mw_ctx_unlock (dpo_id_t * dpo); - /** * @brief Format the dpo ctx for a human-readable string * @@ -51,8 +37,8 @@ void hicn_strategy_mw_ctx_unlock (dpo_id_t * dpo); u8 *format_hicn_strategy_mw_ctx (u8 * s, va_list * ap); const static dpo_vft_t dpo_strategy_mw_ctx_vft = { - .dv_lock = hicn_strategy_mw_ctx_lock, - .dv_unlock = hicn_strategy_mw_ctx_unlock, + .dv_lock = hicn_strategy_dpo_ctx_lock, + .dv_unlock = hicn_strategy_dpo_ctx_unlock, .dv_format = format_hicn_strategy_mw_ctx, }; @@ -73,7 +59,7 @@ hicn_dpo_ctx_t *hicn_strategy_mw_ctx_get (index_t index); * @param dpo_idx index_t that will hold the index of the created dpo ctx * @return HICN_ERROR_NONE if the creation was fine, otherwise EINVAL */ -int +void hicn_strategy_mw_ctx_create (dpo_proto_t proto, const dpo_id_t * next_hop, int nh_len, index_t * dpo_idx); @@ -100,9 +86,7 @@ int hicn_strategy_mw_ctx_add_nh (const dpo_id_t * nh, index_t dpo_idx); * @return HICN_ERROR_NONE if the update or insert was fine, * otherwise HICN_ERROR_DPO_CTS_NOT_FOUND */ -int -hicn_strategy_mw_ctx_del_nh (hicn_face_id_t face_id, index_t dpo_idx, - fib_prefix_t * fib_pfx); +int hicn_strategy_mw_ctx_del_nh (hicn_face_id_t face_id, index_t dpo_idx); /** * @brief Prefetch a dpo @@ -111,14 +95,40 @@ hicn_strategy_mw_ctx_del_nh (hicn_face_id_t face_id, index_t dpo_idx, */ void hicn_strategy_mw_ctx_prefetch (index_t dpo_idx); +/** + * @brief Return true if the dpo is of type strategy mw + * + * @param dpo Dpo to check the type + */ int hicn_dpo_is_type_strategy_mw (const dpo_id_t * dpo); +/** + * @brief Initialize the Maximum Weight strategy + */ void hicn_dpo_strategy_mw_module_init (void); +/** + * @brief Return the dpo type for the Maximum Weight strategy + */ dpo_type_t hicn_dpo_strategy_mw_get_type (void); +/** + * @brief Format the dpo ctx for the strategy Maximum Weight + * + * @param s String to append the formatted dpo ctx + * @param ap List of arguments to format + */ u8 *format_hicn_dpo_strategy_mw (u8 * s, va_list * ap); +/** + * @brief Format the dpo ctx for the strategy Maximum Weight. To + * call from other functions + * + * @param s String to append the formatted dpo ctx + * @param ... List of arguments to format + */ +u8 *hicn_strategy_mw_format_ctx (u8 * s, int n, ...); + #endif // __HICN_DPO_MW_H__ -- cgit 1.2.3-korg