diff --git a/src/conf-file-processor.cpp b/src/conf-file-processor.cpp
index 10667f1..2bb7aef 100644
--- a/src/conf-file-processor.cpp
+++ b/src/conf-file-processor.cpp
@@ -35,6 +35,7 @@
 #include "conf-file-processor.hpp"
 #include "adjacent.hpp"
 #include "utility/name-helper.hpp"
+#include "update/prefix-update-processor.hpp"
 
 namespace nlsr {
 
@@ -620,6 +621,15 @@
   m_nlsr.loadValidator(it->second, m_confFileName);
   it++;
 
+  if (it == section.end() || it->first != "prefix-update-validator")
+    {
+      std::cerr << "Error: Expect prefix-update-validator section" << std::endl;
+      return false;
+    }
+
+  m_nlsr.getPrefixUpdateProcessor().loadValidator(it->second, m_confFileName);
+  it++;
+
   for (; it != section.end(); it++)
     {
       using namespace boost::filesystem;
diff --git a/src/name-prefix-list.cpp b/src/name-prefix-list.cpp
index 6afdb54..9605d0d 100644
--- a/src/name-prefix-list.cpp
+++ b/src/name-prefix-list.cpp
@@ -1,7 +1,8 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  University of Memphis,
- *                     Regents of the University of California
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
  *
  * This file is part of NLSR (Named-data Link State Routing).
  * See AUTHORS.md for complete list of NLSR authors and contributors.
@@ -16,10 +17,8 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- *
- * \author A K M Mahmudul Hoque <ahoque1@memphis.edu>
- *
  **/
+
 #include <iostream>
 #include <algorithm>
 
@@ -49,7 +48,7 @@
   return name1 == name2;
 }
 
-int32_t
+bool
 NamePrefixList::insert(const ndn::Name& name)
 {
   std::list<ndn::Name>::iterator it = std::find_if(m_nameList.begin(),
@@ -57,13 +56,13 @@
                                                    ndn::bind(&nameCompare, _1 ,
                                                              ndn::cref(name)));
   if (it != m_nameList.end()) {
-    return -1;
+    return false;
   }
   m_nameList.push_back(name);
-  return 0;
+  return true;
 }
 
-int32_t
+bool
 NamePrefixList::remove(const ndn::Name& name)
 {
   std::list<ndn::Name>::iterator it = std::find_if(m_nameList.begin(),
@@ -72,8 +71,10 @@
                                                    ndn::cref(name)));
   if (it != m_nameList.end()) {
     m_nameList.erase(it);
+    return true;
   }
-  return -1;
+
+  return false;
 }
 
 void
diff --git a/src/name-prefix-list.hpp b/src/name-prefix-list.hpp
index 9f50d2e..100cd2a 100644
--- a/src/name-prefix-list.hpp
+++ b/src/name-prefix-list.hpp
@@ -1,7 +1,8 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2014  University of Memphis,
- *                     Regents of the University of California
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
  *
  * This file is part of NLSR (Named-data Link State Routing).
  * See AUTHORS.md for complete list of NLSR authors and contributors.
@@ -16,10 +17,8 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- *
- * \author A K M Mahmudul Hoque <ahoque1@memphis.edu>
- *
  **/
+
 #ifndef NLSR_NAME_PREFIX_LIST_HPP
 #define NLSR_NAME_PREFIX_LIST_HPP
 
@@ -38,10 +37,16 @@
 
   ~NamePrefixList();
 
-  int32_t
+  /** \brief inserts name into NamePrefixList
+   *  \return true if the name is inserted, otherwise false
+   */
+  bool
   insert(const ndn::Name& name);
 
-  int32_t
+  /** \brief removes name from NamePrefixList
+   *  \return true if the name is removed, otherwise false
+   */
+  bool
   remove(const ndn::Name& name);
 
   void
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();
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index 1b7527d..8893272 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -45,7 +45,8 @@
 #include "hello-protocol.hpp"
 #include "test-access-control.hpp"
 #include "publisher/lsdb-dataset-interest-handler.hpp"
