A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
tcp-recovery-ops.cc
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 NITK Surathkal
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Viyom Mittal <viyommittal@gmail.com>
7
* Vivek Jain <jain.vivek.anand@gmail.com>
8
* Mohit P. Tahiliani <tahiliani@nitk.edu.in>
9
*
10
*/
11
#include "
tcp-recovery-ops.h
"
12
13
#include "
tcp-socket-state.h
"
14
15
#include "ns3/log.h"
16
17
namespace
ns3
18
{
19
20
NS_LOG_COMPONENT_DEFINE
(
"TcpRecoveryOps"
);
21
22
NS_OBJECT_ENSURE_REGISTERED
(TcpRecoveryOps);
23
24
TypeId
25
TcpRecoveryOps::GetTypeId
()
26
{
27
static
TypeId
tid =
TypeId
(
"ns3::TcpRecoveryOps"
).
SetParent
<
Object
>().SetGroupName(
"Internet"
);
28
return
tid;
29
}
30
31
TcpRecoveryOps::TcpRecoveryOps
()
32
:
Object
()
33
{
34
NS_LOG_FUNCTION
(
this
);
35
}
36
37
TcpRecoveryOps::TcpRecoveryOps
(
const
TcpRecoveryOps
& other)
38
:
Object
(other)
39
{
40
NS_LOG_FUNCTION
(
this
);
41
}
42
43
TcpRecoveryOps::~TcpRecoveryOps
()
44
{
45
NS_LOG_FUNCTION
(
this
);
46
}
47
48
void
49
TcpRecoveryOps::UpdateBytesSent
(
uint32_t
bytesSent)
50
{
51
NS_LOG_FUNCTION
(
this
<< bytesSent);
52
}
53
54
// Classic recovery
55
56
NS_OBJECT_ENSURE_REGISTERED
(
TcpClassicRecovery
);
57
58
TypeId
59
TcpClassicRecovery::GetTypeId
()
60
{
61
static
TypeId
tid =
TypeId
(
"ns3::TcpClassicRecovery"
)
62
.
SetParent
<
TcpRecoveryOps
>()
63
.SetGroupName(
"Internet"
)
64
.AddConstructor<
TcpClassicRecovery
>();
65
return
tid;
66
}
67
68
TcpClassicRecovery::TcpClassicRecovery
()
69
:
TcpRecoveryOps
()
70
{
71
NS_LOG_FUNCTION
(
this
);
72
}
73
74
TcpClassicRecovery::TcpClassicRecovery
(
const
TcpClassicRecovery
& sock)
75
:
TcpRecoveryOps
(sock)
76
{
77
NS_LOG_FUNCTION
(
this
);
78
}
79
80
TcpClassicRecovery::~TcpClassicRecovery
()
81
{
82
NS_LOG_FUNCTION
(
this
);
83
}
84
85
void
86
TcpClassicRecovery::EnterRecovery
(
Ptr<TcpSocketState>
tcb,
87
uint32_t
dupAckCount,
88
uint32_t
unAckDataCount [[maybe_unused]],
89
uint32_t
deliveredBytes [[maybe_unused]])
90
{
91
NS_LOG_FUNCTION
(
this
<< tcb << dupAckCount << unAckDataCount);
92
tcb->m_cWnd = tcb->m_ssThresh;
93
tcb->m_cWndInfl = tcb->m_ssThresh + (dupAckCount * tcb->m_segmentSize);
94
}
95
96
void
97
TcpClassicRecovery::DoRecovery
(
Ptr<TcpSocketState>
tcb,
98
uint32_t
deliveredBytes [[maybe_unused]],
99
bool
isDupAck)
100
{
101
NS_LOG_FUNCTION
(
this
<< tcb << deliveredBytes << isDupAck);
102
tcb->m_cWndInfl += tcb->m_segmentSize;
103
}
104
105
void
106
TcpClassicRecovery::ExitRecovery
(
Ptr<TcpSocketState>
tcb)
107
{
108
NS_LOG_FUNCTION
(
this
<< tcb);
109
// Follow NewReno procedures to exit FR if SACK is disabled
110
// (RFC2582 sec.3 bullet #5 paragraph 2, option 2)
111
// In this implementation, actual m_cWnd value is reset to ssThresh
112
// immediately before calling ExitRecovery(), so we just need to
113
// reset the inflated cWnd trace variable
114
tcb->m_cWndInfl = tcb->m_ssThresh.Get();
115
}
116
117
std::string
118
TcpClassicRecovery::GetName
()
const
119
{
120
return
"TcpClassicRecovery"
;
121
}
122
123
Ptr<TcpRecoveryOps>
124
TcpClassicRecovery::Fork
()
125
{
126
return
CopyObject<TcpClassicRecovery>
(
this
);
127
}
128
129
}
// namespace ns3
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
ns3::Object::CopyObject
friend Ptr< T > CopyObject(Ptr< T > object)
Copy an Object.
Definition
object.h:581
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TcpClassicRecovery
The Classic recovery implementation.
Definition
tcp-recovery-ops.h:152
ns3::TcpClassicRecovery::DoRecovery
void DoRecovery(Ptr< TcpSocketState > tcb, uint32_t deliveredBytes, bool isDupAck) override
Performs recovery based on the recovery algorithm.
Definition
tcp-recovery-ops.cc:97
ns3::TcpClassicRecovery::Fork
Ptr< TcpRecoveryOps > Fork() override
Copy the recovery algorithm across socket.
Definition
tcp-recovery-ops.cc:124
ns3::TcpClassicRecovery::EnterRecovery
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:86
ns3::TcpClassicRecovery::ExitRecovery
void ExitRecovery(Ptr< TcpSocketState > tcb) override
Performs cwnd adjustments at the end of recovery.
Definition
tcp-recovery-ops.cc:106
ns3::TcpClassicRecovery::GetName
std::string GetName() const override
Get the name of the recovery algorithm.
Definition
tcp-recovery-ops.cc:118
ns3::TcpClassicRecovery::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
tcp-recovery-ops.cc:59
ns3::TcpClassicRecovery::TcpClassicRecovery
TcpClassicRecovery()
Constructor.
Definition
tcp-recovery-ops.cc:68
ns3::TcpClassicRecovery::~TcpClassicRecovery
~TcpClassicRecovery() override
Constructor.
Definition
tcp-recovery-ops.cc:80
ns3::TcpRecoveryOps
recovery abstract class
Definition
tcp-recovery-ops.h:50
ns3::TcpRecoveryOps::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
tcp-recovery-ops.cc:25
ns3::TcpRecoveryOps::UpdateBytesSent
virtual void UpdateBytesSent(uint32_t bytesSent)
Keeps track of bytes sent during recovery phase.
Definition
tcp-recovery-ops.cc:49
ns3::TcpRecoveryOps::TcpRecoveryOps
TcpRecoveryOps()
Constructor.
Definition
tcp-recovery-ops.cc:31
ns3::TcpRecoveryOps::~TcpRecoveryOps
~TcpRecoveryOps() override
Deconstructor.
Definition
tcp-recovery-ops.cc:43
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition
type-id.cc:1001
uint32_t
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition
log.h:191
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:229
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition
object-base.h:35
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
tcp-recovery-ops.h
tcp-socket-state.h
src
internet
model
tcp-recovery-ops.cc
Generated on Fri Nov 8 2024 13:59:01 for ns-3 by
1.11.0