Finalizing implementation of almost all events for forwarding strategy.
Implementing FwStats strategy that just calculates statistics for
pit entries and incoming/outgoing interests.
A serious testing is necessary to see if everything works.
diff --git a/model/pit/ccnx-pit-impl.cc b/model/pit/ccnx-pit-impl.cc
index c1867f0..2dfd39d 100644
--- a/model/pit/ccnx-pit-impl.cc
+++ b/model/pit/ccnx-pit-impl.cc
@@ -22,6 +22,7 @@
#include "ns3/ccnx-interest-header.h"
#include "ns3/ccnx-content-object-header.h"
+#include "ns3/ccnx-forwarding-strategy.h"
#include "ns3/log.h"
#include "ns3/string.h"
@@ -100,12 +101,23 @@
{
m_fib = GetObject<CcnxFib> ();
}
+ if (m_forwardingStrategy == 0)
+ {
+ m_forwardingStrategy = GetObject<CcnxForwardingStrategy> ();
+ }
+
+ CcnxPit::NotifyNewAggregate ();
}
void
CcnxPitImpl::DoDispose ()
{
super::clear ();
+
+ m_forwardingStrategy = 0;
+ m_fib = 0;
+
+ CcnxPit::DoDispose ();
}
void CcnxPitImpl::RescheduleCleaning ()
@@ -139,6 +151,7 @@
time_index::iterator entry = i_time.begin ();
if (entry->GetExpireTime () <= now) // is the record stale?
{
+ m_forwardingStrategy->WillErasePendingInterest (entry->to_iterator ()->payload ());
super::erase (entry->to_iterator ());
// // count ++;
}
@@ -166,6 +179,7 @@
{
NS_LOG_FUNCTION (header.GetName ());
NS_ASSERT_MSG (m_fib != 0, "FIB should be set");
+ NS_ASSERT_MSG (m_forwardingStrategy != 0, "Forwarding strategy should be set");
super::iterator foundItem, lastItem;
bool reachLast;
diff --git a/model/pit/ccnx-pit-impl.h b/model/pit/ccnx-pit-impl.h
index 692f78b..2f52604 100644
--- a/model/pit/ccnx-pit-impl.h
+++ b/model/pit/ccnx-pit-impl.h
@@ -113,6 +113,7 @@
private:
EventId m_cleanEvent;
Ptr<CcnxFib> m_fib; ///< \brief Link to FIB table
+ Ptr<CcnxForwardingStrategy> m_forwardingStrategy;
// indexes
typedef
diff --git a/model/pit/ccnx-pit.cc b/model/pit/ccnx-pit.cc
index 00e58c7..e07ccfd 100644
--- a/model/pit/ccnx-pit.cc
+++ b/model/pit/ccnx-pit.cc
@@ -45,11 +45,6 @@
static TypeId tid = TypeId ("ns3::private::CcnxPit")
.SetGroupName ("Ccnx")
.SetParent<Object> ()
- // .AddAttribute ("CleanupTimeout",
- // "Timeout defining how frequent RIT should be cleaned up",
- // StringValue ("1s"),
- // MakeTimeAccessor (&CcnxPit::GetCleanupTimeout, &CcnxPit::SetCleanupTimeout),
- // MakeTimeChecker ())
.AddAttribute ("PitEntryPruningTimout",
"Timeout for PIT entry to live after being satisfied. To make sure recently satisfied interest will not be satisfied again",
@@ -69,32 +64,4 @@
{
}
-// void CcnxPit::CleanExpired ()
-// {
-// DoCleanExpired ();
-
-// // schedule next event
-// m_cleanupEvent = Simulator::Schedule (m_cleanupTimeout,
-// &CcnxPit::CleanExpired, this);
-// }
-
-// void
-// CcnxPit::SetCleanupTimeout (const Time &timeout)
-// {
-// m_cleanupTimeout = timeout;
-// if (m_cleanupEvent.IsRunning ())
-// m_cleanupEvent.Cancel (); // cancel any scheduled cleanup events
-
-// // schedule even with new timeout
-// m_cleanupEvent = Simulator::Schedule (m_cleanupTimeout,
-// &CcnxPit::CleanExpired, this);
-// }
-
-// Time
-// CcnxPit::GetCleanupTimeout () const
-// {
-// return m_cleanupTimeout;
-// }
-
-
} // namespace ns3
diff --git a/model/pit/ccnx-pit.h b/model/pit/ccnx-pit.h
index 941b079..26cc626 100644
--- a/model/pit/ccnx-pit.h
+++ b/model/pit/ccnx-pit.h
@@ -147,35 +147,6 @@
static inline Ptr<CcnxPit>
GetCcnxPit (Ptr<Object> node);
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////
-
-private:
- // /**
- // * @brief Remove expired records from PIT
- // */
- // void
- // CleanExpired ();
-
- // /**
- // * \brief Set cleanup timeout
- // *
- // * Side effect: current clean up even (if any) will be cancelled and a new event started
- // *
- // * \param timeout cleanup timeout
- // */
- // void
- // SetCleanupTimeout (const Time &timeout);
-
- // /**
- // * \brief Get cleanup timeout
- // *
- // * \returns cleanup timeout
- // */
- // Time
- // GetCleanupTimeout () const;
-
protected:
// configuration variables. Check implementation of GetTypeId for more details
Time m_PitEntryPruningTimout;