30 #include <boost/concept/assert.hpp> 31 #include <boost/concept_check.hpp> 32 #include <type_traits> 36 const shared_ptr<fib::Entry> Fib::s_emptyEntry = make_shared<fib::Entry>(
Name());
39 BOOST_CONCEPT_ASSERT((boost::ForwardIterator<Fib::const_iterator>));
42 #ifdef HAVE_IS_DEFAULT_CONSTRUCTIBLE 43 static_assert(std::is_default_constructible<Fib::const_iterator>::value,
44 "Fib::const_iterator must be default-constructible");
46 BOOST_CONCEPT_ASSERT((boost::DefaultConstructible<Fib::const_iterator>));
47 #endif // HAVE_IS_DEFAULT_CONSTRUCTIBLE 50 : m_nameTree(nameTree)
65 shared_ptr<fib::Entry>
68 shared_ptr<name_tree::Entry> nameTreeEntry =
70 if (static_cast<bool>(nameTreeEntry)) {
71 return nameTreeEntry->getFibEntry();
76 shared_ptr<fib::Entry>
79 shared_ptr<fib::Entry> entry = nameTreeEntry->getFibEntry();
80 if (static_cast<bool>(entry))
84 if (static_cast<bool>(nameTreeEntry)) {
85 return nameTreeEntry->getFibEntry();
90 shared_ptr<fib::Entry>
94 BOOST_ASSERT(nte !=
nullptr);
98 shared_ptr<fib::Entry>
101 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
get(measurementsEntry);
103 BOOST_ASSERT(static_cast<bool>(nameTreeEntry));
108 shared_ptr<fib::Entry>
111 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
findExactMatch(prefix);
112 if (static_cast<bool>(nameTreeEntry))
113 return nameTreeEntry->getFibEntry();
114 return shared_ptr<fib::Entry>();
117 std::pair<shared_ptr<fib::Entry>,
bool>
120 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
lookup(prefix);
121 shared_ptr<fib::Entry> entry = nameTreeEntry->getFibEntry();
122 if (static_cast<bool>(entry))
123 return std::make_pair(entry,
false);
124 entry = make_shared<fib::Entry>(prefix);
125 nameTreeEntry->setFibEntry(entry);
127 return std::make_pair(entry,
true);
131 Fib::erase(shared_ptr<name_tree::Entry> nameTreeEntry)
133 nameTreeEntry->setFibEntry(shared_ptr<fib::Entry>());
141 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
findExactMatch(prefix);
142 if (static_cast<bool>(nameTreeEntry)) {
143 this->
erase(nameTreeEntry);
150 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
get(entry);
151 if (static_cast<bool>(nameTreeEntry)) {
152 this->
erase(nameTreeEntry);
159 std::list<fib::Entry*> toErase;
163 shared_ptr<fib::Entry> entry = nte.getFibEntry();
164 entry->removeNextHop(face);
165 if (!entry->hasNextHops()) {
166 toErase.push_back(entry.get());
shared_ptr< fib::Entry > getFibEntry() const
static bool predicate_NameTreeEntry_hasFibEntry(const name_tree::Entry &entry)
const_iterator begin() const
returns an iterator pointing to the first FIB entry
std::pair< shared_ptr< fib::Entry >, bool > insert(const Name &prefix)
inserts a FIB entry for prefix If an entry for exact same prefix exists, that entry is returned...
bool eraseEntryIfEmpty(shared_ptr< name_tree::Entry > entry)
Delete a Name Tree Entry if this entry is empty.
shared_ptr< fib::Entry > findLongestPrefixMatch(const Name &prefix) const
performs a longest prefix match
shared_ptr< name_tree::Entry > get(const fib::Entry &fibEntry) const
get NameTree entry from FIB entry
shared_ptr< fib::Entry > findExactMatch(const Name &prefix) const
represents a Measurements entry
shared_ptr< name_tree::Entry > findLongestPrefixMatch(const Name &prefix, const name_tree::EntrySelector &entrySelector=name_tree::AnyEntry()) const
Longest prefix matching for the given name.
void removeNextHopFromAllEntries(shared_ptr< Face > face)
removes the NextHop record for face in all entrites
void erase(const Name &prefix)
Copyright (c) 2011-2015 Regents of the University of California.
shared_ptr< name_tree::Entry > findExactMatch(const Name &prefix) const
Exact match lookup for the given name prefix.
Name abstraction to represent an absolute name.
shared_ptr< name_tree::Entry > lookup(const Name &prefix)
Look for the Name Tree Entry that contains this name prefix.
boost::iterator_range< const_iterator > fullEnumerate(const name_tree::EntrySelector &entrySelector=name_tree::AnyEntry()) const
Enumerate all entries, optionally filtered by an EntrySelector.