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)
80 template<
typename Command>
83 const ControlCommandHandler& handler);
110 makeAuthorization(
const std::string& verb) = 0;
126 handleCommand(shared_ptr<nfd::ControlCommand> command,
127 const ControlCommandHandler& handler,
141 makeRelPrefix(
const std::string& verb);
145 std::string m_module;
149 ManagerBase::makeRelPrefix(
const std::string& verb)
154 template<
typename Command>
159 auto command = make_shared<Command>();
163 makeAuthorization(verb),
164 bind(&ManagerBase::validateParameters, cref(*command), _1),
165 bind(&ManagerBase::handleCommand, command, handler, _1, _2, _3, _4));
170 #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
Accept any value the remote endpoint offers.
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
Name & append(const Component &component)
Append a component.
ndn mgmt Dispatcher
Copyright (c) 2013-2017 Regents of the University of California.
mgmt::ControlResponse ControlResponse
Copyright (c) 2011-2015 Regents of the University of California.
Name PartialName
Represents an arbitrary sequence of name components.
Represents 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
void registerCommandHandler(const std::string &verb, const ControlCommandHandler &handler)
ndn::mgmt::PostNotification registerNotificationStream(const std::string &verb)
const std::string & getModule() const
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