update: merge ManagerBase and CommandManagerBase

Change-Id: Ib939d8d032ff9e6e27f51d9053d08da558fd5027
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index 3902959..144f1d3 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -27,6 +27,7 @@
 #include <cstdio>
 #include <unistd.h>
 
+#include <ndn-cxx/mgmt/nfd/control-command.hpp>
 #include <ndn-cxx/mgmt/nfd/status-dataset.hpp>
 #include <ndn-cxx/net/face-uri.hpp>
 
diff --git a/src/nlsr.hpp b/src/nlsr.hpp
index f562bc9..f375eca 100644
--- a/src/nlsr.hpp
+++ b/src/nlsr.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2023,  The University of Memphis,
+ * Copyright (c) 2014-2025,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
  *
@@ -185,10 +185,6 @@
   DatasetInterestHandler m_datasetHandler;
 
 private:
-  /*! \brief Where NLSR stores certificates it claims to be
-   * authoritative for. Usually the router certificate.
-   */
-
   ndn::nfd::Controller m_controller;
   ndn::nfd::Controller m_faceDatasetController;
 
diff --git a/src/update/manager-base.cpp b/src/update/command-processor.cpp
similarity index 81%
rename from src/update/manager-base.cpp
rename to src/update/command-processor.cpp
index e066bfc..d13d9b6 100644
--- a/src/update/manager-base.cpp
+++ b/src/update/command-processor.cpp
@@ -19,34 +19,29 @@
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "manager-base.hpp"
+#include "command-processor.hpp"
 #include "logger.hpp"
 
-namespace nlsr {
-namespace update {
+#include <ndn-cxx/mgmt/nfd/control-response.hpp>
 
-INIT_LOGGER(update.PrefixCommandProcessor);
+namespace nlsr::update {
 
-ManagerBase::ManagerBase(ndn::mgmt::Dispatcher& dispatcher,
-                         const std::string& module)
+INIT_LOGGER(update.CommandProcessor);
+
+CommandProcessor::CommandProcessor(ndn::mgmt::Dispatcher& dispatcher,
+                                   NamePrefixList& namePrefixList,
+                                   Lsdb& lsdb)
   : m_dispatcher(dispatcher)
-  , m_module(module)
-{
-}
-
-CommandManagerBase::CommandManagerBase(ndn::mgmt::Dispatcher& dispatcher,
-                                      NamePrefixList& namePrefixList,
-                                      Lsdb& lsdb,
-                                      const std::string& module)
-  : ManagerBase(dispatcher, module)
   , m_namePrefixList(namePrefixList)
   , m_lsdb(lsdb)
 {
 }
 
+CommandProcessor::~CommandProcessor() = default;
+
 void
-CommandManagerBase::advertiseAndInsertPrefix(const ndn::mgmt::ControlParametersBase& parameters,
-                                             const ndn::mgmt::CommandContinuation& done)
+CommandProcessor::advertiseAndInsertPrefix(const ndn::mgmt::ControlParametersBase& parameters,
+                                           const ndn::mgmt::CommandContinuation& done)
 {
   const auto& castParams = static_cast<const ndn::nfd::ControlParameters&>(parameters);
 
@@ -84,8 +79,8 @@
 }
 
 void
-CommandManagerBase::withdrawAndRemovePrefix(const ndn::mgmt::ControlParametersBase& parameters,
-                                            const ndn::mgmt::CommandContinuation& done)
+CommandProcessor::withdrawAndRemovePrefix(const ndn::mgmt::ControlParametersBase& parameters,
+                                          const ndn::mgmt::CommandContinuation& done)
 {
   const auto& castParams = static_cast<const ndn::nfd::ControlParameters&>(parameters);
 
@@ -121,5 +116,4 @@
   }
 }
 
-} // namespace update
-} // namespace nlsr
+} // namespace nlsr::update
diff --git a/src/update/manager-base.hpp b/src/update/command-processor.hpp
similarity index 76%
rename from src/update/manager-base.hpp
rename to src/update/command-processor.hpp
index 7616ef6..d0245fd 100644
--- a/src/update/manager-base.hpp
+++ b/src/update/command-processor.hpp
@@ -19,31 +19,23 @@
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NLSR_MANAGER_BASE_HPP
-#define NLSR_MANAGER_BASE_HPP
+#ifndef NLSR_UPDATE_COMMAND_PROCESSOR_HPP
+#define NLSR_UPDATE_COMMAND_PROCESSOR_HPP
 
 #include "lsdb.hpp"
 #include "name-prefix-list.hpp"
 
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/interest.hpp>
 #include <ndn-cxx/mgmt/dispatcher.hpp>
