core: drop std::function and ndn::Exclude from common.hpp, add ndn::optional

Change-Id: Ie3983d8b6f9929430efd8ada8d942e3f95755cd4
diff --git a/tests/daemon/face/factory-test-common.hpp b/tests/daemon/face/factory-test-common.hpp
index 15b3621..7b7bdf6 100644
--- a/tests/daemon/face/factory-test-common.hpp
+++ b/tests/daemon/face/factory-test-common.hpp
@@ -37,8 +37,8 @@
 struct TestFaceParams : public FaceParams
 {
   TestFaceParams(ndn::nfd::FacePersistency persistency,
-                 ndn::optional<time::nanoseconds> baseCongestionMarkingInterval,
-                 ndn::optional<uint64_t> defaultCongestionThreshold,
+                 optional<time::nanoseconds> baseCongestionMarkingInterval,
+                 optional<uint64_t> defaultCongestionThreshold,
                  bool wantLocalFields,
                  bool wantLpReliability,
                  boost::logic::tribool wantCongestionMarking) noexcept
@@ -62,7 +62,7 @@
 inline void
 createFace(ProtocolFactory& factory,
            const FaceUri& remoteUri,
-           const ndn::optional<FaceUri>& localUri,
+           const optional<FaceUri>& localUri,
            const TestFaceParams& params,
            const CreateFaceExpectedResult& expected,
            const std::function<void(const Face&)>& extraChecks = nullptr)
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index 3ebe7f1..2337e07 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -100,7 +100,7 @@
   scheduler::EventId retxFrom4Evt;
   size_t nSentLast = strategy.sendInterestHistory.size();
   time::steady_clock::TimePoint timeSentLast = time::steady_clock::now();
-  function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
+  std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
   periodicalRetxFrom4 = [&] {
     pitEntry->insertOrUpdateInRecord(*face4, *interest);
     strategy.afterReceiveInterest(*face4, *interest, pitEntry);
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index a5118d8..82a93ea 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -190,7 +190,7 @@
 
 protected:
   void
-  dispatchToStrategy(pit::Entry& pitEntry, function<void(fw::Strategy&)> trigger) override
+  dispatchToStrategy(pit::Entry&, std::function<void(fw::Strategy&)>) override
   {
     ++dispatchToStrategy_count;
   }
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index 07e854c..d57f801 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017,  Regents of the University of California,
+/*
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -99,7 +99,7 @@
   scheduler::EventId retxFrom4Evt;
   size_t nSentLast = strategy.sendInterestHistory.size();
   time::steady_clock::TimePoint timeSentLast = time::steady_clock::now();
-  function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
+  std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
   periodicalRetxFrom4 = [&] {
     pitEntry->insertOrUpdateInRecord(*face3, *interest);
     strategy.afterReceiveInterest(*face3, *interest, pitEntry);
diff --git a/tests/daemon/mgmt/command-authenticator.t.cpp b/tests/daemon/mgmt/command-authenticator.t.cpp
index ce4ab53..5f55451 100644
--- a/tests/daemon/mgmt/command-authenticator.t.cpp
+++ b/tests/daemon/mgmt/command-authenticator.t.cpp
@@ -60,7 +60,7 @@
 
   bool
   authorize(const std::string& module, const Name& identity,
-            const function<void(Interest&)>& modifyInterest = nullptr)
+            const std::function<void(Interest&)>& modifyInterest = nullptr)
   {
     Interest interest = this->makeControlCommandRequest(Name("/prefix/" + module + "/verb"),
                                                         ControlParameters(), identity);
@@ -262,7 +262,7 @@
   }
 
   bool
-  authorize1(const function<void(Interest&)>& modifyInterest)
+  authorize1(const std::function<void(Interest&)>& modifyInterest)
   {
     return authorize("module1", id1, modifyInterest);
   }
diff --git a/tests/daemon/mgmt/face-manager-update-face.t.cpp b/tests/daemon/mgmt/face-manager-update-face.t.cpp
index 904b550..15bf6dd 100644
--- a/tests/daemon/mgmt/face-manager-update-face.t.cpp
+++ b/tests/daemon/mgmt/face-manager-update-face.t.cpp
@@ -53,8 +53,8 @@
   void
   createFace(const std::string& uri = "tcp4://127.0.0.1:26363",
              ndn::nfd::FacePersistency persistency = ndn::nfd::FACE_PERSISTENCY_PERSISTENT,
-             ndn::optional<time::nanoseconds> baseCongestionMarkingInterval = {},
-             ndn::optional<uint64_t> defaultCongestionThreshold = {},
+             optional<time::nanoseconds> baseCongestionMarkingInterval = {},
+             optional<uint64_t> defaultCongestionThreshold = {},
              bool enableLocalFields = false,
              bool enableReliability = false,
              boost::logic::tribool enableCongestionMarking = boost::logic::indeterminate)
@@ -127,7 +127,7 @@
   void
   updateFace(const ControlParameters& requestParams,
              bool isSelfUpdating,
-             const function<void(const ControlResponse& resp)>& checkResp)
+             const std::function<void(const ControlResponse& resp)>& checkResp)
   {
     Interest req = makeControlCommandRequest("/localhost/nfd/faces/update", requestParams);
     if (isSelfUpdating) {
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 428b15b..e2986bc 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -35,8 +35,6 @@
 namespace nfd {
 namespace tests {
 
-using ndn::nullopt;
-
 class FibManagerFixture : public NfdManagerCommonFixture
 {
 public:
@@ -98,9 +96,9 @@
    */
   CheckNextHopResult
   checkNextHop(const Name& prefix,
-               ndn::optional<size_t> expectedNNextHops = nullopt,
-               ndn::optional<FaceId> faceId = nullopt,
-               ndn::optional<uint64_t> expectedCost = nullopt) const
+               optional<size_t> expectedNNextHops = nullopt,
+               optional<FaceId> faceId = nullopt,
+               optional<uint64_t> expectedCost = nullopt) const
   {
     const fib::Entry* entry = m_fib.findExactMatch(prefix);
     if (entry == nullptr) {
diff --git a/tests/daemon/table/cs.t.cpp b/tests/daemon/table/cs.t.cpp
index 66b7e95..a8363de 100644
--- a/tests/daemon/table/cs.t.cpp
+++ b/tests/daemon/table/cs.t.cpp
@@ -28,6 +28,8 @@
 #include "tests/test-common.hpp"
 
 #include <cstring>
+
+#include <ndn-cxx/exclude.hpp>
 #include <ndn-cxx/lp/tags.hpp>
 #include <ndn-cxx/util/sha256.hpp>
 
@@ -92,7 +94,7 @@
   size_t
   erase(const Name& prefix, size_t limit)
   {
-    ndn::optional<size_t> nErased;
+    optional<size_t> nErased;
     m_cs.erase(prefix, limit, [&] (size_t nErased1) { nErased = nErased1; });
 
     // current Cs::erase implementation is synchronous
@@ -331,7 +333,7 @@
   uint8_t digestFF[ndn::util::Sha256::DIGEST_SIZE];
   std::fill_n(digestFF, sizeof(digestFF), 0xFF);
 
-  Exclude excludeDigest;
+  ndn::Exclude excludeDigest;
   excludeDigest.excludeRange(
     name::Component::fromImplicitSha256Digest(digest00, sizeof(digest00)),
     name::Component::fromImplicitSha256Digest(digestFF, sizeof(digestFF)));
@@ -346,7 +348,7 @@
     .setExclude(excludeDigest);
   CHECK_CS_FIND(3);
 
-  Exclude excludeGeneric;
+  ndn::Exclude excludeGeneric;
   excludeGeneric.excludeAfter(name::Component(static_cast<uint8_t*>(nullptr), 0));
 
   startInterest("/A")
@@ -359,7 +361,7 @@
     .setExclude(excludeGeneric);
   find([] (uint32_t found) { BOOST_CHECK(found == 1 || found == 2); });
 
-  Exclude exclude2 = excludeGeneric;
+  ndn::Exclude exclude2 = excludeGeneric;
   exclude2.excludeOne(n2.get(-1));
 
   startInterest("/A")
diff --git a/tests/daemon/table/pit.t.cpp b/tests/daemon/table/pit.t.cpp
index c883ff4..511f2aa 100644
--- a/tests/daemon/table/pit.t.cpp
+++ b/tests/daemon/table/pit.t.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2017,  Regents of the University of California,
+ * Copyright (c) 2014-2018,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -24,10 +24,12 @@
  */
 
 #include "table/pit.hpp"
-#include "tests/daemon/face/dummy-face.hpp"
 
+#include "tests/daemon/face/dummy-face.hpp"
 #include "tests/test-common.hpp"
 
+#include <ndn-cxx/exclude.hpp>
+
 namespace nfd {
 namespace pit {
 namespace tests {
@@ -60,9 +62,9 @@
 {
   Name name1("ndn:/5vzBNnMst");
   Name name2("ndn:/igSGfEIM62");
-  Exclude exclude1;
+  ndn::Exclude exclude1;
   exclude1.excludeOne(Name::Component("u26p47oep"));
-  Exclude exclude2;
+  ndn::Exclude exclude2;
   exclude2.excludeBefore(Name::Component("u26p47oep"));
   ndn::KeyLocator keyLocator1("ndn:/sGAE3peMHA");
   ndn::KeyLocator keyLocator2("ndn:/nIJH6pr4");