A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-recovery-ops.h
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#ifndef TCP_RECOVERY_OPS_H
23#define TCP_RECOVERY_OPS_H
24
25#include "ns3/object.h"
26
27namespace ns3
28{
29
30class TcpSocketState;
31
32/**
33 * \ingroup tcp
34 * \defgroup recoveryOps Recovery Algorithms.
35 *
36 * The various recovery algorithms used in recovery phase of TCP. The interface
37 * is defined in class TcpRecoveryOps.
38 */
39
40/**
41 * \ingroup recoveryOps
42 *
43 * \brief recovery abstract class
44 *
45 * The design is inspired by the TcpCongestionOps class in ns-3. The fast
46 * recovery is split from the main socket code, and it is a pluggable
47 * component. Subclasses of TcpRecoveryOps should modify TcpSocketState variables
48 * upon three condition:
49 *
50 * - EnterRecovery (when the first loss is guessed)
51 * - DoRecovery (each time a duplicate ACK or an ACK with SACK information is received)
52 * - ExitRecovery (when the sequence transmitted when the socket entered the
53 * Recovery phase is ACKed, therefore ending phase).
54 *
55 * Each condition is represented by a pure virtual method.
56 *
57 * \see TcpClassicRecovery
58 * \see DoRecovery
59 */
60class TcpRecoveryOps : public Object
61{
62 public:
63 /**
64 * \brief Get the type ID.
65 * \return the object TypeId
66 */
67 static TypeId GetTypeId();
68
69 /**
70 * \brief Constructor
71 */
73
74 /**
75 * \brief Copy constructor.
76 * \param other object to copy.
77 */
78 TcpRecoveryOps(const TcpRecoveryOps& other);
79
80 /**
81 * \brief Deconstructor
82 */
83 ~TcpRecoveryOps() override;
84
85 /**
86 * \brief Get the name of the recovery algorithm
87 *
88 * \return A string identifying the name
89 */
90 virtual std::string GetName() const = 0;
91
92 /**
93 * \brief Performs variable initialization at the start of recovery
94 *
95 * The function is called when the TcpSocketState is changed to CA_RECOVERY.
96 *
97 * \param tcb internal congestion state
98 * \param dupAckCount duplicate acknowldgement count
99 * \param unAckDataCount total bytes of data unacknowledged
100 * \param deliveredBytes bytes (S)ACKed in the last (S)ACK
101 */
103 uint32_t dupAckCount,
104 uint32_t unAckDataCount,
105 uint32_t deliveredBytes) = 0;
106
107 /**
108 * \brief Performs recovery based on the recovery algorithm
109 *
110 * The function is called on arrival of every ack when TcpSocketState
111 * is set to CA_RECOVERY. It performs the necessary cwnd changes
112 * as per the recovery algorithm.
113 *
114 * \param tcb internal congestion state
115 * \param deliveredBytes bytes (S)ACKed in the last (S)ACK
116 */
117 virtual void DoRecovery(Ptr<TcpSocketState> tcb, uint32_t deliveredBytes) = 0;
118
119 /**
120 * \brief Performs cwnd adjustments at the end of recovery
121 *
122 * The function is called when the TcpSocketState is changed from CA_RECOVERY.
123 *
124 * \param tcb internal congestion state
125 */
126 virtual void ExitRecovery(Ptr<TcpSocketState> tcb) = 0;
127
128 /**
129 * \brief Keeps track of bytes sent during recovery phase
130 *
131 * The function is called whenever a data packet is sent during recovery phase
132 * (optional).
133 *
134 * \param bytesSent bytes sent
135 */
136 virtual void UpdateBytesSent(uint32_t bytesSent);
137
138 /**
139 * \brief Copy the recovery algorithm across socket
140 *
141 * \return a pointer of the copied object
142 */
144};
145
146/**
147 * \brief The Classic recovery implementation
148 *
149 * Classic recovery refers to the two well-established recovery algorithms,
150 * namely, NewReno (RFC 6582) and SACK based recovery (RFC 6675).
151 *
152 * The idea of the algorithm is that when we enter recovery, we set the
153 * congestion window value to the slow start threshold and maintain it
154 * at such value until we are fully recovered (in other words, until
155 * the highest sequence transmitted at time of detecting the loss is
156 * ACKed by the receiver).
157 *
158 * \see DoRecovery
159 */
161{
162 public:
163 /**
164 * \brief Get the type ID.
165 * \return the object TypeId
166 */
167 static TypeId GetTypeId();
168
169 /**
170 * \brief Constructor
171 */
173
174 /**
175 * \brief Copy constructor.
176 * \param recovery object to copy.
177 */
178 TcpClassicRecovery(const TcpClassicRecovery& recovery);
179
180 /**
181 * \brief Constructor
182 */
183 ~TcpClassicRecovery() override;
184
185 std::string GetName() const override;
186
188 uint32_t dupAckCount,
189 uint32_t unAckDataCount,
190 uint32_t deliveredBytes) override;
191
192 void DoRecovery(Ptr<TcpSocketState> tcb, uint32_t deliveredBytes) override;
193
194 void ExitRecovery(Ptr<TcpSocketState> tcb) override;
195
196 Ptr<TcpRecoveryOps> Fork() override;
197};
198
199} // namespace ns3
200
201#endif /* TCP_RECOVERY_OPS_H */
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
virtual void EnterRecovery(Ptr< TcpSocketState > tcb, uint32_t dupAckCount, uint32_t unAckDataCount, uint32_t deliveredBytes)=0
Performs variable initialization at the start of recovery.
static TypeId GetTypeId()
Get the type ID.
virtual void UpdateBytesSent(uint32_t bytesSent)
Keeps track of bytes sent during recovery phase.
virtual std::string GetName() const =0
Get the name of the recovery algorithm.
TcpRecoveryOps()
Constructor.
~TcpRecoveryOps() override
Deconstructor.
virtual void DoRecovery(Ptr< TcpSocketState > tcb, uint32_t deliveredBytes)=0
Performs recovery based on the recovery algorithm.
virtual void ExitRecovery(Ptr< TcpSocketState > tcb)=0
Performs cwnd adjustments at the end of recovery.
virtual Ptr< TcpRecoveryOps > Fork()=0
Copy the recovery algorithm across socket.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.