-#include <ndn-cxx/mgmt/nfd/control-command.hpp>
 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
-#include <ndn-cxx/mgmt/nfd/control-response.hpp>
 
 #include <boost/noncopyable.hpp>
 #include <optional>
 
-namespace nlsr {
-
-class Lsdb;
-
-namespace update {
+namespace nlsr::update {
 
 enum { PREFIX_FLAG = 1 };
 
-class ManagerBase : boost::noncopyable
+class CommandProcessor : boost::noncopyable
 {
 public:
   class Error : public std::runtime_error
@@ -52,26 +44,12 @@
     using std::runtime_error::runtime_error;
   };
 
-protected:
-  ManagerBase(ndn::mgmt::Dispatcher& m_dispatcher, const std::string& module);
-
-protected:
-  ndn::mgmt::Dispatcher& m_dispatcher;
-
-private:
-  std::string m_module;
-};
-
-class CommandManagerBase : public ManagerBase
-{
-public:
-  CommandManagerBase(ndn::mgmt::Dispatcher& m_dispatcher,
-                     NamePrefixList& m_namePrefixList,
-                     Lsdb& lsdb,
-                     const std::string& module);
+  CommandProcessor(ndn::mgmt::Dispatcher& m_dispatcher,
+                   NamePrefixList& m_namePrefixList,
+                   Lsdb& lsdb);
 
   virtual
-  ~CommandManagerBase() = default;
+  ~CommandProcessor() = 0;
 
   /*! \brief Add desired name prefix to the advertised name prefix list
    *         or insert a prefix into the FIB if parameters is valid.
@@ -106,11 +84,11 @@
   }
 
 protected:
+  ndn::mgmt::Dispatcher& m_dispatcher;
   NamePrefixList& m_namePrefixList;
   Lsdb& m_lsdb;
 };
 
-} // namespace update
-} // namespace nlsr
+} // namespace nlsr::update
 
-#endif // NLSR_MANAGER_BASE_HPP
+#endif // NLSR_UPDATE_COMMAND_PROCESSOR_HPP
diff --git a/src/update/nfd-rib-command-processor.cpp b/src/update/nfd-rib-command-processor.cpp
index 6892415..21f9a7b 100644
--- a/src/update/nfd-rib-command-processor.cpp
+++ b/src/update/nfd-rib-command-processor.cpp
@@ -21,19 +21,23 @@
 
 #include "nfd-rib-command-processor.hpp"
 
+#include <ndn-cxx/mgmt/nfd/control-command.hpp>
+
 namespace nlsr::update {
 
 NfdRibCommandProcessor::NfdRibCommandProcessor(ndn::mgmt::Dispatcher& dispatcher,
                                                NamePrefixList& namePrefixList,
                                                Lsdb& lsdb)
-  : CommandManagerBase(dispatcher, namePrefixList, lsdb, "rib")
+  : CommandProcessor(dispatcher, namePrefixList, lsdb)
 {
   m_dispatcher.addControlCommand<ndn::nfd::RibRegisterCommand>(
     ndn::mgmt::makeAcceptAllAuthorization(),
+    // the first and second arguments are ignored since the handler does not need them
     std::bind(&NfdRibCommandProcessor::advertiseAndInsertPrefix, this, _3, _4));
 
   m_dispatcher.addControlCommand<ndn::nfd::RibUnregisterCommand>(
     ndn::mgmt::makeAcceptAllAuthorization(),
+    // the first and second arguments are ignored since the handler does not need them
     std::bind(&NfdRibCommandProcessor::withdrawAndRemovePrefix, this, _3, _4));
 }
 
diff --git a/src/update/nfd-rib-command-processor.hpp b/src/update/nfd-rib-command-processor.hpp
index 351e375..4188504 100644
--- a/src/update/nfd-rib-command-processor.hpp
+++ b/src/update/nfd-rib-command-processor.hpp
@@ -22,11 +22,11 @@
 #ifndef NLSR_UPDATE_NFD_RIB_COMMAND_PROCESSOR_HPP
 #define NLSR_UPDATE_NFD_RIB_COMMAND_PROCESSOR_HPP
 
-#include "manager-base.hpp"
+#include "command-processor.hpp"
 
 namespace nlsr::update {
 
-class NfdRibCommandProcessor : public CommandManagerBase
+class NfdRibCommandProcessor : public CommandProcessor
 {
 public:
   NfdRibCommandProcessor(ndn::mgmt::Dispatcher& dispatcher,
diff --git a/src/update/prefix-update-processor.cpp b/src/update/prefix-update-processor.cpp
index 83bfcc4..f07f0d0 100644
--- a/src/update/prefix-update-processor.cpp
+++ b/src/update/prefix-update-processor.cpp
@@ -21,11 +21,8 @@
 
 #include "prefix-update-processor.hpp"
 #include "logger.hpp"
-#include "lsdb.hpp"
 #include "prefix-update-commands.hpp"
 
-#include <ndn-cxx/face.hpp>
-
 #include <boost/algorithm/string.hpp>
 #include <fstream>
 
@@ -55,16 +52,18 @@
                                              ndn::security::ValidatorConfig& validator,
                                              NamePrefixList& namePrefixList,
                                              Lsdb& lsdb, const std::string& configFileName)
-  : CommandManagerBase(dispatcher, namePrefixList, lsdb, "prefix-update")
+  : CommandProcessor(dispatcher, namePrefixList, lsdb)
   , m_validator(validator)
   , m_confFileNameDynamic(configFileName)
 {
   m_dispatcher.addControlCommand<AdvertisePrefixCommand>(
     makeAuthorization(),
+    // the first and second arguments are ignored since the handler does not need them
     std::bind(&PrefixUpdateProcessor::advertiseAndInsertPrefix, this, _3, _4));
 
   m_dispatcher.addControlCommand<WithdrawPrefixCommand>(
     makeAuthorization(),
+    // the first and second arguments are ignored since the handler does not need them
     std::bind(&PrefixUpdateProcessor::withdrawAndRemovePrefix, this, _3, _4));
 }
 
diff --git a/src/update/prefix-update-processor.hpp b/src/update/prefix-update-processor.hpp
index 9230f0b..bc59937 100644
--- a/src/update/prefix-update-processor.hpp
+++ b/src/update/prefix-update-processor.hpp
@@ -22,7 +22,7 @@
 #ifndef NLSR_UPDATE_PREFIX_UPDATE_PROCESSOR_HPP
 #define NLSR_UPDATE_PREFIX_UPDATE_PROCESSOR_HPP
 
-#include "manager-base.hpp"
+#include "command-processor.hpp"
 
 #include <ndn-cxx/security/key-chain.hpp>
 
@@ -32,7 +32,7 @@
 
 using ConfigSection = boost::property_tree::ptree;
 
-class PrefixUpdateProcessor : public CommandManagerBase
+class PrefixUpdateProcessor : public CommandProcessor
 {
 public:
   PrefixUpdateProcessor(ndn::mgmt::Dispatcher& dispatcher,