Cleanup includes in common.hpp

Change-Id: I1bb08a44726de5c880e6bc2f016506e6083e919b
This commit is contained in:
Davide Pesavento committed 2021-01-21 19:47:04 -05:00
1 parent 3047ba4741
commit a0e6b60e8f
17 files changed
+105 -86

No files matched your search

+1 -9
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2020, Regents of the University of California,
* Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -43,20 +43,15 @@
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
#include <boost/asio.hpp>
#include <boost/assert.hpp>
#include <boost/core/noncopyable.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/parsers.hpp>
#include <ndn-cxx/data.hpp>
#include <ndn-cxx/face.hpp>
@@ -66,7 +61,6 @@
#include <ndn-cxx/util/backports.hpp>
#include <ndn-cxx/util/exception.hpp>
#include <ndn-cxx/util/scheduler.hpp>
#include <ndn-cxx/util/signal.hpp>
#include <ndn-cxx/util/time.hpp>
namespace ndn {
@@ -80,8 +74,6 @@ using std::size_t;
using boost::noncopyable;
namespace signal = util::signal;
} // namespace ndn
#endif // NDN_TOOLS_CORE_COMMON_HPP
+18 -22
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2016-2020, Regents of the University of California,
* Copyright (c) 2016-2021, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -26,6 +26,7 @@
#include "tools/chunks/putchunks/producer.hpp"
#include "tests/test-common.hpp"
#include "tests/io-fixture.hpp"
#include "tests/key-chain-fixture.hpp"
#include <ndn-cxx/metadata-object.hpp>
@@ -42,32 +43,26 @@ namespace tests {
using namespace ndn::tests;
class ProducerFixture : public KeyChainFixture
class ProducerFixture : public IoFixture, public KeyChainFixture
{
protected:
ProducerFixture()
: face(io, {true, true})
, prefix("/ndn/chunks/test")
, version(1449227841747)
, keyLocatorName(m_keyChain.createIdentity("/ProducerFixture").getDefaultKey().getName())
, testString(std::string(
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget "
"dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, "
"nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, "
"sem. Nulla consequat massa Donec pede justo,"))
{
options.maxSegmentSize = 40;
options.isQuiet = true;
}
protected:
boost::asio::io_service io;
util::DummyClientFace face;
Name prefix;
util::DummyClientFace face{m_io, {true, true}};
Name prefix = "/ndn/chunks/test";
Producer::Options options;
uint64_t version;
Name keyLocatorName;
std::istringstream testString;
uint64_t version = 1449227841747;
Name keyLocatorName = m_keyChain.createIdentity("/ProducerFixture").getDefaultKey().getName();
std::istringstream testString{
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget "
"dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, "
"nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, "
"sem. Nulla consequat massa Donec pede justo,"s};
};
BOOST_AUTO_TEST_SUITE(Chunks)
@@ -94,8 +89,9 @@ BOOST_AUTO_TEST_CASE(InputData)
Producer prod(prefix, face, m_keyChain, input, options);
size_t expectedSize = std::ceil(static_cast<double>(testStrings[i].size()) / options.maxSegmentSize);
if (testStrings[i].empty())
if (testStrings[i].empty()) {
expectedSize = 1;
}
BOOST_CHECK_EQUAL(prod.m_store.size(), expectedSize);
}
@@ -104,7 +100,7 @@ BOOST_AUTO_TEST_CASE(InputData)
BOOST_AUTO_TEST_CASE(RequestSegmentUnspecifiedVersion)
{
Producer producer(prefix, face, m_keyChain, testString, options);
io.poll();
m_io.poll();
size_t nSegments = std::ceil(static_cast<double>(testString.str().size()) / options.maxSegmentSize);
// version request
@@ -137,7 +133,7 @@ BOOST_AUTO_TEST_CASE(RequestSegmentUnspecifiedVersion)
BOOST_AUTO_TEST_CASE(RequestSegmentSpecifiedVersion)
{
Producer producer(prefix.appendVersion(version), face, m_keyChain, testString, options);
io.poll();
m_io.poll();
size_t nSegments = std::ceil(static_cast<double>(testString.str().size()) / options.maxSegmentSize);
// version request
@@ -171,7 +167,7 @@ BOOST_AUTO_TEST_CASE(RequestSegmentSpecifiedVersion)
BOOST_AUTO_TEST_CASE(RequestNotExistingSegment)
{
Producer producer(prefix, face, m_keyChain, testString, options);
io.poll();
m_io.poll();
size_t nSegments = std::ceil(static_cast<double>(testString.str().size()) / options.maxSegmentSize);
// version request
@@ -198,7 +194,7 @@ BOOST_AUTO_TEST_CASE(RequestNotExistingSegment)
BOOST_AUTO_TEST_CASE(RequestMetadata)
{
Producer producer(prefix.appendVersion(version), face, m_keyChain, testString, options);
io.poll();
m_io.poll();
// ask for metadata with a valid discovery interest
face.receive(MetadataObject::makeDiscoveryInterest(Name(prefix).getPrefix(-1)));
+3 -1
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2016-2020, Regents of the University of California,
* Copyright (c) 2016-2021, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -34,6 +34,8 @@
#include <ndn-cxx/security/validation-error.hpp>
#include <ndn-cxx/security/validator.hpp>
#include <map>
namespace ndn {
namespace chunks {
+11 -13
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2016-2019, Regents of the University of California,
* Copyright (c) 2016-2021, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -31,6 +31,8 @@
#include "options.hpp"
#include <ndn-cxx/util/signal.hpp>
namespace ndn {
namespace chunks {
@@ -44,23 +46,19 @@ class DataFetcher;
*/
class DiscoverVersion
{
public: // signals
/**
* @brief Signal emitted when the versioned name of Data is found.
*/
signal::Signal<DiscoverVersion, Name> onDiscoverySuccess;
/**
* @brief Signal emitted when a failure occurs.
*/
signal::Signal<DiscoverVersion, std::string> onDiscoveryFailure;
public:
DiscoverVersion(Face& face, const Name& prefix, const Options& options);
/**
* @brief identify the latest Data version published.
* @brief Signal emitted when the versioned name of Data is found.
*/
util::Signal<DiscoverVersion, Name> onDiscoverySuccess;
/**
* @brief Signal emitted when a failure occurs.
*/
util::Signal<DiscoverVersion, std::string> onDiscoveryFailure;
void
run();
+5 -1
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2016-2020, Regents of the University of California,
* Copyright (c) 2016-2021, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -40,6 +40,10 @@
#include <fstream>
#include <ndn-cxx/security/validator-null.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
namespace ndn {
namespace chunks {
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2016-2019, Regents of the University of California,
* Copyright (c) 2016-2021, 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/signal.hpp>
#include <queue>
#include <unordered_map>
@@ -94,7 +95,7 @@ public:
* The callback function should be: `void(nanoseconds age, double cwnd)`, where `age` is the
* time since the pipeline started and `cwnd` is the new congestion window size (in segments).
*/
signal::Signal<PipelineInterestsAdaptive, time::nanoseconds, double> afterCwndChange;
util::Signal<PipelineInterestsAdaptive, time::nanoseconds, double> afterCwndChange;
struct RttSample
{
@@ -108,7 +109,7 @@ public:
/**
* @brief Signals when a new RTT sample has been taken.
*/
signal::Signal<PipelineInterestsAdaptive, RttSample> afterRttMeasurement;
util::Signal<PipelineInterestsAdaptive, RttSample> afterRttMeasurement;
protected:
DECLARE_SIGNAL_EMIT(afterCwndChange)
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2016-2019, Regents of the University of California,
* Copyright (c) 2016-2021, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -31,6 +31,8 @@
#include "pipeline-interests.hpp"
#include "data-fetcher.hpp"
#include <boost/asio/io_service.hpp>
namespace ndn {
namespace chunks {
+6 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2016-2019, Regents of the University of California,
* Copyright (c) 2016-2021, Regents of the University of California,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University.
*
@@ -30,11 +30,15 @@
#include "core/version.hpp"
#include "producer.hpp"
namespace po = boost::program_options;
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
namespace ndn {
namespace chunks {
namespace po = boost::program_options;
static void
usage(std::ostream& os, const std::string& programName, const po::options_description& desc)
{
+13 -20
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2019, Regents of the University of California.
* Copyright (c) 2014-2021, Regents of the University of California.
*
* 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,16 +21,16 @@
#include "core/version.hpp"
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/variables_map.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
#include <fstream>
namespace po = boost::program_options;
namespace ndn {
namespace dissect {
namespace po = boost::program_options;
static void
usage(std::ostream& os, const std::string& appName, const po::options_description& options)
{
@@ -43,34 +43,27 @@ usage(std::ostream& os, const std::string& appName, const po::options_descriptio
static int
main(int argc, char* argv[])
{
std::string inputFileName;
po::options_description visibleOptions;
visibleOptions.add_options()
("help,h", "Print help and exit.")
("version,V", "Print version and exit.")
("help,h", "print help and exit")
("version,V", "print version and exit")
;
std::string inputFileName;
po::options_description hiddenOptions;
hiddenOptions.add_options()
("input-file", po::value<std::string>(&inputFileName));
;
po::positional_options_description positionalArguments;
positionalArguments
.add("input-file", -1);
po::options_description allOptions;
allOptions
.add(visibleOptions)
.add(hiddenOptions)
;
allOptions.add(visibleOptions).add(hiddenOptions);
po::positional_options_description pos;
pos.add("input-file", -1);
po::variables_map vm;
try {
po::store(po::command_line_parser(argc, argv)
.options(allOptions)
.positional(positionalArguments)
.run(),
vm);
po::store(po::command_line_parser(argc, argv).options(allOptions).positional(pos).run(), vm);
po::notify(vm);
}
catch (const po::error& e) {
+2 -1
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2013-2019, Regents of the University of California.
* Copyright (c) 2013-2021, 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,7 @@
#include "ndn-dissect.hpp"
#include <algorithm>
#include <map>
#include <ndn-cxx/name-component.hpp>
#include <ndn-cxx/encoding/tlv.hpp>
+5 -1
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011-2019, Regents of the University of California.
* Copyright (c) 2011-2021, 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.
@@ -22,6 +22,10 @@
#include <ndn-cxx/util/ostream-joiner.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
#include <sstream>
namespace ndn {
+5 -1
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2019, Regents of the University of California,
* Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -32,6 +32,10 @@
#include <ndn-cxx/util/io.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
#include <cerrno>
#include <cstring>
#include <fstream>
+5 -1
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2019, Regents of the University of California,
* Copyright (c) 2014-2021, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,6 +29,10 @@
#include "ndnpoke.hpp"
#include "core/version.hpp"
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
namespace ndn {
namespace peek {
+6 -1
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2019, Arizona Board of Regents.
* Copyright (c) 2014-2021, 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.
@@ -27,6 +27,11 @@
#include "statistics-collector.hpp"
#include "tracer.hpp"
#include <boost/asio/signal_set.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
namespace ndn {
namespace ping {
namespace client {
+7 -5
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2015-2019, Arizona Board of Regents.
* Copyright (c) 2015-2021, 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/util/signal.hpp>
namespace ndn {
namespace ping {
namespace client {
@@ -62,7 +64,7 @@ public:
* @param seq ping sequence number
* @param rtt round trip time
*/
signal::Signal<Ping, uint64_t, Rtt> afterData;
util::Signal<Ping, uint64_t, Rtt> afterData;
/**
* @brief Signals on the return of a Nack
@@ -71,19 +73,19 @@ public:
* @param rtt round trip time
* @param header the received Network NACK header
*/
signal::Signal<Ping, uint64_t, Rtt, lp::NackHeader> afterNack;
util::Signal<Ping, uint64_t, Rtt, lp::NackHeader> afterNack;
/**
* @brief Signals on timeout of a packet
*
* @param seq ping sequence number
*/
signal::Signal<Ping, uint64_t> afterTimeout;
util::Signal<Ping, uint64_t> afterTimeout;
/**
* @brief Signals when finished pinging
*/
signal::Signal<Ping> afterFinish;
util::Signal<Ping> afterFinish;
/**
* @brief Start sending ping interests
+6 -1
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2015-2019, Arizona Board of Regents.
* Copyright (c) 2015-2021, 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,11 @@
#include "ping-server.hpp"
#include "tracer.hpp"
#include <boost/asio/signal_set.hpp>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
namespace ndn {
namespace ping {
namespace server {
+5 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2015-2019, Arizona Board of Regents.
* Copyright (c) 2015-2021, 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/util/signal.hpp>
namespace ndn {
namespace ping {
namespace server {
@@ -55,12 +57,12 @@ public:
*
* @param name incoming interest name
*/
signal::Signal<PingServer, Name> afterReceive;
util::Signal<PingServer, Name> afterReceive;
/**
* @brief Signals when finished pinging
*/
signal::Signal<PingServer> afterFinish;
util::Signal<PingServer> afterFinish;
/** @brief starts ping server
*