Remove use of deprecated code

Notably, faces/enable-local-control and faces/disable-local-control
management commands are removed in this commit.

Change-Id: I9ba45c9697eca418315c1c749a3c0c602a36f34e
Refs: #3988
diff --git a/core/scheduler.cpp b/core/scheduler.cpp
index 177045f..d0b0f2b 100644
--- a/core/scheduler.cpp
+++ b/core/scheduler.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  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,
@@ -44,7 +44,7 @@
 }
 
 EventId
-schedule(const time::nanoseconds& after, const Scheduler::Event& event)
+schedule(time::nanoseconds after, const EventCallback& event)
 {
   return getGlobalScheduler().scheduleEvent(after, event);
 }
diff --git a/core/scheduler.hpp b/core/scheduler.hpp
index b846c64..199a8e2 100644
--- a/core/scheduler.hpp
+++ b/core/scheduler.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014-2015,  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,
@@ -39,10 +39,12 @@
  */
 using ndn::EventId;
 
+using ndn::util::scheduler::EventCallback;
+
 /** \brief schedule an event
  */
 EventId
-schedule(const time::nanoseconds& after, const Scheduler::Event& event);
+schedule(time::nanoseconds after, const EventCallback& event);
 
 /** \brief cancel a scheduled event
  */
diff --git a/daemon/mgmt/command-authenticator.cpp b/daemon/mgmt/command-authenticator.cpp
index cd45b84..50e4434 100644
--- a/daemon/mgmt/command-authenticator.cpp
+++ b/daemon/mgmt/command-authenticator.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,
@@ -26,7 +26,7 @@
 #include "command-authenticator.hpp"
 #include "core/logger.hpp"
 
-#include <ndn-cxx/security/identity-certificate.hpp>
+#include <ndn-cxx/security/v1/identity-certificate.hpp>
 #include <ndn-cxx/security/validator-null.hpp>
 #include <ndn-cxx/util/io.hpp>
 
@@ -38,6 +38,8 @@
 // INFO: configuration change, etc
 // DEBUG: per authentication request result
 
+using ndn::security::v1::IdentityCertificate;
+
 shared_ptr<CommandAuthenticator>
 CommandAuthenticator::create()
 {
@@ -89,7 +91,7 @@
     }
 
     bool isAny = false;
-    shared_ptr<ndn::IdentityCertificate> cert;
+    shared_ptr<IdentityCertificate> cert;
     if (certfile == "any") {
       isAny = true;
       NFD_LOG_WARN("'certfile any' is intended for demo purposes only and "
@@ -98,7 +100,7 @@
     else {
       using namespace boost::filesystem;
       path certfilePath = absolute(certfile, path(filename).parent_path());
-      cert = ndn::io::load<ndn::IdentityCertificate>(certfilePath.string());
+      cert = ndn::io::load<IdentityCertificate>(certfilePath.string());
       if (cert == nullptr) {
         BOOST_THROW_EXCEPTION(ConfigFile::Error(
           "cannot load certfile " + certfilePath.string() +
@@ -202,13 +204,13 @@
 CommandAuthenticator::extractKeyName(const Interest& interest)
 {
   const Name& name = interest.getName();
-  if (name.size() < ndn::signed_interest::MIN_LENGTH) {
+  if (name.size() < ndn::command_interest::MIN_SIZE) {
     return {false, Name()};
   }
 
   ndn::SignatureInfo sig;
   try {
-    sig.wireDecode(name[ndn::signed_interest::POS_SIG_INFO].blockFromValue());
+    sig.wireDecode(name[ndn::command_interest::POS_SIG_INFO].blockFromValue());
   }
   catch (const tlv::Error&) {
     return {false, Name()};
@@ -224,9 +226,9 @@
   }
 
   try {
-    return {true, ndn::IdentityCertificate::certificateNameToPublicKeyName(keyLocator.getName())};
+    return {true, IdentityCertificate::certificateNameToPublicKeyName(keyLocator.getName())};
   }
-  catch (const ndn::IdentityCertificate::Error&) {
+  catch (const IdentityCertificate::Error&) {
     return {false, Name()};
   }
 }
diff --git a/daemon/mgmt/command-authenticator.hpp b/daemon/mgmt/command-authenticator.hpp
index 69d0ec9..fe2e0b9 100644
--- a/daemon/mgmt/command-authenticator.hpp
+++ b/daemon/mgmt/command-authenticator.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,
@@ -29,7 +29,7 @@
 #include "core/config-file.hpp"
 #include <ndn-cxx/mgmt/dispatcher.hpp>
 #include <ndn-cxx/security/command-interest-validator.hpp>
-#include <ndn-cxx/security/public-key.hpp>
+#include <ndn-cxx/security/v1/public-key.hpp>
 
 namespace nfd {
 
@@ -68,7 +68,7 @@
   struct AuthorizedCerts
   {
     bool allowAny = false;
-    std::unordered_map<Name, ndn::PublicKey> certs; ///< keyName => publicKey
+    std::unordered_map<Name, ndn::security::v1::PublicKey> certs; ///< keyName => publicKey
   };
   std::unordered_map<std::string, AuthorizedCerts> m_moduleAuth; ///< module => certs
 
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index b66a939..9be7c94 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.cpp
@@ -51,12 +51,6 @@
   registerCommandHandler<ndn::nfd::FaceDestroyCommand>("destroy",
     bind(&FaceManager::destroyFace, this, _2, _3, _4, _5));
 
-  registerCommandHandler<ndn::nfd::FaceEnableLocalControlCommand>("enable-local-control",
-    bind(&FaceManager::enableLocalControl, this, _2, _3, _4, _5));
-
-  registerCommandHandler<ndn::nfd::FaceDisableLocalControlCommand>("disable-local-control",
-    bind(&FaceManager::disableLocalControl, this, _2, _3, _4, _5));
-
   // register handlers for StatusDataset
   registerStatusDatasetHandler("list", bind(&FaceManager::listFaces, this, _1, _2, _3));
   registerStatusDatasetHandler("channels", bind(&FaceManager::listChannels, this, _1, _2, _3));
@@ -240,81 +234,6 @@
 }
 
 void
-FaceManager::enableLocalControl(const Name& topPrefix, const Interest& interest,
-                                const ControlParameters& parameters,
-                                const ndn::mgmt::CommandContinuation& done)
-{
-  Face* face = findFaceForLocalControl(interest, parameters, done);
-  if (!face) {
-    return;
-  }
-
-  // enable-local-control will enable all local fields in GenericLinkService
-  auto service = dynamic_cast<face::GenericLinkService*>(face->getLinkService());
-  if (service == nullptr) {
-    return done(ControlResponse(503, "LinkService type not supported"));
-  }
-
-  face::GenericLinkService::Options options = service->getOptions();
-  options.allowLocalFields = true;
-  service->setOptions(options);
-
-  return done(ControlResponse(200, "OK: enable all local fields on GenericLinkService")
-              .setBody(parameters.wireEncode()));
-}
-
-void
-FaceManager::disableLocalControl(const Name& topPrefix, const Interest& interest,
-                                 const ControlParameters& parameters,
-                                 const ndn::mgmt::CommandContinuation& done)
-{
-  Face* face = findFaceForLocalControl(interest, parameters, done);
-  if (!face) {
-    return;
-  }
-
-  // disable-local-control will disable all local fields in GenericLinkService
-  auto service = dynamic_cast<face::GenericLinkService*>(face->getLinkService());
-  if (service == nullptr) {
-    return done(ControlResponse(503, "LinkService type not supported"));
-  }
-
-  face::GenericLinkService::Options options = service->getOptions();
-  options.allowLocalFields = false;
-  service->setOptions(options);
-
-  return done(ControlResponse(200, "OK: disable all local fields on GenericLinkService")
-              .setBody(parameters.wireEncode()));
-}
-
-Face*
-FaceManager::findFaceForLocalControl(const Interest& request,
-                                     const ControlParameters& parameters,
-                                     const ndn::mgmt::CommandContinuation& done)
-{
-  shared_ptr<lp::IncomingFaceIdTag> incomingFaceIdTag = request.getTag<lp::IncomingFaceIdTag>();
-  // NDNLPv2 says "application MUST be prepared to receive a packet without IncomingFaceId field",
-  // but it's fine to assert IncomingFaceId is available, because InternalFace lives inside NFD
-  // and is initialized synchronously with IncomingFaceId field enabled.
-  BOOST_ASSERT(incomingFaceIdTag != nullptr);
-
-  Face* face = m_faceTable.get(*incomingFaceIdTag);
-  if (face == nullptr) {
-    NFD_LOG_DEBUG("FaceId " << *incomingFaceIdTag << " not found");
-    done(ControlResponse(410, "Face not found"));
-    return nullptr;
-  }
-
-  if (face->getScope() == ndn::nfd::FACE_SCOPE_NON_LOCAL) {
-    NFD_LOG_DEBUG("Cannot enable local control on non-local FaceId " << face->getId());
-    done(ControlResponse(412, "Face is non-local"));
-    return nullptr;
-  }
-
-  return face;
-}
-
-void
 FaceManager::setLinkServiceOptions(Face& face,
                                    const ControlParameters& parameters,
                                    ControlParameters& response)
diff --git a/daemon/mgmt/face-manager.hpp b/daemon/mgmt/face-manager.hpp
index b7991b8..77e820c 100644
--- a/daemon/mgmt/face-manager.hpp
+++ b/daemon/mgmt/face-manager.hpp
@@ -36,7 +36,7 @@
 
 /**
  * @brief implement the Face Management of NFD Management Protocol.
- * @sa http://redmine.named-data.net/projects/nfd/wiki/FaceMgmt
+ * @sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt
  */
 class FaceManager : public NfdManagerBase
 {
@@ -66,22 +66,6 @@
               const ControlParameters& parameters,
               const ndn::mgmt::CommandContinuation& done);
 
-  /**
-   * \deprecated use Flags+Mask in faces/update instead
-   */
-  void
-  enableLocalControl(const Name& topPrefix, const Interest& interest,
-                     const ControlParameters& parameters,
-                     const ndn::mgmt::CommandContinuation& done);
-
-  /**
-   * \deprecated use Flags+Mask in faces/update instead
-   */
-  void
-  disableLocalControl(const Name& topPrefix, const Interest& interest,
-                      const ControlParameters& parameters,
-                      const ndn::mgmt::CommandContinuation& done);
-
 PUBLIC_WITH_TESTS_ELSE_PRIVATE: // helpers for ControlCommand
   void
   afterCreateFaceSuccess(const ControlParameters& parameters,
@@ -93,11 +77,6 @@
                          const std::string& reason,
                          const ndn::mgmt::CommandContinuation& done);
 
-  Face*
-  findFaceForLocalControl(const Interest& request,
-                          const ControlParameters& parameters,
-                          const ndn::mgmt::CommandContinuation& done);
-
   static void
   setLinkServiceOptions(Face& face,
                         const ControlParameters& parameters,
diff --git a/rib/auto-prefix-propagator.cpp b/rib/auto-prefix-propagator.cpp
index 29321b4..ae5f563 100644
--- a/rib/auto-prefix-propagator.cpp
+++ b/rib/auto-prefix-propagator.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,
@@ -272,9 +272,9 @@
 {
   NFD_LOG_INFO("advertise " << parameters.getName());
 
-  ndn::Scheduler::Event refreshEvent =
+  scheduler::EventCallback refreshEvent =
     bind(&AutoPrefixPropagator::onRefreshTimer, this, parameters, options);
-  ndn::Scheduler::Event retryEvent =
+  scheduler::EventCallback retryEvent =
     bind(&AutoPrefixPropagator::onRetryTimer, this, parameters, options,
          std::min(m_maxRetryWait, retryWaitTime * 2));
 
@@ -381,7 +381,7 @@
 void
 AutoPrefixPropagator::afterPropagateSucceed(const ControlParameters& parameters,
                                             const CommandOptions& options,
-                                            const ndn::Scheduler::Event& refreshEvent)
+                                            const scheduler::EventCallback& refreshEvent)
 {
   NFD_LOG_TRACE("success to propagate " << parameters.getName());
 
@@ -403,7 +403,7 @@
                                          const ControlParameters& parameters,
                                          const CommandOptions& options,
                                          time::seconds retryWaitTime,
-                                         const ndn::Scheduler::Event& retryEvent)
+                                         const scheduler::EventCallback& retryEvent)
 {
   NFD_LOG_TRACE("fail to propagate " << parameters.getName()
                                      << "\n\t reason:" << response.getText()
diff --git a/rib/auto-prefix-propagator.hpp b/rib/auto-prefix-propagator.hpp
index efc48cb..cbbe362 100644
--- a/rib/auto-prefix-propagator.hpp
+++ b/rib/auto-prefix-propagator.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,
@@ -310,7 +310,7 @@
   void
   afterPropagateSucceed(const ndn::nfd::ControlParameters& parameters,
                         const ndn::nfd::CommandOptions& options,
-                        const ndn::Scheduler::Event& refreshEvent);
+                        const scheduler::EventCallback& refreshEvent);
 
   /**
    * @brief invoked after propagation fails.
@@ -331,7 +331,7 @@
                      const ndn::nfd::ControlParameters& parameters,
                      const ndn::nfd::CommandOptions& options,
                      time::seconds retryWaitTime,
-                     const ndn::Scheduler::Event& retryEvent);
+                     const scheduler::EventCallback& retryEvent);
 
   /**
    * @brief invoked after revocation succeeds
diff --git a/tests/daemon/mgmt/command-authenticator.t.cpp b/tests/daemon/mgmt/command-authenticator.t.cpp
index c12fcfa..35bc117 100644
--- a/tests/daemon/mgmt/command-authenticator.t.cpp
+++ b/tests/daemon/mgmt/command-authenticator.t.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,
@@ -349,7 +349,7 @@
 {
   BOOST_CHECK_EQUAL(authorize1(
     [] (Interest& interest) {
-      setNameComponent(interest, ndn::signed_interest::POS_SIG_VALUE, "bad-signature-bits");
+      setNameComponent(interest, ndn::command_interest::POS_SIG_VALUE, "bad-signature-bits");
     }
   ), false);
   BOOST_CHECK(lastRejectReply == ndn::mgmt::RejectReply::STATUS403);
@@ -360,12 +360,12 @@
   name::Component timestampComp;
   BOOST_CHECK_EQUAL(authorize1(
     [&timestampComp] (const Interest& interest) {
-      timestampComp = interest.getName().at(ndn::signed_interest::POS_TIMESTAMP);
+      timestampComp = interest.getName().at(ndn::command_interest::POS_TIMESTAMP);
     }
   ), true); // accept first command
   BOOST_CHECK_EQUAL(authorize1(
     [&timestampComp] (Interest& interest) {
-      setNameComponent(interest, ndn::signed_interest::POS_TIMESTAMP, timestampComp);
+      setNameComponent(interest, ndn::command_interest::POS_TIMESTAMP, timestampComp);
     }
   ), false); // reject second command because timestamp equals first command
   BOOST_CHECK(lastRejectReply == ndn::mgmt::RejectReply::STATUS403);
diff --git a/tests/identity-management-fixture.cpp b/tests/identity-management-fixture.cpp
index 3bb7252..dbc5ec4 100644
--- a/tests/identity-management-fixture.cpp
+++ b/tests/identity-management-fixture.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,
@@ -24,6 +24,8 @@
  */
 
 #include "identity-management-fixture.hpp"
+#include <ndn-cxx/security/v1/identity-certificate.hpp>
+#include <ndn-cxx/security/v1/sec-public-info.hpp>
 #include <ndn-cxx/util/io.hpp>
 #include <boost/filesystem.hpp>
 
@@ -56,7 +58,7 @@
     m_identities.push_back(identity);
     return true;
   }
-  catch (std::runtime_error&) {
+  catch (const std::runtime_error&) {
     return false;
   }
 }
@@ -64,11 +66,11 @@
 bool
 IdentityManagementFixture::saveIdentityCertificate(const Name& identity, const std::string& filename, bool wantAdd)
 {
-  shared_ptr<ndn::IdentityCertificate> cert;
+  shared_ptr<ndn::security::v1::IdentityCertificate> cert;
   try {
     cert = m_keyChain.getCertificate(m_keyChain.getDefaultCertificateNameForIdentity(identity));
   }
-  catch (const ndn::SecPublicInfo::Error&) {
+  catch (const ndn::security::v1::SecPublicInfo::Error&) {
     if (wantAdd && this->addIdentity(identity)) {
       return this->saveIdentityCertificate(identity, filename, false);
     }