nlsr::NamePrefixTable Class Reference

#include <name-prefix-table.hpp>

Public Types

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

Public Member Functions

 NamePrefixTable (Nlsr &nlsr, 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...
 
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...
 
std::shared_ptr< RoutingTablePoolEntryaddRtpeToPool (RoutingTablePoolEntry &rtpe)
 Adds a pool entry to the pool. More...
 
void deleteRtpeFromPool (std::shared_ptr< RoutingTablePoolEntry > rtpePtr)
 Removes a pool entry from the pool. More...
 
void writeLog ()
 
const_iterator begin () const
 
const_iterator end () const
 

Detailed Description

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

Member Typedef Documentation

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

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

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

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

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

nlsr::NamePrefixTable::NamePrefixTable ( Nlsr nlsr,
std::unique_ptr< AfterRoutingChange > &  afterRoutingChangeSignal 
)

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

Here is the call graph for this function:

nlsr::NamePrefixTable::~NamePrefixTable ( )

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

Member Function Documentation

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 58 of file name-prefix-table.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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 254 of file name-prefix-table.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

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

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 271 of file name-prefix-table.cpp.

Here is the caller graph for this function:

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

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

Here is the call graph for this function:

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 146 of file name-prefix-table.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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 214 of file name-prefix-table.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nlsr::NamePrefixTable::writeLog ( )

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

Here is the caller graph for this function: