represents a dispatcher on server side of NFD Management protocol More...
#include <dispatcher.hpp>


Public Member Functions | |
| Dispatcher (Face &face, KeyChain &keyChain, const security::SigningInfo &signingInfo=security::SigningInfo(), size_t imsCapacity=256) | |
| constructor More... | |
| virtual | ~Dispatcher () |
| void | addTopPrefix (const Name &prefix, bool wantRegister=true, const security::SigningInfo &signingInfo=security::SigningInfo()) |
| add a top-level prefix More... | |
| void | removeTopPrefix (const Name &prefix) |
| remove a top-level prefix More... | |
| template<typename CP > | |
| void | addControlCommand (const PartialName &relPrefix, Authorization authorize, ValidateParameters validate, ControlCommandHandler handle) |
| register a ControlCommand More... | |
| void | addStatusDataset (const PartialName &relPrefix, Authorization authorize, StatusDatasetHandler handle) |
| register a StatusDataset or a prefix under which StatusDatasets can be requested More... | |
| PostNotification | addNotificationStream (const PartialName &relPrefix) |
| register a NotificationStream More... | |
represents a dispatcher on server side of NFD Management protocol
Definition at line 130 of file dispatcher.hpp.
| ndn::mgmt::Dispatcher::Dispatcher | ( | Face & | face, |
| KeyChain & | keyChain, | ||
| const security::SigningInfo & | signingInfo = security::SigningInfo(), |
||
| size_t | imsCapacity = 256 |
||
| ) |
constructor
| face | the Face on which the dispatcher operates |
| keyChain | a KeyChain to sign Data |
| signingInfo | signing parameters to sign Data with keyChain |
| imsCapacity | capacity of the internal InMemoryStorage used by dispatcher |
Definition at line 43 of file dispatcher.cpp.
References ~Dispatcher().
|
virtualdefault |
Referenced by Dispatcher().
| void ndn::mgmt::Dispatcher::addTopPrefix | ( | const Name & | prefix, |
| bool | wantRegister = true, |
||
| const security::SigningInfo & | signingInfo = security::SigningInfo() |
||
| ) |
add a top-level prefix
| prefix | a top-level prefix, e.g., "/localhost/nfd" |
| wantRegister | whether prefix registration should be performed through the Face |
| signingInfo | signing parameters to sign the prefix registration command |
| std::out_of_range | prefix overlaps with an existing top-level prefix |
Procedure for adding a top-level prefix:
wantRegister is true, invoke Face::registerPrefix for the top-level prefix; the returned RegisteredPrefixHandle shall be recorded internally, indexed by the top-level prefix.relPrefix from ControlCommands and StatusDatasets, join the top-level prefix with relPrefix to obtain the full prefix, and invoke non-registering overload of Face::setInterestFilter, with the InterestHandler set to an appropriate private method to handle incoming Interests for the ControlCommand or StatusDataset; the returned InterestFilterHandle shall be recorded internally, indexed by the top-level prefix. Definition at line 56 of file dispatcher.cpp.
References ndn::Name::isPrefixOf(), nonstd::optional_lite::std11::move(), ns3::ndn::Name, NDN_THROW, ndn::Face::registerPrefix(), and ndn::Face::setInterestFilter().
Referenced by nfd::RibManager::enableLocalFields().
| void ndn::mgmt::Dispatcher::removeTopPrefix | ( | const Name & | prefix | ) |
remove a top-level prefix
| prefix | a top-level prefix, e.g., "/localhost/nfd" |
Procedure for removing a top-level prefix:
wantRegister, unregister the prefix.Definition at line 89 of file dispatcher.cpp.
References websocketpp::extensions::permessage_deflate::mode::accept, websocketpp::http::status_code::accepted, ndn::tlv::ContentType_Nack, ndn::Name::get(), ndn::Data::getName(), ndn::Interest::getName(), ndn::Name::isPrefixOf(), NDN_LOG_ERROR, ndn::lp::NO_CACHE, ndn::Face::put(), websocketpp::error::rejected, ndn::lp::CachePolicy::setPolicy(), ndn::MetaInfo::setType(), ndn::Name::size(), ndn::mgmt::STATUS403, and ndn::mgmt::ControlResponse::wireEncode().
| void ndn::mgmt::Dispatcher::addControlCommand | ( | const PartialName & | relPrefix, |
| Authorization | authorize, | ||
| ValidateParameters | validate, | ||
| ControlCommandHandler | handle | ||
| ) |
register a ControlCommand
| CP | subclass of ControlParameters used by this command |
| relPrefix | a prefix for this command, e.g., "faces/create"; relPrefixes in ControlCommands, StatusDatasets, NotificationStreams must be non-overlapping (no relPrefix is a prefix of another relPrefix) |
| authorize | Callback to authorize the incoming commands |
| validate | Callback to validate parameters of the incoming commands |
| handle | Callback to handle the commands |
| std::out_of_range | relPrefix overlaps with an existing relPrefix |
| std::domain_error | one or more top-level prefix has been added |
Procedure for processing a ControlCommand:
Definition at line 451 of file dispatcher.hpp.
References websocketpp::http::status_code::accepted, nonstd::optional_lite::std11::move(), NDN_THROW, and websocketpp::error::rejected.
| void ndn::mgmt::Dispatcher::addStatusDataset | ( | const PartialName & | relPrefix, |
| Authorization | authorize, | ||
| StatusDatasetHandler | handle | ||
| ) |
register a StatusDataset or a prefix under which StatusDatasets can be requested
| relPrefix | a prefix for this dataset, e.g., "faces/list"; relPrefixes in ControlCommands, StatusDatasets, NotificationStreams must be non-overlapping (no relPrefix is a prefix of another relPrefix) |
| authorize | should set identity to Name() if the dataset is public |
| handle | Callback to process the incoming dataset requests |
| std::out_of_range | relPrefix overlaps with an existing relPrefix |
| std::domain_error | one or more top-level prefix has been added |
The payload of the returned status dataset data packet is at most half of the maximum data packet size.
Procedure for processing a StatusDataset request:
As an optimization, a Data packet may be sent as soon as enough octets have been collected through StatusDatasetAppend calls.
Definition at line 223 of file dispatcher.cpp.
References websocketpp::extensions::permessage_deflate::mode::accept, websocketpp::http::status_code::accepted, ndn::Interest::getName(), nonstd::optional_lite::std11::move(), NDN_THROW, websocketpp::error::rejected, ndn::MetaInfo::setFinalBlock(), and ndn::Name::size().
Referenced by nfd::ForwarderStatusManager::ForwarderStatusManager(), and nfd::ManagerBase::registerStatusDatasetHandler().
| PostNotification ndn::mgmt::Dispatcher::addNotificationStream | ( | const PartialName & | relPrefix | ) |
register a NotificationStream
| relPrefix | a prefix for this notification stream, e.g., "faces/events"; relPrefixes in ControlCommands, StatusDatasets, NotificationStreams must be non-overlapping (no relPrefix is a prefix of another relPrefix) |
| std::out_of_range | relPrefix overlaps with an existing relPrefix |
| std::domain_error | one or more top-level prefix has been added |
Procedure for posting a notification:
Definition at line 303 of file dispatcher.cpp.
References ndn::Name::append(), ndn::Name::appendSequenceNumber(), NDN_LOG_WARN, and NDN_THROW.
Referenced by nfd::ManagerBase::registerNotificationStream().