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
72
virtual
void
SentSeq
(
SequenceNumber32
seq, uint32_t size);
73
79
virtual
Time
AckSeq
(
SequenceNumber32
ackSeq);
80
84
virtual
void
ClearSent
();
85
90
virtual
void
Measurement
(
Time
t) = 0;
91
96
virtual
Time
RetransmitTimeout
() = 0;
97
98
virtual
Ptr<RttEstimator>
Copy
()
const
= 0;
99
103
virtual
void
IncreaseMultiplier
();
104
108
virtual
void
ResetMultiplier
();
109
113
virtual
void
Reset
();
114
119
void
SetMinRto
(
Time
minRto);
120
125
Time
GetMinRto
(
void
)
const
;
126
131
void
SetCurrentEstimate
(
Time
estimate);
132
137
Time
GetCurrentEstimate
(
void
)
const
;
138
139
private
:
140
SequenceNumber32
m_next
;
// Next expected sequence to be sent
141
RttHistory_t
m_history
;
// List of sent packet
142
uint16_t
m_maxMultiplier
;
143
Time
m_initialEstimatedRtt
;
144
145
protected
:
146
Time
m_currentEstimatedRtt
;
// Current estimate
147
Time
m_minRto
;
// minimum value of the timeout
148
uint32_t
m_nSamples
;
// Number of samples
149
uint16_t
m_multiplier
;
// RTO Multiplier
150
};
151
162
class
RttMeanDeviation
:
public
RttEstimator
{
163
public
:
164
static
TypeId
GetTypeId
(
void
);
165
166
RttMeanDeviation
();
167
168
RttMeanDeviation
(
const
RttMeanDeviation
&);
169
174
void
Measurement
(
Time
measure);
175
180
Time
RetransmitTimeout
();
181
182
Ptr<RttEstimator>
Copy
()
const
;
183
187
void
Reset
();
188
193
void
Gain
(
double
g);
194
195
private
:
196
double
m_gain
;
// Filter gain
197
Time
m_variance
;
// Current variance
198
};
199
}
// namespace ns3
200
201
#endif
/* RTT_ESTIMATOR_H */
src
internet
model
rtt-estimator.h
Generated on Tue Nov 13 2012 10:32:15 for ns-3 by
1.8.1.2