|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
22 #ifndef NDN_MGMT_DISPATCHER_HPP
23 #define NDN_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);
207 template<
typename CP>
274 typedef std::function<void(
const Name& prefix,
275 const Interest& interest)> InterestHandler;
277 typedef std::function<void(
const std::string& requester,
280 const shared_ptr<ControlParameters>&)> AuthorizationAcceptedCallback;
283 const Interest& interest)> AuthorizationRejectedCallback;
291 typedef std::function<shared_ptr<ControlParameters>(
const name::Component& comp)> ControlParametersParser;
294 isOverlappedWithOthers(
const PartialName& relPrefix)
const;
314 queryStorage(
const Name& prefix,
const Interest& interest,
const InterestHandler& missContinuation);
316 enum class SendDestination {
341 SendDestination destination, time::milliseconds imsFresh);
349 sendOnFace(
const Data& data);
363 processControlCommandInterest(
const Name& prefix,
364 const Name& relPrefix,
366 const ControlParametersParser& parser,
368 const AuthorizationAcceptedCallback& accepted,
369 const AuthorizationRejectedCallback& rejected);
382 processAuthorizedControlCommandInterest(
const std::string& requester,
385 const shared_ptr<ControlParameters>& parameters,
402 processStatusDatasetInterest(
const Name& prefix,
405 const AuthorizationAcceptedCallback& accepted,
406 const AuthorizationRejectedCallback& rejected);
417 processAuthorizedStatusDatasetInterest(
const std::string& requester,
431 sendStatusDatasetSegment(
const Name& dataName,
const Block& content,
432 time::milliseconds imsFresh,
bool isFinalBlock);
438 struct TopPrefixEntry
441 std::vector<ScopedInterestFilterHandle> interestFilters;
443 std::unordered_map<Name, TopPrefixEntry> m_topLevelPrefixes;
449 std::unordered_map<PartialName, InterestHandler> m_handlers;
452 std::unordered_map<Name, uint64_t> m_streams;
458 template<
typename CP>
465 if (!m_topLevelPrefixes.empty()) {
466 NDN_THROW(std::domain_error(
"one or more top-level prefix has been added"));
469 if (isOverlappedWithOthers(relPrefix)) {
470 NDN_THROW(std::out_of_range(
"relPrefix overlaps with another relPrefix"));
473 auto parser = [] (
const name::Component& comp) -> shared_ptr<ControlParameters> {
474 return make_shared<CP>(comp.blockFromValue());
477 AuthorizationAcceptedCallback accepted =
478 bind(&Dispatcher::processAuthorizedControlCommandInterest,
this,
481 AuthorizationRejectedCallback rejected =
482 bind(&Dispatcher::afterAuthorizationRejected,
this, _1, _2);
484 m_handlers[relPrefix] = bind(&Dispatcher::processControlCommandInterest,
this,
492 #endif // NDN_MGMT_DISPATCHER_HPP
std::function< void(const std::string &requester)> AcceptContinuation
a function to be called if authorization is successful
std::function< bool(const ControlParameters ¶ms)> ValidateParameters
a function to validate input ControlParameters
RejectReply
indicate how to reply in case authorization is rejected
std::function< void(const ControlResponse &resp)> CommandContinuation
a function to be called after ControlCommandHandler completes
Signing parameters passed to KeyChain.
std::function< void(const Name &prefix, const Interest &interest, StatusDatasetContext &context)> StatusDatasetHandler
a function to handle a StatusDataset request
std::function< void(const Block ¬ification)> PostNotification
a function to post a notification
Provide a communication channel with local or remote NDN forwarder.
base class for a struct that contains ControlCommand parameters
void addStatusDataset(const PartialName &relPrefix, Authorization authorize, StatusDatasetHandler handle)
register a StatusDataset or a prefix under which StatusDatasets can be requested
Represents an absolute name.
The interface of signing key management.
provides a context for generating response to a StatusDataset request
Authorization makeAcceptAllAuthorization()
return an Authorization that accepts all Interests, with empty string as requester
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
std::function< void(const Name &prefix, const Interest &interest, const ControlParameters *params, const AcceptContinuation &accept, const RejectContinuation &reject)> Authorization
a function that performs authorization
void addTopPrefix(const Name &prefix, bool wantRegister=true, const security::SigningInfo &signingInfo=security::SigningInfo())
add a top-level prefix
void addControlCommand(const PartialName &relPrefix, Authorization authorize, ValidateParameters validate, ControlCommandHandler handle)
register a ControlCommand
Represents an Interest packet.
Represents a Data packet.
Provides in-memory storage employing First-In-First-Out (FIFO) replacement policy.
std::function< void(const Name &prefix, const Interest &interest, const ControlParameters ¶ms, const CommandContinuation &done)> ControlCommandHandler
a function to handle an authorized ControlCommand
@ STATUS403
reply with a ControlResponse where StatusCode is 403
Represents a name component.
Represents a TLV element of NDN packet format.
Dispatcher(Face &face, KeyChain &keyChain, const security::SigningInfo &signingInfo=security::SigningInfo(), size_t imsCapacity=256)
constructor
represents a dispatcher on server side of NFD Management protocol
PostNotification addNotificationStream(const PartialName &relPrefix)
register a NotificationStream
std::function< void(RejectReply reply)> RejectContinuation
a function to be called if authorization is rejected
void removeTopPrefix(const Name &prefix)
remove a top-level prefix
Copyright (c) 2011-2015 Regents of the University of California.