Refactor and modernize namespace declarations

Move all unit tests to namespace nfd::tests

Delete unused header core/algorithm.hpp

Change-Id: I5591f0c5f3bb5db67f8b45fae95471f8a555ca68
diff --git a/tools/ndn-autoconfig-server/main.cpp b/tools/ndn-autoconfig-server/main.cpp
index c281148..38b4f32 100644
--- a/tools/ndn-autoconfig-server/main.cpp
+++ b/tools/ndn-autoconfig-server/main.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -31,9 +31,7 @@
 
 #include <boost/exception/diagnostic_information.hpp>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig_server {
+namespace ndn::autoconfig_server {
 
 static void
 usage(const char* programName)
@@ -93,12 +91,10 @@
   return 0;
 }
 
-} // namespace autoconfig_server
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig_server
 
 int
 main(int argc, char** argv)
 {
-  return ndn::tools::autoconfig_server::main(argc, argv);
+  return ndn::autoconfig_server::main(argc, argv);
 }
diff --git a/tools/ndn-autoconfig-server/program.cpp b/tools/ndn-autoconfig-server/program.cpp
index 82c1497..542d91a 100644
--- a/tools/ndn-autoconfig-server/program.cpp
+++ b/tools/ndn-autoconfig-server/program.cpp
@@ -31,9 +31,7 @@
 
 #include <iostream>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig_server {
+namespace ndn::autoconfig_server {
 
 const Name HUB_DATA_NAME("/localhop/ndn-autoconf/hub");
 const Name ROUTABLE_PREFIXES_DATA_PREFIX("/localhop/nfd");
@@ -97,6 +95,4 @@
   m_face.shutdown();
 }
 
-} // namespace autoconfig_server
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig_server
diff --git a/tools/ndn-autoconfig-server/program.hpp b/tools/ndn-autoconfig-server/program.hpp
index 39b5bce..03d5e20 100644
--- a/tools/ndn-autoconfig-server/program.hpp
+++ b/tools/ndn-autoconfig-server/program.hpp
@@ -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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,14 +26,12 @@
 #ifndef NFD_TOOLS_NDN_AUTOCONFIG_SERVER_PROGRAM_HPP
 #define NFD_TOOLS_NDN_AUTOCONFIG_SERVER_PROGRAM_HPP
 
-#include "core/common.hpp"
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/mgmt/dispatcher.hpp>
+#include <ndn-cxx/net/face-uri.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig_server {
+namespace ndn::autoconfig_server {
 
 struct Options
 {
@@ -68,8 +66,6 @@
   mgmt::Dispatcher m_dispatcher;
 };
 
-} // namespace autoconfig_server
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig_server
 
 #endif // NFD_TOOLS_NDN_AUTOCONFIG_SERVER_PROGRAM_HPP
diff --git a/tools/ndn-autoconfig/dns-srv.cpp b/tools/ndn-autoconfig/dns-srv.cpp
index 574ef17..bc0b3a6 100644
--- a/tools/ndn-autoconfig/dns-srv.cpp
+++ b/tools/ndn-autoconfig/dns-srv.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -34,13 +34,14 @@
 #include <arpa/nameser_compat.h>
 #endif
 
+#include <ndn-cxx/util/backports.hpp>
+#include <ndn-cxx/util/exception.hpp>
+
 #include <iostream>
 
 #include <boost/endian/conversion.hpp>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 using namespace std::string_literals;
 
@@ -165,6 +166,4 @@
   return parseSrvRr(queryAnswer, answerSize);
 }
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
diff --git a/tools/ndn-autoconfig/dns-srv.hpp b/tools/ndn-autoconfig/dns-srv.hpp
index 41563e9..8d156b1 100644
--- a/tools/ndn-autoconfig/dns-srv.hpp
+++ b/tools/ndn-autoconfig/dns-srv.hpp
@@ -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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,11 +26,10 @@
 #ifndef NFD_TOOLS_NDN_AUTOCONFIG_DNS_SRV_HPP
 #define NFD_TOOLS_NDN_AUTOCONFIG_DNS_SRV_HPP
 
-#include "core/common.hpp"
+#include <stdexcept>
+#include <string>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 /** \file
  *  \brief provide synchronous DNS SRV record querying
@@ -39,14 +38,9 @@
 class DnsSrvError : public std::runtime_error
 {
 public:
-  explicit
-  DnsSrvError(const std::string& what)
-    : std::runtime_error(what)
-  {
-  }
+  using std::runtime_error::runtime_error;
 };
 
