aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces/ip/dpo_ip.c
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/faces/ip/dpo_ip.c')
-rw-r--r--hicn-plugin/src/faces/ip/dpo_ip.c106
1 files changed, 5 insertions, 101 deletions
diff --git a/hicn-plugin/src/faces/ip/dpo_ip.c b/hicn-plugin/src/faces/ip/dpo_ip.c
index de71f1b01..d05fec1a0 100644
--- a/hicn-plugin/src/faces/ip/dpo_ip.c
+++ b/hicn-plugin/src/faces/ip/dpo_ip.c
@@ -19,6 +19,8 @@ mhash_t hicn_face_ip_local_hashtb;
mhash_t hicn_face_ip_remote_hashtb;
dpo_type_t hicn_face_ip_type;
+hicn_face_ip_vec_t * hicn_vec_pool;
+
const static char *const hicn_face_ip4dpoi_nodes[] = {
"hicn-face-ip4-input",
"hicn-face-ip4-output",
@@ -51,12 +53,14 @@ void
hicn_dpo_ip_module_init (void)
{
mhash_init (&hicn_face_ip_local_hashtb,
- sizeof (hicn_face_id_t) /* value */ ,
+ sizeof (hicn_face_ip_input_faces_t) /* value */ ,
sizeof (hicn_face_ip_key_t) /* key */ );
mhash_init (&hicn_face_ip_remote_hashtb,
sizeof (hicn_face_id_t) /* value */ ,
sizeof (hicn_face_ip_key_t) /* key */ );
+ pool_alloc(hicn_vec_pool, 100);
+
/*
* How much useful is the following registration?
* So far it seems that we need it only for setting the dpo_type.
@@ -65,106 +69,6 @@ hicn_dpo_ip_module_init (void)
dpo_register_new_type (&hicn_face_ip_vft, hicn_ip_nodes);
}
-
-int
-hicn_dpo_ip4_create (dpo_id_t * dpo,
- const ip4_address_t * local_addr,
- const ip4_address_t * remote_addr,
- u32 sw_if,
- adj_index_t adj,
- u32 node_index,
- hicn_face_flags_t flags, hicn_face_id_t * face_id)
-{
- /* If local matches the dpoi is a face */
- hicn_face_t *face =
- hicn_face_ip4_get (local_addr, sw_if, &hicn_face_ip_local_hashtb);
- u8 hicnb_flags;
-
- if (face != NULL)
- return HICN_ERROR_FACE_ALREADY_CREATED;
-
- face = hicn_face_ip4_get (remote_addr, sw_if, &hicn_face_ip_remote_hashtb);
-
- if (face == NULL)
- {
- hicn_dpo_ip4_add_and_lock_from_remote (dpo, &hicnb_flags, local_addr,
- remote_addr, sw_if, node_index);
- *face_id = (hicn_face_id_t) dpo->dpoi_index;
- face = hicn_dpoi_get_from_idx (*face_id);
- }
- else
- {
- *face_id = hicn_dpoi_get_index (face);
- dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP4, *face_id);
- dpo->dpoi_next_node = node_index;
- }
-
-
- hicn_face_ip_key_t key;
- hicn_face_ip4_get_key (local_addr, sw_if, &key);
-
- mhash_set_mem (&hicn_face_ip_local_hashtb, &key, (uword *) face_id, 0);
-
- hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
- ip46_address_set_ip4 (&ip_face->local_addr, local_addr);
- ip46_address_set_ip4 (&ip_face->remote_addr, remote_addr);
- face->shared.flags = flags;
- face->shared.adj = adj;
-
- return HICN_ERROR_NONE;
-}
-
-int
-hicn_dpo_ip6_create (dpo_id_t * dpo,
- const ip6_address_t * local_addr,
- const ip6_address_t * remote_addr,
- u32 sw_if,
- adj_index_t adj,
- u32 node_index,
- hicn_face_flags_t flags, hicn_face_id_t * face_id)
-{
- /* If local matches the dpoi is a face */
- hicn_face_t *face =
- hicn_face_ip6_get (local_addr, sw_if, &hicn_face_ip_local_hashtb);
-
- u8 hicnb_flags;
-
- if (face != NULL)
- return HICN_ERROR_FACE_ALREADY_CREATED;
-
- face = hicn_face_ip6_get (remote_addr, sw_if, &hicn_face_ip_remote_hashtb);
-
- /* If remote matches the dpoi is a iface */
- if (face == NULL)
- {
- hicn_dpo_ip6_add_and_lock_from_remote (dpo, &hicnb_flags, local_addr,
- remote_addr, sw_if, node_index);
- *face_id = (hicn_face_id_t) dpo->dpoi_index;
- face = hicn_dpoi_get_from_idx (*face_id);
- }
- else
- {
- *face_id = hicn_dpoi_get_index (face);
- dpo_set (dpo, hicn_face_ip_type, DPO_PROTO_IP6, *face_id);
- dpo->dpoi_next_node = node_index;
- }
-
- hicn_face_ip_key_t key;
- hicn_face_ip6_get_key (local_addr, sw_if, &key);
-
- mhash_set_mem (&hicn_face_ip_local_hashtb, &key, (uword *) face_id, 0);
-
- hicn_face_ip_t *ip_face = (hicn_face_ip_t *) face->data;
- clib_memcpy (&ip_face->local_addr, local_addr, sizeof (ip6_address_t));
- clib_memcpy (&ip_face->remote_addr, remote_addr, sizeof (ip6_address_t));
- face->shared.sw_if = sw_if;
- face->shared.flags = flags;
- face->shared.adj = adj;
-
-
- return HICN_ERROR_NONE;
-}
-
void
hicn_dpo_ip_create_from_face (hicn_face_t * face, dpo_id_t * dpo,
u16 dpoi_next_node)