fw: remove EndpointId from egress APIs
This commit partially reverts c70794810592a90847656a97caf27f0326668240
refs: #4849, #4973
Change-Id: I1063e5de2c0e3c90971c4ae006ce46de386c2ed0
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 55a9062..bd4d692 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -68,7 +68,7 @@
});
face.onDroppedInterest.connect(
[this, &face] (const Interest& interest) {
- this->onDroppedInterest(FaceEndpoint(face, 0), interest);
+ this->onDroppedInterest(face, interest);
});
});
@@ -206,7 +206,7 @@
<< " nexthop-faceid=" << nextHopFace->getId());
// go to outgoing Interest pipeline
// scope control is unnecessary, because privileged app explicitly wants to forward
- this->onOutgoingInterest(pitEntry, FaceEndpoint(*nextHopFace, 0), interest);
+ this->onOutgoingInterest(pitEntry, *nextHopFace, interest);
}
return;
}
@@ -242,23 +242,23 @@
void
Forwarder::onOutgoingInterest(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& egress, const Interest& interest)
+ Face& egress, const Interest& interest)
{
// drop if HopLimit == 0 but sending on non-local face
- if (interest.getHopLimit() == 0 && egress.face.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL) {
- NFD_LOG_DEBUG("onOutgoingInterest out=" << egress << " interest=" << pitEntry->getName()
+ 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.face.getCounters().nOutHopLimitZero);
+ ++const_cast<PacketCounter&>(egress.getCounters().nOutHopLimitZero);
return;
}
- NFD_LOG_DEBUG("onOutgoingInterest out=" << egress << " interest=" << pitEntry->getName());
+ NFD_LOG_DEBUG("onOutgoingInterest out=" << egress.getId() << " interest=" << pitEntry->getName());
// insert out-record
- pitEntry->insertOrUpdateOutRecord(egress.face, interest);
+ pitEntry->insertOrUpdateOutRecord(egress, interest);
// send Interest
- egress.face.sendInterest(interest);
+ egress.sendInterest(interest);
++m_counters.nOutInterests;
}
@@ -329,7 +329,7 @@
pitEntry->isSatisfied = true;
pitEntry->dataFreshnessPeriod = data.getFreshnessPeriod();
- // Dead Nonce List insert if necessary (for out-record of inFace)
+ // Dead Nonce List insert if necessary (for out-record of ingress face)
this->insertDeadNonceList(*pitEntry, &ingress.face);
// delete PIT entry's out-record
@@ -338,7 +338,7 @@
// when more than one PIT entry is matched, trigger strategy: before satisfy Interest,
// and send Data to all matched out faces
else {
- std::set<std::pair<Face*, EndpointId>> pendingDownstreams;
+ std::set<Face*> pendingDownstreams;
auto now = time::steady_clock::now();
for (const auto& pitEntry : pitMatches) {
@@ -347,7 +347,7 @@
// remember pending downstreams
for (const pit::InRecord& inRecord : pitEntry->getInRecords()) {
if (inRecord.getExpiry() > now) {
- pendingDownstreams.emplace(&inRecord.getFace(), 0);
+ pendingDownstreams.insert(&inRecord.getFace());
}
}
@@ -362,7 +362,7 @@
pitEntry->isSatisfied = true;
pitEntry->dataFreshnessPeriod = data.getFreshnessPeriod();
- // Dead Nonce List insert if necessary (for out-record of inFace)
+ // Dead Nonce List insert if necessary (for out-record of ingress face)
this->insertDeadNonceList(*pitEntry, &ingress.face);
// clear PIT entry's in and out records
@@ -372,13 +372,12 @@
// foreach pending downstream
for (const auto& pendingDownstream : pendingDownstreams) {
- if (pendingDownstream.first->getId() == ingress.face.getId() &&
- pendingDownstream.second == ingress.endpoint &&
- pendingDownstream.first->getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
+ if (pendingDownstream->getId() == ingress.face.getId() &&
+ pendingDownstream->getLinkType() != ndn::nfd::LINK_TYPE_AD_HOC) {
continue;
}
// goto outgoing Data pipeline
- this->onOutgoingData(data, FaceEndpoint(*pendingDownstream.first, pendingDownstream.second));
+ this->onOutgoingData(data, *pendingDownstream);
}
}
}
@@ -393,24 +392,26 @@
m_cs.insert(data, true);
}
- NFD_LOG_DEBUG("onDataUnsolicited in=" << ingress << " data=" << data.getName() << " decision=" << decision);
+ NFD_LOG_DEBUG("onDataUnsolicited in=" << ingress << " data=" << data.getName()
+ << " decision=" << decision);
++m_counters.nUnsolicitedData;
}
void
-Forwarder::onOutgoingData(const Data& data, const FaceEndpoint& egress)
+Forwarder::onOutgoingData(const Data& data, Face& egress)
{
- if (egress.face.getId() == face::INVALID_FACEID) {
+ if (egress.getId() == face::INVALID_FACEID) {
NFD_LOG_WARN("onOutgoingData out=(invalid) data=" << data.getName());
return;
}
- NFD_LOG_DEBUG("onOutgoingData out=" << egress << " data=" << data.getName());
+ NFD_LOG_DEBUG("onOutgoingData out=" << egress.getId() << " data=" << data.getName());
// /localhost scope control
- bool isViolatingLocalhost = egress.face.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
+ bool isViolatingLocalhost = egress.getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL &&
scope_prefix::LOCALHOST.isPrefixOf(data.getName());
if (isViolatingLocalhost) {
- NFD_LOG_DEBUG("onOutgoingData out=" << egress << " data=" << data.getName() << " violates /localhost");
+ NFD_LOG_DEBUG("onOutgoingData out=" << egress.getId() << " data=" << data.getName()
+ << " violates /localhost");
// (drop)
return;
}
@@ -418,7 +419,7 @@
// TODO traffic manager
// send Data
- egress.face.sendData(data);
+ egress.sendData(data);
++m_counters.nOutData;
}
@@ -481,34 +482,34 @@
void
Forwarder::onOutgoingNack(const shared_ptr<pit::Entry>& pitEntry,
- const FaceEndpoint& egress, const lp::NackHeader& nack)
+ Face& egress, const lp::NackHeader& nack)
{
- if (egress.face.getId() == face::INVALID_FACEID) {
+ if (egress.getId() == face::INVALID_FACEID) {
NFD_LOG_WARN("onOutgoingNack out=(invalid)"
<< " nack=" << pitEntry->getInterest().getName() << "~" << nack.getReason());
return;
}
// has in-record?
- auto inRecord = pitEntry->getInRecord(egress.face);
+ auto inRecord = pitEntry->getInRecord(egress);
// if no in-record found, drop
if (inRecord == pitEntry->in_end()) {
- NFD_LOG_DEBUG("onOutgoingNack out=" << egress
+ NFD_LOG_DEBUG("onOutgoingNack out=" << egress.getId()
<< " nack=" << pitEntry->getInterest().getName()
<< "~" << nack.getReason() << " no-in-record");
return;
}
// if multi-access or ad hoc face, drop
- if (egress.face.getLinkType() != ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
- NFD_LOG_DEBUG("onOutgoingNack out=" << egress
+ if (egress.getLinkType() != ndn::nfd::LINK_TYPE_POINT_TO_POINT) {
+ NFD_LOG_DEBUG("onOutgoingNack out=" << egress.getId()
<< " nack=" << pitEntry->getInterest().getName() << "~" << nack.getReason()
- << " link-type=" << egress.face.getLinkType());
+ << " link-type=" << egress.getLinkType());
return;
}
- NFD_LOG_DEBUG("onOutgoingNack out=" << egress
+ NFD_LOG_DEBUG("onOutgoingNack out=" << egress.getId()
<< " nack=" << pitEntry->getInterest().getName()
<< "~" << nack.getReason() << " OK");
@@ -517,15 +518,15 @@
nackPkt.setHeader(nack);
// erase in-record
- pitEntry->deleteInRecord(egress.face);
+ pitEntry->deleteInRecord(egress);
// send Nack on face
- egress.face.sendNack(nackPkt);
+ egress.sendNack(nackPkt);
++m_counters.nOutNacks;
}
void
-Forwarder::onDroppedInterest(const FaceEndpoint& egress, const Interest& interest)
+Forwarder::onDroppedInterest(const Face& egress, const Interest& interest)
{
m_strategyChoice.findEffectiveStrategy(interest.getName()).onDroppedInterest(egress, interest);
}