A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-ledbat.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 NITK Surathkal
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Ankit Deepak <adadeepak8@gmail.com>
7 *
8 */
9
10#ifndef TCP_LEDBAT_H
11#define TCP_LEDBAT_H
12
13#include "tcp-congestion-ops.h"
14
15#include <vector>
16
17namespace ns3
18{
19
20class TcpSocketState;
21
22/**
23 * \ingroup congestionOps
24 *
25 * \brief An implementation of LEDBAT
26 */
27
28class TcpLedbat : public TcpNewReno
29{
30 private:
31 /**
32 * \brief The slowstart types
33 */
35 {
36 DO_NOT_SLOWSTART, //!< Do not Slow Start
37 DO_SLOWSTART, //!< Do NewReno Slow Start
38 };
39
40 /**
41 * \brief The state of LEDBAT. If LEDBAT is not in VALID_OWD state, it falls to
42 * default congestion ops.
43 */
45 {
46 LEDBAT_VALID_OWD = (1 << 1), //!< If valid timestamps are present
47 LEDBAT_CAN_SS = (1 << 3) //!< If LEDBAT allows Slow Start
48 };
49
50 public:
51 /**
52 * \brief Get the type ID.
53 * \return the object TypeId
54 */
55 static TypeId GetTypeId();
56
57 /**
58 * Create an unbound tcp socket.
59 */
60 TcpLedbat();
61
62 /**
63 * \brief Copy constructor
64 * \param sock the object to copy
65 */
66 TcpLedbat(const TcpLedbat& sock);
67
68 /**
69 * \brief Destructor
70 */
71 ~TcpLedbat() override;
72
73 /**
74 * \brief Get the name of the TCP flavour
75 *
76 * \return The name of the TCP
77 */
78 std::string GetName() const override;
79
80 /**
81 * \brief Get information from the acked packet
82 *
83 * \param tcb internal congestion state
84 * \param segmentsAcked count of segments ACKed
85 * \param rtt The estimated rtt
86 */
87 void PktsAcked(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, const Time& rtt) override;
88
89 // Inherited
90 Ptr<TcpCongestionOps> Fork() override;
91
92 /**
93 * \brief Adjust cwnd following LEDBAT algorithm
94 *
95 * \param tcb internal congestion state
96 * \param segmentsAcked count of segments ACKed
97 */
98 void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
99
100 /**
101 * \brief Change the Slow Start Capability
102 *
103 * \param doSS Slow Start Option
104 */
105 void SetDoSs(SlowStartType doSS);
106
107 protected:
108 /**
109 * \brief Reduce Congestion
110 *
111 * \param tcb internal congestion state
112 * \param segmentsAcked count of segments ACKed
113 */
114 void CongestionAvoidance(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
115
116 private:
117 /**
118 * \brief Buffer structure to store delays
119 */
121 {
122 std::vector<uint32_t> buffer; //!< Vector to store the delay
123 uint32_t min; //!< The index of minimum value
124 };
125
126 /**
127 * \brief Initialise a new buffer
128 *
129 * \param buffer The buffer to be initialised
130 */
131 void InitCircBuf(OwdCircBuf& buffer);
132
133 /// Filter function used by LEDBAT for current delay
135
136 /**
137 * \brief Return the minimum delay of the buffer
138 *
139 * \param b The buffer
140 * \return The minimum delay
141 */
142 static uint32_t MinCircBuf(OwdCircBuf& b);
143
144 /**
145 * \brief Return the value of current delay
146 *
147 * \param filter The filter function
148 * \return The current delay
149 */
151
152 /**
153 * \brief Return the value of base delay
154 *
155 * \return The base delay
156 */
158
159 /**
160 * \brief Add new delay to the buffers
161 *
162 * \param cb The buffer
163 * \param owd The new delay
164 * \param maxlen The maximum permitted length
165 */
166 void AddDelay(OwdCircBuf& cb, uint32_t owd, uint32_t maxlen);
167
168 /**
169 * \brief Update the base delay buffer
170 *
171 * \param owd The delay
172 */
173 void UpdateBaseDelay(uint32_t owd);
174
175 Time m_target; //!< Target Queue Delay
176 double m_gain; //!< GAIN value from RFC
177 SlowStartType m_doSs; //!< Permissible Slow Start State
178 uint32_t m_baseHistoLen; //!< Length of base delay history buffer
179 uint32_t m_noiseFilterLen; //!< Length of current delay buffer
180 uint64_t m_lastRollover; //!< Timestamp of last added delay
181 int32_t m_sndCwndCnt; //!< The congestion window addition parameter
182 OwdCircBuf m_baseHistory; //!< Buffer to store the base delay
183 OwdCircBuf m_noiseFilter; //!< Buffer to store the current delay
184 uint32_t m_flag; //!< LEDBAT Flag
185 uint32_t m_minCwnd; //!< Minimum cWnd value mentioned in RFC 6817
186};
187
188} // namespace ns3
189
190#endif /* TCP_LEDBAT_H */
Smart pointer class similar to boost::intrusive_ptr.
An implementation of LEDBAT.
Definition tcp-ledbat.h:29
static TypeId GetTypeId()
Get the type ID.
Definition tcp-ledbat.cc:24
SlowStartType m_doSs
Permissible Slow Start State.
Definition tcp-ledbat.h:177
std::string GetName() const override
Get the name of the TCP flavour.
void UpdateBaseDelay(uint32_t owd)
Update the base delay buffer.
uint32_t m_minCwnd
Minimum cWnd value mentioned in RFC 6817.
Definition tcp-ledbat.h:185
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Adjust cwnd following LEDBAT algorithm.
uint32_t m_flag
LEDBAT Flag.
Definition tcp-ledbat.h:184
uint32_t BaseDelay()
Return the value of base delay.
void SetDoSs(SlowStartType doSS)
Change the Slow Start Capability.
Definition tcp-ledbat.cc:65
double m_gain
GAIN value from RFC.
Definition tcp-ledbat.h:176
State
The state of LEDBAT.
Definition tcp-ledbat.h:45
@ LEDBAT_CAN_SS
If LEDBAT allows Slow Start.
Definition tcp-ledbat.h:47
@ LEDBAT_VALID_OWD
If valid timestamps are present.
Definition tcp-ledbat.h:46
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
void AddDelay(OwdCircBuf &cb, uint32_t owd, uint32_t maxlen)
Add new delay to the buffers.
OwdCircBuf m_noiseFilter
Buffer to store the current delay.
Definition tcp-ledbat.h:183
SlowStartType
The slowstart types.
Definition tcp-ledbat.h:35
@ DO_NOT_SLOWSTART
Do not Slow Start.
Definition tcp-ledbat.h:36
@ DO_SLOWSTART
Do NewReno Slow Start.
Definition tcp-ledbat.h:37
void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override
Get information from the acked packet.
TcpLedbat()
Create an unbound tcp socket.
Definition tcp-ledbat.cc:79
~TcpLedbat() override
Destructor.
void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Reduce Congestion.
void InitCircBuf(OwdCircBuf &buffer)
Initialise a new buffer.
Definition tcp-ledbat.cc:97
static uint32_t MinCircBuf(OwdCircBuf &b)
Return the minimum delay of the buffer.
Time m_target
Target Queue Delay.
Definition tcp-ledbat.h:175
int32_t m_sndCwndCnt
The congestion window addition parameter.
Definition tcp-ledbat.h:181
uint32_t m_baseHistoLen
Length of base delay history buffer.
Definition tcp-ledbat.h:178
uint32_t m_noiseFilterLen
Length of current delay buffer.
Definition tcp-ledbat.h:179
uint64_t m_lastRollover
Timestamp of last added delay.
Definition tcp-ledbat.h:180
uint32_t(* FilterFunction)(OwdCircBuf &)
Filter function used by LEDBAT for current delay.
Definition tcp-ledbat.h:134
OwdCircBuf m_baseHistory
Buffer to store the base delay.
Definition tcp-ledbat.h:182
uint32_t CurrentDelay(FilterFunction filter)
Return the value of current delay.
The NewReno implementation.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Buffer structure to store delays.
Definition tcp-ledbat.h:121
uint32_t min
The index of minimum value.
Definition tcp-ledbat.h:123
std::vector< uint32_t > buffer
Vector to store the delay.
Definition tcp-ledbat.h:122