**breaking** Change NLSR to nlsr for various prefixes
src: register router prefix to fix remote requests
refs: #4543
Change-Id: I698484318bf8e641f955ea40e6c51c6865cad8bf
diff --git a/src/communication/sync-logic-handler.cpp b/src/communication/sync-logic-handler.cpp
index 5226ed4..7703505 100644
--- a/src/communication/sync-logic-handler.cpp
+++ b/src/communication/sync-logic-handler.cpp
@@ -30,7 +30,7 @@
INIT_LOGGER(SyncLogicHandler);
-const std::string NLSR_COMPONENT = "NLSR";
+const std::string NLSR_COMPONENT = "nlsr";
const std::string LSA_COMPONENT = "LSA";
template<class T>
diff --git a/src/conf-parameter.cpp b/src/conf-parameter.cpp
index 5ffca5b..bb61456 100644
--- a/src/conf-parameter.cpp
+++ b/src/conf-parameter.cpp
@@ -29,7 +29,7 @@
INIT_LOGGER(ConfParameter);
// To be changed when breaking changes are made to sync
-const uint64_t ConfParameter::SYNC_VERSION = 4;
+const uint64_t ConfParameter::SYNC_VERSION = 5;
void
ConfParameter::writeLog()
@@ -69,13 +69,13 @@
m_chronosyncPrefix.append("localhop");
m_chronosyncPrefix.append(m_network);
- m_chronosyncPrefix.append("NLSR");
+ m_chronosyncPrefix.append("nlsr");
m_chronosyncPrefix.append("sync");
m_chronosyncPrefix.appendVersion(SYNC_VERSION);
m_lsaPrefix.append("localhop");
m_lsaPrefix.append(m_network);
- m_lsaPrefix.append("NLSR");
+ m_lsaPrefix.append("nlsr");
m_lsaPrefix.append("LSA");
}
diff --git a/src/hello-protocol.cpp b/src/hello-protocol.cpp
index 0c2d2d3..34600a7 100644
--- a/src/hello-protocol.cpp
+++ b/src/hello-protocol.cpp
@@ -30,7 +30,7 @@
INIT_LOGGER(HelloProtocol);
const std::string HelloProtocol::INFO_COMPONENT = "INFO";
-const std::string HelloProtocol::NLSR_COMPONENT = "NLSR";
+const std::string HelloProtocol::NLSR_COMPONENT = "nlsr";
HelloProtocol::HelloProtocol(Nlsr& nlsr, ndn::Scheduler& scheduler)
: m_nlsr(nlsr)
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 71970ec..3c3fab3 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -97,18 +97,18 @@
Nlsr::setInfoInterestFilter()
{
ndn::Name name(m_confParam.getRouterPrefix());
- name.append("NLSR");
+ name.append("nlsr");
name.append("INFO");
NLSR_LOG_DEBUG("Setting interest filter for Hello interest: " << name);
- getNlsrFace().setInterestFilter(name,
- std::bind(&HelloProtocol::processInterest,
- &m_helloProtocol, _1, _2),
- std::bind(&Nlsr::onRegistrationSuccess, this, _1),
- std::bind(&Nlsr::registrationFailed, this, _1),
- m_signingInfo,
- ndn::nfd::ROUTE_FLAG_CAPTURE);
+ m_nlsrFace.setInterestFilter(name,
+ std::bind(&HelloProtocol::processInterest,
+ &m_helloProtocol, _1, _2),
+ std::bind(&Nlsr::onRegistrationSuccess, this, _1),
+ std::bind(&Nlsr::registrationFailed, this, _1),
+ m_signingInfo,
+ ndn::nfd::ROUTE_FLAG_CAPTURE);
}
void
@@ -118,13 +118,13 @@
NLSR_LOG_DEBUG("Setting interest filter for LsaPrefix: " << name);
- getNlsrFace().setInterestFilter(name,
- std::bind(&Lsdb::processInterest,
- &m_nlsrLsdb, _1, _2),
- std::bind(&Nlsr::onRegistrationSuccess, this, _1),
- std::bind(&Nlsr::registrationFailed, this, _1),
- m_signingInfo,
- ndn::nfd::ROUTE_FLAG_CAPTURE);
+ m_nlsrFace.setInterestFilter(name,
+ std::bind(&Lsdb::processInterest,
+ &m_nlsrLsdb, _1, _2),
+ std::bind(&Nlsr::onRegistrationSuccess, this, _1),
+ std::bind(&Nlsr::registrationFailed, this, _1),
+ m_signingInfo,
+ ndn::nfd::ROUTE_FLAG_CAPTURE);
}
@@ -132,6 +132,7 @@
Nlsr::addDispatcherTopPrefix(const ndn::Name& topPrefix)
{
try {
+ // false since we want to have control over the registration process
m_dispatcher.addTopPrefix(topPrefix, false, m_signingInfo);
}
catch (const std::exception& e) {
@@ -277,7 +278,7 @@
setLsaInterestFilter();
// add top-level prefixes: router and localhost prefix
- addDispatcherTopPrefix(m_confParam.getRouterPrefix());
+ addDispatcherTopPrefix(ndn::Name(m_confParam.getRouterPrefix()).append("nlsr"));
addDispatcherTopPrefix(LOCALHOST_PREFIX);
initializeFaces(std::bind(&Nlsr::processFaceDataset, this, _1),
@@ -299,6 +300,7 @@
registerKeyPrefix();
registerLocalhostPrefix();
+ registerRouterPrefix();
m_helloProtocol.scheduleInterest(m_firstHelloInterval);
@@ -319,7 +321,7 @@
NLSR_LOG_DEBUG("Initializing Key ...");
ndn::Name nlsrInstanceName = m_confParam.getRouterPrefix();
- nlsrInstanceName.append("NLSR");
+ nlsrInstanceName.append("nlsr");
try {
m_keyChain.deleteIdentity(m_keyChain.getPib().getIdentity(nlsrInstanceName));
@@ -377,7 +379,7 @@
{
// Start listening for the interest of this router's NLSR certificate
ndn::Name nlsrKeyPrefix = getConfParameter().getRouterPrefix();
- nlsrKeyPrefix.append("NLSR");
+ nlsrKeyPrefix.append("nlsr");
nlsrKeyPrefix.append("KEY");
m_nlsrFace.setInterestFilter(nlsrKeyPrefix,
@@ -436,6 +438,14 @@
}
void
+Nlsr::registerRouterPrefix()
+{
+ m_nlsrFace.registerPrefix(ndn::Name(m_confParam.getRouterPrefix()).append("nlsr"),
+ std::bind(&Nlsr::onRegistrationSuccess, this, _1),
+ std::bind(&Nlsr::registrationFailed, this, _1));
+}
+
+void
Nlsr::onKeyInterest(const ndn::Name& name, const ndn::Interest& interest)
{
NLSR_LOG_DEBUG("Got interest for certificate. Interest: " << interest.getName());
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index 018febf..476650f 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -436,6 +436,11 @@
void
registerLocalhostPrefix();
+ /*! \brief Registers the <router-prefix>/nlsr so that NLSR can respond to status requests from remote routers.
+ */
+ void
+ registerRouterPrefix();
+
/*! \brief Attempts to satisfy an Interest for a certificate, and send it back.
*/
void
diff --git a/src/route/routing-table-calculator.cpp b/src/route/routing-table-calculator.cpp
index 0be5e54..7dbf821 100644
--- a/src/route/routing-table-calculator.cpp
+++ b/src/route/routing-table-calculator.cpp
@@ -119,7 +119,7 @@
void
RoutingTableCalculator::writeAdjMatrixLog(const Map& map) const
{
- if (!getNdnCxxLogger().isLevelEnabled(ndn::util::LogLevel::DEBUG)) {
+ if (!ndn_cxx_getLogger().isLevelEnabled(ndn::util::LogLevel::DEBUG)) {
return;
}
@@ -133,7 +133,7 @@
routerIndex += " ";
lengthOfDash += "--";
NLSR_LOG_DEBUG("Router:" + map.getRouterNameByMappingNo(i)->toUri() +
- "Index:" + boost::lexical_cast<std::string>(i));
+ " Index:" + boost::lexical_cast<std::string>(i));
}
NLSR_LOG_DEBUG(" |" + routerIndex);
NLSR_LOG_DEBUG(lengthOfDash);