A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-dctcp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 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: Shravya K.S. <shravya.ks0@gmail.com>
18 *
19 */
20
21#ifndef TCP_DCTCP_H
22#define TCP_DCTCP_H
23
24#include "tcp-congestion-ops.h"
25#include "tcp-linux-reno.h"
26
27#include "ns3/traced-callback.h"
28
29namespace ns3
30{
31
32/**
33 * \ingroup tcp
34 *
35 * \brief An implementation of DCTCP. This model implements all of the
36 * endpoint capabilities mentioned in the DCTCP SIGCOMM paper. Note that
37 * this model presently will not do any fallback to RFC 5681 congestion
38 * avoidance as specified in RFC 8257 Section 3.5, so it should only be
39 * used in a simulation that does not involve packet loss.
40 */
41
42class TcpDctcp : public TcpLinuxReno
43{
44 public:
45 /**
46 * \brief Get the type ID.
47 * \return the object TypeId
48 */
49 static TypeId GetTypeId();
50
51 /**
52 * Create an unbound tcp socket.
53 */
54 TcpDctcp();
55
56 /**
57 * \brief Copy constructor
58 * \param sock the object to copy
59 */
60 TcpDctcp(const TcpDctcp& sock);
61
62 /**
63 * \brief Destructor
64 */
65 ~TcpDctcp() override;
66
67 // Documented in base class
68 std::string GetName() const override;
69
70 /**
71 * \brief Set configuration required by congestion control algorithm,
72 * This method will force DctcpEcn mode and will force usage of
73 * either ECT(0) or ECT(1) (depending on the 'UseEct0' attribute),
74 * despite any other configuration in the base classes.
75 *
76 * \param tcb internal congestion state
77 */
78 void Init(Ptr<TcpSocketState> tcb) override;
79
80 /**
81 * TracedCallback signature for DCTCP update of congestion state
82 *
83 * \param [in] bytesAcked Bytes acked in this observation window
84 * \param [in] bytesMarked Bytes marked in this observation window
85 * \param [in] alpha New alpha (congestion estimate) value
86 */
87 typedef void (*CongestionEstimateTracedCallback)(uint32_t bytesAcked,
88 uint32_t bytesMarked,
89 double alpha);
90
91 // Documented in base class
92 uint32_t GetSsThresh(Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight) override;
93 Ptr<TcpCongestionOps> Fork() override;
94 void PktsAcked(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, const Time& rtt) override;
95 void CwndEvent(Ptr<TcpSocketState> tcb, const TcpSocketState::TcpCAEvent_t event) override;
96
97 private:
98 /**
99 * \brief Changes state of m_ceState to true
100 *
101 * \param tcb internal congestion state
102 */
104
105 /**
106 * \brief Changes state of m_ceState to false
107 *
108 * \param tcb internal congestion state
109 */
111
112 /**
113 * \brief Updates the value of m_delayedAckReserved
114 *
115 * \param tcb internal congestion state
116 * \param event the congestion window event
117 */
119
120 /**
121 * \brief Resets the value of m_ackedBytesEcn, m_ackedBytesTotal and m_nextSeq
122 *
123 * \param tcb internal congestion state
124 */
125 void Reset(Ptr<TcpSocketState> tcb);
126
127 /**
128 * \brief Initialize the value of m_alpha
129 *
130 * \param alpha DCTCP alpha parameter
131 */
132 void InitializeDctcpAlpha(double alpha);
133
134 uint32_t m_ackedBytesEcn; //!< Number of acked bytes which are marked
135 uint32_t m_ackedBytesTotal; //!< Total number of acked bytes
136 SequenceNumber32 m_priorRcvNxt; //!< Sequence number of the first missing byte in data
137 bool m_priorRcvNxtFlag; //!< Variable used in setting the value of m_priorRcvNxt for first time
138 double m_alpha; //!< Parameter used to estimate the amount of network congestion
140 m_nextSeq; //!< TCP sequence number threshold for beginning a new observation window
141 bool m_nextSeqFlag; //!< Variable used in setting the value of m_nextSeq for first time
142 bool m_ceState; //!< DCTCP Congestion Experienced state
143 bool m_delayedAckReserved; //!< Delayed Ack state
144 double m_g; //!< Estimation gain
145 bool m_useEct0; //!< Use ECT(0) for ECN codepoint
146 bool m_initialized; //!< Whether DCTCP has been initialized
147 /**
148 * \brief Callback pointer for congestion state update
149 */
151};
152
153} // namespace ns3
154
155#endif /* TCP_DCTCP_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
An implementation of DCTCP.
Definition: tcp-dctcp.h:43
void(* CongestionEstimateTracedCallback)(uint32_t bytesAcked, uint32_t bytesMarked, double alpha)
TracedCallback signature for DCTCP update of congestion state.
Definition: tcp-dctcp.h:87
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
Definition: tcp-dctcp.cc:110
static TypeId GetTypeId()
Get the type ID.
Definition: tcp-dctcp.cc:36
SequenceNumber32 m_priorRcvNxt
Sequence number of the first missing byte in data.
Definition: tcp-dctcp.h:136
double m_alpha
Parameter used to estimate the amount of network congestion.
Definition: tcp-dctcp.h:138
double m_g
Estimation gain.
Definition: tcp-dctcp.h:144
bool m_initialized
Whether DCTCP has been initialized.
Definition: tcp-dctcp.h:146
bool m_ceState
DCTCP Congestion Experienced state.
Definition: tcp-dctcp.h:142
bool m_priorRcvNxtFlag
Variable used in setting the value of m_priorRcvNxt for first time.
Definition: tcp-dctcp.h:137
void InitializeDctcpAlpha(double alpha)
Initialize the value of m_alpha.
Definition: tcp-dctcp.cc:166
SequenceNumber32 m_nextSeq
TCP sequence number threshold for beginning a new observation window.
Definition: tcp-dctcp.h:140
uint32_t m_ackedBytesEcn
Number of acked bytes which are marked.
Definition: tcp-dctcp.h:134
void Init(Ptr< TcpSocketState > tcb) override
Set configuration required by congestion control algorithm, This method will force DctcpEcn mode and ...
Definition: tcp-dctcp.cc:117
TcpDctcp()
Create an unbound tcp socket.
Definition: tcp-dctcp.cc:71
void Reset(Ptr< TcpSocketState > tcb)
Resets the value of m_ackedBytesEcn, m_ackedBytesTotal and m_nextSeq.
Definition: tcp-dctcp.cc:174
uint32_t m_ackedBytesTotal
Total number of acked bytes.
Definition: tcp-dctcp.h:135
bool m_nextSeqFlag
Variable used in setting the value of m_nextSeq for first time.
Definition: tcp-dctcp.h:141
std::string GetName() const override
Get the name of the congestion control algorithm.
Definition: tcp-dctcp.cc:66
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get the slow start threshold after a loss event.
Definition: tcp-dctcp.cc:131
void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override
Timing information on received ACK.
Definition: tcp-dctcp.cc:138
void CwndEvent(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event) override
Trigger events/calculations on occurrence of congestion window event.
Definition: tcp-dctcp.cc:266
void CeState1to0(Ptr< TcpSocketState > tcb)
Changes state of m_ceState to false.
Definition: tcp-dctcp.cc:210
void UpdateAckReserved(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event)
Updates the value of m_delayedAckReserved.
Definition: tcp-dctcp.cc:242
bool m_delayedAckReserved
Delayed Ack state.
Definition: tcp-dctcp.h:143
TracedCallback< uint32_t, uint32_t, double > m_traceCongestionEstimate
Callback pointer for congestion state update.
Definition: tcp-dctcp.h:150
bool m_useEct0
Use ECT(0) for ECN codepoint.
Definition: tcp-dctcp.h:145
void CeState0to1(Ptr< TcpSocketState > tcb)
Changes state of m_ceState to true.
Definition: tcp-dctcp.cc:183
~TcpDctcp() override
Destructor.
Definition: tcp-dctcp.cc:104
Reno congestion control algorithm.
TcpCAEvent_t
Congestion avoidance events.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.