NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ndn-rtt-estimator.h
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 // THIS IS A COPY OF rtt-estimator.h from internet module with minor modifications
25 
26 #ifndef NDN_RTT_ESTIMATOR_H
27 #define NDN_RTT_ESTIMATOR_H
28 
29 #include <deque>
30 #include "ns3/sequence-number.h"
31 #include "ns3/nstime.h"
32 #include "ns3/object.h"
33 
34 namespace ns3 {
35 
36 namespace ndn {
37 
43 class RttHistory {
44 public:
45  RttHistory (SequenceNumber32 s, uint32_t c, Time t);
46  RttHistory (const RttHistory& h); // Copy constructor
47 public:
48  SequenceNumber32 seq; // First sequence number in packet sent
49  uint32_t count; // Number of bytes sent
50  Time time; // Time this one was sent
51  bool retx; // True if this has been retransmitted
52 };
53 
54 typedef std::deque<RttHistory> RttHistory_t;
55 
61 class RttEstimator : public Object {
62 public:
63  static TypeId GetTypeId (void);
64 
65  RttEstimator();
66  RttEstimator (const RttEstimator&);
67 
68  virtual ~RttEstimator();
69 
70  virtual TypeId GetInstanceTypeId (void) const;
71 
77  virtual void SentSeq (SequenceNumber32 seq, uint32_t size);
78 
84  virtual Time AckSeq (SequenceNumber32 ackSeq);
85 
89  virtual void ClearSent ();
90 
95  virtual void Measurement (Time t) = 0;
96 
101  virtual Time RetransmitTimeout () = 0;
102 
103  virtual Ptr<RttEstimator> Copy () const = 0;
104 
108  virtual void IncreaseMultiplier ();
109 
113  virtual void ResetMultiplier ();
114 
118  virtual void Reset ();
119 
124  void SetMinRto (Time minRto);
125 
130  Time GetMinRto (void) const;
131 
136  void SetMaxRto (Time maxRto);
137 
142  Time GetMaxRto (void) const;
143 
148  void SetCurrentEstimate (Time estimate);
149 
154  Time GetCurrentEstimate (void) const;
155 
156 private:
157  SequenceNumber32 m_next; // Next expected sequence to be sent
158  uint16_t m_maxMultiplier;
159  Time m_initialEstimatedRtt;
160 
161 protected:
162  Time m_currentEstimatedRtt; // Current estimate
163  Time m_minRto; // minimum value of the timeout
164  Time m_maxRto; // maximum value of the timeout
165  uint32_t m_nSamples; // Number of samples
166  uint16_t m_multiplier; // RTO Multiplier
167  RttHistory_t m_history; // List of sent packet
168 };
169 
170 } // namespace ndn
171 
172 } // namespace ns3
173 
174 #endif /* RTT_ESTIMATOR_H */
virtual Time RetransmitTimeout()=0
Returns the estimated RTO.
void SetCurrentEstimate(Time estimate)
Sets the current RTT estimate (forcefully).
virtual void SentSeq(SequenceNumber32 seq, uint32_t size)
Note that a particular sequence has been sent.
virtual void ClearSent()
Clear all history entries.
Time GetMaxRto(void) const
Get the Maximum RTO.
Helper class to store RTT measurements.
Time GetCurrentEstimate(void) const
gets the current RTT estimate.
void SetMinRto(Time minRto)
Sets the Minimum RTO.
virtual void Reset()
Resets the estimation to its initial state.
Base class for all RTT Estimators.
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 IncreaseMultiplier()
Increase the estimation multiplier up to MaxMultiplier.
void SetMaxRto(Time maxRto)
Sets the Maximum RTO.
virtual void ResetMultiplier()
Resets the estimation multiplier to 1.
Time GetMinRto(void) const
Get the Minimum RTO.