A Discrete-Event Network Simulator
QKDNetSim v2.0 (NS-3 v3.41) @ (+)
API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
tcp-ledbat.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 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: Ankit Deepak <adadeepak8@gmail.com>
18  *
19  */
20 
21 #ifndef TCP_LEDBAT_H
22 #define TCP_LEDBAT_H
23 
24 #include "tcp-congestion-ops.h"
25 
26 #include <vector>
27 
28 namespace ns3
29 {
30 
31 class TcpSocketState;
32 
39 class TcpLedbat : public TcpNewReno
40 {
41  private:
46  {
49  };
50 
55  enum State : uint32_t
56  {
57  LEDBAT_VALID_OWD = (1 << 1),
58  LEDBAT_CAN_SS = (1 << 3)
59  };
60 
61  public:
66  static TypeId GetTypeId();
67 
71  TcpLedbat();
72 
77  TcpLedbat(const TcpLedbat& sock);
78 
82  ~TcpLedbat() override;
83 
89  std::string GetName() const override;
90 
98  void PktsAcked(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, const Time& rtt) override;
99 
100  // Inherited
101  Ptr<TcpCongestionOps> Fork() override;
102 
109  void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
110 
116  void SetDoSs(SlowStartType doSS);
117 
118  protected:
125  void CongestionAvoidance(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
126 
127  private:
131  struct OwdCircBuf
132  {
133  std::vector<uint32_t> buffer;
134  uint32_t min;
135  };
136 
142  void InitCircBuf(OwdCircBuf& buffer);
143 
145  typedef uint32_t (*FilterFunction)(OwdCircBuf&);
146 
153  static uint32_t MinCircBuf(OwdCircBuf& b);
154 
161  uint32_t CurrentDelay(FilterFunction filter);
162 
168  uint32_t BaseDelay();
169 
177  void AddDelay(OwdCircBuf& cb, uint32_t owd, uint32_t maxlen);
178 
184  void UpdateBaseDelay(uint32_t owd);
185 
187  double m_gain;
189  uint32_t m_baseHistoLen;
190  uint32_t m_noiseFilterLen;
191  uint64_t m_lastRollover;
192  int32_t m_sndCwndCnt;
195  uint32_t m_flag;
196  uint32_t m_minCwnd;
197 };
198 
199 } // namespace ns3
200 
201 #endif /* TCP_LEDBAT_H */
An implementation of LEDBAT.
Definition: tcp-ledbat.h:40
static TypeId GetTypeId()
Get the type ID.
Definition: tcp-ledbat.cc:35
SlowStartType m_doSs
Permissible Slow Start State.
Definition: tcp-ledbat.h:188
std::string GetName() const override
Get the name of the TCP flavour.
Definition: tcp-ledbat.cc:144
void UpdateBaseDelay(uint32_t owd)
Update the base delay buffer.
Definition: tcp-ledbat.cc:274
uint32_t m_minCwnd
Minimum cWnd value mentioned in RFC 6817.
Definition: tcp-ledbat.h:196
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Adjust cwnd following LEDBAT algorithm.
Definition: tcp-ledbat.cc:178
uint32_t m_flag
LEDBAT Flag.
Definition: tcp-ledbat.h:195
uint32_t BaseDelay()
Return the value of base delay.
Definition: tcp-ledbat.cc:171
void SetDoSs(SlowStartType doSS)
Change the Slow Start Capability.
Definition: tcp-ledbat.cc:76
double m_gain
GAIN value from RFC.
Definition: tcp-ledbat.h:187
State
The state of LEDBAT.
Definition: tcp-ledbat.h:56
@ LEDBAT_CAN_SS
If LEDBAT allows Slow Start.
Definition: tcp-ledbat.h:58
@ LEDBAT_VALID_OWD
If valid timestamps are present.
Definition: tcp-ledbat.h:57
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
Definition: tcp-ledbat.cc:138
void AddDelay(OwdCircBuf &cb, uint32_t owd, uint32_t maxlen)
Add new delay to the buffers.
Definition: tcp-ledbat.cc:242
OwdCircBuf m_noiseFilter
Buffer to store the current delay.
Definition: tcp-ledbat.h:194
SlowStartType
The slowstart types.
Definition: tcp-ledbat.h:46
@ DO_NOT_SLOWSTART
Do not Slow Start.
Definition: tcp-ledbat.h:47
@ DO_SLOWSTART
Do NewReno Slow Start.
Definition: tcp-ledbat.h:48
void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt) override
Get information from the acked packet.
Definition: tcp-ledbat.cc:304
TcpLedbat()
Create an unbound tcp socket.
Definition: tcp-ledbat.cc:90
~TcpLedbat() override
Destructor.
Definition: tcp-ledbat.cc:132
void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Reduce Congestion.
Definition: tcp-ledbat.cc:197
void InitCircBuf(OwdCircBuf &buffer)
Initialise a new buffer.
Definition: tcp-ledbat.cc:108
static uint32_t MinCircBuf(OwdCircBuf &b)
Return the minimum delay of the buffer.
Definition: tcp-ledbat.cc:150
Time m_target
Target Queue Delay.
Definition: tcp-ledbat.h:186
int32_t m_sndCwndCnt
The congestion window addition parameter.
Definition: tcp-ledbat.h:192
uint32_t m_baseHistoLen
Length of base delay history buffer.
Definition: tcp-ledbat.h:189
uint32_t m_noiseFilterLen
Length of current delay buffer.
Definition: tcp-ledbat.h:190
uint64_t m_lastRollover
Timestamp of last added delay.
Definition: tcp-ledbat.h:191
uint32_t(* FilterFunction)(OwdCircBuf &)
Filter function used by LEDBAT for current delay.
Definition: tcp-ledbat.h:145
OwdCircBuf m_baseHistory
Buffer to store the base delay.
Definition: tcp-ledbat.h:193
uint32_t CurrentDelay(FilterFunction filter)
Return the value of current delay.
Definition: tcp-ledbat.cc:164
The NewReno implementation.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Buffer structure to store delays.
Definition: tcp-ledbat.h:132
uint32_t min
The index of minimum value.
Definition: tcp-ledbat.h:134
std::vector< uint32_t > buffer
Vector to store the delay.
Definition: tcp-ledbat.h:133