-
 /** \brief Send DNS SRV request for \p fqdn
  *  \param fqdn a fully qualified domain name
  *  \return FaceUri of the hub from the requested SRV record
@@ -62,8 +56,6 @@
 std::string
 querySrvRrSearch();
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
 
 #endif // NFD_TOOLS_NDN_AUTOCONFIG_DNS_SRV_HPP
diff --git a/tools/ndn-autoconfig/guess-from-identity-name.cpp b/tools/ndn-autoconfig/guess-from-identity-name.cpp
index 9c50c20..16cf743 100644
--- a/tools/ndn-autoconfig/guess-from-identity-name.cpp
+++ b/tools/ndn-autoconfig/guess-from-identity-name.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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -31,9 +31,7 @@
 
 #include <sstream>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 GuessFromIdentityName::GuessFromIdentityName(KeyChain& keyChain)
   : m_keyChain(keyChain)
@@ -62,6 +60,4 @@
   }
 }
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
diff --git a/tools/ndn-autoconfig/guess-from-identity-name.hpp b/tools/ndn-autoconfig/guess-from-identity-name.hpp
index 9da9093..2901a55 100644
--- a/tools/ndn-autoconfig/guess-from-identity-name.hpp
+++ b/tools/ndn-autoconfig/guess-from-identity-name.hpp
@@ -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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -29,9 +29,7 @@
 #include "stage.hpp"
 #include <ndn-cxx/security/key-chain.hpp>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 /**
  * @brief Guessing home router based on the default identity name
@@ -75,8 +73,6 @@
   KeyChain& m_keyChain;
 };
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
 
 #endif // NFD_TOOLS_NDN_AUTOCONFIG_GUESS_FROM_IDENTITY_NAME_HPP
diff --git a/tools/ndn-autoconfig/guess-from-search-domains.cpp b/tools/ndn-autoconfig/guess-from-search-domains.cpp
index 2f92cc3..8b32867 100644
--- a/tools/ndn-autoconfig/guess-from-search-domains.cpp
+++ b/tools/ndn-autoconfig/guess-from-search-domains.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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,9 +26,7 @@
 #include "guess-from-search-domains.hpp"
 #include "dns-srv.hpp"
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 void
 GuessFromSearchDomains::doStart()
@@ -42,6 +40,4 @@
   }
 }
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
diff --git a/tools/ndn-autoconfig/guess-from-search-domains.hpp b/tools/ndn-autoconfig/guess-from-search-domains.hpp
index 9bd6521..fd02b80 100644
--- a/tools/ndn-autoconfig/guess-from-search-domains.hpp
+++ b/tools/ndn-autoconfig/guess-from-search-domains.hpp
@@ -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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,9 +28,7 @@
 
 #include "stage.hpp"
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 /**
  * @brief Guessing home router based on DNS query with default suffix
@@ -61,8 +59,6 @@
   doStart() override;
 };
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
 
 #endif // NFD_TOOLS_NDN_AUTOCONFIG_GUESS_FROM_SEARCH_DOMAINS_HPP
diff --git a/tools/ndn-autoconfig/main.cpp b/tools/ndn-autoconfig/main.cpp
index afedc38..2f8e561 100644
--- a/tools/ndn-autoconfig/main.cpp
+++ b/tools/ndn-autoconfig/main.cpp
@@ -38,11 +38,7 @@
 #include <ndn-cxx/util/scheduler.hpp>
 #include <ndn-cxx/util/time.hpp>
 
-// ndn-autoconfig is an NDN tool not an NFD tool, so it uses ndn::tools::autoconfig namespace.
-// It lives in NFD repository because nfd-start can automatically start ndn-autoconfig in daemon mode.
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 namespace po = boost::program_options;
 
@@ -184,12 +180,10 @@
   return exitCode;
 }
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
 
 int
 main(int argc, char** argv)
 {
-  return ndn::tools::autoconfig::main(argc, argv);
+  return ndn::autoconfig::main(argc, argv);
 }
diff --git a/tools/ndn-autoconfig/multicast-discovery.cpp b/tools/ndn-autoconfig/multicast-discovery.cpp
index a9fbc88..550ed7f 100644
--- a/tools/ndn-autoconfig/multicast-discovery.cpp
+++ b/tools/ndn-autoconfig/multicast-discovery.cpp
@@ -29,9 +29,7 @@
 
 #include <ndn-cxx/encoding/tlv-nfd.hpp>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 using nfd::ControlParameters;
 
@@ -153,6 +151,4 @@
     });
 }
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
diff --git a/tools/ndn-autoconfig/multicast-discovery.hpp b/tools/ndn-autoconfig/multicast-discovery.hpp
index a1d5884..b2a63ed 100644
--- a/tools/ndn-autoconfig/multicast-discovery.hpp
+++ b/tools/ndn-autoconfig/multicast-discovery.hpp
@@ -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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -31,9 +31,7 @@
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
 #include <ndn-cxx/mgmt/nfd/face-status.hpp>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 /** \brief multicast discovery stage
  *
@@ -87,8 +85,6 @@
   int m_nRegFailure = 0;
 };
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
 
 #endif // NFD_TOOLS_NDN_AUTOCONFIG_MULTICAST_DISCOVERY_HPP
diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.cpp b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
index 879ea8e..c6df1b7 100644
--- a/tools/ndn-autoconfig/ndn-fch-discovery.cpp
+++ b/tools/ndn-autoconfig/ndn-fch-discovery.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -31,9 +31,7 @@
 #include <regex>
 #include <sstream>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 /**
  * A partial and specialized copy of ndn::FaceUri implementation
@@ -210,6 +208,4 @@
   }
 }
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
diff --git a/tools/ndn-autoconfig/ndn-fch-discovery.hpp b/tools/ndn-autoconfig/ndn-fch-discovery.hpp
index 000568d..64d3899 100644
--- a/tools/ndn-autoconfig/ndn-fch-discovery.hpp
+++ b/tools/ndn-autoconfig/ndn-fch-discovery.hpp
@@ -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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,9 +28,7 @@
 
 #include "stage.hpp"
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 /**
  * @brief Discovery NDN hub using NDN-FCH protocol
@@ -61,8 +59,6 @@
   std::string m_url;
 };
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
 
 #endif // NFD_TOOLS_NDN_AUTOCONFIG_NDN_FCH_DISCOVERY_HPP
diff --git a/tools/ndn-autoconfig/procedure.cpp b/tools/ndn-autoconfig/procedure.cpp
index cda39ad..f7295d3 100644
--- a/tools/ndn-autoconfig/procedure.cpp
+++ b/tools/ndn-autoconfig/procedure.cpp
@@ -29,9 +29,7 @@
 #include "multicast-discovery.hpp"
 #include "ndn-fch-discovery.hpp"
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 using nfd::ControlParameters;
 using nfd::ControlResponse;
@@ -138,6 +136,4 @@
     });
 }
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
diff --git a/tools/ndn-autoconfig/procedure.hpp b/tools/ndn-autoconfig/procedure.hpp
index 7c52658..c5dc0bb 100644
--- a/tools/ndn-autoconfig/procedure.hpp
+++ b/tools/ndn-autoconfig/procedure.hpp
@@ -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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,13 +28,13 @@
 
 #include "stage.hpp"
 
+#include "core/common.hpp"
+
 #include <ndn-cxx/face.hpp>
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 struct Options
 {
@@ -89,8 +89,6 @@
   nfd::Controller m_controller;
 };
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
 
 #endif // NFD_TOOLS_NDN_AUTOCONFIG_PROCEDURE_HPP
diff --git a/tools/ndn-autoconfig/stage.cpp b/tools/ndn-autoconfig/stage.cpp
index 0569b24..6bfaff0 100644
--- a/tools/ndn-autoconfig/stage.cpp
+++ b/tools/ndn-autoconfig/stage.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -25,9 +25,7 @@
 
 #include "stage.hpp"
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 void
 Stage::start()
@@ -69,6 +67,4 @@
   m_isInProgress = false;
 }
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
diff --git a/tools/ndn-autoconfig/stage.hpp b/tools/ndn-autoconfig/stage.hpp
index f7f358e..d11309b 100644
--- a/tools/ndn-autoconfig/stage.hpp
+++ b/tools/ndn-autoconfig/stage.hpp
@@ -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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,16 +26,12 @@
 #ifndef NFD_TOOLS_NDN_AUTOCONFIG_STAGE_HPP
 #define NFD_TOOLS_NDN_AUTOCONFIG_STAGE_HPP
 
-#include "core/common.hpp"
-
 #include <ndn-cxx/net/face-uri.hpp>
 #include <ndn-cxx/util/signal.hpp>
 
 #include <iostream>
 
-namespace ndn {
-namespace tools {
-namespace autoconfig {
+namespace ndn::autoconfig {
 
 /** \brief a discovery stage
  */
