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/utils/ndn-limits.h b/utils/ndn-limits.h
index 181059a..14aec50 100644
--- a/utils/ndn-limits.h
+++ b/utils/ndn-limits.h
@@ -23,7 +23,6 @@
#include "ns3/ptr.h"
#include "ns3/object.h"
-#include "ns3/nstime.h"
#include "ns3/traced-value.h"
namespace ns3 {
@@ -39,33 +38,38 @@
public:
static TypeId
GetTypeId ();
-
- /**
- * \brief Constructor
- * \param prefix smart pointer to the prefix for the FIB entry
- */
+
Limits ()
: m_maxLimit (-1)
, m_curMaxLimit (0)
- , m_outstanding (0)
{ }
-
+
+ virtual
+ ~Limits () {}
+
/**
* @brief Set limit for the number of outstanding interests
*/
- void
- SetMaxLimit (double max);
+ virtual void
+ SetMaxLimit (double max)
+ {
+ m_maxLimit = max;
+ m_curMaxLimit = max;
+ }
/**
* @brief Get limit for the number of outstanding interests
*/
- double
- GetMaxLimit () const;
+ virtual double
+ GetMaxLimit () const
+ {
+ return m_maxLimit;
+ }
/**
* @brief Check whether limits are enabled or not
*/
- inline bool
+ virtual inline bool
IsEnabled () const
{
return m_maxLimit > 0.0;
@@ -85,7 +89,7 @@
{
return m_curMaxLimit;
}
-
+
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
@@ -93,20 +97,12 @@
/**
* @brief Check if new interest can be send out, if yes, number of outstanding will be increased
*/
- bool
- IsBelowLimit ();
-
- /**
- * @brief Remove outstanding interests
- */
- void
- RemoveOutstanding ();
+ virtual bool
+ IsBelowLimit () = 0;
-public:
+protected:
double m_maxLimit;
-
TracedValue< double > m_curMaxLimit;
- TracedValue< double > m_outstanding;
};