-
+#include "utility/name-helper.hpp"
+#include "update/prefix-update-processor.hpp"
 #include "validator.hpp"
 
 
@@ -87,6 +88,13 @@
     , m_helloProtocol(*this, scheduler)
     , m_certificateCache(new ndn::CertificateCacheTtl(ioService))
     , m_validator(m_nlsrFace, DEFAULT_BROADCAST_PREFIX, m_certificateCache)
+    , m_prefixUpdateProcessor(m_nlsrFace,
+                              m_namePrefixList,
+                              m_nlsrLsdb,
+                              m_syncLogicHandler,
+                              DEFAULT_BROADCAST_PREFIX,
+                              m_keyChain,
+                              m_certificateCache)
     , m_faceMonitor(m_nlsrFace)
     , m_firstHelloInterval(FIRST_HELLO_INTERVAL_DEFAULT)
   {
@@ -101,6 +109,9 @@
   onRegistrationSuccess(const ndn::Name& name);
 
   void
+  onLocalhostRegistrationSuccess(const ndn::Name& name);
+
+  void
   setInfoInterestFilter();
 
   void
@@ -302,6 +313,12 @@
     return m_defaultCertName;
   }
 
+  update::PrefixUpdateProcessor&
+  getPrefixUpdateProcessor()
+  {
+    return m_prefixUpdateProcessor;
+  }
+
   void
   createFace(const std::string& faceUri,
              const CommandSucceedCallback& onSuccess,
@@ -322,11 +339,23 @@
     return m_firstHelloInterval;
   }
 
+PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+  void
+  addCertificateToCache(ndn::shared_ptr<ndn::IdentityCertificate> certificate)
+  {
+    if (certificate != nullptr) {
+      m_certificateCache->insertCertificate(certificate);
+    }
+  }
+
 private:
   void
   registerKeyPrefix();
 
   void
+  registerLocalhostPrefix();
+
+  void
   onKeyInterest(const ndn::Name& name, const ndn::Interest& interest);
 
   void
@@ -347,6 +376,9 @@
     m_firstHelloInterval = interval;
   }
 
+public:
+  static const ndn::Name LOCALHOST_PREFIX;
+
 private:
   typedef std::map<ndn::Name, ndn::shared_ptr<ndn::IdentityCertificate> > CertMap;
 
@@ -377,6 +409,7 @@
   ndn::KeyChain m_keyChain;
   ndn::Name m_defaultIdentity;
   ndn::Name m_defaultCertName;
+  update::PrefixUpdateProcessor m_prefixUpdateProcessor;
 
   ndn::nfd::FaceMonitor m_faceMonitor;
 
diff --git a/src/update/prefix-update-commands.cpp b/src/update/prefix-update-commands.cpp
new file mode 100644
index 0000000..539cc10
--- /dev/null
+++ b/src/update/prefix-update-commands.cpp
@@ -0,0 +1,42 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "prefix-update-commands.hpp"
+
+namespace nlsr {
+namespace update {
+
+WithdrawPrefixCommand::WithdrawPrefixCommand()
+  : ControlCommand("nlsr", "withdraw")
+{
+  m_requestValidator.required(ndn::nfd::CONTROL_PARAMETER_NAME);
+  m_responseValidator.required(ndn::nfd::CONTROL_PARAMETER_NAME);
+}
+
+AdvertisePrefixCommand::AdvertisePrefixCommand()
+  : ControlCommand("nlsr", "advertise")
+{
+  m_requestValidator.required(ndn::nfd::CONTROL_PARAMETER_NAME);
+  m_responseValidator.required(ndn::nfd::CONTROL_PARAMETER_NAME);
+}
+
+} // namespace update
+} // namespace nlsr
diff --git a/src/update/prefix-update-commands.hpp b/src/update/prefix-update-commands.hpp
new file mode 100644
index 0000000..6dd30a9
--- /dev/null
+++ b/src/update/prefix-update-commands.hpp
@@ -0,0 +1,45 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#ifndef UPDATE_PREFIX_UPDATE_COMMANDS_HPP
+#define UPDATE_PREFIX_UPDATE_COMMANDS_HPP
+
+#include <ndn-cxx/management/nfd-control-command.hpp>
+
+namespace nlsr {
+namespace update {
+
+class WithdrawPrefixCommand : public ndn::nfd::ControlCommand
+{
+public:
+  WithdrawPrefixCommand();
+};
+
+class AdvertisePrefixCommand : public ndn::nfd::ControlCommand
+{
+public:
+  AdvertisePrefixCommand();
+};
+
+} // namespace update
+} // namespace nlsr
+
+#endif // UPDATE_PREFIX_UPDATE_COMMANDS_HPP
diff --git a/src/update/prefix-update-processor.cpp b/src/update/prefix-update-processor.cpp
new file mode 100644
index 0000000..75e6bae
--- /dev/null
+++ b/src/update/prefix-update-processor.cpp
@@ -0,0 +1,207 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#include "prefix-update-processor.hpp"
+
+#include "lsdb.hpp"
+#include "nlsr.hpp"
+#include "prefix-update-commands.hpp"
+#include "communication/sync-logic-handler.hpp"
+
+#include <ndn-cxx/management/nfd-control-response.hpp>
+
+namespace nlsr {
+namespace update {
+
+INIT_LOGGER("PrefixUpdateProcessor");
+
+const ndn::Name::Component PrefixUpdateProcessor::MODULE_COMPONENT = ndn::Name::Component("prefix-update");
+const ndn::Name::Component PrefixUpdateProcessor::ADVERTISE_VERB = ndn::Name::Component("advertise");
+const ndn::Name::Component PrefixUpdateProcessor::WITHDRAW_VERB  = ndn::Name::Component("withdraw");
+
+PrefixUpdateProcessor::PrefixUpdateProcessor(ndn::Face& face,
+                                             NamePrefixList& namePrefixList,
+                                             Lsdb& lsdb,
+                                             SyncLogicHandler& sync,
+                                             const ndn::Name broadcastPrefix,
+                                             ndn::KeyChain& keyChain,
+                                             ndn::shared_ptr<ndn::CertificateCacheTtl> certificateCache)
+  : m_face(face)
+  , m_namePrefixList(namePrefixList)
+  , m_lsdb(lsdb)
+  , m_sync(sync)
+  , m_keyChain(keyChain)
+  , m_validator(m_face, broadcastPrefix, certificateCache)
+  , COMMAND_PREFIX(ndn::Name(Nlsr::LOCALHOST_PREFIX).append(MODULE_COMPONENT))
+{
+}
+
+void
+PrefixUpdateProcessor::startListening()
+{
+  _LOG_DEBUG("Setting Interest filter for: " << COMMAND_PREFIX);
+
+  m_face.setInterestFilter(COMMAND_PREFIX, bind(&PrefixUpdateProcessor::onInterest, this, _2));
+}
+
+void
+PrefixUpdateProcessor::onInterest(const ndn::Interest& request)
+{
+  _LOG_TRACE("Received Interest: " << request);
+
+  m_validator.validate(request,
+                       bind(&PrefixUpdateProcessor::onCommandValidated, this, _1),
+                       bind(&PrefixUpdateProcessor::onCommandValidationFailed, this, _1, _2));
+}
+
+void
+PrefixUpdateProcessor::loadValidator(boost::property_tree::ptree section,
+                                     const std::string& filename)
+{
+  m_validator.load(section, filename);
+}
+
+void
+PrefixUpdateProcessor::onCommandValidated(const std::shared_ptr<const ndn::Interest>& request)
+{
+  const ndn::Name& command = request->getName();
+  const ndn::Name::Component& verb = command[COMMAND_PREFIX.size()];
+  const ndn::Name::Component& parameterComponent = command[COMMAND_PREFIX.size() + 1];
+
+  if (verb == ADVERTISE_VERB || verb == WITHDRAW_VERB) {
+    ndn::nfd::ControlParameters parameters;
+
+    if (!extractParameters(parameterComponent, parameters)) {
+      sendResponse(request, 400, "Malformed command");
+      return;
+    }
+
+    if (verb == ADVERTISE_VERB) {
+      advertise(request, parameters);
+    }
+    else if (verb == WITHDRAW_VERB) {
+      withdraw(request, parameters);
+    }
+
+    sendResponse(request, 200, "Success");
+  }
+  else {
+    sendResponse(request, 501, "Unsupported command");
+  }
+}
+
+void
+PrefixUpdateProcessor::onCommandValidationFailed(const std::shared_ptr<const ndn::Interest>& request,
+                                                 const std::string& failureInfo)
+{
+  sendResponse(request, 403, failureInfo);
+}
+
+bool
+PrefixUpdateProcessor::extractParameters(const ndn::Name::Component& parameterComponent,
+                                         ndn::nfd::ControlParameters& extractedParameters)
+{
+  try {
+    ndn::Block rawParameters = parameterComponent.blockFromValue();
+    extractedParameters.wireDecode(rawParameters);
+  }
+  catch (const ndn::tlv::Error&) {
+    return false;
+  }
+
+  return true;
+}
+
+void
+PrefixUpdateProcessor::advertise(const std::shared_ptr<const ndn::Interest>& request,
+                                 const ndn::nfd::ControlParameters& parameters)
+{
+  AdvertisePrefixCommand command;
+
+  if (!validateParameters(command, parameters)) {
+    sendResponse(request, 400, "Malformed command");
+    return;
+  }
+
+  _LOG_INFO("Advertising name: " << parameters.getName());
+
+  if (m_namePrefixList.insert(parameters.getName())) {
+    // Only build a Name LSA if the added name is new
+    m_lsdb.buildAndInstallOwnNameLsa();
+    m_sync.publishRoutingUpdate();
+  }
+}
+
+void
+PrefixUpdateProcessor::withdraw(const std::shared_ptr<const ndn::Interest>& request,
+                                const ndn::nfd::ControlParameters& parameters)
+{
+  WithdrawPrefixCommand command;
+
+  if (!validateParameters(command, parameters)) {
+    sendResponse(request, 400, "Malformed command");
+    return;
+  }
+
+  _LOG_INFO("Withdrawing name: " << parameters.getName());
+
+  if (m_namePrefixList.remove(parameters.getName())) {
+    // Only build a Name LSA if a name was actually removed
+    m_lsdb.buildAndInstallOwnNameLsa();
+    m_sync.publishRoutingUpdate();
+  }
+}
+
+bool
+PrefixUpdateProcessor::validateParameters(const ndn::nfd::ControlCommand& command,
+                                          const ndn::nfd::ControlParameters& parameters)
+{
+  try {
+    command.validateRequest(parameters);
+  }
+  catch (const ndn::nfd::ControlCommand::ArgumentError&) {
+    return false;
+  }
+
+  return true;
+}
+
+void
+PrefixUpdateProcessor::sendResponse(const std::shared_ptr<const ndn::Interest>& request,
+                                    uint32_t code,
+                                    const std::string& text)
+{
+  if (request == nullptr) {
+    return;
+  }
+
+  ndn::nfd::ControlResponse response(code, text);
+  const ndn::Block& encodedControl = response.wireEncode();
+
+  std::shared_ptr<ndn::Data> responseData = ndn::make_shared<ndn::Data>(request->getName());
+  responseData->setContent(encodedControl);
+
+  m_keyChain.sign(*responseData);
+  m_face.put(*responseData);
+}
+
+} // namespace update
+} // namespace nlsr
diff --git a/src/update/prefix-update-processor.hpp b/src/update/prefix-update-processor.hpp
new file mode 100644
index 0000000..164bb49
--- /dev/null
+++ b/src/update/prefix-update-processor.hpp
@@ -0,0 +1,137 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2015,  The University of Memphis,
+ *                           Regents of the University of California,
+ *                           Arizona Board of Regents.
+ *
+ * This file is part of NLSR (Named-data Link State Routing).
+ * See AUTHORS.md for complete list of NLSR authors and contributors.
+ *
+ * NLSR is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NLSR is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+#ifndef UPDATE_PREFIX_UPDATE_PROCESSOR_HPP
+#define UPDATE_PREFIX_UPDATE_PROCESSOR_HPP
+
+#include "name-prefix-list.hpp"
+#include "test-access-control.hpp"
+#include "validator.hpp"
+
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/management/nfd-control-command.hpp>
+#include <ndn-cxx/management/nfd-control-parameters.hpp>
+#include <ndn-cxx/security/certificate-cache-ttl.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+
+#include <boost/noncopyable.hpp>
+#include <boost/property_tree/ptree.hpp>
+
+namespace nlsr {
+
+class Lsdb;
+class SyncLogicHandler;
+
+namespace update {
+
+typedef boost::property_tree::ptree ConfigSection;
+
+class PrefixUpdateProcessor : boost::noncopyable
+{
+public:
+  class Error : public std::runtime_error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : std::runtime_error(what)
+    {
+    }
+  };
+
+public:
+  PrefixUpdateProcessor(ndn::Face& face,
+                        NamePrefixList& namePrefixList,
+                        Lsdb& lsdb,
+                        SyncLogicHandler& sync,
+                        const ndn::Name broadcastPrefix,
+                        ndn::KeyChain& keyChain,
+                        ndn::shared_ptr<ndn::CertificateCacheTtl> certificateCache);
+
+  void
+  loadValidator(ConfigSection section, const std::string& filename);
+
+  void
+  startListening();
+
+private:
+  void
+  onInterest(const ndn::Interest& request);
+
+  void
+  sendResponse(const std::shared_ptr<const ndn::Interest>& request,
+               uint32_t code,
+               const std::string& text);
+
+  /** \brief adds desired name prefix to the advertised name prefix list
+   */
+  void
+  advertise(const std::shared_ptr<const ndn::Interest>& request,
+            const ndn::nfd::ControlParameters& parameters);
+
+  /** \brief removes desired name prefix from the advertised name prefix list
+   */
+  void
+  withdraw(const std::shared_ptr<const ndn::Interest>& request,
+           const ndn::nfd::ControlParameters& parameters);
+
+  void
+  onCommandValidated(const std::shared_ptr<const ndn::Interest>& request);
+
+  void
+  onCommandValidationFailed(const std::shared_ptr<const ndn::Interest>& request,
+                            const std::string& failureInfo);
+
+  static bool
+  extractParameters(const ndn::name::Component& parameterComponent,
+                    ndn::nfd::ControlParameters& extractedParameters);
+
+  bool
+  validateParameters(const ndn::nfd::ControlCommand& command,
+                     const ndn::nfd::ControlParameters& parameters);
+
+PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+  Validator&
+  getValidator()
+  {
+    return m_validator;
+  }
+
+private:
+  ndn::Face& m_face;
+  NamePrefixList& m_namePrefixList;
+  Lsdb& m_lsdb;
+  SyncLogicHandler& m_sync;
+  ndn::KeyChain& m_keyChain;
+  Validator m_validator;
+
+  const ndn::Name COMMAND_PREFIX; // /localhost/nlsr/prefix-update
+
+  static const ndn::Name::Component MODULE_COMPONENT;
+  static const ndn::Name::Component ADVERTISE_VERB;
+  static const ndn::Name::Component WITHDRAW_VERB;
+};
+
+} // namespace update
+} // namespace nlsr
+
+#endif // UPDATE_PREFIX_UPDATE_PROCESSOR_HPP
