30 #include <ndn-cxx/util/concepts.hpp>
36 const unique_ptr<Entry> Fib::s_emptyEntry = make_unique<Entry>(Name());
45 : m_nameTree(nameTree)
51 Fib::findLongestPrefixMatchImpl(
const K& key)
const
63 return this->findLongestPrefixMatchImpl(prefix);
69 return this->findLongestPrefixMatchImpl(pitEntry);
75 return this->findLongestPrefixMatchImpl(measurementsEntry);
88 std::pair<Entry*, bool>
93 if (entry !=
nullptr) {
94 return {entry,
false};
105 BOOST_ASSERT(nte !=
nullptr);
118 if (nte !=
nullptr) {
127 if (nte ==
nullptr) {
128 BOOST_ASSERT(&entry == s_emptyEntry.get());
137 auto [it, isNew] = entry.addOrUpdateNextHop(face, cost);
145 bool isRemoved = entry.removeNextHop(face);
152 this->
erase(nte,
false);
161 Fib::getRange()
const
Generalization of a network interface.
Represents an entry in the FIB.
const Name & getPrefix() const
@ NEXTHOP_REMOVED
the nexthop is removed and the fib entry stays
@ FIB_ENTRY_REMOVED
the nexthop is removed and the fib entry is removed
@ NO_SUCH_NEXTHOP
the nexthop is not found
std::pair< Entry *, bool > insert(const Name &prefix)
Find or insert a FIB entry.
Entry * findExactMatch(const Name &prefix)
Performs an exact match lookup.
boost::range_iterator< Range >::type const_iterator
RemoveNextHopResult removeNextHop(Entry &entry, const Face &face)
Remove the NextHop record for face from entry.
boost::transformed_range< name_tree::GetTableEntry< Entry >, const name_tree::Range > Range
signal::Signal< Fib, Name, NextHop > afterNewNextHop
Signals on Fib entry nexthop creation.
void erase(const Name &prefix)
const Entry & findLongestPrefixMatch(const Name &prefix) const
Performs a longest prefix match.
void addOrUpdateNextHop(Entry &entry, Face &face, uint64_t cost)
Add a NextHop record.
Represents an entry in the Measurements table.
An entry in the name tree.
fib::Entry * getFibEntry() const
void setFibEntry(unique_ptr< fib::Entry > fibEntry)
A functor to get a table entry from a name tree entry.
A common index structure for FIB, PIT, StrategyChoice, and Measurements.
size_t eraseIfEmpty(Entry *entry, bool canEraseAncestors=true)
Delete the entry if it is empty.
Range fullEnumerate(const EntrySelector &entrySelector=AnyEntry()) const
Enumerate all entries.
Entry & lookup(const Name &name, size_t prefixLen)
Find or insert an entry by name.
Entry * getEntry(const EntryT &tableEntry) const
Entry * findExactMatch(const Name &name, size_t prefixLen=std::numeric_limits< size_t >::max()) const
Exact match lookup.
Entry * findLongestPrefixMatch(const Name &name, const EntrySelector &entrySelector=AnyEntry()) const
Longest prefix matching.
Represents an entry in the Interest table (PIT).
NDN_CXX_ASSERT_FORWARD_ITERATOR(Fib::const_iterator)
static bool nteHasFibEntry(const name_tree::Entry &nte)