A Discrete-Event Network Simulator
API
tcp-cubic.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2014 Natale Patriciello <natale.patriciello@gmail.com>
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  */
19 
20 #ifndef TCPCUBIC_H
21 #define TCPCUBIC_H
22 
23 #include "ns3/tcp-congestion-ops.h"
24 #include "ns3/tcp-socket-base.h"
25 
26 
27 namespace ns3 {
28 
70 class TcpCubic : public TcpCongestionOps
71 {
72 public:
77  static TypeId GetTypeId (void);
78 
79  TcpCubic ();
80 
85  TcpCubic (const TcpCubic& sock);
86 
87  virtual std::string GetName () const;
88  virtual void PktsAcked (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, const Time& rtt);
89  virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
90  virtual uint32_t GetSsThresh (Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight);
91  virtual void CongestionStateSet (Ptr<TcpSocketState> tcb,
92  const TcpSocketState::TcpCongState_t newState);
93 
94  virtual Ptr<TcpCongestionOps> Fork ();
95 
96 private:
101  {
102  PACKET_TRAIN = 0x1,
103  DELAY = 0x2
104  };
105 
107  double m_beta;
108 
109  bool m_hystart;
116 
117  uint32_t m_initialCwnd;
118  uint8_t m_cntClamp;
119 
120  double m_c;
121 
122  // Cubic parameters
123  uint32_t m_cWndCnt;
124  uint32_t m_lastMaxCwnd;
125  uint32_t m_bicOriginPoint;
126  double m_bicK;
127  // of the current epoch (in s)
130  bool m_found;
136  uint32_t m_sampleCnt;
137 
138 private:
144 
150 
156  uint32_t Update (Ptr<TcpSocketState> tcb);
157 
164  void HystartUpdate (Ptr<TcpSocketState> tcb, const Time &delay);
165 
176  Time HystartDelayThresh (const Time &t) const;
177 };
178 
179 } // namespace ns3
180 
181 #endif // TCPCUBIC_H
Congestion control abstract class.
The Cubic Congestion Control Algorithm.
Definition: tcp-cubic.h:71
Time m_currRtt
Current Rtt.
Definition: tcp-cubic.h:135
void HystartReset(Ptr< const TcpSocketState > tcb)
Reset HyStart parameters.
Definition: tcp-cubic.cc:152
Time m_hystartDelayMax
Maximum time for hystart algorithm.
Definition: tcp-cubic.h:114
Time m_cubicDelta
Time to wait after recovery before update.
Definition: tcp-cubic.h:134
uint32_t m_bicOriginPoint
Origin point of bic function.
Definition: tcp-cubic.h:125
uint32_t Update(Ptr< TcpSocketState > tcb)
Cubic window update after a new ack received.
Definition: tcp-cubic.cc:215
uint32_t m_sampleCnt
Count of samples for HyStart.
Definition: tcp-cubic.h:136
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across sockets.
Definition: tcp-cubic.cc:448
bool m_hystart
Enable or disable HyStart algorithm.
Definition: tcp-cubic.h:109
double m_bicK
Time to origin point from the beginning.
Definition: tcp-cubic.h:126
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Congestion avoidance algorithm implementation.
Definition: tcp-cubic.cc:163
int m_hystartDetect
Detect way for HyStart algorithm.
Definition: tcp-cubic.h:110
uint32_t m_cWndCnt
cWnd integer-to-float counter
Definition: tcp-cubic.h:123
Time m_hystartDelayMin
Minimum time for hystart algorithm.
Definition: tcp-cubic.h:113
bool m_found
The exit point is found?
Definition: tcp-cubic.h:130
SequenceNumber32 m_endSeq
End sequence of the round.
Definition: tcp-cubic.h:132
double m_beta
Beta for cubic multiplicative increase.
Definition: tcp-cubic.h:107
Time m_lastAck
Last time when the ACK spacing is close.
Definition: tcp-cubic.h:133
Time m_hystartAckDelta
Spacing between ack's indicating train.
Definition: tcp-cubic.h:112
bool m_fastConvergence
Enable or disable fast convergence algorithm.
Definition: tcp-cubic.h:106
Time m_delayMin
Min delay.
Definition: tcp-cubic.h:128
Time m_roundStart
Beginning of each round.
Definition: tcp-cubic.h:131
virtual std::string GetName() const
Get the name of the congestion control algorithm.
Definition: tcp-cubic.cc:146
Time m_epochStart
Beginning of an epoch.
Definition: tcp-cubic.h:129
uint8_t m_cntClamp
Modulo of the (avoided) float division for cWnd.
Definition: tcp-cubic.h:118
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Timing information on received ACK.
Definition: tcp-cubic.cc:300
void HystartUpdate(Ptr< TcpSocketState > tcb, const Time &delay)
Update HyStart parameters.
Definition: tcp-cubic.cc:328
double m_c
Cubic Scaling factor.
Definition: tcp-cubic.h:120
void CubicReset(Ptr< const TcpSocketState > tcb)
Reset Cubic parameters.
Definition: tcp-cubic.cc:436
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-cubic.cc:33
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Trigger events/calculations specific to a congestion state.
Definition: tcp-cubic.cc:424
HybridSSDetectionMode
Values to detect the Slow Start mode of HyStart.
Definition: tcp-cubic.h:101
@ DELAY
Detection by delay value.
Definition: tcp-cubic.h:103
@ PACKET_TRAIN
Detection by trains of packet.
Definition: tcp-cubic.h:102
uint32_t m_lastMaxCwnd
Last maximum cWnd.
Definition: tcp-cubic.h:124
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get the slow start threshold after a loss event.
Definition: tcp-cubic.cc:396
Time HystartDelayThresh(const Time &t) const
Clamp time value in a range.
Definition: tcp-cubic.cc:378
uint32_t m_initialCwnd
Initial cWnd.
Definition: tcp-cubic.h:117
uint8_t m_hystartMinSamples
Number of delay samples for detecting the increase of delay.
Definition: tcp-cubic.h:115
uint32_t m_hystartLowWindow
Lower bound cWnd for hybrid slow start (segments)
Definition: tcp-cubic.h:111
TcpCongState_t
Definition of the Congestion state machine.
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.