A Discrete-Event Network Simulator
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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Viyom Mittal <viyommittal@gmail.com>
18 * Vivek Jain <jain.vivek.anand@gmail.com>
19 * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
20 *
21 */
22#include "tcp-recovery-ops.h"
23
24#include "tcp-socket-state.h"
25
26#include "ns3/log.h"
27
28namespace ns3
29{
30
31NS_LOG_COMPONENT_DEFINE("TcpRecoveryOps");
32
33NS_OBJECT_ENSURE_REGISTERED(TcpRecoveryOps);
34
35TypeId
37{
38 static TypeId tid = TypeId("ns3::TcpRecoveryOps").SetParent<Object>().SetGroupName("Internet");
39 return tid;
40}
41
43 : Object()
44{
45 NS_LOG_FUNCTION(this);
46}
47
49 : Object(other)
50{
51 NS_LOG_FUNCTION(this);
52}
53
55{
56 NS_LOG_FUNCTION(this);
57}
58
59void
61{
62 NS_LOG_FUNCTION(this << bytesSent);
63}
64
65// Classic recovery
66
68
71{
72 static TypeId tid = TypeId("ns3::TcpClassicRecovery")
74 .SetGroupName("Internet")
75 .AddConstructor<TcpClassicRecovery>();
76 return tid;
77}
78
81{
82 NS_LOG_FUNCTION(this);
83}
84
86 : TcpRecoveryOps(sock)
87{
88 NS_LOG_FUNCTION(this);
89}
90
92{
93 NS_LOG_FUNCTION(this);
94}
95
96void
98 uint32_t dupAckCount,
99 uint32_t unAckDataCount [[maybe_unused]],
100 uint32_t deliveredBytes [[maybe_unused]])
101{
102 NS_LOG_FUNCTION(this << tcb << dupAckCount << unAckDataCount);
103 tcb->m_cWnd = tcb->m_ssThresh;
104 tcb->m_cWndInfl = tcb->m_ssThresh + (dupAckCount * tcb->m_segmentSize);
105}
106
107void
109{
110 NS_LOG_FUNCTION(this << tcb << deliveredBytes);
111 tcb->m_cWndInfl += tcb->m_segmentSize;
112}
113
114void
116{
117 NS_LOG_FUNCTION(this << tcb);
118 // Follow NewReno procedures to exit FR if SACK is disabled
119 // (RFC2582 sec.3 bullet #5 paragraph 2, option 2)
120 // In this implementation, actual m_cWnd value is reset to ssThresh
121 // immediately before calling ExitRecovery(), so we just need to
122 // reset the inflated cWnd trace variable
123 tcb->m_cWndInfl = tcb->m_ssThresh.Get();
124}
125
126std::string
128{
129 return "TcpClassicRecovery";
130}
131
134{
135 return CopyObject<TcpClassicRecovery>(this);
136}
137
138} // namespace ns3
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
The Classic recovery implementation.
Ptr< TcpRecoveryOps > Fork() override
Copy the recovery algorithm across socket.
void EnterRecovery(Ptr< TcpSocketState > tcb, uint32_t dupAckCount, uint32_t unAckDataCount, uint32_t deliveredBytes) override
Performs variable initialization at the start of recovery.
void DoRecovery(Ptr< TcpSocketState > tcb, uint32_t deliveredBytes) override
Performs recovery based on the recovery algorithm.
void ExitRecovery(Ptr< TcpSocketState > tcb) override
Performs cwnd adjustments at the end of recovery.
std::string GetName() const override
Get the name of the recovery algorithm.
static TypeId GetTypeId()
Get the type ID.
TcpClassicRecovery()
Constructor.
~TcpClassicRecovery() override
Constructor.
recovery abstract class
static TypeId GetTypeId()
Get the type ID.
virtual void UpdateBytesSent(uint32_t bytesSent)
Keeps track of bytes sent during recovery phase.
TcpRecoveryOps()
Constructor.
~TcpRecoveryOps() override
Deconstructor.
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.