aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/src
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2020-01-13 15:12:55 +0100
committerJordan Augé <jordan.auge+fdio@cisco.com>2020-01-13 15:12:55 +0100
commit63312d00f31de987101a3a3edc4939730d269fef (patch)
tree8ebd2b0bddb8d92e2173d1024fe9d14da94a7b90 /ctrl/facemgr/src
parent3f4acd6752d19ebe29fd0b04101fbe5b5199c119 (diff)
[HICN-473] Add getter functions for face manager rule configuration
Change-Id: I8b78694462d2fc5dfc085c9e198a06ca4b93a199 Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl/facemgr/src')
-rw-r--r--ctrl/facemgr/src/cfg.c121
1 files changed, 121 insertions, 0 deletions
diff --git a/ctrl/facemgr/src/cfg.c b/ctrl/facemgr/src/cfg.c
index e324d04c3..9712466a5 100644
--- a/ctrl/facemgr/src/cfg.c
+++ b/ctrl/facemgr/src/cfg.c
@@ -1076,6 +1076,127 @@ facemgr_cfg_get_overlay_remote_port(const facemgr_cfg_t * cfg,
return 0;
}
+int facemgr_cfg_rule_get_face_type(const facemgr_cfg_rule_t * rule,
+ facemgr_face_type_t * face_type)
+{
+ if (!rule->override.is_face_type)
+ return -1;
+ *face_type = rule->override.face_type;
+ return 0;
+}
+
+int facemgr_cfg_rule_get_discovery(const facemgr_cfg_rule_t * rule, bool * discovery)
+{
+ if (!rule->override.is_discovery)
+ return -1;
+ *discovery = rule->override.discovery;
+ return 0;
+}
+
+int facemgr_cfg_rule_get_ignore(const facemgr_cfg_rule_t * rule, bool * ignore)
+{
+ if (!rule->override.is_ignore)
+ return -1;
+ *ignore = rule->override.ignore;
+ return 0;
+}
+
+int facemgr_cfg_rule_get_ipv4(const facemgr_cfg_rule_t * rule, bool * ipv4)
+{
+ if (!rule->override.is_ipv4)
+ return -1;
+ *ipv4 = rule->override.ipv4;
+ return 0;
+}
+
+int facemgr_cfg_rule_get_ipv6(const facemgr_cfg_rule_t * rule, bool * ipv6)
+{
+ if (!rule->override.is_ipv6)
+ return -1;
+ *ipv6 = rule->override.ipv6;
+ return 0;
+}
+
+int facemgr_cfg_rule_get_overlay_local_addr(const facemgr_cfg_rule_t * rule, int family,
+ ip_address_t * addr)
+{
+ facemgr_cfg_overlay_t * overlay = NULL;
+ switch(family) {
+ case AF_INET:
+ overlay = rule->override.overlays.v4;
+ break;
+ case AF_INET6:
+ overlay = rule->override.overlays.v6;
+ break;
+ default:
+ return -1;
+ }
+ if (!overlay->is_local_addr)
+ return -1;
+ *addr = overlay->local_addr;
+ return 0;
+}
+
+int facemgr_cfg_rule_get_overlay_local_port(const facemgr_cfg_rule_t * rule, int family,
+ uint16_t * port)
+{
+ facemgr_cfg_overlay_t * overlay = NULL;
+ switch(family) {
+ case AF_INET:
+ overlay = rule->override.overlays.v4;
+ break;
+ case AF_INET6:
+ overlay = rule->override.overlays.v6;
+ break;
+ default:
+ return -1;
+ }
+ if (!overlay->is_local_port)
+ return -1;
+ *port = overlay->local_port;
+ return 0;
+}
+
+int facemgr_cfg_rule_get_overlay_remote_addr(const facemgr_cfg_rule_t * rule, int family,
+ ip_address_t * addr)
+{
+ facemgr_cfg_overlay_t * overlay = NULL;
+ switch(family) {
+ case AF_INET:
+ overlay = rule->override.overlays.v4;
+ break;
+ case AF_INET6:
+ overlay = rule->override.overlays.v6;
+ break;
+ default:
+ return -1;
+ }
+ if (!overlay->is_remote_addr)
+ return -1;
+ *addr = overlay->remote_addr;
+ return 0;
+}
+
+int facemgr_cfg_rule_get_overlay_remote_port(const facemgr_cfg_rule_t * rule, int family,
+ uint16_t * port)
+{
+ facemgr_cfg_overlay_t * overlay = NULL;
+ switch(family) {
+ case AF_INET:
+ overlay = rule->override.overlays.v4;
+ break;
+ case AF_INET6:
+ overlay = rule->override.overlays.v6;
+ break;
+ default:
+ return -1;
+ }
+ if (!overlay->is_remote_port)
+ return -1;
+ *port = overlay->remote_port;
+ return 0;
+}
+
int
facemgr_cfg_add_static_facelet(facemgr_cfg_t * cfg, facelet_t * facelet)
{