aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2022-09-30 12:29:05 +0200
committerJordan Augé <jordan.auge+fdio@cisco.com>2022-10-07 17:30:19 +0200
commita61398ad90acdfa4ea0ac03f3d2b9bcbfd7a6dd3 (patch)
tree64cc24594bf2a010691371e16881586830b4b760 /lib
parent3476dd9ddecc87d9212c3bf56a5be52079e27def (diff)
refactor(hicn-light): cleanup and optimizations to UDP socket face
Ticket: HICN-771 Change-Id: Ie84dc2f61888c3fdd7b3728b2a13cacbac503d1a Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/includes/hicn/util/ip_address.h2
-rw-r--r--lib/src/face.c6
-rw-r--r--lib/src/util/ip_address.c6
3 files changed, 12 insertions, 2 deletions
diff --git a/lib/includes/hicn/util/ip_address.h b/lib/includes/hicn/util/ip_address.h
index 55d5f5fc3..979efaa40 100644
--- a/lib/includes/hicn/util/ip_address.h
+++ b/lib/includes/hicn/util/ip_address.h
@@ -189,6 +189,8 @@ bool hicn_ip_address_match_family (const hicn_ip_address_t *address,
uint32_t hicn_ip_address_get_hash (const hicn_ip_address_t *address);
+void hicn_ip_address_clear (hicn_ip_address_t *address);
+
/* Prefix */
int hicn_ip_prefix_pton (const char *ip_address_str,
diff --git a/lib/src/face.c b/lib/src/face.c
index 832cd0936..81395c4b1 100644
--- a/lib/src/face.c
+++ b/lib/src/face.c
@@ -447,7 +447,9 @@ get_protocol (face_type_t face_type)
case FACE_TYPE_UDP_LISTENER:
return FACE_PROTOCOL_UDP;
- default:
- return FACE_PROTOCOL_UNKNOWN;
+ case FACE_TYPE_UNDEFINED:
+ case FACE_TYPE_N:
+ break;
}
+ return FACE_PROTOCOL_UNKNOWN;
}
diff --git a/lib/src/util/ip_address.c b/lib/src/util/ip_address.c
index 3624a6fca..b50864c96 100644
--- a/lib/src/util/ip_address.c
+++ b/lib/src/util/ip_address.c
@@ -241,6 +241,12 @@ hicn_ip_address_empty (const hicn_ip_address_t *ip)
return (memcmp (ip, &IP_ADDRESS_EMPTY, sizeof (hicn_ip_address_t)) == 0);
}
+void
+hicn_ip_address_clear (hicn_ip_address_t *address)
+{
+ memset (address, 0, sizeof (hicn_ip_address_t));
+}
+
/* Prefix */
/* Parse IP Prefixes in presentation format (in bits, separated by a slash) */