aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/includes
diff options
context:
space:
mode:
authorLuca Muscariello <lumuscar@cisco.com>2022-03-30 22:29:28 +0200
committerMauro Sardara <msardara@cisco.com>2022-03-31 19:51:47 +0200
commitc46e5df56b67bb8ea7a068d39324c640084ead2b (patch)
treeeddeb17785938e09bc42eec98ee09b8a28846de6 /ctrl/facemgr/includes
parent18fa668f25d3cc5463417ce7df6637e31578e898 (diff)
feat: boostrap hicn 22.02
The current patch provides several new features, improvements, bug fixes and also complete rewrite of entire components. - lib The hicn packet parser has been improved with a new packet format fully based on UDP. The TCP header is still temporarily supported but the UDP header will replace completely the new hicn packet format. Improvements have been made to make sure every packet parsing operation is made via this library. The current new header can be used as header between the payload and the UDP header or as trailer in the UDP surplus area to be tested when UDP options will start to be used. - hicn-light The portable packet forwarder has been completely rewritten from scratch with the twofold objective to improve performance and code size but also to drop dependencies such as libparc which is now removed by the current implementation. - hicn control the control library is the agent that is used to program the packet forwarders via their binary API. This component has benefited from significant improvements in terms of interaction model which is now event driven and more robust to failures. - VPP plugin has been updated to support VPP 22.02 - transport Major improvement have been made to the RTC protocol, to the support of IO modules and to the security sub system. Signed manifests are the default data authenticity and integrity framework. Confidentiality can be enabled by sharing the encryption key to the prod/cons layer. The library has been tested with group key based applications such as broadcast/multicast and real-time on-line meetings with trusted server keys or MLS. - testing Unit testing has been introduced using GoogleTest. One third of the code base is covered by unit testing with priority on critical features. Functional testing has also been introduce using Docker, linux bridging and Robot Framework to define test with Less Code techniques to facilitate the extension of the coverage. Co-authored-by: Mauro Sardara <msardara@cisco.com> Co-authored-by: Jordan Augé <jordan.auge+fdio@cisco.com> Co-authored-by: Michele Papalini <micpapal@cisco.com> Co-authored-by: Angelo Mantellini <manangel@cisco.com> Co-authored-by: Jacques Samain <jsamain@cisco.com> Co-authored-by: Olivier Roques <oroques+fdio@cisco.com> Co-authored-by: Enrico Loparco <eloparco@cisco.com> Co-authored-by: Giulio Grassi <gigrassi@cisco.com> Change-Id: I75d0ef70f86d921e3ef503c99271216ff583c215 Signed-off-by: Luca Muscariello <muscariello@ieee.org> Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'ctrl/facemgr/includes')
-rw-r--r--ctrl/facemgr/includes/CMakeLists.txt20
-rw-r--r--ctrl/facemgr/includes/facemgr.h3
-rw-r--r--ctrl/facemgr/includes/hicn/facemgr.h3
-rw-r--r--ctrl/facemgr/includes/hicn/facemgr/api.h68
-rw-r--r--ctrl/facemgr/includes/hicn/facemgr/cfg.h204
-rw-r--r--ctrl/facemgr/includes/hicn/facemgr/facelet.h323
-rw-r--r--ctrl/facemgr/includes/hicn/facemgr/loop.h35
7 files changed, 333 insertions, 323 deletions
diff --git a/ctrl/facemgr/includes/CMakeLists.txt b/ctrl/facemgr/includes/CMakeLists.txt
index 065a9022f..bfbf65717 100644
--- a/ctrl/facemgr/includes/CMakeLists.txt
+++ b/ctrl/facemgr/includes/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2017-2019 Cisco and/or its affiliates.
+# Copyright (c) 2021-2022 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:
@@ -11,15 +11,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# XXX
-
+##############################################################
+# Public headers directory
+##############################################################
set(LIBFACEMGR_INCLUDE_DIRS
- ${CMAKE_CURRENT_SOURCE_DIR} ""
+ ${CMAKE_CURRENT_SOURCE_DIR}
CACHE INTERNAL
"" FORCE
)
-if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
+
+##############################################################
+# To install header files
+##############################################################
+if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
set(TO_INSTALL_HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/facemgr.h
${CMAKE_CURRENT_SOURCE_DIR}/hicn/facemgr/api.h
@@ -28,9 +33,7 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Android")
${CMAKE_CURRENT_SOURCE_DIR}/hicn/facemgr/loop.h
PARENT_SCOPE
)
-
else ()
-
set(TO_INSTALL_HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/facemgr.h
${CMAKE_CURRENT_SOURCE_DIR}/hicn/facemgr/api.h
@@ -39,7 +42,4 @@ else ()
${CMAKE_CURRENT_SOURCE_DIR}/hicn/facemgr/loop.h
PARENT_SCOPE
)
-
endif ()
-
-
diff --git a/ctrl/facemgr/includes/facemgr.h b/ctrl/facemgr/includes/facemgr.h
index b3b482ccc..b62bb88ce 100644
--- a/ctrl/facemgr/includes/facemgr.h
+++ b/ctrl/facemgr/includes/facemgr.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 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:
@@ -26,4 +26,3 @@
#include <hicn/facemgr/loop.h>
#endif /* HICN_FACEMGR_H */
-
diff --git a/ctrl/facemgr/includes/hicn/facemgr.h b/ctrl/facemgr/includes/hicn/facemgr.h
index 4165a8fc4..83a76cc08 100644
--- a/ctrl/facemgr/includes/hicn/facemgr.h
+++ b/ctrl/facemgr/includes/hicn/facemgr.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 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:
@@ -24,4 +24,3 @@
#include <hicn/facemgr/api.h>
#endif /* HICN_FACEMGR_H */
-
diff --git a/ctrl/facemgr/includes/hicn/facemgr/api.h b/ctrl/facemgr/includes/hicn/facemgr/api.h
index e9d25f132..3fe049c06 100644
--- a/ctrl/facemgr/includes/hicn/facemgr/api.h
+++ b/ctrl/facemgr/includes/hicn/facemgr/api.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 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:
@@ -30,40 +30,38 @@
/* facemgr callbacks */
typedef enum {
- FACEMGR_CB_TYPE_REGISTER_FD,
- FACEMGR_CB_TYPE_UNREGISTER_FD,
- FACEMGR_CB_TYPE_REGISTER_TIMER,
- FACEMGR_CB_TYPE_UNREGISTER_TIMER,
+ FACEMGR_CB_TYPE_REGISTER_FD,
+ FACEMGR_CB_TYPE_UNREGISTER_FD,
+ FACEMGR_CB_TYPE_REGISTER_TIMER,
+ FACEMGR_CB_TYPE_UNREGISTER_TIMER,
} facemgr_cb_type_t;
-typedef int (*facemgr_cb_t)(void * loop, facemgr_cb_type_t type, void * data);
-
+typedef int (*facemgr_cb_t)(void *loop, facemgr_cb_type_t type, void *data);
/*
* \brief Manual overlay settings (alternative to service discovery)
*/
typedef struct {
- uint16_t local_port;
- ip_address_t remote_addr;
- uint16_t remote_port;
+ uint16_t local_port;
+ ip_address_t remote_addr;
+ uint16_t remote_port;
} facemgr_overlay_setting_t;
-#define FACEMGR_OVERLAY_SETTING_EMPTY (facemgr_overlay_setting_t) { \
- .local_port = 0, \
- .remote_addr = IP_ADDRESS_EMPTY, \
- .remote_port = 0, \
-}
+#define FACEMGR_OVERLAY_SETTING_EMPTY \
+ (facemgr_overlay_setting_t) { \
+ .local_port = 0, .remote_addr = IP_ADDRESS_EMPTY, .remote_port = 0, \
+ }
typedef struct {
- facemgr_overlay_setting_t v4;
- facemgr_overlay_setting_t v6;
+ facemgr_overlay_setting_t v4;
+ facemgr_overlay_setting_t v6;
} facemgr_overlay_t;
-#define FACEMGR_OVERLAY_EMPTY (facemgr_overlay_t) { \
- .v4 = FACEMGR_OVERLAY_SETTING_EMPTY, \
- .v6 = FACEMGR_OVERLAY_SETTING_EMPTY, \
-}
+#define FACEMGR_OVERLAY_EMPTY \
+ (facemgr_overlay_t) { \
+ .v4 = FACEMGR_OVERLAY_SETTING_EMPTY, .v6 = FACEMGR_OVERLAY_SETTING_EMPTY, \
+ }
/*
* \brief Face manager context
@@ -72,24 +70,30 @@ typedef struct facemgr_s facemgr_t;
int facemgr_initialize(facemgr_t *);
int facemgr_finalize(facemgr_t *);
-facemgr_t * facemgr_create();
-facemgr_t * facemgr_create_with_config(facemgr_cfg_t * cfg);
+facemgr_t *facemgr_create();
+facemgr_t *facemgr_create_with_config(facemgr_cfg_t *cfg);
void facemgr_stop(facemgr_t *);
void facemgr_free(facemgr_t *);
+void facemgr_set_callback(facemgr_t *facemgr, void *callback_owner,
+ facemgr_cb_t callback);
-void facemgr_set_callback(facemgr_t * facemgr, void * callback_owner, facemgr_cb_t callback);
-
-int facemgr_set_config(facemgr_t * facemgr, facemgr_cfg_t * cfg);
-int facemgr_reset_config(facemgr_t * facemgr);
-int facemgr_bootstrap(facemgr_t * facemgr);
+int facemgr_set_config(facemgr_t *facemgr, facemgr_cfg_t *cfg);
+int facemgr_reset_config(facemgr_t *facemgr);
+int facemgr_bootstrap(facemgr_t *facemgr);
#ifdef __ANDROID__
-void facemgr_set_jvm(facemgr_t * facemgr, JavaVM *jvm);
+void facemgr_set_jvm(facemgr_t *facemgr, JavaVM *jvm);
+void facemgr_on_android_callback(facemgr_t *facemgr, const char *interface_name,
+ netdevice_type_t netdevice_type, bool up,
+ int family, const char *ip_address);
#endif /* __ANDROID__ */
-typedef int (*facemgr_list_facelets_cb_t)(const facemgr_t * facemgr, const facelet_t * facelet, void * user_data);
+typedef int (*facemgr_list_facelets_cb_t)(const facemgr_t *facemgr,
+ const facelet_t *facelet,
+ void *user_data);
-void facemgr_list_facelets(const facemgr_t * facemgr, facemgr_list_facelets_cb_t cb, void * user_data);
-int facemgr_list_facelets_json(const facemgr_t * facemgr, char ** buffer);
+void facemgr_list_facelets(const facemgr_t *facemgr,
+ facemgr_list_facelets_cb_t cb, void *user_data);
+int facemgr_list_facelets_json(const facemgr_t *facemgr, char **buffer);
#endif /* FACEMGR_H */
diff --git a/ctrl/facemgr/includes/hicn/facemgr/cfg.h b/ctrl/facemgr/includes/hicn/facemgr/cfg.h
index 84d63fe73..fee38daf1 100644
--- a/ctrl/facemgr/includes/hicn/facemgr/cfg.h
+++ b/ctrl/facemgr/includes/hicn/facemgr/cfg.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 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:
@@ -20,7 +20,7 @@
#ifndef FACEMGR_CFG_H
#define FACEMGR_CFG_H
-#include <hicn/ctrl/face.h>
+#include <hicn/face.h>
#include <hicn/facemgr/facelet.h>
#include <hicn/util/log.h>
@@ -38,68 +38,70 @@
#define FACEMGR_CFG_DEFAULT_IPV4 true
#define FACEMGR_CFG_DEFAULT_IPV6 false
-
-
typedef struct facemgr_cfg_s facemgr_cfg_t;
-facemgr_cfg_t * facemgr_cfg_create();
-void facemgr_cfg_free(facemgr_cfg_t * cfg);
-int facemgr_cfg_initialize(facemgr_cfg_t * cfg);
-int facemgr_cfg_finalize(facemgr_cfg_t * cfg);
-void facemgr_cfg_dump(facemgr_cfg_t * cfg);
+facemgr_cfg_t* facemgr_cfg_create();
+void facemgr_cfg_free(facemgr_cfg_t* cfg);
+int facemgr_cfg_initialize(facemgr_cfg_t* cfg);
+int facemgr_cfg_finalize(facemgr_cfg_t* cfg);
+void facemgr_cfg_dump(facemgr_cfg_t* cfg);
/* Rules */
typedef struct facemgr_cfg_rule_s facemgr_cfg_rule_t;
-facemgr_cfg_rule_t * facemgr_cfg_rule_create();
-void facemgr_cfg_rule_free(facemgr_cfg_rule_t * rule);
-int facemgr_cfg_rule_initialize(facemgr_cfg_rule_t * rule);
-int facemgr_cfg_rule_finalize(facemgr_cfg_rule_t * rule);
+facemgr_cfg_rule_t* facemgr_cfg_rule_create();
+void facemgr_cfg_rule_free(facemgr_cfg_rule_t* rule);
+int facemgr_cfg_rule_initialize(facemgr_cfg_rule_t* rule);
+int facemgr_cfg_rule_finalize(facemgr_cfg_rule_t* rule);
-int facemgr_cfg_rule_set_match(facemgr_cfg_rule_t * rule,
- const char * interface_name, netdevice_type_t interface_type);
+int facemgr_cfg_rule_set_match(facemgr_cfg_rule_t* rule,
+ const char* interface_name,
+ netdevice_type_t interface_type);
-int facemgr_cfg_rule_set_face_type(facemgr_cfg_rule_t * cfg_rule, facemgr_face_type_t * face_type);
-int facemgr_cfg_rule_unset_face_type(facemgr_cfg_rule_t * cfg_rule);
+int facemgr_cfg_rule_set_face_type(facemgr_cfg_rule_t* cfg_rule,
+ facemgr_face_type_t* face_type);
+int facemgr_cfg_rule_unset_face_type(facemgr_cfg_rule_t* cfg_rule);
-int facemgr_cfg_rule_set_discovery(facemgr_cfg_rule_t * cfg_rule, bool status);
-int facemgr_cfg_rule_unset_discovery(facemgr_cfg_rule_t * cfg_rule);
+int facemgr_cfg_rule_set_discovery(facemgr_cfg_rule_t* cfg_rule, bool status);
+int facemgr_cfg_rule_unset_discovery(facemgr_cfg_rule_t* cfg_rule);
-int facemgr_cfg_rule_set_ignore(facemgr_cfg_rule_t * cfg_rule, bool status);
-int facemgr_cfg_rule_unset_ignore(facemgr_cfg_rule_t * cfg_rule);
+int facemgr_cfg_rule_set_ignore(facemgr_cfg_rule_t* cfg_rule, bool status);
+int facemgr_cfg_rule_unset_ignore(facemgr_cfg_rule_t* cfg_rule);
-int facemgr_cfg_rule_set_ipv4(facemgr_cfg_rule_t * cfg_rule, bool status);
-int facemgr_cfg_rule_unset_ipv4(facemgr_cfg_rule_t * cfg_rule);
+int facemgr_cfg_rule_set_ipv4(facemgr_cfg_rule_t* cfg_rule, bool status);
+int facemgr_cfg_rule_unset_ipv4(facemgr_cfg_rule_t* cfg_rule);
-int facemgr_cfg_rule_set_ipv6(facemgr_cfg_rule_t * cfg_rule, bool status);
-int facemgr_cfg_rule_unset_ipv6(facemgr_cfg_rule_t * cfg_rule);
+int facemgr_cfg_rule_set_ipv6(facemgr_cfg_rule_t* cfg_rule, bool status);
+int facemgr_cfg_rule_unset_ipv6(facemgr_cfg_rule_t* cfg_rule);
-int facemgr_cfg_rule_set_overlay(facemgr_cfg_rule_t * rule, int family,
- ip_address_t * local_addr, uint16_t local_port,
- ip_address_t * remote_addr, uint16_t remote_port);
-int facemgr_rule_unset_overlay(facemgr_cfg_rule_t * rule, int family);
+int facemgr_cfg_rule_set_overlay(facemgr_cfg_rule_t* rule, int family,
+ ip_address_t* local_addr, uint16_t local_port,
+ ip_address_t* remote_addr,
+ uint16_t remote_port);
+int facemgr_rule_unset_overlay(facemgr_cfg_rule_t* rule, int family);
/* General */
-int facemgr_cfg_set_face_type(facemgr_cfg_t * cfg, facemgr_face_type_t * face_type);
-int facemgr_cfg_unset_face_type(facemgr_cfg_t * cfg);
-int facemgr_cfg_set_discovery(facemgr_cfg_t * cfg, bool status);
-int facemgr_cfg_unset_discovery(facemgr_cfg_t * cfg);
-int facemgr_cfg_set_ipv4(facemgr_cfg_t * cfg, bool status);
-int facemgr_cfg_unset_ipv4(facemgr_cfg_t * cfg);
-int facemgr_cfg_set_ipv6(facemgr_cfg_t * cfg, bool status);
-int facemgr_cfg_unset_ipv6(facemgr_cfg_t * cfg);
-
-int facemgr_cfg_set_overlay(facemgr_cfg_t * cfg, int family,
- ip_address_t * local_addr, uint16_t local_port,
- ip_address_t * remote_addr, uint16_t remote_port);
-int facemgr_cfg_unset_overlay(facemgr_cfg_t * cfg, int family);
-
-
-int facemgr_cfg_add_rule(facemgr_cfg_t * cfg, facemgr_cfg_rule_t * rule);
-int facemgr_cfg_del_rule(facemgr_cfg_t * cfg, facemgr_cfg_rule_t * rule);
-int facemgr_cfg_get_rule(const facemgr_cfg_t * cfg, const char * interface_name,
- netdevice_type_t interface_type, facemgr_cfg_rule_t ** rule);
+int facemgr_cfg_set_face_type(facemgr_cfg_t* cfg,
+ facemgr_face_type_t* face_type);
+int facemgr_cfg_unset_face_type(facemgr_cfg_t* cfg);
+int facemgr_cfg_set_discovery(facemgr_cfg_t* cfg, bool status);
+int facemgr_cfg_unset_discovery(facemgr_cfg_t* cfg);
+int facemgr_cfg_set_ipv4(facemgr_cfg_t* cfg, bool status);
+int facemgr_cfg_unset_ipv4(facemgr_cfg_t* cfg);
+int facemgr_cfg_set_ipv6(facemgr_cfg_t* cfg, bool status);
+int facemgr_cfg_unset_ipv6(facemgr_cfg_t* cfg);
+
+int facemgr_cfg_set_overlay(facemgr_cfg_t* cfg, int family,
+ ip_address_t* local_addr, uint16_t local_port,
+ ip_address_t* remote_addr, uint16_t remote_port);
+int facemgr_cfg_unset_overlay(facemgr_cfg_t* cfg, int family);
+
+int facemgr_cfg_add_rule(facemgr_cfg_t* cfg, facemgr_cfg_rule_t* rule);
+int facemgr_cfg_del_rule(facemgr_cfg_t* cfg, facemgr_cfg_rule_t* rule);
+int facemgr_cfg_get_rule(const facemgr_cfg_t* cfg, const char* interface_name,
+ netdevice_type_t interface_type,
+ facemgr_cfg_rule_t** rule);
/* Log */
@@ -107,57 +109,63 @@ int facemgr_cfg_get_rule(const facemgr_cfg_t * cfg, const char * interface_name,
* Query API
*
* Takes the overrides into account
- *
- * TODO : interface_types are currently not taken into account by this API
*/
-int facemgr_cfg_get_face_type(const facemgr_cfg_t * cfg,
- const netdevice_t * netdevice, netdevice_type_t netdevice_type,
- facemgr_face_type_t * face_type);
-int facemgr_cfg_get_discovery(const facemgr_cfg_t * cfg,
- const netdevice_t * netdevice, netdevice_type_t netdevice_type,
- bool * discovery);
-int facemgr_cfg_get_ignore(const facemgr_cfg_t * cfg,
- const netdevice_t * netdevice, netdevice_type_t netdevice_type,
- bool * ignore);
-int facemgr_cfg_get_ipv4(const facemgr_cfg_t * cfg,
- const netdevice_t * netdevice, netdevice_type_t netdevice_type,
- bool * ipv4);
-int facemgr_cfg_get_ipv6(const facemgr_cfg_t * cfg,
- const netdevice_t * netdevice, netdevice_type_t netdevice_type,
- bool * ipv6);
-int facemgr_cfg_get_overlay_local_addr(const facemgr_cfg_t * cfg,
- const netdevice_t * netdevice, netdevice_type_t netdevice_type,
- int family, ip_address_t * addr);
-int facemgr_cfg_get_overlay_local_port(const facemgr_cfg_t * cfg,
- const netdevice_t * netdevice, netdevice_type_t netdevice_type,
- int family, u16 * port);
-int facemgr_cfg_get_overlay_remote_addr(const facemgr_cfg_t * cfg,
- const netdevice_t * netdevice, netdevice_type_t netdevice_type,
- int family, ip_address_t * addr);
-int facemgr_cfg_get_overlay_remote_port(const facemgr_cfg_t * cfg,
- const netdevice_t * netdevice, netdevice_type_t netdevice_type,
- int family, u16 * port);
-
-int facemgr_cfg_rule_get(const facemgr_cfg_t * cfg, const netdevice_t netdevice,
- netdevice_type_t netdevice_type, facemgr_cfg_rule_t ** rule);
-int facemgr_cfg_rule_get_face_type(const facemgr_cfg_rule_t * cfg_rule, facemgr_face_type_t * face_type);
-int facemgr_cfg_rule_get_discovery(const facemgr_cfg_rule_t * cfg_rule, bool * status);
-int facemgr_cfg_rule_get_ignore(const facemgr_cfg_rule_t * cfg_rule, bool * status);
-int facemgr_cfg_rule_get_ipv4(const facemgr_cfg_rule_t * cfg_rule, bool * status);
-int facemgr_cfg_rule_get_ipv6(const facemgr_cfg_rule_t * cfg_rule, bool * status);
-int facemgr_cfg_rule_get_overlay_local_addr(const facemgr_cfg_rule_t * rule, int family,
- ip_address_t * addr);
-int facemgr_cfg_rule_get_overlay_local_port(const facemgr_cfg_rule_t * rule, int family,
- uint16_t * port);
-int facemgr_cfg_rule_get_overlay_remote_addr(const facemgr_cfg_rule_t * rule, int family,
- ip_address_t * addr);
-int facemgr_cfg_rule_get_overlay_remote_port(const facemgr_cfg_rule_t * rule, int family,
- uint16_t * port);
-
-int facemgr_cfg_add_static_facelet(facemgr_cfg_t * cfg, facelet_t * facelet);
-int facemgr_cfg_remove_static_facelet(facemgr_cfg_t * cfg, facelet_t * facelet,
- facelet_t ** removed_facelet);
-int facemgr_cfg_get_static_facelet_array(const facemgr_cfg_t * cfg, facelet_t *** array);
+int facemgr_cfg_get_face_type(const facemgr_cfg_t* cfg,
+ const netdevice_t* netdevice,
+ netdevice_type_t netdevice_type,
+ facemgr_face_type_t* face_type);
+int facemgr_cfg_get_discovery(const facemgr_cfg_t* cfg,
+ const netdevice_t* netdevice,
+ netdevice_type_t netdevice_type, bool* discovery);
+int facemgr_cfg_get_ignore(const facemgr_cfg_t* cfg,
+ const netdevice_t* netdevice,
+ netdevice_type_t netdevice_type, bool* ignore);
+int facemgr_cfg_get_ipv4(const facemgr_cfg_t* cfg, const netdevice_t* netdevice,
+ netdevice_type_t netdevice_type, bool* ipv4);
+int facemgr_cfg_get_ipv6(const facemgr_cfg_t* cfg, const netdevice_t* netdevice,
+ netdevice_type_t netdevice_type, bool* ipv6);
+int facemgr_cfg_get_overlay_local_addr(const facemgr_cfg_t* cfg,
+ const netdevice_t* netdevice,
+ netdevice_type_t netdevice_type,
+ int family, ip_address_t* addr);
+int facemgr_cfg_get_overlay_local_port(const facemgr_cfg_t* cfg,
+ const netdevice_t* netdevice,
+ netdevice_type_t netdevice_type,
+ int family, u16* port);
+int facemgr_cfg_get_overlay_remote_addr(const facemgr_cfg_t* cfg,
+ const netdevice_t* netdevice,
+ netdevice_type_t netdevice_type,
+ int family, ip_address_t* addr);
+int facemgr_cfg_get_overlay_remote_port(const facemgr_cfg_t* cfg,
+ const netdevice_t* netdevice,
+ netdevice_type_t netdevice_type,
+ int family, u16* port);
+
+int facemgr_cfg_rule_get(const facemgr_cfg_t* cfg, const netdevice_t netdevice,
+ netdevice_type_t netdevice_type,
+ facemgr_cfg_rule_t** rule);
+int facemgr_cfg_rule_get_face_type(const facemgr_cfg_rule_t* cfg_rule,
+ facemgr_face_type_t* face_type);
+int facemgr_cfg_rule_get_discovery(const facemgr_cfg_rule_t* cfg_rule,
+ bool* status);
+int facemgr_cfg_rule_get_ignore(const facemgr_cfg_rule_t* cfg_rule,
+ bool* status);
+int facemgr_cfg_rule_get_ipv4(const facemgr_cfg_rule_t* cfg_rule, bool* status);
+int facemgr_cfg_rule_get_ipv6(const facemgr_cfg_rule_t* cfg_rule, bool* status);
+int facemgr_cfg_rule_get_overlay_local_addr(const facemgr_cfg_rule_t* rule,
+ int family, ip_address_t* addr);
+int facemgr_cfg_rule_get_overlay_local_port(const facemgr_cfg_rule_t* rule,
+ int family, uint16_t* port);
+int facemgr_cfg_rule_get_overlay_remote_addr(const facemgr_cfg_rule_t* rule,
+ int family, ip_address_t* addr);
+int facemgr_cfg_rule_get_overlay_remote_port(const facemgr_cfg_rule_t* rule,
+ int family, uint16_t* port);
+
+int facemgr_cfg_add_static_facelet(facemgr_cfg_t* cfg, facelet_t* facelet);
+int facemgr_cfg_remove_static_facelet(facemgr_cfg_t* cfg, facelet_t* facelet,
+ facelet_t** removed_facelet);
+int facemgr_cfg_get_static_facelet_array(const facemgr_cfg_t* cfg,
+ facelet_t*** array);
#endif /* FACEMGR_CFG_H */
diff --git a/ctrl/facemgr/includes/hicn/facemgr/facelet.h b/ctrl/facemgr/includes/hicn/facemgr/facelet.h
index cfdc5540e..d9c986731 100644
--- a/ctrl/facemgr/includes/hicn/facemgr/facelet.h
+++ b/ctrl/facemgr/includes/hicn/facemgr/facelet.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 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:
@@ -28,7 +28,7 @@
#include <stdbool.h>
-#include <hicn/ctrl/face.h>
+#include <hicn/face.h>
#include <hicn/ctrl/route.h>
#define MAXSZ_FACELET 1024
@@ -36,111 +36,111 @@
#define FACELET_MAX_ERRORS 10
/* NOTE: Any test should be sufficient */
-#define IS_VALID_NETDEVICE(netdevice) ((netdevice.index != 0) && (netdevice.name[0] != '\0'))
+#define IS_VALID_NETDEVICE(netdevice) \
+ ((netdevice.index != 0) && (netdevice.name[0] != '\0'))
typedef struct facelet_s facelet_t;
/* Face type */
#define foreach_face_type_layer \
- _(UNDEFINED) \
- _(3) \
- _(4) \
- _(N)
+ _(UNDEFINED) \
+ _(3) \
+ _(4) \
+ _(N)
typedef enum {
-#define _(x) FACE_TYPE_LAYER_ ## x,
- foreach_face_type_layer
+#define _(x) FACE_TYPE_LAYER_##x,
+ foreach_face_type_layer
#undef _
} face_type_layer_t;
#define foreach_face_type_encap \
- _(UNDEFINED) \
- _(TCP) \
- _(UDP) \
- _(N)
+ _(UNDEFINED) \
+ _(TCP) \
+ _(UDP) \
+ _(N)
typedef enum {
-#define _(x) FACE_TYPE_ENCAP_ ## x,
- foreach_face_type_encap
+#define _(x) FACE_TYPE_ENCAP_##x,
+ foreach_face_type_encap
#undef _
} face_type_encap_t;
typedef struct {
- face_type_layer_t layer;
- face_type_encap_t encap;
+ face_type_layer_t layer;
+ face_type_encap_t encap;
} facemgr_face_type_t;
+extern const char* face_type_layer_str[];
+extern const char* face_type_encap_str[];
-extern const char * face_type_layer_str[];
-extern const char * face_type_encap_str[];
+#define FACEMGR_FACE_TYPE_STR(x) \
+ face_type_layer_str[x.layer], face_type_encap_str[x.encap]
-#define FACEMGR_FACE_TYPE_STR(x) \
- face_type_layer_str[x.layer], face_type_encap_str[x.encap]
+#define FACEMGR_FACE_TYPE_UNDEFINED \
+ (facemgr_face_type_t) { \
+ .layer = FACE_TYPE_LAYER_UNDEFINED, .encap = FACE_TYPE_ENCAP_UNDEFINED, \
+ }
-#define FACEMGR_FACE_TYPE_UNDEFINED (facemgr_face_type_t) { \
- .layer = FACE_TYPE_LAYER_UNDEFINED, \
- .encap = FACE_TYPE_ENCAP_UNDEFINED, \
-}
+#define FACEMGR_FACE_TYPE_NATIVE_UDP \
+ (facemgr_face_type_t) { \
+ .layer = FACE_TYPE_LAYER_3, .encap = FACE_TYPE_ENCAP_UDP, \
+ }
-#define FACEMGR_FACE_TYPE_NATIVE_UDP (facemgr_face_type_t) { \
- .layer = FACE_TYPE_LAYER_3, \
- .encap = FACE_TYPE_ENCAP_UDP, \
-}
+#define FACEMGR_FACE_TYPE_NATIVE_TCP \
+ (facemgr_face_type_t) { \
+ .layer = FACE_TYPE_LAYER_3, .encap = FACE_TYPE_ENCAP_TCP, \
+ }
-#define FACEMGR_FACE_TYPE_NATIVE_TCP (facemgr_face_type_t) { \
- .layer = FACE_TYPE_LAYER_3, \
- .encap = FACE_TYPE_ENCAP_TCP, \
-}
+#define FACEMGR_FACE_TYPE_OVERLAY_UDP \
+ (facemgr_face_type_t) { \
+ .layer = FACE_TYPE_LAYER_4, .encap = FACE_TYPE_ENCAP_UDP, \
+ }
-#define FACEMGR_FACE_TYPE_OVERLAY_UDP (facemgr_face_type_t) { \
- .layer = FACE_TYPE_LAYER_4, \
- .encap = FACE_TYPE_ENCAP_UDP, \
-}
-
-#define FACEMGR_FACE_TYPE_OVERLAY_TCP (facemgr_face_type_t) { \
- .layer = FACE_TYPE_LAYER_4, \
- .encap = FACE_TYPE_ENCAP_TCP, \
-}
+#define FACEMGR_FACE_TYPE_OVERLAY_TCP \
+ (facemgr_face_type_t) { \
+ .layer = FACE_TYPE_LAYER_4, .encap = FACE_TYPE_ENCAP_TCP, \
+ }
/* Facelet status */
-#define foreach_facelet_status \
- _(UNDEFINED) \
- _(DOWN) \
- _(UNCERTAIN) \
- _(INCOMPLETE) \
- _(CREATE) \
- _(CLEAN) \
- _(IGNORED) \
- _(UPDATE) \
- _(DELETE) \
- _(DELETED) \
- _(N)
+#define foreach_facelet_status \
+ _(UNDEFINED) \
+ _(DOWN) \
+ _(UNCERTAIN) \
+ _(INCOMPLETE) \
+ _(CREATE) \
+ _(CLEAN) \
+ _(IGNORED) \
+ _(UPDATE) \
+ _(DELETE) \
+ _(DELETED) \
+ _(N)
typedef enum {
-#define _(x) FACELET_STATUS_ ## x,
- foreach_facelet_status
+#define _(x) FACELET_STATUS_##x,
+ foreach_facelet_status
#undef _
} facelet_status_t;
-extern const char * facelet_status_str[];
+extern const char* facelet_status_str[];
/* Facelet error reason */
-#define foreach_facelet_error_reason \
- _(UNDEFINED) \
- _(UNSPECIFIED_ERROR) \
- _(FORWARDER_OFFLINE) \
- _(PERMISSION_DENIED) \
- _(INTERNAL_ERROR) \
- _(N)
+#define foreach_facelet_error_reason \
+ _(UNDEFINED) \
+ _(UNSPECIFIED_ERROR) \
+ _(FORWARDER_OFFLINE) \
+ _(PERMISSION_DENIED) \
+ _(INTERNAL_ERROR) \
+ _(N)
typedef enum {
-#define _(x) FACELET_ERROR_REASON_ ## x,
- foreach_facelet_error_reason
+#define _(x) FACELET_ERROR_REASON_##x,
+ foreach_facelet_error_reason
#undef _
} facelet_error_reason_t;
-extern const char * facelet_error_reason_str[];
+extern const char* facelet_error_reason_str[];
/* Facelet attribute status */
@@ -148,62 +148,62 @@ extern const char * facelet_error_reason_str[];
* We expect an attribute in the cache to be able to take any value but
* UNDEFINED and N, which facelet events should either be UNSET or CLEAN
*/
-#define foreach_facelet_attr_status \
- _(UNDEFINED, '?') \
- _(UNSET, 'X') \
- _(CLEAN, ' ') \
- _(DIRTY, '*') \
- _(PENDING, 'P') \
- _(CONFLICT, '!') \
- _(N, '-')
+#define foreach_facelet_attr_status \
+ _(UNDEFINED, '?') \
+ _(UNSET, 'X') \
+ _(CLEAN, ' ') \
+ _(DIRTY, '*') \
+ _(PENDING, 'P') \
+ _(CONFLICT, '!') \
+ _(N, '-')
typedef enum {
-#define _(x, y) FACELET_ATTR_STATUS_ ## x,
- foreach_facelet_attr_status
+#define _(x, y) FACELET_ATTR_STATUS_##x,
+ foreach_facelet_attr_status
#undef _
} facelet_attr_status_t;
-extern const char * facelet_attr_status_str[];
-extern const char * facelet_attr_status_str_short[];
+extern const char* facelet_attr_status_str[];
+extern const char* facelet_attr_status_str_short[];
/* Facelet attribute */
#ifdef WITH_POLICY
-#define foreach_facelet_attr \
- _(netdevice_type_t, netdevice_type) \
- _(netdevice_t, netdevice) \
- _(int, family) \
- _(ip_address_t, local_addr) \
- _(u16, local_port) \
- _(ip_address_t, remote_addr) \
- _(u16, remote_port) \
- _(face_state_t, admin_state) \
- _(face_state_t, state) \
- _(u32, priority) \
- _(facemgr_face_type_t, face_type)
+#define foreach_facelet_attr \
+ _(netdevice_type_t, netdevice_type) \
+ _(netdevice_t, netdevice) \
+ _(int, family) \
+ _(ip_address_t, local_addr) \
+ _(u16, local_port) \
+ _(ip_address_t, remote_addr) \
+ _(u16, remote_port) \
+ _(face_state_t, admin_state) \
+ _(face_state_t, state) \
+ _(u32, priority) \
+ _(facemgr_face_type_t, face_type)
#else
-#define foreach_facelet_attr \
- _(netdevice_type_t, netdevice_type) \
- _(netdevice_t, netdevice) \
- _(int, family) \
- _(ip_address_t, local_addr) \
- _(u16, local_port) \
- _(ip_address_t, remote_addr) \
- _(u16, remote_port) \
- _(face_state_t, admin_state) \
- _(face_state_t, state) \
- _(facemgr_face_type_t, face_type)
+#define foreach_facelet_attr \
+ _(netdevice_type_t, netdevice_type) \
+ _(netdevice_t, netdevice) \
+ _(int, family) \
+ _(ip_address_t, local_addr) \
+ _(u16, local_port) \
+ _(ip_address_t, remote_addr) \
+ _(u16, remote_port) \
+ _(face_state_t, admin_state) \
+ _(face_state_t, state) \
+ _(facemgr_face_type_t, face_type)
#endif /* WITH_POLICY */
-#define foreach_facelet_event \
- _(UNDEFINED) \
- _(GET) \
- _(CREATE) \
- _(UPDATE) \
- _(DELETE) \
- _(SET_UP) \
- _(SET_DOWN) \
- _(N)
+#define foreach_facelet_event \
+ _(UNDEFINED) \
+ _(GET) \
+ _(CREATE) \
+ _(UPDATE) \
+ _(DELETE) \
+ _(SET_UP) \
+ _(SET_DOWN) \
+ _(N)
#define MAXSZ_EVENT__ 10
#define MAXSZ_EVENT_ MAXSZ_EVENT_ + 1
@@ -212,37 +212,37 @@ extern const char * facelet_attr_status_str_short[];
* \brief Enumeration of the possible types of event
*/
typedef enum {
-#define _(x) FACELET_EVENT_ ## x,
-foreach_facelet_event
+#define _(x) FACELET_EVENT_##x,
+ foreach_facelet_event
#undef _
} facelet_event_t;
-extern const char * facelet_event_str[];
+extern const char* facelet_event_str[];
/**
* \brief Create a facelet.
*/
-facelet_t * facelet_create();
+facelet_t* facelet_create();
-facelet_t * facelet_create_from_netdevice(netdevice_t * netdevice);
+facelet_t* facelet_create_from_netdevice(netdevice_t* netdevice);
-unsigned facelet_get_id(facelet_t * facelet);
-void facelet_set_id(facelet_t * facelet, unsigned id);
+unsigned facelet_get_id(facelet_t* facelet);
+void facelet_set_id(facelet_t* facelet, unsigned id);
-int facelet_validate_face(const facelet_t * facelet);
+int facelet_validate_face(const facelet_t* facelet);
-facelet_t * facelet_create_from_face(face_t * face);
+facelet_t* facelet_create_from_face(face_t* face);
-void facelet_free(facelet_t * facelet);
+void facelet_free(facelet_t* facelet);
-facelet_t * facelet_dup(const facelet_t * current_facelet);
+facelet_t* facelet_dup(const facelet_t* current_facelet);
-int facelet_cmp(const facelet_t * f1, const facelet_t * f2);
+int facelet_cmp(const facelet_t* f1, const facelet_t* f2);
-bool facelet_equals(const facelet_t * facelet1, const facelet_t * facelet2);
+bool facelet_equals(const facelet_t* facelet1, const facelet_t* facelet2);
/* NOTE: only clean attributes are matched */
-bool facelet_match(const facelet_t * facelet, const facelet_t * facelet_match);
+bool facelet_match(const facelet_t* facelet, const facelet_t* facelet_match);
/**
* \brief Returns whether the specified facelet has all key attributes defined.
@@ -251,55 +251,58 @@ bool facelet_match(const facelet_t * facelet, const facelet_t * facelet_match);
* uniquely identify a facelet, otherwise it is a 'wildcard' facelet
* specification and might match several facelets.
*/
-bool facelet_has_key(const facelet_t * facelet);
+bool facelet_has_key(const facelet_t* facelet);
-#define FACELET_ACCESSORS_H(TYPE, NAME) \
-bool facelet_has_ ## NAME(const facelet_t * facelet); \
-facelet_attr_status_t facelet_get_ ## NAME ## _status(const facelet_t * facelet);\
-void facelet_set_ ## NAME ## _status(facelet_t * facelet, \
- facelet_attr_status_t status); \
-int facelet_get_ ## NAME(const facelet_t * facelet, TYPE * NAME); \
-int facelet_set_ ## NAME(facelet_t * facelet, TYPE NAME); \
-int facelet_unset_ ## NAME(facelet_t * facelet);
+#define FACELET_ACCESSORS_H(TYPE, NAME) \
+ bool facelet_has_##NAME(const facelet_t* facelet); \
+ facelet_attr_status_t facelet_get_##NAME##_status(const facelet_t* facelet); \
+ void facelet_set_##NAME##_status(facelet_t* facelet, \
+ facelet_attr_status_t status); \
+ int facelet_get_##NAME(const facelet_t* facelet, TYPE* NAME); \
+ int facelet_set_##NAME(facelet_t* facelet, TYPE NAME); \
+ int facelet_unset_##NAME(facelet_t* facelet);
#define _(TYPE, NAME) FACELET_ACCESSORS_H(TYPE, NAME)
foreach_facelet_attr
#undef _
-int facelet_get_face(const facelet_t * facelet, face_t ** pface);
+ int
+ facelet_get_face(const facelet_t* facelet, face_t** pface);
-int facelet_merge(facelet_t * facelet, facelet_t * facelet_to_merge);
+int facelet_merge(facelet_t* facelet, facelet_t* facelet_to_merge);
-facelet_status_t facelet_get_status(const facelet_t * facelet);
-void facelet_set_status(facelet_t * facelet, facelet_status_t status);
-void facelet_set_attr_clean(facelet_t * facelet);
+facelet_status_t facelet_get_status(const facelet_t* facelet);
+void facelet_set_status(facelet_t* facelet, facelet_status_t status);
+void facelet_set_attr_clean(facelet_t* facelet);
-void facelet_set_error(facelet_t * facelet, facelet_error_reason_t reason);
-void facelet_unset_error(facelet_t * facelet);
-bool facelet_get_error(const facelet_t * facelet);
+void facelet_set_error(facelet_t* facelet, facelet_error_reason_t reason);
+void facelet_unset_error(facelet_t* facelet);
+bool facelet_get_error(const facelet_t* facelet);
-void facelet_set_bj_done(facelet_t * facelet);
-void facelet_unset_bj_done(facelet_t * facelet);
-bool facelet_is_bj_done(const facelet_t * facelet);
-void facelet_set_au_done(facelet_t * facelet);
-bool facelet_is_au_done(const facelet_t * facelet);
+void facelet_set_bj_done(facelet_t* facelet);
+void facelet_unset_bj_done(facelet_t* facelet);
+bool facelet_is_bj_done(const facelet_t* facelet);
-facelet_event_t facelet_get_event(const facelet_t * facelet);
-void facelet_set_event(facelet_t * facelet, facelet_event_t event);
+facelet_event_t facelet_get_event(const facelet_t* facelet);
+void facelet_set_event(facelet_t* facelet, facelet_event_t event);
-int facelet_add_route(facelet_t * facelet, hicn_route_t * route);
-int facelet_remove_route(facelet_t * facelet, hicn_route_t * route, hicn_route_t ** route_removed);
-int facelet_clear_routes(facelet_t * facelet);
-int facelet_get_route_array(const facelet_t * facelet, hicn_route_t *** route_array);
+int facelet_add_route(facelet_t* facelet, hicn_route_t* route);
+int facelet_remove_route(facelet_t* facelet, hicn_route_t* route,
+ hicn_route_t** route_removed);
+int facelet_clear_routes(facelet_t* facelet);
+int facelet_get_route_array(const facelet_t* facelet,
+ hicn_route_t*** route_array);
-int facelet_snprintf(char * buf, size_t size, const facelet_t * facelet);
+int facelet_snprintf(char* buf, size_t size, const facelet_t* facelet);
-#define DUMP_FACELET(msg, facelet) do { \
- char buf[MAXSZ_FACELET]; \
- facelet_snprintf(buf, MAXSZ_FACELET, facelet); \
- DEBUG("%s : %s", msg, buf); \
-} while(0)
+#define DUMP_FACELET(msg, facelet) \
+ do { \
+ char buf[MAXSZ_FACELET]; \
+ facelet_snprintf(buf, MAXSZ_FACELET, facelet); \
+ DEBUG("%s : %s", msg, buf); \
+ } while (0)
-int facelet_snprintf_json(char * buf, size_t size, const facelet_t * facelet, int indent);
+int facelet_snprintf_json(char* buf, size_t size, const facelet_t* facelet,
+ int indent);
#endif /* FACEMGR_FACELET_H */
diff --git a/ctrl/facemgr/includes/hicn/facemgr/loop.h b/ctrl/facemgr/includes/hicn/facemgr/loop.h
index 752a3b365..3965a1f27 100644
--- a/ctrl/facemgr/includes/hicn/facemgr/loop.h
+++ b/ctrl/facemgr/includes/hicn/facemgr/loop.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2019 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:
@@ -25,23 +25,21 @@
/* fd & timer callbacks */
-typedef int (*fd_callback_t)(void * owner, int fd, void * data);
+typedef int (*fd_callback_t)(void *owner, int fd, void *data);
typedef struct {
- int fd;
- void *owner;
- fd_callback_t callback;
- //int (*callback)(void * owner, int fd, void * data);
- void *data;
+ int fd;
+ void *owner;
+ fd_callback_t callback;
+ void *data;
} fd_callback_data_t;
/* timer callbacks */
typedef struct {
- unsigned delay_ms;
- void *owner;
- fd_callback_t callback;
- //int (*callback)(void * owner, int fd, void * data);
- void *data;
+ unsigned delay_ms;
+ void *owner;
+ fd_callback_t callback;
+ void *data;
} timer_callback_data_t;
/* loop */
@@ -52,33 +50,32 @@ typedef struct loop_s loop_t;
* \brief Creates a main loop
* \return Pointer to the newly created loop, or NULL in case of error
*/
-loop_t * loop_create();
+loop_t *loop_create();
/**
* \brief Releases a loop instance and frees all associated memory
* \param [in] loop - Pointer to the loop instance to free
*/
-void loop_free(loop_t * loop);
+void loop_free(loop_t *loop);
/**
* \brief Runs the loop instance to process events
* \param [in] loop - Pointer to the loop instance
* \return 0 if successful, -1 otherwise
*/
-int loop_dispatch(loop_t * loop);
+int loop_dispatch(loop_t *loop);
/**
* \brief Terminates the dispatching of events
* \param [in] loop - Pointer to the loop instance
*/
-int loop_undispatch(loop_t * loop);
+int loop_undispatch(loop_t *loop);
/**
* \brief Breaks out of the loop
* \param [in] loop - Pointer to the loop instance
*/
-void loop_break(loop_t * loop);
-
+void loop_break(loop_t *loop);
/**
* \brief Callback for loop helpers
@@ -86,6 +83,6 @@ void loop_break(loop_t * loop);
* \param [in] type - Type of service to be requested
* \param [in] data - Service specific data
*/
-int loop_callback(loop_t * loop, facemgr_cb_type_t type, void * data);
+int loop_callback(loop_t *loop, facemgr_cb_type_t type, void *data);
#endif /* FACEMGR_LOOP_H */