@@ -45,14 +41,11 @@
   class Error : public std::runtime_error
   {
   public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-    }
+    using std::runtime_error::runtime_error;
   };
 
-  virtual ~Stage() = default;
+  virtual
+  ~Stage() = default;
 
   /** \brief get stage name
    *  \return stage name as a phrase, typically starting with lower case
@@ -99,8 +92,6 @@
   bool m_isInProgress = false;
 };
 
-} // namespace autoconfig
-} // namespace tools
-} // namespace ndn
+} // namespace ndn::autoconfig
 
 #endif // NFD_TOOLS_NDN_AUTOCONFIG_STAGE_HPP
diff --git a/tools/nfd-autoreg.cpp b/tools/nfd-autoreg.cpp
index 3745cb0..7a72b82 100644
--- a/tools/nfd-autoreg.cpp
+++ b/tools/nfd-autoreg.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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -27,8 +27,6 @@
 #include "core/version.hpp"
 
 #include <ndn-cxx/face.hpp>
-#include <ndn-cxx/name.hpp>
-#include <ndn-cxx/encoding/buffer-stream.hpp>
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
 #include <ndn-cxx/mgmt/nfd/face-monitor.hpp>
 #include <ndn-cxx/mgmt/nfd/face-status.hpp>
@@ -37,35 +35,25 @@
 
 #include <boost/exception/diagnostic_information.hpp>
 #include <boost/program_options/options_description.hpp>
-#include <boost/program_options/variables_map.hpp>
 #include <boost/program_options/parsers.hpp>
+#include <boost/program_options/variables_map.hpp>
 
 #include <iostream>
 
-namespace ndn {
-namespace nfd_autoreg {
-
-using ::nfd::Network;
+namespace nfd::tools::autoreg {
 
 class AutoregServer : boost::noncopyable
 {
 public:
-  AutoregServer()
-    : m_controller(m_face, m_keyChain)
-    , m_faceMonitor(m_face)
-    , m_cost(255)
-  {
-  }
-
-  void
+  static void
   onRegisterCommandSuccess(uint64_t faceId, const Name& prefix)
   {
-    std::cerr << "SUCCEED: register " << prefix << " on face " << faceId << std::endl;
+    std::cerr << "SUCCESS: register " << prefix << " on face " << faceId << std::endl;
   }
 
-  void
+  static void
   onRegisterCommandFailure(uint64_t faceId, const Name& prefix,
-                           const nfd::ControlResponse& response)
+                           const ndn::nfd::ControlResponse& response)
   {
     std::cerr << "FAILED: register " << prefix << " on face " << faceId
               << " (code: " << response.getCode() << ", reason: " << response.getText() << ")"
@@ -90,7 +78,7 @@
   isBlacklisted(const boost::asio::ip::address& address) const
   {
     return std::any_of(m_blackList.begin(), m_blackList.end(),
-                       std::bind(&Network::doesContain, _1, address));
+                       [&] (const auto& net) { return net.doesContain(address); });
   }
 
   /**
@@ -100,27 +88,27 @@
   isWhitelisted(const boost::asio::ip::address& address) const
   {
     return std::any_of(m_whiteList.begin(), m_whiteList.end(),
-                       std::bind(&Network::doesContain, _1, address));
+                       [&] (const auto& net) { return net.doesContain(address); });
   }
 
   void
   registerPrefixesForFace(uint64_t faceId, const std::vector<Name>& prefixes)
   {
     for (const Name& prefix : prefixes) {
-      m_controller.start<nfd::RibRegisterCommand>(
-        nfd::ControlParameters()
+      m_controller.start<ndn::nfd::RibRegisterCommand>(
+        ndn::nfd::ControlParameters()
           .setName(prefix)
           .setFaceId(faceId)
-          .setOrigin(nfd::ROUTE_ORIGIN_AUTOREG)
+          .setOrigin(ndn::nfd::ROUTE_ORIGIN_AUTOREG)
           .setCost(m_cost)
           .setExpirationPeriod(time::milliseconds::max()),
-        std::bind(&AutoregServer::onRegisterCommandSuccess, this, faceId, prefix),
-        std::bind(&AutoregServer::onRegisterCommandFailure, this, faceId, prefix, _1));
+        [=] (auto&&...) { onRegisterCommandSuccess(faceId, prefix); },
+        [=] (const auto& response) { onRegisterCommandFailure(faceId, prefix, response); });
     }
   }
 
   void
-  registerPrefixesIfNeeded(uint64_t faceId, const FaceUri& uri, nfd::FacePersistency facePersistency)
+  registerPrefixesIfNeeded(uint64_t faceId, const FaceUri& uri, ndn::nfd::FacePersistency facePersistency)
   {
     if (hasAllowedSchema(uri)) {
       boost::system::error_code ec;
@@ -131,7 +119,7 @@
         registerPrefixesForFace(faceId, m_allFacesPrefixes);
 
         // register autoreg prefixes if new face is on-demand and not blacklisted and whitelisted
-        if (facePersistency == nfd::FACE_PERSISTENCY_ON_DEMAND &&
+        if (facePersistency == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND &&
             !isBlacklisted(address) && isWhitelisted(address)) {
           registerPrefixesForFace(faceId, m_autoregPrefixes);
         }
@@ -140,10 +128,10 @@
   }
 
   void
-  onNotification(const nfd::FaceEventNotification& notification)
+  onNotification(const ndn::nfd::FaceEventNotification& notification)
   {
-    if (notification.getKind() == nfd::FACE_EVENT_CREATED &&
-        notification.getFaceScope() != nfd::FACE_SCOPE_LOCAL) {
+    if (notification.getKind() == ndn::nfd::FACE_EVENT_CREATED &&
+        notification.getFaceScope() != ndn::nfd::FACE_SCOPE_LOCAL) {
       std::cerr << "PROCESSING: " << notification << std::endl;
 
       registerPrefixesIfNeeded(notification.getFaceId(), FaceUri(notification.getRemoteUri()),
@@ -154,16 +142,6 @@
     }
   }
 
-  static void
-  usage(std::ostream& os,
-        const boost::program_options::options_description& desc,
-        const char* programName)
-  {
-    os << "Usage: " << programName << " [--prefix=</autoreg/prefix>]... [options]\n"
-       << "\n"
-       << desc;
-  }
-
   void
   startProcessing()
   {
@@ -188,7 +166,7 @@
       std::cout << "  " << network << std::endl;
     }
 
-    m_faceMonitor.onNotification.connect(std::bind(&AutoregServer::onNotification, this, _1));
+    m_faceMonitor.onNotification.connect([this] (const auto& notif) { onNotification(notif); });
     m_faceMonitor.start();
 
     boost::asio::signal_set signalSet(m_face.getIoService(), SIGINT, SIGTERM);
@@ -200,7 +178,7 @@
   void
   startFetchingFaceStatusDataset()
   {
-    m_controller.fetch<nfd::FaceDataset>(
+    m_controller.fetch<ndn::nfd::FaceDataset>(
       [this] (const auto& faces) {
         for (const auto& faceStatus : faces) {
           registerPrefixesIfNeeded(faceStatus.getFaceId(), FaceUri(faceStatus.getRemoteUri()),
@@ -224,7 +202,7 @@
       ("all-faces-prefix,a", po::value<std::vector<Name>>(&m_allFacesPrefixes)->composing(),
        "prefix that should be automatically registered for all TCP and UDP non-local faces "
        "(blacklists and whitelists do not apply to this prefix)")
-      ("cost,c", po::value<uint64_t>(&m_cost)->default_value(255),
+      ("cost,c", po::value<uint64_t>(&m_cost)->default_value(m_cost),
        "FIB cost that should be assigned to autoreg nexthops")
       ("whitelist,w", po::value<std::vector<Network>>(&m_whiteList)->composing(),
        "Whitelisted network, e.g., 192.168.2.0/24 or ::1/128")
@@ -232,6 +210,12 @@
        "Blacklisted network, e.g., 192.168.2.32/30 or ::1/128")
       ;
 
+    auto usage = [&] (std::ostream& os) {
+      os << "Usage: " << argv[0] << " [--prefix=</autoreg/prefix>]... [options]\n"
+         << "\n"
+         << optionsDesc;
+    };
+
     po::variables_map options;
     try {
       po::store(po::parse_command_line(argc, argv, optionsDesc), options);
@@ -239,12 +223,12 @@
     }
     catch (const std::exception& e) {
       std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
-      usage(std::cerr, optionsDesc, argv[0]);
+      usage(std::cerr);
       return 2;
     }
 
     if (options.count("help") > 0) {
-      usage(std::cout, optionsDesc, argv[0]);
+      usage(std::cout);
       return 0;
     }
 
@@ -256,7 +240,7 @@
     if (m_autoregPrefixes.empty() && m_allFacesPrefixes.empty()) {
       std::cerr << "ERROR: at least one --prefix or --all-faces-prefix must be specified"
                 << std::endl << std::endl;
-      usage(std::cerr, optionsDesc, argv[0]);
+      usage(std::cerr);
       return 2;
     }
 
@@ -279,23 +263,22 @@
   }
 
 private:
-  Face m_face;
-  KeyChain m_keyChain;
-  nfd::Controller m_controller;
-  nfd::FaceMonitor m_faceMonitor;
+  ndn::Face m_face;
+  ndn::KeyChain m_keyChain;
+  ndn::nfd::Controller m_controller{m_face, m_keyChain};
+  ndn::nfd::FaceMonitor m_faceMonitor{m_face};
   std::vector<Name> m_autoregPrefixes;
   std::vector<Name> m_allFacesPrefixes;
-  uint64_t m_cost;
+  uint64_t m_cost = 255;
   std::vector<Network> m_whiteList;
   std::vector<Network> m_blackList;
 };
 
-} // namespace nfd_autoreg
-} // namespace ndn
+} // namespace nfd::tools::autoreg
 
 int
 main(int argc, char* argv[])
 {
-  ndn::nfd_autoreg::AutoregServer server;
+  nfd::tools::autoreg::AutoregServer server;
   return server.main(argc, argv);
 }
diff --git a/tools/nfdc/available-commands.cpp b/tools/nfdc/available-commands.cpp
index 5be4854..6df761a 100644
--- a/tools/nfdc/available-commands.cpp
+++ b/tools/nfdc/available-commands.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -30,9 +30,7 @@
 #include "status.hpp"
 #include "strategy-choice-module.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 void
 registerCommands(CommandParser& parser)
@@ -44,6 +42,4 @@
   StrategyChoiceModule::registerCommands(parser);
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/available-commands.hpp b/tools/nfdc/available-commands.hpp
index a887eec..ad6525c 100644
--- a/tools/nfdc/available-commands.hpp
+++ b/tools/nfdc/available-commands.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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,15 +28,11 @@
 
 #include "command-parser.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 void
 registerCommands(CommandParser& parser);
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_AVAILABLE_COMMANDS_HPP
diff --git a/tools/nfdc/canonizer.cpp b/tools/nfdc/canonizer.cpp
index a44a2bf..c6f150b 100644
--- a/tools/nfdc/canonizer.cpp
+++ b/tools/nfdc/canonizer.cpp
@@ -25,9 +25,7 @@
 
 #include "canonizer.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 std::pair<std::optional<FaceUri>, std::string>
 canonize(ExecuteContext& ctx, const FaceUri& uri)
@@ -56,6 +54,4 @@
   return {FindFace::Code::CANONIZE_ERROR, msg};
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/canonizer.hpp b/tools/nfdc/canonizer.hpp
index 90b3afb..d693a55 100644
--- a/tools/nfdc/canonizer.hpp
+++ b/tools/nfdc/canonizer.hpp
@@ -32,9 +32,7 @@
 
 #include <ndn-cxx/net/face-uri.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 /** \brief canonize FaceUri
  *  \return pair of canonical FaceUri (nullopt if failure) and error string
@@ -53,8 +51,6 @@
                     const std::string& error,
                     const std::string& field = "");
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_CANONIZER_HPP
diff --git a/tools/nfdc/channel-module.cpp b/tools/nfdc/channel-module.cpp
index 81f69d4..085fc35 100644
--- a/tools/nfdc/channel-module.cpp
+++ b/tools/nfdc/channel-module.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,9 +26,7 @@
 #include "channel-module.hpp"
 #include "format-helpers.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 void
 ChannelModule::fetchStatus(Controller& controller,
@@ -78,6 +76,4 @@
   os << "\n";
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/channel-module.hpp b/tools/nfdc/channel-module.hpp
index 17989a6..6698ae8 100644
--- a/tools/nfdc/channel-module.hpp
+++ b/tools/nfdc/channel-module.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,9 +28,7 @@
 
 #include "module.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::nfd::ChannelStatus;
 
@@ -70,8 +68,6 @@
   std::vector<ChannelStatus> m_status;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_CHANNEL_MODULE_HPP
diff --git a/tools/nfdc/command-arguments.hpp b/tools/nfdc/command-arguments.hpp
index 2ab30f2..6dc060a 100644
--- a/tools/nfdc/command-arguments.hpp
+++ b/tools/nfdc/command-arguments.hpp
@@ -33,9 +33,7 @@
 #include <any>
 #include <boost/logic/tribool.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::nfd::FacePersistency;
 using ndn::nfd::RouteOrigin;
@@ -75,8 +73,6 @@
   }
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_COMMAND_ARGUMENTS_HPP
diff --git a/tools/nfdc/command-definition.cpp b/tools/nfdc/command-definition.cpp
index 7952e25..08952fd 100644
--- a/tools/nfdc/command-definition.cpp
+++ b/tools/nfdc/command-definition.cpp
@@ -28,9 +28,7 @@
 
 #include <ndn-cxx/util/logger.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 NDN_LOG_INIT(nfdc.CommandDefinition);
 
@@ -291,6 +289,4 @@
   NDN_CXX_UNREACHABLE;
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/command-definition.hpp b/tools/nfdc/command-definition.hpp
index 8cd56d9..26e309b 100644
--- a/tools/nfdc/command-definition.hpp
+++ b/tools/nfdc/command-definition.hpp
@@ -28,16 +28,14 @@
 
 #include "command-arguments.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 /** \brief indicates argument value type
  */
 enum class ArgValueType {
   /** \brief boolean argument without value
    *
-   *  The argument appears in CommandArguments as bool value 'true'.
+   *  The argument appears in CommandArguments as bool value `true`.
    *  It must not be declared as positional.
    */
   NONE,
@@ -212,8 +210,6 @@
   std::vector<std::string> m_positionalArgs;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_COMMAND_DEFINITION_HPP
diff --git a/tools/nfdc/command-parser.cpp b/tools/nfdc/command-parser.cpp
index 69bc26a..19bb5a2 100644
--- a/tools/nfdc/command-parser.cpp
+++ b/tools/nfdc/command-parser.cpp
@@ -28,9 +28,7 @@
 
 #include <ndn-cxx/util/logger.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 NDN_LOG_INIT(nfdc.CommandParser);
 
@@ -129,6 +127,4 @@
   return {def.getNoun(), def.getVerb(), def.parse(tokens, nConsumed), i->second->execute};
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/command-parser.hpp b/tools/nfdc/command-parser.hpp
index f03027b..e0849b0 100644
--- a/tools/nfdc/command-parser.hpp
+++ b/tools/nfdc/command-parser.hpp
@@ -31,9 +31,7 @@
 
 #include <type_traits>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 /** \brief indicates which modes is a command allowed
  */
@@ -125,8 +123,6 @@
   std::vector<CommandContainer::const_iterator> m_commandOrder;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_COMMAND_PARSER_HPP
diff --git a/tools/nfdc/cs-module.cpp b/tools/nfdc/cs-module.cpp
index cdaad5a..73d066c 100644
--- a/tools/nfdc/cs-module.cpp
+++ b/tools/nfdc/cs-module.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,9 +28,7 @@
 
 #include <ndn-cxx/util/indented-stream.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 void
 CsModule::registerCommands(CommandParser& parser)
@@ -184,6 +182,4 @@
      << ia.end();
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/cs-module.hpp b/tools/nfdc/cs-module.hpp
index 3b16952..3c78765 100644
--- a/tools/nfdc/cs-module.hpp
+++ b/tools/nfdc/cs-module.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -29,9 +29,7 @@
 #include "command-parser.hpp"
 #include "module.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::nfd::CsInfo;
 
@@ -78,8 +76,6 @@
   CsInfo m_status;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_CS_MODULE_HPP
diff --git a/tools/nfdc/execute-command.cpp b/tools/nfdc/execute-command.cpp
index 7067ebf..6706ffc 100644
--- a/tools/nfdc/execute-command.cpp
+++ b/tools/nfdc/execute-command.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -25,9 +25,7 @@
 
 #include "execute-command.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 time::nanoseconds
 ExecuteContext::getTimeout() const
@@ -60,6 +58,4 @@
   };
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/execute-command.hpp b/tools/nfdc/execute-command.hpp
index 0458fb1..8132774 100644
--- a/tools/nfdc/execute-command.hpp
+++ b/tools/nfdc/execute-command.hpp
@@ -37,9 +37,7 @@
 #include <ndn-cxx/mgmt/nfd/status-dataset.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::Face;
 using ndn::KeyChain;
