A Discrete-Event Network Simulator
API
tcp-ledbat.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016 NITK Surathkal
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Ankit Deepak <adadeepak8@gmail.com>
19  *
20  */
21 
22 #ifndef TCP_LEDBAT_H
23 #define TCP_LEDBAT_H
24 
25 #include "tcp-congestion-ops.h"
26 
27 #include <vector>
28 
29 namespace ns3 {
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 (void);
67 
71  TcpLedbat (void);
72 
77  TcpLedbat (const TcpLedbat& sock);
78 
82  virtual ~TcpLedbat (void);
83 
89  virtual std::string GetName () const;
90 
98  virtual void PktsAcked (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked,
99  const Time& rtt);
100 
101  // Inherited
102  virtual Ptr<TcpCongestionOps> Fork ();
103 
110  virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
111 
117  void SetDoSs (SlowStartType doSS);
118 
119 protected:
126  virtual void CongestionAvoidance (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
127 
128 private:
132  struct OwdCircBuf
133  {
134  std::vector<uint32_t> buffer;
135  uint32_t min;
136  };
137 
143  void InitCircBuf (struct OwdCircBuf &buffer);
144 
146  typedef uint32_t (*FilterFunction)(struct OwdCircBuf &);
147 
154  static uint32_t MinCircBuf (struct OwdCircBuf &b);
155 
162  uint32_t CurrentDelay (FilterFunction filter);
163 
169  uint32_t BaseDelay ();
170 
178  void AddDelay (struct OwdCircBuf &cb, uint32_t owd, uint32_t maxlen);
179 
185  void UpdateBaseDelay (uint32_t owd);
186 
188  double m_gain;
190  uint32_t m_baseHistoLen;
191  uint32_t m_noiseFilterLen;
192  uint64_t m_lastRollover;
193  int32_t m_sndCwndCnt;
196  uint32_t m_flag;
197  uint32_t m_minCwnd;
198 };
199 
200 } // namespace ns3
201 
202 #endif /* TCP_LEDBAT_H */
An implementation of LEDBAT.
Definition: tcp-ledbat.h:40
SlowStartType m_doSs
Permissible Slow Start State.
Definition: tcp-ledbat.h:189
void AddDelay(struct OwdCircBuf &cb, uint32_t owd, uint32_t maxlen)
Add new delay to the buffers.
Definition: tcp-ledbat.cc:231
void UpdateBaseDelay(uint32_t owd)
Update the base delay buffer.
Definition: tcp-ledbat.cc:262
uint32_t m_minCwnd
Minimum cWnd value mentioned in RFC 6817.
Definition: tcp-ledbat.h:197
void InitCircBuf(struct OwdCircBuf &buffer)
Initialise a new buffer.
Definition: tcp-ledbat.cc:106
uint32_t m_flag
LEDBAT Flag.
Definition: tcp-ledbat.h:196
uint32_t BaseDelay()
Return the value of base delay.
Definition: tcp-ledbat.cc:166
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-ledbat.cc:34
void SetDoSs(SlowStartType doSS)
Change the Slow Start Capability.
Definition: tcp-ledbat.cc:75
double m_gain
GAIN value from RFC.
Definition: tcp-ledbat.h:188
uint32_t(* FilterFunction)(struct OwdCircBuf &)
Filter function used by LEDBAT for current delay.
Definition: tcp-ledbat.h:146
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
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Reduce Congestion.
Definition: tcp-ledbat.cc:190
static uint32_t MinCircBuf(struct OwdCircBuf &b)
Return the minimum delay of the buffer.
Definition: tcp-ledbat.cc:147
OwdCircBuf m_noiseFilter
Buffer to store the current delay.
Definition: tcp-ledbat.h:195
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
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across sockets.
Definition: tcp-ledbat.cc:136
TcpLedbat(void)
Create an unbound tcp socket.
Definition: tcp-ledbat.cc:89
Time m_target
Target Queue Delay.
Definition: tcp-ledbat.h:187
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Adjust cwnd following LEDBAT algorithm.
Definition: tcp-ledbat.cc:172
int32_t m_sndCwndCnt
The congestion window addition parameter.
Definition: tcp-ledbat.h:193
uint32_t m_baseHistoLen
Length of base delay history buffer.
Definition: tcp-ledbat.h:190
uint32_t m_noiseFilterLen
Length of current delay buffer.
Definition: tcp-ledbat.h:191
uint64_t m_lastRollover
Timestamp of last added delay.
Definition: tcp-ledbat.h:192
virtual ~TcpLedbat(void)
Destructor.
Definition: tcp-ledbat.cc:130
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Get information from the acked packet.
Definition: tcp-ledbat.cc:291
OwdCircBuf m_baseHistory
Buffer to store the base delay.
Definition: tcp-ledbat.h:194
uint32_t CurrentDelay(FilterFunction filter)
Return the value of current delay.
Definition: tcp-ledbat.cc:160
virtual std::string GetName() const
Get the name of the TCP flavour.
Definition: tcp-ledbat.cc:142
The NewReno implementation.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
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:133
uint32_t min
The index of minimum value.
Definition: tcp-ledbat.h:135
std::vector< uint32_t > buffer
Vector to store the delay.
Definition: tcp-ledbat.h:134