26 #ifndef NFD_DAEMON_MGMT_MANAGER_BASE_HPP 27 #define NFD_DAEMON_MGMT_MANAGER_BASE_HPP 50 class Error :
public std::runtime_error
53 using std::runtime_error::runtime_error;
81 template<
typename Command>
110 makeAuthorization(
const std::string& verb);
145 std::string m_module;
150 template<
typename Command>
155 auto command = make_shared<Command>();
159 makeAuthorization(verb),
161 [=] (
auto&&... args) {
handleCommand(command, handler, std::forward<decltype(args)>(args)...); });
166 #endif // NFD_DAEMON_MGMT_MANAGER_BASE_HPP NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name & prefix
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name const Interest & interest
A collection of common functions shared by all NFD managers, such as communicating with the dispatche...
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name const Interest const ControlParameters const ndn::mgmt::CommandContinuation done
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
base class of NFD ControlCommand
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.
ManagerBase(const std::string &module, Dispatcher &dispatcher)
static bool validateParameters(const ControlCommand &command, const ndn::mgmt::ControlParameters ¶meters)
Validates the parameters for a given command.
const std::string & getModule() const
mgmt::ControlResponse ControlResponse
Copyright (c) 2011-2015 Regents of the University of California.
#define NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Name PartialName
Represents an arbitrary sequence of name components.
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const ndn::mgmt::AcceptContinuation & accept
Represents an absolute name.
std::function< void(const ControlResponse &resp)> CommandContinuation
a function to be called after ControlCommandHandler completes
PartialName makeRelPrefix(const std::string &verb)
Generates the relative prefix for a handler by appending the verb name to the module name...
base class for a struct that contains ControlCommand parameters
Provides ControlCommand authorization according to NFD configuration file.
std::function< void(const Name &prefix, const Interest &interest, const ControlParameters ¶ms, const CommandContinuation &done)> ControlCommandHandler
a function to handle an authorized ControlCommand
#define NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED
void registerCommandHandler(const std::string &verb, const ControlCommandHandler &handler)
NFD_PUBLIC_WITH_TESTS_ELSE_PROTECTED const Name const Interest const ControlParameters & parameters
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)
static void handleCommand(shared_ptr< ControlCommand > command, const ControlCommandHandler &handler, const Name &prefix, const Interest &interest, const ndn::mgmt::ControlParameters ¶ms, const ndn::mgmt::CommandContinuation &done)
Handles a control command.
std::function< void(const Name &prefix, const Interest &interest, StatusDatasetContext &context)> StatusDatasetHandler
a function to handle a StatusDataset request