@@ -92,8 +90,6 @@
  */
 using ExecuteCommand = std::function<void(ExecuteContext&)>;
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_EXECUTE_COMMAND_HPP
diff --git a/tools/nfdc/face-module.cpp b/tools/nfdc/face-module.cpp
index 267187e..08409f7 100644
--- a/tools/nfdc/face-module.cpp
+++ b/tools/nfdc/face-module.cpp
@@ -27,9 +27,7 @@
 #include "canonizer.hpp"
 #include "find-face.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 void
 FaceModule::registerCommands(CommandParser& parser)
@@ -557,6 +555,4 @@
   os << '\n';
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/face-module.hpp b/tools/nfdc/face-module.hpp
index cffd98b..1d3eac8 100644
--- a/tools/nfdc/face-module.hpp
+++ b/tools/nfdc/face-module.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2020,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -30,9 +30,7 @@
 #include "command-parser.hpp"
 #include "format-helpers.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::nfd::FaceStatus;
 
@@ -114,8 +112,6 @@
   std::vector<FaceStatus> m_status;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_FACE_MODULE_HPP
diff --git a/tools/nfdc/fib-module.cpp b/tools/nfdc/fib-module.cpp
index e040109..92f7212 100644
--- a/tools/nfdc/fib-module.cpp
+++ b/tools/nfdc/fib-module.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,9 +26,7 @@
 #include "fib-module.hpp"
 #include "format-helpers.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 void
 FibModule::fetchStatus(Controller& controller,
@@ -98,6 +96,4 @@
   os << "\n";
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/fib-module.hpp b/tools/nfdc/fib-module.hpp
index a41c978..e182f59 100644
--- a/tools/nfdc/fib-module.hpp
+++ b/tools/nfdc/fib-module.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,9 +28,7 @@
 
 #include "module.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::nfd::FibEntry;
 using ndn::nfd::NextHopRecord;
@@ -71,8 +69,6 @@
   std::vector<FibEntry> m_status;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_FIB_MODULE_HPP
diff --git a/tools/nfdc/find-face.cpp b/tools/nfdc/find-face.cpp
index 2240433..054cba9 100644
--- a/tools/nfdc/find-face.cpp
+++ b/tools/nfdc/find-face.cpp
@@ -29,9 +29,7 @@
 
 #include <ndn-cxx/util/logger.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 NDN_LOG_INIT(nfdc.FindFace);
 
@@ -180,6 +178,4 @@
   }
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/find-face.hpp b/tools/nfdc/find-face.hpp
index ee1c521..02de011 100644
--- a/tools/nfdc/find-face.hpp
+++ b/tools/nfdc/find-face.hpp
@@ -28,9 +28,7 @@
 
 #include "execute-command.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::nfd::FaceQueryFilter;
 using ndn::nfd::FaceStatus;
@@ -139,8 +137,6 @@
   std::string m_errorReason;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_FIND_FACE_HPP
diff --git a/tools/nfdc/format-helpers.cpp b/tools/nfdc/format-helpers.cpp
index 63f2417..1810f30 100644
--- a/tools/nfdc/format-helpers.cpp
+++ b/tools/nfdc/format-helpers.cpp
@@ -28,9 +28,7 @@
 #include <iomanip>
 #include <sstream>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 namespace xml {
 
@@ -204,6 +202,4 @@
 
 } // namespace text
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/format-helpers.hpp b/tools/nfdc/format-helpers.hpp
index 4140ae2..2ee28ba 100644
--- a/tools/nfdc/format-helpers.hpp
+++ b/tools/nfdc/format-helpers.hpp
@@ -28,9 +28,7 @@
 
 #include "core/common.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 namespace xml {
 
@@ -266,8 +264,6 @@
 
 } // namespace text
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_FORMAT_HELPERS_HPP
diff --git a/tools/nfdc/forwarder-general-module.cpp b/tools/nfdc/forwarder-general-module.cpp
index 1542b9f..7cfab84 100644
--- a/tools/nfdc/forwarder-general-module.cpp
+++ b/tools/nfdc/forwarder-general-module.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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,9 +28,7 @@
 
 #include <ndn-cxx/util/indented-stream.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 void
 ForwarderGeneralModule::fetchStatus(Controller& controller,
@@ -130,6 +128,4 @@
   os << ia.end();
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/forwarder-general-module.hpp b/tools/nfdc/forwarder-general-module.hpp
index 10d5cf3..239cea6 100644
--- a/tools/nfdc/forwarder-general-module.hpp
+++ b/tools/nfdc/forwarder-general-module.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -28,9 +28,7 @@
 
 #include "module.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::nfd::ForwarderStatus;
 
@@ -70,8 +68,6 @@
   ForwarderStatus m_status;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_FORWARDER_GENERAL_MODULE_HPP
diff --git a/tools/nfdc/help.cpp b/tools/nfdc/help.cpp
index 052d16c..357a647 100644
--- a/tools/nfdc/help.cpp
+++ b/tools/nfdc/help.cpp
@@ -32,9 +32,7 @@
 #include <cstring>
 #include <unistd.h>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 NDN_LOG_INIT(nfdc.Help);
 
@@ -98,6 +96,4 @@
   }
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/help.hpp b/tools/nfdc/help.hpp
index 53d21d4..19df8c1 100644
--- a/tools/nfdc/help.hpp
+++ b/tools/nfdc/help.hpp
@@ -28,9 +28,7 @@
 
 #include "command-parser.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 /** \brief writes the list of available commands to a stream
  *  \param os the output stream to write the list to
