model: Finalizing implementation of FaceMetric::Status tracing
Adding test case (ndnSIM-fib-entry), which can be used as an example how
to set up tracing.
diff --git a/model/fib/ndn-fib-entry.h b/model/fib/ndn-fib-entry.h
index 57e8916..93fa2aa 100644
--- a/model/fib/ndn-fib-entry.h
+++ b/model/fib/ndn-fib-entry.h
@@ -26,6 +26,7 @@
#include "ns3/ndn-face.h"
#include "ns3/ndn-name-components.h"
#include "ns3/ndn-limits.h"
+#include "ns3/traced-value.h"
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/tag.hpp>
@@ -112,7 +113,7 @@
void
SetStatus (Status status)
{
- m_status = status;
+ m_status.Set (status);
}
/**
@@ -151,13 +152,22 @@
m_realDelay = realDelay;
}
+ /**
+ * @brief Get direct access to status trace
+ */
+ TracedValue<Status> &
+ GetStatusTrace ()
+ {
+ return m_status;
+ }
+
private:
friend std::ostream& operator<< (std::ostream& os, const FaceMetric &metric);
private:
Ptr<Face> m_face; ///< Face
- Status m_status; ///< \brief Status of the next hop:
+ TracedValue<Status> m_status; ///< \brief Status of the next hop:
///< - NDN_FIB_GREEN
///< - NDN_FIB_YELLOW
///< - NDN_FIB_RED
diff --git a/model/fw/green-yellow-red.cc b/model/fw/green-yellow-red.cc
index 09f3199..e5d1eae 100644
--- a/model/fw/green-yellow-red.cc
+++ b/model/fw/green-yellow-red.cc
@@ -105,6 +105,19 @@
}
void
+GreenYellowRed::WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry)
+{
+ super::WillEraseTimedOutPendingInterest (pitEntry);
+
+ for (ndn::pit::Entry::out_container::iterator face = pitEntry->GetOutgoing ().begin ();
+ face != pitEntry->GetOutgoing ().end ();
+ face ++)
+ {
+ pitEntry->GetFibEntry ()->UpdateStatus (face->m_face, fib::FaceMetric::NDN_FIB_YELLOW);
+ }
+}
+
+void
GreenYellowRed::DidReceiveValidNack (Ptr<Face> inFace,
uint32_t nackCode,
Ptr<const InterestHeader> header,
diff --git a/model/fw/green-yellow-red.h b/model/fw/green-yellow-red.h
index 371f7fd..e82c93b 100644
--- a/model/fw/green-yellow-red.h
+++ b/model/fw/green-yellow-red.h
@@ -47,13 +47,16 @@
Ptr<const InterestHeader> header,
Ptr<const Packet> origPacket,
Ptr<pit::Entry> pitEntry);
+
+ virtual void
+ WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry);
+
virtual void
DidReceiveValidNack (Ptr<Face> incomingFace,
uint32_t nackCode,
Ptr<const InterestHeader> header,
Ptr<const Packet> origPacket,
Ptr<pit::Entry> pitEntry);
-
private:
typedef Nacks super;
};