diff options
author | Mauro Sardara <msardara@cisco.com> | 2022-07-08 16:10:13 +0000 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2022-08-10 11:57:10 +0200 |
commit | 8f0a8bf572b9b8123121338a31462440bad65857 (patch) | |
tree | ecac67f0ad005b2eb0a1bd25c8f242497ffddea1 /hicn-light | |
parent | 8d27045832427a0ea345f48bfb2c42f46a357af1 (diff) |
feat: add interest manifest serialization/deserialization
Also:
add helpers for interest manifest
Ref: HICN-738
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Change-Id: Ia531605148e00ccbe446da0f4f2d8caae2b098be
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'hicn-light')
-rw-r--r-- | hicn-light/src/hicn/core/forwarder.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/hicn-light/src/hicn/core/forwarder.c b/hicn-light/src/hicn/core/forwarder.c index 482e3d6f1..14f1649fa 100644 --- a/hicn-light/src/hicn/core/forwarder.c +++ b/hicn-light/src/hicn/core/forwarder.c @@ -790,9 +790,18 @@ static interest_manifest_header_t *_forwarder_get_interest_manifest( if (payload_type != HPT_MANIFEST) return NULL; rc = hicn_packet_get_payload(pkbuf, &payload, &payload_size, false); - _ASSERT(rc == HICN_LIB_ERROR_NONE); + assert(rc == HICN_LIB_ERROR_NONE); + + interest_manifest_header_t *int_manifest_header = + (interest_manifest_header_t *)payload; - return (interest_manifest_header_t *)payload; + // Deserialize intrest mmanifest + interest_manifest_deserialize(int_manifest_header); + + if (!interest_manifest_is_valid(int_manifest_header, payload_size)) + return NULL; + + return int_manifest_header; } // Manifest is split using splitting strategy, then every @@ -901,6 +910,9 @@ int _forwarder_forward_aggregated_interest( { pit_entry_egress_add(pit_entry, nexthop); }); } + // Serialize manifest before sending it + interest_manifest_serialize(int_manifest_header); + if (forwarder_forward_to_nexthops(forwarder, msgbuf_id, nexthops) <= 0) { ERROR("Message %p returned an empty next hop set", msgbuf); |