nlsr::NamePrefixTable Class Reference

#include <name-prefix-table.hpp>

Public Types

using const_iterator = NptEntryList::const_iterator
 
using NptEntryList = std::list< std::shared_ptr< NamePrefixTableEntry > >
 
using RoutingTableEntryPool = std::unordered_map< ndn::Name, std::shared_ptr< RoutingTablePoolEntry > >
 

Public Member Functions

 NamePrefixTable (Fib &fib, RoutingTable &routingTable, std::unique_ptr< AfterRoutingChange > &afterRoutingChangeSignal)
 
 ~NamePrefixTable ()
 
void addEntry (const ndn::Name &name, const ndn::Name &destRouter)
 Adds a destination to the specified name prefix. More...
 
std::shared_ptr< RoutingTablePoolEntryaddRtpeToPool (RoutingTablePoolEntry &rtpe)
 Adds a pool entry to the pool. More...
 
const_iterator begin () const
 
void deleteRtpeFromPool (std::shared_ptr< RoutingTablePoolEntry > rtpePtr)
 Removes a pool entry from the pool. More...
 
const_iterator end () const
 
void removeEntry (const ndn::Name &name, const ndn::Name &destRouter)
 Removes a destination from a name prefix table entry. More...
 
void updateWithNewRoute (const std::list< RoutingTableEntry > &entries)
 Updates all routing information in the NPT. More...
 
void writeLog ()
 

Detailed Description

Definition at line 36 of file name-prefix-table.hpp.

Member Typedef Documentation

◆ const_iterator

using nlsr::NamePrefixTable::const_iterator = NptEntryList::const_iterator

Definition at line 42 of file name-prefix-table.hpp.

◆ NptEntryList

using nlsr::NamePrefixTable::NptEntryList = std::list<std::shared_ptr<NamePrefixTableEntry> >

Definition at line 41 of file name-prefix-table.hpp.

◆ RoutingTableEntryPool

using nlsr::NamePrefixTable::RoutingTableEntryPool = std::unordered_map<ndn::Name, std::shared_ptr<RoutingTablePoolEntry> >

Definition at line 40 of file name-prefix-table.hpp.

Constructor & Destructor Documentation

◆ NamePrefixTable()

nlsr::NamePrefixTable::NamePrefixTable ( Fib fib,
RoutingTable routingTable,
std::unique_ptr< AfterRoutingChange > &  afterRoutingChangeSignal 
)

Definition at line 36 of file name-prefix-table.cpp.

+ Here is the call graph for this function:

◆ ~NamePrefixTable()

nlsr::NamePrefixTable::~NamePrefixTable ( )

Definition at line 47 of file name-prefix-table.cpp.

Member Function Documentation

◆ addEntry()

void nlsr::NamePrefixTable::addEntry ( const ndn::Name &  name,
const ndn::Name &  destRouter 
)

Adds a destination to the specified name prefix.

Parameters
nameThe name prefix
destRouterThe destination router prefix

This method adds a router to a name prefix table entry. If the name prefix table entry does not exist, it is created. The method will first look through its local pool of cached entries to find the routing information for destRouter. If it is not found there, it will construct one and fill it with information from an appropriate RoutingTableEntry in the routing table. If there isn't a match, it will instantiate it with no next hops. The FIB will be notified of the change to the NPT entry, too.

Definition at line 53 of file name-prefix-table.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addRtpeToPool()

std::shared_ptr< RoutingTablePoolEntry > nlsr::NamePrefixTable::addRtpeToPool ( RoutingTablePoolEntry rtpe)

Adds a pool entry to the pool.

Parameters
rtpeThe entry.
Returns
A shared_ptr to the entry, now in the pool.

Adds a RoutingTablePoolEntry to the NPT's local pool. Shared pointers are used because it eliminates complicated hacks to deal with lifetime issues, and to simplify memory management.

Definition at line 248 of file name-prefix-table.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ begin()

NamePrefixTable::const_iterator nlsr::NamePrefixTable::begin ( ) const
inline

Definition at line 134 of file name-prefix-table.hpp.

◆ deleteRtpeFromPool()

void nlsr::NamePrefixTable::deleteRtpeFromPool ( std::shared_ptr< RoutingTablePoolEntry rtpePtr)

Removes a pool entry from the pool.

Parameters
rtpePtrThe shared_ptr to the entry.

Removes a pool entry from the pool. Comparing these shared_ptrs should not be a problem, because the same pointer is moved around, all sourced from this central location. A more robust solution is certainly possible, though.

Definition at line 265 of file name-prefix-table.cpp.

+ Here is the caller graph for this function:

◆ end()

NamePrefixTable::const_iterator nlsr::NamePrefixTable::end ( ) const
inline

Definition at line 140 of file name-prefix-table.hpp.

+ Here is the call graph for this function:

◆ removeEntry()

void nlsr::NamePrefixTable::removeEntry ( const ndn::Name &  name,
const ndn::Name &  destRouter 
)

Removes a destination from a name prefix table entry.

Parameters
nameThe name prefix
destRouterThe destination.

This method removes a destination from an entry. It will not fail if an invalid name/destination pair are passed. After removal, if the RoutingTablePoolEntry has a use count of 0, it is deleted from the table. Additionally, if the name prefix has no routing table entries associated with it, it is deleted from the NPT. In any case, the FIB is informed of the changes.

Definition at line 140 of file name-prefix-table.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateWithNewRoute()

void nlsr::NamePrefixTable::updateWithNewRoute ( const std::list< RoutingTableEntry > &  entries)

Updates all routing information in the NPT.

Takes in a list of entries that are assumed to be exhaustive, and updates each pool entry with the next hop information contained in the corresponding entry in entries. If no entry is found, it is assumed that the destination for that pool entry is inaccessible, and its next hop information is deleted.

Definition at line 208 of file name-prefix-table.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeLog()

void nlsr::NamePrefixTable::writeLog ( )

Definition at line 275 of file name-prefix-table.cpp.

+ Here is the caller graph for this function: