update: Process Name prefix update commands

refs #1834

Change-Id: I18c86d0743b4a10ce3a8681f202b59a86602e43f
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 1176b69..2175c93 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -34,6 +34,8 @@
 
 INIT_LOGGER("nlsr");
 
+const ndn::Name Nlsr::LOCALHOST_PREFIX = ndn::Name("/localhost/nlsr");
+
 using namespace ndn;
 using namespace std;
 
@@ -57,6 +59,14 @@
 }
 
 void
+Nlsr::onLocalhostRegistrationSuccess(const ndn::Name& name)
+{
+  _LOG_DEBUG("Successfully registered prefix: " << name);
+
+  m_prefixUpdateProcessor.startListening();
+}
+
+void
 Nlsr::setInfoInterestFilter()
 {
   ndn::Name name(m_confParam.getRouterPrefix());
@@ -156,6 +166,7 @@
   m_nlsrLsdb.buildAndInstallOwnCoordinateLsa();
 
   registerKeyPrefix();
+  registerLocalhostPrefix();
 
   m_helloProtocol.scheduleInterest(m_firstHelloInterval);
 
@@ -222,6 +233,16 @@
 }
 
 void
+Nlsr::registerLocalhostPrefix()
+{
+  _LOG_TRACE("Registering prefix: " << LOCALHOST_PREFIX);
+
+  m_nlsrFace.registerPrefix(LOCALHOST_PREFIX,
+                            std::bind(&Nlsr::onLocalhostRegistrationSuccess, this, _1),
+                            std::bind(&Nlsr::registrationFailed, this, _1));
+}
+
+void
 Nlsr::onKeyInterest(const ndn::Name& name, const ndn::Interest& interest)
 {
   const ndn::Name& interestName = interest.getName();