table: reorganize PIT implementation
Merge pit-{face,in,out}-record.{cpp,hpp} into pit-entry.{cpp,hpp}
and merge pit-iterator.{cpp,hpp} into pit.{cpp,hpp}.
Rename get{In,Out}Record() to find{In,Out}Record(), following the
typical C++ pattern of using the verb "find" for functions that
return iterators.
No functional changes.
Change-Id: I6740dd6cfe92ca477938ab8dc2f6271fd8b6cc26
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 0070a3e..2c154bc 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -170,7 +170,7 @@
return;
}
- auto inRecord = pitEntry->getInRecord(*inFace);
+ auto inRecord = pitEntry->findInRecord(*inFace);
// 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 the in-record,
// and the RTO timer should be cancelled in that case as well
@@ -218,7 +218,7 @@
return;
}
- auto outRecord = pitEntry->getOutRecord(ingress.face);
+ auto outRecord = pitEntry->findOutRecord(ingress.face);
if (outRecord == pitEntry->out_end()) {
NFD_LOG_DATA_FROM(data, ingress, "no-out-record");
return;
diff --git a/daemon/fw/algorithm.cpp b/daemon/fw/algorithm.cpp
index a16ccc3..cdc432b 100644
--- a/daemon/fw/algorithm.cpp
+++ b/daemon/fw/algorithm.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -116,7 +116,7 @@
if (!isNextHopEligible(inFace, interest, *it, pitEntry))
continue;
- auto outRecord = pitEntry->getOutRecord(it->getFace());
+ auto outRecord = pitEntry->findOutRecord(it->getFace());
BOOST_ASSERT(outRecord != pitEntry->out_end());
if (outRecord->getLastRenewed() < earliestRenewed) {
found = it;
@@ -142,7 +142,7 @@
if (wantUnused) {
// nexthop must not have unexpired out-record
- auto outRecord = pitEntry->getOutRecord(outFace);
+ auto outRecord = pitEntry->findOutRecord(outFace);
if (outRecord != pitEntry->out_end() && outRecord->getExpiry() > now) {
return false;
}
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index 18d1b70..edb6ec1 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -144,7 +144,7 @@
return;
}
- auto outRecord = pitEntry->getOutRecord(ingress.face);
+ auto outRecord = pitEntry->findOutRecord(ingress.face);
if (outRecord == pitEntry->out_end()) {
NFD_LOG_DATA_FROM(data, ingress, "no-out-record");
}
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 4aa78e2..993f773 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -453,7 +453,7 @@
}
// has out-record?
- auto outRecord = pitEntry->getOutRecord(ingress.face);
+ auto outRecord = pitEntry->findOutRecord(ingress.face);
// if no out-record found, drop
if (outRecord == pitEntry->out_end()) {
NFD_LOG_DEBUG("onIncomingNack in=" << ingress << " nack=" << nack.getInterest().getName()
@@ -495,7 +495,7 @@
}
// has in-record?
- auto inRecord = pitEntry->getInRecord(egress);
+ auto inRecord = pitEntry->findInRecord(egress);
// if no in-record found, drop
if (inRecord == pitEntry->in_end()) {
@@ -585,15 +585,14 @@
// Dead Nonce List insert
if (upstream == nullptr) {
// insert all outgoing Nonces
- const auto& outRecords = pitEntry.getOutRecords();
- std::for_each(outRecords.begin(), outRecords.end(), [&] (const auto& outRecord) {
+ std::for_each(pitEntry.out_begin(), pitEntry.out_end(), [&] (const auto& outRecord) {
m_deadNonceList.add(pitEntry.getName(), outRecord.getLastNonce());
});
}
else {
// insert outgoing Nonce of a specific face
- auto outRecord = pitEntry.getOutRecord(*upstream);
- if (outRecord != pitEntry.getOutRecords().end()) {
+ auto outRecord = pitEntry.findOutRecord(*upstream);
+ if (outRecord != pitEntry.out_end()) {
m_deadNonceList.add(pitEntry.getName(), outRecord->getLastNonce());
}
}
diff --git a/daemon/fw/process-nack-traits.cpp b/daemon/fw/process-nack-traits.cpp
index 25b2526..6919268 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-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -55,7 +55,7 @@
if (nOutRecordsNotNacked == 1) {
BOOST_ASSERT(lastFaceNotNacked != nullptr);
- auto inR = pitEntry->getInRecord(*lastFaceNotNacked);
+ auto inR = pitEntry->findInRecord(*lastFaceNotNacked);
if (inR != pitEntry->in_end()) {
// one out-record not Nacked, which is also a downstream
NFD_LOG_NACK_FROM(nack, inFace.getId(), "bidirectional nack-to=" << lastFaceNotNacked->getId()
diff --git a/daemon/fw/retx-suppression-exponential.cpp b/daemon/fw/retx-suppression-exponential.cpp
index 39af1f5..8eb5071 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-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -99,7 +99,7 @@
RetxSuppressionExponential::decidePerUpstream(pit::Entry& pitEntry, Face& outFace)
{
// NEW if outRecord for the face does not exist
- auto outRecord = pitEntry.getOutRecord(outFace);
+ auto outRecord = pitEntry.findOutRecord(outFace);
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 7cb14c4..8b5b9e8 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -73,7 +73,7 @@
const fib::NextHopList& nexthops = fibEntry.getNextHops();
bool isNonDiscovery = interest.getTag<lp::NonDiscoveryTag>() != nullptr;
- auto inRecordInfo = pitEntry->getInRecord(ingress.face)->insertStrategyInfo<InRecordInfo>().first;
+ auto inRecordInfo = pitEntry->findInRecord(ingress.face)->insertStrategyInfo<InRecordInfo>().first;
if (isNonDiscovery) { // "non-discovery" Interest
inRecordInfo->isNonDiscoveryInterest = true;
if (nexthops.empty()) { // return NACK if no matching FIB entry exists
@@ -103,7 +103,7 @@
SelfLearningStrategy::afterReceiveData(const Data& data, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
- auto outRecord = pitEntry->getOutRecord(ingress.face);
+ auto outRecord = pitEntry->findOutRecord(ingress.face);
if (outRecord == pitEntry->out_end()) {
NFD_LOG_DATA_FROM(data, ingress, "no-out-record");
return;
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 712e200..47fd7d9 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -248,7 +248,7 @@
{
BOOST_ASSERT(pitEntry->getInterest().matchesData(data));
- auto inRecord = pitEntry->getInRecord(egress);
+ auto inRecord = pitEntry->findInRecord(egress);
if (inRecord != pitEntry->in_end()) {
auto pitToken = inRecord->getInterest().getTag<lp::PitToken>();
diff --git a/daemon/table/pit-entry.cpp b/daemon/table/pit-entry.cpp
index 194106d..cfbbc82 100644
--- a/daemon/table/pit-entry.cpp
+++ b/daemon/table/pit-entry.cpp
@@ -29,6 +29,36 @@
namespace nfd::pit {
+void
+FaceRecord::update(const Interest& interest)
+{
+ m_lastNonce = interest.getNonce();
+ m_lastRenewed = time::steady_clock::now();
+
+ auto lifetime = interest.getInterestLifetime();
+ // impose an upper bound on the lifetime to prevent integer overflow when calculating m_expiry
+ lifetime = std::min<time::milliseconds>(lifetime, 10_days);
+ m_expiry = m_lastRenewed + lifetime;
+}
+
+void
+InRecord::update(const Interest& interest)
+{
+ FaceRecord::update(interest);
+ m_interest = interest.shared_from_this();
+}
+
+bool
+OutRecord::setIncomingNack(const lp::Nack& nack)
+{
+ if (nack.getInterest().getNonce() != this->getLastNonce()) {
+ return false;
+ }
+
+ m_incomingNack = make_unique<lp::NackHeader>(nack.getHeader());
+ return true;
+}
+
Entry::Entry(const Interest& interest)
: m_interest(interest.shared_from_this())
{
@@ -48,7 +78,7 @@
}
InRecordCollection::iterator
-Entry::getInRecord(const Face& face)
+Entry::findInRecord(const Face& face)
{
return std::find_if(m_inRecords.begin(), m_inRecords.end(),
[&face] (const InRecord& inRecord) { return &inRecord.getFace() == &face; });
@@ -70,21 +100,8 @@
return it;
}
-void
-Entry::deleteInRecord(InRecordCollection::const_iterator pos)
-{
- BOOST_ASSERT(pos != m_inRecords.end());
- m_inRecords.erase(pos);
-}
-
-void
-Entry::clearInRecords()
-{
- m_inRecords.clear();
-}
-
OutRecordCollection::iterator
-Entry::getOutRecord(const Face& face)
+Entry::findOutRecord(const Face& face)
{
return std::find_if(m_outRecords.begin(), m_outRecords.end(),
[&face] (const OutRecord& outRecord) { return &outRecord.getFace() == &face; });
diff --git a/daemon/table/pit-entry.hpp b/daemon/table/pit-entry.hpp
index d6f304b..a314ae6 100644
--- a/daemon/table/pit-entry.hpp
+++ b/daemon/table/pit-entry.hpp
@@ -26,18 +26,151 @@
#ifndef NFD_DAEMON_TABLE_PIT_ENTRY_HPP
#define NFD_DAEMON_TABLE_PIT_ENTRY_HPP
-#include "pit-in-record.hpp"
-#include "pit-out-record.hpp"
+#include "strategy-info-host.hpp"
#include <ndn-cxx/util/scheduler.hpp>
#include <list>
-namespace nfd::name_tree {
-class Entry;
-} // namespace nfd::name_tree
+namespace nfd {
-namespace nfd::pit {
+namespace face {
+class Face;
+} // namespace face
+using face::Face;
+
+namespace name_tree {
+class Entry;
+} // namespace name_tree
+
+namespace pit {
+
+/**
+ * \brief Contains information about an Interest on an incoming or outgoing face.
+ * \note This class is an implementation detail to extract common functionality
+ * of InRecord and OutRecord.
+ */
+class FaceRecord : public StrategyInfoHost
+{
+public:
+ explicit
+ FaceRecord(Face& face)
+ : m_face(face)
+ {
+ }
+
+ Face&
+ getFace() const noexcept
+ {
+ return m_face;
+ }
+
+ Interest::Nonce
+ getLastNonce() const noexcept
+ {
+ return m_lastNonce;
+ }
+
+ time::steady_clock::time_point
+ getLastRenewed() const noexcept
+ {
+ return m_lastRenewed;
+ }
+
+ /**
+ * \brief Returns the time point at which this record expires.
+ * \return getLastRenewed() + InterestLifetime
+ */
+ time::steady_clock::time_point
+ getExpiry() const noexcept
+ {
+ return m_expiry;
+ }
+
+ /**
+ * \brief Updates lastNonce, lastRenewed, expiry fields.
+ */
+ void
+ update(const Interest& interest);
+
+private:
+ Face& m_face;
+ Interest::Nonce m_lastNonce{0, 0, 0, 0};
+ time::steady_clock::time_point m_lastRenewed = time::steady_clock::time_point::min();
+ time::steady_clock::time_point m_expiry = time::steady_clock::time_point::min();
+};
+
+/**
+ * \brief Contains information about an Interest from an incoming face.
+ */
+class InRecord : public FaceRecord
+{
+public:
+ using FaceRecord::FaceRecord;
+
+ const Interest&
+ getInterest() const noexcept
+ {
+ BOOST_ASSERT(m_interest != nullptr);
+ return *m_interest;
+ }
+
+ void
+ update(const Interest& interest);
+
+private:
+ shared_ptr<const Interest> m_interest;
+};
+
+/**
+ * \brief Contains information about an Interest toward an outgoing face.
+ */
+class OutRecord : public FaceRecord
+{
+public:
+ using FaceRecord::FaceRecord;
+
+ /**
+ * \brief Returns the last Nack returned by getFace().
+ *
+ * A nullptr return value means the Interest is still pending or has timed out.
+ * A non-null return value means the last outgoing Interest has been Nacked.
+ */
+ const lp::NackHeader*
+ getIncomingNack() const noexcept
+ {
+ return m_incomingNack.get();
+ }
+
+ /**
+ * \brief Sets a Nack received from getFace().
+ * \return whether incoming Nack is accepted
+ *
+ * This is invoked in incoming Nack pipeline.
+ *
+ * An incoming Nack is accepted if its Nonce matches getLastNonce().
+ * If accepted, `nack.getHeader()` will be copied, and any pointers
+ * previously returned by getIncomingNack() are invalidated.
+ */
+ bool
+ setIncomingNack(const lp::Nack& nack);
+
+ /**
+ * \brief Clears last Nack.
+ *
+ * This is invoked in outgoing Interest pipeline.
+ *
+ * Any pointers previously returned by getIncomingNack() are invalidated.
+ */
+ void
+ clearIncomingNack() noexcept
+ {
+ m_incomingNack.reset();
+ }
+
+private:
+ unique_ptr<lp::NackHeader> m_incomingNack;
+};
/**
* \brief An unordered collection of in-records.
@@ -142,7 +275,7 @@
* \return an iterator to the in-record, or in_end() if it does not exist
*/
InRecordCollection::iterator
- getInRecord(const Face& face);
+ findInRecord(const Face& face);
/**
* \brief Insert or update an in-record.
@@ -156,13 +289,19 @@
* \param pos iterator to the in-record to remove; must be valid and dereferenceable.
*/
void
- deleteInRecord(InRecordCollection::const_iterator pos);
+ deleteInRecord(InRecordCollection::const_iterator pos)
+ {
+ m_inRecords.erase(pos);
+ }
/**
* \brief Removes all in-records.
*/
void
- clearInRecords();
+ clearInRecords() noexcept
+ {
+ m_inRecords.clear();
+ }
public: // out-record
/**
@@ -215,7 +354,7 @@
* \return an iterator to the out-record, or out_end() if it does not exist
*/
OutRecordCollection::iterator
- getOutRecord(const Face& face);
+ findOutRecord(const Face& face);
/**
* \brief Insert or update an out-record.
@@ -256,6 +395,7 @@
friend ::nfd::name_tree::Entry;
};
-} // namespace nfd::pit
+} // namespace pit
+} // namespace nfd
#endif // NFD_DAEMON_TABLE_PIT_ENTRY_HPP
diff --git a/daemon/table/pit-face-record.cpp b/daemon/table/pit-face-record.cpp
deleted file mode 100644
index 4b96c40..0000000
--- a/daemon/table/pit-face-record.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2022, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "pit-face-record.hpp"
-
-namespace nfd::pit {
-
-// Impose a maximum lifetime to prevent integer overflow when calculating m_expiry.
-constexpr time::milliseconds MAX_LIFETIME = 10_days;
-
-void
-FaceRecord::update(const Interest& interest)
-{
- m_lastNonce = interest.getNonce();
- m_lastRenewed = time::steady_clock::now();
-
- auto lifetime = interest.getInterestLifetime();
- lifetime = std::min(lifetime, MAX_LIFETIME);
- m_expiry = m_lastRenewed + lifetime;
-}
-
-} // namespace nfd::pit
diff --git a/daemon/table/pit-face-record.hpp b/daemon/table/pit-face-record.hpp
deleted file mode 100644
index 830316e..0000000
--- a/daemon/table/pit-face-record.hpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2022, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_DAEMON_TABLE_PIT_FACE_RECORD_HPP
-#define NFD_DAEMON_TABLE_PIT_FACE_RECORD_HPP
-
-#include "face/face.hpp"
-#include "strategy-info-host.hpp"
-
-namespace nfd::pit {
-
-/**
- * \brief Contains information about an Interest on an incoming or outgoing face.
- * \note This class is an implementation detail to extract common functionality
- * of InRecord and OutRecord.
- */
-class FaceRecord : public StrategyInfoHost
-{
-public:
- explicit
- FaceRecord(Face& face)
- : m_face(face)
- {
- }
-
- Face&
- getFace() const noexcept
- {
- return m_face;
- }
-
- Interest::Nonce
- getLastNonce() const noexcept
- {
- return m_lastNonce;
- }
-
- time::steady_clock::time_point
- getLastRenewed() const noexcept
- {
- return m_lastRenewed;
- }
-
- /** \brief Returns the time point at which this record expires.
- * \return getLastRenewed() + InterestLifetime
- */
- time::steady_clock::time_point
- getExpiry() const noexcept
- {
- return m_expiry;
- }
-
- /** \brief Updates lastNonce, lastRenewed, expiry fields.
- */
- void
- update(const Interest& interest);
-
-private:
- Face& m_face;
- Interest::Nonce m_lastNonce{0, 0, 0, 0};
- time::steady_clock::time_point m_lastRenewed = time::steady_clock::time_point::min();
- time::steady_clock::time_point m_expiry = time::steady_clock::time_point::min();
-};
-
-} // namespace nfd::pit
-
-#endif // NFD_DAEMON_TABLE_PIT_FACE_RECORD_HPP
diff --git a/daemon/table/pit-in-record.cpp b/daemon/table/pit-in-record.cpp
deleted file mode 100644
index 6982780..0000000
--- a/daemon/table/pit-in-record.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2022, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "pit-in-record.hpp"
-
-namespace nfd::pit {
-
-void
-InRecord::update(const Interest& interest)
-{
- FaceRecord::update(interest);
- m_interest = interest.shared_from_this();
-}
-
-} // namespace nfd::pit
diff --git a/daemon/table/pit-in-record.hpp b/daemon/table/pit-in-record.hpp
deleted file mode 100644
index 95dc710..0000000
--- a/daemon/table/pit-in-record.hpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2022, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_DAEMON_TABLE_PIT_IN_RECORD_HPP
-#define NFD_DAEMON_TABLE_PIT_IN_RECORD_HPP
-
-#include "pit-face-record.hpp"
-
-namespace nfd::pit {
-
-/**
- * \brief Contains information about an Interest from an incoming face.
- */
-class InRecord : public FaceRecord
-{
-public:
- using FaceRecord::FaceRecord;
-
- const Interest&
- getInterest() const noexcept
- {
- BOOST_ASSERT(m_interest != nullptr);
- return *m_interest;
- }
-
- void
- update(const Interest& interest);
-
-private:
- shared_ptr<const Interest> m_interest;
-};
-
-} // namespace nfd::pit
-
-#endif // NFD_DAEMON_TABLE_PIT_IN_RECORD_HPP
diff --git a/daemon/table/pit-iterator.cpp b/daemon/table/pit-iterator.cpp
deleted file mode 100644
index f3680f8..0000000
--- a/daemon/table/pit-iterator.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2023, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "pit-iterator.hpp"
-
-namespace nfd::pit {
-
-Iterator&
-Iterator::operator++()
-{
- BOOST_ASSERT(m_ntIt != NameTree::const_iterator());
- BOOST_ASSERT(m_iPitEntry < m_ntIt->getPitEntries().size());
-
- if (++m_iPitEntry >= m_ntIt->getPitEntries().size()) {
- ++m_ntIt;
- m_iPitEntry = 0;
- BOOST_ASSERT(m_ntIt == NameTree::const_iterator() || m_ntIt->hasPitEntries());
- }
- return *this;
-}
-
-} // namespace nfd::pit
diff --git a/daemon/table/pit-iterator.hpp b/daemon/table/pit-iterator.hpp
deleted file mode 100644
index e1647ff..0000000
--- a/daemon/table/pit-iterator.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2023, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_DAEMON_TABLE_PIT_ITERATOR_HPP
-#define NFD_DAEMON_TABLE_PIT_ITERATOR_HPP
-
-#include "name-tree.hpp"
-#include "pit-entry.hpp"
-
-namespace nfd::pit {
-
-/**
- * \brief PIT iterator.
- */
-class Iterator : public boost::forward_iterator_helper<Iterator, const Entry>
-{
-public:
- /**
- * \brief Constructor.
- * \param ntIt a name tree iterator that visits name tree entries with one or more PIT entries
- * \param iPitEntry make this iterator to dereference to the i-th PIT entry in name tree entry
- */
- explicit
- Iterator(const NameTree::const_iterator& ntIt = {}, size_t iPitEntry = 0)
- : m_ntIt(ntIt)
- , m_iPitEntry(iPitEntry)
- {
- }
-
- const Entry&
- operator*() const noexcept
- {
- BOOST_ASSERT(m_ntIt != NameTree::const_iterator());
- BOOST_ASSERT(m_iPitEntry < m_ntIt->getPitEntries().size());
- return *m_ntIt->getPitEntries()[m_iPitEntry];
- }
-
- Iterator&
- operator++();
-
- friend bool
- operator==(const Iterator& lhs, const Iterator& rhs) noexcept
- {
- return lhs.m_ntIt == rhs.m_ntIt &&
- lhs.m_iPitEntry == rhs.m_iPitEntry;
- }
-
-private:
- NameTree::const_iterator m_ntIt; ///< current name tree entry
- size_t m_iPitEntry; ///< current PIT entry within m_ntIt->getPitEntries()
-};
-
-} // namespace nfd::pit
-
-#endif // NFD_DAEMON_TABLE_PIT_ITERATOR_HPP
diff --git a/daemon/table/pit-out-record.cpp b/daemon/table/pit-out-record.cpp
deleted file mode 100644
index 1f3e899..0000000
--- a/daemon/table/pit-out-record.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2022, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "pit-out-record.hpp"
-
-namespace nfd::pit {
-
-bool
-OutRecord::setIncomingNack(const lp::Nack& nack)
-{
- if (nack.getInterest().getNonce() != this->getLastNonce()) {
- return false;
- }
-
- m_incomingNack = make_unique<lp::NackHeader>(nack.getHeader());
- return true;
-}
-
-} // namespace nfd::pit
diff --git a/daemon/table/pit-out-record.hpp b/daemon/table/pit-out-record.hpp
deleted file mode 100644
index f165370..0000000
--- a/daemon/table/pit-out-record.hpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/*
- * Copyright (c) 2014-2022, Regents of the University of California,
- * Arizona Board of Regents,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University,
- * Washington University in St. Louis,
- * Beijing Institute of Technology,
- * The University of Memphis.
- *
- * This file is part of NFD (Named Data Networking Forwarding Daemon).
- * See AUTHORS.md for complete list of NFD authors and contributors.
- *
- * NFD is free software: you can redistribute it and/or modify it under the terms
- * of the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef NFD_DAEMON_TABLE_PIT_OUT_RECORD_HPP
-#define NFD_DAEMON_TABLE_PIT_OUT_RECORD_HPP
-
-#include "pit-face-record.hpp"
-
-namespace nfd::pit {
-
-/**
- * \brief Contains information about an Interest toward an outgoing face.
- */
-class OutRecord : public FaceRecord
-{
-public:
- using FaceRecord::FaceRecord;
-
- /** \brief Returns the last NACK returned by getFace().
- *
- * A nullptr return value means the Interest is still pending or has timed out.
- * A non-null return value means the last outgoing Interest has been NACKed.
- */
- const lp::NackHeader*
- getIncomingNack() const noexcept
- {
- return m_incomingNack.get();
- }
-
- /** \brief Sets a NACK received from getFace().
- * \return whether incoming NACK is accepted
- *
- * This is invoked in incoming NACK pipeline.
- * An incoming NACK is accepted if its Nonce matches getLastNonce().
- * If accepted, `nack.getHeader()` will be copied,
- * and any pointer previously returned by getIncomingNack().
- */
- bool
- setIncomingNack(const lp::Nack& nack);
-
- /** \brief Clears last NACK.
- *
- * This is invoked in outgoing Interest pipeline.
- * This invalidates any pointer previously returned by getIncomingNack().
- */
- void
- clearIncomingNack() noexcept
- {
- m_incomingNack.reset();
- }
-
-private:
- unique_ptr<lp::NackHeader> m_incomingNack;
-};
-
-} // namespace nfd::pit
-
-#endif // NFD_DAEMON_TABLE_PIT_OUT_RECORD_HPP
diff --git a/daemon/table/pit.cpp b/daemon/table/pit.cpp
index b731df0..f2c7684 100644
--- a/daemon/table/pit.cpp
+++ b/daemon/table/pit.cpp
@@ -27,10 +27,18 @@
namespace nfd::pit {
-static inline bool
-nteHasPitEntries(const name_tree::Entry& nte)
+Iterator&
+Iterator::operator++()
{
- return nte.hasPitEntries();
+ BOOST_ASSERT(m_ntIt != NameTree::const_iterator());
+ BOOST_ASSERT(m_iPitEntry < m_ntIt->getPitEntries().size());
+
+ if (++m_iPitEntry >= m_ntIt->getPitEntries().size()) {
+ ++m_ntIt;
+ m_iPitEntry = 0;
+ BOOST_ASSERT(m_ntIt == NameTree::const_iterator() || m_ntIt->hasPitEntries());
+ }
+ return *this;
}
Pit::Pit(NameTree& nameTree)
@@ -44,7 +52,7 @@
// determine which NameTree entry should the PIT entry be attached onto
const Name& name = interest.getName();
bool hasDigest = name.size() > 0 && name[-1].isImplicitSha256Digest();
- size_t nteDepth = name.size() - static_cast<int>(hasDigest);
+ size_t nteDepth = name.size() - static_cast<size_t>(hasDigest);
nteDepth = std::min(nteDepth, NameTree::getMaxDepth());
// ensure NameTree entry exists
@@ -81,6 +89,12 @@
return {entry, true};
}
+static bool
+nteHasPitEntries(const name_tree::Entry& nte)
+{
+ return nte.hasPitEntries();
+}
+
DataMatchResult
Pit::findAllDataMatches(const Data& data) const
{
@@ -115,7 +129,7 @@
{
BOOST_ASSERT(entry != nullptr);
- auto in = entry->getInRecord(face);
+ auto in = entry->findInRecord(face);
if (in != entry->in_end()) {
entry->deleteInRecord(in);
}
diff --git a/daemon/table/pit.hpp b/daemon/table/pit.hpp
index b44dce8..dab57ea 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-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,23 +26,60 @@
#ifndef NFD_DAEMON_TABLE_PIT_HPP
#define NFD_DAEMON_TABLE_PIT_HPP
+#include "name-tree.hpp"
#include "pit-entry.hpp"
-#include "pit-iterator.hpp"
namespace nfd {
namespace pit {
-/** \class nfd::pit::DataMatchResult
- * \brief An unordered iterable of all PIT entries matching Data.
- *
- * This type has the following member functions:
- * - `iterator<shared_ptr<Entry>> begin()`
- * - `iterator<shared_ptr<Entry>> end()`
- * - `size_t size() const`
+/**
+ * \brief An unordered iterable of all PIT entries matching a Data packet.
*/
using DataMatchResult = std::vector<shared_ptr<Entry>>;
-/** \brief Represents the Interest Table
+/**
+ * \brief PIT iterator.
+ */
+class Iterator : public boost::forward_iterator_helper<Iterator, const Entry>
+{
+public:
+ /**
+ * \brief Constructor.
+ * \param ntIt a name tree iterator that visits name tree entries with one or more PIT entries
+ * \param iPitEntry make this iterator to dereference to the i-th PIT entry in name tree entry
+ */
+ explicit
+ Iterator(const NameTree::const_iterator& ntIt = {}, size_t iPitEntry = 0)
+ : m_ntIt(ntIt)
+ , m_iPitEntry(iPitEntry)
+ {
+ }
+
+ const Entry&
+ operator*() const noexcept
+ {
+ BOOST_ASSERT(m_ntIt != NameTree::const_iterator());
+ BOOST_ASSERT(m_iPitEntry < m_ntIt->getPitEntries().size());
+ return *m_ntIt->getPitEntries()[m_iPitEntry];
+ }
+
+ Iterator&
+ operator++();
+
+ friend bool
+ operator==(const Iterator& lhs, const Iterator& rhs) noexcept
+ {
+ return lhs.m_ntIt == rhs.m_ntIt &&
+ lhs.m_iPitEntry == rhs.m_iPitEntry;
+ }
+
+private:
+ NameTree::const_iterator m_ntIt; ///< current name tree entry
+ size_t m_iPitEntry; ///< current PIT entry within m_ntIt->getPitEntries()
+};
+
+/**
+ * \brief NFD's Interest Table.
*/
class Pit : noncopyable
{
@@ -50,7 +87,8 @@
explicit
Pit(NameTree& nameTree);
- /** \return number of entries
+ /**
+ * \brief Returns the number of entries.
*/
size_t
size() const
diff --git a/tests/daemon/fw/algorithm.t.cpp b/tests/daemon/fw/algorithm.t.cpp
index ab00f2b..78bc4b0 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-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -166,7 +166,7 @@
// Interest-Nack
entry.insertOrUpdateOutRecord(*face2, *interest);
BOOST_CHECK_EQUAL(hasPendingOutRecords(entry), true);
- pit::OutRecordCollection::iterator outR = entry.getOutRecord(*face2);
+ auto outR = entry.findOutRecord(*face2);
BOOST_REQUIRE(outR != entry.out_end());
lp::Nack nack = makeNack(*interest, lp::NackReason::DUPLICATE);
bool isNackAccepted = outR->setIncomingNack(nack); // Nack arrival
diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index 0fde3a5..dce7118 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -279,7 +279,7 @@
consumer->getClientFace().expressInterest(*interest, nullptr, nullptr, nullptr);
this->advanceClocks(time::milliseconds(100));
- auto outRecord = pitEntry->getOutRecord(linkBC->getFace(nodeB));
+ auto outRecord = pitEntry->findOutRecord(linkBC->getFace(nodeB));
BOOST_CHECK(outRecord != pitEntry->out_end());
this->advanceClocks(time::milliseconds(100));
@@ -450,7 +450,7 @@
// Get pitEntry of node A
auto pitEntry = topo.getForwarder(nodeA).getPit().find(*interest);
// Get outRecord associated with face towards B
- auto outRecord = pitEntry->getOutRecord(linkAB->getFace(nodeA));
+ auto outRecord = pitEntry->findOutRecord(linkAB->getFace(nodeA));
BOOST_REQUIRE(outRecord != pitEntry->out_end());
// Check that Nonce of interest is not equal to Nonce of Probe
@@ -470,12 +470,12 @@
pitEntry = topo.getForwarder(nodeB).getPit().find(*interest);
// Get outRecord associated with face towards D.
- outRecord = pitEntry->getOutRecord(linkBD->getFace(nodeB));
+ outRecord = pitEntry->findOutRecord(linkBD->getFace(nodeB));
BOOST_CHECK(outRecord != pitEntry->out_end());
// RTT between B and D
this->advanceClocks(5_ms, 160_ms);
- outRecord = pitEntry->getOutRecord(linkBD->getFace(nodeB));
+ outRecord = pitEntry->findOutRecord(linkBD->getFace(nodeB));
BOOST_CHECK_EQUAL(linkBD->getFace(nodeB).getCounters().nInData, i);
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 0d27c4b..59b6f0d 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -565,7 +565,7 @@
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 1);
// record Nack on PIT out-record
- auto outRecord1 = pit1->getOutRecord(*face1);
+ auto outRecord1 = pit1->findOutRecord(*face1);
BOOST_REQUIRE(outRecord1 != pit1->out_end());
BOOST_REQUIRE(outRecord1->getIncomingNack() != nullptr);
BOOST_CHECK_EQUAL(outRecord1->getIncomingNack()->getReason(), lp::NackReason::CONGESTION);
@@ -657,7 +657,7 @@
BOOST_CHECK_EQUAL(counters.nOutNacks, 1);
// in-record is erased
- auto inRecord2a = pit2->getInRecord(*face1);
+ auto inRecord2a = pit2->findInRecord(*face1);
BOOST_CHECK(inRecord2a == pit2->in_end());
// send Nack with correct Nonce
@@ -669,7 +669,7 @@
BOOST_CHECK_EQUAL(counters.nOutNacks, 2);
// in-record is erased
- auto inRecord2b = pit2->getInRecord(*face2);
+ auto inRecord2b = pit2->findInRecord(*face2);
BOOST_CHECK(inRecord2b == pit2->in_end());
// don't send Nack to multi-access face
diff --git a/tests/daemon/fw/retx-suppression.t.cpp b/tests/daemon/fw/retx-suppression.t.cpp
index d662251..98ee12c 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-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -191,7 +191,7 @@
pitEntry->insertOrUpdateInRecord(*face1, *interest);
BOOST_CHECK(rs.decidePerUpstream(*pitEntry, *face2) == RetxSuppressionResult::FORWARD);
// Assume interest is sent and increment interval
- rs.incrementIntervalForOutRecord(*pitEntry->getOutRecord(*face2));
+ rs.incrementIntervalForOutRecord(*pitEntry->findOutRecord(*face2));
pitEntry->insertOrUpdateInRecord(*face2, *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 725fd70..9641b51 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -107,7 +107,7 @@
pitEntry->insertOrUpdateOutRecord(*this->face3, *interest1);
lp::Nack nack3 = makeNack(*interest1, lp::NackReason::CONGESTION);
- pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3);
+ pitEntry->findOutRecord(*this->face3)->setIncomingNack(nack3);
auto f = [&] {
this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3), pitEntry);
@@ -145,13 +145,13 @@
pitEntry->insertOrUpdateOutRecord(*this->face4, *interest1);
lp::Nack nack3 = makeNack(*interest1, lp::NackReason::CONGESTION);
- pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3);
+ pitEntry->findOutRecord(*this->face3)->setIncomingNack(nack3);
this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3), pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
lp::Nack nack4 = makeNack(*interest1, lp::NackReason::CONGESTION);
- pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4);
+ pitEntry->findOutRecord(*this->face4)->setIncomingNack(nack4);
auto f = [&] {
this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4), pitEntry);
@@ -187,7 +187,7 @@
this->advanceClocks(200_ms); // face3 has timed out
lp::Nack nack4 = makeNack(*interest2, lp::NackReason::CONGESTION);
- pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4);
+ pitEntry->findOutRecord(*this->face4)->setIncomingNack(nack4);
this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4), pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0);
@@ -320,13 +320,13 @@
pitEntry->insertOrUpdateOutRecord(*face4, *interest1);
lp::Nack nack3 = makeNack(*interest1, Combination::firstReason);
- pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
+ pitEntry->findOutRecord(*face3)->setIncomingNack(nack3);
strategy.afterReceiveNack(nack3, FaceEndpoint(*face3), pitEntry);
BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
lp::Nack nack4 = makeNack(*interest1, Combination::secondReason);
- pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
+ pitEntry->findOutRecord(*face4)->setIncomingNack(nack4);
strategy.afterReceiveNack(nack4, FaceEndpoint(*face4), pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index 99f5d36..d264322 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -119,7 +119,7 @@
sendNack(const lp::NackHeader& header, Face& egress, const shared_ptr<pit::Entry>& pitEntry) override
{
sendNackHistory.push_back({pitEntry->getInterest(), egress.getId(), header});
- auto it = pitEntry->getInRecord(egress);
+ auto it = pitEntry->findInRecord(egress);
if (it != pitEntry->in_end()) {
pitEntry->deleteInRecord(it);
}
diff --git a/tests/daemon/table/pit-entry.t.cpp b/tests/daemon/table/pit-entry.t.cpp
index 52b6f8b..7768faa 100644
--- a/tests/daemon/table/pit-entry.t.cpp
+++ b/tests/daemon/table/pit-entry.t.cpp
@@ -98,7 +98,7 @@
BOOST_CHECK_LE(in1->getLastRenewed(), after1);
BOOST_CHECK_LE(in1->getExpiry() - in1->getLastRenewed() - interest1->getInterestLifetime(),
after1 - before1);
- BOOST_CHECK(in1 == entry.getInRecord(*face1));
+ BOOST_CHECK(in1 == entry.findInRecord(*face1));
// insert out-record
auto before2 = time::steady_clock::now();
@@ -113,7 +113,7 @@
BOOST_CHECK_LE(out1->getLastRenewed(), after2);
BOOST_CHECK_LE(out1->getExpiry() - out1->getLastRenewed() - interest1->getInterestLifetime(),
after2 - before2);
- BOOST_CHECK(out1 == entry.getOutRecord(*face1));
+ BOOST_CHECK(out1 == entry.findOutRecord(*face1));
// update in-record
auto before3 = time::steady_clock::now();
@@ -134,20 +134,20 @@
BOOST_CHECK_EQUAL(&in3->getFace(), face2.get());
// get in-record
- InRecordCollection::iterator in4 = entry.getInRecord(*face1);
+ InRecordCollection::iterator in4 = entry.findInRecord(*face1);
BOOST_REQUIRE(in4 != entry.in_end());
BOOST_CHECK_EQUAL(&in4->getFace(), face1.get());
// delete in-record
entry.deleteInRecord(in4);
BOOST_CHECK_EQUAL(entry.getInRecords().size(), 1);
- BOOST_CHECK(entry.getInRecord(*face1) == entry.in_end());
+ BOOST_CHECK(entry.findInRecord(*face1) == entry.in_end());
// clear in-records
entry.clearInRecords();
BOOST_CHECK_EQUAL(entry.getInRecords().size(), 0);
- BOOST_CHECK(entry.getInRecord(*face1) == entry.in_end());
- BOOST_CHECK(entry.getInRecord(*face2) == entry.in_end());
+ BOOST_CHECK(entry.findInRecord(*face1) == entry.in_end());
+ BOOST_CHECK(entry.findInRecord(*face2) == entry.in_end());
// insert another out-record
OutRecordCollection::iterator out2 = entry.insertOrUpdateOutRecord(*face2, *interest4);
@@ -156,7 +156,7 @@
BOOST_CHECK_EQUAL(&out2->getFace(), face2.get());
// get out-record
- OutRecordCollection::iterator out3 = entry.getOutRecord(*face1);
+ OutRecordCollection::iterator out3 = entry.findOutRecord(*face1);
BOOST_REQUIRE(out3 != entry.out_end());
BOOST_CHECK_EQUAL(&out3->getFace(), face1.get());
@@ -165,7 +165,7 @@
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.findOutRecord(*face2) == entry.out_end());
}
const time::milliseconds lifetimes[] = {