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));
66 auto sigInfo = interest.getSignatureInfo();
69 sigInfo.emplace(interest.getName().at(ndn::signed_interest::POS_SIG_INFO).blockFromValue());
71 return sigInfo->getKeyLocator().getName().toUri();
73 catch (
const tlv::Error&) {
78 ndn::mgmt::Authorization
79 ManagerBase::makeAuthorization(
const std::string& verb)
81 BOOST_ASSERT(m_authenticator !=
nullptr);
86 ManagerBase::validateParameters(
const ControlCommand& command,
87 const ndn::mgmt::ControlParameters& parameters)
89 BOOST_ASSERT(
dynamic_cast<const ControlParameters*
>(¶meters) !=
nullptr);
92 command.validateRequest(
static_cast<const ControlParameters&
>(parameters));
94 catch (
const ControlCommand::ArgumentError&) {
101 ManagerBase::handleCommand(shared_ptr<ControlCommand> command,
102 const ControlCommandHandler& handler,
103 const Name& prefix,
const Interest& interest,
104 const ndn::mgmt::ControlParameters& params,
105 const ndn::mgmt::CommandContinuation& done)
107 BOOST_ASSERT(
dynamic_cast<const ControlParameters*
>(¶ms) !=
nullptr);
109 ControlParameters parameters =
static_cast<const ControlParameters&
>(params);
110 command->applyDefaultsToRequest(parameters);
111 handler(*command, prefix, interest, parameters, done);
Provides ControlCommand authorization according to NFD's configuration file.
ndn::mgmt::Authorization makeAuthorization(const std::string &module, const std::string &verb)
Returns an Authorization function for module/verb command.
ndn::mgmt::PostNotification registerNotificationStream(const std::string &verb)
void registerStatusDatasetHandler(const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler)
static std::string extractSigner(const Interest &interest)
Extracts the name from the KeyLocator of a ControlCommand request.
ManagerBase(std::string_view module, Dispatcher &dispatcher)