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