Do not compile ChronoSync support by default
ChronoSync dependency is now made optional
and is kept for testing purposes only.
Also change sig-type to ecdsa-sha256 in nlsr.conf
as ndn-cxx now has strict checking for it.
refs: #5147
Change-Id: I95c9fb844681ebf2c4e7bbb03cc7796a0795de83
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index 2a60f0d..b09f968 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -28,7 +28,7 @@
fi
# Build in debug mode with tests
-./waf --color=yes configure --debug --with-tests $ASAN $COVERAGE
+./waf --color=yes configure --with-chronosync --debug --with-tests $ASAN $COVERAGE
./waf --color=yes build -j$WAF_JOBS
# (tests will be run against the debug version)
diff --git a/docs/INSTALL.rst b/docs/INSTALL.rst
index f496919..d66d59f 100644
--- a/docs/INSTALL.rst
+++ b/docs/INSTALL.rst
@@ -12,16 +12,17 @@
Refer to `Getting started with NFD <https://named-data.net/doc/NFD/current/INSTALL.html>`_
for detailed installation and running instruction.
-- ChronoSync library
-
-Download the ChronoSync library and build it according to the instructions available at
-https://github.com/named-data/ChronoSync#build
-
- PSync library
Download the PSync library and build it according to the instructions available at
https://github.com/named-data/PSync#build
+- [Optional] ChronoSync library
+
+For testing purposes, NLSR can be optionally built with Chronosync support.
+Download the ChronoSync library and build it according to the instructions available at
+https://github.com/named-data/ChronoSync#build
+
Build
-----
@@ -40,3 +41,7 @@
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
# or
export PKG_CONFIG_PATH=/path/to/pkgconfig/on/your/machine
+
+If ChronoSync support is desired, NLSR needs to be configured with the following option:
+
+ ./waf configure --with-chronosync
diff --git a/docs/beginners-guide.rst b/docs/beginners-guide.rst
index 9807191..8cc7e99 100644
--- a/docs/beginners-guide.rst
+++ b/docs/beginners-guide.rst
@@ -18,7 +18,7 @@
The following instructions are based on the information provided at the
Named Data Networking project web page [NDNmain]_.
Before installing NLSR it is necessary to install different libraries
-and programs: ndn-cxx, NFD, ChronoSync, and PSync. This document describes the
+and programs: ndn-cxx, NFD, ChronoSync [optional], and PSync. This document describes the
necessary steps to correctly install these programs (§ `2 <#ndncxx>`__,
`3 <#nfd>`__ and `4 <#nlsr>`__) and a brief guide on how to configure
and test NLSR using a simple two-node network (§ `5 <#test>`__).
@@ -361,8 +361,40 @@
4. Installing NLSR
==================
-4.1 Installing ChronoSync
--------------------------
+4.1 Installing PSync
+--------------------
+
+Before installing NLSR, it is also necessary to download and install
+PSync. PSync is a synchronization library which allows NLSR to synchronize LSAs
+similar to ChronoSync. More information about PSync may be found at [PSync]_.
+This library may be installed by running the following commands as a regular
+user and at the directory defined at § `1 <#intro>`__:
+
+::
+
+ $ git clone --depth 1 https://github.com/named-data/PSync.git
+ $ cd PSync
+ $ ./waf configure
+ $ ./waf
+ $ sudo ./waf install
+
+The following command needs to be used again to configure the libraries:
+
+::
+
+ $ sudo ldconfig -v | grep -i psync
+
+This command should display a line similar to the following:
+
+::
+
+ libPSync.so.0.1.0 -> libPSync.so.0.1.0
+
+4.2 [Optional] Installing ChronoSync
+------------------------------------
+
+By default NLSR no longer builds with ChronoSync support.
+Since ChronoSync is deprecated, only install it for testing purposes.
Before installing NLSR, it is necessary to first download and install
ChronoSync, which is a synchronization library which allows NLSR routers
@@ -391,35 +423,6 @@
libChronoSync.so.0.5.0 -> libChronoSync.so.0.5.0
-4.2 Installing PSync
--------------------------
-
-Before installing NLSR, it is also necessary to download and install
-PSync. PSync is a synchronization library which allows NLSR to synchronize LSAs
-similar to ChronoSync. More information about PSync may be found at [PSync]_.
-This library may be installed by running the following commands as a regular
-user and at the directory defined at § `1 <#intro>`__:
-
-::
-
- $ git clone --depth 1 https://github.com/named-data/PSync.git
- $ cd PSync
- $ ./waf configure
- $ ./waf
- $ sudo ./waf install
-
-The following command needs to be used again to configure the libraries:
-
-::
-
- $ sudo ldconfig -v | grep -i psync
-
-This command should display a line similar to the following:
-
-::
-
- libPSync.so.0.1.0 -> libPSync.so.0.1.0
-
4.3 Downloading and installing NLSR
-----------------------------------
@@ -435,6 +438,12 @@
$ ./waf
$ sudo ./waf install
+If ChronoSync support is needed for testing, please configure NLSR with:
+
+::
+
+ $ ./waf configure --with-chronosync
+
4.4 Configuring NLSR
--------------------
diff --git a/nlsr.conf b/nlsr.conf
index 0adf02c..752dc44 100644
--- a/nlsr.conf
+++ b/nlsr.conf
@@ -28,7 +28,7 @@
state-dir /var/lib/nlsr ; path for intermediate state files including sequence directory (Absolute path)
}
-; the neighbor's section contains the configuration for router's neighbors and hellos behavior
+; the neighbors section contains the configuration for router's neighbors and hello protocol behavior
neighbors
{
@@ -144,7 +144,7 @@
checker
{
type customized
- sig-type rsa-sha256
+ sig-type ecdsa-sha256
key-locator
{
type name
@@ -172,7 +172,7 @@
checker
{
type customized
- sig-type rsa-sha256
+ sig-type ecdsa-sha256
key-locator
{
type name
@@ -201,7 +201,7 @@
checker
{
type customized
- sig-type rsa-sha256
+ sig-type ecdsa-sha256
key-locator
{
type name
@@ -229,7 +229,7 @@
checker
{
type hierarchical
- sig-type rsa-sha256
+ sig-type ecdsa-sha256
}
}
@@ -256,7 +256,7 @@
checker
{
type customized
- sig-type rsa-sha256
+ sig-type ecdsa-sha256
key-locator
{
type name
@@ -277,7 +277,7 @@
checker
{
type hierarchical
- sig-type rsa-sha256
+ sig-type ecdsa-sha256
}
}
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 99bdeac..4f8eba2 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.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.
*
@@ -26,6 +26,8 @@
#include "logger.hpp"
#include "utility/name-helper.hpp"
+#include <boost/lexical_cast.hpp>
+
namespace nlsr {
INIT_LOGGER(SyncLogicHandler);
diff --git a/src/communication/sync-protocol-adapter.cpp b/src/communication/sync-protocol-adapter.cpp
index af263c8..ae08e3a 100644
--- a/src/communication/sync-protocol-adapter.cpp
+++ b/src/communication/sync-protocol-adapter.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 "sync-protocol-adapter.hpp"
#include "logger.hpp"
@@ -29,7 +29,7 @@
const auto FIXED_SESSION = ndn::name::Component::fromNumber(0);
SyncProtocolAdapter::SyncProtocolAdapter(ndn::Face& face,
- int32_t syncProtocol,
+ SyncProtocol syncProtocol,
const ndn::Name& syncPrefix,
const ndn::Name& userPrefix,
ndn::time::milliseconds syncInterestLifetime,
@@ -37,6 +37,9 @@
: m_syncProtocol(syncProtocol)
, m_syncUpdateCallback(syncUpdateCallback)
{
+ NLSR_LOG_TRACE("SyncProtocol value: " << m_syncProtocol);
+
+#ifdef HAVE_CHRONOSYNC
if (m_syncProtocol == SYNC_PROTOCOL_CHRONOSYNC) {
NDN_LOG_DEBUG("Using ChronoSync");
m_chronoSyncLogic = std::make_shared<chronosync::Logic>(face,
@@ -52,40 +55,45 @@
chronosync::Logic::DEFAULT_SYNC_REPLY_FRESHNESS,
chronosync::Logic::DEFAULT_RECOVERY_INTEREST_LIFETIME,
FIXED_SESSION);
+ return;
}
- else {
- NDN_LOG_DEBUG("Using PSync");
- m_psyncLogic = std::make_shared<psync::FullProducer>(80,
- face,
- syncPrefix,
- userPrefix,
- std::bind(&SyncProtocolAdapter::onPSyncUpdate, this, _1),
- syncInterestLifetime);
- }
+#endif
+
+ NDN_LOG_DEBUG("Using PSync");
+ m_psyncLogic = std::make_shared<psync::FullProducer>(80,
+ face,
+ syncPrefix,
+ userPrefix,
+ std::bind(&SyncProtocolAdapter::onPSyncUpdate, this, _1),
+ syncInterestLifetime);
}
void
SyncProtocolAdapter::addUserNode(const ndn::Name& userPrefix)
{
+#ifdef HAVE_CHRONOSYNC
if (m_syncProtocol == SYNC_PROTOCOL_CHRONOSYNC) {
m_chronoSyncLogic->addUserNode(userPrefix, chronosync::Logic::DEFAULT_NAME, FIXED_SESSION);
+ return;
}
- else {
- m_psyncLogic->addUserNode(userPrefix);
- }
+#endif
+
+ m_psyncLogic->addUserNode(userPrefix);
}
void
SyncProtocolAdapter::publishUpdate(const ndn::Name& userPrefix, uint64_t seq)
{
+#ifdef HAVE_CHRONOSYNC
if (m_syncProtocol == SYNC_PROTOCOL_CHRONOSYNC) {
m_chronoSyncLogic->updateSeqNo(seq, userPrefix);
+ return;
}
- else {
- m_psyncLogic->publishName(userPrefix, seq);
- }
+#endif
+ m_psyncLogic->publishName(userPrefix, seq);
}
+#ifdef HAVE_CHRONOSYNC
void
SyncProtocolAdapter::onChronoSyncUpdate(const std::vector<chronosync::MissingDataInfo>& updates)
{
@@ -96,6 +104,7 @@
m_syncUpdateCallback(update.session.getPrefix(-1), update.high);
}
}
+#endif
void
SyncProtocolAdapter::onPSyncUpdate(const std::vector<psync::MissingDataInfo>& updates)
diff --git a/src/communication/sync-protocol-adapter.hpp b/src/communication/sync-protocol-adapter.hpp
index 363f02d..1d56b25 100644
--- a/src/communication/sync-protocol-adapter.hpp
+++ b/src/communication/sync-protocol-adapter.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,
* 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_SYNC_PROTOCOL_ADAPTER_HPP
#define NLSR_SYNC_PROTOCOL_ADAPTER_HPP
@@ -25,7 +25,9 @@
#include "conf-parameter.hpp"
#include <ndn-cxx/face.hpp>
+#ifdef HAVE_CHRONOSYNC
#include <ChronoSync/logic.hpp>
+#endif
#include <PSync/full-producer.hpp>
namespace nlsr {
@@ -37,7 +39,7 @@
{
public:
SyncProtocolAdapter(ndn::Face& facePtr,
- int32_t syncProtocol,
+ SyncProtocol syncProtocol,
const ndn::Name& syncPrefix,
const ndn::Name& userPrefix,
ndn::time::milliseconds syncInterestLifetime,
@@ -62,6 +64,7 @@
publishUpdate(const ndn::Name& userPrefix, uint64_t seq);
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+#ifdef HAVE_CHRONOSYNC
/*! \brief Hook function to call whenever ChronoSync detects new data.
*
* This function packages the sync information into discrete updates
@@ -72,6 +75,7 @@
*/
void
onChronoSyncUpdate(const std::vector<chronosync::MissingDataInfo>& updates);
+#endif
/*! \brief Hook function to call whenever PSync detects new data.
*
@@ -85,9 +89,11 @@
onPSyncUpdate(const std::vector<psync::MissingDataInfo>& updates);
private:
- int32_t m_syncProtocol;
+ SyncProtocol m_syncProtocol;
SyncUpdateCallback m_syncUpdateCallback;
+#ifdef HAVE_CHRONOSYNC
std::shared_ptr<chronosync::Logic> m_chronoSyncLogic;
+#endif
std::shared_ptr<psync::FullProducer> m_psyncLogic;
};
diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index d3e1625..1d3b781 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -293,9 +293,15 @@
}
// sync-protocol
- std::string syncProtocol = section.get<std::string>("sync-protocol", "chronosync");
+ std::string syncProtocol = section.get<std::string>("sync-protocol", "psync");
if (syncProtocol == "chronosync") {
+#ifdef HAVE_CHRONOSYNC
m_confParam.setSyncProtocol(SYNC_PROTOCOL_CHRONOSYNC);
+#else
+ std::cerr << "NLSR was compiled without Chronosync support!" << std::endl;
+ std::cerr << "Only PSync support is currently available ('sync-protocol psync')" << std::endl;
+ return false;
+#endif
}
else if (syncProtocol == "psync") {
m_confParam.setSyncProtocol(SYNC_PROTOCOL_PSYNC);
diff --git a/src/conf-parameter.cpp b/src/conf-parameter.cpp
index 47a33e8..fb92aa2 100644
--- a/src/conf-parameter.cpp
+++ b/src/conf-parameter.cpp
@@ -26,7 +26,7 @@
INIT_LOGGER(ConfParameter);
// To be changed when breaking changes are made to sync
-const uint64_t ConfParameter::SYNC_VERSION = 9;
+const uint64_t ConfParameter::SYNC_VERSION = 10;
static std::unique_ptr<ndn::security::CertificateFetcherDirectFetch>
makeCertificateFetcher(ndn::Face& face)
@@ -52,7 +52,7 @@
, m_corR(0)
, m_maxFacesPerPrefix(MAX_FACES_PER_PREFIX_MIN)
, m_syncInterestLifetime(ndn::time::milliseconds(SYNC_INTEREST_LIFETIME_DEFAULT))
- , m_syncProtocol(SYNC_PROTOCOL_CHRONOSYNC)
+ , m_syncProtocol(SYNC_PROTOCOL_PSYNC)
, m_adjl()
, m_npl()
, m_validator(makeCertificateFetcher(face))
diff --git a/src/conf-parameter.hpp b/src/conf-parameter.hpp
index c000c4b..57dd2c2 100644
--- a/src/conf-parameter.hpp
+++ b/src/conf-parameter.hpp
@@ -40,9 +40,11 @@
LSA_REFRESH_TIME_MAX = 7200
};
-enum {
- SYNC_PROTOCOL_CHRONOSYNC = 0,
- SYNC_PROTOCOL_PSYNC = 1
+enum SyncProtocol {
+#ifdef HAVE_CHRONOSYNC
+ SYNC_PROTOCOL_CHRONOSYNC,
+#endif
+ SYNC_PROTOCOL_PSYNC
};
enum {
@@ -211,18 +213,16 @@
m_lsaRefreshTime = lrt;
}
- uint32_t
+ SyncProtocol
getSyncProtocol() const
{
return m_syncProtocol;
}
void
- setSyncProtocol(int32_t syncProtocol)
+ setSyncProtocol(SyncProtocol syncProtocol)
{
- if (syncProtocol == SYNC_PROTOCOL_CHRONOSYNC || syncProtocol == SYNC_PROTOCOL_PSYNC) {
- m_syncProtocol = syncProtocol;
- }
+ m_syncProtocol = syncProtocol;
}
uint32_t
@@ -527,7 +527,7 @@
ndn::time::milliseconds m_syncInterestLifetime;
- int32_t m_syncProtocol;
+ SyncProtocol m_syncProtocol;
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
static const uint64_t SYNC_VERSION;
diff --git a/tests/communication/test-sync-logic-handler.cpp b/tests/communication/test-sync-logic-handler.cpp
index bdd8a3e..55007b8 100644
--- a/tests/communication/test-sync-logic-handler.cpp
+++ b/tests/communication/test-sync-logic-handler.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.
*
@@ -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 "communication/sync-logic-handler.hpp"
#include "tests/test-common.hpp"
@@ -25,20 +25,20 @@
#include "nlsr.hpp"
#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <boost/lexical_cast.hpp>
namespace nlsr {
namespace test {
using std::shared_ptr;
-template<int32_t Protocol>
class SyncLogicFixture : public UnitTestTimeFixture
{
public:
SyncLogicFixture()
: face(m_ioService, m_keyChain)
, conf(face, m_keyChain)
- , confProcessor(conf, Protocol)
+ , confProcessor(conf, SYNC_PROTOCOL_PSYNC)
, testIsLsaNew([] (const ndn::Name& name, const Lsa::Type& lsaType,
const uint64_t sequenceNumber) {
return true;
@@ -57,16 +57,9 @@
this->advanceClocks(ndn::time::milliseconds(1), 10);
face.sentInterests.clear();
- if (Protocol == SYNC_PROTOCOL_CHRONOSYNC) {
- std::vector<chronosync::MissingDataInfo> updates;
- updates.push_back({ndn::Name(prefix).appendNumber(1), 0, seqNo});
- sync.m_syncLogic.onChronoSyncUpdate(updates);
- }
- else {
- std::vector<psync::MissingDataInfo> updates;
- updates.push_back({ndn::Name(prefix), 0, seqNo});
- sync.m_syncLogic.onPSyncUpdate(updates);
- }
+ std::vector<psync::MissingDataInfo> updates;
+ updates.push_back({ndn::Name(prefix), 0, seqNo});
+ sync.m_syncLogic.onPSyncUpdate(updates);
this->advanceClocks(ndn::time::milliseconds(1), 10);
}
@@ -83,17 +76,13 @@
Lsa::Type::COORDINATE};
};
-using mpl_::int_;
-using Protocols = boost::mpl::vector<int_<SYNC_PROTOCOL_CHRONOSYNC>,
- int_<SYNC_PROTOCOL_PSYNC>>;
-
BOOST_AUTO_TEST_SUITE(TestSyncLogicHandler)
/* Tests that when SyncLogicHandler receives an LSA of either Name or
Adjacency type that appears to be newer, it will emit to its signal
with those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(UpdateForOtherLS, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(UpdateForOtherLS, SyncLogicFixture)
{
std::vector<Lsa::Type> lsaTypes = {Lsa::Type::NAME, Lsa::Type::ADJACENCY};
@@ -118,7 +107,7 @@
either Coordinate or Name type that appears to be newer, it will
emit to its signal with those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(UpdateForOtherHR, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(UpdateForOtherHR, SyncLogicFixture)
{
this->conf.setHyperbolicState(HYPERBOLIC_STATE_ON);
@@ -143,7 +132,7 @@
any type that appears to be newer, it will emit to its signal with
those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(UpdateForOtherHRDry, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(UpdateForOtherHRDry, SyncLogicFixture)
{
this->conf.setHyperbolicState(HYPERBOLIC_STATE_DRY_RUN);
@@ -167,7 +156,7 @@
details matching this router's details, it will *not* emit to its
signal those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(NoUpdateForSelf, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(NoUpdateForSelf, SyncLogicFixture)
{
const uint64_t sequenceNumber = 1;
@@ -193,7 +182,7 @@
details that do not match the expected format, it will *not* emit
to its signal those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(MalformedUpdate, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(MalformedUpdate, SyncLogicFixture)
{
const uint64_t sequenceNumber = 1;
@@ -215,7 +204,7 @@
details that do not appear to be new, it will *not* emit to its
signal those LSA details.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(LsaNotNew, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(LsaNotNew, SyncLogicFixture)
{
auto testLsaAlwaysFalse = [] (const ndn::Name& routerName, const Lsa::Type& lsaType,
const uint64_t& sequenceNumber) {
@@ -237,9 +226,9 @@
/* Tests that SyncLogicHandler successfully concatenates configured
variables together to form the necessary prefixes to advertise
- through ChronoSync.
+ through sync.
*/
-BOOST_FIXTURE_TEST_CASE_TEMPLATE(UpdatePrefix, T, Protocols, SyncLogicFixture<T::value>)
+BOOST_FIXTURE_TEST_CASE(UpdatePrefix, SyncLogicFixture)
{
ndn::Name expectedPrefix = this->conf.getLsaPrefix();
expectedPrefix.append(this->conf.getSiteName());
diff --git a/tests/communication/test-sync-protocol-adapter.cpp b/tests/communication/test-sync-protocol-adapter.cpp
index 5998caf..0266981 100644
--- a/tests/communication/test-sync-protocol-adapter.cpp
+++ b/tests/communication/test-sync-protocol-adapter.cpp
@@ -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,15 +17,14 @@
*
* 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 "communication/sync-protocol-adapter.hpp"
#include "tests/test-common.hpp"
#include <ndn-cxx/util/dummy-client-face.hpp>
-#include <boost/mpl/int.hpp>
-#include <boost/mpl/vector.hpp>
+#include <boost/lexical_cast.hpp>
namespace nlsr {
namespace test {
@@ -43,7 +42,6 @@
syncPrefix.appendVersion(4);
}
- template <int32_t T>
void
addNodes()
{
@@ -51,7 +49,7 @@
faces[i] = std::make_shared<ndn::util::DummyClientFace>(m_ioService,
util::DummyClientFace::Options{true, true});
userPrefixes[i] = Name(nameLsaUserPrefix).appendNumber(i);
- nodes[i] = std::make_shared<SyncProtocolAdapter>(*faces[i], T, syncPrefix,
+ nodes[i] = std::make_shared<SyncProtocolAdapter>(*faces[i], SYNC_PROTOCOL_PSYNC, syncPrefix,
userPrefixes[i],
syncInterestLifetime,
[i, this] (const ndn::Name& updateName,
@@ -73,14 +71,11 @@
std::map<ndn::Name, uint64_t> prefixToSeq[2];
};
-using boost::mpl::int_;
-using Protocols = boost::mpl::vector<int_<SYNC_PROTOCOL_CHRONOSYNC>, int_<SYNC_PROTOCOL_PSYNC>>;
+BOOST_AUTO_TEST_SUITE(TestSyncProtocolAdapter)
-BOOST_FIXTURE_TEST_SUITE(TestSyncProtocolAdapter, SyncProtocolAdapterFixture)
-
-BOOST_AUTO_TEST_CASE_TEMPLATE(Sync, SyncProtocol, Protocols)
+BOOST_FIXTURE_TEST_CASE(Basic, SyncProtocolAdapterFixture)
{
- addNodes<SyncProtocol::value>();
+ addNodes();
nodes[0]->publishUpdate(userPrefixes[0], 10);
advanceClocks(ndn::time::milliseconds(1000), 100);
diff --git a/tests/security/test-certificate-store.cpp b/tests/security/test-certificate-store.cpp
index 00d5d62..df74c28 100644
--- a/tests/security/test-certificate-store.cpp
+++ b/tests/security/test-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.
*
@@ -26,6 +26,7 @@
#include "lsdb.hpp"
#include <ndn-cxx/security/key-chain.hpp>
+#include <boost/lexical_cast.hpp>
namespace nlsr {
namespace test {
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index 495f0ba..0f18dd7 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -177,7 +177,7 @@
public:
DummyConfFileProcessor(ConfParameter& conf,
- int32_t protocol = SYNC_PROTOCOL_PSYNC,
+ SyncProtocol protocol = SYNC_PROTOCOL_PSYNC,
int32_t hyperbolicState = HYPERBOLIC_STATE_OFF,
ndn::Name networkName = "/ndn", ndn::Name siteName = "/site",
ndn::Name routerName = "/%C1.Router/this-router")
diff --git a/tests/test-lsa-rule.cpp b/tests/test-lsa-rule.cpp
index e6d4458..4e7b3b3 100644
--- a/tests/test-lsa-rule.cpp
+++ b/tests/test-lsa-rule.cpp
@@ -25,13 +25,14 @@
#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/security/key-chain.hpp>
-#include <ndn-cxx/util/dummy-client-face.hpp>
#include <ndn-cxx/security/signing-helpers.hpp>
#include <ndn-cxx/security/signing-info.hpp>
+#include <ndn-cxx/util/dummy-client-face.hpp>
#include <boost/filesystem.hpp>
-#include <boost/property_tree/ptree.hpp>
+#include <boost/lexical_cast.hpp>
#include <boost/property_tree/info_parser.hpp>
+#include <boost/property_tree/ptree.hpp>
using namespace ndn;
diff --git a/tests/test-statistics.cpp b/tests/test-statistics.cpp
index 0000fb0..2c02bb7 100644
--- a/tests/test-statistics.cpp
+++ b/tests/test-statistics.cpp
@@ -26,6 +26,7 @@
#include "nlsr.hpp"
#include <ndn-cxx/util/dummy-client-face.hpp>
+#include <boost/lexical_cast.hpp>
namespace nlsr {
namespace test {
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index d5fa0c8..ef8c1b6 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -27,6 +27,8 @@
#include "../test-common.hpp"
#include "../control-commands.hpp"
+#include <boost/lexical_cast.hpp>
+
namespace nlsr {
namespace test {
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index e5a5890..70fd491 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -31,8 +31,9 @@
#include <ndn-cxx/security/signing-helpers.hpp>
#include <boost/filesystem.hpp>
-#include <boost/property_tree/ptree.hpp>
+#include <boost/lexical_cast.hpp>
#include <boost/property_tree/info_parser.hpp>
+#include <boost/property_tree/ptree.hpp>
using namespace ndn;
diff --git a/tests/update/test-save-delete-prefix.cpp b/tests/update/test-save-delete-prefix.cpp
index 336ec8a..26644f8 100644
--- a/tests/update/test-save-delete-prefix.cpp
+++ b/tests/update/test-save-delete-prefix.cpp
@@ -53,7 +53,7 @@
, SITE_CERT_PATH(boost::filesystem::current_path() / std::string("site.cert"))
, counter(0)
{
- std::ifstream source("/usr/local/etc/ndn/nlsr.conf.sample", std::ios::binary);
+ std::ifstream source("nlsr.conf", std::ios::binary);
std::ofstream destination(testConfFile, std::ios::binary);
destination << source.rdbuf();
source.close();
diff --git a/tools/nlsrc.cpp b/tools/nlsrc.cpp
index adeaeee..6c1f064 100644
--- a/tools/nlsrc.cpp
+++ b/tools/nlsrc.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,15 +24,16 @@
#include "version.hpp"
#include "src/publisher/dataset-interest-handler.hpp"
-#include <ndn-cxx/face.hpp>
#include <ndn-cxx/data.hpp>
-#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/interest.hpp>
#include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
-#include <ndn-cxx/util/segment-fetcher.hpp>
-#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/command-interest-signer.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/security/signing-helpers.hpp>
+#include <ndn-cxx/util/segment-fetcher.hpp>
#include <iostream>
diff --git a/wscript b/wscript
index 087ed61..1c24944 100644
--- a/wscript
+++ b/wscript
@@ -1,6 +1,6 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
"""
-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.
@@ -37,6 +37,8 @@
optgrp = opt.add_option_group('NLSR Options')
optgrp.add_option('--with-tests', action='store_true', default=False,
help='Build unit tests')
+ optgrp.add_option('--with-chronosync', action='store_true', default=False,
+ help='Build with Chronosync support')
def configure(conf):
conf.load(['compiler_cxx', 'gnu_dirs',
@@ -59,8 +61,9 @@
'Please upgrade your distribution or manually install a newer version of Boost'
' (https://redmine.named-data.net/projects/nfd/wiki/Boost_FAQ)')
- conf.check_cfg(package='ChronoSync', args=['--cflags', '--libs'], uselib_store='SYNC',
- pkg_config_path=pkg_config_path)
+ if conf.options.with_chronosync:
+ conf.check_cfg(package='ChronoSync', args=['--cflags', '--libs'],
+ uselib_store='CHRONOSYNC', pkg_config_path=pkg_config_path)
conf.check_cfg(package='PSync', args=['--cflags', '--libs'], uselib_store='PSYNC',
pkg_config_path=pkg_config_path)
@@ -98,7 +101,7 @@
target='nlsr-objects',
source=bld.path.ant_glob('src/**/*.cpp',
excl=['src/main.cpp']),
- use='NDN_CXX BOOST SYNC PSYNC',
+ use='NDN_CXX BOOST CHRONOSYNC PSYNC',
includes='. src',
export_includes='. src')