fw: reorder function params to make the strategy API more uniform
Also add a non-const overload of Face::getCounters to avoid const_cast
Refs: #5173
Change-Id: Iff0bfbdedb90e68a373090cf3f247d9a7501f58d
diff --git a/daemon/face/face-endpoint.hpp b/daemon/face/face-endpoint.hpp
index 4d33634..366c743 100644
--- a/daemon/face/face-endpoint.hpp
+++ b/daemon/face/face-endpoint.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -36,8 +36,8 @@
class FaceEndpoint
{
public:
- FaceEndpoint(const Face& face, EndpointId endpoint)
- : face(const_cast<Face&>(face))
+ FaceEndpoint(Face& face, EndpointId endpoint)
+ : face(face)
, endpoint(endpoint)
{
}
diff --git a/daemon/face/face.hpp b/daemon/face/face.hpp
index 0076f85..c91e78a 100644
--- a/daemon/face/face.hpp
+++ b/daemon/face/face.hpp
@@ -171,7 +171,16 @@
getExpirationTime() const;
const FaceCounters&
- getCounters() const;
+ getCounters() const
+ {
+ return m_counters;
+ }
+
+ FaceCounters&
+ getCounters()
+ {
+ return m_counters;
+ }
/**
* \brief Get channel on which face was created (unicast) or the associated channel (multicast)
@@ -301,12 +310,6 @@
return m_transport->getExpirationTime();
}
-inline const FaceCounters&
-Face::getCounters() const
-{
- return m_counters;
-}
-
std::ostream&
operator<<(std::ostream& os, const FaceLogHelper<Face>& flh);
diff --git a/daemon/fw/access-strategy.cpp b/daemon/fw/access-strategy.cpp
index 8dfcba2..e1443df 100644
--- a/daemon/fw/access-strategy.cpp
+++ b/daemon/fw/access-strategy.cpp
@@ -57,15 +57,15 @@
}
void
-AccessStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+AccessStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
auto suppressResult = m_retxSuppression.decidePerPitEntry(*pitEntry);
switch (suppressResult) {
case RetxSuppressionResult::NEW:
- return afterReceiveNewInterest(ingress, interest, pitEntry);
+ return afterReceiveNewInterest(interest, ingress, pitEntry);
case RetxSuppressionResult::FORWARD:
- return afterReceiveRetxInterest(ingress, interest, pitEntry);
+ return afterReceiveRetxInterest(interest, ingress, pitEntry);
case RetxSuppressionResult::SUPPRESS:
NFD_LOG_DEBUG(interest << " interestFrom " << ingress << " retx-suppress");
return;
@@ -73,7 +73,7 @@
}
void
-AccessStrategy::afterReceiveNewInterest(const FaceEndpoint& ingress, const Interest& interest,
+AccessStrategy::afterReceiveNewInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
const auto& fibEntry = this->lookupFib(*pitEntry);
@@ -86,7 +86,7 @@
NFD_LOG_DEBUG(interest << " interestFrom " << ingress << " new-interest mi=" << miName);
// send to last working nexthop
- bool isSentToLastNexthop = this->sendToLastNexthop(ingress, interest, pitEntry, *mi, fibEntry);
+ bool isSentToLastNexthop = this->sendToLastNexthop(interest, ingress, pitEntry, *mi, fibEntry);
if (isSentToLastNexthop) {
return;
}
@@ -98,7 +98,7 @@
// no measurements, or last working nexthop unavailable
// multicast to all nexthops except incoming face
- size_t nMulticastSent = this->multicast(ingress.face, interest, pitEntry, fibEntry);
+ size_t nMulticastSent = this->multicast(interest, ingress.face, pitEntry, fibEntry);
if (nMulticastSent == 0) {
this->rejectPendingInterest(pitEntry);
@@ -106,16 +106,16 @@
}
void
-AccessStrategy::afterReceiveRetxInterest(const FaceEndpoint& ingress, const Interest& interest,
+AccessStrategy::afterReceiveRetxInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
const auto& fibEntry = this->lookupFib(*pitEntry);
NFD_LOG_DEBUG(interest << " interestFrom " << ingress << " retx-forward");
- this->multicast(ingress.face, interest, pitEntry, fibEntry);
+ this->multicast(interest, ingress.face, pitEntry, fibEntry);
}
bool
-AccessStrategy::sendToLastNexthop(const FaceEndpoint& ingress, const Interest& interest,
+AccessStrategy::sendToLastNexthop(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry, MtInfo& mi,
const fib::Entry& fibEntry)
{
@@ -144,7 +144,7 @@
NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << mi.lastNexthop
<< " last-nexthop rto=" << time::duration_cast<time::microseconds>(rto).count());
- if (!this->sendInterest(pitEntry, *outFace, interest)) {
+ if (!this->sendInterest(interest, *outFace, pitEntry)) {
return false;
}
@@ -184,11 +184,11 @@
NFD_LOG_DEBUG(pitEntry->getInterest() << " timeoutFrom " << firstOutFaceId
<< " multicast-except " << firstOutFaceId);
- this->multicast(*inFace, interest, pitEntry, fibEntry, firstOutFaceId);
+ this->multicast(interest, *inFace, pitEntry, fibEntry, firstOutFaceId);
}
size_t
-AccessStrategy::multicast(const Face& inFace, const Interest& interest,
+AccessStrategy::multicast(const Interest& interest, const Face& inFace,
const shared_ptr<pit::Entry>& pitEntry, const fib::Entry& fibEntry,
FaceId exceptFace)
{
@@ -200,7 +200,7 @@
continue;
}
NFD_LOG_DEBUG(pitEntry->getInterest() << " interestTo " << outFace.getId() << " multicast");
- if (this->sendInterest(pitEntry, outFace, interest)) {
+ if (this->sendInterest(interest, outFace, pitEntry)) {
++nSent;
}
}
@@ -208,8 +208,8 @@
}
void
-AccessStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data)
+AccessStrategy::beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry)
{
PitInfo* pi = pitEntry->getStrategyInfo<PitInfo>();
if (pi != nullptr) {
diff --git a/daemon/fw/access-strategy.hpp b/daemon/fw/access-strategy.hpp
index 0f83a64..edcf63b 100644
--- a/daemon/fw/access-strategy.hpp
+++ b/daemon/fw/access-strategy.hpp
@@ -56,12 +56,12 @@
public: // triggers
void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
void
- beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data) override;
+ beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry) override;
private: // StrategyInfo
using RttEstimator = ndn::util::RttEstimator;
@@ -133,18 +133,18 @@
private: // forwarding procedures
void
- afterReceiveNewInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveNewInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry);
void
- afterReceiveRetxInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveRetxInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry);
/** \brief send to last working nexthop
* \return whether an Interest is sent
*/
bool
- sendToLastNexthop(const FaceEndpoint& ingress, const Interest& interest,
+ sendToLastNexthop(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry, MtInfo& mi,
const fib::Entry& fibEntry);
@@ -157,7 +157,7 @@
* \return number of Interests that were sent
*/
size_t
- multicast(const Face& inFace, const Interest& interest,
+ multicast(const Interest& interest, const Face& inFace,
const shared_ptr<pit::Entry>& pitEntry, const fib::Entry& fibEntry,
FaceId exceptFace = face::INVALID_FACEID);
diff --git a/daemon/fw/asf-strategy.cpp b/daemon/fw/asf-strategy.cpp
index d8959af..f337a27 100644
--- a/daemon/fw/asf-strategy.cpp
+++ b/daemon/fw/asf-strategy.cpp
@@ -107,7 +107,7 @@
}
void
-AsfStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+AsfStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
const auto& fibEntry = this->lookupFib(*pitEntry);
@@ -165,7 +165,7 @@
NFD_LOG_DEBUG(interest << " retx-interest from=" << ingress << " retry-to=" << outFace.getId());
// sendInterest() is used here instead of forwardInterest() because the measurements info
// were already attached to this face in the previous forwarding
- auto* outRecord = sendInterest(pitEntry, outFace, interest);
+ auto* outRecord = sendInterest(interest, outFace, pitEntry);
if (outRecord && suppressResult == RetxSuppressionResult::FORWARD) {
m_retxSuppression.incrementIntervalForOutRecord(*outRecord);
}
@@ -173,8 +173,8 @@
}
void
-AsfStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data)
+AsfStrategy::beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry)
{
NamespaceInfo* namespaceInfo = m_measurements.getNamespaceInfo(pitEntry->getName());
if (namespaceInfo == nullptr) {
@@ -207,7 +207,7 @@
}
void
-AsfStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+AsfStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
NFD_LOG_DEBUG(nack.getInterest() << " nack from=" << ingress << " reason=" << nack.getReason());
@@ -221,7 +221,7 @@
const auto& interestName = interest.getName();
auto faceId = outFace.getId();
- auto* outRecord = sendInterest(pitEntry, outFace, interest);
+ auto* outRecord = sendInterest(interest, outFace, pitEntry);
FaceInfo& faceInfo = m_measurements.getOrCreateFaceInfo(fibEntry, interestName, faceId);
@@ -361,7 +361,7 @@
{
lp::NackHeader nackHeader;
nackHeader.setReason(lp::NackReason::NO_ROUTE);
- this->sendNack(pitEntry, face, nackHeader);
+ this->sendNack(nackHeader, face, pitEntry);
this->rejectPendingInterest(pitEntry);
}
diff --git a/daemon/fw/asf-strategy.hpp b/daemon/fw/asf-strategy.hpp
index 932cffa..2e0ba24 100644
--- a/daemon/fw/asf-strategy.hpp
+++ b/daemon/fw/asf-strategy.hpp
@@ -53,15 +53,15 @@
public: // triggers
void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
void
- beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data) override;
+ beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry) override;
void
- afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+ afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
private:
diff --git a/daemon/fw/best-route-strategy.cpp b/daemon/fw/best-route-strategy.cpp
index e684250..eecc3b5 100644
--- a/daemon/fw/best-route-strategy.cpp
+++ b/daemon/fw/best-route-strategy.cpp
@@ -62,7 +62,7 @@
}
void
-BestRouteStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+BestRouteStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
RetxSuppressionResult suppression = m_retxSuppression.decidePerPitEntry(*pitEntry);
@@ -86,15 +86,14 @@
lp::NackHeader nackHeader;
nackHeader.setReason(lp::NackReason::NO_ROUTE);
- this->sendNack(pitEntry, ingress.face, nackHeader);
-
+ this->sendNack(nackHeader, ingress.face, pitEntry);
this->rejectPendingInterest(pitEntry);
return;
}
Face& outFace = it->getFace();
NFD_LOG_DEBUG(interest << " from=" << ingress << " newPitEntry-to=" << outFace.getId());
- this->sendInterest(pitEntry, outFace, interest);
+ this->sendInterest(interest, outFace, pitEntry);
return;
}
@@ -106,7 +105,7 @@
if (it != nexthops.end()) {
Face& outFace = it->getFace();
- this->sendInterest(pitEntry, outFace, interest);
+ this->sendInterest(interest, outFace, pitEntry);
NFD_LOG_DEBUG(interest << " from=" << ingress << " retransmit-unused-to=" << outFace.getId());
return;
}
@@ -118,16 +117,16 @@
}
else {
Face& outFace = it->getFace();
- this->sendInterest(pitEntry, outFace, interest);
+ this->sendInterest(interest, outFace, pitEntry);
NFD_LOG_DEBUG(interest << " from=" << ingress << " retransmit-retry-to=" << outFace.getId());
}
}
void
-BestRouteStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+BestRouteStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
- this->processNack(ingress.face, nack, pitEntry);
+ this->processNack(nack, ingress.face, pitEntry);
}
} // namespace fw
diff --git a/daemon/fw/best-route-strategy.hpp b/daemon/fw/best-route-strategy.hpp
index 636abd2..3f11c7a 100644
--- a/daemon/fw/best-route-strategy.hpp
+++ b/daemon/fw/best-route-strategy.hpp
@@ -60,12 +60,13 @@
static const Name&
getStrategyName();
+public: // triggers
void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
void
- afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+ afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 171a541..fea18f6 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -57,19 +57,19 @@
m_faceTable.afterAdd.connect([this] (const Face& face) {
face.afterReceiveInterest.connect(
[this, &face] (const Interest& interest, const EndpointId& endpointId) {
- this->startProcessInterest(FaceEndpoint(face, endpointId), interest);
+ this->onIncomingInterest(interest, FaceEndpoint(const_cast<Face&>(face), endpointId));
});
face.afterReceiveData.connect(
[this, &face] (const Data& data, const EndpointId& endpointId) {
- this->startProcessData(FaceEndpoint(face, endpointId), data);
+ this->onIncomingData(data, FaceEndpoint(const_cast<Face&>(face), endpointId));
});
face.afterReceiveNack.connect(
[this, &face] (const lp::Nack& nack, const EndpointId& endpointId) {
- this->startProcessNack(FaceEndpoint(face, endpointId), nack);
+ this->onIncomingNack(nack, FaceEndpoint(const_cast<Face&>(face), endpointId));
});
face.onDroppedInterest.connect(
[this, &face] (const Interest& interest) {
- this->onDroppedInterest(face, interest);
+ this->onDroppedInterest(interest, const_cast<Face&>(face));
});
});
@@ -87,7 +87,7 @@
Forwarder::~Forwarder() = default;
void
-Forwarder::onIncomingInterest(const FaceEndpoint& ingress, const Interest& interest)
+Forwarder::onIncomingInterest(const Interest& interest, const FaceEndpoint& ingress)
{
// receive Interest
NFD_LOG_DEBUG("onIncomingInterest in=" << ingress << " interest=" << interest.getName());
@@ -96,13 +96,13 @@
// drop if HopLimit zero, decrement otherwise (if present)
if (interest.getHopLimit()) {
- if (*interest.getHopLimit() < 1) {
+ if (*interest.getHopLimit() == 0) {
NFD_LOG_DEBUG("onIncomingInterest in=" << ingress << " interest=" << interest.getName()
<< " hop-limit=0");
- ++const_cast<PacketCounter&>(ingress.face.getCounters().nInHopLimitZero);
+ ++ingress.face.getCounters().nInHopLimitZero;
+ // drop
return;
}
-
const_cast<Interest&>(interest).setHopLimit(*interest.getHopLimit() - 1);
}
@@ -112,7 +112,7 @@
if (isViolatingLocalhost) {
NFD_LOG_DEBUG("onIncomingInterest in=" << ingress
<< " interest=" << interest.getName() << " violates /localhost");
- // (drop)
+ // drop
return;
}
@@ -120,7 +120,7 @@
bool hasDuplicateNonceInDnl = m_deadNonceList.has(interest.getName(), interest.getNonce());
if (hasDuplicateNonceInDnl) {
// goto Interest loop pipeline
- this->onInterestLoop(ingress, interest);
+ this->onInterestLoop(interest, ingress);
return;
}
@@ -144,23 +144,23 @@
}
if (hasDuplicateNonceInPit) {
// goto Interest loop pipeline
- this->onInterestLoop(ingress, interest);
+ this->onInterestLoop(interest, ingress);
return;
}
// is pending?
if (!pitEntry->hasInRecords()) {
m_cs.find(interest,
- bind(&Forwarder::onContentStoreHit, this, ingress, pitEntry, _1, _2),
- bind(&Forwarder::onContentStoreMiss, this, ingress, pitEntry, _1));
+ [=] (const Interest& i, const Data& d) { onContentStoreHit(i, ingress, pitEntry, d); },
+ [=] (const Interest& i) { onContentStoreMiss(i, ingress, pitEntry); });
}
else {
- this->onContentStoreMiss(ingress, pitEntry, interest);
+ this->onContentStoreMiss(interest, ingress, pitEntry);
}
}
void
-Forwarder::onInterestLoop(const FaceEndpoint& ingress, const Interest& interest)
+Forwarder::onInterestLoop(const Interest& interest, const FaceEndpoint& ingress)
{
// if multi-access or ad hoc face, drop
if (ingress.face.getLinkType() != ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
@@ -180,8 +180,8 @@
}
void
-Forwarder::onContentStoreMiss(const FaceEndpoint& ingress,
- const shared_ptr<pit::Entry>& pitEntry, const Interest& interest)
+Forwarder::onContentStoreMiss(const Interest& interest, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry)
{
NFD_LOG_DEBUG("onContentStoreMiss interest=" << interest.getName());
++m_counters.nCsMisses;
@@ -207,19 +207,19 @@
<< " nexthop-faceid=" << nextHopFace->getId());
// go to outgoing Interest pipeline
// scope control is unnecessary, because privileged app explicitly wants to forward
- this->onOutgoingInterest(pitEntry, *nextHopFace, interest);
+ this->onOutgoingInterest(interest, *nextHopFace, pitEntry);
}
return;
}
// dispatch to strategy: after receive Interest
m_strategyChoice.findEffectiveStrategy(*pitEntry)
- .afterReceiveInterest(FaceEndpoint(ingress.face, 0), interest, pitEntry);
+ .afterReceiveInterest(interest, FaceEndpoint(ingress.face, 0), pitEntry);
}
void
-Forwarder::onContentStoreHit(const FaceEndpoint& ingress, const shared_ptr<pit::Entry>& pitEntry,
- const Interest& interest, const Data& data)
+Forwarder::onContentStoreHit(const Interest& interest, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry, const Data& data)
{
NFD_LOG_DEBUG("onContentStoreHit interest=" << interest.getName());
++m_counters.nCsHits;
@@ -235,18 +235,18 @@
this->setExpiryTimer(pitEntry, 0_ms);
// dispatch to strategy: after Content Store hit
- m_strategyChoice.findEffectiveStrategy(*pitEntry).afterContentStoreHit(pitEntry, ingress, data);
+ m_strategyChoice.findEffectiveStrategy(*pitEntry).afterContentStoreHit(data, ingress, pitEntry);
}
pit::OutRecord*
-Forwarder::onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry,
- Face& egress, const Interest& interest)
+Forwarder::onOutgoingInterest(const Interest& interest, Face& egress,
+ const shared_ptr<pit::Entry>& pitEntry)
{
// drop if HopLimit == 0 but sending on non-local face
if (interest.getHopLimit() == 0 && egress.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL) {
NFD_LOG_DEBUG("onOutgoingInterest out=" << egress.getId() << " interest=" << pitEntry->getName()
<< " non-local hop-limit=0");
- ++const_cast<PacketCounter&>(egress.getCounters().nOutHopLimitZero);
+ ++egress.getCounters().nOutHopLimitZero;
return nullptr;
}
@@ -285,7 +285,7 @@
}
void
-Forwarder::onIncomingData(const FaceEndpoint& ingress, const Data& data)
+Forwarder::onIncomingData(const Data& data, const FaceEndpoint& ingress)
{
// receive Data
NFD_LOG_DEBUG("onIncomingData in=" << ingress << " data=" << data.getName());
@@ -297,7 +297,7 @@
scope_prefix::LOCALHOST.isPrefixOf(data.getName());
if (isViolatingLocalhost) {
NFD_LOG_DEBUG("onIncomingData in=" << ingress << " data=" << data.getName() << " violates /localhost");
- // (drop)
+ // drop
return;
}
@@ -305,7 +305,7 @@
pit::DataMatchResult pitMatches = m_pit.findAllDataMatches(data);
if (pitMatches.size() == 0) {
// goto Data unsolicited pipeline
- this->onDataUnsolicited(ingress, data);
+ this->onDataUnsolicited(data, ingress);
return;
}
@@ -322,7 +322,7 @@
this->setExpiryTimer(pitEntry, 0_ms);
// trigger strategy: after receive Data
- m_strategyChoice.findEffectiveStrategy(*pitEntry).afterReceiveData(pitEntry, ingress, data);
+ m_strategyChoice.findEffectiveStrategy(*pitEntry).afterReceiveData(data, ingress, pitEntry);
// mark PIT satisfied
pitEntry->isSatisfied = true;
@@ -354,7 +354,7 @@
this->setExpiryTimer(pitEntry, 0_ms);
// invoke PIT satisfy callback
- m_strategyChoice.findEffectiveStrategy(*pitEntry).beforeSatisfyInterest(pitEntry, ingress, data);
+ m_strategyChoice.findEffectiveStrategy(*pitEntry).beforeSatisfyInterest(data, ingress, pitEntry);
// mark PIT satisfied
pitEntry->isSatisfied = true;
@@ -381,7 +381,7 @@
}
void
-Forwarder::onDataUnsolicited(const FaceEndpoint& ingress, const Data& data)
+Forwarder::onDataUnsolicited(const Data& data, const FaceEndpoint& ingress)
{
// accept to cache?
auto decision = m_unsolicitedDataPolicy->decide(ingress.face, data);
@@ -410,7 +410,7 @@
if (isViolatingLocalhost) {
NFD_LOG_DEBUG("onOutgoingData out=" << egress.getId() << " data=" << data.getName()
<< " violates /localhost");
- // (drop)
+ // drop
return false;
}
@@ -424,7 +424,7 @@
}
void
-Forwarder::onIncomingNack(const FaceEndpoint& ingress, const lp::Nack& nack)
+Forwarder::onIncomingNack(const lp::Nack& nack, const FaceEndpoint& ingress)
{
// receive Nack
nack.setTag(make_shared<lp::IncomingFaceIdTag>(ingress.face.getId()));
@@ -476,12 +476,12 @@
}
// trigger strategy: after receive NACK
- m_strategyChoice.findEffectiveStrategy(*pitEntry).afterReceiveNack(ingress, nack, pitEntry);
+ m_strategyChoice.findEffectiveStrategy(*pitEntry).afterReceiveNack(nack, ingress, pitEntry);
}
bool
-Forwarder::onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry,
- Face& egress, const lp::NackHeader& nack)
+Forwarder::onOutgoingNack(const lp::NackHeader& nack, Face& egress,
+ const shared_ptr<pit::Entry>& pitEntry)
{
if (egress.getId() == face::INVALID_FACEID) {
NFD_LOG_WARN("onOutgoingNack out=(invalid)"
@@ -527,9 +527,9 @@
}
void
-Forwarder::onDroppedInterest(const Face& egress, const Interest& interest)
+Forwarder::onDroppedInterest(const Interest& interest, Face& egress)
{
- m_strategyChoice.findEffectiveStrategy(interest.getName()).onDroppedInterest(egress, interest);
+ m_strategyChoice.findEffectiveStrategy(interest.getName()).onDroppedInterest(interest, egress);
}
void
diff --git a/daemon/fw/forwarder.hpp b/daemon/fw/forwarder.hpp
index 51e4dd0..6a245de 100644
--- a/daemon/fw/forwarder.hpp
+++ b/daemon/fw/forwarder.hpp
@@ -44,9 +44,10 @@
class Strategy;
} // namespace fw
-/** \brief Main class of NFD's forwarding engine.
+/**
+ * \brief Main class of NFD's forwarding engine.
*
- * Forwarder owns all tables and implements the forwarding pipelines.
+ * The Forwarder class owns all tables and implements the forwarding pipelines.
*/
class Forwarder
{
@@ -76,37 +77,6 @@
m_unsolicitedDataPolicy = std::move(policy);
}
-public: // forwarding entrypoints and tables
- /** \brief start incoming Interest processing
- * \param ingress face on which Interest is received and endpoint of the sender
- * \param interest the incoming Interest, must be well-formed and created with make_shared
- */
- void
- startProcessInterest(const FaceEndpoint& ingress, const Interest& interest)
- {
- this->onIncomingInterest(ingress, interest);
- }
-
- /** \brief start incoming Data processing
- * \param ingress face on which Data is received and endpoint of the sender
- * \param data the incoming Data, must be well-formed and created with make_shared
- */
- void
- startProcessData(const FaceEndpoint& ingress, const Data& data)
- {
- this->onIncomingData(ingress, data);
- }
-
- /** \brief start incoming Nack processing
- * \param ingress face on which Nack is received and endpoint of the sender
- * \param nack the incoming Nack, must be well-formed
- */
- void
- startProcessNack(const FaceEndpoint& ingress, const lp::Nack& nack)
- {
- this->onIncomingNack(ingress, nack);
- }
-
NameTree&
getNameTree()
{
@@ -157,33 +127,35 @@
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: // pipelines
/** \brief incoming Interest pipeline
+ * \param interest the incoming Interest, must be well-formed and created with make_shared
+ * \param ingress face on which \p interest was received and endpoint of the sender
*/
NFD_VIRTUAL_WITH_TESTS void
- onIncomingInterest(const FaceEndpoint& ingress, const Interest& interest);
+ onIncomingInterest(const Interest& interest, const FaceEndpoint& ingress);
/** \brief Interest loop pipeline
*/
NFD_VIRTUAL_WITH_TESTS void
- onInterestLoop(const FaceEndpoint& ingress, const Interest& interest);
+ onInterestLoop(const Interest& interest, const FaceEndpoint& ingress);
/** \brief Content Store miss pipeline
*/
NFD_VIRTUAL_WITH_TESTS void
- onContentStoreMiss(const FaceEndpoint& ingress,
- const shared_ptr<pit::Entry>& pitEntry, const Interest& interest);
+ onContentStoreMiss(const Interest& interest, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry);
/** \brief Content Store hit pipeline
*/
NFD_VIRTUAL_WITH_TESTS void
- onContentStoreHit(const FaceEndpoint& ingress, const shared_ptr<pit::Entry>& pitEntry,
- const Interest& interest, const Data& data);
+ onContentStoreHit(const Interest& interest, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry, const Data& data);
/** \brief outgoing Interest pipeline
* \return A pointer to the out-record created or nullptr if the Interest was dropped
*/
NFD_VIRTUAL_WITH_TESTS pit::OutRecord*
- onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry,
- Face& egress, const Interest& interest);
+ onOutgoingInterest(const Interest& interest, Face& egress,
+ const shared_ptr<pit::Entry>& pitEntry);
/** \brief Interest finalize pipeline
*/
@@ -191,14 +163,16 @@
onInterestFinalize(const shared_ptr<pit::Entry>& pitEntry);
/** \brief incoming Data pipeline
+ * \param data the incoming Data, must be well-formed and created with make_shared
+ * \param ingress face on which \p data was received and endpoint of the sender
*/
NFD_VIRTUAL_WITH_TESTS void
- onIncomingData(const FaceEndpoint& ingress, const Data& data);
+ onIncomingData(const Data& data, const FaceEndpoint& ingress);
/** \brief Data unsolicited pipeline
*/
NFD_VIRTUAL_WITH_TESTS void
- onDataUnsolicited(const FaceEndpoint& ingress, const Data& data);
+ onDataUnsolicited(const Data& data, const FaceEndpoint& ingress);
/** \brief outgoing Data pipeline
* \return Whether the Data was transmitted (true) or dropped (false)
@@ -207,19 +181,21 @@
onOutgoingData(const Data& data, Face& egress);
/** \brief incoming Nack pipeline
+ * \param nack the incoming Nack, must be well-formed
+ * \param ingress face on which \p nack is received and endpoint of the sender
*/
NFD_VIRTUAL_WITH_TESTS void
- onIncomingNack(const FaceEndpoint& ingress, const lp::Nack& nack);
+ onIncomingNack(const lp::Nack& nack, const FaceEndpoint& ingress);
/** \brief outgoing Nack pipeline
* \return Whether the Nack was transmitted (true) or dropped (false)
*/
NFD_VIRTUAL_WITH_TESTS bool
- onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry,
- Face& egress, const lp::NackHeader& nack);
+ onOutgoingNack(const lp::NackHeader& nack, Face& egress,
+ const shared_ptr<pit::Entry>& pitEntry);
NFD_VIRTUAL_WITH_TESTS void
- onDroppedInterest(const Face& egress, const Interest& interest);
+ onDroppedInterest(const Interest& interest, Face& egress);
NFD_VIRTUAL_WITH_TESTS void
onNewNextHop(const Name& prefix, const fib::NextHop& nextHop);
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index 866b8ae..090a560 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -62,7 +62,7 @@
}
void
-MulticastStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+MulticastStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
@@ -83,7 +83,7 @@
}
NFD_LOG_DEBUG(interest << " from=" << ingress << " pitEntry-to=" << outFace.getId());
- auto* sentOutRecord = this->sendInterest(pitEntry, outFace, interest);
+ auto* sentOutRecord = this->sendInterest(interest, outFace, pitEntry);
if (sentOutRecord && suppressResult == RetxSuppressionResult::FORWARD) {
m_retxSuppression.incrementIntervalForOutRecord(*sentOutRecord);
}
@@ -105,7 +105,7 @@
if (isNextHopEligible(inFace, interest, nextHop, pitEntry)) {
NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " pitEntry-to=" << nextHopFaceId);
- this->sendInterest(pitEntry, nextHop.getFace(), interest);
+ this->sendInterest(interest, nextHop.getFace(), pitEntry);
break; // just one eligible incoming face record is enough
}
diff --git a/daemon/fw/multicast-strategy.hpp b/daemon/fw/multicast-strategy.hpp
index 7ef0080..fe122a4 100644
--- a/daemon/fw/multicast-strategy.hpp
+++ b/daemon/fw/multicast-strategy.hpp
@@ -43,8 +43,9 @@
static const Name&
getStrategyName();
+public: // triggers
void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
void
diff --git a/daemon/fw/process-nack-traits.cpp b/daemon/fw/process-nack-traits.cpp
index ed599d9..80e5c40 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-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,7 +32,7 @@
NFD_LOG_INIT(ProcessNackTraits);
void
-ProcessNackTraitsBase::processNack(const Face& inFace, const lp::Nack& nack,
+ProcessNackTraitsBase::processNack(const lp::Nack& nack, const Face& inFace,
const shared_ptr<pit::Entry>& pitEntry)
{
int nOutRecordsNotNacked = 0;
@@ -56,7 +56,7 @@
if (nOutRecordsNotNacked == 1) {
BOOST_ASSERT(lastFaceNotNacked != nullptr);
- pit::InRecordCollection::iterator inR = pitEntry->getInRecord(*lastFaceNotNacked);
+ auto inR = pitEntry->getInRecord(*lastFaceNotNacked);
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/process-nack-traits.hpp b/daemon/fw/process-nack-traits.hpp
index 654c896..c07537b 100644
--- a/daemon/fw/process-nack-traits.hpp
+++ b/daemon/fw/process-nack-traits.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -31,7 +31,7 @@
namespace nfd {
namespace fw {
-/** \brief provides a common procedure for processing Nacks
+/** \brief Provides a common procedure for processing Nacks
*
* This procedure works as follows:
* 1. If Nacks have been received from all upstream faces, return a Nack with least severe reason
@@ -44,7 +44,7 @@
*
* To use this helper, the strategy should inherit from ProcessNackTraits<MyStrategy>,
* and declare that specialization as a friend class.
- * Then, invoke processNack from afterReceiveNack trigger.
+ * Then, invoke processNack() from the Strategy::afterReceiveNack() trigger.
*/
class ProcessNackTraitsBase : noncopyable
{
@@ -53,7 +53,7 @@
~ProcessNackTraitsBase() = default;
void
- processNack(const Face& inFace, const lp::Nack& nack,
+ processNack(const lp::Nack& nack, const Face& inFace,
const shared_ptr<pit::Entry>& pitEntry);
private:
@@ -81,14 +81,14 @@
sendNackForProcessNackTraits(const shared_ptr<pit::Entry>& pitEntry, Face& outFace,
const lp::NackHeader& header) override
{
- m_strategy->sendNack(pitEntry, outFace, header);
+ m_strategy->sendNack(header, outFace, pitEntry);
}
void
sendNacksForProcessNackTraits(const shared_ptr<pit::Entry>& pitEntry,
const lp::NackHeader& header) override
{
- m_strategy->sendNacks(pitEntry, header);
+ m_strategy->sendNacks(header, pitEntry);
}
private:
diff --git a/daemon/fw/random-strategy.cpp b/daemon/fw/random-strategy.cpp
index 96b2ae7..2ab24c9 100644
--- a/daemon/fw/random-strategy.cpp
+++ b/daemon/fw/random-strategy.cpp
@@ -57,7 +57,7 @@
}
void
-RandomStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+RandomStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
@@ -71,20 +71,20 @@
lp::NackHeader nackHeader;
nackHeader.setReason(lp::NackReason::NO_ROUTE);
- this->sendNack(pitEntry, ingress.face, nackHeader);
+ this->sendNack(nackHeader, ingress.face, pitEntry);
this->rejectPendingInterest(pitEntry);
return;
}
std::shuffle(nhs.begin(), nhs.end(), ndn::random::getRandomNumberEngine());
- this->sendInterest(pitEntry, nhs.front().getFace(), interest);
+ this->sendInterest(interest, nhs.front().getFace(), pitEntry);
}
void
-RandomStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+RandomStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
- this->processNack(ingress.face, nack, pitEntry);
+ this->processNack(nack, ingress.face, pitEntry);
}
} // namespace fw
diff --git a/daemon/fw/random-strategy.hpp b/daemon/fw/random-strategy.hpp
index 1aa170a..27b2041 100644
--- a/daemon/fw/random-strategy.hpp
+++ b/daemon/fw/random-strategy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -46,12 +46,13 @@
static const Name&
getStrategyName();
+public: // triggers
void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
void
- afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+ afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
private:
diff --git a/daemon/fw/self-learning-strategy.cpp b/daemon/fw/self-learning-strategy.cpp
index 3a4fcbb..80630dc 100644
--- a/daemon/fw/self-learning-strategy.cpp
+++ b/daemon/fw/self-learning-strategy.cpp
@@ -66,7 +66,7 @@
}
void
-SelfLearningStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+SelfLearningStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
const fib::Entry& fibEntry = this->lookupFib(*pitEntry);
@@ -80,7 +80,7 @@
NFD_LOG_DEBUG("NACK non-discovery Interest=" << interest << " from=" << ingress << " noNextHop");
lp::NackHeader nackHeader;
nackHeader.setReason(lp::NackReason::NO_ROUTE);
- this->sendNack(pitEntry, ingress.face, nackHeader);
+ this->sendNack(nackHeader, ingress.face, pitEntry);
this->rejectPendingInterest(pitEntry);
}
else { // multicast it if matching FIB entry exists
@@ -100,8 +100,8 @@
}
void
-SelfLearningStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data)
+SelfLearningStrategy::afterReceiveData(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry)
{
auto outRecord = pitEntry->getOutRecord(ingress.face);
if (outRecord == pitEntry->out_end()) {
@@ -112,7 +112,7 @@
OutRecordInfo* outRecordInfo = outRecord->getStrategyInfo<OutRecordInfo>();
if (outRecordInfo && outRecordInfo->isNonDiscoveryInterest) { // outgoing Interest was non-discovery
if (!needPrefixAnn(pitEntry)) { // no need to attach a PA (common cases)
- sendDataToAll(pitEntry, ingress.face, data);
+ sendDataToAll(data, pitEntry, ingress.face);
}
else { // needs a PA (to respond discovery Interest)
asyncProcessData(pitEntry, ingress.face, data);
@@ -125,12 +125,12 @@
}
else { // Data contains no PrefixAnnouncement, upstreams do not support self-learning
}
- sendDataToAll(pitEntry, ingress.face, data);
+ sendDataToAll(data, pitEntry, ingress.face);
}
}
void
-SelfLearningStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+SelfLearningStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
NFD_LOG_DEBUG("Nack for " << nack.getInterest() << " from=" << ingress
@@ -138,7 +138,7 @@
if (nack.getReason() == lp::NackReason::NO_ROUTE) { // remove FIB entries
BOOST_ASSERT(this->lookupFib(*pitEntry).hasNextHops());
NFD_LOG_DEBUG("Send NACK to all downstreams");
- this->sendNacks(pitEntry, nack.getHeader());
+ this->sendNacks(nack.getHeader(), pitEntry);
renewRoute(nack.getInterest().getName(), ingress.face.getId(), 0_ms);
}
}
@@ -156,7 +156,7 @@
NFD_LOG_DEBUG("send discovery Interest=" << interest << " from=" << inFace.getId() <<
" to=" << outFace.getId());
- auto outRecord = this->sendInterest(pitEntry, outFace, interest);
+ auto outRecord = this->sendInterest(interest, outFace, pitEntry);
if (outRecord != nullptr) {
outRecord->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = false;
}
@@ -176,7 +176,7 @@
Face& outFace = nexthop.getFace();
NFD_LOG_DEBUG("send non-discovery Interest=" << interest << " from=" << inFace.getId() <<
" to=" << outFace.getId());
- auto outRecord = this->sendInterest(pitEntry, outFace, interest);
+ auto outRecord = this->sendInterest(interest, outFace, pitEntry);
if (outRecord != nullptr) {
outRecord->insertStrategyInfo<OutRecordInfo>().first->isNonDiscoveryInterest = true;
}
@@ -201,7 +201,7 @@
if (pitEntry && inFace) {
NFD_LOG_DEBUG("found PrefixAnnouncement=" << pa.getAnnouncedName());
data.setTag(make_shared<lp::PrefixAnnouncementTag>(lp::PrefixAnnouncementHeader(pa)));
- this->sendDataToAll(pitEntry, *inFace, data);
+ this->sendDataToAll(data, pitEntry, *inFace);
this->setExpiryTimer(pitEntry, 0_ms);
}
else {
diff --git a/daemon/fw/self-learning-strategy.hpp b/daemon/fw/self-learning-strategy.hpp
index 7ffefc2..bb4f6f7 100644
--- a/daemon/fw/self-learning-strategy.hpp
+++ b/daemon/fw/self-learning-strategy.hpp
@@ -79,19 +79,18 @@
public: // triggers
void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
void
- afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data) override;
+ afterReceiveData(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry) override;
void
- afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+ afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
private: // operations
-
/** \brief Send an Interest to all possible faces
*
* This function is invoked when the forwarder has no matching FIB entries for
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 3dc9abd..9cfb3be 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -136,7 +136,7 @@
BOOST_ASSERT(strategyName.at(-1).isVersion());
bool hasVersion = std::any_of(input.rbegin(), input.rend(),
- [] (const name::Component& comp) { return comp.isVersion(); });
+ [] (const auto& comp) { return comp.isVersion(); });
return hasVersion ? input : Name(input).append(strategyName.at(-1));
}
@@ -151,59 +151,47 @@
Strategy::~Strategy() = default;
void
-Strategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data)
+Strategy::afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry)
+{
+ NFD_LOG_DEBUG("afterContentStoreHit pitEntry=" << pitEntry->getName()
+ << " in=" << ingress << " data=" << data.getName());
+
+ this->sendData(data, ingress.face, pitEntry);
+}
+
+void
+Strategy::beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry)
{
NFD_LOG_DEBUG("beforeSatisfyInterest pitEntry=" << pitEntry->getName()
<< " in=" << ingress << " data=" << data.getName());
}
void
-Strategy::afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data)
-{
- NFD_LOG_DEBUG("afterContentStoreHit pitEntry=" << pitEntry->getName()
- << " in=" << ingress << " data=" << data.getName());
-
- this->sendData(pitEntry, data, ingress.face);
-}
-
-void
-Strategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data)
+Strategy::afterReceiveData(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry)
{
NFD_LOG_DEBUG("afterReceiveData pitEntry=" << pitEntry->getName()
<< " in=" << ingress << " data=" << data.getName());
- this->beforeSatisfyInterest(pitEntry, ingress, data);
-
- this->sendDataToAll(pitEntry, ingress.face, data);
+ this->beforeSatisfyInterest(data, ingress, pitEntry);
+ this->sendDataToAll(data, pitEntry, ingress.face);
}
void
-Strategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack&,
+Strategy::afterReceiveNack(const lp::Nack&, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
NFD_LOG_DEBUG("afterReceiveNack in=" << ingress << " pitEntry=" << pitEntry->getName());
}
void
-Strategy::onDroppedInterest(const Face& egress, const Interest& interest)
+Strategy::onDroppedInterest(const Interest& interest, Face& egress)
{
NFD_LOG_DEBUG("onDroppedInterest out=" << egress.getId() << " name=" << interest.getName());
}
-pit::OutRecord*
-Strategy::sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& egress, const Interest& interest)
-{
- if (interest.getTag<lp::PitToken>() != nullptr) {
- Interest interest2 = interest; // make a copy to preserve tag on original packet
- interest2.removeTag<lp::PitToken>();
- return m_forwarder.onOutgoingInterest(pitEntry, egress, interest2);
- }
- return m_forwarder.onOutgoingInterest(pitEntry, egress, interest);
-}
-
void
Strategy::afterNewNextHop(const fib::NextHop& nextHop, const shared_ptr<pit::Entry>& pitEntry)
{
@@ -211,8 +199,19 @@
<< " nexthop=" << nextHop.getFace().getId());
}
+pit::OutRecord*
+Strategy::sendInterest(const Interest& interest, Face& egress, const shared_ptr<pit::Entry>& pitEntry)
+{
+ if (interest.getTag<lp::PitToken>() != nullptr) {
+ Interest interest2 = interest; // make a copy to preserve tag on original packet
+ interest2.removeTag<lp::PitToken>();
+ return m_forwarder.onOutgoingInterest(interest2, egress, pitEntry);
+ }
+ return m_forwarder.onOutgoingInterest(interest, egress, pitEntry);
+}
+
bool
-Strategy::sendData(const shared_ptr<pit::Entry>& pitEntry, const Data& data, Face& egress)
+Strategy::sendData(const Data& data, Face& egress, const shared_ptr<pit::Entry>& pitEntry)
{
BOOST_ASSERT(pitEntry->getInterest().matchesData(data));
@@ -235,14 +234,13 @@
}
void
-Strategy::sendDataToAll(const shared_ptr<pit::Entry>& pitEntry,
- const Face& inFace, const Data& data)
+Strategy::sendDataToAll(const Data& data, const shared_ptr<pit::Entry>& pitEntry, const Face& inFace)
{
std::set<Face*> pendingDownstreams;
auto now = time::steady_clock::now();
// remember pending downstreams
- for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
+ for (const auto& inRecord : pitEntry->getInRecords()) {
if (inRecord.getExpiry() > now) {
if (inRecord.getFace().getId() == inFace.getId() &&
inRecord.getFace().getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
@@ -253,27 +251,28 @@
}
for (const auto& pendingDownstream : pendingDownstreams) {
- this->sendData(pitEntry, data, *pendingDownstream);
+ this->sendData(data, *pendingDownstream, pitEntry);
}
}
void
-Strategy::sendNacks(const shared_ptr<pit::Entry>& pitEntry, const lp::NackHeader& header,
+Strategy::sendNacks(const lp::NackHeader& header, const shared_ptr<pit::Entry>& pitEntry,
std::initializer_list<const Face*> exceptFaces)
{
// populate downstreams with all downstreams faces
std::unordered_set<Face*> downstreams;
- std::transform(pitEntry->in_begin(), pitEntry->in_end(), std::inserter(downstreams, downstreams.end()),
- [] (const pit::InRecord& inR) { return &inR.getFace(); });
+ std::transform(pitEntry->in_begin(), pitEntry->in_end(),
+ std::inserter(downstreams, downstreams.end()),
+ [] (const auto& inR) { return &inR.getFace(); });
- // delete excluded faces
+ // remove excluded faces
for (auto exceptFace : exceptFaces) {
downstreams.erase(const_cast<Face*>(exceptFace));
}
// send Nacks
for (auto downstream : downstreams) {
- this->sendNack(pitEntry, *downstream, header);
+ this->sendNack(header, *downstream, pitEntry);
}
// warning: don't loop on pitEntry->getInRecords(), because in-record is deleted when sending Nack
}
diff --git a/daemon/fw/strategy.hpp b/daemon/fw/strategy.hpp
index 3c6536e..93a154b 100644
--- a/daemon/fw/strategy.hpp
+++ b/daemon/fw/strategy.hpp
@@ -32,7 +32,8 @@
namespace nfd {
namespace fw {
-/** \brief Represents a forwarding strategy
+/**
+ * \brief Represents a forwarding strategy
*/
class Strategy : noncopyable
{
@@ -115,169 +116,193 @@
}
public: // triggers
- /** \brief Trigger after Interest is received
+ /**
+ * \brief Trigger after an Interest is received.
*
- * The Interest:
+ * The Interest:
* - has not exceeded HopLimit
* - does not violate Scope
* - is not looped
* - cannot be satisfied by ContentStore
* - is under a namespace managed by this strategy
*
- * The PIT entry is set to expire after InterestLifetime has elapsed at each downstream.
+ * The PIT entry is set to expire after InterestLifetime has elapsed at each downstream.
*
- * The strategy should decide whether and where to forward this Interest.
+ * The strategy should decide whether and where to forward this Interest.
* - If the strategy decides to forward this Interest,
- * invoke \c sendInterest for each upstream, either now or shortly after via a scheduler event,
- * but before PIT entry expires.
- * Optionally, the strategy can invoke \c setExpiryTimer to adjust how long it would wait for a response.
- * - If the strategy has already forwarded this Interest previously and decides to continue waiting,
- * do nothing.
- * Optionally, the strategy can invoke \c setExpiryTimer to adjust how long it would wait for a response.
+ * invoke sendInterest() for each upstream, either now or shortly after via a scheduler event,
+ * but before the PIT entry expires.
+ * Optionally, the strategy can invoke setExpiryTimer() to adjust how long it would wait for a response.
+ * - If the strategy has already forwarded this Interest previously and decides to continue
+ * waiting, do nothing.
+ * Optionally, the strategy can invoke setExpiryTimer() to adjust how long it would wait for a response.
* - If the strategy concludes that this Interest cannot be satisfied,
- * invoke \c rejectPendingInterest to erase the PIT entry.
+ * invoke rejectPendingInterest() to erase the PIT entry.
*
- * \warning The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior
- * may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
+ * \warning The strategy must not retain a copy of the \p pitEntry shared_ptr after this function
+ * returns, otherwise undefined behavior may occur. However, the strategy is allowed to
+ * construct and keep a weak_ptr to \p pitEntry.
*/
virtual void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) = 0;
- /** \brief Trigger before PIT entry is satisfied
+ /**
+ * \brief Trigger after a matching Data is found in the Content Store.
*
- * This trigger is invoked when an incoming Data satisfies more than one PIT entry.
- * The strategy can collect measurements information, but cannot manipulate Data forwarding.
- * When an incoming Data satisfies only one PIT entry, \c afterReceiveData is invoked instead
- * and given full control over Data forwarding. If a strategy does not override \c afterReceiveData,
- * the default implementation invokes \c beforeSatisfyInterest.
+ * In the base class, this method sends \p data to \p ingress.
*
- * Normally, PIT entries would be erased after receiving the first matching Data.
- * If the strategy wishes to collect responses from additional upstream nodes,
- * it should invoke \c setExpiryTimer within this function to prolong the PIT entry lifetime.
- * If a Data arrives from another upstream during the extended PIT entry lifetime, this trigger will be invoked again.
- * At that time, this function must invoke \c setExpiryTimer again to continue collecting more responses.
- *
- * In this base class this method does nothing.
- *
- * \warning The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior
- * may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
+ * \warning The strategy must not retain a copy of the \p pitEntry shared_ptr after this function
+ * returns, otherwise undefined behavior may occur. However, the strategy is allowed to
+ * construct and keep a weak_ptr to \p pitEntry.
*/
virtual void
- beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data);
+ afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry);
- /** \brief Trigger after a Data is matched in CS
+ /**
+ * \brief Trigger before a PIT entry is satisfied.
*
- * In the base class this method sends \p data to \p ingress
+ * This trigger is invoked when an incoming Data satisfies more than one PIT entry.
+ * The strategy can collect measurements information, but cannot manipulate Data forwarding.
+ * When an incoming Data satisfies only one PIT entry, afterReceiveData() is invoked instead
+ * and given full control over Data forwarding. If a strategy does not override afterReceiveData(),
+ * the default implementation invokes beforeSatisfyInterest().
+ *
+ * Normally, PIT entries are erased after receiving the first matching Data.
+ * If the strategy wishes to collect responses from additional upstream nodes,
+ * it should invoke setExpiryTimer() within this function to prolong the PIT entry lifetime.
+ * If a Data arrives from another upstream during the extended PIT entry lifetime, this trigger
+ * will be invoked again. At that time, the strategy must invoke setExpiryTimer() again to
+ * continue collecting more responses.
+ *
+ * In the base class, this method does nothing.
+ *
+ * \warning The strategy must not retain a copy of the \p pitEntry shared_ptr after this function
+ * returns, otherwise undefined behavior may occur. However, the strategy is allowed to
+ * construct and keep a weak_ptr to \p pitEntry.
*/
virtual void
- afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data);
+ beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry);
- /** \brief Trigger after Data is received
+ /**
+ * \brief Trigger after Data is received.
*
- * This trigger is invoked when an incoming Data satisfies exactly one PIT entry,
- * and gives the strategy full control over Data forwarding.
+ * This trigger is invoked when an incoming Data satisfies exactly one PIT entry,
+ * and gives the strategy full control over Data forwarding.
*
- * When this trigger is invoked:
+ * When this trigger is invoked:
* - The Data has been verified to satisfy the PIT entry.
* - The PIT entry expiry timer is set to now
*
- * Within this function:
- * - A strategy should return Data to downstream nodes via \c sendData or \c sendDataToAll.
+ * Inside this function:
+ * - A strategy should return Data to downstream nodes via sendData() or sendDataToAll().
* - A strategy can modify the Data as long as it still satisfies the PIT entry, such as
* adding or removing congestion marks.
- * - A strategy can delay Data forwarding by prolonging the PIT entry lifetime via \c setExpiryTimer,
- * and forward Data before the PIT entry is erased.
+ * - A strategy can delay Data forwarding by prolonging the PIT entry lifetime via setExpiryTimer(),
+ * and later forward the Data before the PIT entry is erased.
* - A strategy can collect measurements about the upstream.
* - A strategy can collect responses from additional upstream nodes by prolonging the PIT entry
- * lifetime via \c setExpiryTimer every time a Data is received. Note that only one Data should
+ * lifetime via setExpiryTimer() every time a Data is received. Note that only one Data should
* be returned to each downstream node.
*
- * In the base class this method invokes \c beforeSatisfyInterest trigger and then returns
- * the Data to downstream faces via \c sendDataToAll.
+ * In the base class, this method invokes beforeSatisfyInterest() and then returns the Data
+ * to all downstream faces via sendDataToAll().
+ *
+ * \warning The strategy must not retain a copy of the \p pitEntry shared_ptr after this function
+ * returns, otherwise undefined behavior may occur. However, the strategy is allowed to
+ * construct and keep a weak_ptr to \p pitEntry.
*/
virtual void
- afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data);
-
- /** \brief Trigger after Nack is received
- *
- * This trigger is invoked when an incoming Nack is received in response to
- * an forwarded Interest.
- * The Nack has been confirmed to be a response to the last Interest forwarded
- * to that upstream, i.e. the PIT out-record exists and has a matching Nonce.
- * The NackHeader has been recorded in the PIT out-record.
- *
- * If the PIT entry is not yet satisfied, its expiry timer remains unchanged.
- * Otherwise, the PIT entry normally would expire immediately after this function returns.
- *
- * If the strategy wishes to collect responses from additional upstream nodes,
- * it should invoke \c setExpiryTimer within this function to retain the PIT entry.
- * If a Nack arrives from another upstream during the extended PIT entry lifetime, this trigger will be invoked again.
- * At that time, this function must invoke \c setExpiryTimer again to continue collecting more responses.
- *
- * In the base class this method does nothing.
- *
- * \warning The strategy must not retain shared_ptr<pit::Entry>, otherwise undefined behavior
- * may occur. However, the strategy is allowed to store weak_ptr<pit::Entry>.
- */
- virtual void
- afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+ afterReceiveData(const Data& data, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry);
- /** \brief Trigger after Interest dropped (e.g., for exceeding allowed retransmissions)
+ /**
+ * \brief Trigger after a Nack is received.
*
- * In the base class this method does nothing.
+ * This trigger is invoked when an incoming Nack is received in response to
+ * an forwarded Interest.
+ * The Nack has been confirmed to be a response to the last Interest forwarded
+ * to that upstream, i.e. the PIT out-record exists and has a matching Nonce.
+ * The NackHeader has been recorded in the PIT out-record.
+ *
+ * If the PIT entry is not yet satisfied, its expiry timer remains unchanged.
+ * Otherwise, the PIT entry will normally expire immediately after this function returns.
+ *
+ * If the strategy wishes to collect responses from additional upstream nodes,
+ * it should invoke setExpiryTimer() within this function to prolong the PIT entry lifetime.
+ * If a Nack arrives from another upstream during the extended PIT entry lifetime, this trigger
+ * will be invoked again. At that time, the strategy must invoke setExpiryTimer() again to
+ * continue collecting more responses.
+ *
+ * In the base class, this method does nothing.
+ *
+ * \warning The strategy must not retain a copy of the \p pitEntry shared_ptr after this function
+ * returns, otherwise undefined behavior may occur. However, the strategy is allowed to
+ * construct and keep a weak_ptr to \p pitEntry.
*/
virtual void
- onDroppedInterest(const Face& egress, const Interest& interest);
+ afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry);
- /** \brief Trigger after new nexthop is added
+ /**
+ * \brief Trigger after an Interest is dropped (e.g., for exceeding allowed retransmissions).
*
- * The strategy should decide whether to send the buffered Interests to the new nexthop.
- * In the base class, this method does nothing.
+ * In the base class, this method does nothing.
+ */
+ virtual void
+ onDroppedInterest(const Interest& interest, Face& egress);
+
+ /**
+ * \brief Trigger after a new nexthop is added.
+ *
+ * The strategy should decide whether to send the buffered Interests to the new nexthop.
+ *
+ * In the base class, this method does nothing.
*/
virtual void
afterNewNextHop(const fib::NextHop& nextHop, const shared_ptr<pit::Entry>& pitEntry);
protected: // actions
- /** \brief Send an Interest packet.
- * \param pitEntry the PIT entry
- * \param egress face through which to send out the Interest
- * \param interest the Interest packet
- * \return A pointer to the out-record created or nullptr if the Interest was dropped
+ /**
+ * \brief Send an Interest packet.
+ * \param interest the Interest packet
+ * \param egress face through which to send out the Interest
+ * \param pitEntry the PIT entry
+ * \return A pointer to the out-record created or nullptr if the Interest was dropped
*/
NFD_VIRTUAL_WITH_TESTS pit::OutRecord*
- sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& egress,
- const Interest& interest);
+ sendInterest(const Interest& interest, Face& egress, const shared_ptr<pit::Entry>& pitEntry);
- /** \brief Send a Data packet.
- * \param pitEntry the PIT entry
- * \param data the Data packet
- * \param egress face through which to send out the Data
- * \return Whether the Data was sent (true) or dropped (false)
+ /**
+ * \brief Send a Data packet.
+ * \param data the Data packet
+ * \param egress face through which to send out the Data
+ * \param pitEntry the PIT entry
+ * \return Whether the Data was sent (true) or dropped (false)
*/
NFD_VIRTUAL_WITH_TESTS bool
- sendData(const shared_ptr<pit::Entry>& pitEntry, const Data& data, Face& egress);
+ sendData(const Data& data, Face& egress, const shared_ptr<pit::Entry>& pitEntry);
- /** \brief Send a Data packet to all matched and qualified faces.
+ /**
+ * \brief Send a Data packet to all matched and qualified faces.
*
- * A matched face is qualified if it is ad-hoc or it is NOT \p inFace.
+ * A matched face qualifies if it is ad-hoc OR it is NOT \p inFace.
*
- * \param pitEntry the PIT entry
- * \param inFace face on which the Data arrived
- * \param data the Data packet
+ * \param data the Data packet
+ * \param pitEntry the PIT entry
+ * \param inFace face on which the Data arrived
*/
NFD_VIRTUAL_WITH_TESTS void
- sendDataToAll(const shared_ptr<pit::Entry>& pitEntry, const Face& inFace, const Data& data);
+ sendDataToAll(const Data& data, const shared_ptr<pit::Entry>& pitEntry, const Face& inFace);
- /** \brief Schedule the PIT entry for immediate deletion.
+ /**
+ * \brief Schedule the PIT entry for immediate deletion.
*
- * This helper function sets the PIT entry expiry time to zero.
- * The strategy should invoke this function when it concludes that the Interest cannot
- * be forwarded and it does not want to wait for responses from existing upstream nodes.
+ * This helper function sets the PIT entry expiry time to zero.
+ * The strategy should invoke this function when it concludes that the Interest cannot
+ * be forwarded and it does not want to wait for responses from existing upstream nodes.
*/
NFD_VIRTUAL_WITH_TESTS void
rejectPendingInterest(const shared_ptr<pit::Entry>& pitEntry)
@@ -285,33 +310,35 @@
this->setExpiryTimer(pitEntry, 0_ms);
}
- /** \brief Send a Nack packet.
+ /**
+ * \brief Send a Nack packet.
*
- * The egress face must have a PIT in-record, otherwise this method has no effect.
+ * The egress face must have a PIT in-record, otherwise this method has no effect.
*
- * \param pitEntry the PIT entry
- * \param egress face through which to send out the Nack
- * \param header the Nack header
- * \return Whether the Nack was sent (true) or dropped (false)
+ * \param header the Nack header
+ * \param egress face through which to send out the Nack
+ * \param pitEntry the PIT entry
+ * \return Whether the Nack was sent (true) or dropped (false)
*/
NFD_VIRTUAL_WITH_TESTS bool
- sendNack(const shared_ptr<pit::Entry>& pitEntry, Face& egress,
- const lp::NackHeader& header)
+ sendNack(const lp::NackHeader& header, Face& egress, const shared_ptr<pit::Entry>& pitEntry)
{
- return m_forwarder.onOutgoingNack(pitEntry, egress, header);
+ return m_forwarder.onOutgoingNack(header, egress, pitEntry);
}
- /** \brief Send Nack to every face that has an in-record, except those in \p exceptFaces
- * \param pitEntry the PIT entry
- * \param header the Nack header
- * \param exceptFaces list of faces that should be excluded from sending Nacks
- * \note This is not an action, but a helper that invokes the sendNack() action.
+ /**
+ * \brief Send Nack to every face that has an in-record, except those in \p exceptFaces
+ * \param header the Nack header
+ * \param pitEntry the PIT entry
+ * \param exceptFaces list of faces that should be excluded from sending Nacks
+ * \note This is not an action, but a helper that invokes the sendNack() action.
*/
void
- sendNacks(const shared_ptr<pit::Entry>& pitEntry, const lp::NackHeader& header,
+ sendNacks(const lp::NackHeader& header, const shared_ptr<pit::Entry>& pitEntry,
std::initializer_list<const Face*> exceptFaces = {});
- /** \brief Schedule the PIT entry to be erased after \p duration.
+ /**
+ * \brief Schedule the PIT entry to be erased after \p duration.
*/
void
setExpiryTimer(const shared_ptr<pit::Entry>& pitEntry, time::milliseconds duration)
@@ -320,7 +347,8 @@
}
protected: // accessors
- /** \brief Performs a FIB lookup, considering Link object if present.
+ /**
+ * \brief Performs a FIB lookup, considering Link object if present.
*/
const fib::Entry&
lookupFib(const pit::Entry& pitEntry) const;
@@ -381,8 +409,8 @@
}
private: // registry
- typedef std::function<unique_ptr<Strategy>(Forwarder& forwarder, const Name& strategyName)> CreateFunc;
- typedef std::map<Name, CreateFunc> Registry; // indexed by strategy name
+ using CreateFunc = std::function<unique_ptr<Strategy>(Forwarder&, const Name& /*strategyName*/)>;
+ using Registry = std::map<Name, CreateFunc>; // indexed by strategy name
static Registry&
getRegistry();
@@ -396,13 +424,7 @@
private: // instance fields
Name m_name;
-
- /** \brief Reference to the forwarder
- *
- * Triggers can access forwarder indirectly via actions.
- */
Forwarder& m_forwarder;
-
MeasurementsAccessor m_measurements;
};
diff --git a/tests/daemon/fw/asf-strategy.t.cpp b/tests/daemon/fw/asf-strategy.t.cpp
index 78eb795..afe009f 100644
--- a/tests/daemon/fw/asf-strategy.t.cpp
+++ b/tests/daemon/fw/asf-strategy.t.cpp
@@ -275,7 +275,7 @@
auto& pit = topo.getForwarder(nodeB).getPit();
auto pitEntry = pit.insert(*interest).first;
- topo.getForwarder(nodeB).onOutgoingInterest(pitEntry, linkBC->getFace(nodeB), *interest);
+ topo.getForwarder(nodeB).onOutgoingInterest(*interest, linkBC->getFace(nodeB), pitEntry);
this->advanceClocks(time::milliseconds(100));
interest->refreshNonce();
diff --git a/tests/daemon/fw/best-route-strategy.t.cpp b/tests/daemon/fw/best-route-strategy.t.cpp
index cd519b5..5066cca 100644
--- a/tests/daemon/fw/best-route-strategy.t.cpp
+++ b/tests/daemon/fw/best-route-strategy.t.cpp
@@ -88,7 +88,7 @@
// first Interest goes to nexthop with lowest FIB cost,
// however face1 is downstream so it cannot be used
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.back().outFaceId, face2->getId());
@@ -100,7 +100,7 @@
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(*face4, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face4, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face4, 0), pitEntry);
size_t nSent = strategy.sendInterestHistory.size();
if (nSent > nSentLast) {
@@ -132,7 +132,7 @@
for (int i = 0; i < 3; ++i) {
this->advanceClocks(TICK, BestRouteStrategy::RETX_SUPPRESSION_MAX * 2);
pitEntry->insertOrUpdateInRecord(*face5, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face5, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face5, 0), pitEntry);
}
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 3);
BOOST_CHECK_NE(strategy.sendInterestHistory[0].outFaceId, face1->getId());
diff --git a/tests/daemon/fw/dummy-strategy.cpp b/tests/daemon/fw/dummy-strategy.cpp
index 3a6e338..439efd1 100644
--- a/tests/daemon/fw/dummy-strategy.cpp
+++ b/tests/daemon/fw/dummy-strategy.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -44,23 +44,18 @@
DummyStrategy::DummyStrategy(Forwarder& forwarder, const Name& name)
: Strategy(forwarder)
- , afterReceiveInterest_count(0)
- , beforeSatisfyInterest_count(0)
- , afterContentStoreHit_count(0)
- , afterReceiveData_count(0)
- , afterReceiveNack_count(0)
{
this->setInstanceName(name);
}
void
-DummyStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+DummyStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint&,
const shared_ptr<pit::Entry>& pitEntry)
{
++afterReceiveInterest_count;
if (interestOutFace != nullptr) {
- this->sendInterest(pitEntry, *interestOutFace, interest);
+ this->sendInterest(interest, *interestOutFace, pitEntry);
}
else {
this->rejectPendingInterest(pitEntry);
@@ -68,39 +63,39 @@
}
void
-DummyStrategy::beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data)
-{
- ++beforeSatisfyInterest_count;
-
- Strategy::beforeSatisfyInterest(pitEntry, ingress, data);
-}
-
-void
-DummyStrategy::afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data)
+DummyStrategy::afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry)
{
++afterContentStoreHit_count;
- Strategy::afterContentStoreHit(pitEntry, ingress, data);
+ Strategy::afterContentStoreHit(data, ingress, pitEntry);
}
void
-DummyStrategy::afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data)
+DummyStrategy::beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry)
+{
+ ++beforeSatisfyInterest_count;
+
+ Strategy::beforeSatisfyInterest(data, ingress, pitEntry);
+}
+
+void
+DummyStrategy::afterReceiveData(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry)
{
++afterReceiveData_count;
- Strategy::afterReceiveData(pitEntry, ingress, data);
+ Strategy::afterReceiveData(data, ingress, pitEntry);
}
void
-DummyStrategy::afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+DummyStrategy::afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
++afterReceiveNack_count;
- Strategy::afterReceiveNack(ingress, nack, pitEntry);
+ Strategy::afterReceiveNack(nack, ingress, pitEntry);
}
void
diff --git a/tests/daemon/fw/dummy-strategy.hpp b/tests/daemon/fw/dummy-strategy.hpp
index aacc1e4..f24d990 100644
--- a/tests/daemon/fw/dummy-strategy.hpp
+++ b/tests/daemon/fw/dummy-strategy.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -47,37 +47,39 @@
static Name
getStrategyName(uint64_t version = std::numeric_limits<uint64_t>::max());
- /** \brief constructor
+ /**
+ * \brief Constructor
*
- * \p name is recorded unchanged as \p getInstanceName() , and will not automatically
- * gain a version number when instantiated without a version number.
+ * \p name is recorded unchanged as getInstanceName(), and will not automatically
+ * gain a version number when instantiated without a version number.
*/
explicit
DummyStrategy(Forwarder& forwarder, const Name& name = getStrategyName());
- /** \brief after receive Interest trigger
+ /**
+ * \brief After receive Interest trigger
*
- * If \p interestOutFace is not null, Interest is forwarded to that face and endpoint via send Interest action;
- * otherwise, reject pending Interest action is invoked.
+ * If interestOutFace is not null, \p interest is forwarded to that face;
+ * otherwise, rejectPendingInterest() is invoked.
*/
void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
void
- beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data) override;
+ afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry) override;
void
- afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data) override;
+ beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry) override;
void
- afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data) override;
+ afterReceiveData(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry) override;
void
- afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+ afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
void
@@ -97,11 +99,11 @@
}
public:
- int afterReceiveInterest_count;
- int beforeSatisfyInterest_count;
- int afterContentStoreHit_count;
- int afterReceiveData_count;
- int afterReceiveNack_count;
+ int afterReceiveInterest_count = 0;
+ int afterContentStoreHit_count = 0;
+ int beforeSatisfyInterest_count = 0;
+ int afterReceiveData_count = 0;
+ int afterReceiveNack_count = 0;
// a collection of names of PIT entries that afterNewNextHop() was called on
std::vector<Name> afterNewNextHopCalls;
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index e3b3a19..12ced16 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -165,14 +165,14 @@
pitA->insertOrUpdateInRecord(*face1, *interestA1);
auto interestA2 = makeInterest("/A", false, nullopt, 1698);
- auto outA2 = forwarder.onOutgoingInterest(pitA, *face2, *interestA2);
+ auto outA2 = forwarder.onOutgoingInterest(*interestA2, *face2, pitA);
BOOST_REQUIRE(outA2 != nullptr);
BOOST_CHECK_EQUAL(outA2->getLastNonce(), 1698);
// This packet will be dropped because HopLimit=0
auto interestA3 = makeInterest("/A", false, nullopt, 9876);
interestA3->setHopLimit(0);
- auto outA3 = forwarder.onOutgoingInterest(pitA, *face2, *interestA3);
+ auto outA3 = forwarder.onOutgoingInterest(*interestA3, *face2, pitA);
BOOST_CHECK(outA3 == nullptr);
BOOST_REQUIRE_EQUAL(face2->sentInterests.size(), 1);
@@ -275,47 +275,47 @@
// local face, /localhost: OK
strategy.afterReceiveInterest_count = 0;
auto i1 = makeInterest("/localhost/A1");
- forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i1);
+ forwarder.onIncomingInterest(*i1, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
// non-local face, /localhost: violate
strategy.afterReceiveInterest_count = 0;
auto i2 = makeInterest("/localhost/A2");
- forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i2);
+ forwarder.onIncomingInterest(*i2, FaceEndpoint(*face2, 0));
BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 0);
// local face, non-/localhost: OK
strategy.afterReceiveInterest_count = 0;
auto i3 = makeInterest("/A3");
- forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *i3);
+ forwarder.onIncomingInterest(*i3, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
// non-local face, non-/localhost: OK
strategy.afterReceiveInterest_count = 0;
auto i4 = makeInterest("/A4");
- forwarder.onIncomingInterest(FaceEndpoint(*face2, 0), *i4);
+ forwarder.onIncomingInterest(*i4, FaceEndpoint(*face2, 0));
BOOST_CHECK_EQUAL(strategy.afterReceiveInterest_count, 1);
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
// local face, /localhost: OK
auto d1 = makeData("/localhost/B1");
- forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d1);
+ forwarder.onIncomingData(*d1, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
// non-local face, /localhost: violate
auto d2 = makeData("/localhost/B2");
- forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d2);
+ forwarder.onIncomingData(*d2, FaceEndpoint(*face2, 0));
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
// local face, non-/localhost: OK
auto d3 = makeData("/B3");
- forwarder.onIncomingData(FaceEndpoint(*face1, 0), *d3);
+ forwarder.onIncomingData(*d3, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 2);
// non-local face, non-/localhost: OK
auto d4 = makeData("/B4");
- forwarder.onIncomingData(FaceEndpoint(*face2, 0), *d4);
+ forwarder.onIncomingData(*d4, FaceEndpoint(*face2, 0));
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 3);
}
@@ -330,31 +330,31 @@
auto interest1 = makeInterest("/A/1");
strategyA.afterReceiveInterest_count = 0;
strategyA.interestOutFace = face2;
- forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest1);
+ forwarder.onIncomingInterest(*interest1, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(strategyA.afterReceiveInterest_count, 1);
auto interest2 = makeInterest("/B/2", true);
strategyB.afterReceiveInterest_count = 0;
strategyB.interestOutFace = face2;
- forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest2);
+ forwarder.onIncomingInterest(*interest2, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(strategyB.afterReceiveInterest_count, 1);
this->advanceClocks(1_ms, 5_ms);
auto data1 = makeData("/A/1");
strategyA.beforeSatisfyInterest_count = 0;
- forwarder.onIncomingData(FaceEndpoint(*face2, 0), *data1);
+ forwarder.onIncomingData(*data1, FaceEndpoint(*face2, 0));
BOOST_CHECK_EQUAL(strategyA.beforeSatisfyInterest_count, 1);
auto data2 = makeData("/B/2/b");
strategyB.beforeSatisfyInterest_count = 0;
- forwarder.onIncomingData(FaceEndpoint(*face2, 0), *data2);
+ forwarder.onIncomingData(*data2, FaceEndpoint(*face2, 0));
BOOST_CHECK_EQUAL(strategyB.beforeSatisfyInterest_count, 1);
auto interest3 = makeInterest("/A/3", false, 30_ms);
- forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest3);
+ forwarder.onIncomingInterest(*interest3, FaceEndpoint(*face1, 0));
auto interest4 = makeInterest("/B/4", false, 5_s);
- forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest4);
+ forwarder.onIncomingInterest(*interest4, FaceEndpoint(*face1, 0));
}
BOOST_AUTO_TEST_CASE(IncomingData)
@@ -378,7 +378,7 @@
pitC->insertOrUpdateInRecord(*face4, *interestC);
auto dataD = makeData("/A/B/C/D");
- forwarder.onIncomingData(FaceEndpoint(*face3, 0), *dataD);
+ forwarder.onIncomingData(*dataD, FaceEndpoint(*face3, 0));
this->advanceClocks(1_ms, 5_ms);
BOOST_CHECK_EQUAL(face1->sentData.size(), 1);
@@ -446,14 +446,14 @@
auto nack1 = makeNack(*interest1, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack1);
+ forwarder.onIncomingNack(nack1, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 1);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
auto nack2 = makeNack(*interest2, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack2);
+ forwarder.onIncomingNack(nack2, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 1);
@@ -467,7 +467,7 @@
auto nack3 = makeNack(*makeInterest("/yEcw5HhdM", false, nullopt, 243), lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack3);
+ forwarder.onIncomingNack(nack3, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
@@ -479,7 +479,7 @@
auto nack4a = makeNack(*interest4, lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(FaceEndpoint(*face2, 0), nack4a);
+ forwarder.onIncomingNack(nack4a, FaceEndpoint(*face2, 0));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
@@ -487,7 +487,7 @@
auto nack4b = makeNack(*makeInterest("/Etab4KpY", false, nullopt, 294), lp::NackReason::CONGESTION);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(FaceEndpoint(*face1, 0), nack4b);
+ forwarder.onIncomingNack(nack4b, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
@@ -495,7 +495,7 @@
pit4->insertOrUpdateOutRecord(*face3, *interest4);
strategyA.afterReceiveNack_count = 0;
strategyB.afterReceiveNack_count = 0;
- forwarder.onIncomingNack(FaceEndpoint(*face3, 0), nack4a);
+ forwarder.onIncomingNack(nack4a, FaceEndpoint(*face3, 0));
BOOST_CHECK_EQUAL(strategyA.afterReceiveNack_count, 0);
BOOST_CHECK_EQUAL(strategyB.afterReceiveNack_count, 0);
}
@@ -522,7 +522,7 @@
pit1->insertOrUpdateInRecord(*face1, *interest1);
face2->sentNacks.clear();
- BOOST_CHECK(!forwarder.onOutgoingNack(pit1, *face2, nackHeader));
+ BOOST_CHECK(!forwarder.onOutgoingNack(nackHeader, *face2, pit1));
BOOST_CHECK_EQUAL(face2->sentNacks.size(), 0);
// send Nack with correct Nonce
@@ -534,7 +534,7 @@
face1->sentNacks.clear();
face2->sentNacks.clear();
- BOOST_CHECK(forwarder.onOutgoingNack(pit2, *face1, nackHeader));
+ BOOST_CHECK(forwarder.onOutgoingNack(nackHeader, *face1, pit2));
BOOST_REQUIRE_EQUAL(face1->sentNacks.size(), 1);
BOOST_CHECK_EQUAL(face1->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
BOOST_CHECK_EQUAL(face1->sentNacks.back().getInterest().getNonce(), 152);
@@ -545,7 +545,7 @@
BOOST_CHECK(inRecord2a == pit2->in_end());
// send Nack with correct Nonce
- BOOST_CHECK(forwarder.onOutgoingNack(pit2, *face2, nackHeader));
+ BOOST_CHECK(forwarder.onOutgoingNack(nackHeader, *face2, pit2));
BOOST_CHECK_EQUAL(face1->sentNacks.size(), 1);
BOOST_REQUIRE_EQUAL(face2->sentNacks.size(), 1);
BOOST_CHECK_EQUAL(face2->sentNacks.back().getReason(), lp::NackReason::CONGESTION);
@@ -560,7 +560,7 @@
pit2->insertOrUpdateInRecord(*face3, *interest2c);
face3->sentNacks.clear();
- BOOST_CHECK(!forwarder.onOutgoingNack(pit2, *face3, nackHeader));
+ BOOST_CHECK(!forwarder.onOutgoingNack(nackHeader, *face3, pit2));
BOOST_CHECK_EQUAL(face3->sentNacks.size(), 0);
// don't send Nack to face with invalid ID
@@ -568,7 +568,7 @@
pit1->insertOrUpdateInRecord(*face4, *interest1b);
face4->sentNacks.clear();
- BOOST_CHECK(!forwarder.onOutgoingNack(pit1, *face4, nackHeader));
+ BOOST_CHECK(!forwarder.onOutgoingNack(nackHeader, *face4, pit1));
BOOST_CHECK_EQUAL(face4->sentNacks.size(), 0);
}
@@ -643,7 +643,6 @@
// interest should be forwarded only once, as long as Nonce is in Dead Nonce List
BOOST_ASSERT(25_ms * 40 < forwarder.getDeadNonceList().getLifetime());
this->advanceClocks(25_ms, 40);
-
BOOST_CHECK_EQUAL(face2->sentInterests.size(), 1);
// It's unnecessary to check that Interest with duplicate Nonce can be forwarded again
@@ -658,12 +657,12 @@
auto face1 = addFace();
auto interest = makeInterest("/hcLSAsQ9A", false, 2_s, 61883075);
- DeadNonceList& dnl = forwarder.getDeadNonceList();
+ auto& dnl = forwarder.getDeadNonceList();
dnl.add(interest->getName(), interest->getNonce());
- Pit& pit = forwarder.getPit();
- BOOST_REQUIRE_EQUAL(pit.size(), 0);
+ auto& pit = forwarder.getPit();
+ BOOST_CHECK_EQUAL(pit.size(), 0);
- forwarder.onIncomingInterest(FaceEndpoint(*face1, 0), *interest);
+ forwarder.onIncomingInterest(*interest, FaceEndpoint(*face1, 0));
this->advanceClocks(100_ms, 20_s);
BOOST_CHECK_EQUAL(pit.size(), 0);
}
@@ -674,7 +673,7 @@
auto data = makeData("/A");
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 0);
- forwarder.onIncomingData(FaceEndpoint(*face1, 0), *data);
+ forwarder.onIncomingData(*data, FaceEndpoint(*face1, 0));
this->advanceClocks(1_ms, 10_ms);
BOOST_CHECK_EQUAL(forwarder.getCounters().nUnsolicitedData, 1);
}
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index a75bf30..90e4b1e 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -87,7 +87,7 @@
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 1);
@@ -98,7 +98,7 @@
pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face2, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face2, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face2, 0), pitEntry);
// Since the interest is the same as the one sent out earlier, the PIT entry should not be
// rejected, as any data coming back must be able to satisfy the original interest from face 1
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
@@ -164,7 +164,7 @@
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face3, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 2);
BOOST_TEST(didSendInterestTo(*face1));
@@ -180,7 +180,7 @@
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(*face3, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
size_t nSent = strategy.sendInterestHistory.size();
if (nSent > nSentLast) {
@@ -208,7 +208,7 @@
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
}
@@ -228,7 +228,7 @@
auto interest = makeInterest("/t8ZiSOi3");
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
// forwarded to faces 2 and 3
BOOST_TEST(strategy.sendInterestHistory.size() == 2);
@@ -243,7 +243,7 @@
interest->refreshNonce();
pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face2, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face2, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face2, 0), pitEntry);
// forwarded only to face 1, suppressed on face 3
BOOST_TEST(strategy.sendInterestHistory.size() == 1);
@@ -257,7 +257,7 @@
interest->refreshNonce();
pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face3, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
// suppressed on face 1, forwarded on face 2 (and suppression window doubles)
BOOST_TEST(strategy.sendInterestHistory.size() == 1);
@@ -271,7 +271,7 @@
interest->refreshNonce();
pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face3, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face3, 0), pitEntry);
// forwarded only to face 1, suppressed on face 2
BOOST_TEST(strategy.sendInterestHistory.size() == 1);
@@ -285,7 +285,7 @@
interest->refreshNonce();
pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
// forwarded to faces 2 and 3
BOOST_TEST(strategy.sendInterestHistory.size() == 2);
@@ -304,7 +304,7 @@
auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 1);
@@ -492,12 +492,12 @@
auto interest = makeInterest("ndn:/localhop/H0D6i5fc");
auto pitEntry = this->pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*this->inFace1, *interest);
- this->strategy.afterReceiveInterest(FaceEndpoint(*this->inFace1, 0), *interest, pitEntry);
+ this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->inFace1, 0), pitEntry);
if (this->inFace2 != nullptr) {
auto interest2 = makeInterest("ndn:/localhop/H0D6i5fc");
pitEntry->insertOrUpdateInRecord(*this->inFace2, *interest2);
- this->strategy.afterReceiveInterest(FaceEndpoint(*this->inFace2, 0), *interest2, pitEntry);
+ this->strategy.afterReceiveInterest(*interest2, FaceEndpoint(*this->inFace2, 0), pitEntry);
}
this->strategy.sendInterestHistory.clear();
diff --git a/tests/daemon/fw/pit-expiry.t.cpp b/tests/daemon/fw/pit-expiry.t.cpp
index 4b5345e..099d031 100644
--- a/tests/daemon/fw/pit-expiry.t.cpp
+++ b/tests/daemon/fw/pit-expiry.t.cpp
@@ -62,10 +62,10 @@
}
void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override
{
- DummyStrategy::afterReceiveInterest(ingress, interest, pitEntry);
+ DummyStrategy::afterReceiveInterest(interest, ingress, pitEntry);
if (afterReceiveInterest_count <= 1) {
setExpiryTimer(pitEntry, 190_ms);
@@ -73,10 +73,21 @@
}
void
- beforeSatisfyInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data) override
+ afterContentStoreHit(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry) override
{
- DummyStrategy::beforeSatisfyInterest(pitEntry, ingress, data);
+ if (afterContentStoreHit_count == 0) {
+ setExpiryTimer(pitEntry, 190_ms);
+ }
+
+ DummyStrategy::afterContentStoreHit(data, ingress, pitEntry);
+ }
+
+ void
+ beforeSatisfyInterest(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry) override
+ {
+ DummyStrategy::beforeSatisfyInterest(data, ingress, pitEntry);
if (beforeSatisfyInterest_count <= 2) {
setExpiryTimer(pitEntry, 190_ms);
@@ -84,19 +95,8 @@
}
void
- afterContentStoreHit(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data) override
- {
- if (afterContentStoreHit_count == 0) {
- setExpiryTimer(pitEntry, 190_ms);
- }
-
- DummyStrategy::afterContentStoreHit(pitEntry, ingress, data);
- }
-
- void
- afterReceiveData(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& ingress, const Data& data) override
+ afterReceiveData(const Data& data, const FaceEndpoint& ingress,
+ const shared_ptr<pit::Entry>& pitEntry) override
{
++afterReceiveData_count;
@@ -104,14 +104,14 @@
setExpiryTimer(pitEntry, 290_ms);
}
- this->sendDataToAll(pitEntry, ingress.face, data);
+ this->sendDataToAll(data, pitEntry, ingress.face);
}
void
- afterReceiveNack(const FaceEndpoint& ingress, const lp::Nack& nack,
+ afterReceiveNack(const lp::Nack& nack, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override
{
- DummyStrategy::afterReceiveNack(ingress, nack, pitEntry);
+ DummyStrategy::afterReceiveNack(nack, ingress, pitEntry);
if (afterReceiveNack_count <= 1) {
setExpiryTimer(pitEntry, 50_ms);
diff --git a/tests/daemon/fw/random-strategy.t.cpp b/tests/daemon/fw/random-strategy.t.cpp
index 4822e4c..d2291c5 100644
--- a/tests/daemon/fw/random-strategy.t.cpp
+++ b/tests/daemon/fw/random-strategy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -78,22 +78,22 @@
// Send 1000 Interests
for (int i = 0; i < 1000; ++i) {
- shared_ptr<Interest> interest = makeInterest("ndn:/BzgFBchqA" + std::to_string(i));
- shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
+ auto interest = makeInterest("ndn:/BzgFBchqA" + std::to_string(i));
+ auto pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(*face1, *interest);
- strategy.afterReceiveInterest(FaceEndpoint(*face1, 0), *interest, pitEntry);
+ strategy.afterReceiveInterest(*interest, FaceEndpoint(*face1, 0), pitEntry);
}
- // Map outFaceId -> SentInterests.
- std::unordered_map<int, int> faceInterestMap;
+ // Map outFaceId -> SentInterests
+ std::unordered_map<FaceId, int> faceInterestMap;
for (const auto& i : strategy.sendInterestHistory) {
faceInterestMap[i.outFaceId]++;
}
// Check that all faces received at least 10 Interest
for (const auto& x : faceInterestMap) {
- BOOST_CHECK_GE(x.second, 10);
+ BOOST_TEST(x.second >= 10);
}
}
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 5811652..9b5f588 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -108,7 +108,7 @@
pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3);
auto f = [&] {
- this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry);
+ this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3, 0), pitEntry);
};
BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo, 2));
@@ -144,7 +144,7 @@
lp::Nack nack3 = makeNack(*interest1, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face3)->setIncomingNack(nack3);
- this->strategy.afterReceiveNack(FaceEndpoint(*this->face3, 0), nack3, pitEntry);
+ this->strategy.afterReceiveNack(nack3, FaceEndpoint(*this->face3, 0), pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
@@ -152,7 +152,7 @@
pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4);
auto f = [&] {
- this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry);
+ this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4, 0), pitEntry);
};
BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo));
@@ -186,7 +186,7 @@
lp::Nack nack4 = makeNack(*interest2, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*this->face4)->setIncomingNack(nack4);
- this->strategy.afterReceiveNack(FaceEndpoint(*this->face4, 0), nack4, pitEntry);
+ this->strategy.afterReceiveNack(nack4, FaceEndpoint(*this->face4, 0), pitEntry);
BOOST_CHECK_EQUAL(this->strategy.sendNackHistory.size(), 0);
}
@@ -333,13 +333,13 @@
lp::Nack nack3 = makeNack(*interest1, Combination::getX());
pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
- strategy.afterReceiveNack(FaceEndpoint(*face3, 0), nack3, pitEntry);
+ strategy.afterReceiveNack(nack3, FaceEndpoint(*face3, 0), pitEntry);
BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
lp::Nack nack4 = makeNack(*interest1, Combination::getY());
pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
- strategy.afterReceiveNack(FaceEndpoint(*face4, 0), nack4, pitEntry);
+ strategy.afterReceiveNack(nack4, FaceEndpoint(*face4, 0), pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitInterest.wireEncode(),
diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp
index 93a6367..cec64c4 100644
--- a/tests/daemon/fw/strategy-no-route.t.cpp
+++ b/tests/daemon/fw/strategy-no-route.t.cpp
@@ -165,7 +165,7 @@
pitEntry->insertOrUpdateInRecord(*this->face1, *interest);
auto f = [&] {
- this->strategy.afterReceiveInterest(FaceEndpoint(*this->face1, 0), *interest, pitEntry);
+ this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->face1, 0), pitEntry);
};
BOOST_REQUIRE(this->strategy.waitForAction(f, this->limitedIo, 2));
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index 5c6c552..6fd052e 100644
--- a/tests/daemon/fw/strategy-scope-control.t.cpp
+++ b/tests/daemon/fw/strategy-scope-control.t.cpp
@@ -128,7 +128,7 @@
pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3, 0), pitEntry); },
this->limitedIo));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -147,7 +147,7 @@
pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3, 0), pitEntry); },
this->limitedIo, T::willRejectPitEntry() + T::willSendNackNoRoute()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -170,7 +170,7 @@
pitEntry->insertOrUpdateInRecord(*this->localFace3, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->localFace3, 0), *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->localFace3, 0), pitEntry); },
this->limitedIo));
BOOST_REQUIRE_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -190,7 +190,7 @@
pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->nonLocalFace1, 0), *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->nonLocalFace1, 0), pitEntry); },
this->limitedIo, T::willRejectPitEntry() + T::willSendNackNoRoute()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -213,7 +213,7 @@
pitEntry->insertOrUpdateInRecord(*this->nonLocalFace1, *interest);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveInterest(FaceEndpoint(*this->nonLocalFace1, 0), *interest, pitEntry); },
+ [&] { this->strategy.afterReceiveInterest(*interest, FaceEndpoint(*this->nonLocalFace1, 0), pitEntry); },
this->limitedIo));
BOOST_REQUIRE_EQUAL(this->strategy.sendInterestHistory.size(), 1);
@@ -236,7 +236,7 @@
pitEntry->insertOrUpdateOutRecord(*this->localFace4, *interest)->setIncomingNack(nack);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->localFace4, 0), nack, pitEntry); },
+ [&] { this->strategy.afterReceiveNack(nack, FaceEndpoint(*this->localFace4, 0), pitEntry); },
this->limitedIo, T::canProcessNack()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
@@ -261,7 +261,7 @@
pitEntry->insertOrUpdateOutRecord(*this->localFace4, *interest)->setIncomingNack(nack);
BOOST_REQUIRE(this->strategy.waitForAction(
- [&] { this->strategy.afterReceiveNack(FaceEndpoint(*this->localFace4, 0), nack, pitEntry); },
+ [&] { this->strategy.afterReceiveNack(nack, FaceEndpoint(*this->localFace4, 0), pitEntry); },
this->limitedIo, T::canProcessNack()));
BOOST_CHECK_EQUAL(this->strategy.sendInterestHistory.size(), 0);
diff --git a/tests/daemon/fw/strategy-tester.hpp b/tests/daemon/fw/strategy-tester.hpp
index b9ed2ff..03c2f77 100644
--- a/tests/daemon/fw/strategy-tester.hpp
+++ b/tests/daemon/fw/strategy-tester.hpp
@@ -103,8 +103,8 @@
protected:
pit::OutRecord*
- sendInterest(const shared_ptr<pit::Entry>& pitEntry, Face& egress,
- const Interest& interest) override
+ sendInterest(const Interest& interest, Face& egress,
+ const shared_ptr<pit::Entry>& pitEntry) override
{
sendInterestHistory.push_back({pitEntry->getInterest(), egress.getId(), interest});
auto it = pitEntry->insertOrUpdateOutRecord(egress, interest);
@@ -121,8 +121,8 @@
}
bool
- sendNack(const shared_ptr<pit::Entry>& pitEntry, Face& egress,
- const lp::NackHeader& header) override
+ sendNack(const lp::NackHeader& header, Face& egress,
+ const shared_ptr<pit::Entry>& pitEntry) override
{
sendNackHistory.push_back({pitEntry->getInterest(), egress.getId(), header});
pitEntry->deleteInRecord(egress);
diff --git a/tests/daemon/fw/unsolicited-data-policy.t.cpp b/tests/daemon/fw/unsolicited-data-policy.t.cpp
index 21894ca..bc95d4f 100644
--- a/tests/daemon/fw/unsolicited-data-policy.t.cpp
+++ b/tests/daemon/fw/unsolicited-data-policy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -94,18 +94,18 @@
template<typename Policy, bool shouldAdmitLocal, bool shouldAdmitNonLocal>
struct FaceScopePolicyTest
{
- typedef Policy PolicyType;
- typedef std::integral_constant<bool, shouldAdmitLocal> ShouldAdmitLocal;
- typedef std::integral_constant<bool, shouldAdmitNonLocal> ShouldAdmitNonLocal;
+ using PolicyType = Policy;
+ using ShouldAdmitLocal = std::integral_constant<bool, shouldAdmitLocal>;
+ using ShouldAdmitNonLocal = std::integral_constant<bool, shouldAdmitNonLocal>;
};
-typedef boost::mpl::vector<
+using FaceScopePolicyTests = boost::mpl::vector<
FaceScopePolicyTest<void, false, false>, // default policy
FaceScopePolicyTest<DropAllUnsolicitedDataPolicy, false, false>,
FaceScopePolicyTest<AdmitLocalUnsolicitedDataPolicy, true, false>,
FaceScopePolicyTest<AdmitNetworkUnsolicitedDataPolicy, false, true>,
FaceScopePolicyTest<AdmitAllUnsolicitedDataPolicy, true, true>
-> FaceScopePolicyTests;
+>;
BOOST_AUTO_TEST_CASE_TEMPLATE(FaceScopePolicy, T, FaceScopePolicyTests)
{
@@ -115,16 +115,16 @@
ndn::nfd::FACE_SCOPE_LOCAL);
faceTable.add(face1);
- shared_ptr<Data> data1 = makeData("/unsolicited-from-local");
- forwarder.onIncomingData(FaceEndpoint(*face1, 0), *data1);
+ auto data1 = makeData("/unsolicited-from-local");
+ forwarder.onIncomingData(*data1, FaceEndpoint(*face1, 0));
BOOST_CHECK_EQUAL(isInCs(*data1), T::ShouldAdmitLocal::value);
auto face2 = make_shared<DummyFace>("dummy://", "dummy://",
ndn::nfd::FACE_SCOPE_NON_LOCAL);
faceTable.add(face2);
- shared_ptr<Data> data2 = makeData("/unsolicited-from-non-local");
- forwarder.onIncomingData(FaceEndpoint(*face2, 0), *data2);
+ auto data2 = makeData("/unsolicited-from-non-local");
+ forwarder.onIncomingData(*data2, FaceEndpoint(*face2, 0));
BOOST_CHECK_EQUAL(isInCs(*data2), T::ShouldAdmitNonLocal::value);
}
diff --git a/tests/other/fw/congestion-mark-strategy.cpp b/tests/other/fw/congestion-mark-strategy.cpp
index 71afcbc..d21fc6f 100644
--- a/tests/other/fw/congestion-mark-strategy.cpp
+++ b/tests/other/fw/congestion-mark-strategy.cpp
@@ -77,17 +77,17 @@
}
void
-CongestionMarkStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+CongestionMarkStrategy::afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry)
{
auto mark = interest.getCongestionMark();
if (mark != m_congestionMark && (!m_shouldPreserveMark || mark == 0)) {
Interest markedInterest(interest);
markedInterest.setCongestionMark(m_congestionMark);
- BestRouteStrategy::afterReceiveInterest(ingress, markedInterest, pitEntry);
+ BestRouteStrategy::afterReceiveInterest(markedInterest, ingress, pitEntry);
}
else {
- BestRouteStrategy::afterReceiveInterest(ingress, interest, pitEntry);
+ BestRouteStrategy::afterReceiveInterest(interest, ingress, pitEntry);
}
}
diff --git a/tests/other/fw/congestion-mark-strategy.hpp b/tests/other/fw/congestion-mark-strategy.hpp
index 57c1bbe..9b0f982 100644
--- a/tests/other/fw/congestion-mark-strategy.hpp
+++ b/tests/other/fw/congestion-mark-strategy.hpp
@@ -50,7 +50,7 @@
getStrategyName();
void
- afterReceiveInterest(const FaceEndpoint& ingress, const Interest& interest,
+ afterReceiveInterest(const Interest& interest, const FaceEndpoint& ingress,
const shared_ptr<pit::Entry>& pitEntry) override;
private: