nlsr: accept NFD-RIB-style register/unregister commands

refs: #3818

Change-Id: I7a5455bdec815bdcbe53ad535dab44249d1a18ce
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 2a57e0f..58d5cf7 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -73,6 +73,10 @@
                             m_certificateCache,
                             m_certStore)
   , m_dispatcher(m_nlsrFace, m_keyChain, m_signingInfo)
+  , m_nfdRibCommandProcessor(m_dispatcher,
+                             m_namePrefixList,
+                             m_nlsrLsdb,
+                             m_syncLogicHandler)
   , m_faceMonitor(m_nlsrFace)
   , m_firstHelloInterval(FIRST_HELLO_INTERVAL_DEFAULT)
 {
@@ -104,6 +108,16 @@
 
   m_prefixUpdateProcessor.startListening();
   m_lsdbDatasetHandler.startListeningOnLocalhost();
+  // Dispatcher prefix registrations
+  m_nfdRibCommandProcessor.startListening();
+  // All dispatcher-related sub-prefixes *must* be registered before
+  // the top-level prefixes are added.
+  try {
+    m_dispatcher.addTopPrefix(LOCALHOST_PREFIX, false, m_signingInfo);
+  }
+  catch (const std::exception& e) {
+    _LOG_ERROR("Error setting top-level prefix in dispatcher: " << e.what() << "\n");
+  }
 }
 
 void
@@ -281,16 +295,6 @@
 void
 Nlsr::registerLocalhostPrefix()
 {
-  _LOG_TRACE("Registering prefix with dispatcher and Face: " << LOCALHOST_PREFIX);
-  // All dispatcher-related sub-prefixes *must* be registered before
-  // the top-level prefixes are added.
-  try {
-    m_dispatcher.addTopPrefix(LOCALHOST_PREFIX, false, m_signingInfo);
-  }
-  catch (const std::exception& e) {
-    _LOG_ERROR("Error setting top-level prefix in dispatcher: " << e.what() << "\n");
-    registrationFailed(LOCALHOST_PREFIX);
-  }
   m_nlsrFace.registerPrefix(LOCALHOST_PREFIX,
                             std::bind(&Nlsr::onLocalhostRegistrationSuccess, this, _1),
                             std::bind(&Nlsr::registrationFailed, this, _1));