22 #ifndef NDN_CXX_MGMT_DISPATCHER_HPP 
   23 #define NDN_CXX_MGMT_DISPATCHER_HPP 
   33 #include <unordered_map> 
   74 typedef std::function<void(
const Name& prefix, 
const Interest& interest,
 
  104 typedef std::function<void(
const Name& prefix, 
const Interest& interest,
 
  117 typedef std::function<void(
const Name& prefix, 
const Interest& interest,
 
  141              size_t imsCapacity = 256);
 
  206   template<
typename CP>
 
  273   using InterestHandler = std::function<void(
const Name& prefix, 
const Interest&)>;
 
  275   using AuthorizationAcceptedCallback = std::function<void(
const std::string& requester,
 
  278                                                            const shared_ptr<ControlParameters>&)>;
 
  287   using ControlParametersParser = std::function<shared_ptr<ControlParameters>(
const name::Component&)>;
 
  290   isOverlappedWithOthers(
const PartialName& relPrefix) 
const;
 
  310   queryStorage(
const Name& prefix, 
const Interest& interest, 
const InterestHandler& missContinuation);
 
  312   enum class SendDestination {
 
  336            SendDestination destination);
 
  344   sendOnFace(
const Data& data);
 
  358   processControlCommandInterest(
const Name& prefix,
 
  359                                 const Name& relPrefix,
 
  361                                 const ControlParametersParser& parser,
 
  363                                 const AuthorizationAcceptedCallback& accepted,
 
  364                                 const AuthorizationRejectedCallback& rejected);
 
  377   processAuthorizedControlCommandInterest(
const std::string& requester,
 
  380                                           const shared_ptr<ControlParameters>& parameters,
 
  397   processStatusDatasetInterest(
const Name& prefix,
 
  400                                const AuthorizationAcceptedCallback& accepted,
 
  401                                const AuthorizationRejectedCallback& rejected);
 
  411   processAuthorizedStatusDatasetInterest(
const Name& prefix,
 
  423   sendStatusDatasetSegment(
const Name& dataName, 
const Block& content, 
bool isFinalBlock);
 
  429   struct TopPrefixEntry
 
  432     std::vector<ScopedInterestFilterHandle> interestFilters;
 
  434   std::unordered_map<Name, TopPrefixEntry> m_topLevelPrefixes;
 
  437   KeyChain& m_keyChain;
 
  440   std::unordered_map<PartialName, InterestHandler> m_handlers;
 
  443   std::unordered_map<Name, uint64_t> m_streams;
 
  449 template<
typename CP>
 
  456   if (!m_topLevelPrefixes.empty()) {
 
  457     NDN_THROW(std::domain_error(
"one or more top-level prefix has been added"));
 
  460   if (isOverlappedWithOthers(relPrefix)) {
 
  461     NDN_THROW(std::out_of_range(
"relPrefix overlaps with another relPrefix"));
 
  464   ControlParametersParser parser = [] (
const name::Component& comp) -> shared_ptr<ControlParameters> {
 
  465     return make_shared<CP>(comp.blockFromValue());
 
  467   AuthorizationAcceptedCallback accepted = [
this, validate = std::move(validate),
 
  468                                             handle = std::move(handle)] (
auto&&... args) {
 
  469     processAuthorizedControlCommandInterest(std::forward<decltype(args)>(args)..., validate, handle);
 
  471   AuthorizationRejectedCallback rejected = [
this] (
auto&&... args) {
 
  472     afterAuthorizationRejected(std::forward<decltype(args)>(args)...);
 
  475   m_handlers[relPrefix] = [
this, relPrefix,
 
  476                            parser = std::move(parser),
 
  477                            authorize = std::move(authorize),
 
  478                            accepted = std::move(accepted),
 
  479                            rejected = std::move(rejected)] (
const auto& prefix, 
const auto& interest) {
 
  480     processControlCommandInterest(prefix, relPrefix, interest, parser, authorize, accepted, rejected);
 
Represents a TLV element of the NDN packet format.
 
Represents a Data packet.
 
Provide a communication channel with local or remote NDN forwarder.
 
Provides in-memory storage employing First-In-First-Out (FIFO) replacement policy.
 
Represents an Interest packet.
 
Represents an absolute name.
 
base class for a struct that contains ControlCommand parameters
 
represents a dispatcher on server side of NFD Management protocol
 
PostNotification addNotificationStream(const PartialName &relPrefix)
register a NotificationStream
 
Dispatcher(Face &face, KeyChain &keyChain, const security::SigningInfo &signingInfo=security::SigningInfo(), size_t imsCapacity=256)
constructor
 
void addStatusDataset(const PartialName &relPrefix, Authorization authorize, StatusDatasetHandler handle)
register a StatusDataset or a prefix under which StatusDatasets can be requested
 
void addControlCommand(const PartialName &relPrefix, Authorization authorize, ValidateParameters validate, ControlCommandHandler handle)
register a ControlCommand
 
void addTopPrefix(const Name &prefix, bool wantRegister=true, const security::SigningInfo &signingInfo=security::SigningInfo())
add a top-level prefix
 
void removeTopPrefix(const Name &prefix)
remove a top-level prefix
 
Provides a context for generating the response to a StatusDataset request.
 
Represents a name component.
 
Signing parameters passed to KeyChain.
 
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
 
std::function< void(const ControlResponse &resp)> CommandContinuation
a function to be called after ControlCommandHandler completes
 
std::function< void(const Name &prefix, const Interest &interest, const ControlParameters *params, const AcceptContinuation &accept, const RejectContinuation &reject)> Authorization
a function that performs authorization
 
std::function< void(const Block ¬ification)> PostNotification
a function to post a notification
 
std::function< void(const Name &prefix, const Interest &interest, const ControlParameters ¶ms, const CommandContinuation &done)> ControlCommandHandler
a function to handle an authorized ControlCommand
 
std::function< bool(const ControlParameters ¶ms)> ValidateParameters
a function to validate input ControlParameters
 
RejectReply
indicate how to reply in case authorization is rejected
 
@ STATUS403
reply with a ControlResponse where StatusCode is 403
 
std::function< void(const std::string &requester)> AcceptContinuation
a function to be called if authorization is successful
 
std::function< void(RejectReply reply)> RejectContinuation
a function to be called if authorization is rejected
 
Authorization makeAcceptAllAuthorization()
return an Authorization that accepts all Interests, with empty string as requester
 
std::function< void(const Name &prefix, const Interest &interest, StatusDatasetContext &context)> StatusDatasetHandler
a function to handle a StatusDataset request