aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/src/cfg_file.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_file.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_file.c')
-rw-r--r--ctrl/facemgr/src/cfg_file.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/ctrl/facemgr/src/cfg_file.c b/ctrl/facemgr/src/cfg_file.c
index 966e35816..9b5f592dd 100644
--- a/ctrl/facemgr/src/cfg_file.c
+++ b/ctrl/facemgr/src/cfg_file.c
@@ -99,16 +99,16 @@ int parse_config_global(facemgr_cfg_t *cfg, config_setting_t *setting) {
config_setting_t *overlay_v4 = config_setting_get_member(overlay, "ipv4");
if (overlay_v4) {
const char *local_addr_str, *remote_addr_str;
- ip_address_t local_addr = IP_ADDRESS_EMPTY;
- ip_address_t remote_addr = IP_ADDRESS_EMPTY;
- ip_address_t *local_addr_p = NULL;
- ip_address_t *remote_addr_p = NULL;
+ hicn_ip_address_t local_addr = IP_ADDRESS_EMPTY;
+ hicn_ip_address_t remote_addr = IP_ADDRESS_EMPTY;
+ hicn_ip_address_t *local_addr_p = NULL;
+ hicn_ip_address_t *remote_addr_p = NULL;
int local_port = 0;
int remote_port = 0;
if (config_setting_lookup_string(overlay_v4, "local_addr",
&local_addr_str)) {
- if (ip_address_pton(local_addr_str, &local_addr) < 0) {
+ if (hicn_ip_address_pton(local_addr_str, &local_addr) < 0) {
ERROR("Error parsing v4 local addr");
goto ERR;
}
@@ -121,7 +121,7 @@ int parse_config_global(facemgr_cfg_t *cfg, config_setting_t *setting) {
if (config_setting_lookup_string(overlay_v4, "remote_addr",
&remote_addr_str)) {
- if (ip_address_pton(remote_addr_str, &remote_addr) < 0) {
+ if (hicn_ip_address_pton(remote_addr_str, &remote_addr) < 0) {
ERROR("Error parsing v4 remote addr");
goto ERR;
}
@@ -140,16 +140,16 @@ int parse_config_global(facemgr_cfg_t *cfg, config_setting_t *setting) {
config_setting_t *overlay_v6 = config_setting_get_member(overlay, "ipv6");
if (overlay_v6) {
const char *local_addr_str, *remote_addr_str;
- ip_address_t local_addr = IP_ADDRESS_EMPTY;
- ip_address_t remote_addr = IP_ADDRESS_EMPTY;
- ip_address_t *local_addr_p = NULL;
- ip_address_t *remote_addr_p = NULL;
+ hicn_ip_address_t local_addr = IP_ADDRESS_EMPTY;
+ hicn_ip_address_t remote_addr = IP_ADDRESS_EMPTY;
+ hicn_ip_address_t *local_addr_p = NULL;
+ hicn_ip_address_t *remote_addr_p = NULL;
int local_port = 0;
int remote_port = 0;
if (config_setting_lookup_string(overlay_v6, "local_addr",
&local_addr_str)) {
- if (ip_address_pton(local_addr_str, &local_addr) < 0) {
+ if (hicn_ip_address_pton(local_addr_str, &local_addr) < 0) {
ERROR("Error parsing v6 local addr");
goto ERR;
}
@@ -162,7 +162,7 @@ int parse_config_global(facemgr_cfg_t *cfg, config_setting_t *setting) {
if (config_setting_lookup_string(overlay_v6, "remote_addr",
&remote_addr_str)) {
- if (ip_address_pton(remote_addr_str, &remote_addr) < 0) {
+ if (hicn_ip_address_pton(remote_addr_str, &remote_addr) < 0) {
ERROR("Error parsing v6 remote addr");
goto ERR;
}
@@ -353,16 +353,16 @@ int parse_config_rules(facemgr_cfg_t *cfg, config_setting_t *setting) {
config_setting_t *overlay_v4 = config_setting_get_member(overlay, "ipv4");
if (overlay_v4) {
const char *local_addr_str, *remote_addr_str;
- ip_address_t local_addr = IP_ADDRESS_EMPTY;
- ip_address_t remote_addr = IP_ADDRESS_EMPTY;
- ip_address_t *local_addr_p = NULL;
- ip_address_t *remote_addr_p = NULL;
+ hicn_ip_address_t local_addr = IP_ADDRESS_EMPTY;
+ hicn_ip_address_t remote_addr = IP_ADDRESS_EMPTY;
+ hicn_ip_address_t *local_addr_p = NULL;
+ hicn_ip_address_t *remote_addr_p = NULL;
int local_port = 0;
int remote_port = 0;
if (config_setting_lookup_string(overlay_v4, "local_addr",
&local_addr_str)) {
- ip_address_pton(local_addr_str, &local_addr);
+ hicn_ip_address_pton(local_addr_str, &local_addr);
local_addr_p = &local_addr;
}
@@ -372,7 +372,7 @@ int parse_config_rules(facemgr_cfg_t *cfg, config_setting_t *setting) {
if (config_setting_lookup_string(overlay_v4, "remote_addr",
&remote_addr_str)) {
- ip_address_pton(remote_addr_str, &remote_addr);
+ hicn_ip_address_pton(remote_addr_str, &remote_addr);
remote_addr_p = &remote_addr;
}
@@ -390,16 +390,16 @@ int parse_config_rules(facemgr_cfg_t *cfg, config_setting_t *setting) {
config_setting_t *overlay_v6 = config_setting_get_member(overlay, "ipv6");
if (overlay_v6) {
const char *local_addr_str, *remote_addr_str;
- ip_address_t local_addr = IP_ADDRESS_EMPTY;
- ip_address_t remote_addr = IP_ADDRESS_EMPTY;
- ip_address_t *local_addr_p = NULL;
- ip_address_t *remote_addr_p = NULL;
+ hicn_ip_address_t local_addr = IP_ADDRESS_EMPTY;
+ hicn_ip_address_t remote_addr = IP_ADDRESS_EMPTY;
+ hicn_ip_address_t *local_addr_p = NULL;
+ hicn_ip_address_t *remote_addr_p = NULL;
int local_port = 0;
int remote_port = 0;
if (config_setting_lookup_string(overlay_v6, "local_addr",
&local_addr_str)) {
- ip_address_pton(local_addr_str, &local_addr);
+ hicn_ip_address_pton(local_addr_str, &local_addr);
local_addr_p = &local_addr;
}
@@ -409,7 +409,7 @@ int parse_config_rules(facemgr_cfg_t *cfg, config_setting_t *setting) {
if (config_setting_lookup_string(overlay_v6, "remote_addr",
&remote_addr_str)) {
- ip_address_pton(remote_addr_str, &remote_addr);
+ hicn_ip_address_pton(remote_addr_str, &remote_addr);
remote_addr_p = &remote_addr;
}
@@ -450,7 +450,7 @@ int parse_config_static_facelets(facemgr_cfg_t *cfg,
const char *family_str;
int family;
const char *remote_addr_str;
- ip_address_t remote_addr = IP_ADDRESS_EMPTY;
+ hicn_ip_address_t remote_addr = IP_ADDRESS_EMPTY;
int remote_port = 0;
const char *interface_name;
const char *interface_type_str;
@@ -496,7 +496,7 @@ int parse_config_static_facelets(facemgr_cfg_t *cfg,
/* Remote address */
if (config_setting_lookup_string(static_setting, "remote_addr",
&remote_addr_str)) {
- if (ip_address_pton(remote_addr_str, &remote_addr) < 0) {
+ if (hicn_ip_address_pton(remote_addr_str, &remote_addr) < 0) {
ERROR("Error parsing v4 remote addr");
goto ERR_FACELET;
}
@@ -554,12 +554,12 @@ int parse_config_static_facelets(facemgr_cfg_t *cfg,
config_setting_get_elem(routes_static_setting, j);
const char *prefix_str;
- ip_prefix_t prefix;
+ hicn_ip_prefix_t prefix;
int cost = 0; /* default */
if (config_setting_lookup_string(route_static_setting, "prefix",
&prefix_str)) {
- if (ip_prefix_pton(prefix_str, &prefix) < 0) {
+ if (hicn_ip_prefix_pton(prefix_str, &prefix) < 0) {
ERROR("Error parsing prefix in route #%d, rule #%d", j, i);
goto ERR_FACELET;
}