Slim down `common.hpp`
Change-Id: Ic9843a1b9ffc5b5b1fa6062c8250ba28c6aaa898
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)