build: switch to C++17

Change-Id: Ie957dcfe2c579499654aa8dcc47003d0afba9d05
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index f086c17..7c6d282 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -136,7 +136,7 @@
     """
     def getGeneralFlags(self, conf):
         flags = super(GccBasicFlags, self).getGeneralFlags(conf)
-        flags['CXXFLAGS'] += ['-std=c++14']
+        flags['CXXFLAGS'] += ['-std=c++17']
         if Utils.unversioned_sys_platform() == 'linux':
             flags['LINKFLAGS'] += ['-fuse-ld=gold']
         elif Utils.unversioned_sys_platform() == 'freebsd':
diff --git a/README.md b/README.md
index fe3247f..24829bc 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
 # NDN Traffic Generator
 
 [![CI](https://github.com/named-data/ndn-traffic-generator/actions/workflows/ci.yml/badge.svg)](https://github.com/named-data/ndn-traffic-generator/actions/workflows/ci.yml)
-![Language](https://img.shields.io/badge/C%2B%2B-14-blue)
+![Language](https://img.shields.io/badge/C%2B%2B-17-blue)
 
 This tool is designed to generate Interest and Data traffic in an NDN network.
 The client and server tool accept traffic configuration files which can be
diff --git a/src/logger.hpp b/src/logger.hpp
index 71cfbc2..7952b1c 100644
--- a/src/logger.hpp
+++ b/src/logger.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019, Arizona Board of Regents.
+ * Copyright (c) 2014-2022, Arizona Board of Regents.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,8 +18,8 @@
  * Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
  */
 
-#ifndef NTG_LOGGER_HPP
-#define NTG_LOGGER_HPP
+#ifndef NDNTG_LOGGER_HPP
+#define NDNTG_LOGGER_HPP
 
 #include <cstdlib>
 #include <fstream>
@@ -28,7 +28,7 @@
 #include <boost/filesystem.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 
-namespace ndn {
+namespace ndntg {
 
 class Logger
 {
@@ -74,12 +74,13 @@
       return;
     }
 
-    if (boost::filesystem::exists(boost::filesystem::path(m_logLocation))) {
-      if (boost::filesystem::is_directory(boost::filesystem::path(m_logLocation))) {
-        std::string logFilename = m_logLocation + "/" + m_module + "_" + instanceId + ".log";
-        m_logFile.open(logFilename.data(), std::ofstream::out | std::ofstream::trunc);
+    boost::filesystem::path logdir(m_logLocation);
+    if (boost::filesystem::exists(logdir)) {
+      if (boost::filesystem::is_directory(logdir)) {
+        auto logfile = logdir / (m_module + '_' + instanceId + ".log");
+        m_logFile.open(logfile.string(), std::ofstream::out | std::ofstream::trunc);
         if (m_logFile.is_open()) {
-          std::cout << "Log file initialized: " << logFilename << std::endl;
+          std::cout << "Log file initialized: " << logfile << std::endl;
         }
         else {
           std::cout << "ERROR: Unable to initialize a log file at: " << m_logLocation << std::endl
@@ -104,8 +105,7 @@
   static std::string
   getTimestamp()
   {
-    boost::posix_time::ptime now;
-    now = boost::posix_time::second_clock::local_time();
+    auto now = boost::posix_time::second_clock::local_time();
     return to_simple_string(now);
   }
 
@@ -115,6 +115,6 @@
   std::ofstream m_logFile;
 };
 
-} // namespace ndn
+} // namespace ndntg
 
-#endif // NTG_LOGGER_HPP
+#endif // NDNTG_LOGGER_HPP
diff --git a/src/ndn-traffic-client.cpp b/src/ndn-traffic-client.cpp
index 781966a..2761e04 100644
--- a/src/ndn-traffic-client.cpp
+++ b/src/ndn-traffic-client.cpp
@@ -20,14 +20,17 @@
 
 #include "util.hpp"
 
+#include <ndn-cxx/data.hpp>
 #include <ndn-cxx/face.hpp>
-#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/interest.hpp>
 #include <ndn-cxx/lp/tags.hpp>
-#include <ndn-cxx/util/backports.hpp>
 #include <ndn-cxx/util/random.hpp>
+#include <ndn-cxx/util/time.hpp>
 
 #include <limits>
+#include <optional>
 #include <sstream>
+#include <string_view>
 #include <vector>
 
 #include <boost/asio/deadline_timer.hpp>
@@ -41,8 +44,12 @@
 #include <boost/program_options/variables_map.hpp>
 
 namespace po = boost::program_options;
+using namespace ndn::time_literals;
+using namespace std::string_literals;
 
-namespace ndn {
+namespace ndntg {
+
+namespace time = ndn::time;
 
 class NdnTrafficClient : boost::noncopyable
 {
@@ -78,7 +85,7 @@
   int
   run()
   {
-    m_logger.initializeLog(to_string(random::generateWord32()));
+    m_logger.initializeLog(std::to_string(ndn::random::generateWord32()));
 
     if (!readConfigurationFile(m_configurationFile, m_trafficPatterns, m_logger)) {
       return 2;
@@ -91,7 +98,7 @@
 
     m_logger.log("Traffic configuration file processing completed.\n", true, false);
     for (std::size_t i = 0; i < m_trafficPatterns.size(); i++) {
-      m_logger.log("Traffic Pattern Type #" + to_string(i + 1), false, false);
+      m_logger.log("Traffic Pattern Type #" + std::to_string(i + 1), false, false);
       m_trafficPatterns[i].printTrafficConfiguration(m_logger);
       m_logger.log("", false, false);
     }
@@ -101,11 +108,11 @@
       return 0;
     }
 
-    m_signalSet.async_wait([this] (auto&&...) { this->stop(); });
+    m_signalSet.async_wait([this] (auto&&...) { stop(); });
 
     boost::asio::deadline_timer timer(m_ioService,
                                       boost::posix_time::millisec(m_interestInterval.count()));
-    timer.async_wait([this, &timer] (auto&&...) { this->generateTraffic(timer); });
+    timer.async_wait([this, &timer] (auto&&...) { generateTraffic(timer); });
 
     try {
       m_face.processEvents();
@@ -164,7 +171,7 @@
     {
       std::string parameter, value;
       if (!extractParameterAndValue(line, parameter, value)) {
-        logger.log("Line " + to_string(lineNumber) + " - Invalid syntax: " + line,
+        logger.log("Line " + std::to_string(lineNumber) + " - Invalid syntax: " + line,
                    false, true);
         return false;
       }
@@ -200,7 +207,7 @@
         m_expectedContent = value;
       }
       else {
-        logger.log("Line " + to_string(lineNumber) + " - Ignoring unknown parameter: " + parameter,
+        logger.log("Line " + std::to_string(lineNumber) + " - Ignoring unknown parameter: " + parameter,
                    false, true);
       }
       return true;
@@ -215,14 +222,14 @@
   public:
     uint8_t m_trafficPercentage = 0;
     std::string m_name;
-    optional<std::size_t> m_nameAppendBytes;
-    optional<uint64_t> m_nameAppendSeqNum;
+    std::optional<std::size_t> m_nameAppendBytes;
+    std::optional<uint64_t> m_nameAppendSeqNum;
     bool m_canBePrefix = false;
     bool m_mustBeFresh = false;
     uint8_t m_nonceDuplicationPercentage = 0;
     time::milliseconds m_interestLifetime = -1_ms;
     uint64_t m_nextHopFaceId = 0;
-    optional<std::string> m_expectedContent;
+    std::optional<std::string> m_expectedContent;
 
     uint64_t m_nInterestsSent = 0;
     uint64_t m_nInterestsReceived = 0;
@@ -240,19 +247,19 @@
   {
     m_logger.log("\n\n== Interest Traffic Report ==\n", false, true);
     m_logger.log("Total Traffic Pattern Types = " +
-                 to_string(m_trafficPatterns.size()), false, true);
+                 std::to_string(m_trafficPatterns.size()), false, true);
     m_logger.log("Total Interests Sent        = " +
-                 to_string(m_nInterestsSent), false, true);
+                 std::to_string(m_nInterestsSent), false, true);
     m_logger.log("Total Responses Received    = " +
-                 to_string(m_nInterestsReceived), false, true);
+                 std::to_string(m_nInterestsReceived), false, true);
     m_logger.log("Total Nacks Received        = " +
-                 to_string(m_nNacks), false, true);
+                 std::to_string(m_nNacks), false, true);
 
     double loss = 0.0;
     if (m_nInterestsSent > 0) {
       loss = (m_nInterestsSent - m_nInterestsReceived) * 100.0 / m_nInterestsSent;
     }
-    m_logger.log("Total Interest Loss         = " + to_string(loss) + "%", false, true);
+    m_logger.log("Total Interest Loss         = " + std::to_string(loss) + "%", false, true);
 
     double average = 0.0;
     double inconsistency = 0.0;
@@ -261,41 +268,40 @@
       inconsistency = m_nContentInconsistencies * 100.0 / m_nInterestsReceived;
     }
     m_logger.log("Total Data Inconsistency    = " +
-                 to_string(inconsistency) + "%", false, true);
+                 std::to_string(inconsistency) + "%", false, true);
     m_logger.log("Total Round Trip Time       = " +
-                 to_string(m_totalInterestRoundTripTime) + "ms", false, true);
+                 std::to_string(m_totalInterestRoundTripTime) + "ms", false, true);
     m_logger.log("Average Round Trip Time     = " +
-                 to_string(average) + "ms\n", false, true);
+                 std::to_string(average) + "ms\n", false, true);
 
     for (std::size_t patternId = 0; patternId < m_trafficPatterns.size(); patternId++) {
-      m_logger.log("Traffic Pattern Type #" + to_string(patternId + 1), false, true);
+      m_logger.log("Traffic Pattern Type #" + std::to_string(patternId + 1), false, true);
       m_trafficPatterns[patternId].printTrafficConfiguration(m_logger);
       m_logger.log("Total Interests Sent        = " +
-                   to_string(m_trafficPatterns[patternId].m_nInterestsSent), false, true);
+                   std::to_string(m_trafficPatterns[patternId].m_nInterestsSent), false, true);
       m_logger.log("Total Responses Received    = " +
-                   to_string(m_trafficPatterns[patternId].m_nInterestsReceived), false, true);
+                   std::to_string(m_trafficPatterns[patternId].m_nInterestsReceived), false, true);
       m_logger.log("Total Nacks Received        = " +
-                   to_string(m_trafficPatterns[patternId].m_nNacks), false, true);
+                   std::to_string(m_trafficPatterns[patternId].m_nNacks), false, true);
       loss = 0;
       if (m_trafficPatterns[patternId].m_nInterestsSent > 0) {
-        loss = (m_trafficPatterns[patternId].m_nInterestsSent -
-                m_trafficPatterns[patternId].m_nInterestsReceived);
+        loss = m_trafficPatterns[patternId].m_nInterestsSent - m_trafficPatterns[patternId].m_nInterestsReceived;
         loss *= 100.0;
         loss /= m_trafficPatterns[patternId].m_nInterestsSent;
       }
-      m_logger.log("Total Interest Loss         = " + to_string(loss) + "%", false, true);
+      m_logger.log("Total Interest Loss         = " + std::to_string(loss) + "%", false, true);
       average = 0;
       inconsistency = 0;
       if (m_trafficPatterns[patternId].m_nInterestsReceived > 0) {
-        average = (m_trafficPatterns[patternId].m_totalInterestRoundTripTime /
-                   m_trafficPatterns[patternId].m_nInterestsReceived);
+        average = m_trafficPatterns[patternId].m_totalInterestRoundTripTime /
+                  m_trafficPatterns[patternId].m_nInterestsReceived;
         inconsistency = m_trafficPatterns[patternId].m_nContentInconsistencies;
         inconsistency *= 100.0 / m_trafficPatterns[patternId].m_nInterestsReceived;
       }
-      m_logger.log("Total Data Inconsistency    = " + to_string(inconsistency) + "%", false, true);
+      m_logger.log("Total Data Inconsistency    = " + std::to_string(inconsistency) + "%", false, true);
       m_logger.log("Total Round Trip Time       = " +
-                   to_string(m_trafficPatterns[patternId].m_totalInterestRoundTripTime) + "ms", false, true);
-      m_logger.log("Average Round Trip Time     = " + to_string(average) + "ms\n", false, true);
+                   std::to_string(m_trafficPatterns[patternId].m_totalInterestRoundTripTime) + "ms", false, true);
+      m_logger.log("Average Round Trip Time     = " + std::to_string(average) + "ms\n", false, true);
     }
   }
 
@@ -312,9 +318,9 @@
     if (m_nonces.size() >= 1000)
       m_nonces.clear();
 
-    auto randomNonce = random::generateWord32();
+    auto randomNonce = ndn::random::generateWord32();
     while (std::find(m_nonces.begin(), m_nonces.end(), randomNonce) != m_nonces.end())
-      randomNonce = random::generateWord32();
+      randomNonce = ndn::random::generateWord32();
 
     m_nonces.push_back(randomNonce);
     return randomNonce;
@@ -327,30 +333,30 @@
       return getNewNonce();
 
     std::uniform_int_distribution<std::size_t> dist(0, m_nonces.size() - 1);
-    return m_nonces[dist(random::getRandomNumberEngine())];
+    return m_nonces[dist(ndn::random::getRandomNumberEngine())];
   }
 
-  static name::Component
+  static auto
   generateRandomNameComponent(std::size_t length)
   {
     // per ISO C++ std, cannot instantiate uniform_int_distribution with uint8_t
     static std::uniform_int_distribution<unsigned short> dist(std::numeric_limits<uint8_t>::min(),
                                                               std::numeric_limits<uint8_t>::max());
 
-    Buffer buf(length);
+    ndn::Buffer buf(length);
     for (std::size_t i = 0; i < length; i++) {
-      buf[i] = static_cast<uint8_t>(dist(random::getRandomNumberEngine()));
+      buf[i] = static_cast<uint8_t>(dist(ndn::random::getRandomNumberEngine()));
     }
-    return name::Component(buf);
+    return ndn::name::Component(buf);
   }
 
-  Interest
+  auto
   prepareInterest(std::size_t patternId)
   {
-    Interest interest;
+    ndn::Interest interest;
     auto& pattern = m_trafficPatterns[patternId];
 
-    Name name(pattern.m_name);
+    ndn::Name name(pattern.m_name);
     if (pattern.m_nameAppendBytes > 0) {
       name.append(generateRandomNameComponent(*pattern.m_nameAppendBytes));
     }
@@ -365,7 +371,7 @@
     interest.setMustBeFresh(pattern.m_mustBeFresh);
 
     static std::uniform_int_distribution<> duplicateNonceDist(1, 100);
-    if (duplicateNonceDist(random::getRandomNumberEngine()) <= pattern.m_nonceDuplicationPercentage)
+    if (duplicateNonceDist(ndn::random::getRandomNumberEngine()) <= pattern.m_nonceDuplicationPercentage)
       interest.setNonce(getOldNonce());
     else
       interest.setNonce(getNewNonce());
@@ -374,18 +380,18 @@
       interest.setInterestLifetime(pattern.m_interestLifetime);
 
     if (pattern.m_nextHopFaceId > 0)
-      interest.setTag(make_shared<lp::NextHopFaceIdTag>(pattern.m_nextHopFaceId));
+      interest.setTag(std::make_shared<ndn::lp::NextHopFaceIdTag>(pattern.m_nextHopFaceId));
 
     return interest;
   }
 
   void
-  onData(const Data& data, int globalRef, int localRef, std::size_t patternId,
-         const time::steady_clock::TimePoint& sentTime)
+  onData(const ndn::Data& data, int globalRef, int localRef, std::size_t patternId,
+         const time::steady_clock::time_point& sentTime)
   {
-    auto logLine = "Data Received      - PatternType=" + to_string(patternId + 1) +
-                   ", GlobalID=" + to_string(globalRef) +
-                   ", LocalID=" + to_string(localRef) +
+    auto logLine = "Data Received      - PatternType=" + std::to_string(patternId + 1) +
+                   ", GlobalID=" + std::to_string(globalRef) +
+                   ", LocalID=" + std::to_string(localRef) +
                    ", Name=" + data.getName().toUri();
 
     m_nInterestsReceived++;
@@ -427,12 +433,12 @@
   }
 
   void
-  onNack(const Interest& interest, const lp::Nack& nack,
+  onNack(const ndn::Interest& interest, const ndn::lp::Nack& nack,
          int globalRef, int localRef, std::size_t patternId)
   {
-    auto logLine = "Interest Nack'd    - PatternType=" + to_string(patternId + 1) +
-                   ", GlobalID=" + to_string(globalRef) +
-                   ", LocalID=" + to_string(localRef) +
+    auto logLine = "Interest Nack'd    - PatternType=" + std::to_string(patternId + 1) +
+                   ", GlobalID=" + std::to_string(globalRef) +
+                   ", LocalID=" + std::to_string(localRef) +
                    ", Name=" + interest.getName().toUri() +
                    ", NackReason=" + boost::lexical_cast<std::string>(nack.getReason());
     m_logger.log(logLine, true, false);
@@ -446,11 +452,11 @@
   }
 
   void
-  onTimeout(const Interest& interest, int globalRef, int localRef, int patternId)
+  onTimeout(const ndn::Interest& interest, int globalRef, int localRef, int patternId)
   {
-    auto logLine = "Interest Timed Out - PatternType=" + to_string(patternId + 1) +
-                   ", GlobalID=" + to_string(globalRef) +
-                   ", LocalID=" + to_string(localRef) +
+    auto logLine = "Interest Timed Out - PatternType=" + std::to_string(patternId + 1) +
+                   ", GlobalID=" + std::to_string(globalRef) +
+                   ", LocalID=" + std::to_string(localRef) +
                    ", Name=" + interest.getName().toUri();
     m_logger.log(logLine, true, false);
 
@@ -467,7 +473,7 @@
     }
 
     static std::uniform_int_distribution<> trafficDist(1, 100);
-    int trafficKey = trafficDist(random::getRandomNumberEngine());
+    int trafficKey = trafficDist(ndn::random::getRandomNumberEngine());
 
     int cumulativePercentage = 0;
     std::size_t patternId = 0;
@@ -488,16 +494,15 @@
                                       m_trafficPatterns[patternId].m_nInterestsSent, patternId));
 
           if (!m_wantQuiet) {
-            auto logLine = "Sending Interest   - PatternType=" + to_string(patternId + 1) +
-                           ", GlobalID=" + to_string(m_nInterestsSent) +
-                           ", LocalID=" + to_string(m_trafficPatterns[patternId].m_nInterestsSent) +
+            auto logLine = "Sending Interest   - PatternType=" + std::to_string(patternId + 1) +
+                           ", GlobalID=" + std::to_string(m_nInterestsSent) +
+                           ", LocalID=" + std::to_string(m_trafficPatterns[patternId].m_nInterestsSent) +
                            ", Name=" + interest.getName().toUri();
             m_logger.log(logLine, true, false);
           }
 
-          timer.expires_at(timer.expires_at() +
-                           boost::posix_time::millisec(m_interestInterval.count()));
-          timer.async_wait([this, &timer] (auto&&...) { this->generateTraffic(timer); });
+          timer.expires_at(timer.expires_at() + boost::posix_time::millisec(m_interestInterval.count()));
+          timer.async_wait([this, &timer] (auto&&...) { generateTraffic(timer); });
         }
         catch (const std::exception& e) {
           m_logger.log("ERROR: "s + e.what(), true, true);
@@ -506,9 +511,8 @@
       }
     }
     if (patternId == m_trafficPatterns.size()) {
-      timer.expires_at(timer.expires_at() +
-                       boost::posix_time::millisec(m_interestInterval.count()));
-      timer.async_wait([this, &timer] (auto&&...) { this->generateTraffic(timer); });
+      timer.expires_at(timer.expires_at() + boost::posix_time::millisec(m_interestInterval.count()));
+      timer.async_wait([this, &timer] (auto&&...) { generateTraffic(timer); });
     }
   }
 
@@ -528,12 +532,11 @@
   boost::asio::io_service m_ioService;
   boost::asio::signal_set m_signalSet;
   Logger m_logger;
-  Face m_face;
+  ndn::Face m_face;
 
   std::string m_configurationFile;
-  optional<uint64_t> m_nMaximumInterests;
+  std::optional<uint64_t> m_nMaximumInterests;
   time::milliseconds m_interestInterval = 1_s;
-  bool m_wantQuiet = false;
 
   std::vector<InterestTrafficConfiguration> m_trafficPatterns;
   std::vector<uint32_t> m_nonces;
@@ -547,13 +550,14 @@
   double m_maximumInterestRoundTripTime = 0;
   double m_totalInterestRoundTripTime = 0;
 
+  bool m_wantQuiet = false;
   bool m_hasError = false;
 };
 
-} // namespace ndn
+} // namespace ndntg
 
 static void
-usage(std::ostream& os, const std::string& programName, const po::options_description& desc)
+usage(std::ostream& os, std::string_view programName, const po::options_description& desc)
 {
   os << "Usage: " << programName << " [options] <Traffic_Configuration_File>\n"
      << "\n"
@@ -613,7 +617,7 @@
     return 2;
   }
 
-  ndn::NdnTrafficClient client(configFile);
+  ndntg::NdnTrafficClient client(configFile);
 
   if (vm.count("count") > 0) {
     int count = vm["count"].as<int>();
@@ -626,7 +630,7 @@
 
   if (vm.count("interval") > 0) {
     ndn::time::milliseconds interval(vm["interval"].as<ndn::time::milliseconds::rep>());
-    if (interval <= ndn::time::milliseconds::zero()) {
+    if (interval <= 0_ms) {
       std::cerr << "ERROR: the argument for option '--interval' must be positive" << std::endl;
       return 2;
     }
diff --git a/src/ndn-traffic-server.cpp b/src/ndn-traffic-server.cpp
index b85556c..6525b7a 100644
--- a/src/ndn-traffic-server.cpp
+++ b/src/ndn-traffic-server.cpp
@@ -22,13 +22,16 @@
 
 #include <ndn-cxx/data.hpp>
 #include <ndn-cxx/face.hpp>
+#include <ndn-cxx/interest.hpp>
 #include <ndn-cxx/security/key-chain.hpp>
 #include <ndn-cxx/security/signing-info.hpp>
-#include <ndn-cxx/util/backports.hpp>
 #include <ndn-cxx/util/random.hpp>
+#include <ndn-cxx/util/time.hpp>
 
 #include <limits>
+#include <optional>
 #include <sstream>
+#include <string_view>
 #include <vector>
 
 #include <boost/asio/io_service.hpp>
@@ -40,8 +43,12 @@
 #include <boost/thread/thread.hpp>
 
 namespace po = boost::program_options;
+using namespace ndn::time_literals;
+using namespace std::string_literals;
 
-namespace ndn {
+namespace ndntg {
+
+namespace time = ndn::time;
 
 class NdnTrafficServer : boost::noncopyable
 {
@@ -77,7 +84,7 @@
   int
   run()
   {
-    m_logger.initializeLog(to_string(random::generateWord32()));
+    m_logger.initializeLog(std::to_string(ndn::random::generateWord32()));
 
     if (!readConfigurationFile(m_configurationFile, m_trafficPatterns, m_logger)) {
       return 2;
@@ -90,7 +97,7 @@
 
     m_logger.log("Traffic configuration file processing completed.\n", true, false);
     for (std::size_t i = 0; i < m_trafficPatterns.size(); i++) {
-      m_logger.log("Traffic Pattern Type #" + to_string(i + 1), false, false);
+      m_logger.log("Traffic Pattern Type #" + std::to_string(i + 1), false, false);
       m_trafficPatterns[i].printTrafficConfiguration(m_logger);
       m_logger.log("", false, false);
     }
@@ -110,9 +117,9 @@
     for (std::size_t id = 0; id < m_trafficPatterns.size(); id++) {
       m_registeredPrefixes.push_back(
         m_face.setInterestFilter(m_trafficPatterns[id].m_name,
-                                 [=] (auto&&, const auto& interest) { this->onInterest(interest, id); },
+                                 [this, id] (auto&&, const auto& interest) { onInterest(interest, id); },
                                  nullptr,
-                                 [=] (auto&&, const auto& reason) { this->onRegisterFailed(reason, id); }));
+                                 [this, id] (auto&&, const auto& reason) { onRegisterFailed(reason, id); }));
     }
 
     try {
@@ -163,7 +170,7 @@
     {
       std::string parameter, value;
       if (!extractParameterAndValue(line, parameter, value)) {
-        logger.log("Line " + to_string(lineNumber) + " - Invalid syntax: " + line,
+        logger.log("Line " + std::to_string(lineNumber) + " - Invalid syntax: " + line,
                    false, true);
         return false;
       }
@@ -187,10 +194,10 @@
         m_content = value;
       }
       else if (parameter == "SigningInfo") {
-        m_signingInfo = security::SigningInfo(value);
+        m_signingInfo = ndn::security::SigningInfo(value);
       }
       else {
-        logger.log("Line " + to_string(lineNumber) + " - Ignoring unknown parameter: " + parameter,
+        logger.log("Line " + std::to_string(lineNumber) + " - Ignoring unknown parameter: " + parameter,
                    false, true);
       }
       return true;
@@ -206,10 +213,10 @@
     std::string m_name;
     time::milliseconds m_contentDelay = -1_ms;
     time::milliseconds m_freshnessPeriod = -1_ms;
-    optional<uint32_t> m_contentType;
-    optional<std::size_t> m_contentLength;
+    std::optional<uint32_t> m_contentType;
+    std::optional<std::size_t> m_contentLength;
     std::string m_content;
-    security::SigningInfo m_signingInfo;
+    ndn::security::SigningInfo m_signingInfo;
     uint64_t m_nInterestsReceived = 0;
   };
 
@@ -218,15 +225,15 @@
   {
     m_logger.log("\n\n== Interest Traffic Report ==\n", false, true);
     m_logger.log("Total Traffic Pattern Types = " +
-                 to_string(m_trafficPatterns.size()), false, true);
+                 std::to_string(m_trafficPatterns.size()), false, true);
     m_logger.log("Total Interests Received    = " +
-                 to_string(m_nInterestsReceived), false, true);
+                 std::to_string(m_nInterestsReceived), false, true);
 
     for (std::size_t patternId = 0; patternId < m_trafficPatterns.size(); patternId++) {
-      m_logger.log("\nTraffic Pattern Type #" + to_string(patternId + 1), false, true);
+      m_logger.log("\nTraffic Pattern Type #" + std::to_string(patternId + 1), false, true);
       m_trafficPatterns[patternId].printTrafficConfiguration(m_logger);
       m_logger.log("Total Interests Received    = " +
-                   to_string(m_trafficPatterns[patternId].m_nInterestsReceived) + "\n", false, true);
+                   std::to_string(m_trafficPatterns[patternId].m_nInterestsReceived) + "\n", false, true);
     }
   }
 
@@ -247,18 +254,18 @@
     std::string s;
     s.reserve(length);
     for (std::size_t i = 0; i < length; i++) {
-      s += static_cast<char>(dist(random::getRandomNumberEngine()));
+      s += static_cast<char>(dist(ndn::random::getRandomNumberEngine()));
     }
     return s;
   }
 
   void
-  onInterest(const Interest& interest, std::size_t patternId)
+  onInterest(const ndn::Interest& interest, std::size_t patternId)
   {
     auto& pattern = m_trafficPatterns[patternId];
 
     if (!m_nMaximumInterests || m_nInterestsReceived < *m_nMaximumInterests) {
-      Data data(interest.getName());
+      ndn::Data data(interest.getName());
 
       if (pattern.m_freshnessPeriod >= 0_ms)
         data.setFreshnessPeriod(pattern.m_freshnessPeriod);
@@ -271,7 +278,7 @@
         content = getRandomByteString(*pattern.m_contentLength);
       if (!pattern.m_content.empty())
         content = pattern.m_content;
-      data.setContent(makeStringBlock(tlv::Content, content));
+      data.setContent(ndn::makeStringBlock(ndn::tlv::Content, content));
 
       m_keyChain.sign(data, pattern.m_signingInfo);
 
@@ -279,9 +286,9 @@
       pattern.m_nInterestsReceived++;
 
       if (!m_wantQuiet) {
-        auto logLine = "Interest received          - PatternType=" + to_string(patternId + 1) +
-                       ", GlobalID=" + to_string(m_nInterestsReceived) +
-                       ", LocalID=" + to_string(pattern.m_nInterestsReceived) +
+        auto logLine = "Interest received          - PatternType=" + std::to_string(patternId + 1) +
+                       ", GlobalID=" + std::to_string(m_nInterestsReceived) +
+                       ", LocalID=" + std::to_string(pattern.m_nInterestsReceived) +
                        ", Name=" + pattern.m_name;
         m_logger.log(logLine, true, false);
       }
@@ -304,7 +311,7 @@
   void
   onRegisterFailed(const std::string& reason, std::size_t patternId)
   {
-    auto logLine = "Prefix registration failed - PatternType=" + to_string(patternId + 1) +
+    auto logLine = "Prefix registration failed - PatternType=" + std::to_string(patternId + 1) +
                    ", Name=" + m_trafficPatterns[patternId].m_name +
                    ", Reason=" + reason;
     m_logger.log(logLine, true, true);
@@ -328,25 +335,26 @@
   boost::asio::io_service m_ioService;
   boost::asio::signal_set m_signalSet;
   Logger m_logger;
-  Face m_face;
-  KeyChain m_keyChain;
+  ndn::Face m_face;
+  ndn::KeyChain m_keyChain;
 
   std::string m_configurationFile;
-  optional<uint64_t> m_nMaximumInterests;
+  std::optional<uint64_t> m_nMaximumInterests;
   time::milliseconds m_contentDelay = 0_ms;
-  bool m_wantQuiet = false;
 
   std::vector<DataTrafficConfiguration> m_trafficPatterns;
-  std::vector<ScopedRegisteredPrefixHandle> m_registeredPrefixes;
+  std::vector<ndn::ScopedRegisteredPrefixHandle> m_registeredPrefixes;
   uint64_t m_nRegistrationsFailed = 0;
   uint64_t m_nInterestsReceived = 0;
+
+  bool m_wantQuiet = false;
   bool m_hasError = false;
 };
 
-} // namespace ndn
+} // namespace ndntg
 
 static void
-usage(std::ostream& os, const std::string& programName, const po::options_description& desc)
+usage(std::ostream& os, std::string_view programName, const po::options_description& desc)
 {
   os << "Usage: " << programName << " [options] <Traffic_Configuration_File>\n"
      << "\n"
@@ -406,7 +414,7 @@
     return 2;
   }
 
-  ndn::NdnTrafficServer server(configFile);
+  ndntg::NdnTrafficServer server(configFile);
 
   if (vm.count("count") > 0) {
     int count = vm["count"].as<int>();
@@ -419,7 +427,7 @@
 
   if (vm.count("delay") > 0) {
     ndn::time::milliseconds delay(vm["delay"].as<ndn::time::milliseconds::rep>());
-    if (delay < ndn::time::milliseconds::zero()) {
+    if (delay < 0_ms) {
       std::cerr << "ERROR: the argument for option '--delay' cannot be negative" << std::endl;
       return 2;
     }
diff --git a/src/util.hpp b/src/util.hpp
index bafdc39..c570c1c 100644
--- a/src/util.hpp
+++ b/src/util.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2019, Arizona Board of Regents.
+ * Copyright (c) 2014-2022, Arizona Board of Regents.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -18,8 +18,8 @@
  * Author: Jerald Paul Abraham <jeraldabraham@email.arizona.edu>
  */
 
-#ifndef NTG_UTIL_HPP
-#define NTG_UTIL_HPP
+#ifndef NDNTG_UTIL_HPP
+#define NDNTG_UTIL_HPP
 
 #include "logger.hpp"
 
@@ -28,9 +28,9 @@
 
 #include <boost/algorithm/string/predicate.hpp>
 
-namespace ndn {
+namespace ndntg {
 
-static inline bool
+inline bool
 extractParameterAndValue(const std::string& input, std::string& parameter, std::string& value)
 {
   static const std::string allowedCharacters = ":/+._-%";
@@ -60,7 +60,7 @@
   return !parameter.empty() && !value.empty() && i == input.length();
 }
 
-static inline bool
+inline bool
 parseBoolean(const std::string& input)
 {
   if (boost::iequals(input, "no") || boost::iequals(input, "off") ||
@@ -75,7 +75,7 @@
 }
 
 template<typename TrafficConfigurationType>
-static inline bool
+bool
 readConfigurationFile(const std::string& filename,
                       std::vector<TrafficConfigurationType>& patterns,
                       Logger& logger)
@@ -119,6 +119,6 @@
   return true;
 }
 
-} // namespace ndn
+} // namespace ndntg
 
-#endif // NTG_UTIL_HPP
+#endif // NDNTG_UTIL_HPP