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

typedef boost::range_iterator< Range >::type const_iterator
 
typedef boost::transformed_range< name_tree::GetTableEntry< Entry >, const name_tree::RangeRange
 
enum  RemoveNextHopResult {
  RemoveNextHopResult::NO_SUCH_NEXTHOP,
  RemoveNextHopResult::NEXTHOP_REMOVED,
  RemoveNextHopResult::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 Name &prefix)
 
void erase (const Entry &entry)
 
EntryfindExactMatch (const Name &prefix)
 Performs an exact match lookup. 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...
 
const EntryfindLongestPrefixMatch (const measurements::Entry &measurementsEntry) 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
 

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

◆ const_iterator

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

Definition at line 126 of file fib.hpp.

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

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

Definition at line 45 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 136 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 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.

◆ erase() [1/2]

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

Definition at line 116 of file fib.cpp.

◆ erase() [2/2]

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

Definition at line 125 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.

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

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

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

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

◆ removeNextHop()

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

Remove the NextHop record for face from entry.

Definition at line 147 of file fib.cpp.

◆ size()

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

Definition at line 54 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.