22 #ifndef NLSR_MANAGER_BASE_HPP
23 #define NLSR_MANAGER_BASE_HPP
29 #include <ndn-cxx/face.hpp>
30 #include <ndn-cxx/interest.hpp>
31 #include <ndn-cxx/mgmt/dispatcher.hpp>
32 #include <ndn-cxx/mgmt/nfd/control-command.hpp>
33 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
34 #include <ndn-cxx/mgmt/nfd/control-response.hpp>
36 #include <boost/noncopyable.hpp>
51 class Error :
public std::runtime_error
54 using std::runtime_error::runtime_error;
68 template<
typename Command>
73 Command::validateRequest(
dynamic_cast<const ndn::nfd::ControlParameters&
>(parameters));
75 catch (
const ndn::nfd::ArgumentError&) {
78 catch (
const std::exception& e) {
79 std::cerr << e.what() << std::endl;
98 const std::string& module);
108 const ndn::Interest& interest,
109 const ndn::mgmt::ControlParametersBase& parameters,
110 const ndn::mgmt::CommandContinuation& done);
117 const ndn::Interest& interest,
118 const ndn::mgmt::ControlParametersBase& parameters,
119 const ndn::mgmt::CommandContinuation& done);
124 virtual std::optional<bool>
133 virtual std::optional<bool>
virtual std::optional< bool > afterWithdraw(const ndn::Name &prefix)
save an advertised prefix to the nlsr configuration file returns bool from the overridden function wh...
void withdrawAndRemovePrefix(const ndn::Name &prefix, const ndn::Interest &interest, const ndn::mgmt::ControlParametersBase ¶meters, const ndn::mgmt::CommandContinuation &done)
remove desired name prefix from the advertised name prefix list or remove a prefix from the FIB if pa...
virtual ~CommandManagerBase()=default
void advertiseAndInsertPrefix(const ndn::Name &prefix, const ndn::Interest &interest, const ndn::mgmt::ControlParametersBase ¶meters, const ndn::mgmt::CommandContinuation &done)
add desired name prefix to the advertised name prefix list or insert a prefix into the FIB if paramet...
NamePrefixList & m_namePrefixList
virtual std::optional< bool > afterAdvertise(const ndn::Name &prefix)
save an advertised prefix to the nlsr configuration file returns bool from the overridden function wh...
CommandManagerBase(ndn::mgmt::Dispatcher &m_dispatcher, NamePrefixList &m_namePrefixList, Lsdb &lsdb, const std::string &module)
ManagerBase(ndn::mgmt::Dispatcher &m_dispatcher, const std::string &module)
ndn::PartialName makeRelPrefix(const std::string &verb) const
Generate the relative prefix for a handler by appending the verb name to the module name.
ndn::mgmt::Dispatcher & m_dispatcher
static bool validateParameters(const ndn::mgmt::ControlParametersBase ¶meters)
Validate the parameters for a given command.
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED