Correcting bugs with cleaning timeouts in PIT/RIT/ContentStore

Removing RIT concept. Instead, keep track of nonces for each PIT entry.

Many changes in CcnxL3Protocol regarding Interest/Data handling (NACK
are not yet handled at all)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!! Remove when is not actual !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Code is not compiling !!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
diff --git a/model/ccnx-fib.cc b/model/ccnx-fib.cc
index 8daa034..9f23a83 100644
--- a/model/ccnx-fib.cc
+++ b/model/ccnx-fib.cc
@@ -36,6 +36,10 @@
 //#define NDN_DEBUG_OSPF	0
 //#define NDN_DEBUG_OSPF_NODES 0
 
+#include <boost/lambda/lambda.hpp>
+
+using namespace boost::lambda;
+
 //#define NDN_DUMP_FIB		0
 namespace ns3 {
 
@@ -51,48 +55,6 @@
   type;
 };
 
-struct ChangeStatus
-{
-  ChangeStatus (CcnxFibFaceMetric::Status status) : m_status (status) { }
-  void operator() (CcnxFibFaceMetric &entry)
-  {
-    entry.m_status = m_status;
-  }
-private:
-  CcnxFibFaceMetric::Status m_status;
-};
-
-struct ChangeMetric
-{
-  ChangeMetric (int32_t metric) : m_metric (metric) { }
-  void operator() (CcnxFibFaceMetric &entry)
-  {
-    entry.m_routingCost = m_metric;
-  }
-private:
-  int32_t m_metric;
-};
-
-// struct SearchByFace {
-//   /**
-//    * \brief To perform effective searches by CcnxFace
-//    */
-//   bool
-//   operator() (const CcnxFibFaceMetric &m, const Ptr<CcnxFace> &face) const
-//   {
-//     return *(m.m_face) < *face;
-//   } 
-
-//   /**
-//    * \brief To perform effective searches by CcnxFace
-//    */
-//   bool
-//   operator() (const Ptr<CcnxFace> &face, const CcnxFibFaceMetric &m) const
-//   {
-//     return *face < *(m.m_face);
-//   } 
-// };
-
 }
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
@@ -112,69 +74,63 @@
   return tid;
 }
 
+/////////////////////////////////////////////////////////////////////
+
 void
-CcnxFibFaceMetric::UpdateRtt::operator() (CcnxFibFaceMetric &entry)
+CcnxFibFaceMetric::UpdateRtt (const Time &rttSample)
 {
   // const Time & this->m_rttSample
   
   //update srtt and rttvar (RFC 2988)
-  if (entry.m_sRtt.IsZero ())
+  if (m_sRtt.IsZero ())
     {
       //first RTT measurement
-      NS_ASSERT_MSG (entry.m_rttVar.IsZero (), "SRTT is zero, but variation is not");
+      NS_ASSERT_MSG (m_rttVar.IsZero (), "SRTT is zero, but variation is not");
       
-      entry.m_sRtt = m_rttSample;
-      entry.m_rttVar = Time (entry.m_sRtt / 2.0);
+      m_sRtt = rttSample;
+      m_rttVar = Time (m_sRtt / 2.0);
     }
   else
     {
-      entry.m_rttVar = Time ((1 - NDN_RTO_BETA) * entry.m_rttVar + NDN_RTO_BETA * Abs(entry.m_sRtt - m_rttSample));
-      entry.m_sRtt = Time ((1 - NDN_RTO_ALPHA) * entry.m_sRtt + NDN_RTO_ALPHA * m_rttSample);
+      m_rttVar = Time ((1 - NDN_RTO_BETA) * m_rttVar + NDN_RTO_BETA * Abs(m_sRtt - rttSample));
+      m_sRtt = Time ((1 - NDN_RTO_ALPHA) * m_sRtt + NDN_RTO_ALPHA * rttSample);
     }
 }
 
+/////////////////////////////////////////////////////////////////////
+
 void
-CcnxFibEntry::UpdateStatus::operator () (CcnxFibEntry &entry)
+CcnxFibEntry::UpdateStatus (const CcnxFace &face, CcnxFibFaceMetric::Status status)
 {
-  CcnxFibFaceMetricByFace::type::iterator record = entry.m_faces.get<i_face> ().find (m_face);
-  NS_ASSERT_MSG (record != entry.m_faces.get<i_face> ().end (),
+  CcnxFibFaceMetricByFace::type::iterator record = m_faces.get<i_face> ().find (face);
+  NS_ASSERT_MSG (record != m_faces.get<i_face> ().end (),
                  "Update status can be performed only on existing faces of CcxnFibEntry");
 
-  entry.m_faces.modify (record, ChangeStatus (m_status));
+  m_faces.modify (record, _1->m_status = status);
 
   // reordering random access index same way as by metric index
-  entry.m_faces.get<i_nth> ().rearrange (entry.m_faces.get<i_metric> ().begin ());
+  m_faces.get<i_nth> ().rearrange (m_faces.get<i_metric> ().begin ());
 }
 
-void
-CcnxFibEntry::AddOrUpdateRoutingMetric::operator () (CcnxFibEntry &entry)
-{
-  NS_LOG_FUNCTION(this);
-  NS_ASSERT_MSG (m_face != NULL, "Trying to Add or Update NULL face");
+// void
+// CcnxFibEntry::AddOrUpdateRoutingMetric (Ptr<CcnxFace> face, int32_t metric)
+// {
+//   NS_LOG_FUNCTION(this);
+//   NS_ASSERT_MSG (m_face != NULL, "Trying to Add or Update NULL face");
 
-  CcnxFibFaceMetricByFace::type::iterator record = entry.m_faces.get<i_face> ().find (m_face);
-  if (record == entry.m_faces.get<i_face> ().end ())
-    {
-      entry.m_faces.insert (CcnxFibFaceMetric (m_face, m_metric));
-    }
-  else
-  {
-      entry.m_faces.modify (record, ChangeMetric (m_metric));
-    }
-  // reordering random access index same way as by metric index
-  entry.m_faces.get<i_nth> ().rearrange (entry.m_faces.get<i_metric> ().begin ());
-}
+//   CcnxFibFaceMetricByFace::type::iterator record = entry.m_faces.get<i_face> ().find (m_face);
+//   if (record == entry.m_faces.get<i_face> ().end ())
+//     {
+//       entry.m_faces.insert (CcnxFibFaceMetric (m_face, m_metric));
+//     }
+//   else
+//   {
+//       entry.m_faces.modify (record, ChangeMetric (m_metric));
+//     }
+//   // reordering random access index same way as by metric index
+//   entry.m_faces.get<i_nth> ().rearrange (entry.m_faces.get<i_metric> ().begin ());
+// }
 
-void
-CcnxFibEntry::UpdateFaceRtt::operator() (CcnxFibEntry &entry)
-{
-  CcnxFibFaceMetricContainer::type::iterator metric = entry.m_faces.find (m_face);
-  NS_ASSERT_MSG (metric != entry.m_faces.end (),
-                 "Something wrong. Cannot find entry for the face in FIB");
-
-  entry.m_faces.modify (metric, CcnxFibFaceMetric::UpdateRtt (m_rttSample));
-}
-    
 Ptr<CcnxFace>
 CcnxFibEntry::FindBestCandidate (int skip/* = 0*/) const
 {