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;
}
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index da217b2..8e90a73 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -27,11 +27,12 @@
#define NFD_DAEMON_MGMT_FACE_MANAGER_HPP
#include "manager-base.hpp"
-#include "face/local-face.hpp"
+#include <ndn-cxx/management/nfd-face-status.hpp>
#include <ndn-cxx/management/nfd-face-query-filter.hpp>
namespace nfd {
+class Face;
class FaceTable;
class NetworkInterfaceInfo;
class ProtocolFactory;
@@ -91,9 +92,7 @@
struct ExtractLocalControlParametersResult
{
bool isValid;
- shared_ptr<LocalFace> face;
face::LpFace* lpFace;
- LocalControlFeature feature;
};
ExtractLocalControlParametersResult
diff --git a/daemon/mgmt/fib-manager.cpp b/daemon/mgmt/fib-manager.cpp
index 12374f1..9882033 100644
--- a/daemon/mgmt/fib-manager.cpp
+++ b/daemon/mgmt/fib-manager.cpp
@@ -142,7 +142,12 @@
{
bool isSelfRegistration = (parameters.getFaceId() == 0);
if (isSelfRegistration) {
- parameters.setFaceId(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);
+ parameters.setFaceId(*incomingFaceIdTag);
}
}