diff --git a/nlsr.conf b/nlsr.conf
index ffffe43..a370f34 100644
--- a/nlsr.conf
+++ b/nlsr.conf
@@ -212,7 +212,7 @@
           type name
           hyper-relation
           {
-	    k-regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><ksk-.*><ID-CERT>$
+            k-regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><ksk-.*><ID-CERT>$
             k-expand \\1
             h-relation equal
             p-regex ^([^<KEY><%C1.Router>]*)<%C1.Router>[^<KEY>]*<KEY><ksk-.*><ID-CERT><>$
@@ -244,6 +244,52 @@
       file-name "root.cert"
     }
   }
+
+  prefix-update-validator
+  {
+    rule
+    {
+      id "NLSR ControlCommand Rule"
+      for interest
+      filter
+      {
+        type name
+        regex ^<localhost><nlsr><prefix-update>[<advertise><withdraw>]<>$
+      }
+      checker
+      {
+        type customized
+        sig-type rsa-sha256
+        key-locator
+        {
+          type name
+          regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><ksk-.*><ID-CERT>$
+        }
+      }
+    }
+
+    rule
+    {
+      id "NLSR Hierarchy Rule"
+      for data
+      filter
+      {
+        type name
+        regex ^[^<KEY>]*<KEY><ksk-.*><ID-CERT><>$
+      }
+      checker
+      {
+        type hierarchical
+        sig-type rsa-sha256
+      }
+    }
+
+    trust-anchor
+    {
+      type file
+      file-name "site.cert"
+    }
+  }
   ; cert-to-publish "root.cert"  ; optional, a file containing the root certificate
                                  ; Only the router that is designated to publish the root cert
                                  ; needs to specify this
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
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
new file mode 100644
index 0000000..adb13f4
--- /dev/null
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -0,0 +1,241 @@
+/* -*- 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 "update/prefix-update-processor.hpp"
+
+#include "../control-commands.hpp"
+#include "../test-common.hpp"
+#include "nlsr.hpp"
+
+#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/management/nfd-control-parameters.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/util/dummy-client-face.hpp>
+
+#include <boost/filesystem.hpp>
+
+using namespace ndn;
+
+namespace nlsr {
+namespace update {
+namespace test {
+
+class PrefixUpdateFixture : public nlsr::test::BaseFixture
+{
+public:
+  PrefixUpdateFixture()
+    : face(ndn::util::makeDummyClientFace(g_ioService))
+    , siteIdentity(ndn::Name("/ndn/edu/test-site").appendVersion())
+    , opIdentity(ndn::Name(siteIdentity).append(ndn::Name("%C1.Operator")).appendVersion())
+    , nlsr(g_ioService, g_scheduler, *face)
+    , keyPrefix(("/ndn/broadcast"))
+    , updateProcessor(nlsr.getPrefixUpdateProcessor())
+    , SITE_CERT_PATH(boost::filesystem::current_path() / std::string("site.cert"))
+  {
+    createSiteCert();
+    BOOST_REQUIRE(siteCert != nullptr);
+
+    createOperatorCert();
+    BOOST_REQUIRE(opCert != nullptr);
+
+    const std::string CONFIG =
+      "rule\n"
+      "{\n"
+      "  id \"NLSR ControlCommand Rule\"\n"
+      "  for interest\n"
+      "  filter\n"
+      "  {\n"
+      "    type name\n"
+      "    regex ^<localhost><nlsr><prefix-update>[<advertise><withdraw>]<>$\n"
+      "  }\n"
+      "  checker\n"
+      "  {\n"
+      "    type customized\n"
+      "    sig-type rsa-sha256\n"
+      "    key-locator\n"
+      "    {\n"
+      "      type name\n"
+      "      regex ^([^<KEY><%C1.Operator>]*)<%C1.Operator>[^<KEY>]*<KEY><ksk-.*><ID-CERT>$\n"
+      "    }\n"
+      "  }\n"
+      "}\n"
+      "rule\n"
+      "{\n"
+      "  id \"NLSR Hierarchy Rule\"\n"
+      "  for data\n"
+      "  filter\n"
+      "  {\n"
+      "    type name\n"
+      "    regex ^[^<KEY>]*<KEY><ksk-.*><ID-CERT><>$\n"
+      "  }\n"
+      "  checker\n"
+      "  {\n"
+      "    type hierarchical\n"
+      "    sig-type rsa-sha256\n"
+      "  }\n"
+      "}\n"
+      "trust-anchor\n"
+      "{\n"
+      " type file\n"
+      " file-name \"site.cert\"\n"
+      "}\n";
+
+    const boost::filesystem::path CONFIG_PATH =
+      (boost::filesystem::current_path() / std::string("unit-test.conf"));
+
+    updateProcessor.getValidator().load(CONFIG, CONFIG_PATH.native());
+
+    // Insert certs after the validator is loaded since ValidatorConfig::load() clears
+    // the certificate cache
+    nlsr.addCertificateToCache(opCert);
+
+    // Set the network so the LSA prefix is constructed
+    nlsr.getConfParameter().setNetwork("/ndn");
+
+    // Initialize NLSR so a sync socket is created
+    nlsr.initialize();
+
+    // Listen on localhost prefix
+    updateProcessor.startListening();
+
+    face->processEvents(ndn::time::milliseconds(1));
+    face->sentInterests.clear();
+  }
+
+  void
+  createSiteCert()
+  {
+    // Site cert
+    keyChain.createIdentity(siteIdentity);
+    siteCertName = keyChain.getDefaultCertificateNameForIdentity(siteIdentity);
+    siteCert = keyChain.getCertificate(siteCertName);
+
+    ndn::io::save(*siteCert, SITE_CERT_PATH.string());
+  }
+
+  void
+  createOperatorCert()
+  {
+    // Operator cert
+    ndn::Name keyName = keyChain.generateRsaKeyPairAsDefault(opIdentity, true);
+
+    opCert = ndn::make_shared<ndn::IdentityCertificate>();
+    ndn::shared_ptr<ndn::PublicKey> pubKey = keyChain.getPublicKey(keyName);
+    opCertName = keyName.getPrefix(-1);
+    opCertName.append("KEY").append(keyName.get(-1)).append("ID-CERT").appendVersion();
+    opCert->setName(opCertName);
+    opCert->setNotBefore(time::system_clock::now() - time::days(1));
+    opCert->setNotAfter(time::system_clock::now() + time::days(1));
+    opCert->setPublicKeyInfo(*pubKey);
+    opCert->addSubjectDescription(CertificateSubjectDescription(ndn::oid::ATTRIBUTE_NAME,
+                                                                keyName.toUri()));
+    opCert->encode();
+
+    keyChain.signByIdentity(*opCert, siteIdentity);
+
+    keyChain.addCertificateAsIdentityDefault(*opCert);
+  }
+
+  bool
+  wasRoutingUpdatePublished()
+  {
+    const ndn::Name& lsaPrefix = nlsr.getConfParameter().getLsaPrefix();
+
+    const auto& it = std::find_if(face->sentDatas.begin(), face->sentDatas.end(),
+      [lsaPrefix] (const ndn::Data& data) {
+        return lsaPrefix.isPrefixOf(data.getName());
+      });
+
+    return (it != face->sentDatas.end());
+  }
+
+  ~PrefixUpdateFixture()
+  {
+    keyChain.deleteIdentity(siteIdentity);
+    keyChain.deleteIdentity(opIdentity);
+
+    boost::filesystem::remove(SITE_CERT_PATH);
+  }
+
+public:
+  shared_ptr<ndn::util::DummyClientFace> face;
+  ndn::KeyChain keyChain;
+
+  ndn::Name siteIdentity;
+  ndn::Name siteCertName;
+  shared_ptr<IdentityCertificate> siteCert;
+
+  ndn::Name opIdentity;
+  ndn::Name opCertName;
+  shared_ptr<IdentityCertificate> opCert;
+
+  Nlsr nlsr;
+  ndn::Name keyPrefix;
+  PrefixUpdateProcessor& updateProcessor;
+
+  const boost::filesystem::path SITE_CERT_PATH;
+};
+
+BOOST_FIXTURE_TEST_SUITE(TestPrefixUpdateProcessor, PrefixUpdateFixture)
+
+BOOST_AUTO_TEST_CASE(Basic)
+{
+  // Advertise
+  ndn::nfd::ControlParameters parameters;
+  parameters.setName("/prefix/to/advertise/");
+
+  ndn::Name advertiseCommand("/localhost/nlsr/prefix-update/advertise");
+  advertiseCommand.append(parameters.wireEncode());
+
+  shared_ptr<Interest> advertiseInterest = make_shared<Interest>(advertiseCommand);
+  keyChain.signByIdentity(*advertiseInterest, opIdentity);
+
+  face->receive(*advertiseInterest);
+  face->processEvents(ndn::time::milliseconds(1));
+
+  NamePrefixList& namePrefixList = nlsr.getNamePrefixList();
+
+  BOOST_REQUIRE_EQUAL(namePrefixList.getSize(), 1);
+  BOOST_CHECK_EQUAL(namePrefixList.getNameList().front(), parameters.getName());
+
+  BOOST_CHECK(wasRoutingUpdatePublished());
+  face->sentDatas.clear();
+
+  // Withdraw
+  ndn::Name withdrawCommand("/localhost/nlsr/prefix-update/withdraw");
+  withdrawCommand.append(parameters.wireEncode());
+
+  shared_ptr<Interest> withdrawInterest = make_shared<Interest>(withdrawCommand);
+  keyChain.signByIdentity(*withdrawInterest, opIdentity);
+
+  face->receive(*withdrawInterest);
+  face->processEvents(ndn::time::milliseconds(1));
+
+  BOOST_CHECK_EQUAL(namePrefixList.getSize(), 0);
+
+  BOOST_CHECK(wasRoutingUpdatePublished());
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace test
+} // namespace update
+} // namespace nlsr
diff --git a/tests/wscript b/tests/wscript
index 9d8973b..3f3cbaf 100644
--- a/tests/wscript
+++ b/tests/wscript
@@ -28,7 +28,7 @@
             target='unit-tests-main',
             name='unit-tests-main',
             features='cxx',
-            source=bld.path.ant_glob(['*.cpp', 'utility/*.cpp', 'tlv/*.cpp', 'publisher/*.cpp']),
+            source=bld.path.ant_glob(['**/*.cpp'], excl=['nsync/**/*']),
             use='nlsr-objects',
           )
 
