face: use IncomingFaceId, NextHopFaceId, CachePolicy tags
This commit replaces all LocalControlHeader usages with these tags,
and deletes LocalFace.
This commit also does minor improvements in RIB test suites.
refs #3339
Change-Id: I14cbfc296a6723a5860bf8bd95d9804d3bac3da5
diff --git a/daemon/fw/client-control-strategy.cpp b/daemon/fw/client-control-strategy.cpp
index f65cf69..7cc07fd 100644
--- a/daemon/fw/client-control-strategy.cpp
+++ b/daemon/fw/client-control-strategy.cpp
@@ -50,14 +50,13 @@
shared_ptr<fib::Entry> fibEntry,
shared_ptr<pit::Entry> pitEntry)
{
- // Strategy needn't check whether LocalControlHeader-NextHopFaceId is enabled.
- // LocalFace does this check.
- if (!interest.getLocalControlHeader().hasNextHopFaceId()) {
+ shared_ptr<lp::NextHopFaceIdTag> tag = interest.getTag<lp::NextHopFaceIdTag>();
+ if (tag == nullptr) {
this->BestRouteStrategy::afterReceiveInterest(inFace, interest, fibEntry, pitEntry);
return;
}
- FaceId outFaceId = static_cast<FaceId>(interest.getNextHopFaceId());
+ FaceId outFaceId = static_cast<FaceId>(*tag);
shared_ptr<Face> outFace = this->getFace(outFaceId);
if (!static_cast<bool>(outFace)) {
// If outFace doesn't exist, it's better to reject the Interest
diff --git a/daemon/fw/client-control-strategy.hpp b/daemon/fw/client-control-strategy.hpp
index a0ddbf2..85a6e3b 100644
--- a/daemon/fw/client-control-strategy.hpp
+++ b/daemon/fw/client-control-strategy.hpp
@@ -31,8 +31,11 @@
namespace nfd {
namespace fw {
-/** \brief a forwarding strategy that forwards Interests
- * according to NextHopFaceId field in LocalControlHeader
+/** \brief a forwarding strategy controlled by client application
+ *
+ * The consumer may specify the nexthop for an Interest in NDNLPv2 NextHopFaceId field.
+ * If NextHopFaceId field is omitted, the Interest is forwarded to
+ * the FIB nexthop with lowest routing cost.
*/
class ClientControlStrategy : public BestRouteStrategy
{
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index b2dc6bb..e96b87b 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -104,7 +104,7 @@
// receive Interest
NFD_LOG_DEBUG("onIncomingInterest face=" << inFace.getId() <<
" interest=" << interest.getName());
- const_cast<Interest&>(interest).setIncomingFaceId(inFace.getId());
+ interest.setTag(make_shared<lp::IncomingFaceIdTag>(inFace.getId()));
++m_counters.nInInterests;
// /localhost scope control
@@ -244,7 +244,7 @@
{
NFD_LOG_DEBUG("onContentStoreHit interest=" << interest.getName());
- const_pointer_cast<Data>(data.shared_from_this())->setIncomingFaceId(FACEID_CONTENT_STORE);
+ data.setTag(make_shared<lp::IncomingFaceIdTag>(FACEID_CONTENT_STORE));
// XXX should we lookup PIT for other Interests that also match csMatch?
// set PIT straggler timer
@@ -370,7 +370,7 @@
{
// receive Data
NFD_LOG_DEBUG("onIncomingData face=" << inFace.getId() << " data=" << data.getName());
- const_cast<Data&>(data).setIncomingFaceId(inFace.getId());
+ data.setTag(make_shared<lp::IncomingFaceIdTag>(inFace.getId()));
++m_counters.nInData;
// /localhost scope control
@@ -479,6 +479,8 @@
void
Forwarder::onIncomingNack(Face& inFace, const lp::Nack& nack)
{
+ // receive Nack
+ nack.setTag(make_shared<lp::IncomingFaceIdTag>(inFace.getId()));
++m_counters.nInNacks;
// if multi-access face, drop