limits: Introducing modularity for Interest limits
Now ndn::Limits object can be aggregated on a face/FIB entry. A
forwarding strategy module is responsible in creating an appropriate
implementation of the Interest limits module.
diff --git a/helper/ndn-stack-helper.cc b/helper/ndn-stack-helper.cc
index 72bec65..9c29bf9 100644
--- a/helper/ndn-stack-helper.cc
+++ b/helper/ndn-stack-helper.cc
@@ -254,6 +254,13 @@
if (m_limitsEnabled)
{
+ Ptr<Limits> limits = face->GetObject<Limits> ();
+ if (limits == 0)
+ {
+ NS_FATAL_ERROR ("Limits are enabled, but the selected forwarding strategy does not support limits. Please revise your scenario");
+ exit (1);
+ }
+
NS_LOG_INFO ("Limits are enabled");
Ptr<PointToPointNetDevice> p2p = DynamicCast<PointToPointNetDevice> (device);
if (p2p != 0)
@@ -272,7 +279,7 @@
NS_LOG_INFO ("MaxLimit: " << (int)(m_avgRtt.ToDouble (Time::S) * maxInterestPackets));
// Set max to BDP
- face->GetLimits ().SetMaxLimit (m_avgRtt.ToDouble (Time::S) * maxInterestPackets);
+ limits->SetMaxLimit (m_avgRtt.ToDouble (Time::S) * maxInterestPackets);
}
}