32 , m_dispatcher(dispatcher)
39 , m_dispatcher(dispatcher)
40 , m_authenticator(&authenticator)
48 const ndn::mgmt::StatusDatasetHandler& handler)
50 m_dispatcher.addStatusDataset(makeRelPrefix(verb),
51 ndn::mgmt::makeAcceptAllAuthorization(),
55 ndn::mgmt::PostNotification
58 return m_dispatcher.addNotificationStream(makeRelPrefix(verb));
64 const Name& interestName = interest.getName();
67 ndn::SignatureInfo sigInfo(interestName.at(ndn::signed_interest::POS_SIG_INFO).blockFromValue());
68 if (!sigInfo.hasKeyLocator() || sigInfo.getKeyLocator().getType() != tlv::Name) {
72 accept(sigInfo.getKeyLocator().getName().toUri());
74 catch (
const tlv::Error&) {
79 ndn::mgmt::Authorization
80 ManagerBase::makeAuthorization(
const std::string& verb)
82 BOOST_ASSERT(m_authenticator !=
nullptr);
87 ManagerBase::validateParameters(
const ControlCommand& command,
88 const ndn::mgmt::ControlParameters& parameters)
90 BOOST_ASSERT(dynamic_cast<const ControlParameters*>(¶meters) !=
nullptr);
93 command.validateRequest(static_cast<const ControlParameters&>(parameters));
95 catch (
const ControlCommand::ArgumentError&) {
102 ManagerBase::handleCommand(shared_ptr<ControlCommand> command,
104 const Name& prefix,
const Interest& interest,
105 const ndn::mgmt::ControlParameters& params,
106 ndn::mgmt::CommandContinuation done)
108 BOOST_ASSERT(dynamic_cast<const ControlParameters*>(¶ms) !=
nullptr);
110 ControlParameters parameters =
static_cast<const ControlParameters&
>(params);
111 command->applyDefaultsToRequest(parameters);
112 handler(*command, prefix, interest, parameters, done);
void registerStatusDatasetHandler(const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
std::function< void(const ControlCommand &command, const Name &prefix, const Interest &interest, const ControlParameters ¶meters, const ndn::mgmt::CommandContinuation done)> ControlCommandHandler
ManagerBase(const std::string &module, Dispatcher &dispatcher)
ndn::mgmt::Authorization makeAuthorization(const std::string &module, const std::string &verb)
Provides ControlCommand authorization according to NFD configuration file.
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
ndn::mgmt::PostNotification registerNotificationStream(const std::string &verb)
void extractRequester(const Interest &interest, ndn::mgmt::AcceptContinuation accept)
Extracts the requester from a ControlCommand request.