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 |
using | UpdateSuccessCallback = std::function< void()> |
using | UpdateFailureCallback = std::function< void(uint32_t code, const std::string &error)> |
Public Member Functions | |
Rib () | |
void | setFibUpdater (FibUpdater *updater) |
const_iterator | find (const Name &prefix) const |
Route * | find (const Name &prefix, const Route &route) const |
Route * | findLongestPrefix (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 |
using nfd::rib::Rib::UpdateSuccessCallback = std::function<void()> |
using nfd::rib::Rib::UpdateFailureCallback = std::function<void(uint32_t code, const std::string& error)> |
void nfd::rib::Rib::setFibUpdater | ( | FibUpdater * | updater | ) |
Definition at line 55 of file rib.cpp.
Referenced by nfd::rib::FibUpdater::FibUpdater().
Rib::const_iterator nfd::rib::Rib::find | ( | const Name & | prefix | ) | const |
Definition at line 61 of file rib.cpp.
Referenced by findLongestPrefix().
Definition at line 84 of file rib.cpp.
References find(), and findParent().
|
inline |
|
inline |
Definition at line 214 of file rib.cpp.
References ndn::Name::getPrefix(), and ndn::Name::size().
Referenced by findLongestPrefix(), and insert().
finds namespaces under the passed prefix
Definition at line 227 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 248 of file rib.cpp.
References ndn::Name::isPrefixOf().
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 350 of file rib.cpp.
Referenced by onRouteExpiration().
void nfd::rib::Rib::beginRemoveFace | ( | uint64_t | faceId | ) |
starts the FIB update process when a face has been destroyed
Definition at line 362 of file rib.cpp.
References nfd::rib::RibUpdate::REMOVE_FACE, nfd::rib::RibUpdate::setAction(), nfd::rib::RibUpdate::setName(), and nfd::rib::RibUpdate::setRoute().
void nfd::rib::Rib::onFibUpdateSuccess | ( | const RibUpdateBatch & | batch, |
const RibUpdateList & | inheritedRoutes, | ||
const Rib::UpdateSuccessCallback & | onSuccess | ||
) |
Definition at line 429 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.
void nfd::rib::Rib::onFibUpdateFailure | ( | const Rib::UpdateFailureCallback & | onFailure, |
uint32_t | code, | ||
const std::string & | error | ||
) |
Definition at line 201 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.
Definition at line 98 of file rib.cpp.
References afterAddRoute, afterInsertEntry, nfd::rib::Route::faceId, findDescendants(), findParent(), and NFD_LOG_TRACE.
Referenced by onFibUpdateSuccess().
|
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 234 of file rib.hpp.
Referenced by insert(), and nfd::rib::NfdRibReadvertiseDestination::NfdRibReadvertiseDestination().
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 242 of file rib.hpp.
Referenced by nfd::rib::NfdRibReadvertiseDestination::NfdRibReadvertiseDestination().
ndn::util::signal::Signal<Rib, RibRouteRef> nfd::rib::Rib::afterAddRoute |
signals after a Route is added
Definition at line 246 of file rib.hpp.
Referenced by insert(), and nfd::rib::Readvertise::Readvertise().
ndn::util::signal::Signal<Rib, RibRouteRef> nfd::rib::Rib::beforeRemoveRoute |
signals before a route is removed
Definition at line 250 of file rib.hpp.
Referenced by nfd::rib::Readvertise::Readvertise().