table: shortcuts between FIB, PIT, Measurements, StrategyChoice
refs #1202
Change-Id: Ie63ab792e840de7e0889d385d3e8ea8a112cb7e5
diff --git a/daemon/table/name-tree.cpp b/daemon/table/name-tree.cpp
index 430ed3c..0820683 100644
--- a/daemon/table/name-tree.cpp
+++ b/daemon/table/name-tree.cpp
@@ -203,6 +203,19 @@
return shared_ptr<name_tree::Entry>();
}
+shared_ptr<name_tree::Entry>
+NameTree::findLongestPrefixMatch(shared_ptr<name_tree::Entry> entry,
+ const name_tree::EntrySelector& entrySelector) const
+{
+ while (static_cast<bool>(entry))
+ {
+ if (entrySelector(*entry))
+ return entry;
+ entry = entry->getParent();
+ }
+ return shared_ptr<name_tree::Entry>();
+}
+
// return {false: this entry is not empty, true: this entry is empty and erased}
bool
NameTree::eraseEntryIfEmpty(shared_ptr<name_tree::Entry> entry)