Implements the RIB Management of NFD Management Protocol. More...
#include <daemon/mgmt/rib-manager.hpp>
Inheritance diagram for nfd::RibManager:
Collaboration diagram for nfd::RibManager:Public Types | |
| using | SlAnnounceCallback = std::function< void(SlAnnounceResult res)> |
| enum class | SlAnnounceResult { OK , ERROR , VALIDATION_FAILURE , EXPIRED , NOT_FOUND } |
| using | SlFindAnnCallback = std::function< void(std::optional< ndn::PrefixAnnouncement >)> |
Public Member Functions | |
| RibManager (rib::Rib &rib, ndn::Face &face, ndn::KeyChain &keyChain, ndn::nfd::Controller &nfdController, Dispatcher &dispatcher) | |
| void | applyLocalhostConfig (const ConfigSection §ion, const std::string &filename) |
| Apply localhost_security configuration. More... | |
| void | applyPaConfig (const ConfigSection §ion, const std::string &filename) |
| Apply prefix_announcement_validation configuration. More... | |
| void | disableLocalhop () |
| Disallow accepting commands on /localhop/nfd/rib prefix. More... | |
| void | enableLocalFields () |
| Enable NDNLP IncomingFaceId field in order to support self-registration commands. More... | |
| void | enableLocalhop (const ConfigSection §ion, const std::string &filename) |
| Apply localhop_security configuration and allow accepting commands on /localhop/nfd/rib prefix. More... | |
| const std::string & | getModule () const |
| void | registerWithNfd () |
| Start accepting commands and dataset requests. More... | |
| void | slAnnounce (const ndn::PrefixAnnouncement &pa, uint64_t faceId, time::milliseconds maxLifetime, const SlAnnounceCallback &cb) |
| Insert a route by prefix announcement from self-learning strategy. More... | |
| void | slFindAnn (const Name &name, const SlFindAnnCallback &cb) const |
| Retrieve an outgoing prefix announcement for self-learning strategy. More... | |
| void | slRenew (const Name &name, uint64_t faceId, time::milliseconds maxLifetime, const SlAnnounceCallback &cb) |
| Renew a route created by prefix announcement from self-learning strategy. More... | |
Static Public Attributes | |
| static const Name | LOCALHOP_TOP_PREFIX {"/localhop/nfd"} |
Protected Types | |
| using | ControlCommandHandler = std::function< void(const ControlCommand &command, const Name &prefix, const Interest &interest, const ControlParameters ¶meters, const ndn::mgmt::CommandContinuation done)> |
Protected Member Functions | |
| template<typename Command > | |
| void | registerCommandHandler (const std::string &verb, const ControlCommandHandler &handler) |
| ndn::mgmt::PostNotification | registerNotificationStream (const std::string &verb) |
| void | registerStatusDatasetHandler (const std::string &verb, const ndn::mgmt::StatusDatasetHandler &handler) |
Static Protected Member Functions | |
| static std::string | extractSigner (const Interest &interest) |
| Extracts the name from the KeyLocator of a ControlCommand request. More... | |
Implements the RIB Management of NFD Management Protocol.
Definition at line 50 of file rib-manager.hpp.
|
protectedinherited |
Definition at line 80 of file manager-base.hpp.
| using nfd::RibManager::SlAnnounceCallback = std::function<void(SlAnnounceResult res)> |
Definition at line 102 of file rib-manager.hpp.
| using nfd::RibManager::SlFindAnnCallback = std::function<void(std::optional<ndn::PrefixAnnouncement>)> |
Definition at line 103 of file rib-manager.hpp.
|
strong |
Definition at line 94 of file rib-manager.hpp.
| nfd::RibManager::RibManager | ( | rib::Rib & | rib, |
| ndn::Face & | face, | ||
| ndn::KeyChain & | keyChain, | ||
| ndn::nfd::Controller & | nfdController, | ||
| Dispatcher & | dispatcher | ||
| ) |
Definition at line 51 of file rib-manager.cpp.
| void nfd::RibManager::applyLocalhostConfig | ( | const ConfigSection & | section, |
| const std::string & | filename | ||
| ) |
Apply localhost_security configuration.
Definition at line 73 of file rib-manager.cpp.
| void nfd::RibManager::applyPaConfig | ( | const ConfigSection & | section, |
| const std::string & | filename | ||
| ) |
Apply prefix_announcement_validation configuration.
Definition at line 92 of file rib-manager.cpp.
| void nfd::RibManager::disableLocalhop | ( | ) |
Disallow accepting commands on /localhop/nfd/rib prefix.
Definition at line 86 of file rib-manager.cpp.
| void nfd::RibManager::enableLocalFields | ( | ) |
Enable NDNLP IncomingFaceId field in order to support self-registration commands.
Definition at line 114 of file rib-manager.cpp.
| void nfd::RibManager::enableLocalhop | ( | const ConfigSection & | section, |
| const std::string & | filename | ||
| ) |
Apply localhop_security configuration and allow accepting commands on /localhop/nfd/rib prefix.
Definition at line 79 of file rib-manager.cpp.
|
staticprotectedinherited |
Extracts the name from the KeyLocator of a ControlCommand request.
This is called after the signature has been validated. Returns an empty string if SignatureInfo or KeyLocator are missing or malformed.
Definition at line 62 of file manager-base.cpp.
|
inlineinherited |
Definition at line 59 of file manager-base.hpp.
|
protectedinherited |
Definition at line 154 of file manager-base.hpp.
|
protectedinherited |
Definition at line 56 of file manager-base.cpp.
|
protectedinherited |
Definition at line 47 of file manager-base.cpp.
| void nfd::RibManager::registerWithNfd | ( | ) |
Start accepting commands and dataset requests.
Definition at line 98 of file rib-manager.cpp.
| void nfd::RibManager::slAnnounce | ( | const ndn::PrefixAnnouncement & | pa, |
| uint64_t | faceId, | ||
| time::milliseconds | maxLifetime, | ||
| const SlAnnounceCallback & | cb | ||
| ) |
Insert a route by prefix announcement from self-learning strategy.
| pa | A prefix announcement. It must contain the Data. |
| faceId | Face on which the announcement arrives. |
| maxLifetime | Maximum route lifetime as imposed by self-learning strategy. |
| cb | Callback to receive the operation result. |
If pa passes validation and is unexpired, inserts or replaces a route for the announced name and faceId whose lifetime is set to the earlier of now+maxLifetime or prefix announcement expiration time, updates FIB, and invokes cb with SlAnnounceResult::OK. In case pa expires when validation completes, invokes cb with SlAnnounceResult::EXPIRED. If pa cannot be verified by the trust schema given in rib.localhop_security config key, or the relevant config has not been loaded via enableLocalHop, invokes cb with SlAnnounceResult::VALIDATION_FAILURE.
Self-learning strategy invokes this method after receiving a Data carrying a prefix announcement.
Definition at line 354 of file rib-manager.cpp.
| void nfd::RibManager::slFindAnn | ( | const Name & | name, |
| const SlFindAnnCallback & | cb | ||
| ) | const |
Retrieve an outgoing prefix announcement for self-learning strategy.
| name | Data name. |
| cb | Callback to receive a prefix announcement that announces a prefix of name, or nullopt if no RIB entry is found by longest-prefix-match of name. |
Self-learning strategy invokes this method before sending a Data in reply to a discovery Interest, so as to attach a prefix announcement onto that Data.
Definition at line 404 of file rib-manager.cpp.
| void nfd::RibManager::slRenew | ( | const Name & | name, |
| uint64_t | faceId, | ||
| time::milliseconds | maxLifetime, | ||
| const SlAnnounceCallback & | cb | ||
| ) |
Renew a route created by prefix announcement from self-learning strategy.
| name | Data name, for finding RIB entry by longest-prefix-match. |
| faceId | Nexthop face. |
| maxLifetime | Maximum route lifetime as imposed by self-learning strategy. |
| cb | Callback to receive the operation result. |
If the specified route exists, prolongs its lifetime to the earlier of now+maxLifetime or prefix announcement expiration time, and invokes cb with SlAnnounceResult::OK. If the prefix announcement has expired, invokes cb with SlAnnounceResult::EXPIRED. If the route is not found, invokes cb with SlAnnounceResult::NOT_FOUND.
Self-learning strategy invokes this method after an Interest forwarded via a learned route is satisfied.
Definition at line 379 of file rib-manager.cpp.
|
inlinestatic |
Definition at line 241 of file rib-manager.hpp.