provides automatic prefix propagation feature More...
#include <auto-prefix-propagator.hpp>
Classes | |
class | Error |
Public Member Functions | |
AutoPrefixPropagator (ndn::nfd::Controller &controller, ndn::KeyChain &keyChain, Rib &rib) | |
void | loadConfig (const ConfigSection &configSection) |
load the "auto_prefix_propagate" section from config file More... | |
void | enable () |
enable automatic prefix propagation More... | |
void | disable () |
disable automatic prefix propagation More... | |
provides automatic prefix propagation feature
The AutoPrefixPropagator monitors changes to local RIB, and registers prefixes onto a connected gateway router (HUB), so that Interests under propagated prefixes will be forwarded toward the local host by the HUB.
The route origin of propagated prefix is CLIENT, as shown on the HUB.
Connectivity to a HUB is indicated with a special RIB entry "ndn:/localhop/nfd". Currently, the AutoPrefixPropagator can process the connection to at most one HUB.
For every RIB entry except "ndn:/localhop/nfd" and those starting with "ndn:/localhost", the AutoPrefixPropagator queries the local KeyChain for signing identities that is authorized to sign a prefix registration command of a prefix of the RIB prefix.
If one or more signing identities are found, the identity that can sign a prefix registration command of the shortest prefix is chosen, and the AutoPrefixPropagator will attempt to propagte a prefix to the HUB using the shortest prefix. It's noteworthy that no route flags will be inherited from the local registration. If no signing identity is available, no prefix of the RIB entry is propagated to the HUB.
When a RIB entry is erased, the corresponding propagated entry would be revoked, unless another local RIB entry is causing the propagation of that prefix.
After a successful propagation, the AutoPrefixPropagator will refresh the propagation periodically by resending the registration command.
In case of a failure or timeout in a registration command, the command will be retried with an exponential back-off strategy.
The AutoPrefixPropagator can be configured in NFD configuration file, at the rib.auto_prefix_propagate section.
Definition at line 77 of file auto-prefix-propagator.hpp.
nfd::rib::AutoPrefixPropagator::AutoPrefixPropagator | ( | ndn::nfd::Controller & | controller, |
ndn::KeyChain & | keyChain, | ||
Rib & | rib | ||
) |
Definition at line 50 of file auto-prefix-propagator.cpp.
Referenced by nfd::rib::AutoPrefixPropagator::Error::Error().
void nfd::rib::AutoPrefixPropagator::loadConfig | ( | const ConfigSection & | configSection | ) |
load the "auto_prefix_propagate" section from config file
configSection | the sub section in "rib" section. |
Definition at line 64 of file auto-prefix-propagator.cpp.
References nfd::rib::LINK_LOCAL_NFD_PREFIX, NFD_LOG_INFO, nfd::rib::PREFIX_PROPAGATION_DEFAULT_BASE_RETRY_WAIT, nfd::rib::PREFIX_PROPAGATION_DEFAULT_MAX_RETRY_WAIT, nfd::rib::PREFIX_PROPAGATION_DEFAULT_REFRESH_INTERVAL, ndn::nfd::ROUTE_ORIGIN_CLIENT, ndn::nfd::ControlParameters::setCost(), ndn::nfd::ControlParameters::setFaceId(), ndn::nfd::ControlParameters::setOrigin(), ndn::nfd::CommandOptions::setPrefix(), and ndn::nfd::CommandOptions::setTimeout().
Referenced by nfd::rib::AutoPrefixPropagator::Error::Error(), and nfd::rib::RibManager::setConfigFile().
void nfd::rib::AutoPrefixPropagator::enable | ( | ) |
enable automatic prefix propagation
Definition at line 106 of file auto-prefix-propagator.cpp.
References nfd::rib::Rib::afterEraseEntry, and nfd::rib::Rib::afterInsertEntry.
Referenced by nfd::rib::AutoPrefixPropagator::Error::Error(), and nfd::rib::RibManager::setConfigFile().
void nfd::rib::AutoPrefixPropagator::disable | ( | ) |
disable automatic prefix propagation
Definition at line 115 of file auto-prefix-propagator.cpp.
References ndn::util::signal::ScopedConnection::disconnect(), ndn::Name::empty(), ndn::security::KeyChain::getAllIdentities(), ndn::nfd::ControlParameters::getCost(), ndn::security::KeyChain::getDefaultIdentity(), ndn::nfd::ControlParameters::getName(), ndn::security::SigningInfo::getSignerName(), ndn::nfd::CommandOptions::getSigningInfo(), nfd::rib::IGNORE_COMMPONENT, ndn::Name::isPrefixOf(), nfd::rib::LINK_LOCAL_NFD_PREFIX, nfd::rib::LOCAL_REGISTRATION_PREFIX, NFD_LOG_DEBUG, NFD_LOG_INFO, NFD_LOG_TRACE, nfd::scheduler::schedule(), ndn::nfd::ControlParameters::setCost(), ndn::nfd::ControlParameters::setName(), ndn::nfd::CommandOptions::setSigningInfo(), ndn::security::signingByIdentity(), ndn::Name::size(), ndn::nfd::Controller::start(), and ndn::nfd::ControlParameters::unsetCost().
Referenced by nfd::rib::AutoPrefixPropagator::Error::Error(), and nfd::rib::RibManager::setConfigFile().