A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
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
:
42
RttHistory
(
SequenceNumber32
s, uint32_t c,
Time
t);
43
RttHistory
(
const
RttHistory
& h);
// Copy constructor
44
public
:
45
SequenceNumber32
seq
;
// First sequence number in packet sent
46
uint32_t
count
;
// Number of bytes sent
47
Time
time
;
// Time this one was sent
48
bool
retx
;
// True if this has been retransmitted
49
};
50
51
typedef
std::deque<RttHistory>
RttHistory_t
;
52
58
class
RttEstimator
:
public
Object
{
59
public
:
60
static
TypeId
GetTypeId
(
void
);
61
62
RttEstimator
();
63
RttEstimator
(
const
RttEstimator
&);
64
65
virtual
~RttEstimator
();
66
67
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
68
74
virtual
void
SentSeq
(
SequenceNumber32
seq, uint32_t size);
75
81
virtual
Time
AckSeq
(
SequenceNumber32
ackSeq);
82
86
virtual
void
ClearSent
();
87
92
virtual
void
Measurement
(
Time
t) = 0;
93
98
virtual
Time
RetransmitTimeout
() = 0;
99
100
virtual
Ptr<RttEstimator>
Copy
()
const
= 0;
101
105
virtual
void
IncreaseMultiplier
();
106
110
virtual
void
ResetMultiplier
();
111
115
virtual
void
Reset
();
116
121
void
SetMinRto
(
Time
minRto);
122
127
Time
GetMinRto
(
void
)
const
;
128
133
void
SetCurrentEstimate
(
Time
estimate);
134
139
Time
GetCurrentEstimate
(
void
)
const
;
140
141
private
:
142
SequenceNumber32
m_next
;
// Next expected sequence to be sent
143
RttHistory_t
m_history
;
// List of sent packet
144
uint16_t
m_maxMultiplier
;
145
Time
m_initialEstimatedRtt
;
146
147
protected
:
148
Time
m_currentEstimatedRtt
;
// Current estimate
149
Time
m_minRto
;
// minimum value of the timeout
150
uint32_t
m_nSamples
;
// Number of samples
151
uint16_t
m_multiplier
;
// RTO Multiplier
152
};
153
164
class
RttMeanDeviation
:
public
RttEstimator
{
165
public
:
166
static
TypeId
GetTypeId
(
void
);
167
168
RttMeanDeviation
();
169
170
RttMeanDeviation
(
const
RttMeanDeviation
&);
171
172
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
173
178
void
Measurement
(
Time
measure);
179
184
Time
RetransmitTimeout
();
185
186
Ptr<RttEstimator>
Copy
()
const
;
187
191
void
Reset
();
192
197
void
Gain
(
double
g);
198
199
private
:
200
double
m_gain
;
// Filter gain
201
Time
m_variance
;
// Current variance
202
};
203
}
// namespace ns3
204
205
#endif
/* RTT_ESTIMATOR_H */
src
internet
model
rtt-estimator.h
Generated on Tue May 14 2013 11:08:23 for ns-3 by
1.8.1.2