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

Represents the Forwarding Information Base (FIB) More...

#include <fib.hpp>

Inheritance diagram for nfd::fib::Fib:
Collaboration diagram for nfd::fib::Fib:

Public Types

enum  RemoveNextHopResult { RemoveNextHopResult::NO_SUCH_NEXTHOP, RemoveNextHopResult::NEXTHOP_REMOVED, RemoveNextHopResult::FIB_ENTRY_REMOVED }
 
typedef boost::transformed_range< name_tree::GetTableEntry< Entry >, const name_tree::RangeRange
 
typedef boost::range_iterator< Range >::type const_iterator
 

Public Member Functions

 Fib (NameTree &nameTree)
 
size_t size () const
 
const EntryfindLongestPrefixMatch (const Name &prefix) const
 Performs a longest prefix match. More...
 
const EntryfindLongestPrefixMatch (const pit::Entry &pitEntry) const
 Performs a longest prefix match. More...
 
const EntryfindLongestPrefixMatch (const measurements::Entry &measurementsEntry) const
 Performs a longest prefix match. More...
 
EntryfindExactMatch (const Name &prefix)
 Performs an exact match lookup. More...
 
std::pair< Entry *, bool > insert (const Name &prefix)
 Find or insert a FIB entry. More...
 
void erase (const Name &prefix)
 
void erase (const Entry &entry)
 
void addOrUpdateNextHop (Entry &entry, Face &face, uint64_t cost)
 Add a NextHop record. More...
 
RemoveNextHopResult removeNextHop (Entry &entry, const Face &face)
 Remove the NextHop record for face from entry. More...
 
const_iterator begin () const
 
const_iterator end () const
 

Static Public Member Functions

static constexpr size_t getMaxDepth ()
 Maximum number of components in a FIB entry prefix. More...
 

Public Attributes

signal::Signal< Fib, Name, NextHopafterNewNextHop
 signals on Fib entry nexthop creation More...
 

Detailed Description

Represents the Forwarding Information Base (FIB)

Definition at line 47 of file fib.hpp.

Member Typedef Documentation

◆ Range

typedef boost::transformed_range<name_tree::GetTableEntry<Entry>, const name_tree::Range> nfd::fib::Fib::Range

Definition at line 125 of file fib.hpp.

◆ const_iterator

typedef boost::range_iterator<Range>::type nfd::fib::Fib::const_iterator

Definition at line 126 of file fib.hpp.

Member Enumeration Documentation

◆ RemoveNextHopResult

Enumerator
NO_SUCH_NEXTHOP 

the nexthop is not found

NEXTHOP_REMOVED 

the nexthop is removed and the fib entry stays

FIB_ENTRY_REMOVED 

the nexthop is removed and the fib entry is removed

Definition at line 113 of file fib.hpp.

Constructor & Destructor Documentation

◆ Fib()

nfd::fib::Fib::Fib ( NameTree nameTree)
explicit

Member Function Documentation

◆ size()

size_t nfd::fib::Fib::size ( ) const
inline

Definition at line 54 of file fib.hpp.

Referenced by nfd::ForwarderStatusManager::ForwarderStatusManager().

◆ findLongestPrefixMatch() [1/3]

const Entry & nfd::fib::Fib::findLongestPrefixMatch ( const Name prefix) const

Performs a longest prefix match.

Definition at line 62 of file fib.cpp.

Referenced by nfd::fw::Strategy::lookupFib().

◆ findLongestPrefixMatch() [2/3]

const Entry & nfd::fib::Fib::findLongestPrefixMatch ( const pit::Entry pitEntry) const

Performs a longest prefix match.

This is equivalent to findLongestPrefixMatch(pitEntry.getName())

Definition at line 68 of file fib.cpp.

◆ findLongestPrefixMatch() [3/3]

const Entry & nfd::fib::Fib::findLongestPrefixMatch ( const measurements::Entry measurementsEntry) const

Performs a longest prefix match.

This is equivalent to findLongestPrefixMatch(measurementsEntry.getName())

Definition at line 74 of file fib.cpp.

◆ findExactMatch()

Entry * nfd::fib::Fib::findExactMatch ( const Name prefix)

Performs an exact match lookup.

Definition at line 80 of file fib.cpp.

References nfd::name_tree::NameTree::findExactMatch(), and nfd::name_tree::Entry::getFibEntry().

Referenced by nfd::FibManager::FibManager().

◆ getMaxDepth()

static constexpr size_t nfd::fib::Fib::getMaxDepth ( )
inlinestatic

Maximum number of components in a FIB entry prefix.

Definition at line 88 of file fib.hpp.

References Face, and nfd::name_tree::NameTree::getMaxDepth().

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

◆ insert()

std::pair< Entry *, bool > nfd::fib::Fib::insert ( const Name prefix)

Find or insert a FIB entry.

Parameters
prefixFIB entry name; it must not have more than getMaxDepth() components.
Returns
the entry, and true for new entry or false for existing entry

Definition at line 90 of file fib.cpp.

References erase(), nfd::name_tree::NameTree::eraseIfEmpty(), nfd::name_tree::Entry::getFibEntry(), nfd::name_tree::NameTree::lookup(), and nfd::name_tree::Entry::setFibEntry().

Referenced by nfd::FibManager::FibManager().

◆ erase() [1/2]

void nfd::fib::Fib::erase ( const Name prefix)

Definition at line 116 of file fib.cpp.

References nfd::name_tree::NameTree::findExactMatch().

Referenced by erase(), insert(), and removeNextHop().

◆ erase() [2/2]

void nfd::fib::Fib::erase ( const Entry entry)

Definition at line 125 of file fib.cpp.

References erase(), and nfd::name_tree::NameTree::getEntry().

◆ addOrUpdateNextHop()

void nfd::fib::Fib::addOrUpdateNextHop ( Entry entry,
Face face,
uint64_t  cost 
)

Add a NextHop record.

If a NextHop record for face already exists in entry, its cost is set to cost.

Definition at line 136 of file fib.cpp.

References afterNewNextHop, and nfd::fib::Entry::getPrefix().

Referenced by nfd::FibManager::FibManager().

◆ removeNextHop()

◆ begin()

const_iterator nfd::fib::Fib::begin ( ) const
inline
Returns
an iterator to the beginning
Note
The iteration order is implementation-defined.
Warning
Undefined behavior may occur if a FIB/PIT/Measurements/StrategyChoice entry is inserted or erased during iteration.

Definition at line 134 of file fib.hpp.

◆ end()

const_iterator nfd::fib::Fib::end ( ) const
inline
Returns
an iterator to the end
See also
begin()

Definition at line 143 of file fib.hpp.

Member Data Documentation

◆ afterNewNextHop

signal::Signal<Fib, Name, NextHop> nfd::fib::Fib::afterNewNextHop

signals on Fib entry nexthop creation

Definition at line 151 of file fib.hpp.

Referenced by addOrUpdateNextHop(), and nfd::Forwarder::Forwarder().


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