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/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index 1bc1701..d773206 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -178,11 +178,6 @@
return;
}
- if (result.face) {
- result.face->setLocalControlHeaderFeature(result.feature, true);
- return done(ControlResponse(200, "OK").setBody(parameters.wireEncode()));
- }
-
// TODO#3226 redesign enable-local-control
// For now, enable-local-control will enable all local fields in GenericLinkService.
BOOST_ASSERT(result.lpFace != nullptr);
@@ -209,11 +204,6 @@
return;
}
- if (result.face) {
- result.face->setLocalControlHeaderFeature(result.feature, false);
- return done(ControlResponse(200, "OK").setBody(parameters.wireEncode()));
- }
-
// TODO#3226 redesign disable-local-control
// For now, disable-local-control will disable all local fields in GenericLinkService.
BOOST_ASSERT(result.lpFace != nullptr);
@@ -239,9 +229,15 @@
result.isValid = false;
result.lpFace = nullptr;
- auto face = m_faceTable.get(request.getIncomingFaceId());
+ shared_ptr<lp::IncomingFaceIdTag> incomingFaceIdTag = request.getTag<lp::IncomingFaceIdTag>();
+ // NDNLPv2 says "application MUST be prepared to receive a packet without IncomingFaceId field",
+ // but it's fine to assert IncomingFaceId is available, because InternalFace lives inside NFD
+ // and is initialized synchronously with IncomingFaceId field enabled.
+ BOOST_ASSERT(incomingFaceIdTag != nullptr);
+
+ auto face = m_faceTable.get(*incomingFaceIdTag);
if (face == nullptr) {
- NFD_LOG_DEBUG("FaceId " << request.getIncomingFaceId() << " not found");
+ NFD_LOG_DEBUG("FaceId " << *incomingFaceIdTag << " not found");
done(ControlResponse(410, "Face not found"));
return result;
}
@@ -253,13 +249,10 @@
}
result.isValid = true;
- result.face = dynamic_pointer_cast<LocalFace>(face);
- if (result.face == nullptr) {
- auto lpFaceW = dynamic_pointer_cast<face::LpFaceWrapper>(face);
- BOOST_ASSERT(lpFaceW != nullptr);
- result.lpFace = lpFaceW->getLpFace();
- }
- result.feature = parameters.getLocalControlFeature();
+ auto lpFaceW = dynamic_pointer_cast<face::LpFaceWrapper>(face);
+ // LocalFace is gone, so a face that is local must be an LpFace.
+ BOOST_ASSERT(lpFaceW != nullptr);
+ result.lpFace = lpFaceW->getLpFace();
return result;
}