Slim down `common.hpp`
Change-Id: Ic9843a1b9ffc5b5b1fa6062c8250ba28c6aaa898
diff --git a/core/common.hpp b/core/common.hpp
index 06e4fe1..e76cb12 100644
--- a/core/common.hpp
+++ b/core/common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -40,42 +40,23 @@
#include <cstddef>
#include <cstdint>
-#include <functional>
-#include <iostream>
-#include <limits>
+#include <iosfwd>
#include <memory>
-#include <optional>
#include <stdexcept>
#include <string>
#include <string_view>
#include <utility>
-#include <vector>
#include <boost/assert.hpp>
#include <boost/core/noncopyable.hpp>
-#include <boost/lexical_cast.hpp>
#include <ndn-cxx/data.hpp>
-#include <ndn-cxx/face.hpp>
#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/name.hpp>
-#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/util/backports.hpp>
-#include <ndn-cxx/util/exception.hpp>
-#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/time.hpp>
namespace ndn {
-
-using std::shared_ptr;
-using std::unique_ptr;
-using std::make_shared;
-using std::make_unique;
-
-using std::size_t;
-
using boost::noncopyable;
-
} // namespace ndn
#define FORWARD_TO_MEM_FN(func) \
diff --git a/core/program-options-ext.hpp b/core/program-options-ext.hpp
index 16b4e41..a505ece 100644
--- a/core/program-options-ext.hpp
+++ b/core/program-options-ext.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -28,6 +28,7 @@
#include <ndn-cxx/name.hpp>
#include <boost/program_options/value_semantic.hpp>
+#include <vector>
namespace ndn {
diff --git a/core/version.hpp b/core/version.hpp
index 2a20a1a..3b937fc 100644
--- a/core/version.hpp
+++ b/core/version.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Arizona Board of Regents.
+ * Copyright (c) 2014-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -20,8 +20,6 @@
#ifndef NDN_TOOLS_CORE_VERSION_HPP
#define NDN_TOOLS_CORE_VERSION_HPP
-#include "core/common.hpp"
-
namespace ndn::tools {
/**
diff --git a/tests/chunks/consumer.t.cpp b/tests/chunks/consumer.t.cpp
index b1231dc..741ee03 100644
--- a/tests/chunks/consumer.t.cpp
+++ b/tests/chunks/consumer.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2023, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -99,7 +99,7 @@
Consumer cons(security::getAcceptAllValidator(), output);
auto interest = makeInterest(name, true);
- std::vector<shared_ptr<Data>> dataStore;
+ std::vector<std::shared_ptr<Data>> dataStore;
for (size_t i = 0; i < testStrings.size(); ++i) {
auto data = makeData(Name(name).appendVersion(1).appendSegment(i));
@@ -153,8 +153,8 @@
Consumer consumer(security::getAcceptAllValidator());
Name prefix = Name("/ndn/chunks/test").appendVersion(1);
- auto discover = make_unique<DiscoverVersion>(face, prefix, options);
- auto pipeline = make_unique<PipelineInterestsDummy>(face, options);
+ auto discover = std::make_unique<DiscoverVersion>(face, prefix, options);
+ auto pipeline = std::make_unique<PipelineInterestsDummy>(face, options);
auto pipelinePtr = pipeline.get();
BOOST_CHECK_EQUAL(pipelinePtr->isPipelineRunning, false);
diff --git a/tests/chunks/discover-version.t.cpp b/tests/chunks/discover-version.t.cpp
index 01e360e..6b429b8 100644
--- a/tests/chunks/discover-version.t.cpp
+++ b/tests/chunks/discover-version.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2023, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -42,7 +42,7 @@
void
run(const Name& prefix)
{
- discover = make_unique<DiscoverVersion>(face, prefix, opt);
+ discover = std::make_unique<DiscoverVersion>(face, prefix, opt);
discover->onDiscoverySuccess.connect([this] (const Name& versionedName) {
isDiscoveryFinished = true;
discoveredName = versionedName;
@@ -62,7 +62,7 @@
const uint64_t version = 1449227841747;
DummyClientFace face{m_io};
Options opt;
- unique_ptr<DiscoverVersion> discover;
+ std::unique_ptr<DiscoverVersion> discover;
std::optional<Name> discoveredName;
std::optional<uint64_t> discoveredVersion;
bool isDiscoveryFinished = false;
diff --git a/tests/chunks/pipeline-interests-aimd.t.cpp b/tests/chunks/pipeline-interests-aimd.t.cpp
index 12eeaa5..4688ee4 100644
--- a/tests/chunks/pipeline-interests-aimd.t.cpp
+++ b/tests/chunks/pipeline-interests-aimd.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -29,6 +29,8 @@
#include "pipeline-interests-fixture.hpp"
+#include <cmath>
+
namespace ndn::chunks::tests {
using namespace ndn::tests;
@@ -45,16 +47,16 @@
void
createPipeline()
{
- auto pline = make_unique<PipelineInterestsAimd>(face, rttEstimator, opt);
+ auto pline = std::make_unique<PipelineInterestsAimd>(face, rttEstimator, opt);
pipeline = pline.get();
setPipeline(std::move(pline));
}
private:
- static shared_ptr<RttEstimatorWithStats::Options>
+ static std::shared_ptr<RttEstimatorWithStats::Options>
makeRttEstimatorOptions()
{
- auto rttOptions = make_shared<RttEstimatorWithStats::Options>();
+ auto rttOptions = std::make_shared<RttEstimatorWithStats::Options>();
rttOptions->alpha = 0.125;
rttOptions->beta = 0.25;
rttOptions->k = 4;
@@ -118,7 +120,7 @@
for (uint64_t i = pipeline->m_ssthresh; i < nDataSegments - 1; ++i) { // congestion avoidance
face.receive(*makeDataWithSegment(i));
advanceClocks(time::nanoseconds(1));
- BOOST_CHECK_CLOSE(pipeline->m_cwnd - preCwnd, opt.aiStep / floor(preCwnd), MARGIN);
+ BOOST_CHECK_CLOSE(pipeline->m_cwnd - preCwnd, opt.aiStep / std::floor(preCwnd), MARGIN);
preCwnd = pipeline->m_cwnd;
}
diff --git a/tests/chunks/pipeline-interests-cubic.t.cpp b/tests/chunks/pipeline-interests-cubic.t.cpp
index d84cce5..6a36105 100644
--- a/tests/chunks/pipeline-interests-cubic.t.cpp
+++ b/tests/chunks/pipeline-interests-cubic.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -45,16 +45,16 @@
void
createPipeline()
{
- auto pline = make_unique<PipelineInterestsCubic>(face, rttEstimator, opt);
+ auto pline = std::make_unique<PipelineInterestsCubic>(face, rttEstimator, opt);
pipeline = pline.get();
setPipeline(std::move(pline));
}
private:
- static shared_ptr<RttEstimatorWithStats::Options>
+ static std::shared_ptr<RttEstimatorWithStats::Options>
makeRttEstimatorOptions()
{
- auto rttOptions = make_shared<RttEstimatorWithStats::Options>();
+ auto rttOptions = std::make_shared<RttEstimatorWithStats::Options>();
rttOptions->alpha = 0.125;
rttOptions->beta = 0.25;
rttOptions->k = 8;
diff --git a/tests/chunks/pipeline-interests-fixed.t.cpp b/tests/chunks/pipeline-interests-fixed.t.cpp
index b4f9723..24f14e9 100644
--- a/tests/chunks/pipeline-interests-fixed.t.cpp
+++ b/tests/chunks/pipeline-interests-fixed.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -29,6 +29,8 @@
#include "pipeline-interests-fixture.hpp"
+#include <cmath>
+
namespace ndn::chunks::tests {
class PipelineInterestFixedFixture : public PipelineInterestsFixture
@@ -46,7 +48,7 @@
void
createPipeline()
{
- auto pline = make_unique<PipelineInterestsFixed>(face, opt);
+ auto pline = std::make_unique<PipelineInterestsFixed>(face, opt);
pipeline = pline.get();
setPipeline(std::move(pline));
}
@@ -187,7 +189,7 @@
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), opt.maxPipelineSize * 3 - 2);
// nack for the first pipeline element (segment #0)
- auto nack = make_shared<lp::Nack>(face.sentInterests[opt.maxPipelineSize]);
+ auto nack = std::make_shared<lp::Nack>(face.sentInterests[opt.maxPipelineSize]);
nack->setReason(lp::NackReason::DUPLICATE);
face.receive(*nack);
@@ -232,7 +234,7 @@
advanceClocks(opt.interestLifetime);
// nack for the first pipeline element (segment #0)
- auto nack = make_shared<lp::Nack>(face.sentInterests[opt.maxPipelineSize]);
+ auto nack = std::make_shared<lp::Nack>(face.sentInterests[opt.maxPipelineSize]);
nack->setReason(lp::NackReason::DUPLICATE);
face.receive(*nack);
BOOST_CHECK_EQUAL(hasFailed, false);
@@ -261,7 +263,7 @@
// send nack for all the pipeline elements first interest
for (size_t i = 0; i < opt.maxPipelineSize; i++) {
- auto nack = make_shared<lp::Nack>(face.sentInterests[i]);
+ auto nack = std::make_shared<lp::Nack>(face.sentInterests[i]);
nack->setReason(lp::NackReason::CONGESTION);
face.receive(*nack);
advanceClocks(time::nanoseconds(1));
@@ -283,7 +285,7 @@
}
for (size_t j = 0; j < opt.maxPipelineSize; j++) {
- auto nack = make_shared<lp::Nack>(face.sentInterests[(opt.maxPipelineSize * i) + j]);
+ auto nack = std::make_shared<lp::Nack>(face.sentInterests[(opt.maxPipelineSize * i) + j]);
nack->setReason(lp::NackReason::CONGESTION);
face.receive(*nack);
advanceClocks(time::nanoseconds(1));
diff --git a/tests/chunks/pipeline-interests-fixture.hpp b/tests/chunks/pipeline-interests-fixture.hpp
index 215f544..4e42223 100644
--- a/tests/chunks/pipeline-interests-fixture.hpp
+++ b/tests/chunks/pipeline-interests-fixture.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2023, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -44,21 +44,21 @@
{
protected:
void
- setPipeline(unique_ptr<PipelineInterests> pline)
+ setPipeline(std::unique_ptr<PipelineInterests> pline)
{
m_pipeline = std::move(pline);
}
- shared_ptr<Data>
+ std::shared_ptr<Data>
makeDataWithSegment(uint64_t segmentNo, bool setFinalBlockId = true) const
{
- auto data = make_shared<Data>(Name(name).appendVersion(0).appendSegment(segmentNo));
+ auto data = std::make_shared<Data>(Name(name).appendVersion(0).appendSegment(segmentNo));
if (setFinalBlockId)
data->setFinalBlock(name::Component::fromSegment(nDataSegments - 1));
return signData(data);
}
- shared_ptr<Data>
+ std::shared_ptr<Data>
makeDataWithSegmentAndCongMark(uint64_t segmentNo,
uint64_t congestionMark = 1,
bool setFinalBlockId = true) const
@@ -83,7 +83,7 @@
bool hasFailed = false;
private:
- unique_ptr<PipelineInterests> m_pipeline;
+ std::unique_ptr<PipelineInterests> m_pipeline;
};
} // namespace ndn::chunks::tests
diff --git a/tests/peek/ndnpeek.t.cpp b/tests/peek/ndnpeek.t.cpp
index 8a51b8e..0764f0c 100644
--- a/tests/peek/ndnpeek.t.cpp
+++ b/tests/peek/ndnpeek.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Arizona Board of Regents.
+ * Copyright (c) 2014-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -24,6 +24,7 @@
#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <boost/lexical_cast.hpp>
#include <boost/test/tools/output_test_stream.hpp>
namespace ndn::peek::tests {
@@ -63,13 +64,13 @@
void
initialize(const PeekOptions& opts = makeDefaultOptions())
{
- peek = make_unique<NdnPeek>(face, opts);
+ peek = std::make_unique<NdnPeek>(face, opts);
}
protected:
DummyClientFace face{m_io};
output_test_stream output;
- unique_ptr<NdnPeek> peek;
+ std::unique_ptr<NdnPeek> peek;
};
class OutputFull
@@ -232,7 +233,7 @@
BOOST_AUTO_TEST_CASE(ApplicationParameters)
{
auto options = makeDefaultOptions();
- options.applicationParameters = make_shared<Buffer>("hello", 5);
+ options.applicationParameters = std::make_shared<Buffer>("hello", 5);
initialize(options);
peek->start();
@@ -305,7 +306,7 @@
BOOST_AUTO_TEST_CASE(OversizedPacket)
{
auto options = makeDefaultOptions();
- options.applicationParameters = make_shared<Buffer>(MAX_NDN_PACKET_SIZE);
+ options.applicationParameters = std::make_shared<Buffer>(MAX_NDN_PACKET_SIZE);
initialize(options);
peek->start();
diff --git a/tests/peek/ndnpoke.t.cpp b/tests/peek/ndnpoke.t.cpp
index b20f377..1c2a2c0 100644
--- a/tests/peek/ndnpoke.t.cpp
+++ b/tests/peek/ndnpoke.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -47,7 +47,7 @@
void
initialize(const PokeOptions& opts = makeDefaultOptions())
{
- poke = make_unique<NdnPoke>(face, m_keyChain, payload, opts);
+ poke = std::make_unique<NdnPoke>(face, m_keyChain, payload, opts);
}
static PokeOptions
@@ -61,7 +61,7 @@
protected:
DummyClientFace face{m_io, m_keyChain, {true, WANT_PREFIX_REG_REPLY}};
std::stringstream payload{"Hello, world!\n"};
- unique_ptr<NdnPoke> poke;
+ std::unique_ptr<NdnPoke> poke;
};
BOOST_AUTO_TEST_SUITE(Peek)
diff --git a/tests/ping/client/statistics-collector.t.cpp b/tests/ping/client/statistics-collector.t.cpp
index 5d3e0d3..30f2c4b 100644
--- a/tests/ping/client/statistics-collector.t.cpp
+++ b/tests/ping/client/statistics-collector.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Arizona Board of Regents.
+ * Copyright (c) 2014-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -22,6 +22,7 @@
#include "tests/test-common.hpp"
#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <cmath>
namespace ndn::ping::client::tests {
diff --git a/tests/ping/integrated.t.cpp b/tests/ping/integrated.t.cpp
index 4a85fda..caad9f8 100644
--- a/tests/ping/integrated.t.cpp
+++ b/tests/ping/integrated.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2023, Arizona Board of Regents.
+ * Copyright (c) 2015-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -54,7 +54,7 @@
void
receive(DummyClientFace& face, const Packet& pkt)
{
- boost::asio::post(m_io, [=, &face] {
+ boost::asio::post(m_io, [&face, pkt, wantLoss = wantLoss] {
if (!wantLoss) {
face.receive(pkt);
}
@@ -88,7 +88,7 @@
serverOpts.nMaxPings = 4;
serverOpts.wantTimestamp = false;
serverOpts.payloadSize = 0;
- server = make_unique<server::PingServer>(serverFace, m_keyChain, serverOpts);
+ server = std::make_unique<server::PingServer>(serverFace, m_keyChain, serverOpts);
BOOST_REQUIRE_EQUAL(0, server->getNPings());
server->start();
@@ -101,7 +101,7 @@
clientOpts.interval = 100_ms;
clientOpts.timeout = 2_s;
clientOpts.startSeq = 1000;
- client = make_unique<client::Ping>(clientFace, clientOpts);
+ client = std::make_unique<client::Ping>(clientFace, clientOpts);
client->afterFinish.connect([this] { onFinish(); });
client->start();
@@ -121,7 +121,7 @@
serverOpts.nMaxPings = 4;
serverOpts.wantTimestamp = false;
serverOpts.payloadSize = 0;
- server = make_unique<server::PingServer>(serverFace, m_keyChain, serverOpts);
+ server = std::make_unique<server::PingServer>(serverFace, m_keyChain, serverOpts);
BOOST_REQUIRE_EQUAL(0, server->getNPings());
server->start();
@@ -134,7 +134,7 @@
clientOpts.interval = 100_ms;
clientOpts.timeout = 500_ms;
clientOpts.startSeq = 1000;
- client = make_unique<client::Ping>(clientFace, clientOpts);
+ client = std::make_unique<client::Ping>(clientFace, clientOpts);
client->afterFinish.connect([this] { onFinish(); });
client->start();
diff --git a/tests/test-common.cpp b/tests/test-common.cpp
index 89a764c..91ebcd4 100644
--- a/tests/test-common.cpp
+++ b/tests/test-common.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,7 +27,7 @@
namespace ndn::tests {
-shared_ptr<Interest>
+std::shared_ptr<Interest>
makeInterest(const Name& name, bool canBePrefix, std::optional<time::milliseconds> lifetime,
std::optional<Interest::Nonce> nonce)
{
@@ -40,7 +40,7 @@
return interest;
}
-shared_ptr<Data>
+std::shared_ptr<Data>
makeData(const Name& name)
{
auto data = std::make_shared<Data>(name);
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index a6edb6e..6e66933 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,48 +29,51 @@
#include "core/common.hpp"
#include "tests/boost-test.hpp"
+#include <ndn-cxx/lp/nack.hpp>
+#include <optional>
+
namespace ndn::tests {
/**
- * \brief Create an Interest
+ * \brief Create an Interest.
*/
-shared_ptr<Interest>
+std::shared_ptr<Interest>
makeInterest(const Name& name, bool canBePrefix = false,
std::optional<time::milliseconds> lifetime = std::nullopt,
std::optional<Interest::Nonce> nonce = std::nullopt);
/**
- * \brief Create a Data with a null (i.e., empty) signature
+ * \brief Create a Data with a null (i.e., empty) signature.
*
* If a "real" signature is desired, use KeyChainFixture and sign again with `m_keyChain`.
*/
-shared_ptr<Data>
+std::shared_ptr<Data>
makeData(const Name& name);
/**
- * \brief Add a null signature to \p data
+ * \brief Add a null signature to \p data.
*/
Data&
signData(Data& data);
/**
- * \brief Add a null signature to \p data
+ * \brief Add a null signature to \p data.
*/
-inline shared_ptr<Data>
-signData(shared_ptr<Data> data)
+inline std::shared_ptr<Data>
+signData(std::shared_ptr<Data> data)
{
signData(*data);
return data;
}
/**
- * \brief Create a Nack
+ * \brief Create a Nack.
*/
lp::Nack
makeNack(Interest interest, lp::NackReason reason);
/**
- * \brief Replace a name component in a packet
+ * \brief Replace a name component in a packet.
* \param[in,out] pkt the packet
* \param index the index of the name component to replace
* \param args arguments to name::Component constructor
diff --git a/tools/chunks/catchunks/consumer.cpp b/tools/chunks/catchunks/consumer.cpp
index a1c2edf..6d30d70 100644
--- a/tools/chunks/catchunks/consumer.cpp
+++ b/tools/chunks/catchunks/consumer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -27,6 +27,8 @@
#include "consumer.hpp"
+#include <ndn-cxx/util/exception.hpp>
+
namespace ndn::chunks {
Consumer::Consumer(security::Validator& validator, std::ostream& os)
@@ -36,7 +38,7 @@
}
void
-Consumer::run(unique_ptr<DiscoverVersion> discover, unique_ptr<PipelineInterests> pipeline)
+Consumer::run(std::unique_ptr<DiscoverVersion> discover, std::unique_ptr<PipelineInterests> pipeline)
{
m_discover = std::move(discover);
m_pipeline = std::move(pipeline);
diff --git a/tools/chunks/catchunks/consumer.hpp b/tools/chunks/catchunks/consumer.hpp
index 8423ace..980df60 100644
--- a/tools/chunks/catchunks/consumer.hpp
+++ b/tools/chunks/catchunks/consumer.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -34,12 +34,14 @@
#include <ndn-cxx/security/validation-error.hpp>
#include <ndn-cxx/security/validator.hpp>
+#include <boost/lexical_cast.hpp>
+#include <iostream>
#include <map>
namespace ndn::chunks {
/**
- * @brief Segmented version consumer
+ * @brief Segmented version consumer.
*
* Discover the latest version of the data published under a specified prefix, and retrieve all the
* segments associated to that version. The segments are fetched in order and written to a
@@ -78,7 +80,7 @@
* @brief Run the consumer
*/
void
- run(unique_ptr<DiscoverVersion> discover, unique_ptr<PipelineInterests> pipeline);
+ run(std::unique_ptr<DiscoverVersion> discover, std::unique_ptr<PipelineInterests> pipeline);
private:
void
@@ -91,12 +93,12 @@
private:
security::Validator& m_validator;
std::ostream& m_outputStream;
- unique_ptr<DiscoverVersion> m_discover;
- unique_ptr<PipelineInterests> m_pipeline;
+ std::unique_ptr<DiscoverVersion> m_discover;
+ std::unique_ptr<PipelineInterests> m_pipeline;
uint64_t m_nextToPrint = 0;
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
- std::map<uint64_t, shared_ptr<const Data>> m_bufferedData;
+ std::map<uint64_t, std::shared_ptr<const Data>> m_bufferedData;
};
} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/data-fetcher.cpp b/tools/chunks/catchunks/data-fetcher.cpp
index ccc142a..e058ca0 100644
--- a/tools/chunks/catchunks/data-fetcher.cpp
+++ b/tools/chunks/catchunks/data-fetcher.cpp
@@ -26,22 +26,25 @@
#include "data-fetcher.hpp"
+#include <boost/lexical_cast.hpp>
+
#include <cmath>
+#include <iostream>
namespace ndn::chunks {
-shared_ptr<DataFetcher>
+std::shared_ptr<DataFetcher>
DataFetcher::fetch(Face& face, const Interest& interest, int maxNackRetries, int maxTimeoutRetries,
DataCallback onData, FailureCallback onNack, FailureCallback onTimeout,
bool isVerbose)
{
- auto dataFetcher = shared_ptr<DataFetcher>(new DataFetcher(face,
- maxNackRetries,
- maxTimeoutRetries,
- std::move(onData),
- std::move(onNack),
- std::move(onTimeout),
- isVerbose));
+ auto dataFetcher = std::shared_ptr<DataFetcher>(new DataFetcher(face,
+ maxNackRetries,
+ maxTimeoutRetries,
+ std::move(onData),
+ std::move(onNack),
+ std::move(onTimeout),
+ isVerbose));
dataFetcher->expressInterest(interest, dataFetcher);
return dataFetcher;
}
@@ -72,18 +75,18 @@
}
void
-DataFetcher::expressInterest(const Interest& interest, const shared_ptr<DataFetcher>& self)
+DataFetcher::expressInterest(const Interest& interest, const std::shared_ptr<DataFetcher>& self)
{
m_nCongestionRetries = 0;
m_pendingInterest = m_face.expressInterest(interest,
- [=] (auto&&... args) { handleData(std::forward<decltype(args)>(args)..., self); },
- [=] (auto&&... args) { handleNack(std::forward<decltype(args)>(args)..., self); },
- [=] (auto&&... args) { handleTimeout(std::forward<decltype(args)>(args)..., self); });
+ [this, self] (auto&&... args) { handleData(std::forward<decltype(args)>(args)..., self); },
+ [this, self] (auto&&... args) { handleNack(std::forward<decltype(args)>(args)..., self); },
+ [this, self] (auto&&... args) { handleTimeout(std::forward<decltype(args)>(args)..., self); });
}
void
DataFetcher::handleData(const Interest& interest, const Data& data,
- const shared_ptr<DataFetcher>& self)
+ const std::shared_ptr<DataFetcher>& self)
{
if (!isRunning())
return;
@@ -94,7 +97,7 @@
void
DataFetcher::handleNack(const Interest& interest, const lp::Nack& nack,
- const shared_ptr<DataFetcher>& self)
+ const std::shared_ptr<DataFetcher>& self)
{
if (!isRunning())
return;
@@ -123,7 +126,9 @@
else {
m_nCongestionRetries++;
}
- m_scheduler.schedule(backoffTime, [=] { expressInterest(newInterest, self); });
+ m_scheduler.schedule(backoffTime, [this, newInterest, self] {
+ expressInterest(newInterest, self);
+ });
break;
}
default: {
@@ -144,7 +149,7 @@
}
void
-DataFetcher::handleTimeout(const Interest& interest, const shared_ptr<DataFetcher>& self)
+DataFetcher::handleTimeout(const Interest& interest, const std::shared_ptr<DataFetcher>& self)
{
if (!isRunning())
return;
diff --git a/tools/chunks/catchunks/data-fetcher.hpp b/tools/chunks/catchunks/data-fetcher.hpp
index c51d577..765963d 100644
--- a/tools/chunks/catchunks/data-fetcher.hpp
+++ b/tools/chunks/catchunks/data-fetcher.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -29,6 +29,11 @@
#include "core/common.hpp"
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
+
+#include <functional>
+
namespace ndn::chunks {
/**
@@ -66,7 +71,7 @@
*
* @param onData callback for segment correctly received, must not be empty
*/
- static shared_ptr<DataFetcher>
+ static std::shared_ptr<DataFetcher>
fetch(Face& face, const Interest& interest, int maxNackRetries, int maxTimeoutRetries,
DataCallback onData, FailureCallback onTimeout, FailureCallback onNack,
bool isVerbose);
@@ -95,16 +100,16 @@
bool isVerbose);
void
- expressInterest(const Interest& interest, const shared_ptr<DataFetcher>& self);
+ expressInterest(const Interest& interest, const std::shared_ptr<DataFetcher>& self);
void
- handleData(const Interest& interest, const Data& data, const shared_ptr<DataFetcher>& self);
+ handleData(const Interest& interest, const Data& data, const std::shared_ptr<DataFetcher>& self);
void
- handleNack(const Interest& interest, const lp::Nack& nack, const shared_ptr<DataFetcher>& self);
+ handleNack(const Interest& interest, const lp::Nack& nack, const std::shared_ptr<DataFetcher>& self);
void
- handleTimeout(const Interest& interest, const shared_ptr<DataFetcher>& self);
+ handleTimeout(const Interest& interest, const std::shared_ptr<DataFetcher>& self);
private:
Face& m_face;
diff --git a/tools/chunks/catchunks/discover-version.cpp b/tools/chunks/catchunks/discover-version.cpp
index 5eae250..3e75850 100644
--- a/tools/chunks/catchunks/discover-version.cpp
+++ b/tools/chunks/catchunks/discover-version.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -31,6 +31,8 @@
#include <ndn-cxx/metadata-object.hpp>
+#include <iostream>
+
namespace ndn::chunks {
DiscoverVersion::DiscoverVersion(Face& face, const Name& prefix, const Options& options)
diff --git a/tools/chunks/catchunks/discover-version.hpp b/tools/chunks/catchunks/discover-version.hpp
index 3f6620e..1098d85 100644
--- a/tools/chunks/catchunks/discover-version.hpp
+++ b/tools/chunks/catchunks/discover-version.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2023, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -31,6 +31,7 @@
#include "options.hpp"
+#include <ndn-cxx/face.hpp>
#include <ndn-cxx/util/signal.hpp>
namespace ndn::chunks {
@@ -69,7 +70,7 @@
Face& m_face;
const Name m_prefix;
const Options& m_options;
- shared_ptr<DataFetcher> m_fetcher;
+ std::shared_ptr<DataFetcher> m_fetcher;
};
} // namespace ndn::chunks
diff --git a/tools/chunks/catchunks/main.cpp b/tools/chunks/catchunks/main.cpp
index e89d904..6c763a9 100644
--- a/tools/chunks/catchunks/main.cpp
+++ b/tools/chunks/catchunks/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -37,7 +37,6 @@
#include "statistics-collector.hpp"
#include "core/version.hpp"
-#include <fstream>
#include <ndn-cxx/security/validator-null.hpp>
#include <ndn-cxx/util/rtt-estimator.hpp>
@@ -45,6 +44,9 @@
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
+#include <fstream>
+#include <iostream>
+
namespace ndn::chunks {
namespace po = boost::program_options;
@@ -57,7 +59,7 @@
Options options;
std::string prefix, nameConv, pipelineType("cubic");
std::string cwndPath, rttPath;
- auto rttEstOptions = make_shared<util::RttEstimator::Options>();
+ auto rttEstOptions = std::make_shared<util::RttEstimator::Options>();
rttEstOptions->k = 8; // increased from the ndn-cxx default of 4
po::options_description basicDesc("Basic Options");
@@ -229,15 +231,15 @@
try {
Face face;
- auto discover = make_unique<DiscoverVersion>(face, Name(prefix), options);
- unique_ptr<PipelineInterests> pipeline;
- unique_ptr<StatisticsCollector> statsCollector;
- unique_ptr<RttEstimatorWithStats> rttEstimator;
+ auto discover = std::make_unique<DiscoverVersion>(face, Name(prefix), options);
+ std::unique_ptr<PipelineInterests> pipeline;
+ std::unique_ptr<StatisticsCollector> statsCollector;
+ std::unique_ptr<RttEstimatorWithStats> rttEstimator;
std::ofstream statsFileCwnd;
std::ofstream statsFileRtt;
if (pipelineType == "fixed") {
- pipeline = make_unique<PipelineInterestsFixed>(face, options);
+ pipeline = std::make_unique<PipelineInterestsFixed>(face, options);
}
else if (pipelineType == "aimd" || pipelineType == "cubic") {
if (options.isVerbose) {
@@ -251,14 +253,14 @@
<< "\tMax RTO = " << duration_cast<milliseconds>(rttEstOptions->maxRto) << "\n"
<< "\tBackoff multiplier = " << rttEstOptions->rtoBackoffMultiplier << "\n";
}
- rttEstimator = make_unique<RttEstimatorWithStats>(std::move(rttEstOptions));
+ rttEstimator = std::make_unique<RttEstimatorWithStats>(std::move(rttEstOptions));
- unique_ptr<PipelineInterestsAdaptive> adaptivePipeline;
+ std::unique_ptr<PipelineInterestsAdaptive> adaptivePipeline;
if (pipelineType == "aimd") {
- adaptivePipeline = make_unique<PipelineInterestsAimd>(face, *rttEstimator, options);
+ adaptivePipeline = std::make_unique<PipelineInterestsAimd>(face, *rttEstimator, options);
}
else {
- adaptivePipeline = make_unique<PipelineInterestsCubic>(face, *rttEstimator, options);
+ adaptivePipeline = std::make_unique<PipelineInterestsCubic>(face, *rttEstimator, options);
}
if (!cwndPath.empty() || !rttPath.empty()) {
@@ -276,7 +278,7 @@
return 4;
}
}
- statsCollector = make_unique<StatisticsCollector>(*adaptivePipeline, statsFileCwnd, statsFileRtt);
+ statsCollector = std::make_unique<StatisticsCollector>(*adaptivePipeline, statsFileCwnd, statsFileRtt);
}
pipeline = std::move(adaptivePipeline);
diff --git a/tools/chunks/catchunks/options.hpp b/tools/chunks/catchunks/options.hpp
index c93e9c2..d21481a 100644
--- a/tools/chunks/catchunks/options.hpp
+++ b/tools/chunks/catchunks/options.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -27,11 +27,14 @@
#ifndef NDN_TOOLS_CHUNKS_CATCHUNKS_OPTIONS_HPP
#define NDN_TOOLS_CHUNKS_CATCHUNKS_OPTIONS_HPP
-#include "core/common.hpp"
+#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/util/time.hpp>
+
+#include <limits>
namespace ndn::chunks {
-struct Options : noncopyable
+struct Options
{
// Common options
time::milliseconds interestLifetime = DEFAULT_INTEREST_LIFETIME;
diff --git a/tools/chunks/catchunks/pipeline-interests-adaptive.cpp b/tools/chunks/catchunks/pipeline-interests-adaptive.cpp
index 78c4c6e..492229f 100644
--- a/tools/chunks/catchunks/pipeline-interests-adaptive.cpp
+++ b/tools/chunks/catchunks/pipeline-interests-adaptive.cpp
@@ -29,7 +29,9 @@
#include "pipeline-interests-adaptive.hpp"
#include "data-fetcher.hpp"
+#include <boost/lexical_cast.hpp>
#include <iomanip>
+#include <iostream>
namespace ndn::chunks {
diff --git a/tools/chunks/catchunks/pipeline-interests-adaptive.hpp b/tools/chunks/catchunks/pipeline-interests-adaptive.hpp
index 28e6207..572418f 100644
--- a/tools/chunks/catchunks/pipeline-interests-adaptive.hpp
+++ b/tools/chunks/catchunks/pipeline-interests-adaptive.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2023, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -32,6 +32,7 @@
#include "pipeline-interests.hpp"
#include <ndn-cxx/util/rtt-estimator.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/signal.hpp>
#include <queue>
diff --git a/tools/chunks/catchunks/pipeline-interests-cubic.cpp b/tools/chunks/catchunks/pipeline-interests-cubic.cpp
index 5eaf411..7fa57a5 100644
--- a/tools/chunks/catchunks/pipeline-interests-cubic.cpp
+++ b/tools/chunks/catchunks/pipeline-interests-cubic.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -26,6 +26,7 @@
#include "pipeline-interests-cubic.hpp"
#include <cmath>
+#include <iostream>
namespace ndn::chunks {
diff --git a/tools/chunks/catchunks/pipeline-interests-fixed.cpp b/tools/chunks/catchunks/pipeline-interests-fixed.cpp
index bd2559f..9e8ffa1 100644
--- a/tools/chunks/catchunks/pipeline-interests-fixed.cpp
+++ b/tools/chunks/catchunks/pipeline-interests-fixed.cpp
@@ -30,6 +30,8 @@
#include "pipeline-interests-fixed.hpp"
#include "data-fetcher.hpp"
+#include <iostream>
+
namespace ndn::chunks {
PipelineInterestsFixed::PipelineInterestsFixed(Face& face, const Options& opts)
@@ -88,13 +90,13 @@
auto fetcher = DataFetcher::fetch(m_face, interest,
m_options.maxRetriesOnTimeoutOrNack,
m_options.maxRetriesOnTimeoutOrNack,
- [=] (const auto& interest, const auto& data) {
+ [this, pipeNo] (const auto& interest, const auto& data) {
handleData(interest, data, pipeNo);
},
- [=] (const auto&, const auto& reason) {
+ [this, pipeNo] (const auto&, const auto& reason) {
handleFail(reason, pipeNo);
},
- [=] (const auto&, const auto& reason) {
+ [this, pipeNo] (const auto&, const auto& reason) {
handleFail(reason, pipeNo);
},
m_options.isVerbose);
diff --git a/tools/chunks/catchunks/pipeline-interests-fixed.hpp b/tools/chunks/catchunks/pipeline-interests-fixed.hpp
index a317ad2..8e9e3ce 100644
--- a/tools/chunks/catchunks/pipeline-interests-fixed.hpp
+++ b/tools/chunks/catchunks/pipeline-interests-fixed.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -32,6 +32,8 @@
#include "pipeline-interests.hpp"
+#include <vector>
+
namespace ndn::chunks {
class DataFetcher;
@@ -81,7 +83,7 @@
handleFail(const std::string& reason, size_t pipeNo);
private:
- std::vector<std::pair<shared_ptr<DataFetcher>, uint64_t>> m_segmentFetchers;
+ std::vector<std::pair<std::shared_ptr<DataFetcher>, uint64_t>> m_segmentFetchers;
/**
* true if one or more segment fetchers encountered an error; if m_hasFinalBlockId
diff --git a/tools/chunks/catchunks/pipeline-interests.cpp b/tools/chunks/catchunks/pipeline-interests.cpp
index 04d7fba..2e29487 100644
--- a/tools/chunks/catchunks/pipeline-interests.cpp
+++ b/tools/chunks/catchunks/pipeline-interests.cpp
@@ -34,6 +34,8 @@
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>
+#include <iostream>
+
namespace ndn::chunks {
PipelineInterests::PipelineInterests(Face& face, const Options& opts)
diff --git a/tools/chunks/catchunks/pipeline-interests.hpp b/tools/chunks/catchunks/pipeline-interests.hpp
index ea52d2f..2757b21 100644
--- a/tools/chunks/catchunks/pipeline-interests.hpp
+++ b/tools/chunks/catchunks/pipeline-interests.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -31,8 +31,13 @@
#ifndef NDN_TOOLS_CHUNKS_CATCHUNKS_PIPELINE_INTERESTS_HPP
#define NDN_TOOLS_CHUNKS_CATCHUNKS_PIPELINE_INTERESTS_HPP
+#include "core/common.hpp"
#include "options.hpp"
+#include <ndn-cxx/face.hpp>
+
+#include <functional>
+
namespace ndn::chunks {
/**
diff --git a/tools/chunks/putchunks/main.cpp b/tools/chunks/putchunks/main.cpp
index 8969e06..04bfec8 100644
--- a/tools/chunks/putchunks/main.cpp
+++ b/tools/chunks/putchunks/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -34,6 +34,8 @@
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
+#include <iostream>
+
namespace ndn::chunks {
namespace po = boost::program_options;
diff --git a/tools/chunks/putchunks/producer.cpp b/tools/chunks/putchunks/producer.cpp
index ab07517..d9591d1 100644
--- a/tools/chunks/putchunks/producer.cpp
+++ b/tools/chunks/putchunks/producer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2023, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -33,6 +33,8 @@
#include <ndn-cxx/metadata-object.hpp>
#include <ndn-cxx/util/segmenter.hpp>
+#include <iostream>
+
namespace ndn::chunks {
Producer::Producer(const Name& prefix, Face& face, KeyChain& keyChain, std::istream& is,
@@ -128,7 +130,7 @@
std::cerr << "Interest: " << interest << "\n";
const Name& name = interest.getName();
- shared_ptr<Data> data;
+ std::shared_ptr<Data> data;
if (name.size() == m_versionedPrefix.size() + 1 && name[-1].isSegment()) {
const auto segmentNo = static_cast<size_t>(interest.getName()[-1].toSegment());
diff --git a/tools/chunks/putchunks/producer.hpp b/tools/chunks/putchunks/producer.hpp
index afacabd..46b25d9 100644
--- a/tools/chunks/putchunks/producer.hpp
+++ b/tools/chunks/putchunks/producer.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2016-2022, Regents of the University of California,
+ * Copyright (c) 2016-2024, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -32,6 +32,11 @@
#include "core/common.hpp"
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+
+#include <vector>
+
namespace ndn::chunks {
/**
@@ -82,7 +87,7 @@
processSegmentInterest(const Interest& interest);
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
- std::vector<shared_ptr<Data>> m_store;
+ std::vector<std::shared_ptr<Data>> m_store;
private:
Name m_prefix;
diff --git a/tools/dissect/dissector.cpp b/tools/dissect/dissector.cpp
index 33677bc..c08a40d 100644
--- a/tools/dissect/dissector.cpp
+++ b/tools/dissect/dissector.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2023, Regents of the University of California.
+ * Copyright (c) 2013-2024, Regents of the University of California.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -24,12 +24,13 @@
#include "dissector.hpp"
-#include <map>
-
#include <ndn-cxx/encoding/tlv.hpp>
#include <ndn-cxx/encoding/tlv-security.hpp>
#include <ndn-cxx/util/string-helper.hpp>
+#include <iostream>
+#include <map>
+
namespace ndn::dissect {
Dissector::Dissector(std::istream& input, std::ostream& output, const Options& options)
diff --git a/tools/dissect/dissector.hpp b/tools/dissect/dissector.hpp
index 6ab7087..0e4232d 100644
--- a/tools/dissect/dissector.hpp
+++ b/tools/dissect/dissector.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California.
+ * Copyright (c) 2014-2024, Regents of the University of California.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -24,6 +24,8 @@
#include <ndn-cxx/encoding/block.hpp>
+#include <vector>
+
namespace ndn::dissect {
struct Options
diff --git a/tools/dissect/main.cpp b/tools/dissect/main.cpp
index 1cb6546..b6bf6ba 100644
--- a/tools/dissect/main.cpp
+++ b/tools/dissect/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California.
+ * Copyright (c) 2014-2024, Regents of the University of California.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -25,6 +25,7 @@
#include <boost/program_options/variables_map.hpp>
#include <fstream>
+#include <iostream>
namespace ndn::dissect {
diff --git a/tools/dump/main.cpp b/tools/dump/main.cpp
index 033ffc4..23d1821 100644
--- a/tools/dump/main.cpp
+++ b/tools/dump/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2011-2022, Regents of the University of California.
+ * Copyright (c) 2011-2024, Regents of the University of California.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -26,6 +26,7 @@
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
+#include <iostream>
#include <sstream>
namespace ndn::dump {
diff --git a/tools/dump/ndndump.cpp b/tools/dump/ndndump.cpp
index d17ae5b..a3f5fd0 100644
--- a/tools/dump/ndndump.cpp
+++ b/tools/dump/ndndump.cpp
@@ -29,12 +29,15 @@
#include <pcap/sll.h>
#include <iomanip>
+#include <iostream>
#include <sstream>
#include <ndn-cxx/lp/fields.hpp>
#include <ndn-cxx/lp/nack.hpp>
#include <ndn-cxx/lp/packet.hpp>
#include <ndn-cxx/net/ethernet.hpp>
+#include <ndn-cxx/util/backports.hpp>
+#include <ndn-cxx/util/exception.hpp>
#include <ndn-cxx/util/scope.hpp>
#include <ndn-cxx/util/string-helper.hpp>
diff --git a/tools/dump/ndndump.hpp b/tools/dump/ndndump.hpp
index 83b0710..8a10def 100644
--- a/tools/dump/ndndump.hpp
+++ b/tools/dump/ndndump.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2011-2022, Regents of the University of California.
+ * Copyright (c) 2011-2024, Regents of the University of California.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -23,6 +23,8 @@
#include "core/common.hpp"
#include <pcap.h>
+
+#include <optional>
#include <regex>
#ifdef HAVE_BSD_TCPHDR
diff --git a/tools/peek/ndnpeek/main.cpp b/tools/peek/ndnpeek/main.cpp
index 0bfb677..7b6fd38 100644
--- a/tools/peek/ndnpeek/main.cpp
+++ b/tools/peek/ndnpeek/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -40,6 +40,7 @@
#include <cerrno>
#include <cstring>
#include <fstream>
+#include <iostream>
namespace ndn::peek {
diff --git a/tools/peek/ndnpeek/ndnpeek.cpp b/tools/peek/ndnpeek/ndnpeek.cpp
index 3673224..919ce1e 100644
--- a/tools/peek/ndnpeek/ndnpeek.cpp
+++ b/tools/peek/ndnpeek/ndnpeek.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,6 +29,8 @@
#include "ndnpeek.hpp"
+#include <iostream>
+
namespace ndn::peek {
NdnPeek::NdnPeek(Face& face, const PeekOptions& options)
diff --git a/tools/peek/ndnpeek/ndnpeek.hpp b/tools/peek/ndnpeek/ndnpeek.hpp
index f7f246b..8d11bc8 100644
--- a/tools/peek/ndnpeek/ndnpeek.hpp
+++ b/tools/peek/ndnpeek/ndnpeek.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,9 +32,13 @@
#include "core/common.hpp"
+#include <ndn-cxx/face.hpp>
#include <ndn-cxx/link.hpp>
#include <ndn-cxx/util/scheduler.hpp>
+#include <optional>
+#include <vector>
+
namespace ndn::peek {
/**
@@ -49,7 +53,7 @@
std::vector<Name> forwardingHint;
time::milliseconds interestLifetime = DEFAULT_INTEREST_LIFETIME;
std::optional<uint8_t> hopLimit;
- shared_ptr<Buffer> applicationParameters;
+ std::shared_ptr<Buffer> applicationParameters;
// program behavior options
bool isVerbose = false;
diff --git a/tools/peek/ndnpoke/main.cpp b/tools/peek/ndnpoke/main.cpp
index a3e5ec2..4939d51 100644
--- a/tools/peek/ndnpoke/main.cpp
+++ b/tools/peek/ndnpoke/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -33,6 +33,8 @@
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
+#include <iostream>
+
namespace ndn::peek {
namespace po = boost::program_options;
diff --git a/tools/peek/ndnpoke/ndnpoke.cpp b/tools/peek/ndnpoke/ndnpoke.cpp
index 62a6c4a..ff8f937 100644
--- a/tools/peek/ndnpoke/ndnpoke.cpp
+++ b/tools/peek/ndnpoke/ndnpoke.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,6 +30,8 @@
#include <ndn-cxx/encoding/buffer-stream.hpp>
+#include <iostream>
+
namespace ndn::peek {
NdnPoke::NdnPoke(Face& face, KeyChain& keyChain, std::istream& input, const PokeOptions& options)
@@ -56,10 +58,10 @@
[this] (auto&&, const auto& reason) { this->onRegFailure(reason); });
}
-shared_ptr<Data>
+std::shared_ptr<Data>
NdnPoke::createData() const
{
- auto data = make_shared<Data>(m_options.name);
+ auto data = std::make_shared<Data>(m_options.name);
data->setFreshnessPeriod(m_options.freshnessPeriod);
if (m_options.wantFinalBlockId) {
data->setFinalBlock(m_options.name.at(-1));
diff --git a/tools/peek/ndnpoke/ndnpoke.hpp b/tools/peek/ndnpoke/ndnpoke.hpp
index a3cd393..79b7591 100644
--- a/tools/peek/ndnpoke/ndnpoke.hpp
+++ b/tools/peek/ndnpoke/ndnpoke.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2022, Regents of the University of California,
+ * Copyright (c) 2014-2024, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -31,8 +31,12 @@
#include "core/common.hpp"
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/util/scheduler.hpp>
+#include <optional>
+
namespace ndn::peek {
/**
@@ -79,7 +83,7 @@
start();
private:
- shared_ptr<Data>
+ std::shared_ptr<Data>
createData() const;
void
diff --git a/tools/ping/client/main.cpp b/tools/ping/client/main.cpp
index bcef47a..d29549b 100644
--- a/tools/ping/client/main.cpp
+++ b/tools/ping/client/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2023, Arizona Board of Regents.
+ * Copyright (c) 2014-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -32,6 +32,8 @@
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
+#include <iostream>
+
namespace ndn::ping::client {
class Runner : noncopyable
diff --git a/tools/ping/client/ping.cpp b/tools/ping/client/ping.cpp
index cacd845..3bc5693 100644
--- a/tools/ping/client/ping.cpp
+++ b/tools/ping/client/ping.cpp
@@ -61,9 +61,9 @@
auto now = time::steady_clock::now();
m_face.expressInterest(interest,
- [=, seq = m_nextSeq] (auto&&...) { onData(seq, now); },
- [=, seq = m_nextSeq] (auto&&, const auto& nack) { onNack(seq, now, nack); },
- [=, seq = m_nextSeq] (auto&&...) { onTimeout(seq); });
+ [this, seq = m_nextSeq, now] (auto&&...) { onData(seq, now); },
+ [this, seq = m_nextSeq, now] (auto&&, const auto& nack) { onNack(seq, now, nack); },
+ [this, seq = m_nextSeq] (auto&&...) { onTimeout(seq); });
++m_nSent;
++m_nextSeq;
diff --git a/tools/ping/client/ping.hpp b/tools/ping/client/ping.hpp
index b2e4bfd..3509ac9 100644
--- a/tools/ping/client/ping.hpp
+++ b/tools/ping/client/ping.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2023, Arizona Board of Regents.
+ * Copyright (c) 2015-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -26,6 +26,8 @@
#include "core/common.hpp"
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/signal.hpp>
namespace ndn::ping::client {
diff --git a/tools/ping/client/statistics-collector.cpp b/tools/ping/client/statistics-collector.cpp
index 0b6b39f..cc8842c 100644
--- a/tools/ping/client/statistics-collector.cpp
+++ b/tools/ping/client/statistics-collector.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2022, Arizona Board of Regents.
+ * Copyright (c) 2015-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -23,6 +23,8 @@
#include "statistics-collector.hpp"
+#include <cmath>
+
namespace ndn::ping::client {
StatisticsCollector::StatisticsCollector(Ping& ping, const Options& options)
diff --git a/tools/ping/client/statistics-collector.hpp b/tools/ping/client/statistics-collector.hpp
index 1810208..e335aae 100644
--- a/tools/ping/client/statistics-collector.hpp
+++ b/tools/ping/client/statistics-collector.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2022, Arizona Board of Regents.
+ * Copyright (c) 2015-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -25,9 +25,10 @@
#define NDN_TOOLS_PING_CLIENT_STATISTICS_COLLECTOR_HPP
#include "core/common.hpp"
-
#include "ping.hpp"
+#include <limits>
+
namespace ndn::ping::client {
/**
diff --git a/tools/ping/client/tracer.cpp b/tools/ping/client/tracer.cpp
index 7c16a4c..6b8b78f 100644
--- a/tools/ping/client/tracer.cpp
+++ b/tools/ping/client/tracer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2022, Arizona Board of Regents.
+ * Copyright (c) 2015-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -22,6 +22,8 @@
#include "tracer.hpp"
+#include <iostream>
+
namespace ndn::ping::client {
Tracer::Tracer(Ping& ping, const Options& options)
diff --git a/tools/ping/server/main.cpp b/tools/ping/server/main.cpp
index 41ec490..64538b5 100644
--- a/tools/ping/server/main.cpp
+++ b/tools/ping/server/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2023, Arizona Board of Regents.
+ * Copyright (c) 2015-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -31,6 +31,8 @@
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
+#include <iostream>
+
namespace ndn::ping::server {
namespace po = boost::program_options;
diff --git a/tools/ping/server/ping-server.cpp b/tools/ping/server/ping-server.cpp
index 69093d3..ca11c2a 100644
--- a/tools/ping/server/ping-server.cpp
+++ b/tools/ping/server/ping-server.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2022, Arizona Board of Regents.
+ * Copyright (c) 2015-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -23,6 +23,7 @@
#include "ping-server.hpp"
#include <ndn-cxx/security/signing-helpers.hpp>
+#include <ndn-cxx/util/exception.hpp>
namespace ndn::ping::server {
@@ -31,7 +32,7 @@
, m_face(face)
, m_keyChain(keyChain)
{
- auto b = make_shared<Buffer>();
+ auto b = std::make_shared<Buffer>();
b->assign(m_options.payloadSize, 'a');
m_payload = Block(tlv::Content, std::move(b));
}
@@ -63,7 +64,7 @@
{
afterReceive(interest.getName());
- auto data = make_shared<Data>(interest.getName());
+ auto data = std::make_shared<Data>(interest.getName());
data->setFreshnessPeriod(m_options.freshnessPeriod);
data->setContent(m_payload);
m_keyChain.sign(*data, signingWithSha256());
diff --git a/tools/ping/server/ping-server.hpp b/tools/ping/server/ping-server.hpp
index 0289da2..936846b 100644
--- a/tools/ping/server/ping-server.hpp
+++ b/tools/ping/server/ping-server.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2023, Arizona Board of Regents.
+ * Copyright (c) 2015-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -25,6 +25,8 @@
#include "core/common.hpp"
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/util/signal.hpp>
namespace ndn::ping::server {
diff --git a/tools/ping/server/tracer.cpp b/tools/ping/server/tracer.cpp
index 0a9df40..e09c481 100644
--- a/tools/ping/server/tracer.cpp
+++ b/tools/ping/server/tracer.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2015-2022, Arizona Board of Regents.
+ * Copyright (c) 2015-2024, Arizona Board of Regents.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -21,6 +21,8 @@
#include "tracer.hpp"
+#include <iostream>
+
namespace ndn::ping::server {
Tracer::Tracer(PingServer& pingServer, const Options& options)