#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 (const ndn::Name &ownRouterName, Fib &fib, RoutingTable &routingTable, AfterRoutingChange &afterRoutingChangeSignal, Lsdb::AfterLsdbModified &afterLsdbModifiedSignal) | |
~NamePrefixTable () | |
void | addEntry (const ndn::Name &name, const ndn::Name &destRouter) |
Adds a destination to the specified name prefix. More... | |
std::shared_ptr< RoutingTablePoolEntry > | addRtpeToPool (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 | updateFromLsdb (std::shared_ptr< Lsa > lsa, LsdbUpdate updateType, const std::list< ndn::Name > &namesToAdd, const std::list< ndn::Name > &namesToRemove) |
Add, update, or remove Names according to the Lsdb update. More... | |
void | updateWithNewRoute (const std::list< RoutingTableEntry > &entries) |
Updates all routing information in the NPT. More... | |
void | writeLog () |
Definition at line 37 of file name-prefix-table.hpp.
using nlsr::NamePrefixTable::const_iterator = NptEntryList::const_iterator |
Definition at line 43 of file name-prefix-table.hpp.
using nlsr::NamePrefixTable::NptEntryList = std::list<std::shared_ptr<NamePrefixTableEntry> > |
Definition at line 42 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.
nlsr::NamePrefixTable::NamePrefixTable | ( | const ndn::Name & | ownRouterName, |
Fib & | fib, | ||
RoutingTable & | routingTable, | ||
AfterRoutingChange & | afterRoutingChangeSignal, | ||
Lsdb::AfterLsdbModified & | afterLsdbModifiedSignal | ||
) |
Definition at line 36 of file name-prefix-table.cpp.
nlsr::NamePrefixTable::~NamePrefixTable | ( | ) |
Definition at line 57 of file name-prefix-table.cpp.
void nlsr::NamePrefixTable::addEntry | ( | const ndn::Name & | name, |
const ndn::Name & | destRouter | ||
) |
Adds a destination to the specified name prefix.
name | The name prefix |
destRouter | The 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 116 of file name-prefix-table.cpp.
std::shared_ptr< RoutingTablePoolEntry > nlsr::NamePrefixTable::addRtpeToPool | ( | RoutingTablePoolEntry & | rtpe | ) |
Adds a pool entry to the pool.
rtpe | The entry. |
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 304 of file name-prefix-table.cpp.
|
inline |
Definition at line 149 of file name-prefix-table.hpp.
void nlsr::NamePrefixTable::deleteRtpeFromPool | ( | std::shared_ptr< RoutingTablePoolEntry > | rtpePtr | ) |
Removes a pool entry from the pool.
rtpePtr | The 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 318 of file name-prefix-table.cpp.
|
inline |
Definition at line 155 of file name-prefix-table.hpp.
void nlsr::NamePrefixTable::removeEntry | ( | const ndn::Name & | name, |
const ndn::Name & | destRouter | ||
) |
Removes a destination from a name prefix table entry.
name | The name prefix |
destRouter | The 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 200 of file name-prefix-table.cpp.
void nlsr::NamePrefixTable::updateFromLsdb | ( | std::shared_ptr< Lsa > | lsa, |
LsdbUpdate | updateType, | ||
const std::list< ndn::Name > & | namesToAdd, | ||
const std::list< ndn::Name > & | namesToRemove | ||
) |
Add, update, or remove Names according to the Lsdb update.
lsa | The LSA class pointer |
updateType | Update type from Lsdb (INSTALLED, UPDATED, REMOVED) |
namesToAdd | If LSA is UPDATED, then these are the names to add |
namesToRemove | If LSA is UPDATED, then these are the names to remove |
Definition at line 64 of file name-prefix-table.cpp.
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 264 of file name-prefix-table.cpp.
void nlsr::NamePrefixTable::writeLog | ( | ) |
Definition at line 328 of file name-prefix-table.cpp.