tools: delete nfdId from 'nfdc status' output
refs #4089
Change-Id: I95f8a4346b2c4601acdc63daac20259b076a1d7e
diff --git a/tools/nfdc/forwarder-general-module.cpp b/tools/nfdc/forwarder-general-module.cpp
index ee3e0af..e490892 100644
--- a/tools/nfdc/forwarder-general-module.cpp
+++ b/tools/nfdc/forwarder-general-module.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,
@@ -30,11 +30,6 @@
namespace tools {
namespace nfdc {
-ForwarderGeneralModule::ForwarderGeneralModule()
- : m_nfdIdCollector(nullptr)
-{
-}
-
void
ForwarderGeneralModule::fetchStatus(Controller& controller,
const function<void()>& onSuccess,
@@ -55,30 +50,17 @@
return status.getCurrentTimestamp() - status.getStartTimestamp();
}
-const Name&
-ForwarderGeneralModule::getNfdId() const
-{
- if (m_nfdIdCollector != nullptr && m_nfdIdCollector->hasNfdId()) {
- return m_nfdIdCollector->getNfdId();
- }
-
- static Name unavailable("/nfdId-unavailable");
- return unavailable;
-}
-
void
ForwarderGeneralModule::formatStatusXml(std::ostream& os) const
{
- this->formatItemXml(os, m_status, this->getNfdId());
+ this->formatItemXml(os, m_status);
}
void
-ForwarderGeneralModule::formatItemXml(std::ostream& os, const ForwarderStatus& item,
- const Name& nfdId) const
+ForwarderGeneralModule::formatItemXml(std::ostream& os, const ForwarderStatus& item) const
{
os << "<generalStatus>";
- os << "<nfdId>" << nfdId << "</nfdId>";
os << "<version>" << xml::Text{item.getNfdVersion()} << "</version>";
os << "<startTime>" << xml::formatTimestamp(item.getStartTimestamp()) << "</startTime>";
os << "<currentTime>" << xml::formatTimestamp(item.getCurrentTimestamp()) << "</currentTime>";
@@ -110,14 +92,12 @@
ForwarderGeneralModule::formatStatusText(std::ostream& os) const
{
os << "General NFD status:\n";
- this->formatItemText(os, m_status, this->getNfdId());
+ this->formatItemText(os, m_status);
}
void
-ForwarderGeneralModule::formatItemText(std::ostream& os, const ForwarderStatus& item,
- const Name& nfdId) const
+ForwarderGeneralModule::formatItemText(std::ostream& os, const ForwarderStatus& item) const
{
- os << " nfdId=" << nfdId << "\n";
os << " version=" << item.getNfdVersion() << "\n";
os << " startTime=" << text::formatTimestamp(item.getStartTimestamp()) << "\n";
os << " currentTime=" << text::formatTimestamp(item.getCurrentTimestamp()) << "\n";
@@ -137,54 +117,6 @@
os << " nOutNacks=" << item.getNOutNacks() << "\n";
}
-NfdIdCollector::NfdIdCollector(unique_ptr<ndn::Validator> inner)
- : m_inner(std::move(inner))
- , m_hasNfdId(false)
-{
- BOOST_ASSERT(m_inner != nullptr);
-}
-
-const Name&
-NfdIdCollector::getNfdId() const
-{
- if (!m_hasNfdId) {
- BOOST_THROW_EXCEPTION(std::runtime_error("NfdId is unavailable"));
- }
-
- return m_nfdId;
-}
-
-void
-NfdIdCollector::checkPolicy(const Data& data, int nSteps,
- const ndn::OnDataValidated& accept,
- const ndn::OnDataValidationFailed& reject,
- std::vector<shared_ptr<ndn::ValidationRequest>>& nextSteps)
-{
- ndn::OnDataValidated accepted = [this, accept] (const shared_ptr<const Data>& data) {
- accept(data); // pass the Data to Validator user's validated callback
-
- if (m_hasNfdId) {
- return;
- }
-
- const ndn::Signature& sig = data->getSignature();
- if (!sig.hasKeyLocator()) {
- return;
- }
-
- const ndn::KeyLocator& kl = sig.getKeyLocator();
- if (kl.getType() != ndn::KeyLocator::KeyLocator_Name) {
- return;
- }
-
- m_nfdId = kl.getName();
- m_hasNfdId = true;
- };
-
- BOOST_ASSERT(nSteps == 0);
- m_inner->validate(data, accepted, reject);
-}
-
} // namespace nfdc
} // namespace tools
} // namespace nfd