represents the Routing Information Base More...
#include <rib.hpp>
Public Types | |
typedef std::list< shared_ptr< RibEntry > > | RibEntryList |
typedef std::map< Name, shared_ptr< RibEntry > > | RibTable |
typedef RibTable::const_iterator | const_iterator |
typedef std::map< uint64_t, std::list< shared_ptr< RibEntry > > > | FaceLookupTable |
typedef bool(* | RouteComparePredicate) (const Route &, const Route &) |
typedef std::set< Route, RouteComparePredicate > | RouteSet |
typedef function< void()> | UpdateSuccessCallback |
typedef function< void(uint32_t code, const std::string &error)> | UpdateFailureCallback |
Public Member Functions | |
Rib () | |
~Rib () | |
void | setFibUpdater (FibUpdater *updater) |
const_iterator | find (const Name &prefix) const |
Route * | find (const Name &prefix, const Route &route) const |
const_iterator | begin () const |
const_iterator | end () const |
size_t | size () const |
bool | empty () const |
shared_ptr< RibEntry > | findParent (const Name &prefix) const |
std::list< shared_ptr< RibEntry > > | findDescendants (const Name &prefix) const |
finds namespaces under the passed prefix More... | |
std::list< shared_ptr< RibEntry > > | findDescendantsForNonInsertedName (const Name &prefix) const |
finds namespaces under the passed prefix More... | |
void | beginApplyUpdate (const RibUpdate &update, const UpdateSuccessCallback &onSuccess, const UpdateFailureCallback &onFailure) |
passes the provided RibUpdateBatch to FibUpdater to calculate and send FibUpdates. More... | |
void | beginRemoveFace (uint64_t faceId) |
starts the FIB update process when a face has been destroyed More... | |
void | onFibUpdateSuccess (const RibUpdateBatch &batch, const RibUpdateList &inheritedRoutes, const Rib::UpdateSuccessCallback &onSuccess) |
void | onFibUpdateFailure (const Rib::UpdateFailureCallback &onFailure, uint32_t code, const std::string &error) |
void | onRouteExpiration (const Name &prefix, const Route &route) |
void | insert (const Name &prefix, const Route &route) |
Public Attributes | |
ndn::util::signal::Signal< Rib, Name > | afterInsertEntry |
signals after a RIB entry is inserted More... | |
ndn::util::signal::Signal< Rib, Name > | afterEraseEntry |
signals after a RIB entry is erased More... | |
ndn::util::signal::Signal< Rib, RibRouteRef > | afterAddRoute |
signals after a Route is added More... | |
ndn::util::signal::Signal< Rib, RibRouteRef > | beforeRemoveRoute |
signals before a route is removed More... | |
Friends | |
class | FibUpdater |
represents the Routing Information Base
The Routing Information Base contains a collection of Routes, each represents a piece of static or dynamic routing information registered by applications, operators, or NFD itself. Routes associated with the same namespace are collected into a RIB entry.
typedef std::list<shared_ptr<RibEntry> > nfd::rib::Rib::RibEntryList |
typedef std::map<Name, shared_ptr<RibEntry> > nfd::rib::Rib::RibTable |
typedef RibTable::const_iterator nfd::rib::Rib::const_iterator |
typedef std::map<uint64_t, std::list<shared_ptr<RibEntry> > > nfd::rib::Rib::FaceLookupTable |
typedef std::set<Route, RouteComparePredicate> nfd::rib::Rib::RouteSet |
typedef function<void()> nfd::rib::Rib::UpdateSuccessCallback |
typedef function<void(uint32_t code, const std::string& error)> nfd::rib::Rib::UpdateFailureCallback |
void nfd::rib::Rib::setFibUpdater | ( | FibUpdater * | updater | ) |
Definition at line 53 of file rib.cpp.
Referenced by nfd::rib::FibUpdater::FibUpdater().
Rib::const_iterator nfd::rib::Rib::find | ( | const Name & | prefix | ) | const |
Definition at line 59 of file rib.cpp.
Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates().
|
inline |
|
inline |
Definition at line 272 of file rib.hpp.
Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates().
|
inline |
Definition at line 284 of file rib.hpp.
References nfd::rib::operator<<().
Definition at line 206 of file rib.cpp.
References ndn::Name::getPrefix(), and ndn::Name::size().
Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), findDescendantsForNonInsertedName(), and insert().
finds namespaces under the passed prefix
Definition at line 220 of file rib.cpp.
References ndn::Name::isPrefixOf().
Referenced by insert().
std::list< shared_ptr< RibEntry > > nfd::rib::Rib::findDescendantsForNonInsertedName | ( | const Name & | prefix | ) | const |
finds namespaces under the passed prefix
Definition at line 242 of file rib.cpp.
References afterEraseEntry, findParent(), nfd::rib::RibEntry::getParent(), nfd::rib::Route::isChildInherit(), ndn::Name::isPrefixOf(), and nfd::rib::sortRoutes().
Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates().
void nfd::rib::Rib::beginApplyUpdate | ( | const RibUpdate & | update, |
const UpdateSuccessCallback & | onSuccess, | ||
const UpdateFailureCallback & | onFailure | ||
) |
passes the provided RibUpdateBatch to FibUpdater to calculate and send FibUpdates.
If the FIB is updated successfully, onFibUpdateSuccess() will be called, and the RIB will be updated
If the FIB update fails, onFibUpdateFailure() will be called, and the RIB will not be updated.
Definition at line 344 of file rib.cpp.
Referenced by nfd::rib::RibManager::onRibUpdateFailure(), and onRouteExpiration().
void nfd::rib::Rib::beginRemoveFace | ( | uint64_t | faceId | ) |
starts the FIB update process when a face has been destroyed
Definition at line 356 of file rib.cpp.
References nfd::rib::RibUpdateBatch::add(), nfd::rib::FibUpdater::computeAndSendFibUpdates(), nfd::rib::Route::faceId, nfd::rib::RibUpdate::getRoute(), onFibUpdateFailure(), onFibUpdateSuccess(), nfd::rib::RibUpdate::REMOVE_FACE, nfd::rib::RibUpdate::setAction(), nfd::rib::RibUpdate::setName(), nfd::rib::RibUpdate::setRoute(), and nfd::rib::RibUpdateBatch::size().
Referenced by nfd::rib::RibManager::onRibUpdateFailure().
void nfd::rib::Rib::onFibUpdateSuccess | ( | const RibUpdateBatch & | batch, |
const RibUpdateList & | inheritedRoutes, | ||
const Rib::UpdateSuccessCallback & | onSuccess | ||
) |
Definition at line 414 of file rib.cpp.
References nfd::rib::RibUpdate::getAction(), nfd::rib::RibUpdate::getName(), nfd::rib::RibUpdate::getRoute(), insert(), nfd::rib::RibUpdate::REGISTER, nfd::rib::RibUpdate::REMOVE_FACE, and nfd::rib::RibUpdate::UNREGISTER.
Referenced by beginRemoveFace().
void nfd::rib::Rib::onFibUpdateFailure | ( | const Rib::UpdateFailureCallback & | onFailure, |
uint32_t | code, | ||
const std::string & | error | ||
) |
Definition at line 444 of file rib.cpp.
References nfd::rib::Route::faceId, nfd::rib::RibUpdate::getAction(), nfd::rib::RibUpdate::getName(), nfd::rib::RibUpdate::getRoute(), nfd::rib::RibUpdate::REGISTER, nfd::rib::RibUpdate::REMOVE_FACE, and nfd::rib::RibUpdate::UNREGISTER.
Referenced by beginRemoveFace().
Definition at line 193 of file rib.cpp.
References beginApplyUpdate(), NFD_LOG_DEBUG, nfd::rib::RibUpdate::setAction(), nfd::rib::RibUpdate::setName(), nfd::rib::RibUpdate::setRoute(), and nfd::rib::RibUpdate::UNREGISTER.
Referenced by nfd::rib::RibManager::onRibUpdateFailure().
Definition at line 84 of file rib.cpp.
References afterAddRoute, afterInsertEntry, beforeRemoveRoute, nfd::scheduler::cancel(), nfd::rib::Route::cost, nfd::rib::Route::expires, nfd::rib::Route::faceId, findDescendants(), findParent(), nfd::rib::Route::flags, nfd::rib::Route::getExpirationEvent(), and NFD_LOG_TRACE.
Referenced by onFibUpdateSuccess(), and nfd::rib::RibManager::onRibUpdateFailure().
|
friend |
ndn::util::signal::Signal<Rib, Name> nfd::rib::Rib::afterInsertEntry |
signals after a RIB entry is inserted
A RIB entry is inserted when the first route associated with a certain namespace is added.
Definition at line 222 of file rib.hpp.
Referenced by nfd::rib::AutoPrefixPropagator::enable(), and insert().
ndn::util::signal::Signal<Rib, Name> nfd::rib::Rib::afterEraseEntry |
signals after a RIB entry is erased
A RIB entry is erased when the last route associated with a certain namespace is removed.
Definition at line 230 of file rib.hpp.
Referenced by nfd::rib::AutoPrefixPropagator::enable(), and findDescendantsForNonInsertedName().
ndn::util::signal::Signal<Rib, RibRouteRef> nfd::rib::Rib::afterAddRoute |
ndn::util::signal::Signal<Rib, RibRouteRef> nfd::rib::Rib::beforeRemoveRoute |