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>
93 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
get(pitEntry);
95 BOOST_ASSERT(static_cast<bool>(nameTreeEntry));
100 shared_ptr<fib::Entry>
103 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
get(measurementsEntry);
105 BOOST_ASSERT(static_cast<bool>(nameTreeEntry));
110 shared_ptr<fib::Entry>
113 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
findExactMatch(prefix);
114 if (static_cast<bool>(nameTreeEntry))
115 return nameTreeEntry->getFibEntry();
116 return shared_ptr<fib::Entry>();
119 std::pair<shared_ptr<fib::Entry>,
bool>
122 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
lookup(prefix);
123 shared_ptr<fib::Entry> entry = nameTreeEntry->getFibEntry();
124 if (static_cast<bool>(entry))
125 return std::make_pair(entry,
false);
126 entry = make_shared<fib::Entry>(prefix);
127 nameTreeEntry->setFibEntry(entry);
129 return std::make_pair(entry,
true);
133 Fib::erase(shared_ptr<name_tree::Entry> nameTreeEntry)
135 nameTreeEntry->setFibEntry(shared_ptr<fib::Entry>());
143 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
findExactMatch(prefix);
144 if (static_cast<bool>(nameTreeEntry)) {
145 this->
erase(nameTreeEntry);
152 shared_ptr<name_tree::Entry> nameTreeEntry = m_nameTree.
get(entry);
153 if (static_cast<bool>(nameTreeEntry)) {
154 this->
erase(nameTreeEntry);
161 std::list<fib::Entry*> toErase;
165 shared_ptr<fib::Entry> entry = nte.getFibEntry();
166 entry->removeNextHop(face);
167 if (!entry->hasNextHops()) {
168 toErase.push_back(entry.get());
static bool predicate_NameTreeEntry_hasFibEntry(const name_tree::Entry &entry)
shared_ptr< fib::Entry > findLongestPrefixMatch(const Name &prefix) const
performs a longest prefix match
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< name_tree::Entry > get(const fib::Entry &fibEntry) const
get NameTree entry from attached FIB entry
const_iterator begin() const
returns an iterator pointing to the first FIB 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.
represents a Measurements entry
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< fib::Entry > findExactMatch(const Name &prefix) const
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.
shared_ptr< name_tree::Entry > findExactMatch(const Name &prefix) const
Exact match lookup for the given 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.
shared_ptr< fib::Entry > getFibEntry() const