22 #ifndef NLSR_MANAGER_BASE_HPP
23 #define NLSR_MANAGER_BASE_HPP
31 #include <ndn-cxx/face.hpp>
32 #include <ndn-cxx/interest.hpp>
33 #include <ndn-cxx/mgmt/nfd/control-command.hpp>
34 #include <ndn-cxx/mgmt/dispatcher.hpp>
35 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
36 #include <ndn-cxx/mgmt/nfd/control-response.hpp>
38 #include <boost/noncopyable.hpp>
53 class Error :
public std::runtime_error
56 using std::runtime_error::runtime_error;
74 const auto* castParams =
dynamic_cast<const ndn::nfd::ControlParameters*
>(¶meters);
75 BOOST_ASSERT(castParams !=
nullptr);
79 command.validateRequest(*castParams);
81 catch (
const ndn::nfd::ControlCommand::ArgumentError&) {
84 catch (
const std::exception& e) {
85 std::cerr << e.what() << std::endl;
104 const std::string& module);
114 const ndn::Interest& interest,
115 const ndn::mgmt::ControlParameters& parameters,
116 const ndn::mgmt::CommandContinuation& done);
123 const ndn::Interest& interest,
124 const ndn::mgmt::ControlParameters& parameters,
125 const ndn::mgmt::CommandContinuation& done);
130 virtual std::optional<bool>
139 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...
virtual ~CommandManagerBase()=default
NamePrefixList & m_namePrefixList
void withdrawAndRemovePrefix(const ndn::Name &prefix, const ndn::Interest &interest, const ndn::mgmt::ControlParameters ¶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 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)
void advertiseAndInsertPrefix(const ndn::Name &prefix, const ndn::Interest &interest, const ndn::mgmt::ControlParameters ¶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...
bool validateParameters(const ndn::mgmt::ControlParameters ¶meters)
validate the parameters for a given command
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
Copyright (c) 2014-2020, The University of Memphis, Regents of the University of California.
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California,...
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California,...
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED