A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
rtt-estimator.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 //
3 // Copyright (c) 2006 Georgia Tech Research Corporation
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License version 2 as
7 // published by the Free Software Foundation;
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 //
18 // Author: Rajib Bhattacharjea<raj.b@gatech.edu>
19 //
20 
21 // Georgia Tech Network Simulator - Round Trip Time Estimation Class
22 // George F. Riley. Georgia Tech, Spring 2002
23 
24 
25 #ifndef RTT_ESTIMATOR_H
26 #define RTT_ESTIMATOR_H
27 
28 #include <deque>
29 #include "ns3/sequence-number.h"
30 #include "ns3/nstime.h"
31 #include "ns3/object.h"
32 
33 namespace ns3 {
34 
40 class RttHistory {
41 public:
48  RttHistory (SequenceNumber32 s, uint32_t c, Time t);
53  RttHistory (const RttHistory& h); // Copy constructor
54 public:
56  uint32_t count;
58  bool retx;
59 };
60 
62 typedef std::deque<RttHistory> RttHistory_t;
63 
69 class RttEstimator : public Object {
70 public:
75  static TypeId GetTypeId (void);
76 
77  RttEstimator();
82  RttEstimator (const RttEstimator& r);
83 
84  virtual ~RttEstimator();
85 
86  virtual TypeId GetInstanceTypeId (void) const;
87 
93  virtual void SentSeq (SequenceNumber32 seq, uint32_t size);
94 
100  virtual Time AckSeq (SequenceNumber32 ackSeq);
101 
105  virtual void ClearSent ();
106 
111  virtual void Measurement (Time t) = 0;
112 
117  virtual Time RetransmitTimeout () = 0;
118 
123  virtual Ptr<RttEstimator> Copy () const = 0;
124 
128  virtual void IncreaseMultiplier ();
129 
133  virtual void ResetMultiplier ();
134 
138  virtual void Reset ();
139 
144  void SetMinRto (Time minRto);
145 
150  Time GetMinRto (void) const;
151 
156  void SetCurrentEstimate (Time estimate);
157 
162  Time GetCurrentEstimate (void) const;
163 
164 private:
167  uint16_t m_maxMultiplier;
169 
170 protected:
173  uint32_t m_nSamples;
174  uint16_t m_multiplier;
175 };
176 
188 public:
193  static TypeId GetTypeId (void);
194 
195  RttMeanDeviation ();
196 
202 
203  virtual TypeId GetInstanceTypeId (void) const;
204 
209  void Measurement (Time measure);
210 
216 
217  Ptr<RttEstimator> Copy () const;
218 
222  void Reset ();
223 
228  void Gain (double g);
229 
230 private:
231  double m_gain;
233 };
234 } // namespace ns3
235 
236 #endif /* RTT_ESTIMATOR_H */
Time m_currentEstimatedRtt
Current estimate.
Time m_variance
Current variance.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
virtual Ptr< RttEstimator > Copy() const =0
Copy object.
static TypeId GetTypeId(void)
Get the type ID.
RttHistory_t m_history
List of sent packet.
double m_gain
Filter gain.
virtual Time RetransmitTimeout()=0
Returns the estimated RTO.
The "Mean--Deviation" RTT estimator, as discussed by Van Jacobson.
bool retx
True if this has been retransmitted.
Definition: rtt-estimator.h:58
uint32_t count
Number of bytes sent.
Definition: rtt-estimator.h:56
static TypeId GetTypeId(void)
Get the type ID.
Time m_initialEstimatedRtt
Initial RTT estimation.
virtual TypeId GetInstanceTypeId(void) const
virtual ~RttEstimator()
uint16_t m_multiplier
RTO Multiplier.
uint16_t m_maxMultiplier
Maximum RTO Multiplier.
Time time
Time this one was sent.
Definition: rtt-estimator.h:57
virtual void ResetMultiplier()
Resets the estimation multiplier to 1.
Time GetCurrentEstimate(void) const
gets the current RTT estimate.
Ptr< SampleEmitter > s
Base class for all RTT Estimators.
Definition: rtt-estimator.h:69
RttHistory(SequenceNumber32 s, uint32_t c, Time t)
Constructor - builds an RttHistory with the given parameters.
std::deque< RttHistory > RttHistory_t
Container for RttHistory objects.
Definition: rtt-estimator.h:62
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.
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.
void Reset()
Resets the estimator.
virtual void IncreaseMultiplier()
Increase the estimation multiplier up to MaxMultiplier.
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.
Definition: rtt-estimator.h:40
SequenceNumber32 seq
First sequence number in packet sent.
Definition: rtt-estimator.h:55
void SetCurrentEstimate(Time estimate)
Sets the current RTT estimate (forcefully).
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
Definition: object.h:64
a unique identifier for an interface.
Definition: type-id.h:49
virtual Time AckSeq(SequenceNumber32 ackSeq)
Note that a particular ack sequence has been received.