32 #include "ns3/simulator.h" 33 #include "ns3/double.h" 34 #include "ns3/integer.h" 35 #include "ns3/uinteger.h" 38 NS_LOG_COMPONENT_DEFINE(
"ndn.RttEstimator");
50 TypeId(
"ns3::ndn::RttEstimator")
52 .AddAttribute(
"MaxMultiplier",
"Maximum RTO Multiplier", UintegerValue(64),
53 MakeUintegerAccessor(&RttEstimator::m_maxMultiplier),
54 MakeUintegerChecker<uint16_t>())
55 .AddAttribute(
"InitialEstimation",
"Initial RTT estimation", TimeValue(Seconds(1.0)),
56 MakeTimeAccessor(&RttEstimator::m_initialEstimatedRtt), MakeTimeChecker())
57 .AddAttribute(
"MinRTO",
"Minimum retransmit timeout value",
63 .AddAttribute(
"MaxRTO",
"Maximum retransmit timeout value", TimeValue(Seconds(200.0)),
72 NS_LOG_FUNCTION(
this << minRto);
84 NS_LOG_FUNCTION(
this << maxRto);
96 NS_LOG_FUNCTION(
this << estimate);
112 NS_LOG_FUNCTION(
this);
121 NS_LOG_FUNCTION(
this);
132 NS_LOG_FUNCTION(
this);
137 ObjectBase::ConstructSelf(AttributeConstructionList());
146 , m_maxMultiplier(c.m_maxMultiplier)
147 , m_initialEstimatedRtt(c.m_initialEstimatedRtt)
155 NS_LOG_FUNCTION(
this);
160 NS_LOG_FUNCTION(
this);
172 NS_LOG_FUNCTION(
this << seq << size);
176 m_next = seq + SequenceNumber32(size);
180 if ((seq >= i->seq) && (seq < (i->seq + SequenceNumber32(i->count)))) {
183 if ((seq + SequenceNumber32(size)) > m_next) {
184 m_next = seq + SequenceNumber32(size);
185 i->count = ((seq + SequenceNumber32(size)) - i->seq);
196 NS_LOG_FUNCTION(
this << ackSeq);
200 Time m = Seconds(0.0);
204 if (!h.
retx && ackSeq >= (h.
seq + SequenceNumber32(h.
count))) {
205 m = Simulator::Now() - h.
time;
212 if ((h.
seq + SequenceNumber32(h.
count)) > ackSeq)
222 NS_LOG_FUNCTION(
this);
231 NS_LOG_FUNCTION(
this);
233 NS_LOG_DEBUG(
"Multiplier increased to " <<
m_multiplier);
239 NS_LOG_FUNCTION(
this);
246 NS_LOG_FUNCTION(
this);
RttHistory(SequenceNumber32 s, uint32_t c, Time t)
virtual void SentSeq(SequenceNumber32 seq, uint32_t size)
Note that a particular sequence has been sent.
Copyright (c) 2011-2015 Regents of the University of California.
Time GetCurrentEstimate(void) const
gets the current RTT estimate.
static TypeId GetTypeId(void)
void SetMaxRto(Time maxRto)
Sets the Maximum RTO.
NS_OBJECT_ENSURE_REGISTERED(GlobalRouter)
virtual void Measurement(Time t)=0
Add a new measurement to the estimator.
virtual Time AckSeq(SequenceNumber32 ackSeq)
Note that a particular ack sequence has been received.
virtual void Reset()
Resets the estimation to its initial state.
virtual void ClearSent()
Clear all history entries.
void SetMinRto(Time minRto)
Sets the Minimum RTO.
void SetCurrentEstimate(Time estimate)
Sets the current RTT estimate (forcefully).
Time GetMaxRto(void) const
Get the Maximum RTO.
virtual TypeId GetInstanceTypeId(void) const
virtual void IncreaseMultiplier()
Increase the estimation multiplier up to MaxMultiplier.
virtual void ResetMultiplier()
Resets the estimation multiplier to 1.
Copyright (c) 2011-2015 Regents of the University of California.
Base class for all RTT Estimators.
Helper class to store RTT measurements.
span_constexpr std::size_t size(span< T, Extent > const &spn)
Time m_currentEstimatedRtt
Time GetMinRto(void) const
Get the Minimum RTO.