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
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 */
ns3::ndn::RttEstimator::m_nSamples
uint32_t m_nSamples
Definition: ndn-rtt-estimator.hpp:182
ns3::ndn::RttEstimator
Base class for all RTT Estimators.
Definition: ndn-rtt-estimator.hpp:61
ns3::ndn::RttEstimator::m_multiplier
uint16_t m_multiplier
Definition: ndn-rtt-estimator.hpp:183
ns3::ndn::RttEstimator::m_maxRto
Time m_maxRto
Definition: ndn-rtt-estimator.hpp:181
ns3::ndn::RttHistory::count
uint32_t count
Definition: ndn-rtt-estimator.hpp:49
ns3
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-app-link-service.cpp:32
ns3::ndn::RttEstimator::m_history
RttHistory_t m_history
Definition: ndn-rtt-estimator.hpp:184
ns3::ndn::RttHistory::retx
bool retx
Definition: ndn-rtt-estimator.hpp:51
ns3::ndn::RttEstimator::m_currentEstimatedRtt
Time m_currentEstimatedRtt
Definition: ndn-rtt-estimator.hpp:179
ns3::ndn::RttHistory::time
Time time
Definition: ndn-rtt-estimator.hpp:50
ns3::ndn::RttHistory::seq
SequenceNumber32 seq
Definition: ndn-rtt-estimator.hpp:48
ns3::ndn::RttEstimator::~RttEstimator
virtual ~RttEstimator()
Definition: ndn-rtt-estimator.cpp:158
ns3::ndn::RttHistory::RttHistory
RttHistory(SequenceNumber32 s, uint32_t c, Time t)
Definition: ndn-rtt-estimator.cpp:106
ns3::ndn::RttEstimator::GetMinRto
Time GetMinRto(void) const
Get the Minimum RTO.
Definition: ndn-rtt-estimator.cpp:76
ns3::ndn::RttEstimator::RttEstimator
RttEstimator()
Definition: ndn-rtt-estimator.cpp:126
ns3::ndn::RttEstimator::GetCurrentEstimate
Time GetCurrentEstimate(void) const
gets the current RTT estimate.
Definition: ndn-rtt-estimator.cpp:100
ns3::ndn::RttEstimator::SentSeq
virtual void SentSeq(SequenceNumber32 seq, uint32_t size)
Note that a particular sequence has been sent.
Definition: ndn-rtt-estimator.cpp:170
ns3::ndn::RttEstimator::GetTypeId
static TypeId GetTypeId(void)
Definition: ndn-rtt-estimator.cpp:47
ns3::ndn::RttEstimator::Reset
virtual void Reset()
Resets the estimation to its initial state.
Definition: ndn-rtt-estimator.cpp:244
ns3::ndn::RttEstimator::RetransmitTimeout
virtual Time RetransmitTimeout()=0
Returns the estimated RTO.
ns3::ndn::RttEstimator::AckSeq
virtual Time AckSeq(SequenceNumber32 ackSeq)
Note that a particular ack sequence has been received.
Definition: ndn-rtt-estimator.cpp:194
ns3::ndn::RttEstimator::ClearSent
virtual void ClearSent()
Clear all history entries.
Definition: ndn-rtt-estimator.cpp:220
ns3::ndn::RttEstimator::m_minRto
Time m_minRto
Definition: ndn-rtt-estimator.hpp:180
ns3::ndn::RttEstimator::SetMaxRto
void SetMaxRto(Time maxRto)
Sets the Maximum RTO.
Definition: ndn-rtt-estimator.cpp:82
ns3::ndn::RttHistory
Helper class to store RTT measurements.
Definition: ndn-rtt-estimator.hpp:43
ns3::ndn::RttHistory_t
std::deque< RttHistory > RttHistory_t
Definition: ndn-rtt-estimator.hpp:54
ns3::ndn::RttEstimator::Measurement
virtual void Measurement(Time t)=0
Add a new measurement to the estimator.
ns3::ndn::RttEstimator::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Definition: ndn-rtt-estimator.cpp:164
ns3::ndn::RttEstimator::SetCurrentEstimate
void SetCurrentEstimate(Time estimate)
Sets the current RTT estimate (forcefully).
Definition: ndn-rtt-estimator.cpp:94
ns3::ndn::RttEstimator::Copy
virtual Ptr< RttEstimator > Copy() const =0
ns3::ndn::RttEstimator::GetMaxRto
Time GetMaxRto(void) const
Get the Maximum RTO.
Definition: ndn-rtt-estimator.cpp:88
ns3::ndn::RttEstimator::IncreaseMultiplier
virtual void IncreaseMultiplier()
Increase the estimation multiplier up to MaxMultiplier.
Definition: ndn-rtt-estimator.cpp:229
ns3::ndn::RttEstimator::SetMinRto
void SetMinRto(Time minRto)
Sets the Minimum RTO.
Definition: ndn-rtt-estimator.cpp:70
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34
ns3::ndn::RttEstimator::ResetMultiplier
virtual void ResetMultiplier()
Resets the estimation multiplier to 1.
Definition: ndn-rtt-estimator.cpp:237