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/portal.h | |
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/portal.h')
-rw-r--r-- | libtransport/src/core/portal.h | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/libtransport/src/core/portal.h b/libtransport/src/core/portal.h index f2380347b..d4fbb3442 100644 --- a/libtransport/src/core/portal.h +++ b/libtransport/src/core/portal.h @@ -319,8 +319,8 @@ class Portal : public ::utils::NonCopyable, uint32_t initial_hash = interest->getName().getHash32(false); auto hash = initial_hash + interest->getName().getSuffix(); uint32_t seq = interest->getName().getSuffix(); - const uint32_t *suffix = interest->firstSuffix(); - auto n_suffixes = interest->numberOfSuffixes(); + const uint32_t *suffix = interest->firstSuffix() + 1; + auto n_suffixes = interest->numberOfSuffixes() - 1; uint32_t counter = 0; // Set timers do { @@ -412,9 +412,10 @@ class Portal : public ::utils::NonCopyable, UNSET_CALLBACK) { DCHECK(std::this_thread::get_id() == worker_.getThreadId()); - io_module_->send(*interest); addInterestToPIT(interest, lifetime, std::move(on_content_object_callback), std::move(on_interest_timeout_callback)); + interest->serializeSuffixes(); + io_module_->send(*interest); } /** @@ -541,6 +542,22 @@ class Portal : public ::utils::NonCopyable, pending_interest_hash_table_.clear(); } + void dumpPIT() { + std::vector<Name> sorted_elements; + for (const auto &[key, value] : pending_interest_hash_table_) { + sorted_elements.push_back(value.getInterestReference()->getName()); + } + + std::sort(sorted_elements.begin(), sorted_elements.end(), + [](const Name &a, const Name &b) { + return a.getSuffix() < b.getSuffix(); + }); + + for (auto &elt : sorted_elements) { + LOG(INFO) << elt; + } + } + /** * Callback called by the underlying connector upon reception of a packet * from the local forwarder. @@ -620,6 +637,7 @@ class Portal : public ::utils::NonCopyable, DLOG_IF(INFO, VLOG_IS_ON(3)) << "processInterest " << interest.getName(); // Save interest in PIT + interest.deserializeSuffixes(); addInterestToPIT(interest.shared_from_this(), interest.getLifetime()); if (TRANSPORT_EXPECT_TRUE(transport_callback_ != nullptr)) { transport_callback_->onInterest(interest); |