NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn-rtt-estimator.hpp
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 // 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
64  GetTypeId(void);
65 
66  RttEstimator();
67  RttEstimator(const RttEstimator&);
68 
69  virtual ~RttEstimator();
70 
71  virtual TypeId
72  GetInstanceTypeId(void) const;
73 
79  virtual void
80  SentSeq(SequenceNumber32 seq, uint32_t size);
81 
87  virtual Time
88  AckSeq(SequenceNumber32 ackSeq);
89 
93  virtual void
94  ClearSent();
95 
100  virtual void
101  Measurement(Time t) = 0;
102 
107  virtual Time
108  RetransmitTimeout() = 0;
109 
110  virtual Ptr<RttEstimator>
111  Copy() const = 0;
112 
116  virtual void
118 
122  virtual void
123  ResetMultiplier();
124 
128  virtual void
129  Reset();
130 
135  void
136  SetMinRto(Time minRto);
137 
142  Time
143  GetMinRto(void) const;
144 
149  void
150  SetMaxRto(Time maxRto);
151 
156  Time
157  GetMaxRto(void) const;
158 
163  void
164  SetCurrentEstimate(Time estimate);
165 
170  Time
171  GetCurrentEstimate(void) const;
172 
173 private:
174  SequenceNumber32 m_next; // Next expected sequence to be sent
175  uint16_t m_maxMultiplier;
176  Time m_initialEstimatedRtt;
177 
178 protected:
179  Time m_currentEstimatedRtt; // Current estimate
180  Time m_minRto; // minimum value of the timeout
181  Time m_maxRto; // maximum value of the timeout
182  uint32_t m_nSamples; // Number of samples
183  uint16_t m_multiplier; // RTO Multiplier
184  RttHistory_t m_history; // List of sent packet
185 };
186 
187 } // namespace ndn
188 
189 } // namespace ns3
190 
191 #endif /* RTT_ESTIMATOR_H */
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.
virtual Time RetransmitTimeout()=0
Returns the estimated RTO.
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.
virtual Ptr< RttEstimator > Copy() const =0
void SetCurrentEstimate(Time estimate)
Sets the current RTT estimate (forcefully).
Time GetMaxRto(void) const
Get the Maximum RTO.
std::deque< RttHistory > RttHistory_t
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.
Time GetMinRto(void) const
Get the Minimum RTO.