26 #ifndef NFD_CORE_MANAGER_BASE_HPP 27 #define NFD_CORE_MANAGER_BASE_HPP 31 #include <ndn-cxx/mgmt/dispatcher.hpp> 32 #include <ndn-cxx/mgmt/nfd/control-command.hpp> 33 #include <ndn-cxx/mgmt/nfd/control-response.hpp> 34 #include <ndn-cxx/mgmt/nfd/control-parameters.hpp> 51 class Error :
public std::runtime_error
56 :
std::runtime_error(what)
63 const std::string& module);
79 template<
typename Command>
82 const ControlCommandHandler& handler);
109 makeAuthorization(
const std::string& verb) = 0;
125 handleCommand(shared_ptr<nfd::ControlCommand> command,
126 const ControlCommandHandler& handler,
140 makeRelPrefix(
const std::string& verb);
144 std::string m_module;
148 ManagerBase::makeRelPrefix(
const std::string& verb)
153 template<
typename Command>
158 auto command = make_shared<Command>();
162 makeAuthorization(verb),
163 bind(&ManagerBase::validateParameters, cref(*command), _1),
164 bind(&ManagerBase::handleCommand, command, handler, _1, _2, _3, _4));
169 #endif // NFD_CORE_MANAGER_BASE_HPP #define PUBLIC_WITH_TESTS_ELSE_PRIVATE
a collection of common functions shared by all NFD managers and RIB manager, such as communicating wi...
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
void extractRequester(const Interest &interest, ndn::mgmt::AcceptContinuation accept)
extract a requester from a ControlCommand request
Error(const std::string &what)
base class of NFD ControlCommand
ManagerBase(Dispatcher &dispatcher, const std::string &module)
represents an Interest packet
std::function< void(const std::string &requester)> AcceptContinuation
a function to be called if authorization is successful
ndn mgmt Dispatcher
Copyright (c) 2013-2016 Regents of the University of California.
const std::string & getModule() const
ndn::mgmt::ControlResponse ControlResponse
Copyright (c) 2011-2015 Regents of the University of California.
Name abstraction to represent an absolute name.
std::function< void(const ControlResponse &resp)> CommandContinuation
a function to be called after ControlCommandHandler completes
base class for a struct that contains ControlCommand parameters
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)
Name PartialName
Partial name abstraction to represent an arbitrary sequence of name components.
ndn::mgmt::PostNotification registerNotificationStream(const std::string &verb)
std::function< void(const Name &prefix, const Interest &interest, const ControlParameters *params, const AcceptContinuation &accept, const RejectContinuation &reject)> Authorization
a function that performs authorization
void registerStatusDatasetHandler(const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
#define PUBLIC_WITH_TESTS_ELSE_PROTECTED
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