@@ -56,8 +54,6 @@
 help(std::ostream& os, const CommandParser& parser,
      std::vector<std::string> args);
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_HELP_HPP
diff --git a/tools/nfdc/main.cpp b/tools/nfdc/main.cpp
index a9d9c6f..78da697 100644
--- a/tools/nfdc/main.cpp
+++ b/tools/nfdc/main.cpp
@@ -31,9 +31,7 @@
 #include <fstream>
 #include <iostream>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 static int
 main(int argc, char** argv)
@@ -184,9 +182,7 @@
   }
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 int
 main(int argc, char** argv)
diff --git a/tools/nfdc/module.hpp b/tools/nfdc/module.hpp
index b8ede30..6793b3e 100644
--- a/tools/nfdc/module.hpp
+++ b/tools/nfdc/module.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -30,9 +30,7 @@
 #include <ndn-cxx/mgmt/nfd/command-options.hpp>
 #include <ndn-cxx/mgmt/nfd/controller.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::nfd::CommandOptions;
 using ndn::nfd::Controller;
@@ -74,8 +72,6 @@
   formatStatusText(std::ostream& os) const = 0;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_MODULE_HPP
diff --git a/tools/nfdc/rib-module.cpp b/tools/nfdc/rib-module.cpp
index 5ed8553..d0489cf 100644
--- a/tools/nfdc/rib-module.cpp
+++ b/tools/nfdc/rib-module.cpp
@@ -29,9 +29,7 @@
 #include "find-face.hpp"
 #include "format-helpers.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 void
 RibModule::registerCommands(CommandParser& parser)
