nlsr::Fib Class Reference

Maps names to lists of next hops, and exports this information to NFD. More...

#include <fib.hpp>

+ Collaboration diagram for nlsr::Fib:

Public Member Functions

 Fib (ndn::Face &face, ndn::Scheduler &scheduler, AdjacencyList &adjacencyList, ConfParameter &conf, ndn::security::KeyChain &keyChain)
 
void clean ()
 Remove all entries from the FIB. More...
 
void registerPrefix (const ndn::Name &namePrefix, const ndn::FaceUri &faceUri, uint64_t faceCost, const ndn::time::milliseconds &timeout, uint64_t flags, uint8_t times)
 Inform NFD of a next-hop. More...
 
void remove (const ndn::Name &name)
 Completely remove a name prefix from the FIB. More...
 
void setEntryRefreshTime (int32_t fert)
 
void setStrategy (const ndn::Name &name, const ndn::Name &strategy, uint32_t count)
 
void update (const ndn::Name &name, const NexthopList &allHops)
 Set the nexthop list of a name. More...
 
void writeLog ()
 

Public Attributes

ndn::signal::Signal< Fib, ndn::Name > onPrefixRegistrationSuccess
 

Static Public Attributes

static const ndn::Name BEST_ROUTE_STRATEGY {"/localhost/nfd/strategy/best-route"}
 
static const ndn::Name MULTICAST_STRATEGY {"/localhost/nfd/strategy/multicast"}
 

Detailed Description

Maps names to lists of next hops, and exports this information to NFD.

The FIB (Forwarding Information Base) is the "authoritative" source of how to route Interests on this router to other nodes running NLSR. In essence, the FIB is a map that takes name prefixes to a list of next-hops out of this router. This class also contains methods to inform NFD about these relationships. The FIB has its entries populated by the NamePrefixTable

See also
nlsr::NamePrefixTable
nlsr::NamePrefixTable::addEntry
nlsr::NamePrefixTable::updateWithNewRoute

Definition at line 62 of file fib.hpp.

Constructor & Destructor Documentation

◆ Fib()

nlsr::Fib::Fib ( ndn::Face &  face,
ndn::Scheduler &  scheduler,
AdjacencyList adjacencyList,
ConfParameter conf,
ndn::security::KeyChain &  keyChain 
)

Definition at line 35 of file fib.cpp.

Member Function Documentation

◆ clean()

void nlsr::Fib::clean ( )

Remove all entries from the FIB.

This method is called before terminating NLSR to minimize the time NFD spends routing on now-invalid information. This is not strictly necessary, because eventually those prefix registrations will expire, but cleaning up after ourselves improves performance.

Definition at line 155 of file fib.cpp.

◆ registerPrefix()

void nlsr::Fib::registerPrefix ( const ndn::Name &  namePrefix,
const ndn::FaceUri &  faceUri,
uint64_t  faceCost,
const ndn::time::milliseconds &  timeout,
uint64_t  flags,
uint8_t  times 
)

Inform NFD of a next-hop.

This method informs NFD of a next-hop for some name prefix. This method actually submits the information to NFD's RIB, which then aggregates its own best hops and updates NFD's (the actual) FIB. Typically, NLSR's FIB and NFD's FIB will be almost the same. However, this is not necessarily the case and there may be cases when other sources of information provide better next-hops to NFD that NLSR doesn't know about. For example, an operator could set up a direct link to a node that isn't running NLSR.

Parameters
namePrefixThe name prefix to register a next-hop for
faceUriThe faceUri of the adjacent that this prefix can be reached through
faceCostThe cost to reach namePrefix through faceUri
timeoutHow long this registration should last
flagsRoute inheritance flags (CAPTURE, CHILD_INHERIT)
timesHow many times we have failed to register this prefix since the last success.
See also
Fib::registerPrefixInNfd

Definition at line 182 of file fib.cpp.

◆ remove()

void nlsr::Fib::remove ( const ndn::Name &  name)

Completely remove a name prefix from the FIB.

If a name prefix is found to no longer be reachable from this router, it will be removed from the FIB and all of its next-hops will be unregistered from NFD.

See also
nlsr::NamePrefixTable::removeEntry

Definition at line 46 of file fib.cpp.

◆ setEntryRefreshTime()

void nlsr::Fib::setEntryRefreshTime ( int32_t  fert)
inline

Definition at line 105 of file fib.hpp.

◆ setStrategy()

void nlsr::Fib::setStrategy ( const ndn::Name &  name,
const ndn::Name &  strategy,
uint32_t  count 
)

Definition at line 274 of file fib.cpp.

◆ update()

void nlsr::Fib::update ( const ndn::Name &  name,
const NexthopList allHops 
)

Set the nexthop list of a name.

This method is the entry for others to add next-hop information to the FIB. Formally put, this method registers in NFD all next-hops in allHops, and unregisters the set difference of newHops - oldHops. This method also schedules the regular refresh of those next hops.

Parameters
nameThe name prefix that the next-hops apply to
allHopsA complete list of next-hops to associate with name.

Definition at line 84 of file fib.cpp.

◆ writeLog()

void nlsr::Fib::writeLog ( )

Definition at line 349 of file fib.cpp.

Member Data Documentation

◆ BEST_ROUTE_STRATEGY

const ndn::Name nlsr::Fib::BEST_ROUTE_STRATEGY {"/localhost/nfd/strategy/best-route"}
inlinestatic

Definition at line 223 of file fib.hpp.

◆ MULTICAST_STRATEGY

const ndn::Name nlsr::Fib::MULTICAST_STRATEGY {"/localhost/nfd/strategy/multicast"}
inlinestatic

Definition at line 222 of file fib.hpp.

◆ onPrefixRegistrationSuccess

ndn::signal::Signal<Fib, ndn::Name> nlsr::Fib::onPrefixRegistrationSuccess

Definition at line 225 of file fib.hpp.