From d3ae85dbad518da84d0ef5ba61b81108e40f84f3 Mon Sep 17 00:00:00 2001 From: ashiqopu Date: Sun, 17 Feb 2019 02:29:55 +0000 Subject: [PATCH] pit: add EndpointId field in in-record and out-record refs: #4842 Change-Id: Id4bca4ad9c2d7c8a2fd975c0b052fb9271b6e47d --- daemon/fw/access-strategy.cpp | 4 +- daemon/fw/asf-measurements.cpp | 2 +- daemon/fw/best-route-strategy2.cpp | 4 +- daemon/fw/forwarder.cpp | 16 +++--- daemon/fw/multicast-strategy.cpp | 2 +- daemon/fw/ncc-strategy.cpp | 2 +- daemon/fw/process-nack-traits.cpp | 4 +- daemon/fw/retx-suppression-exponential.cpp | 4 +- daemon/fw/self-learning-strategy.cpp | 8 +-- daemon/fw/strategy.cpp | 2 +- daemon/table/cleanup.cpp | 2 +- daemon/table/pit-entry.cpp | 53 ++++++++++++----- daemon/table/pit-entry.hpp | 28 +++++---- daemon/table/pit-face-record.cpp | 7 ++- daemon/table/pit-face-record.hpp | 17 ++++-- daemon/table/pit-in-record.cpp | 8 +-- daemon/table/pit-in-record.hpp | 7 +-- daemon/table/pit-out-record.cpp | 8 +-- daemon/table/pit-out-record.hpp | 9 ++- daemon/table/pit.cpp | 7 +-- daemon/table/pit.hpp | 6 +- tests/daemon/fw/algorithm.t.cpp | 38 ++++++------- tests/daemon/fw/asf-measurements.t.cpp | 6 +- tests/daemon/fw/asf-strategy.t.cpp | 8 +-- tests/daemon/fw/best-route-strategy2.t.cpp | 6 +- tests/daemon/fw/forwarder.t.cpp | 36 ++++++------ tests/daemon/fw/multicast-strategy.t.cpp | 6 +- tests/daemon/fw/ncc-strategy.t.cpp | 20 +++---- tests/daemon/fw/pit-expiry.t.cpp | 10 ++-- tests/daemon/fw/retx-suppression.t.cpp | 60 ++++++++++---------- tests/daemon/fw/strategy-nack-return.t.cpp | 38 ++++++------- tests/daemon/fw/strategy-no-route.t.cpp | 2 +- tests/daemon/fw/strategy-scope-control.t.cpp | 18 +++--- tests/daemon/fw/strategy-tester.hpp | 8 +-- tests/daemon/table/cleanup.t.cpp | 20 +++---- tests/daemon/table/pit-entry.t.cpp | 32 +++++------ 36 files changed, 272 insertions(+), 236 deletions(-) diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp index 13560a9b..b07211b6 100644 --- a/daemon/fw/access-strategy.cpp +++ b/daemon/fw/access-strategy.cpp @@ -176,7 +176,7 @@ AccessStrategy::afterRtoTimeout(weak_ptr pitWeak, FaceId inFaceId, F return; } - auto inRecord = pitEntry->getInRecord(*inFace); + auto inRecord = pitEntry->getInRecord(*inFace, 0); BOOST_ASSERT(inRecord != pitEntry->in_end()); // in-record is erased only if Interest is satisfied, and RTO timer should have been cancelled // note: if this strategy is extended to send Nacks, that would also erase in-record, @@ -225,7 +225,7 @@ AccessStrategy::beforeSatisfyInterest(const shared_ptr& pitEntry, return; } - auto outRecord = pitEntry->getOutRecord(inFace); + auto outRecord = pitEntry->getOutRecord(inFace, 0); if (outRecord == pitEntry->out_end()) { // no out-record NFD_LOG_DEBUG(pitEntry->getInterest() << " dataFrom " << inFace.getId() << " no-out-record"); diff --git a/daemon/fw/asf-measurements.cpp b/daemon/fw/asf-measurements.cpp index 63020201..17771e00 100644 --- a/daemon/fw/asf-measurements.cpp +++ b/daemon/fw/asf-measurements.cpp @@ -114,7 +114,7 @@ void FaceInfo::recordRtt(const shared_ptr& pitEntry, const Face& inFace) { // Calculate RTT - pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(inFace); + pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(inFace, 0); if (outRecord == pitEntry->out_end()) { // no out-record NFD_LOG_TRACE(pitEntry->getInterest() << " dataFrom inFace=" << inFace.getId() << " no-out-record"); diff --git a/daemon/fw/best-route-strategy2.cpp b/daemon/fw/best-route-strategy2.cpp index 03f27dc0..7a1f0639 100644 --- a/daemon/fw/best-route-strategy2.cpp +++ b/daemon/fw/best-route-strategy2.cpp @@ -88,7 +88,7 @@ isNextHopEligible(const Face& inFace, const Interest& interest, if (wantUnused) { // nexthop must not have unexpired out-record - auto outRecord = pitEntry->getOutRecord(outFace); + auto outRecord = pitEntry->getOutRecord(outFace, 0); if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) { return false; } @@ -112,7 +112,7 @@ findEligibleNextHopWithEarliestOutRecord(const Face& inFace, const Interest& int if (!isNextHopEligible(inFace, interest, *it, pitEntry)) continue; - auto outRecord = pitEntry->getOutRecord(it->getFace()); + auto outRecord = pitEntry->getOutRecord(it->getFace(), 0); BOOST_ASSERT(outRecord != pitEntry->out_end()); if (outRecord->getLastRenewed() < earliestRenewed) { found = it; diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp index b53b82df..f4e5ac9e 100644 --- a/daemon/fw/forwarder.cpp +++ b/daemon/fw/forwarder.cpp @@ -176,7 +176,7 @@ Forwarder::onContentStoreMiss(const Face& inFace, const shared_ptr& ++m_counters.nCsMisses; // insert in-record - pitEntry->insertOrUpdateInRecord(const_cast(inFace), interest); + pitEntry->insertOrUpdateInRecord(const_cast(inFace), 0, interest); // set PIT expiry timer to the time that the last PIT in-record expires auto lastExpiring = std::max_element(pitEntry->in_begin(), pitEntry->in_end(), &compare_InRecord_expiry); @@ -230,7 +230,7 @@ Forwarder::onOutgoingInterest(const shared_ptr& pitEntry, Face& outF " interest=" << pitEntry->getName()); // insert out-record - pitEntry->insertOrUpdateOutRecord(outFace, interest); + pitEntry->insertOrUpdateOutRecord(outFace, 0, interest); // send Interest outFace.sendInterest(interest); @@ -309,7 +309,7 @@ Forwarder::onIncomingData(Face& inFace, const Data& data) this->insertDeadNonceList(*pitEntry, &inFace); // delete PIT entry's out-record - pitEntry->deleteOutRecord(inFace); + pitEntry->deleteOutRecord(inFace, 0); } // when more than one PIT entry is matched, trigger strategy: before satisfy Interest, // and send Data to all matched out faces @@ -343,7 +343,7 @@ Forwarder::onIncomingData(Face& inFace, const Data& data) // clear PIT entry's in and out records pitEntry->clearInRecords(); - pitEntry->deleteOutRecord(inFace); + pitEntry->deleteOutRecord(inFace, 0); } // foreach pending downstream @@ -425,7 +425,7 @@ Forwarder::onIncomingNack(Face& inFace, const lp::Nack& nack) } // has out-record? - pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(inFace); + pit::OutRecordCollection::iterator outRecord = pitEntry->getOutRecord(inFace, 0); // if no out-record found, drop if (outRecord == pitEntry->out_end()) { NFD_LOG_DEBUG("onIncomingNack face=" << inFace.getId() << @@ -472,7 +472,7 @@ Forwarder::onOutgoingNack(const shared_ptr& pitEntry, const Face& ou } // has in-record? - pit::InRecordCollection::iterator inRecord = pitEntry->getInRecord(outFace); + pit::InRecordCollection::iterator inRecord = pitEntry->getInRecord(outFace, 0); // if no in-record found, drop if (inRecord == pitEntry->in_end()) { @@ -499,7 +499,7 @@ Forwarder::onOutgoingNack(const shared_ptr& pitEntry, const Face& ou nackPkt.setHeader(nack); // erase in-record - pitEntry->deleteInRecord(outFace); + pitEntry->deleteInRecord(outFace, 0); // send Nack on face const_cast(outFace).sendNack(nackPkt); @@ -548,7 +548,7 @@ Forwarder::insertDeadNonceList(pit::Entry& pitEntry, Face* upstream) } else { // insert outgoing Nonce of a specific face - auto outRecord = pitEntry.getOutRecord(*upstream); + auto outRecord = pitEntry.getOutRecord(*upstream, 0); if (outRecord != pitEntry.getOutRecords().end()) { m_deadNonceList.add(pitEntry.getName(), outRecord->getLastNonce()); } diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp index 71fa7c17..7732e09d 100644 --- a/daemon/fw/multicast-strategy.cpp +++ b/daemon/fw/multicast-strategy.cpp @@ -95,7 +95,7 @@ MulticastStrategy::afterReceiveInterest(const Face& inFace, const Interest& inte << " pitEntry-to=" << outFace.getId()); if (suppressResult == RetxSuppressionResult::FORWARD) { - m_retxSuppression.incrementIntervalForOutRecord(*pitEntry->getOutRecord(outFace)); + m_retxSuppression.incrementIntervalForOutRecord(*pitEntry->getOutRecord(outFace, 0)); } ++nEligibleNextHops; } diff --git a/daemon/fw/ncc-strategy.cpp b/daemon/fw/ncc-strategy.cpp index 9a168970..778ed2b5 100644 --- a/daemon/fw/ncc-strategy.cpp +++ b/daemon/fw/ncc-strategy.cpp @@ -143,7 +143,7 @@ NccStrategy::doPropagate(FaceId inFaceId, weak_ptr pitEntryWeak) if (pitEntry == nullptr) { return; } - auto inRecord = pitEntry->getInRecord(*inFace); + auto inRecord = pitEntry->getInRecord(*inFace, 0); if (inRecord == pitEntry->in_end()) { return; } diff --git a/daemon/fw/process-nack-traits.cpp b/daemon/fw/process-nack-traits.cpp index 584bf700..4b2d0913 100644 --- a/daemon/fw/process-nack-traits.cpp +++ b/daemon/fw/process-nack-traits.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -56,7 +56,7 @@ ProcessNackTraitsBase::processNack(const Face& inFace, const lp::Nack& nack, if (nOutRecordsNotNacked == 1) { BOOST_ASSERT(lastFaceNotNacked != nullptr); - pit::InRecordCollection::iterator inR = pitEntry->getInRecord(*lastFaceNotNacked); + pit::InRecordCollection::iterator inR = pitEntry->getInRecord(*lastFaceNotNacked, 0); if (inR != pitEntry->in_end()) { // one out-record not Nacked, which is also a downstream NFD_LOG_DEBUG(nack.getInterest() << " nack-from=" << inFace.getId() << diff --git a/daemon/fw/retx-suppression-exponential.cpp b/daemon/fw/retx-suppression-exponential.cpp index b1105883..1275dd9b 100644 --- a/daemon/fw/retx-suppression-exponential.cpp +++ b/daemon/fw/retx-suppression-exponential.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -95,7 +95,7 @@ RetxSuppressionResult RetxSuppressionExponential::decidePerUpstream(pit::Entry& pitEntry, Face& outFace) { // NEW if outRecord for the face does not exist - auto outRecord = pitEntry.getOutRecord(outFace); + auto outRecord = pitEntry.getOutRecord(outFace, 0); if (outRecord == pitEntry.out_end()) { return RetxSuppressionResult::NEW; } diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp index 174dca4d..42f0f22f 100644 --- a/daemon/fw/self-learning-strategy.cpp +++ b/daemon/fw/self-learning-strategy.cpp @@ -73,7 +73,7 @@ SelfLearningStrategy::afterReceiveInterest(const Face& inFace, const Interest& i const fib::NextHopList& nexthops = fibEntry.getNextHops(); bool isNonDiscovery = interest.getTag() != nullptr; - auto inRecordInfo = pitEntry->getInRecord(inFace)->insertStrategyInfo().first; + auto inRecordInfo = pitEntry->getInRecord(inFace, 0)->insertStrategyInfo().first; if (isNonDiscovery) { // "non-discovery" Interest inRecordInfo->isNonDiscoveryInterest = true; if (nexthops.empty()) { // return NACK if no matching FIB entry exists @@ -103,7 +103,7 @@ void SelfLearningStrategy::afterReceiveData(const shared_ptr& pitEntry, const Face& inFace, const Data& data) { - OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(inFace)->getStrategyInfo(); + OutRecordInfo* outRecordInfo = pitEntry->getOutRecord(inFace, 0)->getStrategyInfo(); if (outRecordInfo && outRecordInfo->isNonDiscoveryInterest) { // outgoing Interest was non-discovery if (!needPrefixAnn(pitEntry)) { // no need to attach a PA (common cases) sendDataToAll(pitEntry, inFace, data); @@ -146,7 +146,7 @@ SelfLearningStrategy::broadcastInterest(const Interest& interest, const Face& in continue; } this->sendInterest(pitEntry, outFace, interest); - pitEntry->getOutRecord(outFace)->insertStrategyInfo().first->isNonDiscoveryInterest = false; + pitEntry->getOutRecord(outFace, 0)->insertStrategyInfo().first->isNonDiscoveryInterest = false; NFD_LOG_DEBUG("send discovery Interest=" << interest << " from=" << inFace.getId() << " to=" << outFace.getId()); } @@ -164,7 +164,7 @@ SelfLearningStrategy::multicastInterest(const Interest& interest, const Face& in continue; } this->sendInterest(pitEntry, outFace, interest); - pitEntry->getOutRecord(outFace)->insertStrategyInfo().first->isNonDiscoveryInterest = true; + pitEntry->getOutRecord(outFace, 0)->insertStrategyInfo().first->isNonDiscoveryInterest = true; NFD_LOG_DEBUG("send non-discovery Interest=" << interest << " from=" << inFace.getId() << " to=" << outFace.getId()); } diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp index 3f364eaf..378e5542 100644 --- a/daemon/fw/strategy.cpp +++ b/daemon/fw/strategy.cpp @@ -199,7 +199,7 @@ Strategy::sendData(const shared_ptr& pitEntry, const Data& data, con // delete the PIT entry's in-record based on outFace, // since Data is sent to outFace from which the Interest was received - pitEntry->deleteInRecord(outFace); + pitEntry->deleteInRecord(outFace, 0); m_forwarder.onOutgoingData(data, *const_pointer_cast(outFace.shared_from_this())); } diff --git a/daemon/table/cleanup.cpp b/daemon/table/cleanup.cpp index 5a45bf73..d45b363a 100644 --- a/daemon/table/cleanup.cpp +++ b/daemon/table/cleanup.cpp @@ -40,7 +40,7 @@ cleanupOnFaceRemoval(NameTree& nt, Fib& fib, Pit& pit, const Face& face) } for (const auto& pitEntry : nte.getPitEntries()) { - pit.deleteInOutRecords(pitEntry.get(), face); + pit.deleteInOutRecordsByFace(pitEntry.get(), face); } if (!nte.hasTableEntries()) { diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp index ee4b7265..2edbc9f3 100644 --- a/daemon/table/pit-entry.cpp +++ b/daemon/table/pit-entry.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -50,21 +50,25 @@ Entry::canMatch(const Interest& interest, size_t nEqualNameComps) const } InRecordCollection::iterator -Entry::getInRecord(const Face& face) +Entry::getInRecord(const Face& face, uint64_t endpointId) { return std::find_if(m_inRecords.begin(), m_inRecords.end(), - [&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; }); + [&face, endpointId] (const InRecord& inRecord) { + return &inRecord.getFace() == &face && inRecord.getEndpointId() == endpointId; + }); } InRecordCollection::iterator -Entry::insertOrUpdateInRecord(Face& face, const Interest& interest) +Entry::insertOrUpdateInRecord(Face& face, uint64_t endpointId, const Interest& interest) { BOOST_ASSERT(this->canMatch(interest)); auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(), - [&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; }); + [&face, endpointId] (const InRecord& inRecord) { + return &inRecord.getFace() == &face && inRecord.getEndpointId() == endpointId; + }); if (it == m_inRecords.end()) { - m_inRecords.emplace_front(face); + m_inRecords.emplace_front(face, endpointId); it = m_inRecords.begin(); } @@ -73,10 +77,12 @@ Entry::insertOrUpdateInRecord(Face& face, const Interest& interest) } void -Entry::deleteInRecord(const Face& face) +Entry::deleteInRecord(const Face& face, uint64_t endpointId) { auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(), - [&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; }); + [&face, endpointId] (const InRecord& inRecord) { + return &inRecord.getFace() == &face && inRecord.getEndpointId() == endpointId; + }); if (it != m_inRecords.end()) { m_inRecords.erase(it); } @@ -89,21 +95,25 @@ Entry::clearInRecords() } OutRecordCollection::iterator -Entry::getOutRecord(const Face& face) +Entry::getOutRecord(const Face& face, uint64_t endpointId) { return std::find_if(m_outRecords.begin(), m_outRecords.end(), - [&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; }); + [&face, endpointId] (const OutRecord& outRecord) { + return &outRecord.getFace() == &face && outRecord.getEndpointId() == endpointId; + }); } OutRecordCollection::iterator -Entry::insertOrUpdateOutRecord(Face& face, const Interest& interest) +Entry::insertOrUpdateOutRecord(Face& face, uint64_t endpointId, const Interest& interest) { BOOST_ASSERT(this->canMatch(interest)); auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(), - [&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; }); + [&face, endpointId] (const OutRecord& outRecord) { + return &outRecord.getFace() == &face && outRecord.getEndpointId() == endpointId; + }); if (it == m_outRecords.end()) { - m_outRecords.emplace_front(face); + m_outRecords.emplace_front(face, endpointId); it = m_outRecords.begin(); } @@ -112,14 +122,27 @@ Entry::insertOrUpdateOutRecord(Face& face, const Interest& interest) } void -Entry::deleteOutRecord(const Face& face) +Entry::deleteOutRecord(const Face& face, uint64_t endpointId) { auto it = std::find_if(m_outRecords.begin(), m_outRecords.end(), - [&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; }); + [&face, endpointId] (const OutRecord& outRecord) { + return &outRecord.getFace() == &face && outRecord.getEndpointId() == endpointId; + }); if (it != m_outRecords.end()) { m_outRecords.erase(it); } } +void +Entry::deleteInOutRecordsByFace(const Face& face) +{ + m_inRecords.remove_if([&face] (const InRecord& inRecord) { + return &inRecord.getFace() == &face; + }); + m_outRecords.remove_if([&face] (const OutRecord& outRecord) { + return &outRecord.getFace() == &face; + }); +} + } // namespace pit } // namespace nfd diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp index 2e498240..b1dc9ee4 100644 --- a/daemon/table/pit-entry.hpp +++ b/daemon/table/pit-entry.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -132,22 +132,22 @@ public: // in-record return m_inRecords.end(); } - /** \brief get the in-record for \p face + /** \brief get the in-record for \p face and \p endpointId * \return an iterator to the in-record, or .in_end() if it does not exist */ InRecordCollection::iterator - getInRecord(const Face& face); + getInRecord(const Face& face, uint64_t endpointId); /** \brief insert or update an in-record * \return an iterator to the new or updated in-record */ InRecordCollection::iterator - insertOrUpdateInRecord(Face& face, const Interest& interest); + insertOrUpdateInRecord(Face& face, uint64_t endpointId, const Interest& interest); - /** \brief delete the in-record for \p face if it exists + /** \brief delete the in-record for \p face and \p endpointId if it exists */ void - deleteInRecord(const Face& face); + deleteInRecord(const Face& face, uint64_t endpointId); /** \brief delete all in-records */ @@ -199,22 +199,28 @@ public: // out-record return m_outRecords.end(); } - /** \brief get the out-record for \p face + /** \brief get the out-record for \p face and \p endpointId * \return an iterator to the out-record, or .out_end() if it does not exist */ OutRecordCollection::iterator - getOutRecord(const Face& face); + getOutRecord(const Face& face, uint64_t endpointId); /** \brief insert or update an out-record * \return an iterator to the new or updated out-record */ OutRecordCollection::iterator - insertOrUpdateOutRecord(Face& face, const Interest& interest); + insertOrUpdateOutRecord(Face& face, uint64_t endpointId, const Interest& interest); - /** \brief delete the out-record for \p face if it exists + /** \brief delete the out-record for \p face and \p endpointId if it exists */ void - deleteOutRecord(const Face& face); + deleteOutRecord(const Face& face, uint64_t endpointId); + +public: // cleanup + /** \brief delete all in-records and out-records for \p face if it exists + */ + void + deleteInOutRecordsByFace(const Face& face); public: /** \brief expiry timer diff --git a/daemon/table/pit-face-record.cpp b/daemon/table/pit-face-record.cpp index d594cb93..61fef7e8 100644 --- a/daemon/table/pit-face-record.cpp +++ b/daemon/table/pit-face-record.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -28,8 +28,9 @@ namespace nfd { namespace pit { -FaceRecord::FaceRecord(Face& face) +FaceRecord::FaceRecord(Face& face, uint64_t endpointId) : m_face(face) + , m_endpointId(endpointId) , m_lastNonce(0) , m_lastRenewed(time::steady_clock::TimePoint::min()) , m_expiry(time::steady_clock::TimePoint::min()) diff --git a/daemon/table/pit-face-record.hpp b/daemon/table/pit-face-record.hpp index 90c3cdba..3e3f0206 100644 --- a/daemon/table/pit-face-record.hpp +++ b/daemon/table/pit-face-record.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -40,12 +40,14 @@ namespace pit { class FaceRecord : public StrategyInfoHost { public: - explicit - FaceRecord(Face& face); + FaceRecord(Face& face, uint64_t endpointId); Face& getFace() const; + uint64_t + getEndpointId() const; + uint32_t getLastNonce() const; @@ -65,6 +67,7 @@ public: private: Face& m_face; + uint64_t m_endpointId; uint32_t m_lastNonce; time::steady_clock::TimePoint m_lastRenewed; time::steady_clock::TimePoint m_expiry; @@ -76,6 +79,12 @@ FaceRecord::getFace() const return m_face; } +inline uint64_t +FaceRecord::getEndpointId() const +{ + return m_endpointId; +} + inline uint32_t FaceRecord::getLastNonce() const { diff --git a/daemon/table/pit-in-record.cpp b/daemon/table/pit-in-record.cpp index 81671909..7bb10b9d 100644 --- a/daemon/table/pit-in-record.cpp +++ b/daemon/table/pit-in-record.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -28,8 +28,8 @@ namespace nfd { namespace pit { -InRecord::InRecord(Face& face) - : FaceRecord(face) +InRecord::InRecord(Face& face, uint64_t endpointId) + : FaceRecord(face, endpointId) { } diff --git a/daemon/table/pit-in-record.hpp b/daemon/table/pit-in-record.hpp index 45167c3e..d7580972 100644 --- a/daemon/table/pit-in-record.hpp +++ b/daemon/table/pit-in-record.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -36,8 +36,7 @@ namespace pit { class InRecord : public FaceRecord { public: - explicit - InRecord(Face& face); + InRecord(Face& face, uint64_t endpointId); void update(const Interest& interest); diff --git a/daemon/table/pit-out-record.cpp b/daemon/table/pit-out-record.cpp index 8b4f6099..75d7e7fe 100644 --- a/daemon/table/pit-out-record.cpp +++ b/daemon/table/pit-out-record.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -28,8 +28,8 @@ namespace nfd { namespace pit { -OutRecord::OutRecord(Face& face) - : FaceRecord(face) +OutRecord::OutRecord(Face& face, uint64_t endpointId) + : FaceRecord(face, endpointId) { } diff --git a/daemon/table/pit-out-record.hpp b/daemon/table/pit-out-record.hpp index 4400fd45..c0537fdb 100644 --- a/daemon/table/pit-out-record.hpp +++ b/daemon/table/pit-out-record.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -36,8 +36,7 @@ namespace pit { class OutRecord : public FaceRecord { public: - explicit - OutRecord(Face& face); + OutRecord(Face& face, uint64_t endpointId); /** \return last NACK returned by \p getFace() * @@ -79,4 +78,4 @@ private: } // namespace pit } // namespace nfd -#endif // NFD_DAEMON_TABLE_PIT_IN_RECORD_HPP +#endif // NFD_DAEMON_TABLE_PIT_OUT_RECORD_HPP diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp index 7a708da4..5e26fc09 100644 --- a/daemon/table/pit.cpp +++ b/daemon/table/pit.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -113,12 +113,11 @@ Pit::erase(Entry* entry, bool canDeleteNte) } void -Pit::deleteInOutRecords(Entry* entry, const Face& face) +Pit::deleteInOutRecordsByFace(Entry* entry, const Face& face) { BOOST_ASSERT(entry != nullptr); - entry->deleteInRecord(face); - entry->deleteOutRecord(face); + entry->deleteInOutRecordsByFace(face); /// \todo decide whether to delete PIT entry if there's no more in/out-record left } diff --git a/daemon/table/pit.hpp b/daemon/table/pit.hpp index 6e8af8af..eb2438b7 100644 --- a/daemon/table/pit.hpp +++ b/daemon/table/pit.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -93,10 +93,10 @@ public: this->erase(entry, true); } - /** \brief deletes in-record and out-record for face + /** \brief deletes all in-records and out-records for \p face */ void - deleteInOutRecords(Entry* entry, const Face& face); + deleteInOutRecordsByFace(Entry* entry, const Face& face); public: // enumeration typedef Iterator const_iterator; diff --git a/tests/daemon/fw/algorithm.t.cpp b/tests/daemon/fw/algorithm.t.cpp index 8a188e62..1e482c56 100644 --- a/tests/daemon/fw/algorithm.t.cpp +++ b/tests/daemon/fw/algorithm.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -97,15 +97,15 @@ BOOST_AUTO_TEST_CASE(CanForwardToLegacy) auto face1 = make_shared(); auto face2 = make_shared(); - entry.insertOrUpdateInRecord(*face1, *interest); + entry.insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face1), false); BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face2), true); - entry.insertOrUpdateInRecord(*face2, *interest); + entry.insertOrUpdateInRecord(*face2, 0, *interest); BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face1), true); BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face2), true); - entry.insertOrUpdateOutRecord(*face1, *interest); + entry.insertOrUpdateOutRecord(*face1, 0, *interest); BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face1), false); BOOST_CHECK_EQUAL(canForwardToLegacy(entry, *face2), true); } @@ -125,22 +125,22 @@ BOOST_AUTO_TEST_CASE(Nonce) BOOST_CHECK_EQUAL(findDuplicateNonce(entry0, 19004, *face2), DUPLICATE_NONCE_NONE); pit::Entry entry1(*interest); - entry1.insertOrUpdateInRecord(*face1, *interest); + entry1.insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK_EQUAL(findDuplicateNonce(entry1, 25559, *face1), DUPLICATE_NONCE_IN_SAME); BOOST_CHECK_EQUAL(findDuplicateNonce(entry1, 25559, *face2), DUPLICATE_NONCE_IN_OTHER); BOOST_CHECK_EQUAL(findDuplicateNonce(entry1, 19004, *face1), DUPLICATE_NONCE_NONE); BOOST_CHECK_EQUAL(findDuplicateNonce(entry1, 19004, *face2), DUPLICATE_NONCE_NONE); pit::Entry entry2(*interest); - entry2.insertOrUpdateOutRecord(*face1, *interest); + entry2.insertOrUpdateOutRecord(*face1, 0, *interest); BOOST_CHECK_EQUAL(findDuplicateNonce(entry2, 25559, *face1), DUPLICATE_NONCE_OUT_SAME); BOOST_CHECK_EQUAL(findDuplicateNonce(entry2, 25559, *face2), DUPLICATE_NONCE_OUT_OTHER); BOOST_CHECK_EQUAL(findDuplicateNonce(entry2, 19004, *face1), DUPLICATE_NONCE_NONE); BOOST_CHECK_EQUAL(findDuplicateNonce(entry2, 19004, *face2), DUPLICATE_NONCE_NONE); pit::Entry entry3(*interest); - entry3.insertOrUpdateInRecord(*face1, *interest); - entry3.insertOrUpdateOutRecord(*face1, *interest); + entry3.insertOrUpdateInRecord(*face1, 0, *interest); + entry3.insertOrUpdateOutRecord(*face1, 0, *interest); BOOST_CHECK_EQUAL(findDuplicateNonce(entry3, 25559, *face1), DUPLICATE_NONCE_IN_SAME | DUPLICATE_NONCE_OUT_SAME); BOOST_CHECK_EQUAL(findDuplicateNonce(entry3, 25559, *face2), @@ -149,8 +149,8 @@ BOOST_AUTO_TEST_CASE(Nonce) BOOST_CHECK_EQUAL(findDuplicateNonce(entry3, 19004, *face2), DUPLICATE_NONCE_NONE); pit::Entry entry4(*interest); - entry4.insertOrUpdateInRecord(*face1, *interest); - entry4.insertOrUpdateInRecord(*face2, *interest); + entry4.insertOrUpdateInRecord(*face1, 0, *interest); + entry4.insertOrUpdateInRecord(*face2, 0, *interest); BOOST_CHECK_EQUAL(findDuplicateNonce(entry4, 25559, *face1), DUPLICATE_NONCE_IN_SAME | DUPLICATE_NONCE_IN_OTHER); BOOST_CHECK_EQUAL(findDuplicateNonce(entry4, 25559, *face2), @@ -159,8 +159,8 @@ BOOST_AUTO_TEST_CASE(Nonce) BOOST_CHECK_EQUAL(findDuplicateNonce(entry4, 19004, *face2), DUPLICATE_NONCE_NONE); pit::Entry entry5(*interest); - entry5.insertOrUpdateOutRecord(*face1, *interest); - entry5.insertOrUpdateOutRecord(*face2, *interest); + entry5.insertOrUpdateOutRecord(*face1, 0, *interest); + entry5.insertOrUpdateOutRecord(*face2, 0, *interest); BOOST_CHECK_EQUAL(findDuplicateNonce(entry5, 25559, *face1), DUPLICATE_NONCE_OUT_SAME | DUPLICATE_NONCE_OUT_OTHER); BOOST_CHECK_EQUAL(findDuplicateNonce(entry5, 25559, *face2), @@ -182,15 +182,15 @@ BOOST_FIXTURE_TEST_CASE(HasPendingOutRecords, UnitTestTimeFixture) BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false); // Interest-Data - entry.insertOrUpdateOutRecord(*face1, *interest); + entry.insertOrUpdateOutRecord(*face1, 0, *interest); BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), true); - entry.deleteOutRecord(*face1); + entry.deleteOutRecord(*face1, 0); BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false); // Interest-Nack - entry.insertOrUpdateOutRecord(*face2, *interest); + entry.insertOrUpdateOutRecord(*face2, 0, *interest); BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), true); - pit::OutRecordCollection::iterator outR = entry.getOutRecord(*face2); + pit::OutRecordCollection::iterator outR = entry.getOutRecord(*face2, 0); BOOST_REQUIRE(outR != entry.out_end()); lp::Nack nack = makeNack("ndn:/totzXG0d", 29321, lp::NackReason::DUPLICATE); bool isNackAccepted = outR->setIncomingNack(nack); // Nack arrival @@ -198,7 +198,7 @@ BOOST_FIXTURE_TEST_CASE(HasPendingOutRecords, UnitTestTimeFixture) BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false); // Interest-timeout - entry.insertOrUpdateOutRecord(*face3, *interest); + entry.insertOrUpdateOutRecord(*face3, 0, *interest); BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), true); this->advanceClocks(ndn::DEFAULT_INTEREST_LIFETIME, 2); BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), false); @@ -214,12 +214,12 @@ BOOST_FIXTURE_TEST_CASE(GetLastOutgoing, UnitTestTimeFixture) time::steady_clock::TimePoint before = time::steady_clock::now(); - entry.insertOrUpdateOutRecord(*face1, *interest); + entry.insertOrUpdateOutRecord(*face1, 0, *interest); this->advanceClocks(time::milliseconds(1000)); BOOST_CHECK_EQUAL(getLastOutgoing(entry), before); - entry.insertOrUpdateOutRecord(*face2, *interest); + entry.insertOrUpdateOutRecord(*face2, 0, *interest); BOOST_CHECK_EQUAL(getLastOutgoing(entry), time::steady_clock::now()); } diff --git a/tests/daemon/fw/asf-measurements.t.cpp b/tests/daemon/fw/asf-measurements.t.cpp index ffee3e63..cc4c9e40 100644 --- a/tests/daemon/fw/asf-measurements.t.cpp +++ b/tests/daemon/fw/asf-measurements.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2016, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -100,7 +100,7 @@ BOOST_FIXTURE_TEST_CASE(Basic, UnitTestTimeFixture) shared_ptr pitEntry = make_shared(*interest); std::shared_ptr face = make_shared(); - pitEntry->insertOrUpdateOutRecord(*face, *interest); + pitEntry->insertOrUpdateOutRecord(*face, 0, *interest); RttEstimator::Duration rtt(50); this->advanceClocks(time::milliseconds(5), rtt); diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp index 5759e680..7e3de91c 100644 --- a/tests/daemon/fw/asf-strategy.t.cpp +++ b/tests/daemon/fw/asf-strategy.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -273,7 +273,7 @@ BOOST_AUTO_TEST_CASE(NoPitOutRecordAndProbeInterestNewNonce) // Get pitEntry of node A shared_ptr pitEntry = topo.getForwarder(nodeA).getPit().find(*interest); //get outRecord associated with face towards B - pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(linkAB->getFace(nodeA)); + pit::OutRecordCollection::const_iterator outRecord = pitEntry->getOutRecord(linkAB->getFace(nodeA), 0); BOOST_CHECK(outRecord != pitEntry->out_end()); @@ -294,13 +294,13 @@ BOOST_AUTO_TEST_CASE(NoPitOutRecordAndProbeInterestNewNonce) pitEntry = topo.getForwarder(nodeB).getPit().find(*interest); // Get outRecord associated with face towards D. - outRecord = pitEntry->getOutRecord(linkBD->getFace(nodeB)); + outRecord = pitEntry->getOutRecord(linkBD->getFace(nodeB), 0); BOOST_CHECK(outRecord != pitEntry->out_end()); // RTT between B and D this->advanceClocks(time::milliseconds(5), time::milliseconds(160)); - outRecord = pitEntry->getOutRecord(linkBD->getFace(nodeB)); + outRecord = pitEntry->getOutRecord(linkBD->getFace(nodeB), 0); BOOST_CHECK_EQUAL(linkBD->getFace(nodeB).getCounters().nInData, i); diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp index c0d9ba81..933a4311 100644 --- a/tests/daemon/fw/best-route-strategy2.t.cpp +++ b/tests/daemon/fw/best-route-strategy2.t.cpp @@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE(Forward) // first Interest goes to nexthop with lowest FIB cost, // however face1 is downstream so it cannot be used - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); strategy.afterReceiveInterest(*face1, *interest, pitEntry); BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1); BOOST_CHECK_EQUAL(strategy.sendInterestHistory.back().outFaceId, face2->getId()); @@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(Forward) time::steady_clock::TimePoint timeSentLast = time::steady_clock::now(); std::function periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself periodicalRetxFrom4 = [&] { - pitEntry->insertOrUpdateInRecord(*face4, *interest); + pitEntry->insertOrUpdateInRecord(*face4, 0, *interest); strategy.afterReceiveInterest(*face4, *interest, pitEntry); size_t nSent = strategy.sendInterestHistory.size(); @@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(Forward) strategy.sendInterestHistory.clear(); for (int i = 0; i < 3; ++i) { this->advanceClocks(TICK, BestRouteStrategy2::RETX_SUPPRESSION_MAX * 2); - pitEntry->insertOrUpdateInRecord(*face5, *interest); + pitEntry->insertOrUpdateInRecord(*face5, 0, *interest); strategy.afterReceiveInterest(*face5, *interest, pitEntry); } BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 3); diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp index 85e77d07..b61c9270 100644 --- a/tests/daemon/fw/forwarder.t.cpp +++ b/tests/daemon/fw/forwarder.t.cpp @@ -137,13 +137,13 @@ BOOST_AUTO_TEST_CASE(OutgoingInterest) auto interestA1 = makeInterest("/A"); interestA1->setNonce(8378); shared_ptr pitA = pit.insert(*interestA1).first; - pitA->insertOrUpdateInRecord(*face1, *interestA1); + pitA->insertOrUpdateInRecord(*face1, 0, *interestA1); auto interestA2 = makeInterest("/A"); interestA2->setNonce(1698); forwarder.onOutgoingInterest(pitA, *face2, *interestA2); - pit::OutRecordCollection::iterator outA2 = pitA->getOutRecord(*face2); + pit::OutRecordCollection::iterator outA2 = pitA->getOutRecord(*face2, 0); BOOST_REQUIRE(outA2 != pitA->out_end()); BOOST_CHECK_EQUAL(outA2->getLastNonce(), 1698); @@ -315,15 +315,15 @@ BOOST_AUTO_TEST_CASE(IncomingData) Pit& pit = forwarder.getPit(); shared_ptr interest0 = makeInterest("ndn:/"); shared_ptr pit0 = pit.insert(*interest0).first; - pit0->insertOrUpdateInRecord(*face1, *interest0); + pit0->insertOrUpdateInRecord(*face1, 0, *interest0); shared_ptr interestA = makeInterest("ndn:/A"); shared_ptr pitA = pit.insert(*interestA).first; - pitA->insertOrUpdateInRecord(*face1, *interestA); - pitA->insertOrUpdateInRecord(*face2, *interestA); + pitA->insertOrUpdateInRecord(*face1, 0, *interestA); + pitA->insertOrUpdateInRecord(*face2, 0, *interestA); shared_ptr interestC = makeInterest("ndn:/A/B/C"); shared_ptr pitC = pit.insert(*interestC).first; - pitC->insertOrUpdateInRecord(*face3, *interestC); - pitC->insertOrUpdateInRecord(*face4, *interestC); + pitC->insertOrUpdateInRecord(*face3, 0, *interestC); + pitC->insertOrUpdateInRecord(*face4, 0, *interestC); shared_ptr dataD = makeData("ndn:/A/B/C/D"); forwarder.onIncomingData(*face3, *dataD); @@ -356,10 +356,10 @@ BOOST_AUTO_TEST_CASE(IncomingNack) // dispatch to the correct strategy shared_ptr interest1 = makeInterest("/A/AYJqayrzF", 562); shared_ptr pit1 = pit.insert(*interest1).first; - pit1->insertOrUpdateOutRecord(*face1, *interest1); + pit1->insertOrUpdateOutRecord(*face1, 0, *interest1); shared_ptr interest2 = makeInterest("/B/EVyP73ru", 221); shared_ptr pit2 = pit.insert(*interest2).first; - pit2->insertOrUpdateOutRecord(*face1, *interest2); + pit2->insertOrUpdateOutRecord(*face1, 0, *interest2); lp::Nack nack1 = makeNack("/A/AYJqayrzF", 562, lp::NackReason::CONGESTION); strategyA.afterReceiveNack_count = 0; @@ -376,7 +376,7 @@ BOOST_AUTO_TEST_CASE(IncomingNack) BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 1); // record Nack on PIT out-record - pit::OutRecordCollection::iterator outRecord1 = pit1->getOutRecord(*face1); + pit::OutRecordCollection::iterator outRecord1 = pit1->getOutRecord(*face1, 0); BOOST_REQUIRE(outRecord1 != pit1->out_end()); BOOST_REQUIRE(outRecord1->getIncomingNack() != nullptr); BOOST_CHECK_EQUAL(outRecord1->getIncomingNack()->getReason(), lp::NackReason::CONGESTION); @@ -392,7 +392,7 @@ BOOST_AUTO_TEST_CASE(IncomingNack) // drop if no out-record shared_ptr interest4 = makeInterest("/Etab4KpY", 157); shared_ptr pit4 = pit.insert(*interest4).first; - pit4->insertOrUpdateOutRecord(*face1, *interest4); + pit4->insertOrUpdateOutRecord(*face1, 0, *interest4); lp::Nack nack4a = makeNack("/Etab4KpY", 157, lp::NackReason::CONGESTION); strategyA.afterReceiveNack_count = 0; @@ -410,7 +410,7 @@ BOOST_AUTO_TEST_CASE(IncomingNack) BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0); // drop if inFace is multi-access - pit4->insertOrUpdateOutRecord(*face3, *interest4); + pit4->insertOrUpdateOutRecord(*face3, 0, *interest4); strategyA.afterReceiveNack_count = 0; strategyB.afterReceiveNack_count = 0; forwarder.onIncomingNack(*face3, nack4a); @@ -439,7 +439,7 @@ BOOST_AUTO_TEST_CASE(OutgoingNack) // don't send Nack if there's no in-record shared_ptr interest1 = makeInterest("/fM5IVEtC", 719); shared_ptr pit1 = pit.insert(*interest1).first; - pit1->insertOrUpdateInRecord(*face1, *interest1); + pit1->insertOrUpdateInRecord(*face1, 0, *interest1); face2->sentNacks.clear(); forwarder.onOutgoingNack(pit1, *face2, nackHeader); @@ -448,9 +448,9 @@ BOOST_AUTO_TEST_CASE(OutgoingNack) // send Nack with correct Nonce shared_ptr interest2a = makeInterest("/Vi8tRm9MG3", 152); shared_ptr pit2 = pit.insert(*interest2a).first; - pit2->insertOrUpdateInRecord(*face1, *interest2a); + pit2->insertOrUpdateInRecord(*face1, 0, *interest2a); shared_ptr interest2b = makeInterest("/Vi8tRm9MG3", 808); - pit2->insertOrUpdateInRecord(*face2, *interest2b); + pit2->insertOrUpdateInRecord(*face2, 0, *interest2b); face1->sentNacks.clear(); forwarder.onOutgoingNack(pit2, *face1, nackHeader); @@ -459,7 +459,7 @@ BOOST_AUTO_TEST_CASE(OutgoingNack) BOOST_CHECK_EQUAL(face1->sentNacks.back().getInterest().getNonce(), 152); // erase in-record - pit::InRecordCollection::iterator inRecord2a = pit2->getInRecord(*face1); + pit::InRecordCollection::iterator inRecord2a = pit2->getInRecord(*face1, 0); BOOST_CHECK(inRecord2a == pit2->in_end()); // send Nack with correct Nonce @@ -470,12 +470,12 @@ BOOST_AUTO_TEST_CASE(OutgoingNack) BOOST_CHECK_EQUAL(face2->sentNacks.back().getInterest().getNonce(), 808); // erase in-record - pit::InRecordCollection::iterator inRecord2b = pit2->getInRecord(*face1); + pit::InRecordCollection::iterator inRecord2b = pit2->getInRecord(*face1, 0); BOOST_CHECK(inRecord2b == pit2->in_end()); // don't send Nack to multi-access face shared_ptr interest2c = makeInterest("/Vi8tRm9MG3", 228); - pit2->insertOrUpdateInRecord(*face3, *interest2c); + pit2->insertOrUpdateInRecord(*face3, 0, *interest2c); face3->sentNacks.clear(); forwarder.onOutgoingNack(pit1, *face3, nackHeader); diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp index 04de9b2a..09eeac76 100644 --- a/tests/daemon/fw/multicast-strategy.t.cpp +++ b/tests/daemon/fw/multicast-strategy.t.cpp @@ -76,7 +76,7 @@ BOOST_AUTO_TEST_CASE(Forward2) shared_ptr interest = makeInterest("ndn:/H0D6i5fc"); shared_ptr pitEntry = pit.insert(*interest).first; - pitEntry->insertOrUpdateInRecord(*face3, *interest); + pitEntry->insertOrUpdateInRecord(*face3, 0, *interest); strategy.afterReceiveInterest(*face3, *interest, pitEntry); BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0); @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(Forward2) time::steady_clock::TimePoint timeSentLast = time::steady_clock::now(); std::function periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself periodicalRetxFrom4 = [&] { - pitEntry->insertOrUpdateInRecord(*face3, *interest); + pitEntry->insertOrUpdateInRecord(*face3, 0, *interest); strategy.afterReceiveInterest(*face3, *interest, pitEntry); size_t nSent = strategy.sendInterestHistory.size(); @@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(RejectLoopback) shared_ptr interest = makeInterest("ndn:/H0D6i5fc"); shared_ptr pitEntry = pit.insert(*interest).first; - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); strategy.afterReceiveInterest(*face1, *interest, pitEntry); BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1); diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp index 38a24013..fed914ca 100644 --- a/tests/daemon/fw/ncc-strategy.t.cpp +++ b/tests/daemon/fw/ncc-strategy.t.cpp @@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE(FavorRespondingUpstream) interest1.setInterestLifetime(time::milliseconds(8000)); shared_ptr pitEntry1 = pit.insert(interest1).first; - pitEntry1->insertOrUpdateInRecord(*face3, interest1); + pitEntry1->insertOrUpdateInRecord(*face3, 0, interest1); strategy.afterReceiveInterest(*face3, interest1, pitEntry1); // forwards to face1 because routing says it's best @@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(FavorRespondingUpstream) interest2.setInterestLifetime(time::milliseconds(8000)); shared_ptr pitEntry2 = pit.insert(interest2).first; - pitEntry2->insertOrUpdateInRecord(*face3, interest2); + pitEntry2->insertOrUpdateInRecord(*face3, 0, interest2); strategy.afterReceiveInterest(*face3, interest2, pitEntry2); // forwards to face2 because it responds previously @@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(Bug1853) interest1->setInterestLifetime(time::milliseconds(8000)); shared_ptr pitEntry1 = pit.insert(*interest1).first; - pitEntry1->insertOrUpdateInRecord(*face3, *interest1); + pitEntry1->insertOrUpdateInRecord(*face3, 0, *interest1); strategy.afterReceiveInterest(*face3, *interest1, pitEntry1); this->advanceClocks(time::milliseconds(1)); @@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE(Bug1853) interest2->setInterestLifetime(time::milliseconds(8000)); shared_ptr pitEntry2 = pit.insert(*interest2).first; - pitEntry2->insertOrUpdateInRecord(*face3, *interest2); + pitEntry2->insertOrUpdateInRecord(*face3, 0, *interest2); strategy.afterReceiveInterest(*face3, *interest2, pitEntry2); // FIB entry is changed before doPropagate executes @@ -183,7 +183,7 @@ BOOST_AUTO_TEST_CASE(Bug1961) interest1->setInterestLifetime(time::milliseconds(2000)); shared_ptr pitEntry1 = pit.insert(*interest1).first; - pitEntry1->insertOrUpdateInRecord(*face3, *interest1); + pitEntry1->insertOrUpdateInRecord(*face3, 0, *interest1); strategy.afterReceiveInterest(*face3, *interest1, pitEntry1); limitedIo.run(2 - strategy.sendInterestHistory.size(), time::milliseconds(2000), time::milliseconds(10)); @@ -205,7 +205,7 @@ BOOST_AUTO_TEST_CASE(Bug1961) interest2->setInterestLifetime(time::milliseconds(2000)); shared_ptr pitEntry2 = pit.insert(*interest2).first; - pitEntry2->insertOrUpdateInRecord(*face3, *interest2); + pitEntry2->insertOrUpdateInRecord(*face3, 0, *interest2); strategy.afterReceiveInterest(*face3, *interest2, pitEntry2); limitedIo.run(3 - strategy.sendInterestHistory.size(), time::milliseconds(2000), time::milliseconds(10)); @@ -237,7 +237,7 @@ BOOST_AUTO_TEST_CASE(Bug1971) interest1->setInterestLifetime(time::milliseconds(2000)); shared_ptr pitEntry1 = pit.insert(*interest1).first; - pitEntry1->insertOrUpdateInRecord(*face1, *interest1); + pitEntry1->insertOrUpdateInRecord(*face1, 0, *interest1); strategy.afterReceiveInterest(*face1, *interest1, pitEntry1); limitedIo.run(1 - strategy.sendInterestHistory.size(), time::milliseconds(2000), time::milliseconds(10)); @@ -248,12 +248,12 @@ BOOST_AUTO_TEST_CASE(Bug1971) shared_ptr data1 = makeData("ndn:/M4mBXCsd"); data1->setFreshnessPeriod(time::milliseconds(5)); strategy.beforeSatisfyInterest(pitEntry1, *face2, *data1); - pitEntry1->deleteOutRecord(*face2); + pitEntry1->deleteOutRecord(*face2, 0); pitEntry1->clearInRecords(); this->advanceClocks(time::milliseconds(10)); // similar Interest: strategy should still forward it - pitEntry1->insertOrUpdateInRecord(*face1, *interest1); + pitEntry1->insertOrUpdateInRecord(*face1, 0, *interest1); strategy.afterReceiveInterest(*face1, *interest1, pitEntry1); limitedIo.run(2 - strategy.sendInterestHistory.size(), time::milliseconds(2000), time::milliseconds(10)); @@ -281,7 +281,7 @@ BOOST_AUTO_TEST_CASE(Bug1998) // Interest comes from face1, which is sole downstream shared_ptr interest1 = makeInterest("ndn:/tFy5HzUzD4"); shared_ptr pitEntry1 = pit.insert(*interest1).first; - pitEntry1->insertOrUpdateInRecord(*face1, *interest1); + pitEntry1->insertOrUpdateInRecord(*face1, 0, *interest1); strategy.afterReceiveInterest(*face1, *interest1, pitEntry1); diff --git a/tests/daemon/fw/pit-expiry.t.cpp b/tests/daemon/fw/pit-expiry.t.cpp index 07c79c97..b8c04187 100644 --- a/tests/daemon/fw/pit-expiry.t.cpp +++ b/tests/daemon/fw/pit-expiry.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2018, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -227,8 +227,8 @@ BOOST_AUTO_TEST_CASE(ReceiveNack) face1->receiveInterest(*interest); auto entry = pit.find(*interest); - entry->insertOrUpdateOutRecord(*face2, *interest); - entry->insertOrUpdateOutRecord(*face3, *interest); + entry->insertOrUpdateOutRecord(*face2, 0, *interest); + entry->insertOrUpdateOutRecord(*face3, 0, *interest); this->advanceClocks(10_ms); face2->receiveNack(nack); @@ -394,8 +394,8 @@ BOOST_AUTO_TEST_CASE(ReceiveNackAfterResetTimer) face1->receiveInterest(*interest); auto entry = pit.find(*interest); - entry->insertOrUpdateOutRecord(*face2, *interest); - entry->insertOrUpdateOutRecord(*face3, *interest); + entry->insertOrUpdateOutRecord(*face2, 0, *interest); + entry->insertOrUpdateOutRecord(*face3, 0, *interest); //pitEntry is not erased after receiving the first Nack this->advanceClocks(10_ms); diff --git a/tests/daemon/fw/retx-suppression.t.cpp b/tests/daemon/fw/retx-suppression.t.cpp index dce6da94..c96ac67c 100644 --- a/tests/daemon/fw/retx-suppression.t.cpp +++ b/tests/daemon/fw/retx-suppression.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -60,31 +60,31 @@ BOOST_AUTO_TEST_CASE(Fixed) time::duration_cast(MIN_RETX_INTERVAL * 0.1); // @ time 0 - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::NEW); - pitEntry->insertOrUpdateOutRecord(*face3, *interest); + pitEntry->insertOrUpdateOutRecord(*face3, 0, *interest); this->advanceClocks(RETRANSMISSION_10P, 5); // @ time 0.5 interval - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::SUPPRESS); - pitEntry->insertOrUpdateInRecord(*face2, *interest); + pitEntry->insertOrUpdateInRecord(*face2, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::SUPPRESS); this->advanceClocks(RETRANSMISSION_10P, 6); // @ time 1.1 interval - pitEntry->insertOrUpdateInRecord(*face2, *interest); + pitEntry->insertOrUpdateInRecord(*face2, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::FORWARD); // but strategy decides not to forward this->advanceClocks(RETRANSMISSION_10P, 1); // @ time 1.2 interval - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::FORWARD); // retransmission suppress shall still give clearance for forwarding - pitEntry->insertOrUpdateOutRecord(*face3, *interest); // and strategy forwards + pitEntry->insertOrUpdateOutRecord(*face3, 0, *interest); // and strategy forwards this->advanceClocks(RETRANSMISSION_10P, 2); // @ time 1.4 interval - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::SUPPRESS); - pitEntry->insertOrUpdateInRecord(*face2, *interest); + pitEntry->insertOrUpdateInRecord(*face2, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::SUPPRESS); } @@ -103,13 +103,13 @@ BOOST_AUTO_TEST_CASE(Exponential) shared_ptr pitEntry = pit.insert(*interest).first; // @ 0ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::NEW); - pitEntry->insertOrUpdateOutRecord(*face2, *interest); + pitEntry->insertOrUpdateOutRecord(*face2, 0, *interest); // suppression interval is 10ms, until 10ms this->advanceClocks(time::milliseconds(5)); // @ 5ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::SUPPRESS); // suppression interval is 10ms, until 10ms @@ -117,42 +117,42 @@ BOOST_AUTO_TEST_CASE(Exponential) // note: what happens at *exactly* 10ms does not matter so it's untested, // because in reality network timing won't be exact: // incoming Interest is processed either before or after 10ms point - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::FORWARD); - pitEntry->insertOrUpdateOutRecord(*face2, *interest); + pitEntry->insertOrUpdateOutRecord(*face2, 0, *interest); // suppression interval is 30ms, until 41ms this->advanceClocks(time::milliseconds(25)); // @ 36ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::SUPPRESS); // suppression interval is 30ms, until 41ms this->advanceClocks(time::milliseconds(6)); // @ 42ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::FORWARD); // strategy decides not to forward, but suppression interval is increased nevertheless // suppression interval is 90ms, until 101ms this->advanceClocks(time::milliseconds(58)); // @ 100ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::SUPPRESS); // suppression interval is 90ms, until 101ms this->advanceClocks(time::milliseconds(3)); // @ 103ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::FORWARD); - pitEntry->insertOrUpdateOutRecord(*face2, *interest); + pitEntry->insertOrUpdateOutRecord(*face2, 0, *interest); // suppression interval is 100ms, until 203ms this->advanceClocks(time::milliseconds(99)); // @ 202ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::SUPPRESS); // suppression interval is 100ms, until 203ms this->advanceClocks(time::milliseconds(2)); // @ 204ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerPitEntry(*pitEntry) == RetxSuppressionResult::FORWARD); - pitEntry->insertOrUpdateOutRecord(*face2, *interest); + pitEntry->insertOrUpdateOutRecord(*face2, 0, *interest); // suppression interval is 100ms, until 304ms } @@ -171,28 +171,28 @@ BOOST_AUTO_TEST_CASE(ExponentialPerUpstream) shared_ptr pitEntry = pit.insert(*interest).first; // @ 0ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerUpstream(*pitEntry, *face2) == RetxSuppressionResult::NEW); // Simluate forwarding an interest to face2 - pitEntry->insertOrUpdateOutRecord(*face2, *interest); + pitEntry->insertOrUpdateOutRecord(*face2, 0, *interest); this->advanceClocks(time::milliseconds(5)); // @ 5ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerUpstream(*pitEntry, *face2) == RetxSuppressionResult::SUPPRESS); // Return NEW since no outRecord for face1 - pitEntry->insertOrUpdateInRecord(*face2, *interest); + pitEntry->insertOrUpdateInRecord(*face2, 0, *interest); BOOST_CHECK(rs.decidePerUpstream(*pitEntry, *face1) == RetxSuppressionResult::NEW); this->advanceClocks(time::milliseconds(6)); // @ 11ms - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); BOOST_CHECK(rs.decidePerUpstream(*pitEntry, *face2) == RetxSuppressionResult::FORWARD); // Assume interest is sent and increment interval - rs.incrementIntervalForOutRecord(*pitEntry->getOutRecord(*face2)); + rs.incrementIntervalForOutRecord(*pitEntry->getOutRecord(*face2, 0)); - pitEntry->insertOrUpdateInRecord(*face2, *interest); + pitEntry->insertOrUpdateInRecord(*face2, 0, *interest); BOOST_CHECK(rs.decidePerUpstream(*pitEntry, *face2) == RetxSuppressionResult::SUPPRESS); } diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp index aea8d882..ed2e9e1a 100644 --- a/tests/daemon/fw/strategy-nack-return.t.cpp +++ b/tests/daemon/fw/strategy-nack-return.t.cpp @@ -103,12 +103,12 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(OneUpstream, shared_ptr interest1 = makeInterest("/McQYjMbm", 992); shared_ptr interest2 = makeInterest("/McQYjMbm", 114); shared_ptr pitEntry = this->pit.insert(*interest1).first; - pitEntry->insertOrUpdateInRecord(*this->face1, *interest1); - pitEntry->insertOrUpdateInRecord(*this->face2, *interest2); - pitEntry->insertOrUpdateOutRecord(*this->face3, *interest1); + pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest1); + pitEntry->insertOrUpdateInRecord(*this->face2, 0, *interest2); + pitEntry->insertOrUpdateOutRecord(*this->face3, 0, *interest1); lp::Nack nack3 = makeNack("/McQYjMbm", 992, lp::NackReason::CONGESTION); - pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3); + pitEntry->getOutRecord(*this->face3, 0)->setIncomingNack(nack3); BOOST_REQUIRE(this->strategy.waitForAction( [&] { this->strategy.afterReceiveNack(*this->face3, nack3, pitEntry); }, @@ -137,18 +137,18 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(TwoUpstreams, shared_ptr interest1 = makeInterest("/aS9FAyUV19", 286); shared_ptr pitEntry = this->pit.insert(*interest1).first; - pitEntry->insertOrUpdateInRecord(*this->face1, *interest1); - pitEntry->insertOrUpdateOutRecord(*this->face3, *interest1); - pitEntry->insertOrUpdateOutRecord(*this->face4, *interest1); + pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest1); + pitEntry->insertOrUpdateOutRecord(*this->face3, 0, *interest1); + pitEntry->insertOrUpdateOutRecord(*this->face4, 0, *interest1); lp::Nack nack3 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION); - pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3); + pitEntry->getOutRecord(*this->face3, 0)->setIncomingNack(nack3); this->strategy.afterReceiveNack(*this->face3, nack3, pitEntry); BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked lp::Nack nack4 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION); - pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4); + pitEntry->getOutRecord(*this->face4, 0)->setIncomingNack(nack4); BOOST_REQUIRE(this->strategy.waitForAction( [&] { this->strategy.afterReceiveNack(*this->face4, nack4, pitEntry); }, this->limitedIo)); @@ -171,18 +171,18 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(Timeout, shared_ptr interest1 = makeInterest("/sIYw0TXWDj", 115); interest1->setInterestLifetime(time::milliseconds(400)); shared_ptr pitEntry = this->pit.insert(*interest1).first; - pitEntry->insertOrUpdateInRecord(*this->face1, *interest1); - pitEntry->insertOrUpdateOutRecord(*this->face3, *interest1); + pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest1); + pitEntry->insertOrUpdateOutRecord(*this->face3, 0, *interest1); this->advanceClocks(time::milliseconds(300)); shared_ptr interest2 = makeInterest("/sIYw0TXWDj", 223); - pitEntry->insertOrUpdateInRecord(*this->face1, *interest2); - pitEntry->insertOrUpdateOutRecord(*this->face4, *interest2); + pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest2); + pitEntry->insertOrUpdateOutRecord(*this->face4, 0, *interest2); this->advanceClocks(time::milliseconds(200)); // face3 has timed out lp::Nack nack4 = makeNack("/sIYw0TXWDj", 223, lp::NackReason::CONGESTION); - pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4); + pitEntry->getOutRecord(*this->face4, 0)->setIncomingNack(nack4); this->strategy.afterReceiveNack(*this->face4, nack4, pitEntry); BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0); @@ -323,18 +323,18 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(CombineReasons, Combination, NackReasonCombinat shared_ptr interest1 = makeInterest("/F6sEwB24I", 282); shared_ptr pitEntry = pit.insert(*interest1).first; - pitEntry->insertOrUpdateInRecord(*face1, *interest1); - pitEntry->insertOrUpdateOutRecord(*face3, *interest1); - pitEntry->insertOrUpdateOutRecord(*face4, *interest1); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest1); + pitEntry->insertOrUpdateOutRecord(*face3, 0, *interest1); + pitEntry->insertOrUpdateOutRecord(*face4, 0, *interest1); lp::Nack nack3 = makeNack(*interest1, Combination::getX()); - pitEntry->getOutRecord(*face3)->setIncomingNack(nack3); + pitEntry->getOutRecord(*face3, 0)->setIncomingNack(nack3); strategy.afterReceiveNack(*face3, nack3, pitEntry); BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0); lp::Nack nack4 = makeNack(*interest1, Combination::getY()); - pitEntry->getOutRecord(*face4)->setIncomingNack(nack4); + pitEntry->getOutRecord(*face4, 0)->setIncomingNack(nack4); strategy.afterReceiveNack(*face4, nack4, pitEntry); BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1); diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp index 8183cafb..4719c5e0 100644 --- a/tests/daemon/fw/strategy-no-route.t.cpp +++ b/tests/daemon/fw/strategy-no-route.t.cpp @@ -161,7 +161,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(IncomingInterest, T, Tests, shared_ptr interest = makeInterest(scenario.getInterestName()); shared_ptr pitEntry = this->pit.insert(*interest).first; - pitEntry->insertOrUpdateInRecord(*this->face1, *interest); + pitEntry->insertOrUpdateInRecord(*this->face1, 0, *interest); BOOST_REQUIRE(this->strategy.waitForAction( [&] { this->strategy.afterReceiveInterest(*this->face1, *interest, pitEntry); }, diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp index bd59838a..029ab0ea 100644 --- a/tests/daemon/fw/strategy-scope-control.t.cpp +++ b/tests/daemon/fw/strategy-scope-control.t.cpp @@ -122,7 +122,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostInterestToLocal, shared_ptr interest = makeInterest("/localhost/A/1"); shared_ptr pitEntry = this->pit.insert(*interest).first; - pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest); + pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest); BOOST_REQUIRE(this->strategy.waitForAction( [&] { this->strategy.afterReceiveInterest(*this->localFace3, *interest, pitEntry); }, @@ -141,7 +141,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostInterestToNonLocal, shared_ptr interest = makeInterest("/localhost/A/1"); shared_ptr pitEntry = this->pit.insert(*interest).first; - pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest); + pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest); BOOST_REQUIRE(this->strategy.waitForAction( [&] { this->strategy.afterReceiveInterest(*this->localFace3, *interest, pitEntry); }, @@ -164,7 +164,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostInterestToLocalAndNonLocal, shared_ptr interest = makeInterest("/localhost/A/1"); shared_ptr pitEntry = this->pit.insert(*interest).first; - pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest); + pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest); BOOST_REQUIRE(this->strategy.waitForAction( [&] { this->strategy.afterReceiveInterest(*this->localFace3, *interest, pitEntry); }, @@ -184,7 +184,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhopInterestToNonLocal, shared_ptr interest = makeInterest("/localhop/A/1"); shared_ptr pitEntry = this->pit.insert(*interest).first; - pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, *interest); + pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, 0, *interest); BOOST_REQUIRE(this->strategy.waitForAction( [&] { this->strategy.afterReceiveInterest(*this->nonLocalFace1, *interest, pitEntry); }, @@ -207,7 +207,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhopInterestToNonLocalAndLocal, shared_ptr interest = makeInterest("/localhop/A/1"); shared_ptr pitEntry = this->pit.insert(*interest).first; - pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, *interest); + pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, 0, *interest); BOOST_REQUIRE(this->strategy.waitForAction( [&] { this->strategy.afterReceiveInterest(*this->nonLocalFace1, *interest, pitEntry); }, @@ -228,9 +228,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostNackToNonLocal, shared_ptr interest = makeInterest("/localhost/A/1", 1460); shared_ptr pitEntry = this->pit.insert(*interest).first; - pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest); + pitEntry->insertOrUpdateInRecord(*this->localFace3, 0, *interest); lp::Nack nack = makeNack("/localhost/A/1", 1460, lp::NackReason::NO_ROUTE); - pitEntry->insertOrUpdateOutRecord(*this->localFace4, *interest)->setIncomingNack(nack); + pitEntry->insertOrUpdateOutRecord(*this->localFace4, 0, *interest)->setIncomingNack(nack); BOOST_REQUIRE(this->strategy.waitForAction( [&] { this->strategy.afterReceiveNack(*this->localFace4, nack, pitEntry); }, @@ -253,9 +253,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhopNackToNonLocal, shared_ptr interest = makeInterest("/localhop/A/1", 1377); shared_ptr pitEntry = this->pit.insert(*interest).first; - pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, *interest); + pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, 0, *interest); lp::Nack nack = makeNack("/localhop/A/1", 1377, lp::NackReason::NO_ROUTE); - pitEntry->insertOrUpdateOutRecord(*this->localFace4, *interest)->setIncomingNack(nack); + pitEntry->insertOrUpdateOutRecord(*this->localFace4, 0, *interest)->setIncomingNack(nack); BOOST_REQUIRE(this->strategy.waitForAction( [&] { this->strategy.afterReceiveNack(*this->localFace4, nack, pitEntry); }, diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp index 0d76d761..c8423277 100644 --- a/tests/daemon/fw/strategy-tester.hpp +++ b/tests/daemon/fw/strategy-tester.hpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ -/** - * Copyright (c) 2014-2017, Regents of the University of California, +/* + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -110,7 +110,7 @@ protected: const Interest& interest) override { sendInterestHistory.push_back({pitEntry->getInterest(), outFace.getId(), interest}); - pitEntry->insertOrUpdateOutRecord(outFace, interest); + pitEntry->insertOrUpdateOutRecord(outFace, 0, interest); afterAction(); } @@ -126,7 +126,7 @@ protected: const lp::NackHeader& header) override { sendNackHistory.push_back({pitEntry->getInterest(), outFace.getId(), header}); - pitEntry->deleteInRecord(outFace); + pitEntry->deleteInRecord(outFace, 0); afterAction(); } diff --git a/tests/daemon/table/cleanup.t.cpp b/tests/daemon/table/cleanup.t.cpp index 3365a502..c6bd7729 100644 --- a/tests/daemon/table/cleanup.t.cpp +++ b/tests/daemon/table/cleanup.t.cpp @@ -55,10 +55,10 @@ BOOST_AUTO_TEST_CASE(Basic) shared_ptr interest = makeInterest(name); shared_ptr pitEntry = pit.insert(*interest).first; if ((i & 0x01) != 0) { - pitEntry->insertOrUpdateInRecord(*face1, *interest); + pitEntry->insertOrUpdateInRecord(*face1, 0, *interest); } if ((i & 0x02) != 0) { - pitEntry->insertOrUpdateOutRecord(*face1, *interest); + pitEntry->insertOrUpdateOutRecord(*face1, 0, *interest); } } BOOST_CHECK_EQUAL(fib.size(), 300); @@ -144,22 +144,22 @@ BOOST_AUTO_TEST_CASE(DeletePitInOutRecords) shared_ptr interestA = makeInterest("/A"); shared_ptr entryA = pit.insert(*interestA).first; - entryA->insertOrUpdateInRecord(*face1, *interestA); - entryA->insertOrUpdateInRecord(*face2, *interestA); - entryA->insertOrUpdateOutRecord(*face1, *interestA); - entryA->insertOrUpdateOutRecord(*face2, *interestA); + entryA->insertOrUpdateInRecord(*face1, 0, *interestA); + entryA->insertOrUpdateInRecord(*face2, 0, *interestA); + entryA->insertOrUpdateOutRecord(*face1, 0, *interestA); + entryA->insertOrUpdateOutRecord(*face2, 0, *interestA); // {'/A':[1,2]} shared_ptr interestB = makeInterest("/B"); shared_ptr entryB = pit.insert(*interestB).first; - entryB->insertOrUpdateInRecord(*face1, *interestB); - entryB->insertOrUpdateOutRecord(*face1, *interestB); + entryB->insertOrUpdateInRecord(*face1, 0, *interestB); + entryB->insertOrUpdateOutRecord(*face1, 0, *interestB); // {'/A':[1,2], '/B':[1]} shared_ptr interestC = makeInterest("/C"); shared_ptr entryC = pit.insert(*interestC).first; - entryC->insertOrUpdateInRecord(*face2, *interestC); - entryC->insertOrUpdateOutRecord(*face2, *interestC); + entryC->insertOrUpdateInRecord(*face2, 0, *interestC); + entryC->insertOrUpdateOutRecord(*face2, 0, *interestC); // {'/A':[1,2], '/B':[1], '/C':[2]} BOOST_CHECK_EQUAL(pit.size(), 3); diff --git a/tests/daemon/table/pit-entry.t.cpp b/tests/daemon/table/pit-entry.t.cpp index effb624f..d4234ad2 100644 --- a/tests/daemon/table/pit-entry.t.cpp +++ b/tests/daemon/table/pit-entry.t.cpp @@ -1,6 +1,6 @@ /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* - * Copyright (c) 2014-2017, Regents of the University of California, + * Copyright (c) 2014-2019, Regents of the University of California, * Arizona Board of Regents, * Colorado State University, * University Pierre & Marie Curie, Sorbonne University, @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE(InOutRecords) // insert in-record time::steady_clock::TimePoint before1 = time::steady_clock::now(); - InRecordCollection::iterator in1 = entry.insertOrUpdateInRecord(*face1, *interest1); + InRecordCollection::iterator in1 = entry.insertOrUpdateInRecord(*face1, 0, *interest1); time::steady_clock::TimePoint after1 = time::steady_clock::now(); const InRecordCollection& inRecords2 = entry.getInRecords(); BOOST_CHECK_EQUAL(inRecords2.size(), 1); @@ -106,11 +106,11 @@ BOOST_AUTO_TEST_CASE(InOutRecords) BOOST_CHECK_LE(in1->getExpiry() - in1->getLastRenewed() - interest1->getInterestLifetime(), (after1 - before1)); - BOOST_CHECK(in1 == entry.getInRecord(*face1)); + BOOST_CHECK(in1 == entry.getInRecord(*face1, 0)); // insert out-record time::steady_clock::TimePoint before2 = time::steady_clock::now(); - OutRecordCollection::iterator out1 = entry.insertOrUpdateOutRecord(*face1, *interest1); + OutRecordCollection::iterator out1 = entry.insertOrUpdateOutRecord(*face1, 0, *interest1); time::steady_clock::TimePoint after2 = time::steady_clock::now(); const OutRecordCollection& outRecords2 = entry.getOutRecords(); BOOST_CHECK_EQUAL(outRecords2.size(), 1); @@ -122,11 +122,11 @@ BOOST_AUTO_TEST_CASE(InOutRecords) BOOST_CHECK_LE(out1->getExpiry() - out1->getLastRenewed() - interest1->getInterestLifetime(), (after2 - before2)); - BOOST_CHECK(out1 == entry.getOutRecord(*face1)); + BOOST_CHECK(out1 == entry.getOutRecord(*face1, 0)); // update in-record time::steady_clock::TimePoint before3 = time::steady_clock::now(); - InRecordCollection::iterator in2 = entry.insertOrUpdateInRecord(*face1, *interest2); + InRecordCollection::iterator in2 = entry.insertOrUpdateInRecord(*face1, 0, *interest2); time::steady_clock::TimePoint after3 = time::steady_clock::now(); const InRecordCollection& inRecords3 = entry.getInRecords(); BOOST_CHECK_EQUAL(inRecords3.size(), 1); @@ -138,13 +138,13 @@ BOOST_AUTO_TEST_CASE(InOutRecords) (after3 - before3)); // insert another in-record - InRecordCollection::iterator in3 = entry.insertOrUpdateInRecord(*face2, *interest3); + InRecordCollection::iterator in3 = entry.insertOrUpdateInRecord(*face2, 0, *interest3); const InRecordCollection& inRecords4 = entry.getInRecords(); BOOST_CHECK_EQUAL(inRecords4.size(), 2); BOOST_CHECK_EQUAL(&in3->getFace(), face2.get()); // get in-record - InRecordCollection::iterator in4 = entry.getInRecord(*face1); + InRecordCollection::iterator in4 = entry.getInRecord(*face1, 0); BOOST_REQUIRE(in4 != entry.in_end()); BOOST_CHECK_EQUAL(&in4->getFace(), face1.get()); @@ -152,26 +152,26 @@ BOOST_AUTO_TEST_CASE(InOutRecords) entry.clearInRecords(); const InRecordCollection& inRecords5 = entry.getInRecords(); BOOST_CHECK_EQUAL(inRecords5.size(), 0); - BOOST_CHECK(entry.getInRecord(*face1) == entry.in_end()); + BOOST_CHECK(entry.getInRecord(*face1, 0) == entry.in_end()); // insert another out-record OutRecordCollection::iterator out2 = - entry.insertOrUpdateOutRecord(*face2, *interest4); + entry.insertOrUpdateOutRecord(*face2, 0, *interest4); const OutRecordCollection& outRecords3 = entry.getOutRecords(); BOOST_CHECK_EQUAL(outRecords3.size(), 2); BOOST_CHECK_EQUAL(&out2->getFace(), face2.get()); // get out-record - OutRecordCollection::iterator out3 = entry.getOutRecord(*face1); + OutRecordCollection::iterator out3 = entry.getOutRecord(*face1, 0); BOOST_REQUIRE(out3 != entry.out_end()); BOOST_CHECK_EQUAL(&out3->getFace(), face1.get()); // delete out-record - entry.deleteOutRecord(*face2); + entry.deleteOutRecord(*face2, 0); const OutRecordCollection& outRecords4 = entry.getOutRecords(); BOOST_REQUIRE_EQUAL(outRecords4.size(), 1); BOOST_CHECK_EQUAL(&outRecords4.begin()->getFace(), face1.get()); - BOOST_CHECK(entry.getOutRecord(*face2) == entry.out_end()); + BOOST_CHECK(entry.getOutRecord(*face2, 0) == entry.out_end()); } BOOST_AUTO_TEST_CASE(Lifetime) @@ -181,17 +181,17 @@ BOOST_AUTO_TEST_CASE(Lifetime) shared_ptr face = make_shared(); Entry entry(*interest); - InRecordCollection::iterator inIt = entry.insertOrUpdateInRecord(*face, *interest); + InRecordCollection::iterator inIt = entry.insertOrUpdateInRecord(*face, 0, *interest); BOOST_CHECK_GT(inIt->getExpiry(), time::steady_clock::now()); - OutRecordCollection::iterator outIt = entry.insertOrUpdateOutRecord(*face, *interest); + OutRecordCollection::iterator outIt = entry.insertOrUpdateOutRecord(*face, 0, *interest); BOOST_CHECK_GT(outIt->getExpiry(), time::steady_clock::now()); } BOOST_AUTO_TEST_CASE(OutRecordNack) { shared_ptr face1 = make_shared(); - OutRecord outR(*face1); + OutRecord outR(*face1, 0); BOOST_CHECK(outR.getIncomingNack() == nullptr); shared_ptr interest1 = makeInterest("ndn:/uWiapGjYL");