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

Represents a RIB entry, which contains one or more Routes with the same prefix. More...

#include <rib-entry.hpp>

Inheritance diagram for nfd::rib::RibEntry:
Collaboration diagram for nfd::rib::RibEntry:

Public Types

typedef std::list< RouteRouteList
 
typedef RouteList::iterator iterator
 
typedef RouteList::const_iterator const_iterator
 

Public Member Functions

 RibEntry ()
 
void setName (const Name &prefix)
 
const NamegetName () const
 
shared_ptr< RibEntrygetParent () const
 
bool hasParent () const
 
void addChild (shared_ptr< RibEntry > child)
 
void removeChild (shared_ptr< RibEntry > child)
 
const std::list< shared_ptr< RibEntry > > & getChildren () const
 
bool hasChildren () const
 
std::pair< RibEntry::iterator, bool > insertRoute (const Route &route)
 inserts a new route into the entry's route list If another route already exists with the same faceId and origin, the new route is not inserted. More...
 
void eraseRoute (const Route &route)
 erases a Route with the same faceId and origin More...
 
iterator eraseRoute (RouteList::iterator route)
 erases a Route with the passed iterator More...
 
bool hasFaceId (uint64_t faceId) const
 
const RouteListgetRoutes () const
 
size_t getNRoutes () const
 
iterator findRoute (const Route &route)
 
const_iterator findRoute (const Route &route) const
 
bool hasRoute (const Route &route)
 
void addInheritedRoute (const Route &route)
 
void removeInheritedRoute (const Route &route)
 
const RouteListgetInheritedRoutes () const
 Returns the routes this namespace has inherited. More...
 
RouteList::const_iterator findInheritedRoute (const Route &route) const
 Finds an inherited route with a matching face ID. More...
 
bool hasInheritedRoute (const Route &route) const
 Determines if the entry has an inherited route with a matching face ID. More...
 
bool hasCapture () const
 
bool hasChildInheritOnFaceId (uint64_t faceId) const
 Determines if the entry has an inherited route with the passed face ID and its child inherit flag set. More...
 
const RoutegetRouteWithLowestCostByFaceId (uint64_t faceId) const
 Returns the route with the lowest cost that has the passed face ID. More...
 
const RoutegetRouteWithSecondLowestCostByFaceId (uint64_t faceId) const
 
const RoutegetRouteWithLowestCostAndChildInheritByFaceId (uint64_t faceId) const
 Returns the route with the lowest cost that has the passed face ID and its child inherit flag set. More...
 
ndn::PrefixAnnouncement getPrefixAnnouncement (time::milliseconds minExpiration=15_s, time::milliseconds maxExpiration=1_h) const
 Retrieve a prefix announcement suitable for readvertising this route. More...
 
const_iterator begin () const
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 

Detailed Description

Represents a RIB entry, which contains one or more Routes with the same prefix.

Definition at line 38 of file rib-entry.hpp.

Member Typedef Documentation

◆ RouteList

Definition at line 41 of file rib-entry.hpp.

◆ iterator

typedef RouteList::iterator nfd::rib::RibEntry::iterator

Definition at line 42 of file rib-entry.hpp.

◆ const_iterator

typedef RouteList::const_iterator nfd::rib::RibEntry::const_iterator

Definition at line 43 of file rib-entry.hpp.

Constructor & Destructor Documentation

◆ RibEntry()

Member Function Documentation

◆ setName()

void nfd::rib::RibEntry::setName ( const Name prefix)
inline

Definition at line 217 of file rib-entry.hpp.

Referenced by RibEntry().

◆ getName()

const Name & nfd::rib::RibEntry::getName ( ) const
inline

◆ getParent()

shared_ptr< RibEntry > nfd::rib::RibEntry::getParent ( ) const
inline

Definition at line 235 of file rib-entry.hpp.

Referenced by nfd::rib::Rib::findParent(), and RibEntry().

◆ hasParent()

bool nfd::rib::RibEntry::hasParent ( ) const

Referenced by RibEntry().

◆ addChild()

void nfd::rib::RibEntry::addChild ( shared_ptr< RibEntry child)

Definition at line 101 of file rib-entry.cpp.

References nonstd::optional_lite::std11::move().

Referenced by RibEntry().

◆ removeChild()

void nfd::rib::RibEntry::removeChild ( shared_ptr< RibEntry child)

Definition at line 109 of file rib-entry.cpp.

Referenced by RibEntry().

◆ getChildren()

const std::list< shared_ptr< RibEntry > > & nfd::rib::RibEntry::getChildren ( ) const
inline

Definition at line 241 of file rib-entry.hpp.

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), and RibEntry().

◆ hasChildren()

bool nfd::rib::RibEntry::hasChildren ( ) const

Referenced by RibEntry().

◆ insertRoute()

std::pair< RibEntry::iterator, bool > nfd::rib::RibEntry::insertRoute ( const Route route)

inserts a new route into the entry's route list If another route already exists with the same faceId and origin, the new route is not inserted.

Returns
a pair, whose first element is the iterator to the newly inserted element if the insert succeeds and to the previously-existing element otherwise, and whose second element is true if the insert succeeds and false otherwise.

Definition at line 57 of file rib-entry.cpp.

References end(), findRoute(), nfd::rib::Route::flags, and ndn::nfd::ROUTE_FLAG_CAPTURE.

Referenced by RibEntry().

◆ eraseRoute() [1/2]

void nfd::rib::RibEntry::eraseRoute ( const Route route)

erases a Route with the same faceId and origin

Definition at line 74 of file rib-entry.cpp.

References findRoute().

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), and RibEntry().

◆ eraseRoute() [2/2]

RibEntry::RouteList::iterator nfd::rib::RibEntry::eraseRoute ( RouteList::iterator  route)

erases a Route with the passed iterator

Returns
{ an iterator to the element that followed the erased iterator }

Definition at line 117 of file rib-entry.cpp.

References NFD_LOG_TRACE, and ndn::nfd::ROUTE_FLAG_CAPTURE.

◆ hasFaceId()

bool nfd::rib::RibEntry::hasFaceId ( uint64_t  faceId) const

Definition at line 88 of file rib-entry.cpp.

References begin(), and end().

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), and RibEntry().

◆ getRoutes()

const RibEntry::RouteList & nfd::rib::RibEntry::getRoutes ( ) const
inline

Definition at line 247 of file rib-entry.hpp.

Referenced by nfd::RibManager::enableLocalFields(), and RibEntry().

◆ getNRoutes()

size_t nfd::rib::RibEntry::getNRoutes ( ) const

Definition at line 95 of file rib-entry.cpp.

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), and RibEntry().

◆ findRoute() [1/2]

RibEntry::RouteList::iterator nfd::rib::RibEntry::findRoute ( const Route route)

◆ findRoute() [2/2]

RibEntry::RouteList::const_iterator nfd::rib::RibEntry::findRoute ( const Route route) const

Definition at line 50 of file rib-entry.cpp.

References begin(), nfd::rib::compareFaceIdAndOrigin(), and end().

◆ hasRoute()

bool nfd::rib::RibEntry::hasRoute ( const Route route)

Definition at line 81 of file rib-entry.cpp.

References end(), and findRoute().

Referenced by RibEntry().

◆ addInheritedRoute()

void nfd::rib::RibEntry::addInheritedRoute ( const Route route)

Definition at line 135 of file rib-entry.cpp.

Referenced by RibEntry().

◆ removeInheritedRoute()

void nfd::rib::RibEntry::removeInheritedRoute ( const Route route)

Definition at line 141 of file rib-entry.cpp.

References nfd::rib::Route::faceId.

Referenced by RibEntry().

◆ getInheritedRoutes()

const RibEntry::RouteList & nfd::rib::RibEntry::getInheritedRoutes ( ) const
inline

Returns the routes this namespace has inherited.

The inherited routes returned represent inherited routes this namespace has in the FIB.

Returns
{ routes inherited by this namespace }

Definition at line 253 of file rib-entry.hpp.

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), and RibEntry().

◆ findInheritedRoute()

RibEntry::RouteList::const_iterator nfd::rib::RibEntry::findInheritedRoute ( const Route route) const

Finds an inherited route with a matching face ID.

