25 #include <ndn-cxx/mgmt/nfd/control-response.hpp> 26 #include <ndn-cxx/tag.hpp> 27 #include <ndn-cxx/face.hpp> 40 static ndn::optional<std::string>
43 shared_ptr<SignerTag> signerTag = interest.getTag<
SignerTag>();
44 if (signerTag ==
nullptr) {
48 return signerTag->get().toUri();
58 , m_validator(
ndn::make_unique<
ndn::security::v2::CertificateFetcherDirectFetch>(face))
65 std::bind(&PrefixUpdateProcessor::validateParameters<AdvertisePrefixCommand>,
71 std::bind(&PrefixUpdateProcessor::validateParameters<WithdrawPrefixCommand>,
76 ndn::mgmt::Authorization
77 PrefixUpdateProcessor::makeAuthorization()
79 return [=] (
const ndn::Name& prefix,
const ndn::Interest& interest,
80 const ndn::mgmt::ControlParameters* params,
81 const ndn::mgmt::AcceptContinuation& accept,
82 const ndn::mgmt::RejectContinuation& reject) {
83 m_validator.validate(interest,
84 [accept] (
const ndn::Interest& request) {
87 std::string signer = signer1.value_or(
"*");
88 NLSR_LOG_DEBUG(
"accept " << request.getName() <<
" signer=" << signer);
91 [reject] (
const ndn::Interest& request,
const ndn::security::v2::ValidationError& error) {
94 reject(ndn::mgmt::RejectReply::STATUS403);
101 const std::string& filename)
103 m_validator.load(section, filename);
ndn::SimpleTag< ndn::Name, 20 > SignerTag
an Interest tag to indicate command signer
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
void loadValidator(ConfigSection section, const std::string &filename)
Load the validator's configuration from a section of a configuration file.
#define NLSR_LOG_DEBUG(x)
void advertiseAndInsertPrefix(const ndn::Name &prefix, const ndn::Interest &interest, const ndn::mgmt::ControlParameters ¶meters, const ndn::mgmt::CommandContinuation &done)
add desired name prefix to the advertised name prefix list or insert a prefix into the FIB if paramet...
static const ndn::Name LOCALHOST_PREFIX
#define INIT_LOGGER(name)
PrefixUpdateProcessor(ndn::mgmt::Dispatcher &dispatcher, ndn::Face &face, NamePrefixList &namePrefixList, Lsdb &lsdb)
Copyright (c) 2014-2017, The University of Memphis, Regents of the University of California, Arizona Board of Regents.
void withdrawAndRemovePrefix(const ndn::Name &prefix, const ndn::Interest &interest, const ndn::mgmt::ControlParameters ¶meters, const ndn::mgmt::CommandContinuation &done)
remove desired name prefix from the advertised name prefix list or remove a prefix from the FIB if pa...
static ndn::optional< std::string > getSignerFromTag(const ndn::Interest &interest)
obtain signer from SignerTag attached to Interest, if available
ndn::PartialName makeRelPrefix(const std::string &verb) const
generate the relative prefix for a handler by appending the verb name to the module name ...
ndn::mgmt::Dispatcher & m_dispatcher