@@ -410,6 +408,4 @@
   }
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/rib-module.hpp b/tools/nfdc/rib-module.hpp
index 6c64cd2..22d4e76 100644
--- a/tools/nfdc/rib-module.hpp
+++ b/tools/nfdc/rib-module.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -29,9 +29,7 @@
 #include "module.hpp"
 #include "command-parser.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::nfd::RibEntry;
 using ndn::nfd::Route;
@@ -113,8 +111,6 @@
   std::vector<RibEntry> m_status;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_RIB_MODULE_HPP
diff --git a/tools/nfdc/status-report.cpp b/tools/nfdc/status-report.cpp
index aa3cdf1..ff0ea1c 100644
--- a/tools/nfdc/status-report.cpp
+++ b/tools/nfdc/status-report.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,9 +26,7 @@
 #include "status-report.hpp"
 #include "format-helpers.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 ReportFormat
 parseReportFormat(const std::string& s)
@@ -99,6 +97,4 @@
   }
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/status-report.hpp b/tools/nfdc/status-report.hpp
index ae5ecdc..20c364d 100644
--- a/tools/nfdc/status-report.hpp
+++ b/tools/nfdc/status-report.hpp
@@ -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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -32,9 +32,7 @@
 #include <ndn-cxx/security/key-chain.hpp>
 #include <ndn-cxx/security/validator.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::Face;
 using ndn::KeyChain;
@@ -93,8 +91,6 @@
   std::vector<unique_ptr<Module>> sections;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_STATUS_REPORT_HPP
diff --git a/tools/nfdc/status.cpp b/tools/nfdc/status.cpp
index a338b1d..081eea9 100644
--- a/tools/nfdc/status.cpp
+++ b/tools/nfdc/status.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-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -34,9 +34,7 @@
 
 #include <ndn-cxx/security/validator-null.hpp>
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 void
 reportStatus(ExecuteContext& ctx, const StatusReportOptions& options)
@@ -154,6 +152,4 @@
   parser.addAlias("cs", "info", "");
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/status.hpp b/tools/nfdc/status.hpp
index b5d2e94..c563ad7 100644
--- a/tools/nfdc/status.hpp
+++ b/tools/nfdc/status.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -29,9 +29,7 @@
 #include "status-report.hpp"
 #include "command-parser.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 struct StatusReportOptions
 {
@@ -63,8 +61,6 @@
 void
 registerStatusCommands(CommandParser& parser);
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_STATUS_HPP
diff --git a/tools/nfdc/strategy-choice-module.cpp b/tools/nfdc/strategy-choice-module.cpp
index 004f368..1fbca4c 100644
--- a/tools/nfdc/strategy-choice-module.cpp
+++ b/tools/nfdc/strategy-choice-module.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -26,9 +26,7 @@
 #include "strategy-choice-module.hpp"
 #include "format-helpers.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 void
 StrategyChoiceModule::registerCommands(CommandParser& parser)
@@ -202,6 +200,4 @@
      << ia.end();
 }
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
diff --git a/tools/nfdc/strategy-choice-module.hpp b/tools/nfdc/strategy-choice-module.hpp
index 7c403a9..502d66b 100644
--- a/tools/nfdc/strategy-choice-module.hpp
+++ b/tools/nfdc/strategy-choice-module.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2022,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -29,9 +29,7 @@
 #include "module.hpp"
 #include "command-parser.hpp"
 
-namespace nfd {
-namespace tools {
-namespace nfdc {
+namespace nfd::tools::nfdc {
 
 using ndn::nfd::StrategyChoice;
 
@@ -97,8 +95,6 @@
   std::vector<StrategyChoice> m_status;
 };
 
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
+} // namespace nfd::tools::nfdc
 
 #endif // NFD_TOOLS_NFDC_STRATEGY_CHOICE_MODULE_HPP