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/rib/rib-manager.cpp b/rib/rib-manager.cpp
index 33d1622..03faf21 100644
--- a/rib/rib-manager.cpp
+++ b/rib/rib-manager.cpp
@@ -280,7 +280,13 @@
bool isSelfRegistration = (!parameters.hasFaceId() || parameters.getFaceId() == 0);
if (isSelfRegistration) {
- parameters.setFaceId(request->getIncomingFaceId());
+ shared_ptr<lp::IncomingFaceIdTag> incomingFaceIdTag = request->getTag<lp::IncomingFaceIdTag>();
+ if (incomingFaceIdTag == nullptr) {
+ sendResponse(request->getName(), 503,
+ "requested self-registration, but IncomingFaceId is unavailable");
+ return;
+ }
+ parameters.setFaceId(*incomingFaceIdTag);
}
// Respond since command is valid and authorized
@@ -358,7 +364,13 @@
bool isSelfRegistration = (!parameters.hasFaceId() || parameters.getFaceId() == 0);
if (isSelfRegistration) {
- parameters.setFaceId(request->getIncomingFaceId());
+ shared_ptr<lp::IncomingFaceIdTag> incomingFaceIdTag = request->getTag<lp::IncomingFaceIdTag>();
+ if (incomingFaceIdTag == nullptr) {
+ sendResponse(request->getName(), 503,
+ "requested self-registration, but IncomingFaceId is unavailable");
+ return;
+ }
+ parameters.setFaceId(*incomingFaceIdTag);
}
// Respond since command is valid and authorized
diff --git a/rib/route.hpp b/rib/route.hpp
index d6a8b6e..9e0935a 100644
--- a/rib/route.hpp
+++ b/rib/route.hpp
@@ -28,6 +28,7 @@
#include "common.hpp"
#include "core/scheduler.hpp"
+#include <ndn-cxx/encoding/nfd-constants.hpp>
namespace nfd {
namespace rib {