diff options
author | Mauro Sardara <msardara@cisco.com> | 2022-08-26 15:02:12 +0000 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2022-09-01 13:20:29 +0000 |
commit | 940228d74920fbfd6707e1324711164360cca52d (patch) | |
tree | 1810371558a8f3efd5e9eb2e5ac042c98e354d50 /libtransport/src/core/interest.cc | |
parent | 8d7d5327ca86871cdf1d2ce404ca88bb2a58630f (diff) |
feat(hicn-plugin): interest manifest
Ref: HICN-748
Change-Id: Ie403de53a93094dca997cec379db6f5d3ce8e6be
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'libtransport/src/core/interest.cc')
-rw-r--r-- | libtransport/src/core/interest.cc | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/libtransport/src/core/interest.cc b/libtransport/src/core/interest.cc index 777374b09..10e1a6dfa 100644 --- a/libtransport/src/core/interest.cc +++ b/libtransport/src/core/interest.cc @@ -169,31 +169,46 @@ void Interest::encodeSuffixes() { // We assume interest does not hold signature for the moment. auto int_manifest_header = (interest_manifest_header_t *)(writableData() + headerSize()); - int_manifest_header->n_suffixes = (uint32_t)suffix_set_.size(); + + interest_manifest_init(int_manifest_header, name_.getSuffix()); memset(int_manifest_header->request_bitmap, 0xFFFFFFFF, BITMAP_SIZE * sizeof(hicn_uword)); uint32_t *suffix = (uint32_t *)(int_manifest_header + 1); for (auto it = suffix_set_.begin(); it != suffix_set_.end(); it++, suffix++) { - *suffix = *it; + interest_manifest_add_suffix(int_manifest_header, *it); } std::size_t additional_length = sizeof(interest_manifest_header_t) + int_manifest_header->n_suffixes * sizeof(uint32_t); - // Serialize interest manifest - interest_manifest_serialize(int_manifest_header); - append(additional_length); updateLength(); } -void Interest::decodeSuffixes() { - if (!hasManifest()) return; +void Interest::serializeSuffixes() { + if (!hasManifest()) { + return; + } - auto header = (interest_manifest_header_t *)(writableData() + headerSize()); - interest_manifest_deserialize(header); + // We assume interest does not hold signature for the moment. + auto int_manifest_header = + (interest_manifest_header_t *)(writableData() + headerSize()); + // Serialize interest manifest + interest_manifest_serialize(int_manifest_header); +} + +void Interest::deserializeSuffixes() { + if (!hasManifest()) { + return; + } + + // We assume interest does not hold signature for the moment. + auto int_manifest_header = + (interest_manifest_header_t *)(writableData() + headerSize()); + // Serialize interest manifest + interest_manifest_deserialize(int_manifest_header); } uint32_t *Interest::firstSuffix() { |