aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/src/cfg.c
diff options
context:
space:
mode:
authorLuca Muscariello <muscariello@ieee.org>2022-08-04 16:06:34 +0200
committerLuca Muscariello <muscariello@ieee.org>2022-08-04 16:31:51 +0200
commit6d22a0db96aa7f8e3102ae44d00c09e36a2e9c57 (patch)
tree79546bbf09f6fbf74db7bc89117843f06ce937ea /ctrl/facemgr/src/cfg.c
parent012843b1c0bc0838e69085ed83a79ec8b6f97360 (diff)
feat: Due to the deep modifications related to names and packet format,
this task cover a large part of the codebase and involves several changes: - the library provides a name data structure (hicn_name_t ), which is composed of a name prefix (hicn_name_prefix_t) and a name suffix (hicn_name_suffix_t), and it has been extended to provide all support functions required for name manipulation, including common prefix computation, as required for the Longest Prefix Match (LPM)in the forwarder, in addition to Exact Prefix Match (EPM). - all code has been rewritten to use this data structure instead of having for instance the forwarder define its own name class (used to be Name and NameBitVector) the code has been refactored to minimize name allocations and copies, one remaining aspect is the difference of name storage between PIT and CS entries (respectively in the PIT entry, and in the message buffer), which causes the packet cache index to be updated when a PIT entry is converted into a CS entry. By storing the name in the PIT/CS entry everytime, we might save on this operation). - hicn-light FIB has been rewritten : code has been refactored and should now be shorter and documented; unit tests have been drafted but more would be required to cover all cases and match the algorithms to add/remove nodes, as specified in the doc. all protocol details and hICN header formats are now abstracted by the library for the forwarder (and thus header.h and  protocols/*.h have been removed from public includes, and replaced by packet.h providing protocol agnostic packet level functions, completely replacing the compat.h header that used to provide similar functions. - this works by exposing a opaque buffer to the application (a kind of socket buffer) which is used by the lib to cache the packet format and offsets of the different layers in the buffer and provider efficient operations (the packet format is either defined for packet construction, or guessed at ingress, and this structure is updated accordingly only once). Co-authored-by: Jordan Augé <jordan.auge+fdio@cisco.com> Signed-off-by: Luca Muscariello <muscariello@ieee.org> Change-Id: I31e321897f85f0267fe8ba4720363c180564492f
Diffstat (limited to 'ctrl/facemgr/src/cfg.c')
-rw-r--r--ctrl/facemgr/src/cfg.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/ctrl/facemgr/src/cfg.c b/ctrl/facemgr/src/cfg.c
index 76e1f5e72..87a6279ca 100644
--- a/ctrl/facemgr/src/cfg.c
+++ b/ctrl/facemgr/src/cfg.c
@@ -17,11 +17,11 @@ typedef struct {
bool is_local_port;
uint16_t local_port;
bool is_local_addr;
- ip_address_t local_addr;
+ hicn_ip_address_t local_addr;
bool is_remote_port;
uint16_t remote_port;
bool is_remote_addr;
- ip_address_t remote_addr;
+ hicn_ip_address_t remote_addr;
} facemgr_cfg_overlay_t;
int facemgr_cfg_overlay_initialize(facemgr_cfg_overlay_t *overlay) {
@@ -185,8 +185,8 @@ void facemgr_cfg_rule_dump(facemgr_cfg_rule_t *rule) {
DEBUG(" <ipv4>");
if (rule->override.overlays.v4->is_local_addr) {
char buf[MAXSZ_IP_ADDRESS];
- ip_address_snprintf(buf, MAXSZ_IP_ADDRESS,
- &rule->override.overlays.v4->local_addr, AF_INET);
+ hicn_ip_address_snprintf(buf, MAXSZ_IP_ADDRESS,
+ &rule->override.overlays.v4->local_addr);
DEBUG(" <local_addr>%s</local_addr>", buf);
}
if (rule->override.overlays.v4->is_local_port) {
@@ -195,8 +195,8 @@ void facemgr_cfg_rule_dump(facemgr_cfg_rule_t *rule) {
}
if (rule->override.overlays.v4->is_remote_addr) {
char buf[MAXSZ_IP_ADDRESS];
- ip_address_snprintf(buf, MAXSZ_IP_ADDRESS,
- &rule->override.overlays.v4->remote_addr, AF_INET);
+ hicn_ip_address_snprintf(buf, MAXSZ_IP_ADDRESS,
+ &rule->override.overlays.v4->remote_addr);
DEBUG(" <remote_addr>%s</remote_addr>", buf);
}
if (rule->override.overlays.v4->is_remote_port) {
@@ -209,8 +209,8 @@ void facemgr_cfg_rule_dump(facemgr_cfg_rule_t *rule) {
DEBUG(" <ipv6>");
if (rule->override.overlays.v6->is_local_addr) {
char buf[MAXSZ_IP_ADDRESS];
- ip_address_snprintf(buf, MAXSZ_IP_ADDRESS,
- &rule->override.overlays.v6->local_addr, AF_INET6);
+ hicn_ip_address_snprintf(buf, MAXSZ_IP_ADDRESS,
+ &rule->override.overlays.v6->local_addr);
DEBUG(" <local_addr>%s</local_addr>", buf);
}
if (rule->override.overlays.v6->is_local_port) {
@@ -219,8 +219,8 @@ void facemgr_cfg_rule_dump(facemgr_cfg_rule_t *rule) {
}
if (rule->override.overlays.v6->is_remote_addr) {
char buf[MAXSZ_IP_ADDRESS];
- ip_address_snprintf(buf, MAXSZ_IP_ADDRESS,
- &rule->override.overlays.v6->remote_addr, AF_INET6);
+ hicn_ip_address_snprintf(buf, MAXSZ_IP_ADDRESS,
+ &rule->override.overlays.v6->remote_addr);
DEBUG(" <remote_addr>%s</remote_addr>", buf);
}
if (rule->override.overlays.v6->is_remote_port) {
@@ -300,8 +300,9 @@ int facemgr_cfg_rule_unset_ipv6(facemgr_cfg_rule_t *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,
+ hicn_ip_address_t *local_addr,
+ uint16_t local_port,
+ hicn_ip_address_t *remote_addr,
uint16_t remote_port) {
if ((family != AF_INET) && (family != AF_INET6)) return -1;
@@ -546,8 +547,9 @@ 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) {
+ hicn_ip_address_t *local_addr, uint16_t local_port,
+ hicn_ip_address_t *remote_addr,
+ uint16_t remote_port) {
if ((family != AF_INET) && (family != AF_INET6)) return -1;
facemgr_cfg_overlay_t *overlay = facemgr_cfg_overlay_create();
@@ -589,7 +591,7 @@ int facemgr_cfg_set_overlay(facemgr_cfg_t *cfg, int family,
DEBUG(" <ipv4>");
if (overlay->is_local_addr) {
char buf[MAXSZ_IP_ADDRESS];
- ip_address_snprintf(buf, MAXSZ_IP_ADDRESS, &overlay->local_addr, AF_INET);
+ hicn_ip_address_snprintf(buf, MAXSZ_IP_ADDRESS, &overlay->local_addr);
DEBUG(" <local_addr>%s</local_addr>", buf);
}
if (overlay->is_local_port) {
@@ -597,8 +599,7 @@ int facemgr_cfg_set_overlay(facemgr_cfg_t *cfg, int family,
}
if (overlay->is_remote_addr) {
char buf[MAXSZ_IP_ADDRESS];
- ip_address_snprintf(buf, MAXSZ_IP_ADDRESS, &overlay->remote_addr,
- AF_INET);
+ hicn_ip_address_snprintf(buf, MAXSZ_IP_ADDRESS, &overlay->remote_addr);
DEBUG(" <remote_addr>%s</remote_addr>", buf);
}
if (overlay->is_remote_port) {
@@ -803,7 +804,7 @@ int facemgr_cfg_get_ignore(const facemgr_cfg_t *cfg,
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 family, hicn_ip_address_t *addr) {
facemgr_cfg_override_t *override;
int rc = facemgr_cfg_get_override(cfg, netdevice, netdevice_type, &override);
if (rc < 0) return rc;
@@ -889,7 +890,7 @@ int facemgr_cfg_get_overlay_local_port(const facemgr_cfg_t *cfg,
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 family, hicn_ip_address_t *addr) {
facemgr_cfg_override_t *override;
int rc = facemgr_cfg_get_override(cfg, netdevice, netdevice_type, &override);
if (rc < 0) return rc;
@@ -1042,7 +1043,8 @@ int facemgr_cfg_rule_get_ipv6(const facemgr_cfg_rule_t *rule, bool *ipv6) {
}
int facemgr_cfg_rule_get_overlay_local_addr(const facemgr_cfg_rule_t *rule,
- int family, ip_address_t *addr) {
+ int family,
+ hicn_ip_address_t *addr) {
facemgr_cfg_overlay_t *overlay = NULL;
switch (family) {
case AF_INET:
@@ -1078,7 +1080,8 @@ int facemgr_cfg_rule_get_overlay_local_port(const facemgr_cfg_rule_t *rule,
}
int facemgr_cfg_rule_get_overlay_remote_addr(const facemgr_cfg_rule_t *rule,
- int family, ip_address_t *addr) {
+ int family,
+ hicn_ip_address_t *addr) {
facemgr_cfg_overlay_t *overlay = NULL;
switch (family) {
case AF_INET: