|
ndn-cxx: NDN C++ Library 0.9.0-33-g832ea91d
|
Implements a request dispatcher on server side of NFD Management protocol. More...
#include <ndn-cxx/mgmt/dispatcher.hpp>
Inheritance diagram for ndn::mgmt::Dispatcher:
Collaboration diagram for ndn::mgmt::Dispatcher:Public Member Functions | |
| Dispatcher (Face &face, KeyChain &keyChain, const security::SigningInfo &signingInfo=security::SigningInfo(), size_t imsCapacity=256) | |
| Constructor. | |
| template<typename Command > | |
| void | addControlCommand (Authorization authorize, ControlCommandHandler handle) |
| Register a ControlCommand (new style). | |
| template<typename ParametersType , std::enable_if_t< std::is_convertible_v< ParametersType *, ControlParametersBase * >, int > = 0> | |
| void | addControlCommand (const PartialName &relPrefix, Authorization authorize, ValidateParameters validate, ControlCommandHandler handle) |
| Register a ControlCommand (old style). | |
| PostNotification | addNotificationStream (const PartialName &relPrefix) |
| Register a NotificationStream. | |
| void | addStatusDataset (const PartialName &relPrefix, Authorization authorize, StatusDatasetHandler handle) |
| Register a StatusDataset or a prefix under which StatusDatasets can be requested. | |
| 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. | |
Implements a request dispatcher on server side of NFD Management protocol.
Definition at line 140 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 44 of file dispatcher.cpp.
|
inline |
Register a ControlCommand (new style).
| Command | The type of ControlCommand to register. |
| authorize | Callback to authorize 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 prefixes have been added. |
Procedure for processing a ControlCommand registered through this function:
Command::parseRequest on the incoming Interest; if parsing fails, abort these steps.Command::validateRequest.Command::applyDefaultsToRequest.Definition at line 268 of file dispatcher.hpp.
|
inline |
Register a ControlCommand (old style).
| ParametersType | Concrete subclass of ControlParameters used by this command. |
| relPrefix | The name prefix for this command relative to the top-level prefix, e.g., "faces/create". The prefixes across all ControlCommands, StatusDatasets, and NotificationStreams must not overlap (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 prefixes have been added. |
Procedure for processing a ControlCommand registered through this function:
Definition at line 220 of file dispatcher.hpp.
| PostNotification ndn::mgmt::Dispatcher::addNotificationStream | ( | const PartialName & | relPrefix | ) |
Register a NotificationStream.
| relPrefix | The name prefix for this notification stream relative to the top-level prefix, e.g., "faces/events". The prefixes across all ControlCommands, StatusDatasets, and NotificationStreams must not overlap (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 prefixes have been added. |
Procedure for posting a notification:
Definition at line 300 of file dispatcher.cpp.
| 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 | The name prefix for this dataset relative to the top-level prefix, e.g., "faces/list". The prefixes across all ControlCommands, StatusDatasets, and NotificationStreams must not overlap (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 prefixes have 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 StatusDatasetContext::append calls.
Definition at line 226 of file dispatcher.cpp.
| void ndn::mgmt::Dispatcher::addTopPrefix | ( | const Name & | prefix, |
| bool | wantRegister = true, |
||
| const security::SigningInfo & | signingInfo = security::SigningInfo() |
||
| ) |
Add a top-level prefix.
| prefix | top-level prefix to add, 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:
std::out_of_range.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 the non-registering overload of Face::setInterestFilter, with the InterestHandler set to an appropriate function 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 54 of file dispatcher.cpp.
| void ndn::mgmt::Dispatcher::removeTopPrefix | ( | const Name & | prefix | ) |
Remove a top-level prefix.
| prefix | top-level prefix to remove, e.g., "/localhost/nfd" |
Procedure for removing a top-level prefix:
wantRegister, unregister the prefix.Definition at line 86 of file dispatcher.cpp.