core: slim down `common.hpp`

Change-Id: I875c35147edd2261fbaa24e809c170d5cd9b94d3
diff --git a/daemon/common/config-file.cpp b/daemon/common/config-file.cpp
index a71bade..ef1eed0 100644
--- a/daemon/common/config-file.cpp
+++ b/daemon/common/config-file.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2022,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -106,7 +106,7 @@
   }
   catch (const boost::property_tree::info_parser_error& error) {
     NDN_THROW(Error("Failed to parse configuration file " + filename +
-                    ": " + error.message() + " on line " + to_string(error.line())));
+                    ": " + error.message() + " on line " + std::to_string(error.line())));
   }
 
   process(isDryRun, filename);
diff --git a/daemon/common/config-file.hpp b/daemon/common/config-file.hpp
index 06cd70b..7be8306 100644
--- a/daemon/common/config-file.hpp
+++ b/daemon/common/config-file.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -30,6 +30,9 @@
 
 #include <boost/property_tree/ptree.hpp>
 
+#include <functional>
+#include <map>
+
 namespace nfd {
 
 /**
@@ -140,9 +143,9 @@
     static_assert(std::is_integral_v<T>);
 
     if (value < min || value > max) {
-      NDN_THROW(Error("Invalid value '" + to_string(value) + "' for option '" + key +
+      NDN_THROW(Error("Invalid value '" + std::to_string(value) + "' for option '" + key +
                       "' in section '" + sectionName + "': out of acceptable range [" +
-                      to_string(min) + ", " + to_string(max) + "]"));
+                      std::to_string(min) + ", " + std::to_string(max) + "]"));
     }
   }
 
diff --git a/daemon/common/global.cpp b/daemon/common/global.cpp
index a9848cd..7dde3b8 100644
--- a/daemon/common/global.cpp
+++ b/daemon/common/global.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,8 +27,8 @@
 
 namespace nfd {
 
-static thread_local unique_ptr<boost::asio::io_context> g_ioCtx;
-static thread_local unique_ptr<Scheduler> g_scheduler;
+static thread_local std::unique_ptr<boost::asio::io_context> g_ioCtx;
+static thread_local std::unique_ptr<ndn::Scheduler> g_scheduler;
 static boost::asio::io_context* g_mainIoCtx = nullptr;
 static boost::asio::io_context* g_ribIoCtx = nullptr;
 
@@ -36,16 +36,16 @@
 getGlobalIoService()
 {
   if (g_ioCtx == nullptr) {
-    g_ioCtx = make_unique<boost::asio::io_context>();
+    g_ioCtx = std::make_unique<boost::asio::io_context>();
   }
   return *g_ioCtx;
 }
 
-Scheduler&
+ndn::Scheduler&
 getScheduler()
 {
   if (g_scheduler == nullptr) {
-    g_scheduler = make_unique<Scheduler>(getGlobalIoService());
+    g_scheduler = std::make_unique<ndn::Scheduler>(getGlobalIoService());
   }
   return *g_scheduler;
 }
diff --git a/daemon/common/global.hpp b/daemon/common/global.hpp
index 3ee072d..3342df5 100644
--- a/daemon/common/global.hpp
+++ b/daemon/common/global.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023  Regents of the University of California,
+ * Copyright (c) 2014-2024  Regents of the University of California,
  *                          Arizona Board of Regents,
  *                          Colorado State University,
  *                          University Pierre & Marie Curie, Sorbonne University,
@@ -25,9 +25,10 @@
 #ifndef NFD_DAEMON_COMMON_GLOBAL_HPP
 #define NFD_DAEMON_COMMON_GLOBAL_HPP
 
-#include "core/common.hpp"
+#include "core/config.hpp"
 
 #include <boost/asio/io_context.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
 
 namespace nfd {
 
@@ -40,7 +41,7 @@
 /**
  * \brief Returns the global Scheduler instance for the calling thread.
  */
-Scheduler&
+ndn::Scheduler&
 getScheduler();
 
 boost::asio::io_context&
diff --git a/daemon/common/privilege-helper.cpp b/daemon/common/privilege-helper.cpp
index eb8e608..8071f23 100644
--- a/daemon/common/privilege-helper.cpp
+++ b/daemon/common/privilege-helper.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2021,  Regents of the University of California,
+ * Copyright (c) 2014-2024,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -123,11 +123,11 @@
 
   NFD_LOG_TRACE("dropping to effective gid=" << s_normalGid);
   if (::setegid(s_normalGid) != 0)
-    throw Error("Failed to drop to effective gid=" + to_string(s_normalGid));
+    throw Error("Failed to drop to effective gid=" + std::to_string(s_normalGid));
 
   NFD_LOG_TRACE("dropping to effective uid=" << s_normalUid);
   if (::seteuid(s_normalUid) != 0)
-    throw Error("Failed to drop to effective uid=" + to_string(s_normalUid));
+    throw Error("Failed to drop to effective uid=" + std::to_string(s_normalUid));
 
   NFD_LOG_INFO("dropped to effective uid=" << ::geteuid() << " gid=" << ::getegid());
 #else
@@ -144,11 +144,11 @@
 
   NFD_LOG_TRACE("elevating to effective uid=" << s_privilegedUid);
   if (::seteuid(s_privilegedUid) != 0)
-    throw Error("Failed to elevate to effective uid=" + to_string(s_privilegedUid));
+    throw Error("Failed to elevate to effective uid=" + std::to_string(s_privilegedUid));
 
   NFD_LOG_TRACE("elevating to effective gid=" << s_privilegedGid);
   if (::setegid(s_privilegedGid) != 0)
-    throw Error("Failed to elevate to effective gid=" + to_string(s_privilegedGid));
+    throw Error("Failed to elevate to effective gid=" + std::to_string(s_privilegedGid));
 
   NFD_LOG_INFO("elevated to effective uid=" << ::geteuid() << " gid=" << ::getegid());
 #else