26 #ifndef NFD_DAEMON_MGMT_MANAGER_BASE_HPP 27 #define NFD_DAEMON_MGMT_MANAGER_BASE_HPP 32 #include <ndn-cxx/mgmt/dispatcher.hpp> 33 #include <ndn-cxx/management/nfd-control-command.hpp> 34 #include <ndn-cxx/management/nfd-control-response.hpp> 35 #include <ndn-cxx/management/nfd-control-parameters.hpp> 52 class Error :
public std::runtime_error
57 :
std::runtime_error(what)
65 const std::string& module);
75 template<
typename Command>
78 const ControlCommandHandler& handler);
117 extractRequester(
const Interest& interest,
135 handleCommand(shared_ptr<nfd::ControlCommand> command,
136 const ControlCommandHandler& handler,
150 makeRelPrefix(
const std::string& verb);
155 std::string m_mgmtModuleName;
159 ManagerBase::makeRelPrefix(
const std::string& verb)
164 template<
typename Command>
169 auto command = make_shared<Command>();
173 bind(&ManagerBase::authorize,
this, _1, _2, _3, _4, _5),
174 bind(&ManagerBase::validateParameters, cref(*command), _1),
175 bind(&ManagerBase::handleCommand, command, handler, _1, _2, _3, _4));
180 #endif // NFD_DAEMON_MGMT_MANAGER_BASE_HPP a collection of common functions shared by all NFD managers, such as communicating with the dispatche...
represents parameters in a ControlCommand request or response
std::function< void(const Block ¬ification)> PostNotification
a function to post a notification
represents a dispatcher on server side of NFD Management protocol
Error(const std::string &what)
base class of NFD ControlCommand
represents an Interest packet
std::function< void(RejectReply act)> RejectContinuation
a function to be called if authorization is rejected
std::function< void(const std::string &requester)> AcceptContinuation
a function to be called if authorization is successful
ndn::mgmt::ControlResponse ControlResponse
Copyright (c) 2011-2015 Regents of the University of California.
Name abstraction to represent an absolute name.
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED
std::function< void(const ControlResponse &resp)> CommandContinuation
a function to be called after ControlCommandHandler completes
base class for a struct that contains ControlCommand parameters
ManagerBase(Dispatcher &dispatcher, CommandValidator &validator, const std::string &module)
Name & append(const uint8_t *value, size_t valueLength)
Append a new component, copying from value of length valueLength.
void registerCommandHandler(const std::string &verb, const ControlCommandHandler &handler)
#define PUBLIC_WITH_TESTS_ELSE_PRIVATE
Name PartialName
Partial name abstraction to represent an arbitrary sequence of name components.
ndn::mgmt::PostNotification registerNotificationStream(const std::string &verb)
void registerStatusDatasetHandler(const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
function< void(const ControlCommand &command, const Name &prefix, const Interest &interest, const ControlParameters ¶meters, const ndn::mgmt::CommandContinuation done)> ControlCommandHandler
std::function< void(const Name &prefix, const Interest &interest, StatusDatasetContext &context)> StatusDatasetHandler
a function to handle a StatusDataset request