tests+tools: minor code cleanup
Change-Id: Ic3356d4a18a8e5eeb45fc076fc0563c3d1549c8a
diff --git a/tools/ndn-autoconfig-server/program.cpp b/tools/ndn-autoconfig-server/program.cpp
index 8f624b8..d0be0d1 100644
--- a/tools/ndn-autoconfig-server/program.cpp
+++ b/tools/ndn-autoconfig-server/program.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-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -35,9 +35,9 @@
namespace tools {
namespace autoconfig_server {
-static const Name HUB_DATA_NAME("/localhop/ndn-autoconf/hub");
-static const Name ROUTABLE_PREFIXES_DATA_PREFIX("/localhop/nfd");
-static const PartialName ROUTABLE_PREFIXES_DATA_SUFFIX("rib/routable-prefixes");
+const Name HUB_DATA_NAME("/localhop/ndn-autoconf/hub");
+const Name ROUTABLE_PREFIXES_DATA_PREFIX("/localhop/nfd");
+const PartialName ROUTABLE_PREFIXES_DATA_SUFFIX("rib/routable-prefixes");
Program::Program(const Options& options, Face& face, KeyChain& keyChain)
: m_face(face)
@@ -56,7 +56,7 @@
std::string uri = hubFaceUri.toString();
auto data = make_shared<Data>(Name(HUB_DATA_NAME).appendVersion());
- data->setFreshnessPeriod(time::hours(1));
+ data->setFreshnessPeriod(1_h);
data->setContent(makeBinaryBlock(tlv::nfd::Uri,
reinterpret_cast<const uint8_t*>(uri.data()), uri.size()));
m_keyChain.sign(*data);
@@ -75,7 +75,7 @@
{
m_dispatcher.addStatusDataset(ROUTABLE_PREFIXES_DATA_SUFFIX,
mgmt::makeAcceptAllAuthorization(),
- [=] (const Name& prefix, const Interest& interest, mgmt::StatusDatasetContext& context) {
+ [=] (const Name&, const Interest&, mgmt::StatusDatasetContext& context) {
for (const Name& routablePrefix : routablePrefixes) {
context.append(routablePrefix.wireEncode());
}
@@ -84,8 +84,8 @@
m_dispatcher.addTopPrefix(ROUTABLE_PREFIXES_DATA_PREFIX, false);
m_face.registerPrefix(Name(ROUTABLE_PREFIXES_DATA_PREFIX).append(ROUTABLE_PREFIXES_DATA_SUFFIX),
- nullptr,
- bind(&Program::handlePrefixRegistrationFailure, this, _1, _2));
+ nullptr,
+ bind(&Program::handlePrefixRegistrationFailure, this, _1, _2));
}
void
diff --git a/tools/ndn-autoconfig/main.cpp b/tools/ndn-autoconfig/main.cpp
index e69ef89..859ed34 100644
--- a/tools/ndn-autoconfig/main.cpp
+++ b/tools/ndn-autoconfig/main.cpp
@@ -49,12 +49,12 @@
namespace tools {
namespace autoconfig {
-static const time::nanoseconds DAEMON_INITIAL_DELAY = 100_ms;
-static const time::nanoseconds DAEMON_UNCONDITIONAL_INTERVAL = 1_h;
-static const time::nanoseconds NETMON_DAMPEN_PERIOD = 5_s;
-
namespace po = boost::program_options;
+const time::nanoseconds DAEMON_INITIAL_DELAY = 100_ms;
+const time::nanoseconds DAEMON_UNCONDITIONAL_INTERVAL = 1_h;
+const time::nanoseconds NETMON_DAMPEN_PERIOD = 5_s;
+
static void
usage(std::ostream& os,
const po::options_description& opts,
diff --git a/tools/ndn-autoconfig/multicast-discovery.cpp b/tools/ndn-autoconfig/multicast-discovery.cpp
index c74d5f3..1baf831 100644
--- a/tools/ndn-autoconfig/multicast-discovery.cpp
+++ b/tools/ndn-autoconfig/multicast-discovery.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-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -24,7 +24,9 @@
*/
#include "multicast-discovery.hpp"
+
#include <boost/lexical_cast.hpp>
+
#include <ndn-cxx/encoding/tlv-nfd.hpp>
namespace ndn {
@@ -34,10 +36,10 @@
using nfd::ControlParameters;
using nfd::ControlResponse;
-static const Name HUB_DISCOVERY_PREFIX("/localhop/ndn-autoconf/hub");
-static const uint64_t HUB_DISCOVERY_ROUTE_COST(1);
-static const time::milliseconds HUB_DISCOVERY_ROUTE_EXPIRATION = time::seconds(30);
-static const time::milliseconds HUB_DISCOVERY_INTEREST_LIFETIME = time::seconds(4);
+const Name HUB_DISCOVERY_PREFIX("/localhop/ndn-autoconf/hub");
+const uint64_t HUB_DISCOVERY_ROUTE_COST(1);
+const time::milliseconds HUB_DISCOVERY_ROUTE_EXPIRATION = 30_s;
+const time::milliseconds HUB_DISCOVERY_INTEREST_LIFETIME = 4_s;
MulticastDiscovery::MulticastDiscovery(Face& face, nfd::Controller& controller)
: m_face(face)
diff --git a/tools/ndn-autoconfig/procedure.cpp b/tools/ndn-autoconfig/procedure.cpp
index fff88f7..dded94b 100644
--- a/tools/ndn-autoconfig/procedure.cpp
+++ b/tools/ndn-autoconfig/procedure.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-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -36,10 +36,10 @@
using nfd::ControlParameters;
using nfd::ControlResponse;
-static const time::nanoseconds FACEURI_CANONIZE_TIMEOUT = time::seconds(4);
-static const std::vector<Name> HUB_PREFIXES{"/", "/localhop/nfd"};
-static const nfd::RouteOrigin HUB_ROUTE_ORIGIN = nfd::ROUTE_ORIGIN_AUTOCONF;
-static const uint64_t HUB_ROUTE_COST = 100;
+const time::nanoseconds FACEURI_CANONIZE_TIMEOUT = 4_s;
+const std::vector<Name> HUB_PREFIXES{"/", "/localhop/nfd"};
+const nfd::RouteOrigin HUB_ROUTE_ORIGIN = nfd::ROUTE_ORIGIN_AUTOCONF;
+const uint64_t HUB_ROUTE_COST = 100;
Procedure::Procedure(Face& face, KeyChain& keyChain)
: m_face(face)
diff --git a/tools/nfdc/execute-command.cpp b/tools/nfdc/execute-command.cpp
index 92f1631..7067ebf 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-2017, Regents of the University of California,
+/*
+ * Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,7 +32,7 @@
time::nanoseconds
ExecuteContext::getTimeout() const
{
- return time::seconds(4);
+ return 4_s;
}
ndn::nfd::CommandOptions