22 #ifndef NLSR_MANAGER_BASE_HPP 23 #define NLSR_MANAGER_BASE_HPP 32 #include <ndn-cxx/face.hpp> 33 #include <ndn-cxx/interest.hpp> 34 #include <ndn-cxx/mgmt/nfd/control-command.hpp> 35 #include <ndn-cxx/mgmt/dispatcher.hpp> 36 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp> 37 #include <ndn-cxx/mgmt/nfd/control-response.hpp> 39 #include <boost/noncopyable.hpp> 52 class Error :
public std::runtime_error
57 :
std::runtime_error(what)
64 const std::string& module);
79 const ndn::nfd::ControlParameters* castParams =
80 dynamic_cast<const ndn::nfd::ControlParameters*
>(¶meters);
82 BOOST_ASSERT(castParams !=
nullptr);
85 command.validateRequest(*castParams);
87 catch (
const ndn::nfd::ControlCommand::ArgumentError& ae) {
90 catch (
const std::exception& e) {
91 std::cerr << e.what() << std::endl;
101 std::string m_module;
110 const std::string& module);
118 advertiseAndInsertPrefix(
const ndn::Name& prefix,
119 const ndn::Interest& interest,
120 const ndn::mgmt::ControlParameters& parameters,
121 const ndn::mgmt::CommandContinuation& done);
127 withdrawAndRemovePrefix(
const ndn::Name& prefix,
128 const ndn::Interest& interest,
129 const ndn::mgmt::ControlParameters& parameters,
130 const ndn::mgmt::CommandContinuation& done);
135 virtual ndn::optional<bool>
141 virtual ndn::optional<bool>
152 #endif // NLSR_MANAGER_BASE_HPP
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
bool validateParameters(const ndn::mgmt::ControlParameters ¶meters)
validate the parameters for a given command
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California.
virtual ~CommandManagerBase()
Error(const std::string &what)
ManagerBase(ndn::mgmt::Dispatcher &m_dispatcher, const std::string &module)
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
Copyright (c) 2014-2018, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
virtual ndn::optional< bool > afterAdvertise(const ndn::Name &prefix)
save an advertised prefix to the nlsr configuration file returns bool from the overridden function wh...
virtual ndn::optional< bool > afterWithdraw(const ndn::Name &prefix)
save an advertised prefix to the nlsr configuration file returns bool from the overridden function wh...
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED
ndn::PartialName makeRelPrefix(const std::string &verb) const
generate the relative prefix for a handler by appending the verb name to the module name ...
NamePrefixList & m_namePrefixList
ndn::mgmt::Dispatcher & m_dispatcher