aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-plugin/src/faces/app
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-plugin/src/faces/app')
-rw-r--r--hicn-plugin/src/faces/app/address_mgr.c62
-rw-r--r--hicn-plugin/src/faces/app/address_mgr.h8
-rw-r--r--hicn-plugin/src/faces/app/face_app_cli.c8
-rw-r--r--hicn-plugin/src/faces/app/face_cons.c32
-rw-r--r--hicn-plugin/src/faces/app/face_cons.h25
-rw-r--r--hicn-plugin/src/faces/app/face_prod.h30
-rw-r--r--hicn-plugin/src/faces/app/face_prod_node.c4
7 files changed, 80 insertions, 89 deletions
diff --git a/hicn-plugin/src/faces/app/address_mgr.c b/hicn-plugin/src/faces/app/address_mgr.c
index 2d5894ab8..b5d8ce7cb 100644
--- a/hicn-plugin/src/faces/app/address_mgr.c
+++ b/hicn-plugin/src/faces/app/address_mgr.c
@@ -24,12 +24,12 @@
#include <vnet/ip/ip6_packet.h>
#include <vnet/ip/ip4.h> //ip4_add_del_ip_address
#include <vnet/ip/ip6.h> //ip6_add_del_ip_address
-#include <vnet/fib/fib_types.h> //FIB_PROTOCOL_IP4/6, FIB_NODE_INDEX_INVALID
-#include <vnet/fib/fib_entry.h> //FIB_SOURCE_PRIORITY_HI
+#include <vnet/fib/fib_types.h> //FIB_PROTOCOL_IP4/6, FIB_NODE_INDEX_INVALID
+#include <vnet/fib/fib_entry.h> //FIB_SOURCE_PRIORITY_HI
#include <vnet/fib/fib_table.h>
#include <vppinfra/format.h>
-#include <vnet/interface.h> //appif_flags
-#include <vnet/interface_funcs.h> //vnet_sw_interface_set_flags
+#include <vnet/interface.h> //appif_flags
+#include <vnet/interface_funcs.h> //vnet_sw_interface_set_flags
#include "address_mgr.h"
#include "../../hicn.h"
@@ -48,7 +48,7 @@ typedef struct address_mgr_main_s
address_mgr_main_t address_mgr_main;
static void
-increment_v4_address (ip4_address_t * a, u32 val)
+increment_v4_address (ip4_address_t *a, u32 val)
{
u32 v;
@@ -57,7 +57,7 @@ increment_v4_address (ip4_address_t * a, u32 val)
}
static void
-increment_v6_address (ip6_address_t * a, u64 val)
+increment_v6_address (ip6_address_t *a, u64 val)
{
u64 v;
@@ -66,7 +66,7 @@ increment_v6_address (ip6_address_t * a, u64 val)
}
void
-get_two_ip4_addresses (ip4_address_t * appif_addr, ip4_address_t * nh_addr)
+get_two_ip4_addresses (ip4_address_t *appif_addr, ip4_address_t *nh_addr)
{
/* We want two consecutives address that fall into a /31 mask */
if (address_mgr_main.next_ip4_local_addr.as_u8[3] & 0x01)
@@ -85,20 +85,17 @@ get_two_ip4_addresses (ip4_address_t * appif_addr, ip4_address_t * nh_addr)
do
{
/* Check if the route already exist in the fib */
- fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 0, appif_addr->as_u8);
- fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
- HICN_FIB_TABLE,
- FIB_SOURCE_PRIORITY_HI);
+ fib_pfx.fp_addr = to_ip46 (/* is_v6 */ 0, appif_addr->as_u8);
+ fib_index = fib_table_find_or_create_and_lock (
+ fib_pfx.fp_proto, HICN_FIB_TABLE, FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup_exact_match (fib_index, &fib_pfx);
fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PRIORITY_HI);
if (fib_entry_index != FIB_NODE_INDEX_INVALID)
{
- fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 0, nh_addr->as_u8);
- fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
- HICN_FIB_TABLE,
- FIB_SOURCE_PRIORITY_HI);
- fib_entry_index =
- fib_table_lookup_exact_match (fib_index, &fib_pfx);
+ fib_pfx.fp_addr = to_ip46 (/* is_v6 */ 0, nh_addr->as_u8);
+ fib_index = fib_table_find_or_create_and_lock (
+ fib_pfx.fp_proto, HICN_FIB_TABLE, FIB_SOURCE_PRIORITY_HI);
+ fib_entry_index = fib_table_lookup_exact_match (fib_index, &fib_pfx);
fib_table_unlock (fib_index, fib_pfx.fp_proto,
FIB_SOURCE_PRIORITY_HI);
}
@@ -115,7 +112,7 @@ get_two_ip4_addresses (ip4_address_t * appif_addr, ip4_address_t * nh_addr)
}
void
-get_two_ip6_addresses (ip6_address_t * appif_addr, ip6_address_t * nh_addr)
+get_two_ip6_addresses (ip6_address_t *appif_addr, ip6_address_t *nh_addr)
{
/* We want two consecutives address that fall into a /127 mask */
@@ -126,7 +123,6 @@ get_two_ip6_addresses (ip6_address_t * appif_addr, ip6_address_t * nh_addr)
increment_v6_address (&(address_mgr_main.next_ip6_local_addr), 1);
*nh_addr = address_mgr_main.next_ip6_local_addr;
-
fib_prefix_t fib_pfx;
fib_node_index_t fib_entry_index = FIB_NODE_INDEX_INVALID;
u32 fib_index;
@@ -140,18 +136,18 @@ get_two_ip6_addresses (ip6_address_t * appif_addr, ip6_address_t * nh_addr)
do
{
/* Check if the route already exist in the fib */
- fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 1, appif_addr->as_u8);
+ fib_pfx.fp_addr = to_ip46 (/* is_v6 */ 1, appif_addr->as_u8);
fib_entry_index = fib_table_lookup_exact_match (fib_index, &fib_pfx);
- //fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PRIORITY_HI);
+ // fib_table_unlock (fib_index, fib_pfx.fp_proto,
+ // FIB_SOURCE_PRIORITY_HI);
if (fib_entry_index != FIB_NODE_INDEX_INVALID)
{
- fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 0, nh_addr->as_u8);
+ fib_pfx.fp_addr = to_ip46 (/* is_v6 */ 0, nh_addr->as_u8);
- fib_entry_index =
- fib_table_lookup_exact_match (fib_index, &fib_pfx);
- // fib_table_unlock (fib_index, fib_pfx.fp_proto,
- // FIB_SOURCE_PRIORITY_HI);
+ fib_entry_index = fib_table_lookup_exact_match (fib_index, &fib_pfx);
+ // fib_table_unlock (fib_index, fib_pfx.fp_proto,
+ // FIB_SOURCE_PRIORITY_HI);
}
if (fib_entry_index != FIB_NODE_INDEX_INVALID)
{
@@ -179,10 +175,9 @@ get_ip4_address ()
do
{
/* Check if the route already exist in the fib */
- fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 0, prefix->as_u8);
- fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
- HICN_FIB_TABLE,
- FIB_SOURCE_PRIORITY_HI);
+ fib_pfx.fp_addr = to_ip46 (/* is_v6 */ 0, prefix->as_u8);
+ fib_index = fib_table_find_or_create_and_lock (
+ fib_pfx.fp_proto, HICN_FIB_TABLE, FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup_exact_match (fib_index, &fib_pfx);
fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PRIORITY_HI);
increment_v4_address (prefix, 1);
@@ -206,10 +201,9 @@ get_ip6_address ()
do
{
/* Check if the route already exist in the fib */
- fib_pfx.fp_addr = to_ip46 ( /* is_v6 */ 1, prefix->as_u8);
- fib_index = fib_table_find_or_create_and_lock (fib_pfx.fp_proto,
- HICN_FIB_TABLE,
- FIB_SOURCE_PRIORITY_HI);
+ fib_pfx.fp_addr = to_ip46 (/* is_v6 */ 1, prefix->as_u8);
+ fib_index = fib_table_find_or_create_and_lock (
+ fib_pfx.fp_proto, HICN_FIB_TABLE, FIB_SOURCE_PRIORITY_HI);
fib_entry_index = fib_table_lookup_exact_match (fib_index, &fib_pfx);
fib_table_unlock (fib_index, fib_pfx.fp_proto, FIB_SOURCE_PRIORITY_HI);
increment_v6_address (prefix, 1);
diff --git a/hicn-plugin/src/faces/app/address_mgr.h b/hicn-plugin/src/faces/app/address_mgr.h
index 99450dcdd..bd834f063 100644
--- a/hicn-plugin/src/faces/app/address_mgr.h
+++ b/hicn-plugin/src/faces/app/address_mgr.h
@@ -25,9 +25,9 @@
* an interface.
*/
-#define ADDR_MGR_IP4_LEN 32
+#define ADDR_MGR_IP4_LEN 32
#define ADDR_MGR_IP4_CONS_LEN 31
-#define ADDR_MGR_IP6_LEN 128
+#define ADDR_MGR_IP6_LEN 128
#define ADDR_MGR_IP6_CONS_LEN 127
/**
@@ -36,7 +36,7 @@
* @param addr1 first ip address with the least significant bit set to 0
* @param addr2 second ip address with the least significant bit set to 1
*/
-void get_two_ip4_addresses (ip4_address_t * addr1, ip4_address_t * addr2);
+void get_two_ip4_addresses (ip4_address_t *addr1, ip4_address_t *addr2);
/**
* @brief Get two consecutive IP v6 addresses from the same /126 subnet
@@ -44,7 +44,7 @@ void get_two_ip4_addresses (ip4_address_t * addr1, ip4_address_t * addr2);
* @param addr1 first ip address with the least significant bit set to 0
* @param addr2 second ip address with the least significant bit set to 1
*/
-void get_two_ip6_addresses (ip6_address_t * addr1, ip6_address_t * addr2);
+void get_two_ip6_addresses (ip6_address_t *addr1, ip6_address_t *addr2);
/**
* @brief Get one IP v4 address
diff --git a/hicn-plugin/src/faces/app/face_app_cli.c b/hicn-plugin/src/faces/app/face_app_cli.c
index 36f8bf3f7..ccdee4450 100644
--- a/hicn-plugin/src/faces/app/face_app_cli.c
+++ b/hicn-plugin/src/faces/app/face_app_cli.c
@@ -114,8 +114,8 @@ hicn_face_app_cli_set_command_fn (vlib_main_t *vm,
if (prod)
{
prefix.fp_proto = ip46_address_is_ip4 (&prefix.fp_addr) ?
- FIB_PROTOCOL_IP4 :
- FIB_PROTOCOL_IP6;
+ FIB_PROTOCOL_IP4 :
+ FIB_PROTOCOL_IP6;
rv = hicn_face_prod_add (&prefix, sw_if, &cs_reserved, &prod_addr,
&face_id1);
if (rv == HICN_ERROR_NONE)
@@ -175,8 +175,8 @@ hicn_face_app_cli_set_command_fn (vlib_main_t *vm,
break;
}
return (rv == HICN_ERROR_NONE) ?
- 0 :
- clib_error_return (0, "%s\n", get_error_string (rv));
+ 0 :
+ clib_error_return (0, "%s\n", get_error_string (rv));
}
/* cli declaration for 'cfg face' */
diff --git a/hicn-plugin/src/faces/app/face_cons.c b/hicn-plugin/src/faces/app/face_cons.c
index d44ba1a2b..53b955775 100644
--- a/hicn-plugin/src/faces/app/face_cons.c
+++ b/hicn-plugin/src/faces/app/face_cons.c
@@ -22,9 +22,8 @@
#include "../../infra.h"
int
-hicn_face_cons_add (ip4_address_t * nh_addr4, ip6_address_t * nh_addr6,
- u32 swif, hicn_face_id_t * faceid1,
- hicn_face_id_t * faceid2)
+hicn_face_cons_add (ip4_address_t *nh_addr4, ip6_address_t *nh_addr6, u32 swif,
+ hicn_face_id_t *faceid1, hicn_face_id_t *faceid2)
{
/* Create the corresponding appif if */
/* Retrieve a valid local ip address to assign to the appif */
@@ -49,32 +48,33 @@ hicn_face_cons_add (ip4_address_t * nh_addr4, ip6_address_t * nh_addr6,
if_flags |= VNET_SW_INTERFACE_FLAG_ADMIN_UP;
vnet_sw_interface_set_flags (vnm, swif, if_flags);
+#if 0
get_two_ip4_addresses (&(if_ip.ip4), nh_addr4);
- ip4_add_del_interface_address (vm,
- swif,
- &(if_ip.ip4),
- ADDR_MGR_IP4_CONS_LEN, 0 /* is_del */ );
+ ip4_add_del_interface_address (vm, swif, &(if_ip.ip4), ADDR_MGR_IP4_CONS_LEN,
+ 0 /* is_del */);
ip46_address_t nh_addr = to_ip46 (0, (u8 *) nh_addr4);
- index_t adj_index = adj_nbr_find(FIB_PROTOCOL_IP4, VNET_LINK_IP4, &nh_addr, swif);
+ index_t adj_index =
+ adj_nbr_find (FIB_PROTOCOL_IP4, VNET_LINK_IP4, &nh_addr, swif);
hicn_iface_add (&nh_addr, swif, faceid1, DPO_PROTO_IP4, adj_index);
hicn_face_t *face = hicn_dpoi_get_from_idx (*faceid1);
face->flags |= HICN_FACE_FLAGS_APPFACE_CONS;
+#endif
get_two_ip6_addresses (&(if_ip.ip6), nh_addr6);
- ip6_add_del_interface_address (vm,
- swif,
- &(if_ip.ip6),
- ADDR_MGR_IP6_CONS_LEN, 0 /* is_del */ );
+ ip6_add_del_interface_address (vm, swif, &(if_ip.ip6), ADDR_MGR_IP6_CONS_LEN,
+ 0 /* is_del */);
- adj_index = adj_nbr_find(FIB_PROTOCOL_IP6, VNET_LINK_IP6, &nh_addr, swif);
+ ip46_address_t nh_addr = to_ip46 (0, (u8 *) nh_addr6);
+ index_t adj_index = adj_nbr_find (FIB_PROTOCOL_IP6, VNET_LINK_IP6, &nh_addr, swif);
- hicn_iface_add ((ip46_address_t *) nh_addr6, swif, faceid2, DPO_PROTO_IP6, adj_index);
+ hicn_iface_add ((ip46_address_t *) nh_addr6, swif, faceid2, DPO_PROTO_IP6,
+ adj_index);
- face = hicn_dpoi_get_from_idx (*faceid2);
+ hicn_face_t *face = hicn_dpoi_get_from_idx (*faceid2);
face->flags |= HICN_FACE_FLAGS_APPFACE_CONS;
return HICN_ERROR_NONE;
@@ -99,7 +99,7 @@ hicn_face_cons_del (hicn_face_id_t face_id)
}
u8 *
-format_hicn_face_cons (u8 * s, va_list * args)
+format_hicn_face_cons (u8 *s, va_list *args)
{
CLIB_UNUSED (index_t index) = va_arg (*args, index_t);
CLIB_UNUSED (u32 indent) = va_arg (*args, u32);
diff --git a/hicn-plugin/src/faces/app/face_cons.h b/hicn-plugin/src/faces/app/face_cons.h
index 5f8f5dde8..3ff246f4f 100644
--- a/hicn-plugin/src/faces/app/face_cons.h
+++ b/hicn-plugin/src/faces/app/face_cons.h
@@ -28,8 +28,8 @@
* consumer application (co-located with the forwarder) that acts as a
* consumer. The interface used by the consumer application face is
* assumed to be reserved only for hICN traffic (e.g., dedicated memif that
- * connects the applictation to the forwarder). Only one application face can be
- * assigned to an interface.
+ * connects the applictation to the forwarder). Only one application face can
+ * be assigned to an interface.
*
* In the vlib graph a consumer application face directly connect the
* device-input node to the hicn-vface-ip node.
@@ -38,17 +38,17 @@
/**
* @brief Add a new consumer application face
*
- * The method creates the internal ip face and set the ip address to the interface.
- * @param nh_addr4 ipv4 address to assign to interface used by the application to
- * send interest to the consumer face
- * @param nh_addr6 ipv6 address to assign to interface used by the application to
- * send interest to the consumer face
+ * The method creates the internal ip face and set the ip address to the
+ * interface.
+ * @param nh_addr4 ipv4 address to assign to interface used by the application
+ * to send interest to the consumer face
+ * @param nh_addr6 ipv6 address to assign to interface used by the application
+ * to send interest to the consumer face
* @param swif interface associated to the face
*/
-int
-hicn_face_cons_add (ip4_address_t * nh_addr4, ip6_address_t * nh_addr6,
- u32 swif, hicn_face_id_t * faceid1,
- hicn_face_id_t * faceid2);
+int hicn_face_cons_add (ip4_address_t *nh_addr4, ip6_address_t *nh_addr6,
+ u32 swif, hicn_face_id_t *faceid1,
+ hicn_face_id_t *faceid2);
/**
* @brief Delete an existing consumer application face
@@ -64,8 +64,7 @@ int hicn_face_cons_del (hicn_face_id_t face_id);
* @param args Array storing input values. Expected u32 face_id and u32 indent
* @return String with the formatted face
*/
-u8 *format_hicn_face_cons (u8 * s, va_list * args);
-
+u8 *format_hicn_face_cons (u8 *s, va_list *args);
#endif /* _FACE_CONSUMER_H_ */
diff --git a/hicn-plugin/src/faces/app/face_prod.h b/hicn-plugin/src/faces/app/face_prod.h
index 4cb2e3fbf..4acf89dfc 100644
--- a/hicn-plugin/src/faces/app/face_prod.h
+++ b/hicn-plugin/src/faces/app/face_prod.h
@@ -25,12 +25,12 @@
* @brief Producer application face.
*
* A producer application face is built upon an ip face and identify a local
- * producer application (co-located with the forwarder) that acts as a producer. In the
- * current design an application face is either a face towards a consumer face
- * or towards a producer. The interface used by the producer application face is
- * assumed to be reserved only for hICN traffic (e.g., dedicated memif that
- * connects the applictation to the forwarder). Only one application face can be
- * assigned to an interface.
+ * producer application (co-located with the forwarder) that acts as a
+ * producer. In the current design an application face is either a face towards
+ * a consumer face or towards a producer. The interface used by the producer
+ * application face is assumed to be reserved only for hICN traffic (e.g.,
+ * dedicated memif that connects the applictation to the forwarder). Only one
+ * application face can be assigned to an interface.
*
* To each producer application face it is assigned a portion of the CS. Every
* data arriving to a producer application will be stored in the portion of the
@@ -38,13 +38,13 @@
* face. Available eviction faces are list in the /cache_policy folder.
*
* In the vlib graph a producer application face is directly connected to the
- * device-input node (with the node hicn-face-prod-input) and passes every packet to
- * the hicn-face-ip node.
+ * device-input node (with the node hicn-face-prod-input) and passes every
+ * packet to the hicn-face-ip node.
*/
/**
- * @brief Producer application face state that refer to the hICN producer socket
- * created by the application.
+ * @brief Producer application face state that refer to the hICN producer
+ * socket created by the application.
*
*/
typedef struct
@@ -69,9 +69,8 @@ extern hicn_face_prod_state_t *face_state_vec;
* @param prod_addr address to assign to interface used by the appliction to
* send data to the producer face
*/
-int
-hicn_face_prod_add (fib_prefix_t * prefix, u32 swif, u32 * cs_reserved,
- ip46_address_t * prod_addr, hicn_face_id_t * faceid);
+int hicn_face_prod_add (fib_prefix_t *prefix, u32 swif, u32 *cs_reserved,
+ ip46_address_t *prod_addr, hicn_face_id_t *faceid);
/**
* @brief Delete an existing application face
@@ -85,7 +84,7 @@ int hicn_face_prod_del (hicn_face_id_t faceid);
*
* @param face_id Id of the producer application face
*/
-int hicn_face_prod_set_lru_max (hicn_face_id_t face_id, u32 * requested_size);
+int hicn_face_prod_set_lru_max (hicn_face_id_t face_id, u32 *requested_size);
/**
* @brief Format an application producer face
@@ -94,8 +93,7 @@ int hicn_face_prod_set_lru_max (hicn_face_id_t face_id, u32 * requested_size);
* @param args Array storing input values. Expected u32 face_id and u32 indent
* @return String with the formatted face
*/
-u8 *format_hicn_face_prod (u8 * s, va_list * args);
-
+u8 *format_hicn_face_prod (u8 *s, va_list *args);
#endif /* _FACE_PROD_H_ */
diff --git a/hicn-plugin/src/faces/app/face_prod_node.c b/hicn-plugin/src/faces/app/face_prod_node.c
index a843a01ef..c4c9edc32 100644
--- a/hicn-plugin/src/faces/app/face_prod_node.c
+++ b/hicn-plugin/src/faces/app/face_prod_node.c
@@ -114,7 +114,7 @@ hicn_face_prod_next_from_data_hdr (vlib_node_runtime_t *node, vlib_buffer_t *b,
}
return match_res ? HICN_FACE_PROD_NEXT_DATA_IP4 + (v == 0x60) :
- HICN_FACE_PROD_NEXT_ERROR_DROP;
+ HICN_FACE_PROD_NEXT_ERROR_DROP;
}
static_always_inline void
@@ -291,7 +291,7 @@ VLIB_REGISTER_NODE(hicn_face_prod_input_node) =
[HICN_FACE_PROD_NEXT_ERROR_DROP] = "error-drop",
},
};
-
+
/*
* fd.io coding-style-patch-verification: ON
*