nfd::rib::RibEntry Class Reference

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

#include <daemon/rib/rib-entry.hpp>

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

Public Types

using const_iterator = RouteList::const_iterator
 
using iterator = RouteList::iterator
 
using RouteList = std::list< Route >
 

Public Member Functions

void addChild (shared_ptr< RibEntry > child)
 
void addInheritedRoute (const Route &route)
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
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...
 
RouteList::const_iterator findInheritedRoute (const Route &route) const
 Finds an inherited route with a matching face ID. More...
 
iterator findRoute (const Route &route)
 
const_iterator findRoute (const Route &route) const
 
const std::list< shared_ptr< RibEntry > > & getChildren () const
 
const RouteListgetInheritedRoutes () const
 Returns the routes this namespace has inherited. More...
 
const Name & getName () const
 
size_t getNRoutes () const
 
shared_ptr< RibEntrygetParent () const
 
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 RouteListgetRoutes () 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...
 
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
 
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...
 
bool hasChildren () const
 
bool hasFaceId (uint64_t faceId) const
 
bool hasInheritedRoute (const Route &route) const
 Determines if the entry has an inherited route with a matching face ID. More...
 
bool hasParent () const
 
bool hasRoute (const Route &route)
 
std::pair< RibEntry::iterator, bool > insertRoute (const Route &route)
 Inserts a new route into the entry's route list. More...
 
void removeChild (shared_ptr< RibEntry > child)
 
void removeInheritedRoute (const Route &route)
 
void setName (const Name &prefix)
 

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

◆ const_iterator

using nfd::rib::RibEntry::const_iterator = RouteList::const_iterator

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

◆ iterator

using nfd::rib::RibEntry::iterator = RouteList::iterator

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

◆ RouteList

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

Member Function Documentation

◆ addChild()

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

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

◆ addInheritedRoute()

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

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

◆ begin() [1/2]

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

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

◆ begin() [2/2]

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

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

◆ end() [1/2]

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

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

◆ end() [2/2]

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

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

◆ eraseRoute() [1/2]

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

Erases a Route with the same FaceId and origin.

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

◆ 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 116 of file rib-entry.cpp.

◆ 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 146 of file rib-entry.cpp.

◆ findRoute() [1/2]

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

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

◆ findRoute() [2/2]

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

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

◆ getChildren()

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

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

◆ 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.

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

◆ getName()

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

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

◆ getNRoutes()

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

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

◆ getParent()

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

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

◆ 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 247 of file rib-entry.cpp.

◆ getRoutes()

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

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

◆ 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.

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

◆ 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 177 of file rib-entry.cpp.

◆ getRouteWithSecondLowestCostByFaceId()

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

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

◆ hasCapture()

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

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

◆ 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 165 of file rib-entry.cpp.

◆ hasChildren()

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

◆ hasFaceId()

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

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

◆ 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 153 of file rib-entry.cpp.

◆ hasParent()

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

◆ hasRoute()

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

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

◆ 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 56 of file rib-entry.cpp.

◆ removeChild()

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

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

◆ removeInheritedRoute()

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

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

◆ setName()

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

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