Merge feature branch 'feature/topology-reader-error-model'
diff --git a/model/fib/ndn-fib-entry.cc b/model/fib/ndn-fib-entry.cc
index 09b3ec6..eee3381 100644
--- a/model/fib/ndn-fib-entry.cc
+++ b/model/fib/ndn-fib-entry.cc
@@ -19,6 +19,7 @@
*/
#include "ndn-fib-entry.h"
+#include "ndn-fib.h"
#include "ns3/ndn-name.h"
#include "ns3/log.h"
@@ -169,6 +170,13 @@
return m_faces.get<i_nth> () [skip];
}
+Ptr<Fib>
+Entry::GetFib ()
+{
+ return m_fib;
+}
+
+
std::ostream& operator<< (std::ostream& os, const Entry &entry)
{
for (FaceMetricContainer::type::index<i_nth>::type::iterator metric =
diff --git a/model/fib/ndn-fib-entry.h b/model/fib/ndn-fib-entry.h
index 4b3f64c..0b1a6bc 100644
--- a/model/fib/ndn-fib-entry.h
+++ b/model/fib/ndn-fib-entry.h
@@ -43,6 +43,8 @@
class Name;
typedef Name NameComponents;
+class Fib;
+
namespace fib {
/**
@@ -246,8 +248,9 @@
* \brief Constructor
* \param prefix smart pointer to the prefix for the FIB entry
*/
- Entry (const Ptr<const Name> &prefix)
- : m_prefix (prefix)
+ Entry (Ptr<Fib> fib, const Ptr<const Name> &prefix)
+ : m_fib (fib)
+ , m_prefix (prefix)
, m_needsProbing (false)
{
}
@@ -308,10 +311,18 @@
m_faces.erase (face);
}
+ /**
+ * @brief Get pointer to access FIB, to which this entry is added
+ */
+ Ptr<Fib>
+ GetFib ();
+
private:
friend std::ostream& operator<< (std::ostream& os, const Entry &entry);
public:
+ Ptr<Fib> m_fib; ///< \brief FIB to which entry is added
+
Ptr<const Name> m_prefix; ///< \brief Prefix of the FIB entry
FaceMetricContainer::type m_faces; ///< \brief Indexed list of faces
diff --git a/model/fib/ndn-fib-impl.cc b/model/fib/ndn-fib-impl.cc
index 218502b..ccc4f10 100644
--- a/model/fib/ndn-fib-impl.cc
+++ b/model/fib/ndn-fib-impl.cc
@@ -112,9 +112,9 @@
{
if (result.second)
{
- Ptr<EntryImpl> newEntry = Create<EntryImpl> (prefix);
- newEntry->SetTrie (result.first);
- result.first->set_payload (newEntry);
+ Ptr<EntryImpl> newEntry = Create<EntryImpl> (this, prefix);
+ newEntry->SetTrie (result.first);
+ result.first->set_payload (newEntry);
}
super::modify (result.first,
diff --git a/model/fib/ndn-fib-impl.h b/model/fib/ndn-fib-impl.h
index 57d7d50..3054420 100644
--- a/model/fib/ndn-fib-impl.h
+++ b/model/fib/ndn-fib-impl.h
@@ -40,8 +40,8 @@
ndnSIM::counting_policy_traits
> trie;
- EntryImpl (const Ptr<const Name> &prefix)
- : Entry (prefix)
+ EntryImpl (Ptr<Fib> fib, const Ptr<const Name> &prefix)
+ : Entry (fib, prefix)
, item_ (0)
{
}