diff options
author | Jordan Augé <jordan.auge+fdio@cisco.com> | 2019-11-05 14:18:34 +0100 |
---|---|---|
committer | Jordan Augé <jordan.auge+fdio@cisco.com> | 2019-11-12 00:16:27 +0100 |
commit | 955e71001bd6d360805d2b33a9e6b9d6fd17397f (patch) | |
tree | d9feee8a560033d25b8f939dd1d9690ea87d504e /ctrl/facemgr/includes | |
parent | f4f2f44072344bbf6083840f4df0dfaea5247c50 (diff) |
[HICN-376] Add manual connection/route setting to face manager
Change-Id: I5c24f687e8e815d0e2f437ff8ce7fbb2c76e0579
Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl/facemgr/includes')
-rw-r--r-- | ctrl/facemgr/includes/hicn/facemgr/cfg.h | 62 | ||||
-rw-r--r-- | ctrl/facemgr/includes/hicn/facemgr/facelet.h | 67 |
2 files changed, 72 insertions, 57 deletions
diff --git a/ctrl/facemgr/includes/hicn/facemgr/cfg.h b/ctrl/facemgr/includes/hicn/facemgr/cfg.h index 525e1a9e3..9d227f30a 100644 --- a/ctrl/facemgr/includes/hicn/facemgr/cfg.h +++ b/ctrl/facemgr/includes/hicn/facemgr/cfg.h @@ -21,64 +21,9 @@ #define FACEMGR_CFG_H #include <hicn/ctrl/face.h> +#include <hicn/facemgr/facelet.h> #include <hicn/util/log.h> -/* Face type */ - -#define foreach_face_type_layer \ - _(UNDEFINED) \ - _(3) \ - _(4) \ - _(N) - -typedef enum { -#define _(x) FACE_TYPE_LAYER_ ## x, - foreach_face_type_layer -#undef _ -} face_type_layer_t; - -#define foreach_face_type_encap \ - _(UNDEFINED) \ - _(TCP) \ - _(UDP) \ - _(N) - -typedef enum { -#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; -} facemgr_face_type_t; - -#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_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_TCP (facemgr_face_type_t) { \ - .layer = FACE_TYPE_LAYER_4, \ - .encap = FACE_TYPE_ENCAP_TCP, \ -} - /* Face manager configuration */ #ifdef __ANDROID__ @@ -194,4 +139,9 @@ 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_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 7fc2745f1..476858eff 100644 --- a/ctrl/facemgr/includes/hicn/facemgr/facelet.h +++ b/ctrl/facemgr/includes/hicn/facemgr/facelet.h @@ -29,7 +29,7 @@ #include <stdbool.h> #include <hicn/ctrl/face.h> -#include <hicn/facemgr/cfg.h> +#include <hicn/ctrl/route.h> #define MAXSZ_FACELET 1024 @@ -38,6 +38,63 @@ typedef struct facelet_s facelet_t; +/* Face type */ + +#define foreach_face_type_layer \ + _(UNDEFINED) \ + _(3) \ + _(4) \ + _(N) + +typedef enum { +#define _(x) FACE_TYPE_LAYER_ ## x, + foreach_face_type_layer +#undef _ +} face_type_layer_t; + +#define foreach_face_type_encap \ + _(UNDEFINED) \ + _(TCP) \ + _(UDP) \ + _(N) + +typedef enum { +#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; +} facemgr_face_type_t; + +#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_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_TCP (facemgr_face_type_t) { \ + .layer = FACE_TYPE_LAYER_4, \ + .encap = FACE_TYPE_ENCAP_TCP, \ +} + + /* Facelet status */ #define foreach_facelet_status \ _(UNDEFINED) \ @@ -133,6 +190,8 @@ facelet_t * facelet_create(); facelet_t * facelet_create_from_netdevice(netdevice_t * netdevice); +void facelet_set_id(facelet_t * facelet, unsigned id); + int facelet_validate_face(const facelet_t * facelet); facelet_t * facelet_create_from_face(face_t * face); @@ -143,6 +202,8 @@ facelet_t * facelet_dup(const facelet_t * current_facelet); int facelet_cmp(const facelet_t * f1, const facelet_t * f2); +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); @@ -185,6 +246,10 @@ bool facelet_is_au_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); +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_get_route_array(const facelet_t * facelet, hicn_route_t *** route_array); + int facelet_snprintf(char * buf, size_t size, const facelet_t * facelet); #define DUMP_FACELET(msg, facelet) do { \ |