Adapt patch for the latest version of ndn-cxx

Change-Id: If9e28ba69ef35c4b4d438111fb754630d7adb321
diff --git a/src/forwarder-status.cpp b/src/forwarder-status.cpp
index 5850b36..8b37990 100644
--- a/src/forwarder-status.cpp
+++ b/src/forwarder-status.cpp
@@ -1,6 +1,7 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016, Regents of the University of California,
+ * Copyright (c) 2013-2016, Regents of the University of California.
+ *
  * This file is part of NFD Control Center.  See AUTHORS.md for complete list of NFD
  * authors and contributors.
  *
@@ -14,7 +15,6 @@
  *
  * You should have received a copy of the GNU General Public License along with NFD
  * Control Center, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- * TODO:Add others
  */
 
 #include "forwarder-status.hpp"
@@ -35,8 +35,8 @@
 ForwarderStatusModel::ForwarderStatusModel(QObject* parent/* = 0*/)
   : QAbstractListModel(parent)
 {
-  connect(this, SIGNAL(onDataReceived(ndn::shared_ptr<const ndn::Data>)), this,
-          SLOT(updateStatus(ndn::shared_ptr<const ndn::Data>)),
+  connect(this, SIGNAL(onDataReceived(ndn::nfd::ForwarderStatus)), this,
+          SLOT(updateStatus(ndn::nfd::ForwarderStatus)),
           Qt::QueuedConnection);
 }
 
@@ -89,17 +89,10 @@
 }
 
 void
