Reduce usage of std::bind()
C++14 lambdas are easier to read, easier to debug,
and can usually be better optimized by the compiler.
Change-Id: I294f275904f91942a8de946fe63e77078a7608a6
diff --git a/core/common.hpp b/core/common.hpp
index fe95d62..a5a88eb 100644
--- a/core/common.hpp
+++ b/core/common.hpp
@@ -59,8 +59,6 @@
#include <vector>
#include <ndn-cxx/data.hpp>
-#include <ndn-cxx/delegation.hpp>
-#include <ndn-cxx/delegation-list.hpp>
#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/name.hpp>
#include <ndn-cxx/encoding/block.hpp>
@@ -68,6 +66,7 @@
#include <ndn-cxx/net/face-uri.hpp>
#include <ndn-cxx/util/backports.hpp>
#include <ndn-cxx/util/exception.hpp>
+#include <ndn-cxx/util/optional.hpp>
#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/signal.hpp>
#include <ndn-cxx/util/time.hpp>
@@ -94,8 +93,6 @@
using std::dynamic_pointer_cast;
using std::const_pointer_cast;
-using std::bind;
-
using namespace std::string_literals;
using ndn::optional;
@@ -104,8 +101,6 @@
using ndn::Block;
using ndn::Data;
-using ndn::Delegation;
-using ndn::DelegationList;
using ndn::FaceUri;
using ndn::Interest;
using ndn::Name;
diff --git a/daemon/face/face-system.cpp b/daemon/face/face-system.cpp
index 5601057..79cb436 100644
--- a/daemon/face/face-system.cpp
+++ b/daemon/face/face-system.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -94,7 +94,9 @@
void
FaceSystem::setConfigFile(ConfigFile& configFile)
{
- configFile.addSectionHandler(CFGSEC_FACESYSTEM, bind(&FaceSystem::processConfig, this, _1, _2, _3));
+ configFile.addSectionHandler(CFGSEC_FACESYSTEM, [this] (auto&&... args) {
+ processConfig(std::forward<decltype(args)>(args)...);
+ });
}
void
diff --git a/daemon/face/generic-link-service.cpp b/daemon/face/generic-link-service.cpp
index 819a91a..5ed4ac2 100644
--- a/daemon/face/generic-link-service.cpp
+++ b/daemon/face/generic-link-service.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -45,11 +45,11 @@
, m_reassembler(m_options.reassemblerOptions, this)
, m_reliability(m_options.reliabilityOptions, this)
, m_lastSeqNo(-2)
- , m_nextMarkTime(time::steady_clock::TimePoint::max())
+ , m_nextMarkTime(time::steady_clock::time_point::max())
, m_nMarkedSinceInMarkingState(0)
{
- m_reassembler.beforeTimeout.connect([this] (auto...) { ++this->nReassemblyTimeouts; });
- m_reliability.onDroppedInterest.connect([this] (const auto& i) { this->notifyDroppedInterest(i); });
+ m_reassembler.beforeTimeout.connect([this] (auto&&...) { ++nReassemblyTimeouts; });
+ m_reliability.onDroppedInterest.connect([this] (const auto& i) { notifyDroppedInterest(i); });
nReassembling.observe(&m_reassembler);
}
@@ -105,7 +105,7 @@
auto block = pkt.wireEncode();
if (mtu != MTU_UNLIMITED && block.size() > static_cast<size_t>(mtu)) {
- ++this->nOutOverMtu;
+ ++nOutOverMtu;
NFD_LOG_FACE_WARN("attempted to send packet over MTU limit");
return;
}
@@ -207,7 +207,7 @@
std::tie(isOk, frags) = m_fragmenter.fragmentPacket(pkt, mtu);
if (!isOk) {
// fragmentation failed (warning is logged by LpFragmenter)
- ++this->nFragmentationErrors;
+ ++nFragmentationErrors;
return;
}
}
@@ -261,7 +261,7 @@
if (static_cast<size_t>(sendQueueLength) > m_options.defaultCongestionThreshold) {
const auto now = time::steady_clock::now();
- if (m_nextMarkTime == time::steady_clock::TimePoint::max()) {
+ if (m_nextMarkTime == time::steady_clock::time_point::max()) {
m_nextMarkTime = now + m_options.baseCongestionMarkingInterval;
}
// Mark packet if sendQueue stays above target for one interval
@@ -279,10 +279,10 @@
m_nextMarkTime += interval;
}
}
- else if (m_nextMarkTime != time::steady_clock::TimePoint::max()) {
+ else if (m_nextMarkTime != time::steady_clock::time_point::max()) {
// Congestion incident has ended, so reset
NFD_LOG_FACE_DEBUG("Send queue length dropped below congestion threshold");
- m_nextMarkTime = time::steady_clock::TimePoint::max();
+ m_nextMarkTime = time::steady_clock::time_point::max();
m_nMarkedSinceInMarkingState = 0;
}
}
@@ -296,7 +296,7 @@
if (m_options.reliabilityOptions.isEnabled) {
if (!m_reliability.processIncomingPacket(pkt)) {
NFD_LOG_FACE_TRACE("received duplicate fragment: DROP");
- ++this->nDuplicateSequence;
+ ++nDuplicateSequence;
return;
}
}
@@ -321,7 +321,7 @@
}
}
catch (const tlv::Error& e) {
- ++this->nInLpInvalid;
+ ++nInLpInvalid;
NFD_LOG_FACE_WARN("packet parse error (" << e.what() << "): DROP");
}
}
@@ -344,13 +344,13 @@
this->decodeData(netPkt, firstPkt, endpointId);
break;
default:
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("unrecognized network-layer packet TLV-TYPE " << netPkt.type() << ": DROP");
return;
}
}
catch (const tlv::Error& e) {
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("packet parse error (" << e.what() << "): DROP");
}
}
@@ -376,7 +376,7 @@
}
if (firstPkt.has<lp::CachePolicyField>()) {
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("received CachePolicy with Interest: DROP");
return;
}
@@ -399,7 +399,7 @@
}
if (firstPkt.has<lp::PrefixAnnouncementField>()) {
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("received PrefixAnnouncement with Interest: DROP");
return;
}
@@ -421,13 +421,13 @@
auto data = make_shared<Data>(netPkt);
if (firstPkt.has<lp::NackField>()) {
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("received Nack with Data: DROP");
return;
}
if (firstPkt.has<lp::NextHopFaceIdField>()) {
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("received NextHopFaceId with Data: DROP");
return;
}
@@ -448,7 +448,7 @@
}
if (firstPkt.has<lp::NonDiscoveryField>()) {
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("received NonDiscovery with Data: DROP");
return;
}
@@ -476,13 +476,13 @@
nack.setHeader(firstPkt.get<lp::NackField>());
if (firstPkt.has<lp::NextHopFaceIdField>()) {
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("received NextHopFaceId with Nack: DROP");
return;
}
if (firstPkt.has<lp::CachePolicyField>()) {
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("received CachePolicy with Nack: DROP");
return;
}
@@ -496,13 +496,13 @@
}
if (firstPkt.has<lp::NonDiscoveryField>()) {
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("received NonDiscovery with Nack: DROP");
return;
}
if (firstPkt.has<lp::PrefixAnnouncementField>()) {
- ++this->nInNetInvalid;
+ ++nInNetInvalid;
NFD_LOG_FACE_WARN("received PrefixAnnouncement with Nack: DROP");
return;
}
diff --git a/daemon/face/network-predicate.cpp b/daemon/face/network-predicate.cpp
index 31a2cf8..07de63c 100644
--- a/daemon/face/network-predicate.cpp
+++ b/daemon/face/network-predicate.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -198,8 +198,10 @@
bool
NetworkInterfacePredicate::operator()(const ndn::net::NetworkInterface& netif) const
{
- return std::any_of(m_whitelist.begin(), m_whitelist.end(), bind(&doesNetifMatchRule, std::cref(netif), _1)) &&
- std::none_of(m_blacklist.begin(), m_blacklist.end(), bind(&doesNetifMatchRule, std::cref(netif), _1));
+ return std::any_of(m_whitelist.begin(), m_whitelist.end(),
+ [&netif] (const auto& rule) { return doesNetifMatchRule(netif, rule); }) &&
+ std::none_of(m_blacklist.begin(), m_blacklist.end(),
+ [&netif] (const auto& rule) { return doesNetifMatchRule(netif, rule); });
}
static bool
@@ -219,8 +221,10 @@
bool
IpAddressPredicate::operator()(const boost::asio::ip::address& address) const
{
- return std::any_of(m_whitelist.begin(), m_whitelist.end(), bind(&doesAddressMatchRule, std::cref(address), _1)) &&
- std::none_of(m_blacklist.begin(), m_blacklist.end(), bind(&doesAddressMatchRule, std::cref(address), _1));
+ return std::any_of(m_whitelist.begin(), m_whitelist.end(),
+ [&address] (const auto& rule) { return doesAddressMatchRule(address, rule); }) &&
+ std::none_of(m_blacklist.begin(), m_blacklist.end(),
+ [&address] (const auto& rule) { return doesAddressMatchRule(address, rule); });
}
} // namespace face
diff --git a/daemon/face/tcp-factory.cpp b/daemon/face/tcp-factory.cpp
index f45d786..89e34d5 100644
--- a/daemon/face/tcp-factory.cpp
+++ b/daemon/face/tcp-factory.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -200,8 +200,9 @@
if (it != m_channels.end())
return it->second;
- auto channel = make_shared<TcpChannel>(endpoint, m_wantCongestionMarking,
- bind(&TcpFactory::determineFaceScopeFromAddresses, this, _1, _2));
+ auto channel = make_shared<TcpChannel>(endpoint, m_wantCongestionMarking, [this] (auto&&... args) {
+ return determineFaceScopeFromAddresses(std::forward<decltype(args)>(args)...);
+ });
m_channels[endpoint] = channel;
return channel;
}
diff --git a/daemon/face/udp-factory.cpp b/daemon/face/udp-factory.cpp
index 9eabd42..8f7f77c 100644
--- a/daemon/face/udp-factory.cpp
+++ b/daemon/face/udp-factory.cpp
@@ -434,7 +434,7 @@
NFD_LOG_DEBUG("Not creating multicast faces on " << netif->getName() << ": no viable IP address");
// keep an eye on new addresses
m_netifConns[netif->getIndex()].addrAddConn =
- netif->onAddressAdded.connect([=] (auto...) { this->applyMcastConfigToNetif(netif); });
+ netif->onAddressAdded.connect([=] (auto&&...) { this->applyMcastConfigToNetif(netif); });
return {};
}
diff --git a/daemon/face/websocket-channel.cpp b/daemon/face/websocket-channel.cpp
index 13f6f38..957c9ad 100644
--- a/daemon/face/websocket-channel.cpp
+++ b/daemon/face/websocket-channel.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -53,13 +53,13 @@
}
return websocketpp::lib::error_code{};
});
- m_server.set_open_handler(bind(&WebSocketChannel::handleOpen, this, _1));
- m_server.set_close_handler(bind(&WebSocketChannel::handleClose, this, _1));
- m_server.set_message_handler(bind(&WebSocketChannel::handleMessage, this, _1, _2));
+ m_server.set_open_handler(std::bind(&WebSocketChannel::handleOpen, this, _1));
+ m_server.set_close_handler(std::bind(&WebSocketChannel::handleClose, this, _1));
+ m_server.set_message_handler(std::bind(&WebSocketChannel::handleMessage, this, _1, _2));
// Detect disconnections using ping-pong messages
- m_server.set_pong_handler(bind(&WebSocketChannel::handlePong, this, _1));
- m_server.set_pong_timeout_handler(bind(&WebSocketChannel::handlePongTimeout, this, _1));
+ m_server.set_pong_handler(std::bind(&WebSocketChannel::handlePong, this, _1));
+ m_server.set_pong_timeout_handler(std::bind(&WebSocketChannel::handlePongTimeout, this, _1));
// Always set SO_REUSEADDR flag
m_server.set_reuse_addr(true);
diff --git a/daemon/fw/algorithm.cpp b/daemon/fw/algorithm.cpp
index a5d692f..a4d864b 100644
--- a/daemon/fw/algorithm.cpp
+++ b/daemon/fw/algorithm.cpp
@@ -84,7 +84,7 @@
bool
hasPendingOutRecords(const pit::Entry& pitEntry)
{
- time::steady_clock::TimePoint now = time::steady_clock::now();
+ auto now = time::steady_clock::now();
return std::any_of(pitEntry.out_begin(), pitEntry.out_end(),
[&now] (const pit::OutRecord& outRecord) {
return outRecord.getExpiry() >= now &&
@@ -92,7 +92,7 @@
});
}
-time::steady_clock::TimePoint
+time::steady_clock::time_point
getLastOutgoing(const pit::Entry& pitEntry)
{
pit::OutRecordCollection::const_iterator lastOutgoing = std::max_element(
@@ -111,7 +111,7 @@
const shared_ptr<pit::Entry>& pitEntry)
{
auto found = nexthops.end();
- auto earliestRenewed = time::steady_clock::TimePoint::max();
+ auto earliestRenewed = time::steady_clock::time_point::max();
for (auto it = nexthops.begin(); it != nexthops.end(); ++it) {
if (!isNextHopEligible(inFace, interest, *it, pitEntry))
@@ -132,7 +132,7 @@
const fib::NextHop& nexthop,
const shared_ptr<pit::Entry>& pitEntry,
bool wantUnused,
- time::steady_clock::TimePoint now)
+ time::steady_clock::time_point now)
{
const Face& outFace = nexthop.getFace();
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 3683734..d984f0c 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -40,7 +40,7 @@
NFD_LOG_INIT(Forwarder);
-const std::string CFGSEC_FORWARDER = "forwarder";
+const std::string CFG_FORWARDER = "forwarder";
static Name
getDefaultStrategyName()
@@ -607,7 +607,9 @@
void
Forwarder::setConfigFile(ConfigFile& configFile)
{
- configFile.addSectionHandler(CFGSEC_FORWARDER, bind(&Forwarder::processConfig, this, _1, _2, _3));
+ configFile.addSectionHandler(CFG_FORWARDER, [this] (auto&&... args) {
+ processConfig(std::forward<decltype(args)>(args)...);
+ });
}
void
@@ -618,10 +620,10 @@
for (const auto& pair : configSection) {
const std::string& key = pair.first;
if (key == "default_hop_limit") {
- config.defaultHopLimit = ConfigFile::parseNumber<uint8_t>(pair, CFGSEC_FORWARDER);
+ config.defaultHopLimit = ConfigFile::parseNumber<uint8_t>(pair, CFG_FORWARDER);
}
else {
- NDN_THROW(ConfigFile::Error("Unrecognized option " + CFGSEC_FORWARDER + "." + key));
+ NDN_THROW(ConfigFile::Error("Unrecognized option " + CFG_FORWARDER + "." + key));
}
}
diff --git a/daemon/fw/retx-suppression-fixed.cpp b/daemon/fw/retx-suppression-fixed.cpp
index dddd742..50ade91 100644
--- a/daemon/fw/retx-suppression-fixed.cpp
+++ b/daemon/fw/retx-suppression-fixed.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -44,9 +44,9 @@
return RetxSuppressionResult::NEW;
}
- time::steady_clock::TimePoint lastOutgoing = getLastOutgoing(pitEntry);
- time::steady_clock::TimePoint now = time::steady_clock::now();
- time::steady_clock::Duration sinceLastOutgoing = now - lastOutgoing;
+ auto lastOutgoing = getLastOutgoing(pitEntry);
+ auto now = time::steady_clock::now();
+ auto sinceLastOutgoing = now - lastOutgoing;
bool shouldSuppress = sinceLastOutgoing < m_minRetxInterval;
return shouldSuppress ? RetxSuppressionResult::SUPPRESS : RetxSuppressionResult::FORWARD;
}
diff --git a/daemon/fw/strategy.cpp b/daemon/fw/strategy.cpp
index 9cfb3be..8762e24 100644
--- a/daemon/fw/strategy.cpp
+++ b/daemon/fw/strategy.cpp
@@ -291,13 +291,13 @@
return fibEntry;
}
- const DelegationList& fh = interest.getForwardingHint();
+ const auto& fh = interest.getForwardingHint();
// Forwarding hint should have been stripped by incoming Interest pipeline when reaching producer region
BOOST_ASSERT(!m_forwarder.getNetworkRegionTable().isInProducerRegion(fh));
const fib::Entry* fibEntry = nullptr;
- for (const Delegation& del : fh) {
- fibEntry = &fib.findLongestPrefixMatch(del.name);
+ for (const auto& delegation : fh) {
+ fibEntry = &fib.findLongestPrefixMatch(delegation.name);
if (fibEntry->hasNextHops()) {
if (fibEntry->getPrefix().size() == 0) {
// in consumer region, return the default route
@@ -305,7 +305,7 @@
}
else {
// in default-free zone, use the first delegation that finds a FIB entry
- NFD_LOG_TRACE("lookupFib delegation=" << del.name << " found=" << fibEntry->getPrefix());
+ NFD_LOG_TRACE("lookupFib delegation=" << delegation.name << " found=" << fibEntry->getPrefix());
}
return *fibEntry;
}
diff --git a/daemon/main.cpp b/daemon/main.cpp
index 1b529fb..6d29646 100644
--- a/daemon/main.cpp
+++ b/daemon/main.cpp
@@ -82,15 +82,15 @@
NfdRunner(const std::string& configFile)
: m_nfd(configFile, m_nfdKeyChain)
, m_configFile(configFile)
- , m_terminationSignalSet(getGlobalIoService())
- , m_reloadSignalSet(getGlobalIoService())
+ , m_terminateSignals(getGlobalIoService(), SIGINT, SIGTERM)
+ , m_reloadSignals(getGlobalIoService(), SIGHUP)
{
- m_terminationSignalSet.add(SIGINT);
- m_terminationSignalSet.add(SIGTERM);
- m_terminationSignalSet.async_wait(bind(&NfdRunner::terminate, this, _1, _2));
-
- m_reloadSignalSet.add(SIGHUP);
- m_reloadSignalSet.async_wait(bind(&NfdRunner::reload, this, _1, _2));
+ m_terminateSignals.async_wait([this] (auto&&... args) {
+ terminate(std::forward<decltype(args)>(args)...);
+ });
+ m_reloadSignals.async_wait([this] (auto&&... args) {
+ reload(std::forward<decltype(args)>(args)...);
+ });
}
void
@@ -210,7 +210,9 @@
m_nfd.reloadConfigFile();
systemdNotify("READY=1");
- m_reloadSignalSet.async_wait(bind(&NfdRunner::reload, this, _1, _2));
+ m_reloadSignals.async_wait([this] (auto&&... args) {
+ reload(std::forward<decltype(args)>(args)...);
+ });
}
private:
@@ -218,8 +220,8 @@
Nfd m_nfd;
std::string m_configFile;
- boost::asio::signal_set m_terminationSignalSet;
- boost::asio::signal_set m_reloadSignalSet;
+ boost::asio::signal_set m_terminateSignals;
+ boost::asio::signal_set m_reloadSignals;
};
static void
diff --git a/daemon/mgmt/command-authenticator.cpp b/daemon/mgmt/command-authenticator.cpp
index 2196889..7c3cb23 100644
--- a/daemon/mgmt/command-authenticator.cpp
+++ b/daemon/mgmt/command-authenticator.cpp
@@ -107,8 +107,9 @@
void
CommandAuthenticator::setConfigFile(ConfigFile& configFile)
{
- configFile.addSectionHandler("authorizations",
- bind(&CommandAuthenticator::processConfig, this, _1, _2, _3));
+ configFile.addSectionHandler("authorizations", [this] (auto&&... args) {
+ processConfig(std::forward<decltype(args)>(args)...);
+ });
}
void
diff --git a/daemon/mgmt/cs-manager.cpp b/daemon/mgmt/cs-manager.cpp
index 50c3001..eaf2cda 100644
--- a/daemon/mgmt/cs-manager.cpp
+++ b/daemon/mgmt/cs-manager.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -40,11 +40,11 @@
, m_fwCounters(fwCounters)
{
registerCommandHandler<ndn::nfd::CsConfigCommand>("config",
- bind(&CsManager::changeConfig, this, _4, _5));
+ std::bind(&CsManager::changeConfig, this, _4, _5));
registerCommandHandler<ndn::nfd::CsEraseCommand>("erase",
- bind(&CsManager::erase, this, _4, _5));
+ std::bind(&CsManager::erase, this, _4, _5));
- registerStatusDatasetHandler("info", bind(&CsManager::serveInfo, this, _1, _2, _3));
+ registerStatusDatasetHandler("info", std::bind(&CsManager::serveInfo, this, _1, _2, _3));
}
void
diff --git a/daemon/mgmt/face-manager.cpp b/daemon/mgmt/face-manager.cpp
index a6ff3df..1d38f43 100644
--- a/daemon/mgmt/face-manager.cpp
+++ b/daemon/mgmt/face-manager.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -47,14 +47,17 @@
, m_faceTable(faceSystem.getFaceTable())
{
// register handlers for ControlCommand
- registerCommandHandler<ndn::nfd::FaceCreateCommand>("create", bind(&FaceManager::createFace, this, _4, _5));
- registerCommandHandler<ndn::nfd::FaceUpdateCommand>("update", bind(&FaceManager::updateFace, this, _3, _4, _5));
- registerCommandHandler<ndn::nfd::FaceDestroyCommand>("destroy", bind(&FaceManager::destroyFace, this, _4, _5));
+ registerCommandHandler<ndn::nfd::FaceCreateCommand>("create",
+ std::bind(&FaceManager::createFace, this, _4, _5));
+ registerCommandHandler<ndn::nfd::FaceUpdateCommand>("update",
+ std::bind(&FaceManager::updateFace, this, _3, _4, _5));
+ registerCommandHandler<ndn::nfd::FaceDestroyCommand>("destroy",
+ std::bind(&FaceManager::destroyFace, this, _4, _5));
// register handlers for StatusDataset
- registerStatusDatasetHandler("list", bind(&FaceManager::listFaces, this, _3));
- registerStatusDatasetHandler("channels", bind(&FaceManager::listChannels, this, _3));
- registerStatusDatasetHandler("query", bind(&FaceManager::queryFaces, this, _2, _3));
+ registerStatusDatasetHandler("list", std::bind(&FaceManager::listFaces, this, _3));
+ registerStatusDatasetHandler("channels", std::bind(&FaceManager::listChannels, this, _3));
+ registerStatusDatasetHandler("query", std::bind(&FaceManager::queryFaces, this, _2, _3));
// register notification stream
m_postNotification = registerNotificationStream("events");
@@ -359,13 +362,13 @@
}
static ndn::nfd::FaceStatus
-makeFaceStatus(const Face& face, const time::steady_clock::TimePoint& now)
+makeFaceStatus(const Face& face, const time::steady_clock::time_point& now)
{
ndn::nfd::FaceStatus status;
copyFaceProperties(face, status);
auto expirationTime = face.getExpirationTime();
- if (expirationTime != time::steady_clock::TimePoint::max()) {
+ if (expirationTime != time::steady_clock::time_point::max()) {
status.setExpirationPeriod(std::max(0_ms,
time::duration_cast<time::milliseconds>(expirationTime - now)));
}
diff --git a/daemon/mgmt/fib-manager.cpp b/daemon/mgmt/fib-manager.cpp
index c048da5..f8a99d8 100644
--- a/daemon/mgmt/fib-manager.cpp
+++ b/daemon/mgmt/fib-manager.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -45,11 +45,11 @@
, m_faceTable(faceTable)
{
registerCommandHandler<ndn::nfd::FibAddNextHopCommand>("add-nexthop",
- bind(&FibManager::addNextHop, this, _2, _3, _4, _5));
+ std::bind(&FibManager::addNextHop, this, _2, _3, _4, _5));
registerCommandHandler<ndn::nfd::FibRemoveNextHopCommand>("remove-nexthop",
- bind(&FibManager::removeNextHop, this, _2, _3, _4, _5));
+ std::bind(&FibManager::removeNextHop, this, _2, _3, _4, _5));
- registerStatusDatasetHandler("list", bind(&FibManager::listEntries, this, _1, _2, _3));
+ registerStatusDatasetHandler("list", std::bind(&FibManager::listEntries, this, _1, _2, _3));
}
void
diff --git a/daemon/mgmt/forwarder-status-manager.cpp b/daemon/mgmt/forwarder-status-manager.cpp
index 5d4cb4d..818d054 100644
--- a/daemon/mgmt/forwarder-status-manager.cpp
+++ b/daemon/mgmt/forwarder-status-manager.cpp
@@ -35,7 +35,7 @@
, m_startTimestamp(time::system_clock::now())
{
m_dispatcher.addStatusDataset("status/general", ndn::mgmt::makeAcceptAllAuthorization(),
- bind(&ForwarderStatusManager::listGeneralStatus, this, _1, _2, _3));
+ std::bind(&ForwarderStatusManager::listGeneralStatus, this, _1, _2, _3));
}
ndn::nfd::ForwarderStatus
diff --git a/daemon/mgmt/manager-base.cpp b/daemon/mgmt/manager-base.cpp
index 49f5b8b..a39bbd6 100644
--- a/daemon/mgmt/manager-base.cpp
+++ b/daemon/mgmt/manager-base.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -59,7 +59,8 @@
}
void
-ManagerBase::extractRequester(const Interest& interest, ndn::mgmt::AcceptContinuation accept)
+ManagerBase::extractRequester(const Interest& interest,
+ const ndn::mgmt::AcceptContinuation& accept)
{
const Name& interestName = interest.getName();
@@ -103,7 +104,7 @@
const ControlCommandHandler& handler,
const Name& prefix, const Interest& interest,
const ndn::mgmt::ControlParameters& params,
- ndn::mgmt::CommandContinuation done)
+ const ndn::mgmt::CommandContinuation& done)
{
BOOST_ASSERT(dynamic_cast<const ControlParameters*>(¶ms) != nullptr);
diff --git a/daemon/mgmt/manager-base.hpp b/daemon/mgmt/manager-base.hpp
index e061217..eeb55f5 100644
--- a/daemon/mgmt/manager-base.hpp
+++ b/daemon/mgmt/manager-base.hpp
@@ -97,10 +97,10 @@
* This is called after the signature has been validated.
*
* @param interest a request for ControlCommand
- * @param accept callback of successful validation, takes the requester string as a argument
+ * @param accept callback of successful validation, takes the requester string as argument
*/
- void
- extractRequester(const Interest& interest, ndn::mgmt::AcceptContinuation accept);
+ static void
+ extractRequester(const Interest& interest, const ndn::mgmt::AcceptContinuation& accept);
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE:
/**
@@ -127,7 +127,7 @@
const ControlCommandHandler& handler,
const Name& prefix, const Interest& interest,
const ndn::mgmt::ControlParameters& params,
- ndn::mgmt::CommandContinuation done);
+ const ndn::mgmt::CommandContinuation& done);
/**
* @brief Generates the relative prefix for a handler by appending the verb name to the module name.
@@ -148,7 +148,7 @@
};
template<typename Command>
-inline void
+void
ManagerBase::registerCommandHandler(const std::string& verb,
const ControlCommandHandler& handler)
{
@@ -157,8 +157,8 @@
m_dispatcher.addControlCommand<ControlParameters>(
makeRelPrefix(verb),
makeAuthorization(verb),
- bind(&ManagerBase::validateParameters, std::cref(*command), _1),
- bind(&ManagerBase::handleCommand, command, handler, _1, _2, _3, _4));
+ [=] (const auto& params) { return validateParameters(*command, params); },
+ [=] (auto&&... args) { handleCommand(command, handler, std::forward<decltype(args)>(args)...); });
}
} // namespace nfd
diff --git a/daemon/mgmt/rib-manager.cpp b/daemon/mgmt/rib-manager.cpp
index 68b061e..4e444bf 100644
--- a/daemon/mgmt/rib-manager.cpp
+++ b/daemon/mgmt/rib-manager.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -62,11 +62,11 @@
, m_isLocalhopEnabled(false)
{
registerCommandHandler<ndn::nfd::RibRegisterCommand>("register",
- bind(&RibManager::registerEntry, this, _2, _3, _4, _5));
+ std::bind(&RibManager::registerEntry, this, _2, _3, _4, _5));
registerCommandHandler<ndn::nfd::RibUnregisterCommand>("unregister",
- bind(&RibManager::unregisterEntry, this, _2, _3, _4, _5));
+ std::bind(&RibManager::unregisterEntry, this, _2, _3, _4, _5));
- registerStatusDatasetHandler("list", bind(&RibManager::listEntries, this, _1, _2, _3));
+ registerStatusDatasetHandler("list", std::bind(&RibManager::listEntries, this, _1, _2, _3));
}
void
@@ -104,7 +104,7 @@
}
NFD_LOG_INFO("Start monitoring face create/destroy events");
- m_faceMonitor.onNotification.connect(bind(&RibManager::onNotification, this, _1));
+ m_faceMonitor.onNotification.connect([this] (const auto& notif) { onNotification(notif); });
m_faceMonitor.start();
scheduleActiveFaceFetch(ACTIVE_FACE_FETCH_INTERVAL);
@@ -248,7 +248,7 @@
}
void
-RibManager::unregisterEntry(const Name& topPrefix, const Interest& interest,
+RibManager::unregisterEntry(const Name&, const Interest& interest,
ControlParameters parameters,
const ndn::mgmt::CommandContinuation& done)
{
@@ -265,7 +265,7 @@
}
void
-RibManager::listEntries(const Name& topPrefix, const Interest& interest,
+RibManager::listEntries(const Name&, const Interest& interest,
ndn::mgmt::StatusDatasetContext& context)
{
auto now = time::steady_clock::now();
@@ -304,7 +304,7 @@
}
ndn::mgmt::Authorization
-RibManager::makeAuthorization(const std::string& verb)
+RibManager::makeAuthorization(const std::string&)
{
return [this] (const Name& prefix, const Interest& interest,
const ndn::mgmt::ControlParameters* params,
@@ -316,8 +316,8 @@
auto& validator = prefix == LOCALHOST_TOP_PREFIX ? m_localhostValidator : m_localhopValidator;
validator.validate(interest,
- bind([&interest, this, accept] { extractRequester(interest, accept); }),
- bind([reject] { reject(ndn::mgmt::RejectReply::STATUS403); }));
+ [&interest, accept] (auto&&...) { extractRequester(interest, accept); },
+ [reject] (auto&&...) { reject(ndn::mgmt::RejectReply::STATUS403); });
};
}
@@ -429,8 +429,8 @@
NFD_LOG_DEBUG("Fetching active faces");
m_nfdController.fetch<ndn::nfd::FaceDataset>(
- bind(&RibManager::removeInvalidFaces, this, _1),
- bind(&RibManager::onFetchActiveFacesFailure, this, _1, _2),
+ std::bind(&RibManager::removeInvalidFaces, this, _1),
+ std::bind(&RibManager::onFetchActiveFacesFailure, this, _1, _2),
ndn::nfd::CommandOptions());
}
diff --git a/daemon/mgmt/strategy-choice-manager.cpp b/daemon/mgmt/strategy-choice-manager.cpp
index 169ce2e..9be09d2 100644
--- a/daemon/mgmt/strategy-choice-manager.cpp
+++ b/daemon/mgmt/strategy-choice-manager.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -41,12 +41,12 @@
, m_table(strategyChoice)
{
registerCommandHandler<ndn::nfd::StrategyChoiceSetCommand>("set",
- bind(&StrategyChoiceManager::setStrategy, this, _4, _5));
+ std::bind(&StrategyChoiceManager::setStrategy, this, _4, _5));
registerCommandHandler<ndn::nfd::StrategyChoiceUnsetCommand>("unset",
- bind(&StrategyChoiceManager::unsetStrategy, this, _4, _5));
+ std::bind(&StrategyChoiceManager::unsetStrategy, this, _4, _5));
registerStatusDatasetHandler("list",
- bind(&StrategyChoiceManager::listChoices, this, _3));
+ std::bind(&StrategyChoiceManager::listChoices, this, _3));
}
void
diff --git a/daemon/mgmt/tables-config-section.cpp b/daemon/mgmt/tables-config-section.cpp
index e5383a4..f6adced 100644
--- a/daemon/mgmt/tables-config-section.cpp
+++ b/daemon/mgmt/tables-config-section.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,7 +28,7 @@
namespace nfd {
-const size_t TablesConfigSection::DEFAULT_CS_MAX_PACKETS = 65536;
+const size_t DEFAULT_CS_MAX_PACKETS = 65536;
TablesConfigSection::TablesConfigSection(Forwarder& forwarder)
: m_forwarder(forwarder)
@@ -39,8 +39,9 @@
void
TablesConfigSection::setConfigFile(ConfigFile& configFile)
{
- configFile.addSectionHandler("tables",
- bind(&TablesConfigSection::processConfig, this, _1, _2));
+ configFile.addSectionHandler("tables", [this] (auto&&... args) {
+ processConfig(std::forward<decltype(args)>(args)...);
+ });
}
void
@@ -58,7 +59,7 @@
}
void
-TablesConfigSection::processConfig(const ConfigSection& section, bool isDryRun)
+TablesConfigSection::processConfig(const ConfigSection& section, bool isDryRun, const std::string&)
{
size_t nCsMaxPackets = DEFAULT_CS_MAX_PACKETS;
OptionalConfigSection csMaxPacketsNode = section.get_child_optional("cs_max_packets");
diff --git a/daemon/mgmt/tables-config-section.hpp b/daemon/mgmt/tables-config-section.hpp
index c2cfec5..f551b78 100644
--- a/daemon/mgmt/tables-config-section.hpp
+++ b/daemon/mgmt/tables-config-section.hpp
@@ -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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -83,7 +83,7 @@
private:
void
- processConfig(const ConfigSection& section, bool isDryRun);
+ processConfig(const ConfigSection& section, bool isDryRun, const std::string& filename);
void
processStrategyChoiceSection(const ConfigSection& section, bool isDryRun);
@@ -92,10 +92,7 @@
processNetworkRegionSection(const ConfigSection& section, bool isDryRun);
private:
- static const size_t DEFAULT_CS_MAX_PACKETS;
-
Forwarder& m_forwarder;
-
bool m_isConfigured;
};
diff --git a/daemon/rib/fib-updater.cpp b/daemon/rib/fib-updater.cpp
index 6e600e4..5208e61 100644
--- a/daemon/rib/fib-updater.cpp
+++ b/daemon/rib/fib-updater.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -95,13 +95,13 @@
const Name& prefix = update.getName();
const Route& route = update.getRoute();
- Rib::const_iterator it = m_rib.find(prefix);
+ auto it = m_rib.find(prefix);
// Name prefix exists
if (it != m_rib.end()) {
shared_ptr<const RibEntry> entry(it->second);
- RibEntry::const_iterator existingRoute = entry->findRoute(route);
+ auto existingRoute = entry->findRoute(route);
// Route will be new
if (existingRoute == entry->end()) {
@@ -114,8 +114,7 @@
// Route already exists
RibEntry entryCopy = *entry;
- Route& routeToUpdate = *(entryCopy.findRoute(route));
-
+ Route& routeToUpdate = *entryCopy.findRoute(route);
routeToUpdate.flags = route.flags;
routeToUpdate.cost = route.cost;
routeToUpdate.expires = route.expires;
@@ -149,16 +148,14 @@
const Name& prefix = update.getName();
const Route& route = update.getRoute();
- Rib::const_iterator ribIt = m_rib.find(prefix);
+ auto ribIt = m_rib.find(prefix);
// Name prefix exists
if (ribIt != m_rib.end()) {
shared_ptr<const RibEntry> entry(ribIt->second);
-
const bool hadCapture = entry->hasCapture();
- RibEntry::const_iterator existing = entry->findRoute(route);
-
+ auto existing = entry->findRoute(route);
if (existing != entry->end()) {
RibEntry temp = *entry;
@@ -240,8 +237,8 @@
.setName(update.name)
.setFaceId(update.faceId)
.setCost(update.cost),
- bind(&FibUpdater::onUpdateSuccess, this, update, onSuccess, onFailure),
- bind(&FibUpdater::onUpdateError, this, update, onSuccess, onFailure, _1, nTimeouts));
+ [=] (const auto&) { onUpdateSuccess(update, onSuccess, onFailure); },
+ [=] (const auto& resp) { onUpdateError(update, onSuccess, onFailure, resp, nTimeouts); });
}
void
@@ -254,12 +251,12 @@
ControlParameters()
.setName(update.name)
.setFaceId(update.faceId),
- bind(&FibUpdater::onUpdateSuccess, this, update, onSuccess, onFailure),
- bind(&FibUpdater::onUpdateError, this, update, onSuccess, onFailure, _1, nTimeouts));
+ [=] (const auto&) { onUpdateSuccess(update, onSuccess, onFailure); },
+ [=] (const auto& resp) { onUpdateError(update, onSuccess, onFailure, resp, nTimeouts); });
}
void
-FibUpdater::onUpdateSuccess(const FibUpdate update,
+FibUpdater::onUpdateSuccess(const FibUpdate& update,
const FibUpdateSuccessCallback& onSuccess,
const FibUpdateFailureCallback& onFailure)
{
@@ -280,7 +277,7 @@
}
void
-FibUpdater::onUpdateError(const FibUpdate update,
+FibUpdater::onUpdateError(const FibUpdate& update,
const FibUpdateSuccessCallback& onSuccess,
const FibUpdateFailureCallback& onFailure,
const ndn::nfd::ControlResponse& response, uint32_t nTimeouts)
@@ -310,14 +307,13 @@
}
void
-FibUpdater::addFibUpdate(FibUpdate update)
+FibUpdater::addFibUpdate(const FibUpdate& update)
{
FibUpdateList& updates = (update.faceId == m_batchFaceId) ? m_updatesForBatchFaceId :
m_updatesForNonBatchFaceId;
- // If an update with the same name and route already exists,
- // replace it
- FibUpdateList::iterator it = std::find_if(updates.begin(), updates.end(),
+ // If an update with the same name and route already exists, replace it
+ auto it = std::find_if(updates.begin(), updates.end(),
[&update] (const FibUpdate& other) {
return update.name == other.name && update.faceId == other.faceId;
});
@@ -400,7 +396,7 @@
// If there is an ancestor route which is the same as the new route, replace it
// with the new route
- Rib::RouteSet::iterator it = ancestorRoutes.find(route);
+ auto it = ancestorRoutes.find(route);
// There is a route that needs to be overwritten, erase and then replace
if (it != ancestorRoutes.end()) {
@@ -525,7 +521,7 @@
else {
// Look for an ancestor that was blocked previously
const Rib::RouteSet ancestorRoutes = m_rib.getAncestorRoutes(entry);
- Rib::RouteSet::iterator it = ancestorRoutes.find(route);
+ auto it = ancestorRoutes.find(route);
// If an ancestor is found, add it to children
if (it != ancestorRoutes.end()) {
@@ -616,7 +612,7 @@
if (!entry.hasCapture() && entry.getNRoutes() != 0) {
// If there is an ancestor route which is the same as the erased route, add that route
// to the current entry
- Rib::RouteSet::iterator it = ancestorRoutes.find(route);
+ auto it = ancestorRoutes.find(route);
if (it != ancestorRoutes.end()) {
addInheritedRoute(entry.getName(), *it);
diff --git a/daemon/rib/fib-updater.hpp b/daemon/rib/fib-updater.hpp
index 52f3d74..d43f50a 100644
--- a/daemon/rib/fib-updater.hpp
+++ b/daemon/rib/fib-updater.hpp
@@ -149,7 +149,7 @@
* the FIB update process is considered a success.
*/
void
- onUpdateSuccess(const FibUpdate update,
+ onUpdateSuccess(const FibUpdate& update,
const FibUpdateSuccessCallback& onSuccess,
const FibUpdateFailureCallback& onFailure);
@@ -169,7 +169,7 @@
* Otherwise, a non-recoverable error has occurred and an exception is thrown.
*/
void
- onUpdateError(const FibUpdate update,
+ onUpdateError(const FibUpdate& update,
const FibUpdateSuccessCallback& onSuccess,
const FibUpdateFailureCallback& onFailure,
const ndn::nfd::ControlResponse& response, uint32_t nTimeouts);
@@ -183,7 +183,7 @@
* Otherwise, the update is added to m_updatesForBatchNonFaceId.
*/
void
- addFibUpdate(const FibUpdate update);
+ addFibUpdate(const FibUpdate& update);
/** \brief creates records of the passed routes added to the entry and creates FIB updates
*/
diff --git a/daemon/rib/readvertise/nfd-rib-readvertise-destination.cpp b/daemon/rib/readvertise/nfd-rib-readvertise-destination.cpp
index a76aaed..0592040 100644
--- a/daemon/rib/readvertise/nfd-rib-readvertise-destination.cpp
+++ b/daemon/rib/readvertise/nfd-rib-readvertise-destination.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -44,10 +44,17 @@
, m_commandOptions(options)
, m_controlParameters(parameters)
{
- m_ribInsertConn = rib.afterInsertEntry.connect(
- std::bind(&NfdRibReadvertiseDestination::handleRibInsert, this, _1));
- m_ribEraseConn = rib.afterEraseEntry.connect(
- std::bind(&NfdRibReadvertiseDestination::handleRibErase, this, _1));
+ m_ribInsertConn = rib.afterInsertEntry.connect([this] (const Name& name) {
+ if (name.isPrefixOf(m_commandOptions.getPrefix())) {
+ setAvailability(true);
+ }
+ });
+
+ m_ribEraseConn = rib.afterEraseEntry.connect([this] (const Name& name) {
+ if (name.isPrefixOf(m_commandOptions.getPrefix())) {
+ setAvailability(false);
+ }
+ });
}
void
@@ -59,7 +66,7 @@
m_controller.start<ndn::nfd::RibRegisterCommand>(
getControlParameters().setName(rr.prefix),
- [=] (const ControlParameters& cp) { successCb(); },
+ [=] (const ControlParameters&) { successCb(); },
[=] (const ControlResponse& cr) { failureCb(cr.getText()); },
getCommandOptions().setSigningInfo(rr.signer));
}
@@ -73,38 +80,10 @@
m_controller.start<ndn::nfd::RibUnregisterCommand>(
getControlParameters().setName(rr.prefix),
- [=] (const ControlParameters& cp) { successCb(); },
+ [=] (const ControlParameters&) { successCb(); },
[=] (const ControlResponse& cr) { failureCb(cr.getText()); },
getCommandOptions().setSigningInfo(rr.signer));
}
-ndn::nfd::ControlParameters
-NfdRibReadvertiseDestination::getControlParameters()
-{
- return m_controlParameters;
-}
-
-ndn::nfd::CommandOptions
-NfdRibReadvertiseDestination::getCommandOptions()
-{
- return m_commandOptions;
-}
-
-void
-NfdRibReadvertiseDestination::handleRibInsert(const ndn::Name& name)
-{
- if (name.isPrefixOf(m_commandOptions.getPrefix())) {
- setAvailability(true);
- }
-}
-
-void
-NfdRibReadvertiseDestination::handleRibErase(const ndn::Name& name)
-{
- if (name.isPrefixOf(m_commandOptions.getPrefix())) {
- setAvailability(false);
- }
-}
-
} // namespace rib
} // namespace nfd
diff --git a/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp b/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp
index 9c5bce6..0f61669 100644
--- a/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp
+++ b/daemon/rib/readvertise/nfd-rib-readvertise-destination.hpp
@@ -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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -45,8 +45,7 @@
Rib& rib,
const ndn::nfd::CommandOptions& options = ndn::nfd::CommandOptions(),
const ndn::nfd::ControlParameters& parameters =
- ndn::nfd::ControlParameters()
- .setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT));
+ ndn::nfd::ControlParameters().setOrigin(ndn::nfd::ROUTE_ORIGIN_CLIENT));
/** \brief add a name prefix into NFD RIB
*/
@@ -64,17 +63,16 @@
protected:
ndn::nfd::ControlParameters
- getControlParameters();
+ getControlParameters() const
+ {
+ return m_controlParameters;
+ }
ndn::nfd::CommandOptions
- getCommandOptions();
-
-private:
- void
- handleRibInsert(const Name& name);
-
- void
- handleRibErase(const Name& name);
+ getCommandOptions() const
+ {
+ return m_commandOptions;
+ }
private:
ndn::nfd::Controller& m_controller;
diff --git a/daemon/rib/rib-entry.cpp b/daemon/rib/rib-entry.cpp
index 7385d16..6acae09 100644
--- a/daemon/rib/rib-entry.cpp
+++ b/daemon/rib/rib-entry.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -33,22 +33,30 @@
NFD_LOG_INIT(RibEntry);
+static bool
+compareFaceIdAndOrigin(const Route& lhs, const Route& rhs)
+{
+ return lhs.faceId == rhs.faceId && lhs.origin == rhs.origin;
+}
+
RibEntry::RouteList::iterator
RibEntry::findRoute(const Route& route)
{
- return std::find_if(begin(), end(), bind(&compareFaceIdAndOrigin, _1, route));
+ return std::find_if(begin(), end(),
+ [&] (const auto& r) { return compareFaceIdAndOrigin(r, route); });
}
RibEntry::RouteList::const_iterator
RibEntry::findRoute(const Route& route) const
{
- return std::find_if(begin(), end(), bind(&compareFaceIdAndOrigin, _1, route));
+ return std::find_if(begin(), end(),
+ [&] (const auto& r) { return compareFaceIdAndOrigin(r, route); });
}
std::pair<RibEntry::iterator, bool>
RibEntry::insertRoute(const Route& route)
{
- iterator it = findRoute(route);
+ auto it = findRoute(route);
if (it == end()) {
if (route.flags & ndn::nfd::ROUTE_FLAG_CAPTURE) {
@@ -65,23 +73,21 @@
void
RibEntry::eraseRoute(const Route& route)
{
- RibEntry::iterator it = findRoute(route);
+ auto it = findRoute(route);
eraseRoute(it);
}
bool
RibEntry::hasRoute(const Route& route)
{
- RibEntry::const_iterator it = findRoute(route);
-
+ auto it = findRoute(route);
return it != end();
}
bool
-RibEntry::hasFaceId(const uint64_t faceId) const
+RibEntry::hasFaceId(uint64_t faceId) const
{
- RibEntry::const_iterator it = std::find_if(begin(), end(), bind(&compareFaceId, _1, faceId));
-
+ auto it = std::find_if(begin(), end(), [faceId] (const auto& r) { return r.faceId == faceId; });
return it != end();
}
@@ -134,14 +140,14 @@
void
RibEntry::removeInheritedRoute(const Route& route)
{
- m_inheritedRoutes.remove_if(bind(&compareFaceId, _1, route.faceId));
+ m_inheritedRoutes.remove_if([id = route.faceId] (const auto& r) { return r.faceId == id; });
}
RibEntry::RouteList::const_iterator
RibEntry::findInheritedRoute(const Route& route) const
{
return std::find_if(m_inheritedRoutes.begin(), m_inheritedRoutes.end(),
- bind(&compareFaceId, _1, route.faceId));
+ [id = route.faceId] (const auto& r) { return r.faceId == id; });
}
bool
@@ -243,7 +249,7 @@
time::milliseconds maxExpiration) const
{
const Route* bestAnnRoute = nullptr;
- auto entryExpiry = time::steady_clock::TimePoint::min();
+ auto entryExpiry = time::steady_clock::time_point::min();
for (const Route& route : *this) {
if (route.expires) {
@@ -255,7 +261,7 @@
}
}
else {
- entryExpiry = time::steady_clock::TimePoint::max();
+ entryExpiry = time::steady_clock::time_point::max();
}
}
diff --git a/daemon/rib/rib-entry.hpp b/daemon/rib/rib-entry.hpp
index 45d5a87..03cfc8c 100644
--- a/daemon/rib/rib-entry.hpp
+++ b/daemon/rib/rib-entry.hpp
@@ -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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -94,7 +94,7 @@
eraseRoute(RouteList::iterator route);
bool
- hasFaceId(const uint64_t faceId) const;
+ hasFaceId(uint64_t faceId) const;
const RouteList&
getRoutes() const;
diff --git a/daemon/rib/rib.cpp b/daemon/rib/rib.cpp
index 2d1db7f..a81e77a 100644
--- a/daemon/rib/rib.cpp
+++ b/daemon/rib/rib.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -426,8 +426,8 @@
// Until task #1698, each RibUpdateBatch contains exactly one RIB update
BOOST_ASSERT(batch.size() == 1);
- auto fibSuccessCb = bind(&Rib::onFibUpdateSuccess, this, batch, _1, item.managerSuccessCallback);
- auto fibFailureCb = bind(&Rib::onFibUpdateFailure, this, item.managerFailureCallback, _1, _2);
+ auto fibSuccessCb = std::bind(&Rib::onFibUpdateSuccess, this, batch, _1, item.managerSuccessCallback);
+ auto fibFailureCb = std::bind(&Rib::onFibUpdateFailure, this, item.managerFailureCallback, _1, _2);
m_fibUpdater->computeAndSendFibUpdates(batch, fibSuccessCb, fibFailureCb);
}
diff --git a/daemon/rib/route.cpp b/daemon/rib/route.cpp
index 04999bb..99d80e5 100644
--- a/daemon/rib/route.cpp
+++ b/daemon/rib/route.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -31,21 +31,21 @@
const uint64_t PA_ROUTE_COST = 2048; ///< cost of route created by prefix announcement
-static time::steady_clock::TimePoint
+static time::steady_clock::time_point
computeExpiration(const ndn::PrefixAnnouncement& ann)
{
- time::steady_clock::Duration validityEnd = time::steady_clock::Duration::max();
+ auto validityEnd = time::steady_clock::duration::max();
if (ann.getValidityPeriod()) {
auto now = time::system_clock::now();
if (!ann.getValidityPeriod()->isValid(now)) {
- validityEnd = time::steady_clock::Duration::zero();
+ validityEnd = time::steady_clock::duration::zero();
}
else {
validityEnd = ann.getValidityPeriod()->getPeriod().second - now;
}
}
return time::steady_clock::now() +
- std::min(validityEnd, time::duration_cast<time::steady_clock::Duration>(ann.getExpiration()));
+ std::min(validityEnd, time::duration_cast<time::steady_clock::duration>(ann.getExpiration()));
}
Route::Route(const ndn::PrefixAnnouncement& ann, uint64_t faceId)
diff --git a/daemon/rib/route.hpp b/daemon/rib/route.hpp
index 92df470..18df250 100644
--- a/daemon/rib/route.hpp
+++ b/daemon/rib/route.hpp
@@ -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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -82,7 +82,7 @@
ndn::nfd::RouteOrigin origin = ndn::nfd::ROUTE_ORIGIN_APP;
uint64_t cost = 0;
std::underlying_type_t<ndn::nfd::RouteFlags> flags = ndn::nfd::ROUTE_FLAGS_NONE;
- optional<time::steady_clock::TimePoint> expires;
+ optional<time::steady_clock::time_point> expires;
/** \brief The prefix announcement that caused the creation of this route.
*
@@ -98,7 +98,7 @@
* not yet valid or has expired. In this case, the exact value of this field does not matter.
* If this field is after the current time, it indicates when the prefix announcement expires.
*/
- time::steady_clock::TimePoint annExpires;
+ time::steady_clock::time_point annExpires;
private:
scheduler::EventId m_expirationEvent;
@@ -113,18 +113,6 @@
return !(lhs == rhs);
}
-inline bool
-compareFaceIdAndOrigin(const Route& lhs, const Route& rhs)
-{
- return (lhs.faceId == rhs.faceId && lhs.origin == rhs.origin);
-}
-
-inline bool
-compareFaceId(const Route& route, const uint64_t faceId)
-{
- return (route.faceId == faceId);
-}
-
std::ostream&
operator<<(std::ostream& os, const Route& route);
diff --git a/daemon/rib/service.cpp b/daemon/rib/service.cpp
index 596fa27..0c674b3 100644
--- a/daemon/rib/service.cpp
+++ b/daemon/rib/service.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -45,7 +45,7 @@
Service* Service::s_instance = nullptr;
-const std::string CFG_SECTION = "rib";
+const std::string CFG_RIB = "rib";
const std::string CFG_LOCALHOST_SECURITY = "localhost_security";
const std::string CFG_LOCALHOP_SECURITY = "localhop_security";
const std::string CFG_PA_VALIDATION = "prefix_announcement_validation";
@@ -126,7 +126,9 @@
s_instance = this;
ConfigFile config(ConfigFile::ignoreUnknownSection);
- config.addSectionHandler(CFG_SECTION, bind(&Service::processConfig, this, _1, _2, _3));
+ config.addSectionHandler(CFG_RIB, [this] (auto&&... args) {
+ processConfig(std::forward<decltype(args)>(args)...);
+ });
configParse(config, true);
configParse(config, false);
@@ -185,10 +187,10 @@
// AutoPrefixPropagator does not support config dry-run
}
else if (key == CFG_READVERTISE_NLSR) {
- ConfigFile::parseYesNo(item, CFG_SECTION + "." + CFG_READVERTISE_NLSR);
+ ConfigFile::parseYesNo(item, CFG_RIB + "." + CFG_READVERTISE_NLSR);
}
else {
- NDN_THROW(ConfigFile::Error("Unrecognized option " + CFG_SECTION + "." + key));
+ NDN_THROW(ConfigFile::Error("Unrecognized option " + CFG_RIB + "." + key));
}
}
@@ -239,10 +241,10 @@
}
}
else if (key == CFG_READVERTISE_NLSR) {
- wantReadvertiseNlsr = ConfigFile::parseYesNo(item, CFG_SECTION + "." + CFG_READVERTISE_NLSR);
+ wantReadvertiseNlsr = ConfigFile::parseYesNo(item, CFG_RIB + "." + CFG_READVERTISE_NLSR);
}
else {
- NDN_THROW(ConfigFile::Error("Unrecognized option " + CFG_SECTION + "." + key));
+ NDN_THROW(ConfigFile::Error("Unrecognized option " + CFG_RIB + "." + key));
}
}
diff --git a/daemon/table/network-region-table.cpp b/daemon/table/network-region-table.cpp
index c7e9cea..4ede386 100644
--- a/daemon/table/network-region-table.cpp
+++ b/daemon/table/network-region-table.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,10 +28,10 @@
namespace nfd {
bool
-NetworkRegionTable::isInProducerRegion(const DelegationList& forwardingHint) const
+NetworkRegionTable::isInProducerRegion(const ndn::DelegationList& forwardingHint) const
{
for (const Name& regionName : *this) {
- for (const Delegation& delegation : forwardingHint) {
+ for (const auto& delegation : forwardingHint) {
if (delegation.name.isPrefixOf(regionName)) {
return true;
}
diff --git a/daemon/table/network-region-table.hpp b/daemon/table/network-region-table.hpp
index 22da902..e531a45 100644
--- a/daemon/table/network-region-table.hpp
+++ b/daemon/table/network-region-table.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,6 +28,8 @@
#include "core/common.hpp"
+#include <ndn-cxx/delegation-list.hpp>
+
namespace nfd {
/** \brief stores a collection of producer region names
@@ -50,7 +52,7 @@
* otherwise, the Interest should be forwarded according to the forwarding hint.
*/
bool
- isInProducerRegion(const DelegationList& forwardingHint) const;
+ isInProducerRegion(const ndn::DelegationList& forwardingHint) const;
};
} // namespace nfd
diff --git a/tests/daemon/common/config-file.t.cpp b/tests/daemon/common/config-file.t.cpp
index c24e335..e1c7333 100644
--- a/tests/daemon/common/config-file.t.cpp
+++ b/tests/daemon/common/config-file.t.cpp
@@ -106,8 +106,8 @@
DummyAllSubscriber(ConfigFile& config, bool expectDryRun = false)
: DummySubscriber(config, CONFIG_N_A_SECTIONS, CONFIG_N_B_SECTIONS, expectDryRun)
{
- config.addSectionHandler("a", bind(&DummySubscriber::onA, this, _1, _2));
- config.addSectionHandler("b", bind(&DummySubscriber::onB, this, _1, _2));
+ config.addSectionHandler("a", std::bind(&DummySubscriber::onA, this, _1, _2));
+ config.addSectionHandler("b", std::bind(&DummySubscriber::onB, this, _1, _2));
}
};
@@ -121,10 +121,10 @@
expectDryRun)
{
if (sectionName == "a") {
- config.addSectionHandler(sectionName, bind(&DummySubscriber::onA, this, _1, _2));
+ config.addSectionHandler(sectionName, std::bind(&DummySubscriber::onA, this, _1, _2));
}
else if (sectionName == "b") {
- config.addSectionHandler(sectionName, bind(&DummySubscriber::onB, this, _1, _2));
+ config.addSectionHandler(sectionName, std::bind(&DummySubscriber::onB, this, _1, _2));
}
else {
BOOST_FAIL("Test setup error: Unexpected section name '" << sectionName << "'");
@@ -304,8 +304,8 @@
ConfigFile file;
BOOST_REQUIRE_THROW(file.parse(CONFIG, false, "dummy-config"), ConfigFile::Error);
- ConfigFile permissiveFile(bind(&MissingCallbackFixture::checkMissingHandler,
- this, _1, _2, _3, _4));
+ ConfigFile permissiveFile(std::bind(&MissingCallbackFixture::checkMissingHandler,
+ this, _1, _2, _3, _4));
DummyOneSubscriber subA(permissiveFile, "a");
BOOST_REQUIRE_NO_THROW(permissiveFile.parse(CONFIG, false, "dummy-config"));
diff --git a/tests/daemon/face/face.t.cpp b/tests/daemon/face/face.t.cpp
index b592a24..641088f 100644
--- a/tests/daemon/face/face.t.cpp
+++ b/tests/daemon/face/face.t.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -101,9 +101,9 @@
size_t nReceivedInterests = 0;
size_t nReceivedData = 0;
size_t nReceivedNacks = 0;
- face1->afterReceiveInterest.connect(bind([&nReceivedInterests] { ++nReceivedInterests; }));
- face1->afterReceiveData.connect(bind([&nReceivedData] { ++nReceivedData; }));
- face1->afterReceiveNack.connect(bind([&nReceivedNacks] { ++nReceivedNacks; }));
+ face1->afterReceiveInterest.connect([&] (auto&&...) { ++nReceivedInterests; });
+ face1->afterReceiveData.connect([&] (auto&&...) { ++nReceivedData; });
+ face1->afterReceiveNack.connect([&] (auto&&...) { ++nReceivedNacks; });
for (size_t i = 0; i < nInInterests; ++i) {
face1->receiveInterest(*makeInterest("/JSQdqward4"), 0);
diff --git a/tests/daemon/face/internal-face.t.cpp b/tests/daemon/face/internal-face.t.cpp
index db72bcc..1f2b82a 100644
--- a/tests/daemon/face/internal-face.t.cpp
+++ b/tests/daemon/face/internal-face.t.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -87,9 +87,9 @@
bool hasTimeout = false;
clientFace->expressInterest(*interest,
- bind([] { BOOST_ERROR("unexpected Data"); }),
- bind([] { BOOST_ERROR("unexpected Nack"); }),
- bind([&hasTimeout] { hasTimeout = true; }));
+ [] (auto&&...) { BOOST_ERROR("unexpected Data"); },
+ [] (auto&&...) { BOOST_ERROR("unexpected Nack"); },
+ [&] (auto&&...) { hasTimeout = true; });
this->advanceClocks(1_ms, 10);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
@@ -106,12 +106,12 @@
bool hasReceivedData = false;
clientFace->expressInterest(*interest,
- [&hasReceivedData] (const Interest&, const Data& data) {
+ [&] (const Interest&, const Data& data) {
hasReceivedData = true;
BOOST_CHECK_EQUAL(data.getName(), "/PQstEJGdL/aI7oCrDXNX");
},
- bind([] { BOOST_ERROR("unexpected Nack"); }),
- bind([] { BOOST_ERROR("unexpected timeout"); }));
+ [] (auto&&...) { BOOST_ERROR("unexpected Nack"); },
+ [] (auto&&...) { BOOST_ERROR("unexpected timeout"); });
this->advanceClocks(1_ms, 10);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
@@ -129,12 +129,12 @@
bool hasReceivedNack = false;
clientFace->expressInterest(*interest,
- bind([] { BOOST_ERROR("unexpected Data"); }),
- [&hasReceivedNack] (const Interest&, const lp::Nack& nack) {
+ [] (auto&&...) { BOOST_ERROR("unexpected Data"); },
+ [&] (const Interest&, const lp::Nack& nack) {
hasReceivedNack = true;
BOOST_CHECK_EQUAL(nack.getReason(), lp::NackReason::NO_ROUTE);
},
- bind([] { BOOST_ERROR("unexpected timeout"); }));
+ [] (auto&&...) { BOOST_ERROR("unexpected timeout"); });
this->advanceClocks(1_ms, 10);
BOOST_REQUIRE_EQUAL(receivedInterests.size(), 1);
@@ -197,9 +197,9 @@
bool hasTimeout = false;
clientFace->expressInterest(*interest,
- bind([] { BOOST_ERROR("unexpected Data"); }),
- bind([] { BOOST_ERROR("unexpected Nack"); }),
- bind([&hasTimeout] { hasTimeout = true; }));
+ [] (auto&&...) { BOOST_ERROR("unexpected Data"); },
+ [] (auto&&...) { BOOST_ERROR("unexpected Nack"); },
+ [&] (auto&&...) { hasTimeout = true; });
BOOST_CHECK_NO_THROW(this->advanceClocks(1_ms, 200));
BOOST_CHECK_EQUAL(receivedInterests.size(), 0);
diff --git a/tests/daemon/face/tcp-factory.t.cpp b/tests/daemon/face/tcp-factory.t.cpp
index 95e6c2b..a6335f9 100644
--- a/tests/daemon/face/tcp-factory.t.cpp
+++ b/tests/daemon/face/tcp-factory.t.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -458,10 +458,10 @@
{
createChannel("0.0.0.0", "20070");
factory.createFace({FaceUri("tcp4://192.0.2.1:20070"), {}, {}},
- bind(&CreateFaceTimeoutFixture::onFaceCreated, this, _1),
- bind(&CreateFaceTimeoutFixture::onConnectFailed, this, _2));
+ std::bind(&CreateFaceTimeoutFixture::onFaceCreated, this, _1),
+ std::bind(&CreateFaceTimeoutFixture::onConnectFailed, this, _2));
- BOOST_REQUIRE_EQUAL(limitedIo.run(1, 10_s), LimitedIo::EXCEED_OPS);
+ BOOST_CHECK_EQUAL(limitedIo.run(1, 10_s), LimitedIo::EXCEED_OPS);
BOOST_CHECK(face == nullptr);
}
diff --git a/tests/daemon/face/websocket-channel-fixture.hpp b/tests/daemon/face/websocket-channel-fixture.hpp
index 69b2e9b..e6e1e9f 100644
--- a/tests/daemon/face/websocket-channel-fixture.hpp
+++ b/tests/daemon/face/websocket-channel-fixture.hpp
@@ -38,7 +38,8 @@
{
protected:
shared_ptr<WebSocketChannel>
- makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0, optional<size_t> mtu = nullopt) final
+ makeChannel(const boost::asio::ip::address& addr, uint16_t port = 0,
+ optional<size_t> mtu = nullopt) final
{
if (port == 0)
port = getNextPort();
@@ -55,7 +56,7 @@
listenerChannel = makeChannel(addr, 20030);
listenerChannel->setPingInterval(pingInterval);
listenerChannel->setPongTimeout(pongTimeout);
- listenerChannel->listen(bind(&WebSocketChannelFixture::listenerOnFaceCreated, this, _1));
+ listenerChannel->listen(std::bind(&WebSocketChannelFixture::listenerOnFaceCreated, this, _1));
}
void
@@ -65,9 +66,9 @@
client.clear_error_channels(websocketpp::log::elevel::all);
client.init_asio(&g_io);
- client.set_open_handler(bind(&WebSocketChannelFixture::clientHandleOpen, this, _1));
- client.set_message_handler(bind(&WebSocketChannelFixture::clientHandleMessage, this, _1, _2));
- client.set_ping_handler(bind(&WebSocketChannelFixture::clientHandlePing, this, _1, _2));
+ client.set_open_handler(std::bind(&WebSocketChannelFixture::clientHandleOpen, this, _1));
+ client.set_message_handler(std::bind(&WebSocketChannelFixture::clientHandleMessage, this, _1, _2));
+ client.set_ping_handler(std::bind(&WebSocketChannelFixture::clientHandlePing, this, _1, _2));
websocketpp::lib::error_code ec;
auto con = client.get_connection(FaceUri(listenerEp, "ws").toString(), ec);
@@ -100,20 +101,16 @@
listenerOnFaceCreated(const shared_ptr<Face>& newFace)
{
BOOST_REQUIRE(newFace != nullptr);
- newFace->afterReceiveInterest.connect(bind(&WebSocketChannelFixture::faceAfterReceiveInterest, this, _1));
+ newFace->afterReceiveInterest.connect([this] (const auto& interest, const auto&) {
+ faceReceivedInterests.push_back(interest);
+ limitedIo.afterOp();
+ });
connectFaceClosedSignal(*newFace, [this] { limitedIo.afterOp(); });
listenerFaces.push_back(newFace);
limitedIo.afterOp();
}
void
- faceAfterReceiveInterest(const Interest& interest)
- {
- faceReceivedInterests.push_back(interest);
- limitedIo.afterOp();
- }
-
- void
clientHandleOpen(websocketpp::connection_hdl hdl)
{
clientHandle = hdl;
@@ -131,8 +128,8 @@
clientHandlePing(websocketpp::connection_hdl, std::string)
{
auto now = time::steady_clock::now();
- if (m_prevPingRecvTime != time::steady_clock::TimePoint()) {
- measuredPingInterval = now - m_prevPingRecvTime;
+ if (m_prevPingRecvTime != time::steady_clock::time_point()) {
+ measuredPingIntervals.push_back(now - m_prevPingRecvTime);
}
m_prevPingRecvTime = now;
@@ -147,13 +144,13 @@
websocketpp::connection_hdl clientHandle;
std::vector<std::string> clientReceivedMessages;
- time::steady_clock::Duration measuredPingInterval;
+ std::vector<time::nanoseconds> measuredPingIntervals;
// set clientShouldPong to false to disable the pong response,
// which will eventually cause a timeout in listenerChannel
bool clientShouldPong = true;
private:
- time::steady_clock::TimePoint m_prevPingRecvTime;
+ time::steady_clock::time_point m_prevPingRecvTime;
};
} // namespace tests
diff --git a/tests/daemon/face/websocket-channel.t.cpp b/tests/daemon/face/websocket-channel.t.cpp
index d9fe929..5772daa 100644
--- a/tests/daemon/face/websocket-channel.t.cpp
+++ b/tests/daemon/face/websocket-channel.t.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -175,13 +175,17 @@
{
auto address = getTestIp(F::value, AddressScope::Loopback);
SKIP_IF_IP_UNAVAILABLE(address);
- const auto pingInterval = 1200_ms;
+ const auto pingInterval = 1500_ms;
this->initialize(address, pingInterval);
- BOOST_CHECK_EQUAL(limitedIo.run(2, // clientHandlePing
- pingInterval * 3), LimitedIo::EXCEED_OPS);
- BOOST_CHECK_LE(measuredPingInterval, pingInterval * 1.1);
- BOOST_CHECK_GE(measuredPingInterval, pingInterval * 0.9);
+ BOOST_CHECK_EQUAL(limitedIo.run(5, // clientHandlePing
+ 5 * pingInterval + 1_s), LimitedIo::EXCEED_OPS);
+ BOOST_CHECK_EQUAL(measuredPingIntervals.size(), 4);
+
+ auto avgPingInterval = std::accumulate(measuredPingIntervals.begin(), measuredPingIntervals.end(), 0_ns);
+ avgPingInterval /= measuredPingIntervals.size();
+ BOOST_CHECK_LE(avgPingInterval, pingInterval * 1.1);
+ BOOST_CHECK_GE(avgPingInterval, pingInterval * 0.9);
}
BOOST_AUTO_TEST_CASE_TEMPLATE(SetPongTimeOut, F, AddressFamilies)
diff --git a/tests/daemon/face/websocket-transport-fixture.hpp b/tests/daemon/face/websocket-transport-fixture.hpp
index 32934ab..b1700ed 100644
--- a/tests/daemon/face/websocket-transport-fixture.hpp
+++ b/tests/daemon/face/websocket-transport-fixture.hpp
@@ -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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -62,11 +62,11 @@
server.clear_error_channels(websocketpp::log::elevel::all);
server.init_asio(&g_io);
- server.set_open_handler(bind(&WebSocketTransportFixture::serverHandleOpen, this, _1));
- server.set_close_handler(bind(&WebSocketTransportFixture::serverHandleClose, this));
- server.set_message_handler(bind(&WebSocketTransportFixture::serverHandleMessage, this, _2));
- server.set_pong_handler(bind(&WebSocketTransportFixture::serverHandlePong, this));
- server.set_pong_timeout_handler(bind(&WebSocketTransportFixture::serverHandlePongTimeout, this));
+ server.set_open_handler(std::bind(&WebSocketTransportFixture::serverHandleOpen, this, _1));
+ server.set_close_handler(std::bind(&WebSocketTransportFixture::serverHandleClose, this));
+ server.set_message_handler(std::bind(&WebSocketTransportFixture::serverHandleMessage, this, _2));
+ server.set_pong_handler(std::bind(&WebSocketTransportFixture::serverHandlePong, this));
+ server.set_pong_timeout_handler(std::bind(&WebSocketTransportFixture::serverHandlePongTimeout, this));
server.set_pong_timeout(pongTimeout.count());
server.set_reuse_addr(true);
@@ -84,9 +84,9 @@
client.clear_error_channels(websocketpp::log::elevel::all);
client.init_asio(&g_io);
- client.set_open_handler(bind(&WebSocketTransportFixture::clientHandleOpen, this, _1));
- client.set_message_handler(bind(&WebSocketTransportFixture::clientHandleMessage, this, _2));
- client.set_ping_handler(bind(&WebSocketTransportFixture::clientHandlePing, this));
+ client.set_open_handler(std::bind(&WebSocketTransportFixture::clientHandleOpen, this, _1));
+ client.set_message_handler(std::bind(&WebSocketTransportFixture::clientHandleMessage, this, _2));
+ client.set_ping_handler(std::bind(&WebSocketTransportFixture::clientHandlePing, this));
websocketpp::lib::error_code ec;
auto con = client.get_connection(uri, ec);
diff --git a/tests/daemon/fw/access-strategy.t.cpp b/tests/daemon/fw/access-strategy.t.cpp
index afa73b6..cb55cca 100644
--- a/tests/daemon/fw/access-strategy.t.cpp
+++ b/tests/daemon/fw/access-strategy.t.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -315,7 +315,7 @@
shared_ptr<Interest> interest1 = makeInterest("ndn:/laptops/A/1");
bool hasData1 = false;
consumer->getClientFace().expressInterest(*interest1,
- bind([&hasData1] { hasData1 = true; }),
+ [&] (auto&&...) { hasData1 = true; },
nullptr, nullptr);
this->advanceClocks(5_ms, 1_s);
BOOST_CHECK_EQUAL(hasData1, true);
@@ -324,9 +324,9 @@
shared_ptr<Interest> interest2a = makeInterest("ndn:/laptops/A/2");
bool hasData2a = false, hasTimeout2a = false;
consumer->getClientFace().expressInterest(*interest2a,
- bind([&hasData2a] { hasData2a = true; }),
+ [&] (auto&&...) { hasData2a = true; },
nullptr,
- bind([&hasTimeout2a] { hasTimeout2a = true; }));
+ [&] (auto&&...) { hasTimeout2a = true; });
producerA->fail();
this->advanceClocks(5_ms, 60_ms);
BOOST_CHECK_EQUAL(hasData2a, false);
@@ -336,7 +336,7 @@
shared_ptr<Interest> interest2b = makeInterest("ndn:/laptops/A/2");
bool hasData2b = false;
consumer->getClientFace().expressInterest(*interest2b,
- bind([&hasData2b] { hasData2b = true; }),
+ [&] (auto&&...) { hasData2b = true; },
nullptr, nullptr);
producerA->recover();
this->advanceClocks(5_ms, 1_s);
@@ -346,7 +346,7 @@
shared_ptr<Interest> interest2c = makeInterest("ndn:/laptops/A/2");
bool hasData2c = false;
consumer->getClientFace().expressInterest(*interest2c,
- bind([&hasData2c] { hasData2c = true; }),
+ [&] (auto&&...) { hasData2c = true; },
nullptr, nullptr);
this->advanceClocks(5_ms, 1_s);
BOOST_CHECK_EQUAL(hasData2c, true);
diff --git a/tests/daemon/fw/algorithm.t.cpp b/tests/daemon/fw/algorithm.t.cpp
index b998ec2..4a86d78 100644
--- a/tests/daemon/fw/algorithm.t.cpp
+++ b/tests/daemon/fw/algorithm.t.cpp
@@ -190,7 +190,7 @@
auto interest = makeInterest("ndn:/c1I7QCtc");
pit::Entry entry(*interest);
- time::steady_clock::TimePoint before = time::steady_clock::now();
+ auto before = time::steady_clock::now();
entry.insertOrUpdateOutRecord(*face1, *interest);
this->advanceClocks(1_s);
diff --git a/tests/daemon/fw/best-route-strategy.t.cpp b/tests/daemon/fw/best-route-strategy.t.cpp
index 5066cca..7293762 100644
--- a/tests/daemon/fw/best-route-strategy.t.cpp
+++ b/tests/daemon/fw/best-route-strategy.t.cpp
@@ -96,7 +96,7 @@
// more often than DEFAULT_MIN_RETX_INTERVAL
scheduler::EventId retxFrom4Evt;
size_t nSentLast = strategy.sendInterestHistory.size();
- time::steady_clock::TimePoint timeSentLast = time::steady_clock::now();
+ auto timeSentLast = time::steady_clock::now();
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(*face4, *interest);
diff --git a/tests/daemon/fw/forwarding-hint.t.cpp b/tests/daemon/fw/forwarding-hint.t.cpp
index fe3e51c..da63619 100644
--- a/tests/daemon/fw/forwarding-hint.t.cpp
+++ b/tests/daemon/fw/forwarding-hint.t.cpp
@@ -114,8 +114,8 @@
shared_ptr<TopologyLink> linkAH, linkHT, linkTP, linkHC, linkCS, linkSQ;
shared_ptr<TopologyAppLink> consumerA, producerP, producerQ;
- Delegation delTelia = {10, "/telia/terabits"};
- Delegation delUcla = {20, "/ucla/cs"};
+ ndn::Delegation delTelia = {10, "/telia/terabits"};
+ ndn::Delegation delUcla = {20, "/ucla/cs"};
};
BOOST_FIXTURE_TEST_SUITE(NdnsimTeliaUclaTopology, NdnsimTeliaUclaTopologyFixture)
@@ -128,12 +128,12 @@
// A forwards Interest according to default route, no change to forwarding hint
BOOST_CHECK_EQUAL(linkAH->getFace(nodeA).getCounters().nOutInterests, 1);
const Interest& interestAH = topo.getPcap(linkAH->getFace(nodeA)).sentInterests.at(0);
- BOOST_CHECK_EQUAL(interestAH.getForwardingHint(), DelegationList({delTelia, delUcla}));
+ BOOST_CHECK_EQUAL(interestAH.getForwardingHint(), ndn::DelegationList({delTelia, delUcla}));
// H prefers T, no change to forwarding hint
BOOST_CHECK_EQUAL(linkHT->getFace(nodeH).getCounters().nOutInterests, 1);
const Interest& interestHT = topo.getPcap(linkHT->getFace(nodeH)).sentInterests.at(0);
- BOOST_CHECK_EQUAL(interestHT.getForwardingHint(), DelegationList({delTelia, delUcla}));
+ BOOST_CHECK_EQUAL(interestHT.getForwardingHint(), ndn::DelegationList({delTelia, delUcla}));
// T forwards to P, forwarding hint stripped when Interest reaches producer region
BOOST_CHECK_EQUAL(linkTP->getFace(nodeT).getCounters().nOutInterests, 1);
@@ -157,17 +157,17 @@
// A forwards Interest according to default route, no change to forwarding hint
BOOST_CHECK_EQUAL(linkAH->getFace(nodeA).getCounters().nOutInterests, 1);
const Interest& interestAH = topo.getPcap(linkAH->getFace(nodeA)).sentInterests.at(0);
- BOOST_CHECK_EQUAL(interestAH.getForwardingHint(), DelegationList({delTelia, delUcla}));
+ BOOST_CHECK_EQUAL(interestAH.getForwardingHint(), ndn::DelegationList({delTelia, delUcla}));
// H forwards to C, no change to forwarding hint
BOOST_CHECK_EQUAL(linkHC->getFace(nodeH).getCounters().nOutInterests, 1);
const Interest& interestHC = topo.getPcap(linkHC->getFace(nodeH)).sentInterests.at(0);
- BOOST_CHECK_EQUAL(interestHC.getForwardingHint(), DelegationList({delTelia, delUcla}));
+ BOOST_CHECK_EQUAL(interestHC.getForwardingHint(), ndn::DelegationList({delTelia, delUcla}));
// C forwards to S, no change to forwarding hint
BOOST_CHECK_EQUAL(linkCS->getFace(nodeC).getCounters().nOutInterests, 1);
const Interest& interestCS = topo.getPcap(linkCS->getFace(nodeC)).sentInterests.at(0);
- BOOST_CHECK_EQUAL(interestCS.getForwardingHint(), DelegationList({delTelia, delUcla}));
+ BOOST_CHECK_EQUAL(interestCS.getForwardingHint(), ndn::DelegationList({delTelia, delUcla}));
// S forwards to Q, forwarding hint stripped when Interest reaches producer region
BOOST_CHECK_EQUAL(linkSQ->getFace(nodeS).getCounters().nOutInterests, 1);
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index 90e4b1e..a1656e5 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -176,7 +176,7 @@
// more often than DEFAULT_MIN_RETX_INTERVAL
scheduler::EventId retxFrom4Evt;
size_t nSentLast = strategy.sendInterestHistory.size();
- time::steady_clock::TimePoint timeSentLast = time::steady_clock::now();
+ auto timeSentLast = time::steady_clock::now();
std::function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(*face3, *interest);
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 9b5f588..73db46c 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -261,11 +261,11 @@
ndn::Face& appD = topo.addAppFace("D", nodeD)->getClientFace();
int nNacksA = 0, nNacksD = 0;
- appA.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksA] { ++nNacksA; }), nullptr);
- appD.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksD] { ++nNacksD; }), nullptr);
+ appA.expressInterest(*makeInterest("/P/1"), nullptr, [&] (auto&&...) { ++nNacksA; }, nullptr);
+ appD.expressInterest(*makeInterest("/P/1"), nullptr, [&] (auto&&...) { ++nNacksD; }, nullptr);
this->advanceClocks(1_ms, 5_ms);
- appA.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksA] { ++nNacksA; }), nullptr);
- appD.expressInterest(*makeInterest("/P/1"), nullptr, bind([&nNacksD] { ++nNacksD; }), nullptr);
+ appA.expressInterest(*makeInterest("/P/1"), nullptr, [&] (auto&&...) { ++nNacksA; }, nullptr);
+ appD.expressInterest(*makeInterest("/P/1"), nullptr, [&] (auto&&...) { ++nNacksD; }, nullptr);
this->advanceClocks(1_ms, 100_ms);
// As long as at least one Nack arrives at each client, strategy behavior is correct.
diff --git a/tests/daemon/fw/topology-tester.hpp b/tests/daemon/fw/topology-tester.hpp
index 6e5cb95..842e810 100644
--- a/tests/daemon/fw/topology-tester.hpp
+++ b/tests/daemon/fw/topology-tester.hpp
@@ -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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -242,7 +242,7 @@
/** \brief captured packet timestamp tag
*/
-using TopologyPcapTimestamp = ndn::SimpleTag<time::steady_clock::TimePoint, 0>;
+using TopologyPcapTimestamp = ndn::SimpleTag<time::steady_clock::time_point, 0>;
/** \brief builds a topology for forwarding tests
*/
diff --git a/tests/daemon/fw/unsolicited-data-policy.t.cpp b/tests/daemon/fw/unsolicited-data-policy.t.cpp
index bc95d4f..5c8c8ad 100644
--- a/tests/daemon/fw/unsolicited-data-policy.t.cpp
+++ b/tests/daemon/fw/unsolicited-data-policy.t.cpp
@@ -58,8 +58,8 @@
tribool isFound = indeterminate;
cs.find(Interest(data.getFullName()),
- bind([&] { isFound = true; }),
- bind([&] { isFound = false; }));
+ [&] (auto&&...) { isFound = true; },
+ [&] (auto&&...) { isFound = false; });
this->advanceClocks(1_ms);
BOOST_REQUIRE(!indeterminate(isFound));
diff --git a/tests/daemon/mgmt/manager-base.t.cpp b/tests/daemon/mgmt/manager-base.t.cpp
index 858ea40..315bf28 100644
--- a/tests/daemon/mgmt/manager-base.t.cpp
+++ b/tests/daemon/mgmt/manager-base.t.cpp
@@ -88,7 +88,7 @@
BOOST_AUTO_TEST_CASE(RegisterCommandHandler)
{
bool wasCommandHandlerCalled = false;
- auto handler = bind([&] { wasCommandHandlerCalled = true; });
+ auto handler = [&] (auto&&...) { wasCommandHandlerCalled = true; };
m_manager.registerCommandHandler<TestCommandVoidParameters>("test-void", handler);
m_manager.registerCommandHandler<TestCommandRequireName>("test-require-name", handler);
@@ -109,7 +109,7 @@
BOOST_AUTO_TEST_CASE(RegisterStatusDataset)
{
bool isStatusDatasetCalled = false;
- auto handler = bind([&] { isStatusDatasetCalled = true; });
+ auto handler = [&] (auto&&...) { isStatusDatasetCalled = true; };
m_manager.registerStatusDatasetHandler("test-status", handler);
setTopPrefix();
diff --git a/tests/daemon/rib/readvertise/readvertise.t.cpp b/tests/daemon/rib/readvertise/readvertise.t.cpp
index 1988a20..89ae410 100644
--- a/tests/daemon/rib/readvertise/readvertise.t.cpp
+++ b/tests/daemon/rib/readvertise/readvertise.t.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -104,7 +104,7 @@
public:
struct HistoryEntry
{
- time::steady_clock::TimePoint timestamp;
+ time::steady_clock::time_point timestamp;
Name prefix;
};
@@ -248,7 +248,7 @@
BOOST_REQUIRE_GT(destination->advertiseHistory.size(), 2);
// destination->advertise keeps failing, so interval should increase
- using FloatInterval = time::duration<float, time::steady_clock::Duration::period>;
+ using FloatInterval = time::duration<float, time::steady_clock::duration::period>;
FloatInterval initialInterval = destination->advertiseHistory[1].timestamp -
destination->advertiseHistory[0].timestamp;
FloatInterval lastInterval = initialInterval;
diff --git a/tests/daemon/rib/rib-entry.t.cpp b/tests/daemon/rib/rib-entry.t.cpp
index 70b053a..b946b78 100644
--- a/tests/daemon/rib/rib-entry.t.cpp
+++ b/tests/daemon/rib/rib-entry.t.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -87,7 +87,7 @@
}
static Route
-makeSimpleRoute(uint64_t faceId, time::steady_clock::Duration expiration)
+makeSimpleRoute(uint64_t faceId, time::nanoseconds expiration)
{
Route route = makeSimpleRoute(faceId);
route.expires = time::steady_clock::now() + expiration;
diff --git a/tests/daemon/table/cs-fixture.hpp b/tests/daemon/table/cs-fixture.hpp
index 4ed5346..9819653 100644
--- a/tests/daemon/table/cs-fixture.hpp
+++ b/tests/daemon/table/cs-fixture.hpp
@@ -80,10 +80,10 @@
std::memcpy(&found, content.value(), sizeof(found));
check(found);
},
- bind([&] {
+ [&] (auto&&...) {
hasResult = true;
check(0);
- }));
+ });
// current Cs::find implementation is synchronous
BOOST_CHECK(hasResult);
diff --git a/tests/daemon/table/network-region-table.t.cpp b/tests/daemon/table/network-region-table.t.cpp
index 12865c6..6ba2678 100644
--- a/tests/daemon/table/network-region-table.t.cpp
+++ b/tests/daemon/table/network-region-table.t.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -36,7 +36,7 @@
BOOST_AUTO_TEST_CASE(InProducerRegion)
{
- DelegationList fh{{10, "/telia/terabits"}, {20, "/ucla/cs"}};
+ ndn::DelegationList fh{{10, "/telia/terabits"}, {20, "/ucla/cs"}};
NetworkRegionTable nrt1;
nrt1.insert("/verizon");
diff --git a/tests/other/cs-benchmark.cpp b/tests/other/cs-benchmark.cpp
index 26f5410..18c9f05 100644
--- a/tests/other/cs-benchmark.cpp
+++ b/tests/other/cs-benchmark.cpp
@@ -78,11 +78,11 @@
void
find(const Interest& interest)
{
- cs.find(interest, bind([]{}), bind([]{}));
+ cs.find(interest, [] (auto&&...) {}, [] (auto&&...) {});
}
protected:
- typedef std::function<Name(size_t)> NameGenerator;
+ using NameGenerator = std::function<Name (size_t)>;
class SimpleNameGenerator
{
diff --git a/tests/other/face-benchmark.cpp b/tests/other/face-benchmark.cpp
index 28af8dc..1ed2143 100644
--- a/tests/other/face-benchmark.cpp
+++ b/tests/other/face-benchmark.cpp
@@ -43,14 +43,13 @@
class FaceBenchmark
{
public:
+ explicit
FaceBenchmark(const char* configFileName)
- : m_terminationSignalSet{getGlobalIoService()}
+ : m_terminationSignalSet{getGlobalIoService(), SIGINT, SIGTERM}
, m_tcpChannel{tcp::Endpoint{boost::asio::ip::tcp::v4(), 6363}, false,
- bind([] { return ndn::nfd::FACE_SCOPE_NON_LOCAL; })}
+ [] (auto&&...) { return ndn::nfd::FACE_SCOPE_NON_LOCAL; }}
, m_udpChannel{udp::Endpoint{boost::asio::ip::udp::v4(), 6363}, 10_min, false, ndn::MAX_NDN_PACKET_SIZE}
{
- m_terminationSignalSet.add(SIGINT);
- m_terminationSignalSet.add(SIGTERM);
m_terminationSignalSet.async_wait([] (const auto& error, int) {
if (!error)
getGlobalIoService().stop();
@@ -58,12 +57,12 @@
parseConfig(configFileName);
- m_tcpChannel.listen(bind(&FaceBenchmark::onLeftFaceCreated, this, _1),
- bind(&FaceBenchmark::onFaceCreationFailed, _1, _2));
+ m_tcpChannel.listen(std::bind(&FaceBenchmark::onLeftFaceCreated, this, _1),
+ std::bind(&FaceBenchmark::onFaceCreationFailed, _1, _2));
std::clog << "Listening on " << m_tcpChannel.getUri() << std::endl;
- m_udpChannel.listen(bind(&FaceBenchmark::onLeftFaceCreated, this, _1),
- bind(&FaceBenchmark::onFaceCreationFailed, _1, _2));
+ m_udpChannel.listen(std::bind(&FaceBenchmark::onLeftFaceCreated, this, _1),
+ std::bind(&FaceBenchmark::onFaceCreationFailed, _1, _2));
std::clog << "Listening on " << m_udpChannel.getUri() << std::endl;
}
@@ -86,7 +85,7 @@
std::clog << "Unsupported protocol '" << uriR.getScheme() << "'" << std::endl;
}
else {
- m_faceUris.push_back(std::make_pair(uriL, uriR));
+ m_faceUris.emplace_back(uriL, uriR);
}
}
@@ -125,13 +124,13 @@
auto port = boost::lexical_cast<uint16_t>(uriR.getPort());
if (uriR.getScheme() == "tcp4") {
m_tcpChannel.connect(tcp::Endpoint(addr, port), {},
- bind(&FaceBenchmark::onRightFaceCreated, this, faceL, _1),
- bind(&FaceBenchmark::onFaceCreationFailed, _1, _2));
+ std::bind(&FaceBenchmark::onRightFaceCreated, this, faceL, _1),
+ std::bind(&FaceBenchmark::onFaceCreationFailed, _1, _2));
}
else if (uriR.getScheme() == "udp4") {
m_udpChannel.connect(udp::Endpoint(addr, port), {},
- bind(&FaceBenchmark::onRightFaceCreated, this, faceL, _1),
- bind(&FaceBenchmark::onFaceCreationFailed, _1, _2));
+ std::bind(&FaceBenchmark::onRightFaceCreated, this, faceL, _1),
+ std::bind(&FaceBenchmark::onFaceCreationFailed, _1, _2));
}
}
diff --git a/tests/tools/mock-nfd-mgmt-fixture.hpp b/tests/tools/mock-nfd-mgmt-fixture.hpp
index 7c02720..6798dd8 100644
--- a/tests/tools/mock-nfd-mgmt-fixture.hpp
+++ b/tests/tools/mock-nfd-mgmt-fixture.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -50,7 +50,7 @@
protected:
MockNfdMgmtFixture()
: face(m_io, m_keyChain,
- {true, false, bind(&MockNfdMgmtFixture::processEventsOverride, this, _1)})
+ {true, false, std::bind(&MockNfdMgmtFixture::processEventsOverride, this, _1)})
{
face.onSendInterest.connect([this] (const Interest& interest) {
if (processInterest) {
diff --git a/tools/ndn-autoconfig-server/program.cpp b/tools/ndn-autoconfig-server/program.cpp
index d0be0d1..21e7857 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-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -67,7 +67,9 @@
m_face.put(*data);
}
},
- bind(&Program::handlePrefixRegistrationFailure, this, _1, _2));
+ [this] (auto&&... args) {
+ handlePrefixRegistrationFailure(std::forward<decltype(args)>(args)...);
+ });
}
void
@@ -84,8 +86,10 @@
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,
+ [this] (auto&&... args) {
+ handlePrefixRegistrationFailure(std::forward<decltype(args)>(args)...);
+ });
}
void
diff --git a/tools/ndn-autoconfig/multicast-discovery.cpp b/tools/ndn-autoconfig/multicast-discovery.cpp
index 200ae75..0a76b22 100644
--- a/tools/ndn-autoconfig/multicast-discovery.cpp
+++ b/tools/ndn-autoconfig/multicast-discovery.cpp
@@ -34,7 +34,6 @@
namespace autoconfig {
using nfd::ControlParameters;
-using nfd::ControlResponse;
const Name HUB_DISCOVERY_PREFIX("/localhop/ndn-autoconf/hub");
const uint64_t HUB_DISCOVERY_ROUTE_COST(1);
@@ -55,9 +54,9 @@
m_controller.fetch<nfd::FaceQueryDataset>(
filter,
- bind(&MulticastDiscovery::registerHubDiscoveryPrefix, this, _1),
+ [this] (const auto& dataset) { registerHubDiscoveryPrefix(dataset); },
[this] (uint32_t code, const std::string& reason) {
- this->fail("Error " + to_string(code) + " when querying multi-access faces: " + reason);
+ fail("Error " + to_string(code) + " when querying multi-access faces: " + reason);
});
}
@@ -65,7 +64,7 @@
MulticastDiscovery::registerHubDiscoveryPrefix(const std::vector<nfd::FaceStatus>& dataset)
{
if (dataset.empty()) {
- this->fail("No multi-access faces available");
+ fail("No multi-access faces available");
return;
}
@@ -82,11 +81,11 @@
m_controller.start<nfd::RibRegisterCommand>(
parameters,
- [this] (const ControlParameters&) {
+ [this] (const auto&) {
++m_nRegSuccess;
afterReg();
},
- [this, faceStatus] (const ControlResponse& resp) {
+ [this, faceStatus] (const auto& resp) {
std::cerr << "Error " << resp.getCode() << " when registering hub discovery prefix "
<< "for face " << faceStatus.getFaceId() << " (" << faceStatus.getRemoteUri()
<< "): " << resp.getText() << std::endl;
@@ -103,10 +102,10 @@
return; // continue waiting
}
if (m_nRegSuccess > 0) {
- this->setStrategy();
+ setStrategy();
}
else {
- this->fail("Cannot register hub discovery prefix for any face");
+ fail("Cannot register hub discovery prefix for any face");
}
}
@@ -119,10 +118,9 @@
m_controller.start<nfd::StrategyChoiceSetCommand>(
parameters,
- bind(&MulticastDiscovery::requestHubData, this),
- [this] (const ControlResponse& resp) {
- this->fail("Error " + to_string(resp.getCode()) + " when setting multicast strategy: " +
- resp.getText());
+ [this] (const auto&) { requestHubData(); },
+ [this] (const auto& resp) {
+ fail("Error " + to_string(resp.getCode()) + " when setting multicast strategy: " + resp.getText());
});
}
@@ -141,17 +139,17 @@
auto i = content.find(tlv::nfd::Uri);
if (i == content.elements_end()) {
- this->fail("Malformed hub Data: missing Uri element");
+ fail("Malformed hub Data: missing Uri element");
return;
}
- this->provideHubFaceUri(std::string(reinterpret_cast<const char*>(i->value()), i->value_size()));
+ provideHubFaceUri(std::string(reinterpret_cast<const char*>(i->value()), i->value_size()));
},
[this] (const Interest&, const lp::Nack& nack) {
- this->fail("Nack-" + boost::lexical_cast<std::string>(nack.getReason()) + " when retrieving hub Data");
+ fail("Nack-" + boost::lexical_cast<std::string>(nack.getReason()) + " when retrieving hub Data");
},
[this] (const Interest&) {
- this->fail("Timeout when retrieving hub Data");
+ fail("Timeout when retrieving hub Data");
});
}
diff --git a/tools/ndn-autoconfig/procedure.cpp b/tools/ndn-autoconfig/procedure.cpp
index dded94b..b0896ec 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-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -52,16 +52,16 @@
Procedure::initialize(const Options& options)
{
BOOST_ASSERT(m_stages.empty());
- this->makeStages(options);
+ makeStages(options);
BOOST_ASSERT(!m_stages.empty());
for (size_t i = 0; i < m_stages.size(); ++i) {
- m_stages[i]->onSuccess.connect(bind(&Procedure::connect, this, _1));
+ m_stages[i]->onSuccess.connect([this] (const auto& uri) { connect(uri); });
if (i + 1 < m_stages.size()) {
- m_stages[i]->onFailure.connect([=] (const std::string&) { m_stages[i + 1]->start(); });
+ m_stages[i]->onFailure.connect([=] (const auto&) { m_stages[i + 1]->start(); });
}
else {
- m_stages[i]->onFailure.connect([=] (const std::string&) { this->onComplete(false); });
+ m_stages[i]->onFailure.connect([=] (const auto&) { onComplete(false); });
}
}
}
diff --git a/tools/nfd-autoreg.cpp b/tools/nfd-autoreg.cpp
index fed9cfb..3745cb0 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-2019, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -90,7 +90,7 @@
isBlacklisted(const boost::asio::ip::address& address) const
{
return std::any_of(m_blackList.begin(), m_blackList.end(),
- bind(&Network::doesContain, _1, address));
+ std::bind(&Network::doesContain, _1, address));
}
/**
@@ -100,7 +100,7 @@
isWhitelisted(const boost::asio::ip::address& address) const
{
return std::any_of(m_whiteList.begin(), m_whiteList.end(),
- bind(&Network::doesContain, _1, address));
+ std::bind(&Network::doesContain, _1, address));
}
void
@@ -114,8 +114,8 @@
.setOrigin(nfd::ROUTE_ORIGIN_AUTOREG)
.setCost(m_cost)
.setExpirationPeriod(time::milliseconds::max()),
- bind(&AutoregServer::onRegisterCommandSuccess, this, faceId, prefix),
- bind(&AutoregServer::onRegisterCommandFailure, this, faceId, prefix, _1));
+ std::bind(&AutoregServer::onRegisterCommandSuccess, this, faceId, prefix),
+ std::bind(&AutoregServer::onRegisterCommandFailure, this, faceId, prefix, _1));
}
}
@@ -154,12 +154,6 @@
}
}
- void
- signalHandler()
- {
- m_face.shutdown();
- }
-
static void
usage(std::ostream& os,
const boost::program_options::options_description& desc,
@@ -194,11 +188,11 @@
std::cout << " " << network << std::endl;
}
- m_faceMonitor.onNotification.connect(bind(&AutoregServer::onNotification, this, _1));
+ m_faceMonitor.onNotification.connect(std::bind(&AutoregServer::onNotification, this, _1));
m_faceMonitor.start();
boost::asio::signal_set signalSet(m_face.getIoService(), SIGINT, SIGTERM);
- signalSet.async_wait(bind(&AutoregServer::signalHandler, this));
+ signalSet.async_wait([this] (auto&&...) { m_face.shutdown(); });
m_face.processEvents();
}
@@ -207,13 +201,13 @@
startFetchingFaceStatusDataset()
{
m_controller.fetch<nfd::FaceDataset>(
- [this] (const std::vector<nfd::FaceStatus>& faces) {
+ [this] (const auto& faces) {
for (const auto& faceStatus : faces) {
registerPrefixesIfNeeded(faceStatus.getFaceId(), FaceUri(faceStatus.getRemoteUri()),
faceStatus.getFacePersistency());
}
},
- [] (uint32_t code, const std::string& reason) {});
+ [] (auto&&...) {});
}
int
diff --git a/tools/nfdc/command-arguments.hpp b/tools/nfdc/command-arguments.hpp
index 164a672..1d0c9bd 100644
--- a/tools/nfdc/command-arguments.hpp
+++ b/tools/nfdc/command-arguments.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,6 +30,7 @@
#include "status-report.hpp"
#include <ndn-cxx/encoding/nfd-constants.hpp>
+#include <ndn-cxx/util/any.hpp>
#include <boost/logic/tribool.hpp>
diff --git a/tools/nfdc/face-module.cpp b/tools/nfdc/face-module.cpp
index e46279d2..18862aa 100644
--- a/tools/nfdc/face-module.cpp
+++ b/tools/nfdc/face-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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -236,7 +236,7 @@
if (isChangingParams) {
ctx.controller.start<ndn::nfd::FaceUpdateCommand>(
params,
- bind(updateFace, respParams, _1),
+ [=, &updateFace] (const auto& cp) { updateFace(respParams, cp); },
ctx.makeCommandFailureHandler("updating face"),
ctx.makeCommandOptions());
}
diff --git a/tools/nfdc/format-helpers.cpp b/tools/nfdc/format-helpers.cpp
index fa72512..a207bf8 100644
--- a/tools/nfdc/format-helpers.cpp
+++ b/tools/nfdc/format-helpers.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -110,9 +110,9 @@
}
std::string
-formatTimestamp(time::system_clock::TimePoint t)
+formatTimestamp(time::system_clock::time_point t)
{
- return time::toString(t, "%Y-%m-%dT%H:%M:%S%F");
+ return time::toIsoExtendedString(t);
}
} // namespace xml
@@ -199,7 +199,7 @@
}
std::string
-formatTimestamp(time::system_clock::TimePoint t)
+formatTimestamp(time::system_clock::time_point t)
{
return time::toIsoString(t);
}
diff --git a/tools/nfdc/format-helpers.hpp b/tools/nfdc/format-helpers.hpp
index 1ee88ee..95f3310 100644
--- a/tools/nfdc/format-helpers.hpp
+++ b/tools/nfdc/format-helpers.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-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -73,7 +73,7 @@
* Definition of this format: https://www.w3.org/TR/xmlschema11-2/#dateTime
*/
std::string
-formatTimestamp(time::system_clock::TimePoint t);
+formatTimestamp(time::system_clock::time_point t);
} // namespace xml
@@ -262,7 +262,7 @@
}
std::string
-formatTimestamp(time::system_clock::TimePoint t);
+formatTimestamp(time::system_clock::time_point t);
} // namespace text
diff --git a/tools/nfdc/forwarder-general-module.cpp b/tools/nfdc/forwarder-general-module.cpp
index 417b346..1542b9f 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-2018, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -46,7 +46,7 @@
onFailure, options);
}
-static time::system_clock::Duration
+static auto
calculateUptime(const ForwarderStatus& status)
{
return status.getCurrentTimestamp() - status.getStartTimestamp();
diff --git a/tools/nfdc/status.cpp b/tools/nfdc/status.cpp
index 441c3a9..a338b1d 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-2020, Regents of the University of California,
+ * Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -128,25 +128,29 @@
CommandDefinition defStatusShow("status", "show");
defStatusShow
.setTitle("print general status");
- parser.addCommand(defStatusShow, bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantForwarderGeneral));
+ parser.addCommand(defStatusShow,
+ std::bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantForwarderGeneral));
parser.addAlias("status", "show", "");
CommandDefinition defChannelList("channel", "list");
defChannelList
.setTitle("print channel list");
- parser.addCommand(defChannelList, bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantChannels));
+ parser.addCommand(defChannelList,
+ std::bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantChannels));
parser.addAlias("channel", "list", "");
CommandDefinition defFibList("fib", "list");
defFibList
.setTitle("print FIB entries");
- parser.addCommand(defFibList, bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantFib));
+ parser.addCommand(defFibList,
+ std::bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantFib));
parser.addAlias("fib", "list", "");
CommandDefinition defCsInfo("cs", "info");
defCsInfo
.setTitle("print CS information");
- parser.addCommand(defCsInfo, bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantCs));
+ parser.addCommand(defCsInfo,
+ std::bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantCs));
parser.addAlias("cs", "info", "");
}