Replace remaining uses of BOOST_THROW_EXCEPTION with NDN_THROW
Change-Id: I0c149acbe5607d928cdf9e8d73813d5e74ca45d0
diff --git a/src/adjacency-list.cpp b/src/adjacency-list.cpp
index b83a982..302d9b9 100644
--- a/src/adjacency-list.cpp
+++ b/src/adjacency-list.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, The University of Memphis,
+/*
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -20,9 +20,6 @@
**/
#include "adjacency-list.hpp"
-
-#include "adjacent.hpp"
-#include "common.hpp"
#include "logger.hpp"
#include <algorithm>
@@ -32,9 +29,9 @@
INIT_LOGGER(AdjacencyList);
bool
-AdjacencyList::insert(Adjacent& adjacent)
+AdjacencyList::insert(const Adjacent& adjacent)
{
- std::list<Adjacent>::iterator it = find(adjacent.getName());
+ auto it = find(adjacent.getName());
if (it != m_adjList.end()) {
return false;
}
diff --git a/src/adjacency-list.hpp b/src/adjacency-list.hpp
index 955e668..2f2b164 100644
--- a/src/adjacency-list.hpp
+++ b/src/adjacency-list.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, The University of Memphis,
+/*
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -26,7 +26,6 @@
#include "common.hpp"
#include <list>
-#include <boost/cstdint.hpp>
namespace nlsr {
@@ -37,7 +36,7 @@
typedef std::list<Adjacent>::iterator iterator;
bool
- insert(Adjacent& adjacent);
+ insert(const Adjacent& adjacent);
std::list<Adjacent>&
getAdjList();
diff --git a/src/adjacent.cpp b/src/adjacent.cpp
index fae92d5..637ea90 100644
--- a/src/adjacent.cpp
+++ b/src/adjacent.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -30,12 +30,12 @@
const double Adjacent::NON_ADJACENT_COST = -12345;
Adjacent::Adjacent()
- : m_name()
- , m_faceUri()
- , m_linkCost(DEFAULT_LINK_COST)
- , m_status(STATUS_INACTIVE)
- , m_interestTimedOutNo(0)
- , m_faceId(0)
+ : m_name()
+ , m_faceUri()
+ , m_linkCost(DEFAULT_LINK_COST)
+ , m_status(STATUS_INACTIVE)
+ , m_interestTimedOutNo(0)
+ , m_faceId(0)
{
}
@@ -45,35 +45,34 @@
}
Adjacent::Adjacent(const ndn::Name& an)
- : m_name(an)
- , m_faceUri()
- , m_linkCost(DEFAULT_LINK_COST)
- , m_status(STATUS_INACTIVE)
- , m_interestTimedOutNo(0)
- , m_faceId(0)
- {
- }
+ : m_name(an)
+ , m_faceUri()
+ , m_linkCost(DEFAULT_LINK_COST)
+ , m_status(STATUS_INACTIVE)
+ , m_interestTimedOutNo(0)
+ , m_faceId(0)
+{
+}
Adjacent::Adjacent(const ndn::Name& an, const ndn::FaceUri& faceUri, double lc,
Status s, uint32_t iton, uint64_t faceId)
- : m_name(an)
- , m_faceUri(faceUri)
- , m_status(s)
- , m_interestTimedOutNo(iton)
- , m_faceId(faceId)
- {
- this->setLinkCost(lc);
- }
+ : m_name(an)
+ , m_faceUri(faceUri)
+ , m_status(s)
+ , m_interestTimedOutNo(iton)
+ , m_faceId(faceId)
+{
+ this->setLinkCost(lc);
+}
void
Adjacent::setLinkCost(double lc)
{
// NON_ADJACENT_COST is a negative value and is used for nodes that aren't direct neighbors.
// But for direct/active neighbors, the cost cannot be negative.
- if (lc < 0 && lc != NON_ADJACENT_COST)
- {
+ if (lc < 0 && lc != NON_ADJACENT_COST) {
NLSR_LOG_ERROR(" Neighbor's link-cost cannot be negative");
- BOOST_THROW_EXCEPTION(ndn::tlv::Error("Neighbor's link-cost cannot be negative"));
+ NDN_THROW(ndn::tlv::Error("Neighbor's link-cost cannot be negative"));
}
m_linkCost = lc;
@@ -127,20 +126,19 @@
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::Adjacency) {
- BOOST_THROW_EXCEPTION(Error("Expected Adjacency Block, but Block is of a different type: #" +
- ndn::to_string(m_wire.type())));
+ NDN_THROW(Error("Adjacency", m_wire.type()));
}
m_wire.parse();
- ndn::Block::element_const_iterator val = m_wire.elements_begin();
+ auto val = m_wire.elements_begin();
if (val != m_wire.elements_end() && val->type() == ndn::tlv::Name) {
m_name.wireDecode(*val);
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required Name field"));
+ NDN_THROW(Error("Missing required Name field"));
}
if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::Uri) {
@@ -148,7 +146,7 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required Uri field"));
+ NDN_THROW(Error("Missing required Uri field"));
}
if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::Cost) {
@@ -156,7 +154,7 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required Cost field"));
+ NDN_THROW(Error("Missing required Cost field"));
}
}
diff --git a/src/adjacent.hpp b/src/adjacent.hpp
index a540a5c..135c6fc 100644
--- a/src/adjacent.hpp
+++ b/src/adjacent.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2020, The University of Memphis,
+/*
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -19,15 +19,15 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
**/
+#ifndef NLSR_ADJACENT_HPP
+#define NLSR_ADJACENT_HPP
+
#include <string>
#include <cmath>
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/net/face-uri.hpp>
-#ifndef NLSR_ADJACENT_HPP
-#define NLSR_ADJACENT_HPP
-
namespace nlsr {
/*! \brief A neighbor reachable over a Face.
@@ -49,11 +49,7 @@
class Error : public ndn::tlv::Error
{
public:
- explicit
- Error(const std::string& what)
- : ndn::tlv::Error(what)
- {
- }
+ using ndn::tlv::Error::Error;
};
enum Status
diff --git a/src/common.hpp b/src/common.hpp
index cd6dc18..dd826ac 100644
--- a/src/common.hpp
+++ b/src/common.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018, The University of Memphis,
+/*
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -16,33 +16,32 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- *
- **/
-
-/*! \file
- * Shared include file to provide a single point-of-entry, and
- * hopefully improve compile times.
*/
#ifndef NLSR_COMMON_HPP
#define NLSR_COMMON_HPP
-#include <ndn-cxx/util/time.hpp>
+#include <cstddef>
+#include <cstdint>
+#include <functional>
+#include <iterator>
+#include <memory>
+#include <utility>
+
#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/util/exception.hpp>
+#include <ndn-cxx/util/time.hpp>
namespace nlsr {
-using std::bind;
-using std::make_shared;
-using std::shared_ptr;
-using std::function;
+using namespace ndn::time_literals;
-const ndn::time::seconds TIME_ALLOWED_FOR_CANONIZATION = ndn::time::seconds(4);
+const ndn::time::seconds TIME_ALLOWED_FOR_CANONIZATION = 4_s;
template<typename T, typename = void>
struct is_iterator
{
- static constexpr bool value = false;
+ static constexpr bool value = false;
};
/*! Use C++11 iterator_traits to check if some type is an iterator
@@ -52,7 +51,7 @@
typename std::iterator_traits<T>::value_type,
void>::value>::type>
{
- static constexpr bool value = true;
+ static constexpr bool value = true;
};
} // namespace nlsr
diff --git a/src/communication/sync-logic-handler.hpp b/src/communication/sync-logic-handler.hpp
index 7deb06a..fa3545f 100644
--- a/src/communication/sync-logic-handler.hpp
+++ b/src/communication/sync-logic-handler.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -30,9 +30,6 @@
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/util/signal.hpp>
-#include <boost/throw_exception.hpp>
-
-class InterestManager;
namespace nlsr {
@@ -49,19 +46,15 @@
class SyncLogicHandler
{
public:
- using IsLsaNew =
- std::function<bool(const ndn::Name&, const Lsa::Type& lsaType, const uint64_t&)>;
-
class Error : public std::runtime_error
{
public:
- explicit
- Error(const std::string& what)
- : std::runtime_error(what)
- {
- }
+ using std::runtime_error::runtime_error;
};
+ using IsLsaNew =
+ std::function<bool(const ndn::Name&, const Lsa::Type& lsaType, const uint64_t&)>;
+
SyncLogicHandler(ndn::Face& face, const IsLsaNew& isLsaNew, const ConfParameter& conf);
/*! \brief Instruct ChronoSync to publish an update.
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index 5a7e803..d3e1625 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -451,9 +451,9 @@
// Set the interval between FaceStatus dataset fetch attempts.
ConfigurationVariable<uint32_t> faceDatasetFetchInterval("face-dataset-fetch-interval",
- bind(&ConfParameter::setFaceDatasetFetchInterval,
- &m_confParam,
- _1));
+ std::bind(&ConfParameter::setFaceDatasetFetchInterval,
+ &m_confParam,
+ _1));
faceDatasetFetchInterval.setMinAndMaxValue(FACE_DATASET_FETCH_INTERVAL_MIN,
FACE_DATASET_FETCH_INTERVAL_MAX);
diff --git a/src/conf-parameter.cpp b/src/conf-parameter.cpp
index 9858998..47a33e8 100644
--- a/src/conf-parameter.cpp
+++ b/src/conf-parameter.cpp
@@ -25,8 +25,6 @@
INIT_LOGGER(ConfParameter);
-using namespace ndn::time_literals;
-
// To be changed when breaking changes are made to sync
const uint64_t ConfParameter::SYNC_VERSION = 9;
@@ -120,7 +118,7 @@
m_prefixUpdateValidator.loadAnchor("Authoritative-Certificate", ndn::security::Certificate(cert));
}
-shared_ptr<ndn::security::Certificate>
+std::shared_ptr<ndn::security::Certificate>
ConfParameter::initializeKey()
{
NLSR_LOG_DEBUG("Initializing Key ...");
diff --git a/src/conf-parameter.hpp b/src/conf-parameter.hpp
index 89d01c4..c000c4b 100644
--- a/src/conf-parameter.hpp
+++ b/src/conf-parameter.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -28,11 +28,9 @@
#include "adjacency-list.hpp"
#include "name-prefix-list.hpp"
-#include <boost/cstdint.hpp>
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/validator-config.hpp>
#include <ndn-cxx/security/certificate-fetcher-direct-fetch.hpp>
-#include <ndn-cxx/util/time.hpp>
namespace nlsr {
@@ -128,9 +126,8 @@
*/
class ConfParameter
{
-
public:
- ConfParameter(ndn::Face& face, ndn::KeyChain& keyChain,
+ ConfParameter(ndn::Face& face, ndn::KeyChain& keyChain,
const std::string& confFileName = "nlsr.conf");
const std::string&
@@ -478,7 +475,7 @@
return m_keyChain;
}
- shared_ptr<ndn::security::Certificate>
+ std::shared_ptr<ndn::security::Certificate>
initializeKey();
void
@@ -492,6 +489,7 @@
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
std::string m_confFileName;
std::string m_confFileNameDynamic;
+
private:
ndn::Name m_routerName;
ndn::Name m_siteName;
diff --git a/src/lsa/adj-lsa.cpp b/src/lsa/adj-lsa.cpp
index f3b04da..781422c 100644
--- a/src/lsa/adj-lsa.cpp
+++ b/src/lsa/adj-lsa.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -93,8 +93,7 @@
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::AdjacencyLsa) {
- BOOST_THROW_EXCEPTION(Error("Expected AdjacencyLsa Block, but Block is of a different type: #" +
- ndn::to_string(m_wire.type())));
+ NDN_THROW(Error("AdjacencyLsa", m_wire.type()));
}
m_wire.parse();
@@ -106,18 +105,16 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required Lsa field"));
+ NDN_THROW(Error("Missing required Lsa field"));
}
AdjacencyList adl;
for (; val != m_wire.elements_end(); ++val) {
if (val->type() == ndn::tlv::nlsr::Adjacency) {
- Adjacent adj = Adjacent(*val);
- adl.insert(adj);
+ adl.insert(Adjacent(*val));
}
else {
- BOOST_THROW_EXCEPTION(Error("Expected Adjacency Block, but Block is of a different type: #" +
- ndn::to_string(m_wire.type())));
+ NDN_THROW(Error("Adjacency", val->type()));
}
}
m_adl = adl;
diff --git a/src/lsa/coordinate-lsa.cpp b/src/lsa/coordinate-lsa.cpp
index 4109c64..32172e6 100644
--- a/src/lsa/coordinate-lsa.cpp
+++ b/src/lsa/coordinate-lsa.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -105,10 +105,7 @@
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::CoordinateLsa) {
- std::stringstream error;
- error << "Expected CoordinateLsa Block, but Block is of a different type: #"
- << m_wire.type();
- BOOST_THROW_EXCEPTION(Error(error.str()));
+ NDN_THROW(Error("CoordinateLsa", m_wire.type()));
}
m_wire.parse();
@@ -120,7 +117,7 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required Lsa field"));
+ NDN_THROW(Error("Missing required Lsa field"));
}
if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::HyperbolicRadius) {
@@ -128,7 +125,7 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required HyperbolicRadius field"));
+ NDN_THROW(Error("Missing required HyperbolicRadius field"));
}
std::vector<double> angles;
@@ -137,7 +134,7 @@
angles.push_back(ndn::encoding::readDouble(*val));
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required HyperbolicAngle field"));
+ NDN_THROW(Error("Missing required HyperbolicAngle field"));
}
}
m_hyperbolicAngles = angles;
diff --git a/src/lsa/lsa.cpp b/src/lsa/lsa.cpp
index dd8267e..25841d2 100644
--- a/src/lsa/lsa.cpp
+++ b/src/lsa/lsa.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -73,7 +73,7 @@
m_originRouter.wireDecode(*val);
}
else {
- BOOST_THROW_EXCEPTION(Error("OriginRouter: Missing required Name field"));
+ NDN_THROW(Error("OriginRouter: Missing required Name field"));
}
++val;
@@ -83,14 +83,14 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required SequenceNumber field"));
+ NDN_THROW(Error("Missing required SequenceNumber field"));
}
if (val != baseWire.elements_end() && val->type() == ndn::tlv::nlsr::ExpirationTime) {
m_expirationTimePoint = ndn::time::fromString(readString(*val));
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required ExpirationTimePoint field"));
+ NDN_THROW(Error("Missing required ExpirationTime field"));
}
}
diff --git a/src/lsa/lsa.hpp b/src/lsa/lsa.hpp
index a44a594..7fb1058 100644
--- a/src/lsa/lsa.hpp
+++ b/src/lsa/lsa.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -28,7 +28,6 @@
#include "test-access-control.hpp"
#include <ndn-cxx/util/scheduler.hpp>
-#include <ndn-cxx/util/time.hpp>
namespace nlsr {
@@ -45,11 +44,7 @@
class Error : public ndn::tlv::Error
{
public:
- explicit
- Error(const std::string& what)
- : ndn::tlv::Error(what)
- {
- }
+ using ndn::tlv::Error::Error;
};
enum class Type {
diff --git a/src/lsa/name-lsa.cpp b/src/lsa/name-lsa.cpp
index cfdfd77..173b9c7 100644
--- a/src/lsa/name-lsa.cpp
+++ b/src/lsa/name-lsa.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -85,8 +85,7 @@
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::NameLsa) {
- BOOST_THROW_EXCEPTION(Error("Expected NameLsa Block, but Block is of a different type: #" +
- ndn::to_string(m_wire.type())));
+ NDN_THROW(Error("NameLsa", m_wire.type()));
}
m_wire.parse();
@@ -98,7 +97,7 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required Lsa field"));
+ NDN_THROW(Error("Missing required Lsa field"));
}
NamePrefixList npl;
@@ -107,11 +106,9 @@
npl.insert(ndn::Name(*val));
}
else {
- BOOST_THROW_EXCEPTION(Error("Expected Name Block, but Block is of a different type: #" +
- ndn::to_string(m_wire.type())));
+ NDN_THROW(Error("Name", val->type()));
}
}
-
m_npl = npl;
}
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index fb4bcb7..a2f552d 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -213,7 +213,7 @@
}
void
-Lsdb::installLsa(shared_ptr<Lsa> lsa)
+Lsdb::installLsa(std::shared_ptr<Lsa> lsa)
{
auto timeToExpire = m_lsaRefreshTime;
diff --git a/src/lsdb.hpp b/src/lsdb.hpp
index a342284..9a5f147 100644
--- a/src/lsdb.hpp
+++ b/src/lsdb.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -45,13 +45,9 @@
#include <PSync/segment-publisher.hpp>
-#include <utility>
-#include <boost/cstdint.hpp>
-
namespace nlsr {
namespace bmi = boost::multi_index;
-using namespace ndn::literals::time_literals;
static constexpr ndn::time::seconds GRACE_PERIOD = 10_s;
@@ -232,7 +228,7 @@
}
void
- installLsa(shared_ptr<Lsa> lsa);
+ installLsa(std::shared_ptr<Lsa> lsa);
/*! \brief Remove a name LSA from the LSDB.
\param router The name of the router that published the LSA to remove.
diff --git a/src/main.cpp b/src/main.cpp
index 16d9c2a..7fa5062 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -20,33 +20,12 @@
**/
#include "conf-file-processor.hpp"
-#include "security/certificate-store.hpp"
#include "nlsr.hpp"
+#include "security/certificate-store.hpp"
#include "version.hpp"
-#include <boost/exception/get_error_info.hpp>
-#include <sstream>
-
-template<typename E>
-static std::string
-getExtendedErrorMessage(const E& exception)
-{
- std::ostringstream errorMessage;
- errorMessage << exception.what();
-
- const char* const* file = boost::get_error_info<boost::throw_file>(exception);
- const int* line = boost::get_error_info<boost::throw_line>(exception);
- const char* const* func = boost::get_error_info<boost::throw_function>(exception);
- if (file && line) {
- errorMessage << " [from " << *file << ":" << *line;
- if (func) {
- errorMessage << " in " << *func;
- }
- errorMessage << "]";
- }
-
- return errorMessage.str();
-}
+#include <boost/exception/diagnostic_information.hpp>
+#include <iostream>
static void
printUsage(std::ostream& os, const std::string& programName)
@@ -95,6 +74,7 @@
std::cerr << "Error in configuration file processing" << std::endl;
return 2;
}
+
// Since confParam is already populated, key is initialized here before
// and independent of the NLSR class
auto certificate = confParam.initializeKey();
@@ -102,7 +82,6 @@
nlsr::Nlsr nlsr(face, keyChain, confParam);
nlsr::security::CertificateStore certStore(face, confParam, nlsr.getLsdb());
-
if (certificate) {
certStore.insert(*certificate);
}
@@ -112,7 +91,7 @@
}
catch (const std::exception& e) {
nlsr.getFib().clean();
- std::cerr << "FATAL: " << getExtendedErrorMessage(e) << std::endl;
+ std::cerr << "FATAL: " << boost::diagnostic_information(e) << std::endl;
return 1;
}
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 590c8a4..b8cec28 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -24,11 +24,8 @@
#include "logger.hpp"
#include <cstdlib>
-#include <string>
-#include <sstream>
#include <cstdio>
#include <unistd.h>
-#include <vector>
#include <ndn-cxx/net/face-uri.hpp>
@@ -426,8 +423,8 @@
m_controller.start<ndn::nfd::FaceUpdateCommand>(
ndn::nfd::ControlParameters()
.setFlagBit(ndn::nfd::FaceFlagBit::BIT_LOCAL_FIELDS_ENABLED, true),
- bind(&Nlsr::onFaceIdIndicationSuccess, this, _1),
- bind(&Nlsr::onFaceIdIndicationFailure, this, _1));
+ std::bind(&Nlsr::onFaceIdIndicationSuccess, this, _1),
+ std::bind(&Nlsr::onFaceIdIndicationFailure, this, _1));
}
void
@@ -440,11 +437,8 @@
void
Nlsr::onFaceIdIndicationFailure(const ndn::nfd::ControlResponse& cr)
{
- std::ostringstream os;
- os << "Failed to enable incoming face id indication feature: " <<
- "(code: " << cr.getCode() << ", reason: " << cr.getText() << ")";
-
- NLSR_LOG_DEBUG(os.str());
+ NLSR_LOG_DEBUG("Failed to enable incoming face id indication feature: " <<
+ "(code: " << cr.getCode() << ", reason: " << cr.getText() << ")");
}
} // namespace nlsr
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index 841a15a..23d73c2 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -38,10 +38,6 @@
#include "utility/name-helper.hpp"
#include "stats-collector.hpp"
-#include <boost/cstdint.hpp>
-#include <stdexcept>
-#include <boost/throw_exception.hpp>
-
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/certificate-fetcher-direct-fetch.hpp>
@@ -69,11 +65,7 @@
class Error : public std::runtime_error
{
public:
- explicit
- Error(const std::string& what)
- : std::runtime_error(what)
- {
- }
+ using std::runtime_error::runtime_error;
};
Nlsr(ndn::Face& face, ndn::KeyChain& keyChain, ConfParameter& confParam);
diff --git a/src/route/name-prefix-table.cpp b/src/route/name-prefix-table.cpp
index 55f0c54..91e6210 100644
--- a/src/route/name-prefix-table.cpp
+++ b/src/route/name-prefix-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -94,11 +94,12 @@
// Either we have to make a new NPT entry or there already was one.
if (nameItr == m_table.end()) {
NLSR_LOG_DEBUG("Adding origin: " << rtpePtr->getDestination()
- << " to a new name prefix: " << name);
- npte = make_shared<NamePrefixTableEntry>(name);
+ << " to a new name prefix: " << name);
+ npte = std::make_shared<NamePrefixTableEntry>(name);
npte->addRoutingTableEntry(rtpePtr);
npte->generateNhlfromRteList();
m_table.push_back(npte);
+
// If this entry has next hops, we need to inform the FIB
if (npte->getNexthopList().size() > 0) {
NLSR_LOG_TRACE("Updating FIB with next hops for " << npte->getNamePrefix());
@@ -131,6 +132,7 @@
m_fib.remove(name);
}
}
+
// Add the reference to this NPT to the RTPE.
rtpePtr->namePrefixTableEntries.emplace(
std::make_pair(npte->getNamePrefix(), std::weak_ptr<NamePrefixTableEntry>(npte)));
diff --git a/src/route/nexthop.cpp b/src/route/nexthop.cpp
index 11399aa..bdb0bde 100644
--- a/src/route/nexthop.cpp
+++ b/src/route/nexthop.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -69,25 +69,28 @@
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::NextHop) {
- std::stringstream error;
- error << "Expected NextHop Block, but Block is of a different type: #"
- << m_wire.type();
- BOOST_THROW_EXCEPTION(Error(error.str()));
+ NDN_THROW(Error("NextHop", m_wire.type()));
}
m_wire.parse();
- ndn::Block::element_const_iterator val = m_wire.elements_begin();
+ auto val = m_wire.elements_begin();
if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::Uri) {
- m_connectingFaceUri.assign(reinterpret_cast<const char*>(val->value()), val->value_size());
+ m_connectingFaceUri = ndn::encoding::readString(*val);
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required Uri field"));
+ NDN_THROW(Error("Missing required Uri field"));
}
- m_routeCost = ndn::encoding::readDouble(*val);
+ if (val != m_wire.elements_end() && val->type() == ndn::tlv::nlsr::CostDouble) {
+ m_routeCost = ndn::encoding::readDouble(*val);
+ ++val;
+ }
+ else {
+ NDN_THROW(Error("Missing required CostDouble field"));
+ }
}
bool
diff --git a/src/route/nexthop.hpp b/src/route/nexthop.hpp
index 7f91cfe..4443a9e 100644
--- a/src/route/nexthop.hpp
+++ b/src/route/nexthop.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -27,9 +27,8 @@
#include <ndn-cxx/encoding/encoding-buffer.hpp>
#include <ndn-cxx/encoding/tlv.hpp>
-#include <iostream>
#include <cmath>
-#include <boost/cstdint.hpp>
+#include <ostream>
namespace nlsr {
diff --git a/src/route/routing-table-calculator.hpp b/src/route/routing-table-calculator.hpp
index 9c0c6b5..b497c06 100644
--- a/src/route/routing-table-calculator.hpp
+++ b/src/route/routing-table-calculator.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -28,9 +28,6 @@
#include "conf-parameter.hpp"
#include <list>
-#include <boost/cstdint.hpp>
-
-#include <ndn-cxx/name.hpp>
namespace nlsr {
diff --git a/src/route/routing-table-entry.cpp b/src/route/routing-table-entry.cpp
index 7320d91..950240e 100644
--- a/src/route/routing-table-entry.cpp
+++ b/src/route/routing-table-entry.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -70,14 +70,10 @@
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::RoutingTableEntry) {
- std::stringstream error;
- error << "Expected RoutingTable Block, but Block is of a different type: #"
- << m_wire.type();
- BOOST_THROW_EXCEPTION(Error(error.str()));
+ NDN_THROW(Error("RoutingTableEntry", m_wire.type()));
}
m_wire.parse();
-
auto val = m_wire.elements_begin();
if (val != m_wire.elements_end() && val->type() == ndn::tlv::Name) {
@@ -85,7 +81,7 @@
++val;
}
else {
- BOOST_THROW_EXCEPTION(Error("Missing required destination field"));
+ NDN_THROW(Error("Missing required Name field"));
}
for (; val != m_wire.elements_end(); ++val) {
@@ -93,10 +89,7 @@
m_nexthopList.addNextHop(NextHop(*val));
}
else {
- std::stringstream error;
- error << "Expected NextHop Block, but Block is of a different type: #"
- << m_wire.type();
- BOOST_THROW_EXCEPTION(Error(error.str()));
+ NDN_THROW(Error("NextHop", val->type()));
}
}
}
@@ -104,10 +97,8 @@
std::ostream&
operator<<(std::ostream& os, const RoutingTableEntry& rte)
{
- os << " Destination: " << rte.getDestination() << "\n"
- << rte.getNexthopList() << "\n";
-
- return os;
+ return os << " Destination: " << rte.getDestination() << "\n"
+ << rte.getNexthopList() << "\n";
}
} // namespace nlsr
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 74d3c11..b600882 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -273,14 +273,10 @@
m_wire = wire;
if (m_wire.type() != ndn::tlv::nlsr::RoutingTable) {
- std::stringstream error;
- error << "Expected RoutingTableStatus Block, but Block is of a different type: #"
- << m_wire.type();
- BOOST_THROW_EXCEPTION(Error(error.str()));
+ NDN_THROW(Error("RoutingTable", m_wire.type()));
}
m_wire.parse();
-
auto val = m_wire.elements_begin();
std::set<ndn::Name> destinations;
@@ -297,10 +293,7 @@
}
if (val != m_wire.elements_end()) {
- std::stringstream error;
- error << "Expected the end of elements, but Block is of a different type: #"
- << val->type();
- BOOST_THROW_EXCEPTION(Error(error.str()));
+ NDN_THROW(Error("Unrecognized TLV of type " + ndn::to_string(val->type()) + " in RoutingTable"));
}
}
diff --git a/src/security/certificate-store.cpp b/src/security/certificate-store.cpp
index 684969a..99067a7 100644
--- a/src/security/certificate-store.cpp
+++ b/src/security/certificate-store.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -129,14 +129,14 @@
void
CertificateStore::onKeyPrefixRegSuccess(const ndn::Name& name)
{
- NLSR_LOG_DEBUG("KEY prefix: " << name << " registration is successful.");
+ NLSR_LOG_DEBUG("KEY prefix: " << name << " registration is successful");
}
void
CertificateStore::registrationFailed(const ndn::Name& name)
{
- NLSR_LOG_ERROR("ERROR: Failed to register prefix " << name);
- BOOST_THROW_EXCEPTION(std::runtime_error("Prefix registration failed"));
+ NLSR_LOG_ERROR("Failed to register prefix " << name);
+ NDN_THROW(std::runtime_error("Prefix registration failed"));
}
void
diff --git a/src/sequencing-manager.hpp b/src/sequencing-manager.hpp
index 9cb349d..586abc2 100644
--- a/src/sequencing-manager.hpp
+++ b/src/sequencing-manager.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -30,7 +30,6 @@
#include <list>
#include <string>
-#include <boost/cstdint.hpp>
namespace nlsr {
diff --git a/src/update/manager-base.hpp b/src/update/manager-base.hpp
index 4d279c7..f9fa17c 100644
--- a/src/update/manager-base.hpp
+++ b/src/update/manager-base.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2019, The University of Memphis,
+/*
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#ifndef NLSR_MANAGER_BASE_HPP
#define NLSR_MANAGER_BASE_HPP
@@ -37,6 +37,7 @@
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
#include <boost/noncopyable.hpp>
+#include <iostream>
namespace nlsr {
@@ -52,16 +53,10 @@
class Error : public std::runtime_error
{
public:
- explicit
- Error(const std::string& what)
- : std::runtime_error(what)
- {
- }
+ using std::runtime_error::runtime_error;
};
-public:
- ManagerBase(ndn::mgmt::Dispatcher& m_dispatcher,
- const std::string& module);
+ ManagerBase(ndn::mgmt::Dispatcher& m_dispatcher, const std::string& module);
protected:
/*! \brief generate the relative prefix for a handler by appending the verb name to the module name
@@ -76,16 +71,15 @@
bool
validateParameters(const ndn::mgmt::ControlParameters& parameters)
{
- const ndn::nfd::ControlParameters* castParams =
- dynamic_cast<const ndn::nfd::ControlParameters*>(¶meters);
-
+ const auto* castParams = dynamic_cast<const ndn::nfd::ControlParameters*>(¶meters);
BOOST_ASSERT(castParams != nullptr);
+
T command;
try {
command.validateRequest(*castParams);
}
- catch (const ndn::nfd::ControlCommand::ArgumentError& ae) {
- throw ae;
+ catch (const ndn::nfd::ControlCommand::ArgumentError&) {
+ throw;
}
catch (const std::exception& e) {
std::cerr << e.what() << std::endl;
diff --git a/src/update/nfd-rib-command-processor.cpp b/src/update/nfd-rib-command-processor.cpp
index 331a3ca..2570797 100644
--- a/src/update/nfd-rib-command-processor.cpp
+++ b/src/update/nfd-rib-command-processor.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2018, The University of Memphis,
+/*
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -17,7 +17,7 @@
*
* You should have received a copy of the GNU General Public License along with
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
#include "nfd-rib-command-processor.hpp"
@@ -32,12 +32,12 @@
m_dispatcher.addControlCommand<ndn::nfd::ControlParameters>(makeRelPrefix("register"),
ndn::mgmt::makeAcceptAllAuthorization(),
std::bind(&NfdRibCommandProcessor::validateParameters<NfdRibRegisterCommand>, this, _1),
- bind(&NfdRibCommandProcessor::advertiseAndInsertPrefix, this, _1, _2, _3, _4));
+ std::bind(&NfdRibCommandProcessor::advertiseAndInsertPrefix, this, _1, _2, _3, _4));
m_dispatcher.addControlCommand<ndn::nfd::ControlParameters>(makeRelPrefix("unregister"),
ndn::mgmt::makeAcceptAllAuthorization(),
std::bind(&NfdRibCommandProcessor::validateParameters<NfdRibUnregisterCommand>, this, _1),
- bind(&NfdRibCommandProcessor::withdrawAndRemovePrefix, this, _1, _2, _3, _4));
+ std::bind(&NfdRibCommandProcessor::withdrawAndRemovePrefix, this, _1, _2, _3, _4));
}
} // namespace update
diff --git a/src/update/prefix-update-processor.cpp b/src/update/prefix-update-processor.cpp
index 956fc7b..99cd76b 100644
--- a/src/update/prefix-update-processor.cpp
+++ b/src/update/prefix-update-processor.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -22,8 +22,10 @@
#include "prefix-update-processor.hpp"
#include "lsdb.hpp"
#include "nlsr.hpp"
-#include <ndn-cxx/mgmt/nfd/control-response.hpp>
+
#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/mgmt/nfd/control-response.hpp>
+
#include <boost/algorithm/string.hpp>
#include <algorithm>
@@ -41,7 +43,7 @@
static ndn::optional<std::string>
getSignerFromTag(const ndn::Interest& interest)
{
- shared_ptr<SignerTag> signerTag = interest.getTag<SignerTag>();
+ auto signerTag = interest.getTag<SignerTag>();
if (signerTag == nullptr) {
return ndn::nullopt;
}
diff --git a/src/utility/name-helper.hpp b/src/utility/name-helper.hpp
index 4bdd38b..5fec4fc 100644
--- a/src/utility/name-helper.hpp
+++ b/src/utility/name-helper.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2014-2017, The University of Memphis,
+/*
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California
*
* This file is part of NLSR (Named-data Link State Routing).
@@ -18,17 +18,12 @@
* NLSR, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*
* \author A K M Mahmudul Hoque <ahoque1@memphis.edu>
- *
- **/
+ */
+
#ifndef NLSR_NAME_HELPER_HPP
#define NLSR_NAME_HELPER_HPP
-#include <boost/algorithm/string.hpp>
-#include <boost/algorithm/string/regex_find_format.hpp>
-#include <boost/regex.hpp>
-#include <boost/cstdint.hpp>
-#include <ndn-cxx/name-component.hpp>
-#include <ndn-cxx/name.hpp>
+#include "common.hpp"
namespace nlsr {
namespace util {
@@ -40,7 +35,7 @@
\return -1 if searchString not found else return the position
starting from 0
*/
-inline static int32_t
+inline int32_t
getNameComponentPosition(const ndn::Name& name, const std::string& searchString)
{
ndn::name::Component component(searchString);
@@ -54,7 +49,6 @@
}
} // namespace util
-
} // namespace nlsr
-#endif //NLSR_NAME_HELPER_HPP
+#endif // NLSR_NAME_HELPER_HPP
diff --git a/tests/route/test-name-prefix-table.cpp b/tests/route/test-name-prefix-table.cpp
index d603d91..9585106 100644
--- a/tests/route/test-name-prefix-table.cpp
+++ b/tests/route/test-name-prefix-table.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -181,7 +181,7 @@
RoutingTablePoolEntry rtpe1("/ndn/memphis/rtr1", 0);
NamePrefixTableEntry npte1("/ndn/memphis/rtr2");
- npt.m_table.push_back(make_shared<NamePrefixTableEntry>(npte1));
+ npt.m_table.push_back(std::make_shared<NamePrefixTableEntry>(npte1));
npt.addEntry("/ndn/memphis/rtr2", "/ndn/memphis/rtr1");
npt.addEntry("/ndn/memphis/rtr2", "/ndn/memphis/altrtr");
@@ -204,7 +204,7 @@
BOOST_FIXTURE_TEST_CASE(AddNptEntryPtrToRoutingEntry, NamePrefixTableFixture)
{
NamePrefixTableEntry npte1("/ndn/memphis/rtr2");
- npt.m_table.push_back(make_shared<NamePrefixTableEntry>(npte1));
+ npt.m_table.push_back(std::make_shared<NamePrefixTableEntry>(npte1));
npt.addEntry("/ndn/memphis/rtr2", "/ndn/memphis/rtr1");
@@ -232,8 +232,8 @@
NamePrefixTableEntry npte1("/ndn/memphis/rtr1");
NamePrefixTableEntry npte2("/ndn/memphis/rtr2");
RoutingTableEntry rte1("/ndn/memphis/destination1");
- npt.m_table.push_back(make_shared<NamePrefixTableEntry>(npte1));
- npt.m_table.push_back(make_shared<NamePrefixTableEntry>(npte2));
+ npt.m_table.push_back(std::make_shared<NamePrefixTableEntry>(npte1));
+ npt.m_table.push_back(std::make_shared<NamePrefixTableEntry>(npte2));
npt.addEntry(npte1.getNamePrefix(), rte1.getDestination());
// We have to add two entries, otherwise the routing pool entry will be deleted.
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index ea48ecc..495f0ba 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-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -40,8 +40,6 @@
namespace nlsr {
namespace test {
-using namespace ndn::time_literals;
-
ndn::Data&
signData(ndn::Data& data);
@@ -50,8 +48,8 @@
/** \brief add a fake signature to Data
*/
-inline shared_ptr<ndn::Data>
-signData(shared_ptr<ndn::Data> data)
+inline std::shared_ptr<ndn::Data>
+signData(std::shared_ptr<ndn::Data> data)
{
signData(*data);
return data;
@@ -158,7 +156,7 @@
" cannot be satisfied by this Data " << name);
}
- auto data = make_shared<ndn::Data>(name);
+ auto data = std::make_shared<ndn::Data>(name);
data->setFreshnessPeriod(1_s);
data->setFinalBlock(name[-1]);
data->setContent(std::forward<ContentArgs>(contentArgs)...);
diff --git a/tests/test-lsdb.cpp b/tests/test-lsdb.cpp
index 13f96a6..317cc6b 100644
--- a/tests/test-lsdb.cpp
+++ b/tests/test-lsdb.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -34,8 +34,6 @@
namespace nlsr {
namespace test {
-using namespace ndn::time_literals;
-
class LsdbFixture : public UnitTestTimeFixture
{
public:
diff --git a/tests/test-nlsr.cpp b/tests/test-nlsr.cpp
index 6c46205..dc91c73 100644
--- a/tests/test-nlsr.cpp
+++ b/tests/test-nlsr.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2020, The University of Memphis,
+ * Copyright (c) 2014-2021, The University of Memphis,
* Regents of the University of California,
* Arizona Board of Regents.
*
@@ -29,8 +29,6 @@
namespace nlsr {
namespace test {
-using namespace ndn::time_literals;
-
class NlsrFixture : public MockNfdMgmtFixture
{
public: