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