31 #include "ns3/simulator.h"
32 #include "ns3/double.h"
33 #include "ns3/integer.h"
34 #include "ns3/uinteger.h"
48 .AddAttribute (
"MaxMultiplier",
49 "Maximum RTO Multiplier",
52 MakeUintegerChecker<uint16_t> ())
53 .AddAttribute (
"InitialEstimation",
54 "Initial RTT estimation",
58 .AddAttribute (
"MinRTO",
59 "Minimum retransmit timeout value",
94 : seq (s), count (c), time (t), retx (false)
100 : seq (h.seq), count (h.count), time (h.time), retx (h.retx)
108 : m_next (1), m_history (),
123 :
Object (c), m_next (c.m_next), m_history (c.m_history),
124 m_maxMultiplier (c.m_maxMultiplier),
125 m_initialEstimatedRtt (c.m_initialEstimatedRtt),
126 m_currentEstimatedRtt (c.m_currentEstimatedRtt), m_minRto (c.m_minRto),
127 m_nSamples (c.m_nSamples), m_multiplier (c.m_multiplier)
241 .AddConstructor<RttMeanDeviation> ()
242 .AddAttribute (
"Gain",
243 "Gain used in estimating the RTT, must be 0 < Gain < 1",
246 MakeDoubleChecker<double> ())
258 :
RttEstimator (c), m_gain (c.m_gain), m_variance (c.m_variance)
310 return CopyObject<RttMeanDeviation> (
this);
323 NS_ASSERT_MSG( (g > 0) && (g < 1),
"RttMeanDeviation: Gain must be less than 1 and greater than 0" );
Time m_currentEstimatedRtt
Current estimate.
Time m_variance
Current variance.
Simulation virtual time values and global simulation resolution.
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
static TypeId GetTypeId(void)
Get the type ID.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
RttHistory_t m_history
List of sent packet.
int64_t ToInteger(enum Unit unit) const
Get the Time value expressed in a particular unit.
double m_gain
Filter gain.
The "Mean--Deviation" RTT estimator, as discussed by Van Jacobson.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
bool retx
True if this has been retransmitted.
uint32_t count
Number of bytes sent.
static TypeId GetTypeId(void)
Get the type ID.
Time m_initialEstimatedRtt
Initial RTT estimation.
virtual TypeId GetInstanceTypeId(void) const
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
virtual Time EstimateRttFromSeq(SequenceNumber32 ackSeq)
Note that a particular ack sequence has been received.
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number
uint16_t m_multiplier
RTO Multiplier.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
uint16_t m_maxMultiplier
Maximum RTO Multiplier.
Time time
Time this one was sent.
virtual void ResetMultiplier()
Resets the estimation multiplier to 1.
Attribute for objects of type ns3::Time.
Time GetCurrentEstimate(void) const
gets the current RTT estimate.
Hold an unsigned integer type.
double ToDouble(enum Unit unit) const
Get the Time value expressed in a particular unit.
Base class for all RTT Estimators.
RttHistory(SequenceNumber32 s, uint32_t c, Time t)
Constructor - builds an RttHistory with the given parameters.
int64x64_t Abs(const int64x64_t &value)
Absolute value.
virtual void Measurement(Time t)=0
Add a new measurement to the estimator.
virtual void SentSeq(SequenceNumber32 seq, uint32_t size)
Note that a particular sequence has been sent.
void ConstructSelf(const AttributeConstructionList &attributes)
Time GetMinRto(void) const
Get the Minimum RTO.
uint32_t m_nSamples
Number of samples.
Time RetransmitTimeout()
Returns the estimated RTO.
void SetMinRto(Time minRto)
Sets the Minimum RTO.
Time m_minRto
minimum value of the timeout
virtual void Reset()
Resets the estimation to its initial state.
static Time Now(void)
Return the "current simulation time".
void Reset()
Resets the estimator.
virtual void IncreaseMultiplier()
Increase the estimation multiplier up to MaxMultiplier.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
static Time FromDouble(double value, enum Unit unit)
Create a Time equal to value in unit unit.
Ptr< RttEstimator > Copy() const
Copy object.
void Measurement(Time measure)
Add a new measurement to the estimator.
virtual TypeId GetInstanceTypeId(void) const
SequenceNumber32 m_next
Next expected sequence to be sent.
Helper class to store RTT measurements.
SequenceNumber32 seq
First sequence number in packet sent.
void SetCurrentEstimate(Time estimate)
Sets the current RTT estimate (forcefully).
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
static Time FromInteger(uint64_t value, enum Unit unit)
Create a Time equal to value in unit unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual void ClearSent()
Clear all history entries.
void Gain(double g)
Sets the estimator Gain.
a base class which provides memory management and object aggregation
Hold a floating point type.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)