tools: switch to v2::Validator in nfdc
"nfdid" field in 'nfdc status show' command is temporarily unavailable
because NfdIdCollector relies on v1 Validator. It will be re-implemented
in a future commit.
refs #4089
Change-Id: I21feae43055a17438d8bd3c0439ae4e0a2d5d14c
diff --git a/tools/nfdc/face-id-fetcher.cpp b/tools/nfdc/face-id-fetcher.cpp
index 458b9bb..f0bf841 100644
--- a/tools/nfdc/face-id-fetcher.cpp
+++ b/tools/nfdc/face-id-fetcher.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,6 +30,7 @@
#include <ndn-cxx/mgmt/nfd/face-query-filter.hpp>
#include <ndn-cxx/mgmt/nfd/face-status.hpp>
+#include <ndn-cxx/security/validator-null.hpp>
#include <ndn-cxx/util/segment-fetcher.hpp>
namespace nfd {
@@ -114,7 +115,7 @@
auto interest = std::make_shared<ndn::Interest>(interestPacket);
ndn::util::SegmentFetcher::fetch(
- m_face, *interest, m_validator,
+ m_face, *interest, ndn::security::v2::getAcceptAllValidator(),
bind(&FaceIdFetcher::onQuerySuccess, this, _1, canonicalUri),
bind(&FaceIdFetcher::onQueryFailure, this, _1, canonicalUri));
}
diff --git a/tools/nfdc/face-id-fetcher.hpp b/tools/nfdc/face-id-fetcher.hpp
index 7c9a40f..5e45b7b 100644
--- a/tools/nfdc/face-id-fetcher.hpp
+++ b/tools/nfdc/face-id-fetcher.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -29,7 +29,6 @@
#include "core/common.hpp"
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/mgmt/nfd/controller.hpp>
-#include <ndn-cxx/security/validator-null.hpp>
namespace nfd {
namespace tools {
@@ -100,7 +99,6 @@
bool m_allowCreate;
SuccessCallback m_onSucceed;
FailureCallback m_onFail;
- ndn::ValidatorNull m_validator;
};
} // namespace nfdc
diff --git a/tools/nfdc/forwarder-general-module.hpp b/tools/nfdc/forwarder-general-module.hpp
index f8c30d8..9fc6a68 100644
--- a/tools/nfdc/forwarder-general-module.hpp
+++ b/tools/nfdc/forwarder-general-module.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -45,7 +45,7 @@
public:
ForwarderGeneralModule();
- virtual void
+ void
fetchStatus(Controller& controller,
const function<void()>& onSuccess,
const Controller::DatasetFailCallback& onFailure,
@@ -57,7 +57,7 @@
m_nfdIdCollector = &nfdIdCollector;
}
- virtual void
+ void
formatStatusXml(std::ostream& os) const override;
/** \brief format a single status item as XML
@@ -68,7 +68,7 @@
void
formatItemXml(std::ostream& os, const ForwarderStatus& item, const Name& nfdId) const;
- virtual void
+ void
formatStatusText(std::ostream& os) const override;
/** \brief format a single status item as text
@@ -94,6 +94,8 @@
* This validator redirects all validation requests to an inner validator.
* For the first Data packet accepted by the inner validator that has a Name in KeyLocator,
* this Name is collected as NFD's signing certificate name.
+ *
+ * \todo #4089 re-implement as v2 ValidationPolicy
*/
class NfdIdCollector : public ndn::Validator
{
@@ -111,7 +113,7 @@
getNfdId() const;
protected:
- virtual void
+ void
checkPolicy(const Interest& interest, int nSteps,
const ndn::OnInterestValidated& accept,
const ndn::OnInterestValidationFailed& reject,
@@ -121,7 +123,7 @@
m_inner->validate(interest, accept, reject);
}
- virtual void
+ void
checkPolicy(const Data& data, int nSteps,
const ndn::OnDataValidated& accept,
const ndn::OnDataValidationFailed& reject,
diff --git a/tools/nfdc/module.hpp b/tools/nfdc/module.hpp
index 553c14f..765e39b 100644
--- a/tools/nfdc/module.hpp
+++ b/tools/nfdc/module.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2016, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,14 +27,15 @@
#define NFD_TOOLS_NFDC_MODULE_HPP
#include "core/common.hpp"
+#include <ndn-cxx/mgmt/nfd/command-options.hpp>
#include <ndn-cxx/mgmt/nfd/controller.hpp>
namespace nfd {
namespace tools {
namespace nfdc {
-using ndn::nfd::Controller;
using ndn::nfd::CommandOptions;
+using ndn::nfd::Controller;
/** \brief provides access to an NFD management module
* \note This type is an interface. It should not have member fields.
diff --git a/tools/nfdc/status-report.hpp b/tools/nfdc/status-report.hpp
index 153751a..1658852 100644
--- a/tools/nfdc/status-report.hpp
+++ b/tools/nfdc/status-report.hpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -27,6 +27,9 @@
#define NFD_TOOLS_NFDC_STATUS_REPORT_HPP
#include "module.hpp"
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/security/v2/validator.hpp>
namespace nfd {
namespace tools {
@@ -34,7 +37,7 @@
using ndn::Face;
using ndn::KeyChain;
-using ndn::Validator;
+using ndn::security::v2::Validator;
enum class ReportFormat {
XML = 1,
diff --git a/tools/nfdc/status.cpp b/tools/nfdc/status.cpp
index f87cd8b..529ee82 100644
--- a/tools/nfdc/status.cpp
+++ b/tools/nfdc/status.cpp
@@ -1,5 +1,5 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/*
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
@@ -40,17 +40,17 @@
void
reportStatus(ExecuteContext& ctx, const StatusReportOptions& options)
{
- unique_ptr<Validator> validator = make_unique<ndn::ValidatorNull>();
+ unique_ptr<ndn::security::v2::Validator> validator = make_unique<ndn::security::v2::ValidatorNull>();
CommandOptions ctrlOptions;
StatusReport report;
if (options.wantForwarderGeneral) {
- auto nfdIdCollector = make_unique<NfdIdCollector>(std::move(validator));
+ // auto nfdIdCollector = make_unique<NfdIdCollector>(std::move(validator));
auto forwarderGeneralModule = make_unique<ForwarderGeneralModule>();
- forwarderGeneralModule->setNfdIdCollector(*nfdIdCollector);
+ // forwarderGeneralModule->setNfdIdCollector(*nfdIdCollector);
report.sections.push_back(std::move(forwarderGeneralModule));
- validator = std::move(nfdIdCollector);
+ // validator = std::move(nfdIdCollector);
}
if (options.wantChannels) {