limits: Reverting back renaming of SimpleLimits strategy
diff --git a/model/fw/simple-window-limits.cc b/model/fw/simple-limits.cc
similarity index 68%
rename from model/fw/simple-window-limits.cc
rename to model/fw/simple-limits.cc
index 8939fa9..7880194 100644
--- a/model/fw/simple-window-limits.cc
+++ b/model/fw/simple-limits.cc
@@ -18,7 +18,7 @@
* Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
*/
-#include "simple-window-limits.h"
+#include "simple-limits.h"
#include "ns3/ndn-l3-protocol.h"
#include "ns3/ndn-interest-header.h"
@@ -32,23 +32,23 @@
namespace ndn {
namespace fw {
-template class SimpleWindowLimits<BestRoute>;
-typedef SimpleWindowLimits<BestRoute> SimpleLimitsBestRoute;
+template class SimpleLimits<BestRoute>;
+typedef SimpleLimits<BestRoute> SimpleLimitsBestRoute;
NS_OBJECT_ENSURE_REGISTERED (SimpleLimitsBestRoute);
-template class SimpleWindowLimits<Flooding>;
-typedef SimpleWindowLimits<Flooding> SimpleLimitsFlooding;
+template class SimpleLimits<Flooding>;
+typedef SimpleLimits<Flooding> SimpleLimitsFlooding;
NS_OBJECT_ENSURE_REGISTERED (SimpleLimitsFlooding);
-template class SimpleWindowLimits<SmartFlooding>;
-typedef SimpleWindowLimits<SmartFlooding> SimpleLimitsSmartFlooding;
+template class SimpleLimits<SmartFlooding>;
+typedef SimpleLimits<SmartFlooding> SimpleLimitsSmartFlooding;
NS_OBJECT_ENSURE_REGISTERED (SimpleLimitsSmartFlooding);
#ifdef DOXYGEN
-class SimpleWindowLimitsBestRoute : public SimpleWindowLimits<BestRoute> { };
-class SimpleWindowLimitsFlooding : public SimpleWindowLimits<Flooding> { };
-class SimpleWindowLimitsSmartFlooding : public SimpleWindowLimits<SmartFlooding> { };
+class SimpleLimitsBestRoute : public SimpleLimits<BestRoute> { };
+class SimpleLimitsFlooding : public SimpleLimits<Flooding> { };
+class SimpleLimitsSmartFlooding : public SimpleLimits<SmartFlooding> { };
#endif
diff --git a/model/fw/simple-window-limits.h b/model/fw/simple-limits.h
similarity index 88%
rename from model/fw/simple-window-limits.h
rename to model/fw/simple-limits.h
index 7e844ba..dd597c0 100644
--- a/model/fw/simple-window-limits.h
+++ b/model/fw/simple-limits.h
@@ -19,8 +19,8 @@
*/
-#ifndef NDNSIM_SIMPLE_WINDOW_LIMITS_H
-#define NDNSIM_SIMPLE_WINDOW_LIMITS_H
+#ifndef NDNSIM_SIMPLE_LIMITS_H
+#define NDNSIM_SIMPLE_LIMITS_H
#include "ns3/event-id.h"
#include "ns3/ndn-pit.h"
@@ -41,7 +41,7 @@
* \brief Strategy implementing per-FIB entry limits
*/
template<class Parent>
-class SimpleWindowLimits :
+class SimpleLimits :
public Parent
{
private:
@@ -54,7 +54,7 @@
/**
* @brief Default constructor
*/
- SimpleWindowLimits ()
+ SimpleLimits ()
{ }
virtual void
@@ -88,16 +88,16 @@
template<class Parent>
TypeId
-SimpleWindowLimits<Parent>::GetTypeId (void)
+SimpleLimits<Parent>::GetTypeId (void)
{
- static TypeId tid = TypeId ((super::GetTypeId ().GetName ()+"::SimpleWindowLimits").c_str ())
+ static TypeId tid = TypeId ((super::GetTypeId ().GetName ()+"::SimpleLimits").c_str ())
.SetGroupName ("Ndn")
.template SetParent <super> ()
- .template AddConstructor <SimpleWindowLimits> ()
+ .template AddConstructor <SimpleLimits> ()
.template AddAttribute ("Limit", "Limit type to be used (e.g., ns3::ndn::Limits::Window or ns3::ndn::Limits::Rate)",
StringValue ("ns3::ndn::Limits::Window"),
- MakeStringAccessor (&SimpleWindowLimits<Parent>::m_limitType),
+ MakeStringAccessor (&SimpleLimits<Parent>::m_limitType),
MakeStringChecker ())
;
return tid;
@@ -105,7 +105,7 @@
template<class Parent>
bool
-SimpleWindowLimits<Parent>::TrySendOutInterest (Ptr<Face> inFace,
+SimpleLimits<Parent>::TrySendOutInterest (Ptr<Face> inFace,
Ptr<Face> outFace,
Ptr<const InterestHeader> header,
Ptr<const Packet> origPacket,
@@ -146,7 +146,7 @@
template<class Parent>
void
-SimpleWindowLimits<Parent>::WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry)
+SimpleLimits<Parent>::WillEraseTimedOutPendingInterest (Ptr<pit::Entry> pitEntry)
{
// NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
@@ -164,7 +164,7 @@
template<class Parent>
void
-SimpleWindowLimits<Parent>::WillSatisfyPendingInterest (Ptr<Face> inFace,
+SimpleLimits<Parent>::WillSatisfyPendingInterest (Ptr<Face> inFace,
Ptr<pit::Entry> pitEntry)
{
// NS_LOG_FUNCTION (this << pitEntry->GetPrefix ());
@@ -184,4 +184,4 @@
} // namespace ndn
} // namespace ns3
-#endif // NDNSIM_SIMPLE_WINDOW_LIMITS_H
+#endif // NDNSIM_SIMPLE_LIMITS_H
diff --git a/utils/ndn-limits-rate.cc b/utils/ndn-limits-rate.cc
index 1bf0af4..27e2f0d 100644
--- a/utils/ndn-limits-rate.cc
+++ b/utils/ndn-limits-rate.cc
@@ -64,6 +64,18 @@
}
}
+void
+LimitsRate::SetLimits (double rate, double delay)
+{
+ super::SetLimits (rate, delay);
+
+ // maximum allowed burst
+ m_bucketMax = GetMaxRate () * GetMaxDelay ();
+
+ // amount of packets allowed every second (leak rate)
+ m_bucketLeak = GetMaxRate ();
+}
+
void
LimitsRate::UpdateCurrentLimit (double limit)
diff --git a/utils/ndn-limits-rate.h b/utils/ndn-limits-rate.h
index 15344c6..7da0f1a 100644
--- a/utils/ndn-limits-rate.h
+++ b/utils/ndn-limits-rate.h
@@ -54,16 +54,7 @@
~LimitsRate () { }
virtual void
- SetLimits (double rate, double delay)
- {
- super::SetLimits (rate, delay);
-
- // maximum allowed burst
- m_bucketMax = GetMaxRate () * GetMaxDelay ();
-
- // amount of packets allowed every second (leak rate)
- m_bucketLeak = GetMaxRate ();
- }
+ SetLimits (double rate, double delay);
/**
* @brief Check if Interest limit is reached (token bucket is not empty)
@@ -84,12 +75,13 @@
ReturnLimit ();
/**
- * @brief Update current leak ratio and maximum burst
+ * @brief Update normalized amount that should be leaked every second (token bucket leak rate) and leak rate
*/
virtual void
UpdateCurrentLimit (double limit);
/**
+ * @brief Get normalized amount that should be leaked every second (token bucket leak rate)
*/
virtual double
GetCurrentLimit () const