aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src/core
diff options
context:
space:
mode:
authorEnrico Loparco (eloparco) <eloparco@cisco.com>2022-09-14 08:58:55 +0000
committerEnrico Loparco (eloparco) <eloparco@cisco.com>2022-09-14 13:42:31 +0000
commitab38321508d886f0acd535f0f5f07a3d44e29591 (patch)
treea46dedcd2dce871cf8c381fd06e3c00c46cd3b27 /libtransport/src/core
parent6c9f120f028bcca93fd087afa648f653b208eb35 (diff)
feat(hicn-ping): allow usage of random prefixes/suffixes in hicn-ping
Ref: HICN-783 Signed-off-by: Enrico Loparco (eloparco) <eloparco@cisco.com> Change-Id: I41c804dd639ee15aee9619732f55e39a3baf1385
Diffstat (limited to 'libtransport/src/core')
-rw-r--r--libtransport/src/core/interest.cc10
-rw-r--r--libtransport/src/core/name.cc7
2 files changed, 14 insertions, 3 deletions
diff --git a/libtransport/src/core/interest.cc b/libtransport/src/core/interest.cc
index 6348a8d3e..c3eb7c379 100644
--- a/libtransport/src/core/interest.cc
+++ b/libtransport/src/core/interest.cc
@@ -170,9 +170,6 @@ void Interest::encodeSuffixes() {
(interest_manifest_header_t *)(writableData() + headerSize());
interest_manifest_init(int_manifest_header, name_.getSuffix());
- memset(int_manifest_header->request_bitmap, 0xFFFFFFFF,
- BITMAP_SIZE * sizeof(hicn_uword));
-
for (auto it = suffix_set_.begin(); it != suffix_set_.end(); it++) {
interest_manifest_add_suffix(int_manifest_header, *it);
}
@@ -237,6 +234,13 @@ hicn_uword *Interest::getRequestBitmap() {
return header->request_bitmap;
}
+interest_manifest_header_t *Interest::getIntManifestHeader() {
+ if (!hasManifest()) return nullptr;
+
+ auto header = (interest_manifest_header_t *)(writableData() + headerSize());
+ return header;
+};
+
void Interest::setRequestBitmap(const uint32_t *request_bitmap) {
if (!hasManifest()) return;
diff --git a/libtransport/src/core/name.cc b/libtransport/src/core/name.cc
index 02cc79be6..4f8ba7873 100644
--- a/libtransport/src/core/name.cc
+++ b/libtransport/src/core/name.cc
@@ -168,6 +168,13 @@ hicn_ip_prefix_t Name::toIpAddress() const {
return ret;
}
+std::string Name::getPrefix() const {
+ char prefix[MAXSZ_HICN_NAME];
+ hicn_name_no_suffix_snprintf(prefix, MAXSZ_HICN_NAME, &name_);
+
+ return std::string(prefix);
+}
+
int Name::getAddressFamily() const {
int ret = 0;