diff options
Diffstat (limited to 'hicn-plugin/src/strategies/dpo_mw.h')
-rw-r--r-- | hicn-plugin/src/strategies/dpo_mw.h | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/hicn-plugin/src/strategies/dpo_mw.h b/hicn-plugin/src/strategies/dpo_mw.h index 433c415fb..f3ccf7e30 100644 --- a/hicn-plugin/src/strategies/dpo_mw.h +++ b/hicn-plugin/src/strategies/dpo_mw.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Cisco and/or its affiliates. + * Copyright (c) 2021 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: @@ -38,17 +38,12 @@ typedef struct hicn_strategy_mw_ctx_s * @brief Format the dpo ctx for a human-readable string * * @param s String to which to append the formatted dpo ctx - * @param ap List of parameters for the formatting + * @param dpo_ctx DPO context + * @param indent Indentation * * @result The string with the formatted dpo ctx */ -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_dpo_ctx_lock, - .dv_unlock = hicn_strategy_dpo_ctx_unlock, - .dv_format = format_hicn_strategy_mw_ctx, -}; +u8 *hicn_dpo_strategy_mw_format (u8 *s, hicn_dpo_ctx_t *dpo_ctx, u32 indent); /** * @brief Retrieve an hicn_strategy_mw_ctx object @@ -67,15 +62,22 @@ 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 */ -void -hicn_strategy_mw_ctx_create (fib_protocol_t proto, const hicn_face_id_t * next_hop, - int nh_len, index_t * dpo_idx); +void hicn_strategy_mw_ctx_create (fib_protocol_t proto, + const hicn_face_id_t *next_hop, int nh_len, + index_t *dpo_idx); + +/** + * @brief Update existing ctx setting it to mw + * + * @param hicn_strategy_ctx pointer to the ctx to update + */ +void hicn_strategy_mw_update_ctx_type (hicn_dpo_ctx_t *hicn_strategy_ctx); /** * @brief Add or update a next hop in the dpo ctx. * - * This function is meant to be used in the control plane and not in the data plane, - * as it is not optimized for the latter. + * This function is meant to be used in the control plane and not in the data + * plane, as it is not optimized for the latter. * * @param nh Next hop to insert in the dpo ctx * @param dpo_idx Index of the dpo ctx to update with the new or updated next @@ -108,7 +110,7 @@ void hicn_strategy_mw_ctx_prefetch (index_t dpo_idx); * * @param dpo Dpo to check the type */ -int hicn_dpo_is_type_strategy_mw (const dpo_id_t * dpo); +int hicn_dpo_is_type_strategy_mw (const dpo_id_t *dpo); /** * @brief Initialize the Maximum Weight strategy @@ -120,24 +122,6 @@ void hicn_dpo_strategy_mw_module_init (void); */ 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__ /* |