NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
nfd::rib::Rib Class Reference

represents the Routing Information Base More...

#include <rib.hpp>

Inheritance diagram for nfd::rib::Rib:
Collaboration diagram for nfd::rib::Rib:

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, RouteComparePredicateRouteSet
 
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
 
Routefind (const Name &prefix, const Route &route) const
 
const_iterator begin () const
 
const_iterator end () const
 
size_t size () const
 
bool empty () const
 
shared_ptr< RibEntryfindParent (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, NameafterInsertEntry
 signals after a RIB entry is inserted More...
 
ndn::util::signal::Signal< Rib, NameafterEraseEntry
 signals after a RIB entry is erased More...
 
ndn::util::signal::Signal< Rib, RibRouteRefafterAddRoute
 signals after a Route is added More...
 
ndn::util::signal::Signal< Rib, RibRouteRefbeforeRemoveRoute
 signals before a route is removed More...
 

Friends

class FibUpdater
 

Detailed Description

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.

Definition at line 56 of file rib.hpp.

Member Typedef Documentation

◆ RibEntryList

typedef std::list<shared_ptr<RibEntry> > nfd::rib::Rib::RibEntryList

Definition at line 59 of file rib.hpp.

◆ RibTable

typedef std::map<Name, shared_ptr<RibEntry> > nfd::rib::Rib::RibTable

Definition at line 60 of file rib.hpp.

◆ const_iterator

typedef RibTable::const_iterator nfd::rib::Rib::const_iterator

Definition at line 61 of file rib.hpp.

◆ FaceLookupTable

typedef std::map<uint64_t, std::list<shared_ptr<RibEntry> > > nfd::rib::Rib::FaceLookupTable

Definition at line 62 of file rib.hpp.

◆ RouteComparePredicate

typedef bool(* nfd::rib::Rib::RouteComparePredicate) (const Route &, const Route &)

Definition at line 63 of file rib.hpp.

◆ RouteSet

Definition at line 64 of file rib.hpp.

◆ UpdateSuccessCallback

typedef function<void()> nfd::rib::Rib::UpdateSuccessCallback

Definition at line 112 of file rib.hpp.

◆ UpdateFailureCallback

typedef function<void(uint32_t code, const std::string& error)> nfd::rib::Rib::UpdateFailureCallback

Definition at line 113 of file rib.hpp.

Constructor & Destructor Documentation

◆ Rib()

nfd::rib::Rib::Rib ( )

Definition at line 42 of file rib.cpp.

◆ ~Rib()

nfd::rib::Rib::~Rib ( )

Definition at line 48 of file rib.cpp.

Member Function Documentation

◆ setFibUpdater()

void nfd::rib::Rib::setFibUpdater ( FibUpdater updater)

Definition at line 53 of file rib.cpp.

Referenced by nfd::rib::FibUpdater::FibUpdater().

◆ find() [1/2]

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().

◆ find() [2/2]

Route * nfd::rib::Rib::find ( const Name prefix,
const Route route 
) const

Definition at line 65 of file rib.cpp.

◆ begin()

Rib::const_iterator nfd::rib::Rib::begin ( ) const
inline

Definition at line 266 of file rib.hpp.

◆ end()

Rib::const_iterator nfd::rib::Rib::end ( ) const
inline

Definition at line 272 of file rib.hpp.

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates().

◆ size()

size_t nfd::rib::Rib::size ( ) const
inline

Definition at line 278 of file rib.hpp.

◆ empty()

bool nfd::rib::Rib::empty ( ) const
inline

Definition at line 284 of file rib.hpp.

References nfd::rib::operator<<().

◆ findParent()

shared_ptr< RibEntry > nfd::rib::Rib::findParent ( const Name prefix) const

◆ findDescendants()

std::list< shared_ptr< RibEntry > > nfd::rib::Rib::findDescendants ( const Name prefix) const

finds namespaces under the passed prefix

Returns
{ a list of entries which are under the passed prefix }

Definition at line 220 of file rib.cpp.

References ndn::Name::isPrefixOf().

Referenced by insert().

◆ findDescendantsForNonInsertedName()

std::list< shared_ptr< RibEntry > > nfd::rib::Rib::findDescendantsForNonInsertedName ( const Name prefix) const

finds namespaces under the passed prefix

Note
Unlike findDescendants, needs to find where prefix would fit in tree before collecting list of descendant prefixes
Returns
{ a list of entries which would be under the passed prefix if the prefix existed in the RIB }

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().

◆ beginApplyUpdate()

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().

◆ beginRemoveFace()

◆ onFibUpdateSuccess()

void nfd::rib::Rib::onFibUpdateSuccess ( const RibUpdateBatch batch,
const RibUpdateList inheritedRoutes,
const Rib::UpdateSuccessCallback onSuccess 
)

◆ onFibUpdateFailure()

void nfd::rib::Rib::onFibUpdateFailure ( const Rib::UpdateFailureCallback onFailure,
uint32_t  code,
const std::string &  error 
)

◆ onRouteExpiration()

void nfd::rib::Rib::onRouteExpiration ( const Name prefix,
const Route route 
)

◆ insert()

Friends And Related Function Documentation

◆ FibUpdater

friend class FibUpdater
friend

Definition at line 247 of file rib.hpp.

Member Data Documentation

◆ afterInsertEntry

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().

◆ afterEraseEntry

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().

◆ afterAddRoute

ndn::util::signal::Signal<Rib, RibRouteRef> nfd::rib::Rib::afterAddRoute

signals after a Route is added

Definition at line 234 of file rib.hpp.

Referenced by insert().

◆ beforeRemoveRoute

ndn::util::signal::Signal<Rib, RibRouteRef> nfd::rib::Rib::beforeRemoveRoute

signals before a route is removed

Definition at line 238 of file rib.hpp.

Referenced by insert().


The documentation for this class was generated from the following files: