nfd::fib::Fib Class Reference

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

#include <daemon/table/fib.hpp>

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

Public Types

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

Public Member Functions

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

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

See also
fib::Entry

Definition at line 50 of file fib.hpp.

Member Typedef Documentation

◆ const_iterator

using nfd::fib::Fib::const_iterator = boost::range_iterator<Range>::type

Definition at line 129 of file fib.hpp.

◆ Range

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

Definition at line 128 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 116 of file fib.hpp.

Constructor & Destructor Documentation

◆ Fib()

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

Definition at line 44 of file fib.cpp.

Member Function Documentation

◆ 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 135 of file fib.cpp.

◆ 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 137 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 146 of file fib.hpp.

◆ erase() [1/2]

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

Definition at line 124 of file fib.cpp.

◆ erase() [2/2]

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

Definition at line 115 of file fib.cpp.

◆ findExactMatch()

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

Performs an exact match lookup.

Definition at line 79 of file fib.cpp.

◆ findLongestPrefixMatch() [1/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 73 of file fib.cpp.

◆ findLongestPrefixMatch() [2/3]

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

Performs a longest prefix match.

Definition at line 61 of file fib.cpp.

◆ findLongestPrefixMatch() [3/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 67 of file fib.cpp.

◆ getMaxDepth()

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

Maximum number of components in a FIB entry prefix.

Definition at line 91 of file fib.hpp.

◆ 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 89 of file fib.cpp.

◆ removeNextHop()

Fib::RemoveNextHopResult nfd::fib::Fib::removeNextHop ( Entry entry,
const Face face 
)

Remove the NextHop record for face from entry.

Definition at line 143 of file fib.cpp.

◆ size()

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

Definition at line 57 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 154 of file fib.hpp.