Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
strategy_dpo_manager.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-2020 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __HICN_STRATEGY_DPO_MANAGER_H__
17 #define __HICN_STRATEGY_DPO_MANAGER_H__
18 
19 #include "strategy_dpo_ctx.h"
20 #include "strategy.h"
21 
45 typedef struct hicn_dpo_vft_s
46 {
47  int (*hicn_dpo_is_type) (const dpo_id_t *dpo);
50  dpo_type_t (*hicn_dpo_get_type) (void);
52  void (*hicn_dpo_module_init) (void);
53  void (*hicn_dpo_create) (
54  fib_protocol_t proto, const hicn_face_id_t *nh, int nh_len,
55  index_t *dpo_idx);
57  hicn_face_id_t nh,
58  index_t dpo_idx);
59  int (*hicn_dpo_del_nh) (hicn_face_id_t face_id, index_t dpo_idx);
60  u8 *(*hicn_dpo_format) (u8 *s, int, ...);
63 
64 /*
65  * Default dpo to be used to create fib entry when a strategy is not
66  * specified
67  */
68 extern hicn_dpo_vft_t default_dpo;
69 
88 dpo_type_t hicn_dpo_register_new_type (
89  const char *const *const *hicn_nodes, const hicn_dpo_vft_t *hicn_dpo_vft,
90  const hicn_strategy_vft_t *hicn_strategy_vft, const dpo_vft_t *dpo_ctx_vft);
91 
100 u32 dpo_is_hicn (const dpo_id_t *dpo);
101 
112 u8 hicn_dpo_get_vft_id (const dpo_id_t *dpo);
113 
121 const hicn_dpo_vft_t *hicn_dpo_get_vft (dpo_type_t vfts_id);
122 
130 const hicn_dpo_vft_t *hicn_dpo_get_vft_from_id (u8 strategy_id);
131 
138 const hicn_strategy_vft_t *hicn_dpo_get_strategy_vft (dpo_type_t vfts_id);
139 
147 
154 void hicn_dpos_init (void);
155 
164 u8 *format_hicn_strategy_list (u8 *s, int n, ...);
165 
174 u8 hicn_dpo_strategy_id_is_valid (int strategy_id);
175 
183 
188 void hicn_dpo_register (const hicn_dpo_vft_t *hicn_dpo);
189 
190 #endif /* // __HICN_STRATEGY_DPO_MANAGER_H__ */
191 
192 /*
193  * fd.io coding-style-patch-verification: ON
194  *
195  * Local Variables: eval: (c-set-style "gnu") End:
196  */
strategy.h
hicn_dpo_vft_t
struct hicn_dpo_vft_s hicn_dpo_vft_t
Definition of the virtual function table for a hICN DPO.
format_hicn_strategy_list
u8 * format_hicn_strategy_list(u8 *s, int n,...)
Print the list of the registered hICN DPO.
dpo_is_hicn
u32 dpo_is_hicn(const dpo_id_t *dpo)
Check if the type of the dpo is among the list of hicn dpo types.
hicn_dpo_vft_s::hicn_dpo_is_type
int(* hicn_dpo_is_type)(const dpo_id_t *dpo)
Definition: strategy_dpo_manager.h:47
hicn_dpo_get_strategy_vft
const hicn_strategy_vft_t * hicn_dpo_get_strategy_vft(dpo_type_t vfts_id)
Get the vft with the hICN strategy functions.
strategy_dpo_ctx.h
hicn_dpo_vft_s::hicn_dpo_module_init
void(* hicn_dpo_module_init)(void)
Definition: strategy_dpo_manager.h:52
hicn_dpo_strategy_id_is_valid
u8 hicn_dpo_strategy_id_is_valid(int strategy_id)
Check if a given id points to a strategy and the corresponding dpo ctx.
hicn_strategy_get_all_available
int hicn_strategy_get_all_available(void)
Return the number of available strategies. This number can be used to as an upperbond for valid vfts_...
hicn_dpo_get_vft
const hicn_dpo_vft_t * hicn_dpo_get_vft(dpo_type_t vfts_id)
Get the vft to manage the dpo context.
hicn_dpo_register_new_type
dpo_type_t hicn_dpo_register_new_type(const char *const *const *hicn_nodes, const hicn_dpo_vft_t *hicn_dpo_vft, const hicn_strategy_vft_t *hicn_strategy_vft, const dpo_vft_t *dpo_ctx_vft)
Register a new hICN dpo to the manager.
hicn_dpo_vft_s::hicn_dpo_get_type
dpo_type_t(* hicn_dpo_get_type)(void)
Definition: strategy_dpo_manager.h:50
hicn_dpo_vft_s::hicn_dpo_add_update_nh
int(* hicn_dpo_add_update_nh)(hicn_face_id_t nh, index_t dpo_idx)
Definition: strategy_dpo_manager.h:56
hicn_dpo_get_strategy_vft_from_id
const hicn_strategy_vft_t * hicn_dpo_get_strategy_vft_from_id(u8 vfts_id)
Get the vft with the hICN strategy functions from the strategy id.
hicn_dpo_get_vft_from_id
const hicn_dpo_vft_t * hicn_dpo_get_vft_from_id(u8 strategy_id)
Get the vft to manage the dpo context from the strategy id.
hicn_dpo_vft_s
Definition of the virtual function table for a hICN DPO.
Definition: strategy_dpo_manager.h:45
hicn_dpo_get_vft_id
u8 hicn_dpo_get_vft_id(const dpo_id_t *dpo)
Return the dpo_vtf and strategy_vtf identifier.
hicn_strategy_vft_s
Definition: strategy.h:50
hicn_dpos_init
void hicn_dpos_init(void)
Initialize all the types hicn dpo registered.
hicn_dpo_register
void hicn_dpo_register(const hicn_dpo_vft_t *hicn_dpo)
Registers a module at compilation time to be initialized as part of the ctor.
hicn_dpo_vft_s::hicn_dpo_create
void(* hicn_dpo_create)(fib_protocol_t proto, const hicn_face_id_t *nh, int nh_len, index_t *dpo_idx)
Definition: strategy_dpo_manager.h:53