30 using ndn::mgmt::ValidateParameters;
31 using ndn::mgmt::Authorization;
34 : m_dispatcher(dispatcher)
43 const ndn::mgmt::StatusDatasetHandler& handler)
45 m_dispatcher.addStatusDataset(makeRelPrefix(verb),
46 ndn::mgmt::makeAcceptAllAuthorization(),
50 ndn::mgmt::PostNotification
53 return m_dispatcher.addNotificationStream(makeRelPrefix(verb));
58 ndn::mgmt::AcceptContinuation accept)
60 const Name& interestName = interest.getName();
63 ndn::SignatureInfo sigInfo(interestName.at(ndn::signed_interest::POS_SIG_INFO).blockFromValue());
64 if (!sigInfo.hasKeyLocator() ||
65 sigInfo.getKeyLocator().getType() != ndn::KeyLocator::KeyLocator_Name) {
69 accept(sigInfo.getKeyLocator().getName().toUri());
71 catch (
const tlv::Error&) {
77 ManagerBase::validateParameters(
const nfd::ControlCommand& command,
const ndn::mgmt::ControlParameters& parameters)
79 BOOST_ASSERT(dynamic_cast<const ControlParameters*>(¶meters) !=
nullptr);
82 command.validateRequest(static_cast<const ControlParameters&>(parameters));
84 catch (
const ControlCommand::ArgumentError&) {
91 ManagerBase::handleCommand(shared_ptr<nfd::ControlCommand> command,
93 const Name& prefix,
const Interest& interest,
94 const ndn::mgmt::ControlParameters& params,
95 ndn::mgmt::CommandContinuation done)
97 BOOST_ASSERT(dynamic_cast<const ControlParameters*>(¶ms) !=
nullptr);
98 ControlParameters parameters =
static_cast<const ControlParameters&
>(params);
99 command->applyDefaultsToRequest(parameters);
100 handler(*command, prefix, interest, parameters, done);
void registerStatusDatasetHandler(const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
ManagerBase(Dispatcher &dispatcher, const std::string &module)
function< void(const ControlCommand &command, const Name &prefix, const Interest &interest, const ControlParameters ¶meters, const ndn::mgmt::CommandContinuation done)> ControlCommandHandler
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)
extract a requester from a ControlCommand request