mgmt: publish GeneralStatus dataset

In ForwarderStatusManager, publish ForwarderStatus as a dataset at
/localhost/nfd/status/general.
To maintain backwards compatibility, an Interest to /localhost/nfd/status
also retrieves this dataset.

It's intentional not to update the test suite in this commit,
to illustrate that backwards compatibility is maintained.

refs #3081

Change-Id: I9b636e2e621563185303a7304be402c8221c9863
diff --git a/daemon/mgmt/forwarder-status-manager.cpp b/daemon/mgmt/forwarder-status-manager.cpp
index b614a58..486e621 100644
--- a/daemon/mgmt/forwarder-status-manager.cpp
+++ b/daemon/mgmt/forwarder-status-manager.cpp
@@ -37,12 +37,11 @@
   , m_startTimestamp(time::system_clock::now())
 {
   m_dispatcher.addStatusDataset("status", ndn::mgmt::makeAcceptAllAuthorization(),
-                                bind(&ForwarderStatusManager::listStatus, this, _1, _2, _3));
+                                bind(&ForwarderStatusManager::listGeneralStatus, this, _1, _2, _3));
 }
 
-void
-ForwarderStatusManager::listStatus(const Name& topPrefix, const Interest& interest,
-                                   ndn::mgmt::StatusDatasetContext& context)
+ndn::nfd::ForwarderStatus
+ForwarderStatusManager::collectGeneralStatus()
 {
   ndn::nfd::ForwarderStatus status;
 
@@ -64,8 +63,29 @@
         .setNInNacks(counters.nInNacks)
         .setNOutNacks(counters.nOutNacks);
 
+  return status;
+}
+
+void
+ForwarderStatusManager::listGeneralStatus(const Name& topPrefix, const Interest& interest,
+                                          ndn::mgmt::StatusDatasetContext& context)
+{
+  static const PartialName PREFIX_STATUS("status");
+  static const PartialName PREFIX_STATUS_GENERAL("status/general");
+
+  PartialName subPrefix = interest.getName().getSubName(topPrefix.size());
+  if (subPrefix == PREFIX_STATUS_GENERAL || subPrefix == PREFIX_STATUS) {
+    context.setPrefix(Name(topPrefix).append(PREFIX_STATUS_GENERAL));
+  }
+  else {
+    context.reject(ndn::mgmt::ControlResponse().setCode(404));
+    return;
+  }
+  // TODO#3379 register the dataset at status/general, and delete these conditions
+
   context.setExpiry(STATUS_SERVER_DEFAULT_FRESHNESS);
 
+  auto status = this->collectGeneralStatus();
   status.wireEncode().parse();
   for (const auto& subblock : status.wireEncode().elements()) {
     context.append(subblock);
diff --git a/daemon/mgmt/forwarder-status-manager.hpp b/daemon/mgmt/forwarder-status-manager.hpp
index 57d89c8..44c112b 100644
--- a/daemon/mgmt/forwarder-status-manager.hpp
+++ b/daemon/mgmt/forwarder-status-manager.hpp
@@ -43,9 +43,14 @@
   ForwarderStatusManager(Forwarder& forwarder, Dispatcher& dispatcher);
 
 private:
+  ndn::nfd::ForwarderStatus
+  collectGeneralStatus();
+
+  /** \brief provide general status dataset
+   */
   void
-  listStatus(const Name& topPrefix, const Interest& interest,
-             ndn::mgmt::StatusDatasetContext& context);
+  listGeneralStatus(const Name& topPrefix, const Interest& interest,
+                    ndn::mgmt::StatusDatasetContext& context);
 
 private:
   Forwarder&  m_forwarder;
diff --git a/tools/nfd-status.cpp b/tools/nfd-status.cpp
index 1b16c33..f186c8d 100644
--- a/tools/nfd-status.cpp
+++ b/tools/nfd-status.cpp
@@ -162,7 +162,7 @@
   void
   fetchVersionInformation()
   {
-    Interest interest("/localhost/nfd/status");
+    Interest interest("/localhost/nfd/status/general");
     interest.setChildSelector(1);
     interest.setMustBeFresh(true);
     m_face.expressInterest(