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 <vector>
26 #include "ns3/tcp-congestion-ops.h"
27 #include "ns3/tcp-recovery-ops.h"
28 
29 namespace ns3 {
30 
37 class TcpLedbat : public TcpNewReno
38 {
39 private:
44  {
47  };
48 
53  enum State : uint32_t
54  {
55  LEDBAT_VALID_OWD = (1 << 1),
56  LEDBAT_CAN_SS = (1 << 3)
57  };
58 
59 public:
64  static TypeId GetTypeId (void);
65 
69  TcpLedbat (void);
70 
75  TcpLedbat (const TcpLedbat& sock);
76 
80  virtual ~TcpLedbat (void);
81 
87  virtual std::string GetName () const;
88 
96  virtual void PktsAcked (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked,
97  const Time& rtt);
98 
99  // Inherited
100  virtual Ptr<TcpCongestionOps> Fork ();
101 
108  virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
109 
115  void SetDoSs (SlowStartType doSS);
116 
117 protected:
124  virtual void CongestionAvoidance (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
125 
126 private:
130  struct OwdCircBuf
131  {
132  std::vector<uint32_t> buffer;
133  uint32_t min;
134  };
135 
141  void InitCircBuf (struct OwdCircBuf &buffer);
142 
144  typedef uint32_t (*FilterFunction)(struct OwdCircBuf &);
145 
152  static uint32_t MinCircBuf (struct OwdCircBuf &b);
153 
160  uint32_t CurrentDelay (FilterFunction filter);
161 
167  uint32_t BaseDelay ();
168 
176  void AddDelay (struct OwdCircBuf &cb, uint32_t owd, uint32_t maxlen);
177 
183  void UpdateBaseDelay (uint32_t owd);
184 
186  double m_gain;
188  uint32_t m_baseHistoLen;
189  uint32_t m_noiseFilterLen;
190  uint64_t m_lastRollover;
191  int32_t m_sndCwndCnt;
194  uint32_t m_flag;
195  uint32_t m_minCwnd;
196 };
197 
198 } // namespace ns3
199 
200 #endif /* TCP_LEDBAT_H */
uint32_t BaseDelay()
Return the value of base delay.
Definition: tcp-ledbat.cc:164
uint32_t min
The index of minimum value.
Definition: tcp-ledbat.h:133
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
uint32_t m_noiseFilterLen
Length of current delay buffer.
Definition: tcp-ledbat.h:189
std::vector< uint32_t > buffer
Vector to store the delay.
Definition: tcp-ledbat.h:132
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Get information from the acked packet.
Definition: tcp-ledbat.cc:289
uint64_t m_lastRollover
Timestamp of last added delay.
Definition: tcp-ledbat.h:190
void AddDelay(struct OwdCircBuf &cb, uint32_t owd, uint32_t maxlen)
Add new delay to the buffers.
Definition: tcp-ledbat.cc:229
An implementation of LEDBAT.
Definition: tcp-ledbat.h:37
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Adjust cwnd following LEDBAT algorithm.
Definition: tcp-ledbat.cc:170
The NewReno implementation.
static uint32_t MinCircBuf(struct OwdCircBuf &b)
Return the minimum delay of the buffer.
Definition: tcp-ledbat.cc:145
OwdCircBuf m_baseHistory
Buffer to store the base delay.
Definition: tcp-ledbat.h:192
Buffer structure to store delays.
Definition: tcp-ledbat.h:130
virtual ~TcpLedbat(void)
Destructor.
Definition: tcp-ledbat.cc:128
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-ledbat.cc:32
void InitCircBuf(struct OwdCircBuf &buffer)
Initialise a new buffer.
Definition: tcp-ledbat.cc:104
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across socket.
Definition: tcp-ledbat.cc:134
State
The state of LEDBAT.
Definition: tcp-ledbat.h:53
uint32_t(* FilterFunction)(struct OwdCircBuf &)
Filter function used by LEDBAT for current delay.
Definition: tcp-ledbat.h:144
SlowStartType m_doSs
Permissible Slow Start State.
Definition: tcp-ledbat.h:187
Do NewReno Slow Start.
Definition: tcp-ledbat.h:46
uint32_t m_baseHistoLen
Length of base delay history buffer.
Definition: tcp-ledbat.h:188
SlowStartType
The slowstart types.
Definition: tcp-ledbat.h:43
uint32_t CurrentDelay(FilterFunction filter)
Return the value of current delay.
Definition: tcp-ledbat.cc:158
uint32_t m_minCwnd
Minimum cWnd value mentioned in RFC 6817.
Definition: tcp-ledbat.h:195
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double m_gain
GAIN value from RFC.
Definition: tcp-ledbat.h:186
Time m_target
Target Queue Delay.
Definition: tcp-ledbat.h:185
void UpdateBaseDelay(uint32_t owd)
Update the base delay buffer.
Definition: tcp-ledbat.cc:260
uint32_t m_flag
LEDBAT Flag.
Definition: tcp-ledbat.h:194
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Reduce Congestion.
Definition: tcp-ledbat.cc:188
void SetDoSs(SlowStartType doSS)
Change the Slow Start Capability.
Definition: tcp-ledbat.cc:73
OwdCircBuf m_noiseFilter
Buffer to store the current delay.
Definition: tcp-ledbat.h:193
virtual std::string GetName() const
Get the name of the TCP flavour.
Definition: tcp-ledbat.cc:140
a unique identifier for an interface.
Definition: type-id.h:58
int32_t m_sndCwndCnt
The congestion window addition parameter.
Definition: tcp-ledbat.h:191
TcpLedbat(void)
Create an unbound tcp socket.
Definition: tcp-ledbat.cc:87
If LEDBAT allows Slow Start.
Definition: tcp-ledbat.h:56
If valid timestamps are present.
Definition: tcp-ledbat.h:55