A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
tcp-recovery-ops.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2018 NITK Surathkal
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: Viyom Mittal <viyommittal@gmail.com>
19
* Vivek Jain <jain.vivek.anand@gmail.com>
20
* Mohit P. Tahiliani <tahiliani@nitk.edu.in>
21
*
22
*/
23
#include "
tcp-recovery-ops.h
"
24
#include "
tcp-socket-state.h
"
25
26
#include "ns3/log.h"
27
28
namespace
ns3
{
29
30
NS_LOG_COMPONENT_DEFINE
(
"TcpRecoveryOps"
);
31
32
NS_OBJECT_ENSURE_REGISTERED
(TcpRecoveryOps);
33
34
TypeId
35
TcpRecoveryOps::GetTypeId
(
void
)
36
{
37
static
TypeId
tid =
TypeId
(
"ns3::TcpRecoveryOps"
)
38
.
SetParent
<
Object
> ()
39
.SetGroupName (
"Internet"
)
40
;
41
return
tid;
42
}
43
44
TcpRecoveryOps::TcpRecoveryOps
() :
Object
()
45
{
46
NS_LOG_FUNCTION
(
this
);
47
}
48
49
TcpRecoveryOps::TcpRecoveryOps
(
const
TcpRecoveryOps
&other) :
Object
(other)
50
{
51
NS_LOG_FUNCTION
(
this
);
52
}
53
54
TcpRecoveryOps::~TcpRecoveryOps
()
55
{
56
NS_LOG_FUNCTION
(
this
);
57
}
58
59
void
60
TcpRecoveryOps::UpdateBytesSent
(uint32_t bytesSent)
61
{
62
NS_LOG_FUNCTION
(
this
<< bytesSent);
63
}
64
65
// Classic recovery
66
67
NS_OBJECT_ENSURE_REGISTERED
(
TcpClassicRecovery
);
68
69
TypeId
70
TcpClassicRecovery::GetTypeId
(
void
)
71
{
72
static
TypeId
tid =
TypeId
(
"ns3::TcpClassicRecovery"
)
73
.
SetParent
<
TcpRecoveryOps
> ()
74
.SetGroupName (
"Internet"
)
75
.AddConstructor<
TcpClassicRecovery
> ()
76
;
77
return
tid;
78
}
79
80
TcpClassicRecovery::TcpClassicRecovery
(
void
) :
TcpRecoveryOps
()
81
{
82
NS_LOG_FUNCTION
(
this
);
83
}
84
85
TcpClassicRecovery::TcpClassicRecovery
(
const
TcpClassicRecovery
& sock)
86
:
TcpRecoveryOps
(sock)
87
{
88
NS_LOG_FUNCTION
(
this
);
89
}
90
91
TcpClassicRecovery::~TcpClassicRecovery
(
void
)
92
{
93
NS_LOG_FUNCTION
(
this
);
94
}
95
96
void
97
TcpClassicRecovery::EnterRecovery
(
Ptr<TcpSocketState>
tcb, uint32_t dupAckCount,
98
uint32_t unAckDataCount, uint32_t deliveredBytes)
99
{
100
NS_LOG_FUNCTION
(
this
<< tcb << dupAckCount << unAckDataCount);
101
NS_UNUSED
(unAckDataCount);
102
NS_UNUSED
(deliveredBytes);
103
tcb->
m_cWnd
= tcb->
m_ssThresh
;
104
tcb->
m_cWndInfl
= tcb->
m_ssThresh
+ (dupAckCount * tcb->
m_segmentSize
);
105
}
106
107
void
108
TcpClassicRecovery::DoRecovery
(
Ptr<TcpSocketState>
tcb, uint32_t deliveredBytes)
109
{
110
NS_LOG_FUNCTION
(
this
<< tcb << deliveredBytes);
111
NS_UNUSED
(deliveredBytes);
112
tcb->
m_cWndInfl
+= tcb->
m_segmentSize
;
113
}
114
115
void
116
TcpClassicRecovery::ExitRecovery
(
Ptr<TcpSocketState>
tcb)
117
{
118
NS_LOG_FUNCTION
(
this
<< tcb);
119
// Follow NewReno procedures to exit FR if SACK is disabled
120
// (RFC2582 sec.3 bullet #5 paragraph 2, option 2)
121
// In this implementation, actual m_cWnd value is reset to ssThresh
122
// immediately before calling ExitRecovery(), so we just need to
123
// reset the inflated cWnd trace variable
124
tcb->
m_cWndInfl
= tcb->
m_ssThresh
.
Get
();
125
}
126
127
std::string
128
TcpClassicRecovery::GetName
()
const
129
{
130
return
"TcpClassicRecovery"
;
131
}
132
133
Ptr<TcpRecoveryOps>
134
TcpClassicRecovery::Fork
()
135
{
136
return
CopyObject<TcpClassicRecovery> (
this
);
137
}
138
139
}
// namespace ns3
140
ns3::TcpClassicRecovery::~TcpClassicRecovery
virtual ~TcpClassicRecovery() override
Constructor.
Definition:
tcp-recovery-ops.cc:91
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
ns3::TcpClassicRecovery::TcpClassicRecovery
TcpClassicRecovery()
Constructor.
Definition:
tcp-recovery-ops.cc:80
ns3::TracedValue::Get
T Get(void) const
Get the underlying value.
Definition:
traced-value.h:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3::TcpRecoveryOps::UpdateBytesSent
virtual void UpdateBytesSent(uint32_t bytesSent)
Keeps track of bytes sent during recovery phase.
Definition:
tcp-recovery-ops.cc:60
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TcpClassicRecovery::EnterRecovery
virtual void EnterRecovery(Ptr< TcpSocketState > tcb, uint32_t dupAckCount, uint32_t unAckDataCount, uint32_t deliveredBytes) override
Performs variable initialization at the start of recovery.
Definition:
tcp-recovery-ops.cc:97
ns3::TcpSocketState::m_segmentSize
uint32_t m_segmentSize
Segment size.
Definition:
tcp-socket-state.h:177
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:923
ns3::TcpRecoveryOps::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
tcp-recovery-ops.cc:35
ns3::Ptr< TcpSocketState >
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:88
NS_UNUSED
#define NS_UNUSED(x)
Mark a local variable as unused.
Definition:
unused.h:36
ns3::TcpSocketState::m_cWndInfl
TracedValue< uint32_t > m_cWndInfl
Inflated congestion window trace (used only for backward compatibility purpose)
Definition:
tcp-socket-state.h:166
ns3::TcpClassicRecovery::GetName
virtual std::string GetName() const override
Get the name of the recovery algorithm.
Definition:
tcp-recovery-ops.cc:128
tcp-socket-state.h
ns3::TcpRecoveryOps::~TcpRecoveryOps
virtual ~TcpRecoveryOps()
Deconstructor.
Definition:
tcp-recovery-ops.cc:54
ns3::TcpClassicRecovery
The Classic recovery implementation.
Definition:
tcp-recovery-ops.h:159
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition:
log-macros-enabled.h:244
ns3::TcpClassicRecovery::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
tcp-recovery-ops.cc:70
ns3::TcpSocketState::m_cWnd
TracedValue< uint32_t > m_cWnd
Congestion window.
Definition:
tcp-socket-state.h:165
ns3::TcpClassicRecovery::ExitRecovery
virtual void ExitRecovery(Ptr< TcpSocketState > tcb) override
Performs cwnd adjustments at the end of recovery.
Definition:
tcp-recovery-ops.cc:116
ns3::TcpRecoveryOps::TcpRecoveryOps
TcpRecoveryOps()
Constructor.
Definition:
tcp-recovery-ops.cc:44
ns3::TcpClassicRecovery::DoRecovery
virtual void DoRecovery(Ptr< TcpSocketState > tcb, uint32_t deliveredBytes) override
Performs recovery based on the recovery algorithm.
Definition:
tcp-recovery-ops.cc:108
ns3::TcpSocketState::m_ssThresh
TracedValue< uint32_t > m_ssThresh
Slow start threshold.
Definition:
tcp-socket-state.h:167
ns3::TcpClassicRecovery::Fork
virtual Ptr< TcpRecoveryOps > Fork() override
Copy the recovery algorithm across socket.
Definition:
tcp-recovery-ops.cc:134
tcp-recovery-ops.h
ns3::TcpRecoveryOps
recovery abstract class
Definition:
tcp-recovery-ops.h:61
src
internet
model
tcp-recovery-ops.cc
Generated on Fri Oct 1 2021 17:03:10 for ns-3 by
1.8.20