Adapt patch for the latest version of ndn-cxx

Change-Id: If9e28ba69ef35c4b4d438111fb754630d7adb321
diff --git a/AUTHORS.md b/AUTHORS.md
index ca686c7..b8436f9 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -1,2 +1,6 @@
-Ilya Moiseenko      <http://ilyamoiseenko.com/>
-Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
+- Ilya Moiseenko      <http://ilyamoiseenko.com/>
+- Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
+- Tai-Lin Chu         <tailinchu@gmail.com>
+- Susmit Shannigrahi  <https://www.linkedin.com/in/susmit-shannigrahi-90433b8>
+- Yingdi Yu           <http://irl.cs.ucla.edu/~yingdi/>
+- Qi Zhao             <http://irl.cs.ucla.edu/~qzhao/>
diff --git a/make-deps.sh b/make-deps.sh
index 6a353e7..f237a6c 100755
--- a/make-deps.sh
+++ b/make-deps.sh
@@ -26,18 +26,18 @@
 
 patch -p1 <<EOF
 diff --git a/src/transport/unix-transport.cpp b/src/transport/unix-transport.cpp
-index 6b86a34..e72170e 100644
+index f2e44aa..268f967 100644
 --- a/src/transport/unix-transport.cpp
 +++ b/src/transport/unix-transport.cpp
-@@ -72,7 +72,7 @@ UnixTransport::getDefaultSocketName(const ConfigFile& config)
-     }
- 
+@@ -40,7 +40,7 @@ std::string
+ UnixTransport::getSocketNameFromUri(const std::string& uriString)
+ {
    // Assume the default nfd.sock location.
--  return "/var/run/nfd.sock";
-+  return "/tmp/nfd.sock";
- }
+-  std::string path = "/var/run/nfd.sock";
++  std::string path = "/tmp/nfd.sock";
  
- shared_ptr<UnixTransport>
+   if (uriString.empty()) {
+     return path;
 EOF
 
 ./waf configure --prefix="${path}/build/deps" \
diff --git a/make-osx-bundle.py b/make-osx-bundle.py
index 300f36e..b7f98d4 100755
--- a/make-osx-bundle.py
+++ b/make-osx-bundle.py
@@ -144,7 +144,7 @@
       macho = os.path.abspath(macho)
 
     print "Processing [%s]" % macho
-      
+
     libs = self.get_binary_libs(macho)
 
     for lib in libs:
@@ -198,7 +198,7 @@
           os.chmod(abs, 0755)
           os.system('install_name_tool -id "@executable_path/../Frameworks/%s" "%s"' % (rel, abs))
           self.handled_libs[basename] = True
-          self.handle_binary_libs(abs, loader_path=os.path.dirname(lib) if loader_path is None else loader_path)
+          self.handle_binary_libs(abs, loader_path=os.path.dirname(lib))
 
         # print 'install_name_tool -change "%s" "@executable_path/../Frameworks/%s" "%s"' % (lib, rel, macho)
         os.chmod(macho, 0755)
@@ -241,7 +241,7 @@
         shutil.copy(rsrc, os.path.join(rsrcpath, b))
 
     return
-  
+
   def copy_framework(self, framework):
     '''
       Copy frameworks
@@ -251,45 +251,9 @@
 
     shutil.copytree(framework, rsrcpath, symlinks = True)
 
-  # def copy_qt_plugins(self):
-  #   '''
-  #     Copy over any needed Qt plugins.
-  #   '''
-
-  #   print ' * Copying Qt and preparing plugins'
-
-  #   src = os.popen('qmake -query QT_INSTALL_PLUGINS').read().strip()
-  #   dst = os.path.join(self.bundle, 'Contents', 'QtPlugins')
-  #   shutil.copytree(src, dst, symlinks=False)
-
-  #   top = dst
-  #   files = {}
-
-  #   def cb(arg, dirname, fnames):
-  #     if dirname == top:
-  #       return
-  #     files[os.path.basename(dirname)] = fnames
-
-  #   os.path.walk(top, cb, None)
-
-  #   exclude = ( 'phonon_backend', 'designer', 'script' )
-
-  #   for dir, files in files.items():
-  #     absdir = dst + '/' + dir
-  #     if dir in exclude:
-  #       shutil.rmtree(absdir)
-  #       continue
-  #     for file in files:
-  #       abs = absdir + '/' + file
-  #       if file.endswith('_debug.dylib'):
-  #         os.remove(abs)
-  #       else:
-  #         os.system('install_name_tool -id "%s" "%s"' % (file, abs))
-  #         self.handle_binary_libs(abs)
-
   def macdeployqt(self):
     Popen(['macdeployqt', self.bundle, '-qmldir=src', '-executable=%s' % self.binary]).communicate()
-  
+
   def copy_ndn_deps(self, path):
     '''
       Copy over NDN dependencies (NFD and related apps)
@@ -304,43 +268,6 @@
       for file in files:
         abs = subdir + "/" + file
         self.handle_binary_libs(abs)
-    
-    # top = dst
-    # files = {}
-
-    # def cb(arg, dirname, fnames):
-    #   if dirname == top:
-    #     return
-    #   files[dirname] = fnames
-
-    # os.path.walk(top, cb, None)
-
-    # # Cleanup debug folders stuff
-    # excludeDirs = ['include', 'pkgconfig', 'lib'] # lib already processed
-    # excludeFiles = ['libndn-cxx.dylib', 'nfd-start', 'nfd-stop']
-
-    # for dir, files in files.items():
-    #   basename = os.path.basename(dir)
-    #   if basename in excludeDirs:
-    #     shutil.rmtree(dir)
-    #     continue
-    #   for file in files:
-    #     if file in excludeFiles:
-    #       abs = dir + '/' + file
-    #       os.remove(abs)
-      
-    # top = dst
-    # files = {}
-
-    # os.path.walk(top, cb, None)
-    
-    # for dir, files in files.items():
-    #   for file in files:
-    #     abs = dir + '/' + file
-    #     type = Popen(['file', '-b', abs], stdout=PIPE).communicate()[0].strip()
-    #     if type.startswith('Mach-O'):
-    #       self.handle_binary_libs(abs)
-    
 
   def set_min_macosx_version(self, version):
     '''
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,