-ForwarderStatusModel::afterFetchedVersionInformation(const Data& data)
-{
-  emit onDataReceived(data.shared_from_this());
-}
-
-void
-ForwarderStatusModel::updateStatus(shared_ptr<const Data> data)
+ForwarderStatusModel::updateStatus(ndn::nfd::ForwarderStatus status)
 {
   beginResetModel();
   m_items.clear();
-  nfd::ForwarderStatus status(data->getContent());
   addItem(ForwarderStatusItem("Version",       QString::fromStdString(status.getNfdVersion())));
   addItem(ForwarderStatusItem("Start Time",     QString::fromStdString(time::toIsoString(status.getStartTimestamp()))));
   addItem(ForwarderStatusItem("Current Time",   QString::fromStdString(time::toIsoString(status.getCurrentTimestamp()))));
diff --git a/src/forwarder-status.hpp b/src/forwarder-status.hpp
index 90bdf86..ba62d97 100644
--- a/src/forwarder-status.hpp
+++ b/src/forwarder-status.hpp
@@ -24,6 +24,7 @@
 #include <QtCore/QStringList>
 
 #include <ndn-cxx/face.hpp>
+#include <ndn-cxx/mgmt/nfd/forwarder-status.hpp>
 
 namespace ndn {
 
@@ -60,7 +61,7 @@
 
 signals:
   void
-  onDataReceived(ndn::shared_ptr<const ndn::Data>);
+  onDataReceived(ndn::nfd::ForwarderStatus status);
 
 public:
 
@@ -88,15 +89,12 @@
   clear();
 
   void
-  afterFetchedVersionInformation(const Data& data);
-
-  void
   onTimeout(const Interest& interest);
 
 private slots:
 
   void
-  updateStatus(ndn::shared_ptr<const ndn::Data> data);
+  updateStatus(ndn::nfd::ForwarderStatus status);
 
 private:
   QList<ForwarderStatusItem> m_items;
diff --git a/src/main.cpp b/src/main.cpp
index 073a9c3..4c718a1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014, Regents of the University of California,
+ * Copyright (c) 2013-2016, Regents of the University of California,
  *
  * This file is part of NFD Control Center.  See AUTHORS.md for complete list of NFD
  * authors and contributors.
@@ -28,6 +28,9 @@
 
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/util/scheduler.hpp>
+#include <ndn-cxx/mgmt/nfd/controller.hpp>
+#include <ndn-cxx/mgmt/nfd/status-dataset.hpp>
+
 #include <boost/thread.hpp>
 
 namespace ndn {
@@ -37,6 +40,8 @@
 public:
   Ncc()
     : m_isActive(true)
+    , m_face(nullptr, m_keyChain)
+    , m_controller(m_face, m_keyChain)
     , m_scheduler(m_face.getIoService())
     , m_fibModel(m_face)
     , m_tray(m_engine.rootContext(), m_face)
@@ -65,9 +70,8 @@
       while (m_isActive) {
         try {
           while (m_isActive) {
-            m_face.expressInterest(Interest("/localhost/nfd/status"),
-                                   bind(&Ncc::onStatusRetrieved, this, _2),
-                                   bind(&Ncc::onStatusTimeout, this));
+            m_controller.fetch<ndn::nfd::ForwarderGeneralStatusDataset>(bind(&Ncc::onStatusRetrieved, this, _1),
+                                                                        bind(&Ncc::onStatusTimeout, this));
             m_face.processEvents(time::milliseconds::zero(), true);
           }
         }
@@ -88,10 +92,10 @@
   }
 
   void
-  onStatusRetrieved(const Data& data)
+  onStatusRetrieved(const nfd::ForwarderStatus& status)
   {
     emit m_tray.nfdActivityUpdate(true);
-    emit m_forwarderStatusModel.onDataReceived(data.shared_from_this());
+    emit m_forwarderStatusModel.onDataReceived(status);
 
     m_scheduler.scheduleEvent(time::seconds(6), bind(&Ncc::requestNfdStatus, this));
   }
@@ -119,18 +123,17 @@
   void
   requestNfdStatus()
   {
-    Interest interest("/localhost/nfd/status");
-    interest.setMustBeFresh(true);
-    m_face.expressInterest(interest,
-                           bind(&Ncc::onStatusRetrieved, this, _2),
-                           bind(&Ncc::onStatusTimeout, this));
+    m_controller.fetch<ndn::nfd::ForwarderGeneralStatusDataset>(bind(&Ncc::onStatusRetrieved, this, _1),
+                                                       bind(&Ncc::onStatusTimeout, this));
   }
 
 private:
   volatile bool m_isActive;
   boost::thread m_nfdThread;
 
+  KeyChain m_keyChain;
   Face m_face;
+  nfd::Controller m_controller;
   Scheduler m_scheduler;
 
   QQmlApplicationEngine m_engine;
@@ -143,11 +146,13 @@
 } // namespace ndn
 
 Q_DECLARE_METATYPE(ndn::shared_ptr<const ndn::Data>)
+Q_DECLARE_METATYPE(ndn::nfd::ForwarderStatus)
 
 int
 main(int argc, char *argv[])
 {
-  qRegisterMetaType<ndn::shared_ptr<const ndn::Data> >();
+  qRegisterMetaType<ndn::shared_ptr<const ndn::Data>>();
+  qRegisterMetaType<ndn::nfd::ForwarderStatus>();
 
   QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
   QApplication app(argc, argv);
diff --git a/src/tray-menu.cpp b/src/tray-menu.cpp
index 9cc38d7..3d3afe7 100644
--- a/src/tray-menu.cpp
+++ b/src/tray-menu.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2014, Regents of the University of California,
+ * Copyright (c) 2013-2016, Regents of the University of California.
  *
  * This file is part of NFD Control Center.  See AUTHORS.md for complete list of NFD
  * authors and contributors.
@@ -13,7 +13,7 @@
  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  * PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  *
-         * You should have received a copy of the GNU General Public License along with NFD
+ * You should have received a copy of the GNU General Public License along with NFD
  * Control Center, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
@@ -243,7 +243,7 @@
   }
   args.push_back(nullptr);
 
-  char const* helperTool  = "/bin/cp";
+  char const* helperTool  = "/bin/ln";
   AuthorizationExecuteWithPrivileges(authorizationRef,
                                      helperTool,
                                      kAuthorizationFlagDefaults,