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/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) {