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 
28 namespace ns3 {
29 
36 class TcpLedbat : public TcpNewReno
37 {
38 private:
43  {
46  };
47 
52  enum State : uint32_t
53  {
54  LEDBAT_VALID_OWD = (1 << 1),
55  LEDBAT_CAN_SS = (1 << 3)
56  };
57 
58 public:
63  static TypeId GetTypeId (void);
64 
68  TcpLedbat (void);
69 
74  TcpLedbat (const TcpLedbat& sock);
75 
79  virtual ~TcpLedbat (void);
80 
86  virtual std::string GetName () const;
87 
95  virtual void PktsAcked (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked,
96  const Time& rtt);
97 
98  // Inherited
99  virtual Ptr<TcpCongestionOps> Fork ();
100 
107  virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
108 
114  void SetDoSs (SlowStartType doSS);
115 
116 protected:
123  virtual void CongestionAvoidance (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
124 
125 private:
129  struct OwdCircBuf
130  {
131  std::vector<uint32_t> buffer;
132  uint32_t min;
133  };
134 
140  void InitCircBuf (struct OwdCircBuf &buffer);
141 
143  typedef uint32_t (*FilterFunction)(struct OwdCircBuf &);
144 
151  static uint32_t MinCircBuf (struct OwdCircBuf &b);
152 
159  uint32_t CurrentDelay (FilterFunction filter);
160 
166  uint32_t BaseDelay ();
167 
175  void AddDelay (struct OwdCircBuf &cb, uint32_t owd, uint32_t maxlen);
176 
182  void UpdateBaseDelay (uint32_t owd);
183 
185  double m_gain;
187  uint32_t m_baseHistoLen;
188  uint32_t m_noiseFilterLen;
189  uint64_t m_lastRollover;
190  int32_t m_sndCwndCnt;
193  uint32_t m_flag;
194 };
195 
196 } // namespace ns3
197 
198 #endif /* TCP_LEDBAT_H */
uint32_t BaseDelay()
Return the value of base delay.
Definition: tcp-ledbat.cc:156
If LEDBAT allows Slow Start.
Definition: tcp-ledbat.h:55
uint32_t min
The index of minimum value.
Definition: tcp-ledbat.h:132
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:188
std::vector< uint32_t > buffer
Vector to store the delay.
Definition: tcp-ledbat.h:131
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Get information from the acked packet.
Definition: tcp-ledbat.cc:281
uint64_t m_lastRollover
Timestamp of last added delay.
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:221
An implementation of LEDBAT.
Definition: tcp-ledbat.h:36
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Adjust cwnd following LEDBAT algorithm.
Definition: tcp-ledbat.cc:162
The NewReno implementation.
static uint32_t MinCircBuf(struct OwdCircBuf &b)
Return the minimum delay of the buffer.
Definition: tcp-ledbat.cc:137
OwdCircBuf m_baseHistory
Buffer to store the base delay.
Definition: tcp-ledbat.h:191
State
The state of LEDBAT.
Definition: tcp-ledbat.h:52
Buffer structure to store delays.
Definition: tcp-ledbat.h:129
virtual ~TcpLedbat(void)
Destructor.
Definition: tcp-ledbat.cc:120
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-ledbat.cc:31
void InitCircBuf(struct OwdCircBuf &buffer)
Initialise a new buffer.
Definition: tcp-ledbat.cc:97
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across socket.
Definition: tcp-ledbat.cc:126
uint32_t(* FilterFunction)(struct OwdCircBuf &)
Filter function used by LEDBAT for current delay.
Definition: tcp-ledbat.h:143
SlowStartType m_doSs
Permissible Slow Start State.
Definition: tcp-ledbat.h:186
uint32_t m_baseHistoLen
Length of base delay history buffer.
Definition: tcp-ledbat.h:187
uint32_t CurrentDelay(FilterFunction filter)
Return the value of current delay.
Definition: tcp-ledbat.cc:150
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double m_gain
GAIN value from RFC.
Definition: tcp-ledbat.h:185
Time m_target
Target Queue Delay.
Definition: tcp-ledbat.h:184
Do NewReno Slow Start.
Definition: tcp-ledbat.h:45
void UpdateBaseDelay(uint32_t owd)
Update the base delay buffer.
Definition: tcp-ledbat.cc:252
uint32_t m_flag
LEDBAT Flag.
Definition: tcp-ledbat.h:193
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Reduce Congestion.
Definition: tcp-ledbat.cc:180
void SetDoSs(SlowStartType doSS)
Change the Slow Start Capability.
Definition: tcp-ledbat.cc:67
SlowStartType
The slowstart types.
Definition: tcp-ledbat.h:42
OwdCircBuf m_noiseFilter
Buffer to store the current delay.
Definition: tcp-ledbat.h:192
virtual std::string GetName() const
Get the name of the TCP flavour.
Definition: tcp-ledbat.cc:132
a unique identifier for an interface.
Definition: type-id.h:58
int32_t m_sndCwndCnt
The congestion window addition parameter.
Definition: tcp-ledbat.h:190
TcpLedbat(void)
Create an unbound tcp socket.
Definition: tcp-ledbat.cc:81
If valid timestamps are present.
Definition: tcp-ledbat.h:54