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/event-id.h"
28 
29 namespace ns3 {
30 
37 class TcpLedbat : public TcpNewReno
38 {
39 private:
44  {
47  };
48 
53  enum State
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 
107  virtual uint32_t GetSsThresh (Ptr<const TcpSocketState> tcb,
108  uint32_t bytesInFlight);
109  virtual Ptr<TcpCongestionOps> Fork ();
110 
117  virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
118 
124  void SetDoSs (SlowStartType doSS);
125 
126 protected:
133  virtual void CongestionAvoidance (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
134 
135 private:
139  struct OwdCircBuf
140  {
141  std::vector<uint32_t> buffer;
142  uint32_t min;
143  };
144 
150  void InitCircBuf (struct OwdCircBuf &buffer);
151 
153  typedef uint32_t (*FilterFunction)(struct OwdCircBuf &);
154 
161  static uint32_t MinCircBuf (struct OwdCircBuf &b);
162 
169  uint32_t CurrentDelay (FilterFunction filter);
170 
176  uint32_t BaseDelay ();
177 
185  void AddDelay (struct OwdCircBuf &cb, uint32_t owd, uint32_t maxlen);
186 
192  void UpdateBaseDelay (uint32_t owd);
193 
195  double m_gain;
197  uint32_t m_baseHistoLen;
198  uint32_t m_noiseFilterLen;
199  uint64_t m_lastRollover;
200  int32_t m_sndCwndCnt;
203  uint32_t m_flag;
204 };
205 
206 } // namespace ns3
207 
208 #endif /* TCP_LEDBAT_H */
uint32_t BaseDelay()
Return the value of base delay.
Definition: tcp-ledbat.cc:157
uint32_t min
The index of minimum value.
Definition: tcp-ledbat.h:142
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:198
std::vector< uint32_t > buffer
Vector to store the delay.
Definition: tcp-ledbat.h:141
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Get information from the acked packet.
Definition: tcp-ledbat.cc:291
uint64_t m_lastRollover
Timestamp of last added delay.
Definition: tcp-ledbat.h:199
void AddDelay(struct OwdCircBuf &cb, uint32_t owd, uint32_t maxlen)
Add new delay to the buffers.
Definition: tcp-ledbat.cc:231
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:172
The NewReno implementation.
static uint32_t MinCircBuf(struct OwdCircBuf &b)
Return the minimum delay of the buffer.
Definition: tcp-ledbat.cc:138
struct OwdCircBuf m_noiseFilter
Buffer to store the current delay.
Definition: tcp-ledbat.h:202
Buffer structure to store delays.
Definition: tcp-ledbat.h:139
virtual ~TcpLedbat(void)
Destructor.
Definition: tcp-ledbat.cc:121
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:98
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across socket.
Definition: tcp-ledbat.cc:127
uint32_t(* FilterFunction)(struct OwdCircBuf &)
Filter function used by LEDBAT for current delay.
Definition: tcp-ledbat.h:153
SlowStartType m_doSs
Permissible Slow Start State.
Definition: tcp-ledbat.h:196
State
The state of LEDBAT.
Definition: tcp-ledbat.h:53
uint32_t m_baseHistoLen
Length of base delay history buffer.
Definition: tcp-ledbat.h:197
uint32_t CurrentDelay(FilterFunction filter)
Return the value of current delay.
Definition: tcp-ledbat.cc:151
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double m_gain
GAIN value from RFC.
Definition: tcp-ledbat.h:195
struct OwdCircBuf m_baseHistory
Buffer to store the base delay.
Definition: tcp-ledbat.h:201
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get the slow start threshold.
Definition: tcp-ledbat.cc:163
If valid timestamps are present.
Definition: tcp-ledbat.h:55
If LEDBAT allows Slow Start.
Definition: tcp-ledbat.h:56
Time m_target
Target Queue Delay.
Definition: tcp-ledbat.h:194
Do NewReno Slow Start.
Definition: tcp-ledbat.h:46
void UpdateBaseDelay(uint32_t owd)
Update the base delay buffer.
Definition: tcp-ledbat.cc:262
uint32_t m_flag
LEDBAT Flag.
Definition: tcp-ledbat.h:203
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Reduce Congestion.
Definition: tcp-ledbat.cc:190
void SetDoSs(SlowStartType doSS)
Change the Slow Start Capability.
Definition: tcp-ledbat.cc:68
SlowStartType
The slowstart types.
Definition: tcp-ledbat.h:43
virtual std::string GetName() const
Get the name of the TCP flavour.
Definition: tcp-ledbat.cc:133
a unique identifier for an interface.
Definition: type-id.h:58
int32_t m_sndCwndCnt
The congestion window addition parameter.
Definition: tcp-ledbat.h:200
TcpLedbat(void)
Create an unbound tcp socket.
Definition: tcp-ledbat.cc:82