**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/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());