model: Extending FIB and PIT interface to include Find call to search for exact match of FIB and PIT entry
diff --git a/model/fib/ndn-fib-impl.cc b/model/fib/ndn-fib-impl.cc
index 1e0f04f..218502b 100644
--- a/model/fib/ndn-fib-impl.cc
+++ b/model/fib/ndn-fib-impl.cc
@@ -83,6 +83,17 @@
return item->payload ();
}
+Ptr<fib::Entry>
+FibImpl::Find (const Name &prefix)
+{
+ super::iterator item = super::find_exact (prefix);
+
+ if (item == super::end ())
+ return 0;
+ else
+ return item->payload ();
+}
+
Ptr<Entry>
FibImpl::Add (const Name &prefix, Ptr<Face> face, int32_t metric)
diff --git a/model/fib/ndn-fib-impl.h b/model/fib/ndn-fib-impl.h
index 0755b35..57d7d50 100644
--- a/model/fib/ndn-fib-impl.h
+++ b/model/fib/ndn-fib-impl.h
@@ -87,6 +87,9 @@
virtual Ptr<Entry>
LongestPrefixMatch (const Interest &interest);
+
+ virtual Ptr<fib::Entry>
+ Find (const Name &prefix);
virtual Ptr<Entry>
Add (const Name &prefix, Ptr<Face> face, int32_t metric);
diff --git a/model/fib/ndn-fib.h b/model/fib/ndn-fib.h
index 6e21214..490cdfd 100644
--- a/model/fib/ndn-fib.h
+++ b/model/fib/ndn-fib.h
@@ -65,6 +65,15 @@
*/
virtual Ptr<fib::Entry>
LongestPrefixMatch (const Interest &interest) = 0;
+
+ /**
+ * @brief Get FIB entry for the prefix (exact match)
+ *
+ * @param prefix Name for FIB entry
+ * @returns If entry is found, a valid iterator (Ptr<fib::Entry>) will be returned. Otherwise End () (==0)
+ */
+ virtual Ptr<fib::Entry>
+ Find (const Name &prefix) = 0;
/**
* \brief Add or update FIB entry