nlsr: Pass keyChain to NLSR constructor
refs: #3742
Change-Id: I186784da2989aa8bcc396c81c4fc80254a6f313a
diff --git a/src/nlsr-runner.cpp b/src/nlsr-runner.cpp
index af68640..100cf72 100644
--- a/src/nlsr-runner.cpp
+++ b/src/nlsr-runner.cpp
@@ -31,7 +31,7 @@
NlsrRunner::NlsrRunner(std::string& configFileName, bool isDaemonProcess)
: m_scheduler(m_ioService)
, m_face(m_ioService)
- , m_nlsr(m_ioService, m_scheduler, m_face)
+ , m_nlsr(m_ioService, m_scheduler, m_face, m_keyChain)
{
m_nlsr.setConfFileName(configFileName);
m_nlsr.setIsDaemonProcess(isDaemonProcess);
diff --git a/src/nlsr-runner.hpp b/src/nlsr-runner.hpp
index 3d34c5f..80ee8d6 100644
--- a/src/nlsr-runner.hpp
+++ b/src/nlsr-runner.hpp
@@ -57,7 +57,7 @@
boost::asio::io_service m_ioService;
ndn::Scheduler m_scheduler;
ndn::Face m_face;
-
+ ndn::KeyChain m_keyChain;
Nlsr m_nlsr;
};
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index fbd067b..6083fc5 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -39,9 +39,10 @@
using namespace ndn;
using namespace std;
-Nlsr::Nlsr(boost::asio::io_service& ioService, ndn::Scheduler& scheduler, ndn::Face& face)
+Nlsr::Nlsr(boost::asio::io_service& ioService, ndn::Scheduler& scheduler, ndn::Face& face, ndn::KeyChain& keyChain)
: m_nlsrFace(face)
, m_scheduler(scheduler)
+ , m_keyChain(keyChain)
, m_confParam()
, m_adjacencyList()
, m_namePrefixList()
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index 8080485..705cc76 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -69,7 +69,7 @@
};
public:
- Nlsr(boost::asio::io_service& ioService, ndn::Scheduler& scheduler, ndn::Face& face);
+ Nlsr(boost::asio::io_service& ioService, ndn::Scheduler& scheduler, ndn::Face& face, ndn::KeyChain& keyChain);
void
registrationFailed(const ndn::Name& name);
@@ -364,6 +364,7 @@
private:
ndn::Face& m_nlsrFace;
ndn::Scheduler& m_scheduler;
+ ndn::KeyChain& m_keyChain;
ConfParameter m_confParam;
AdjacencyList m_adjacencyList;
NamePrefixList m_namePrefixList;
@@ -388,7 +389,6 @@
ndn::shared_ptr<ndn::CertificateCacheTtl> m_certificateCache;
security::CertificateStore m_certStore;
Validator m_validator;
- ndn::KeyChain m_keyChain;
ndn::security::SigningInfo m_signingInfo;
ndn::Name m_defaultCertName;
update::PrefixUpdateProcessor m_prefixUpdateProcessor;
diff --git a/tests/publisher/publisher-fixture.hpp b/tests/publisher/publisher-fixture.hpp
index eda0f71..4466b9b 100644
--- a/tests/publisher/publisher-fixture.hpp
+++ b/tests/publisher/publisher-fixture.hpp
@@ -34,7 +34,7 @@
public:
PublisherFixture()
: face(make_shared<ndn::util::DummyClientFace>())
- , nlsr(g_ioService, g_scheduler, ndn::ref(*face))
+ , nlsr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain)
, lsdb(nlsr, g_scheduler, nlsr.getSyncLogicHandler())
{
}
diff --git a/tests/test-common.hpp b/tests/test-common.hpp
index d7ace96..d326765 100644
--- a/tests/test-common.hpp
+++ b/tests/test-common.hpp
@@ -29,6 +29,7 @@
#include <boost/test/unit_test.hpp>
#include <ndn-cxx/util/scheduler.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/util/time-unit-test-clock.hpp>
namespace nlsr {
@@ -45,6 +46,7 @@
protected:
boost::asio::io_service g_ioService;
ndn::Scheduler g_scheduler;
+ ndn::KeyChain g_keyChain;
};
class UnitTestTimeFixture : public BaseFixture
diff --git a/tests/test-conf-file-processor.cpp b/tests/test-conf-file-processor.cpp
index c36892b..d65fa45 100644
--- a/tests/test-conf-file-processor.cpp
+++ b/tests/test-conf-file-processor.cpp
@@ -133,7 +133,7 @@
public:
ConfFileProcessorFixture()
: face(make_shared<ndn::util::DummyClientFace>())
- , nlsr(g_ioService, g_scheduler, ndn::ref(*face))
+ , nlsr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain)
, CONFIG_FILE("unit-test-nlsr.conf")
, m_logConfigFileName(boost::filesystem::unique_path().native())
, m_logFileName(boost::filesystem::unique_path().native())
diff --git a/tests/test-hyperbolic-calculator.cpp b/tests/test-hyperbolic-calculator.cpp
index de1c86a..97daac0 100644
--- a/tests/test-hyperbolic-calculator.cpp
+++ b/tests/test-hyperbolic-calculator.cpp
@@ -46,7 +46,7 @@
public:
HyperbolicCalculatorFixture()
: face(make_shared<ndn::util::DummyClientFace>())
- , nlsr(g_ioService, g_scheduler, ndn::ref(*face))
+ , nlsr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain)
, routingTable(nlsr.getRoutingTable())
, adjacencies(nlsr.getAdjacencyList())
, lsdb(nlsr.getLsdb())
diff --git a/tests/test-link-state-calculator.cpp b/tests/test-link-state-calculator.cpp
index 2e7a27a..04c5ff4 100644
--- a/tests/test-link-state-calculator.cpp
+++ b/tests/test-link-state-calculator.cpp
@@ -42,7 +42,7 @@
public:
LinkStateCalculatorFixture()
: face(make_shared<ndn::util::DummyClientFace>(g_ioService))
- , nlsr(g_ioService, g_scheduler, ndn::ref(*face))
+ , nlsr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain)
, routingTable(nlsr.getRoutingTable())
, lsdb(nlsr.getLsdb())
{
diff --git a/tests/test-lsdb.cpp b/tests/test-lsdb.cpp
index dc2f51f..959c079 100644
--- a/tests/test-lsdb.cpp
+++ b/tests/test-lsdb.cpp
@@ -40,7 +40,7 @@
public:
LsdbFixture()
: face(make_shared<ndn::util::DummyClientFace>(g_ioService))
- , nlsr(g_ioService, g_scheduler, ndn::ref(*face))
+ , nlsr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain)
, sync(*face, nlsr.getLsdb(), nlsr.getConfParameter(), nlsr.getSequencingManager())
, lsdb(nlsr.getLsdb())
, conf(nlsr.getConfParameter())
diff --git a/tests/test-name-prefix-table.cpp b/tests/test-name-prefix-table.cpp
index bd0e710..58e771e 100644
--- a/tests/test-name-prefix-table.cpp
+++ b/tests/test-name-prefix-table.cpp
@@ -33,7 +33,7 @@
public:
NamePrefixTableFixture()
: face(make_shared<ndn::util::DummyClientFace>(g_ioService))
- , nlsr(g_ioService, g_scheduler, ndn::ref(*face))
+ , nlsr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain)
, lsdb(nlsr.getLsdb())
, npt(nlsr.getNamePrefixTable())
{
diff --git a/tests/test-nlsr.cpp b/tests/test-nlsr.cpp
index 941e1db..531ea8c 100644
--- a/tests/test-nlsr.cpp
+++ b/tests/test-nlsr.cpp
@@ -37,7 +37,7 @@
public:
NlsrFixture()
: face(make_shared<ndn::util::DummyClientFace>())
- , nlsr(g_ioService, g_scheduler, ndn::ref(*face))
+ , nlsr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain)
, lsdb(nlsr.getLsdb())
, neighbors(nlsr.getAdjacencyList())
{
@@ -126,7 +126,7 @@
BOOST_FIXTURE_TEST_CASE(FaceDestroyEvent, UnitTestTimeFixture)
{
shared_ptr<ndn::util::DummyClientFace> face = make_shared<ndn::util::DummyClientFace>(g_ioService);
- Nlsr nlsr(g_ioService, g_scheduler, ndn::ref(*face));
+ Nlsr nlsr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain);
Lsdb& lsdb = nlsr.getLsdb();
// Simulate loading configuration file
@@ -237,7 +237,7 @@
BOOST_FIXTURE_TEST_CASE(FaceDestroyEventInactive, UnitTestTimeFixture)
{
shared_ptr<ndn::util::DummyClientFace> face = make_shared<ndn::util::DummyClientFace>(g_ioService);
- Nlsr nlsr(g_ioService, g_scheduler, ndn::ref(*face));
+ Nlsr nlsr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain);
Lsdb& lsdb = nlsr.getLsdb();
// Simulate loading configuration file
diff --git a/tests/test-sync-logic-handler.cpp b/tests/test-sync-logic-handler.cpp
index e836976..0000de9 100644
--- a/tests/test-sync-logic-handler.cpp
+++ b/tests/test-sync-logic-handler.cpp
@@ -36,7 +36,7 @@
public:
SyncLogicFixture()
: face(make_shared<ndn::util::DummyClientFace>())
- , nlsr(g_ioService, g_scheduler, ndn::ref(*face))
+ , nlsr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain)
, sync(nlsr.getSyncLogicHandler())
, CONFIG_NETWORK("/ndn")
, CONFIG_SITE("/site")
@@ -98,7 +98,7 @@
BOOST_AUTO_TEST_CASE(UpdateForOtherHR)
{
- Nlsr nlsr_hr(g_ioService, g_scheduler, ndn::ref(*face));
+ Nlsr nlsr_hr(g_ioService, g_scheduler, ndn::ref(*face), g_keyChain);
SyncLogicHandler& sync_hr(nlsr_hr.getSyncLogicHandler());
nlsr_hr.getConfParameter().setNetwork(CONFIG_NETWORK);
@@ -132,7 +132,7 @@
BOOST_AUTO_TEST_CASE(UpdateForOtherHRDry)
{
- Nlsr nlsr_hrdry(g_ioService, g_scheduler, ndn::ref(*face));
+ Nlsr nlsr_hrdry(g_ioService, g_scheduler, ndn::ref(*face),g_keyChain);
SyncLogicHandler& sync_hrdry(nlsr_hrdry.getSyncLogicHandler());
nlsr_hrdry.getConfParameter().setNetwork(CONFIG_NETWORK);
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index 983f698..67c00f0 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -46,7 +46,7 @@
: face(make_shared<ndn::util::DummyClientFace>(g_ioService))
, siteIdentity(ndn::Name("/ndn/edu/test-site").appendVersion())
, opIdentity(ndn::Name(siteIdentity).append(ndn::Name("%C1.Operator")).appendVersion())
- , nlsr(g_ioService, g_scheduler, *face)
+ , nlsr(g_ioService, g_scheduler, *face, g_keyChain)
, keyPrefix(("/ndn/broadcast"))
, updateProcessor(nlsr.getPrefixUpdateProcessor())
, SITE_CERT_PATH(boost::filesystem::current_path() / std::string("site.cert"))