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