Returns
{ An iterator to the matching route if one is found; otherwise, an iterator to the end of the entry's inherited route list }

Definition at line 147 of file rib-entry.cpp.

References nfd::rib::Route::faceId.

Referenced by hasInheritedRoute(), and RibEntry().

◆ hasInheritedRoute()

bool nfd::rib::RibEntry::hasInheritedRoute ( const Route route) const

Determines if the entry has an inherited route with a matching face ID.

Returns
{ True, if a matching inherited route is found; otherwise, false. }

Definition at line 154 of file rib-entry.cpp.

References findInheritedRoute().

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), and RibEntry().

◆ hasCapture()

bool nfd::rib::RibEntry::hasCapture ( ) const

Definition at line 160 of file rib-entry.cpp.

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), and RibEntry().

◆ hasChildInheritOnFaceId()

bool nfd::rib::RibEntry::hasChildInheritOnFaceId ( uint64_t  faceId) const

Determines if the entry has an inherited route with the passed face ID and its child inherit flag set.

Returns
{ True, if a matching inherited route is found; otherwise, false. }

Definition at line 166 of file rib-entry.cpp.

References ndn::nfd::ROUTE_FLAG_CHILD_INHERIT.

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), and RibEntry().

◆ getRouteWithLowestCostByFaceId()

const Route * nfd::rib::RibEntry::getRouteWithLowestCostByFaceId ( uint64_t  faceId) const

Returns the route with the lowest cost that has the passed face ID.

Returns
{ The route with the lowest cost that has the passed face ID}

Definition at line 178 of file rib-entry.cpp.

References nfd::rib::Route::cost.

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), and RibEntry().

◆ getRouteWithSecondLowestCostByFaceId()

const Route * nfd::rib::RibEntry::getRouteWithSecondLowestCostByFaceId ( uint64_t  faceId) const

Definition at line 200 of file rib-entry.cpp.

References nfd::rib::Route::cost.

Referenced by RibEntry().

◆ getRouteWithLowestCostAndChildInheritByFaceId()

const Route * nfd::rib::RibEntry::getRouteWithLowestCostAndChildInheritByFaceId ( uint64_t  faceId) const

Returns the route with the lowest cost that has the passed face ID and its child inherit flag set.

Returns
{ The route with the lowest cost that has the passed face ID and its child inherit flag set }

Definition at line 224 of file rib-entry.cpp.

References nfd::rib::Route::cost, and ndn::nfd::ROUTE_FLAG_CHILD_INHERIT.

Referenced by nfd::rib::FibUpdater::computeAndSendFibUpdates(), and RibEntry().

◆ getPrefixAnnouncement()

ndn::PrefixAnnouncement nfd::rib::RibEntry::getPrefixAnnouncement ( time::milliseconds  minExpiration = 15_s,
time::milliseconds  maxExpiration = 1_h 
) const

Retrieve a prefix announcement suitable for readvertising this route.

If one or more routes in this RIB entry contains a prefix announcement, this method returns the announcement from the route that expires last.

If this RIB entry does not have a route containing a prefix announcement, this method creates a new announcement. Its expiration period reflects the remaining lifetime of this RIB entry, confined within [minExpiration, maxExpiration] range. The caller is expected to sign this announcement.

Warning
(minExpiration > maxExpiration) triggers undefined behavior.

Definition at line 248 of file rib-entry.cpp.

References nfd::rib::Route::announcement, ndn::clamp(), nfd::rib::Route::expires, ndn::time::steady_clock::now(), ndn::PrefixAnnouncement::setAnnouncedName(), and ndn::PrefixAnnouncement::setExpiration().

Referenced by RibEntry().

◆ begin() [1/2]

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

Definition at line 259 of file rib-entry.hpp.

Referenced by findRoute(), hasFaceId(), and RibEntry().

◆ end() [1/2]

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

Definition at line 265 of file rib-entry.hpp.

Referenced by findRoute(), hasFaceId(), hasRoute(), insertRoute(), and RibEntry().

◆ begin() [2/2]

RibEntry::iterator nfd::rib::RibEntry::begin ( )
inline

Definition at line 271 of file rib-entry.hpp.

◆ end() [2/2]

RibEntry::iterator nfd::rib::RibEntry::end ( )
inline

Definition at line 277 of file rib-entry.hpp.

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


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