A Discrete-Event Network Simulator
API
tcp-vegas.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2016 ResiliNets, ITTC, University of Kansas
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: Truc Anh N. Nguyen <annguyen@ittc.ku.edu>
19  *
20  * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
21  * ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets
22  * Information and Telecommunication Technology Center (ITTC)
23  * and Department of Electrical Engineering and Computer Science
24  * The University of Kansas Lawrence, KS USA.
25  */
26 
27 #ifndef TCPVEGAS_H
28 #define TCPVEGAS_H
29 
30 #include "tcp-congestion-ops.h"
31 
32 namespace ns3 {
33 
34 class TcpSocketState;
35 
65 class TcpVegas : public TcpNewReno
66 {
67 public:
72  static TypeId GetTypeId (void);
73 
77  TcpVegas (void);
78 
83  TcpVegas (const TcpVegas& sock);
84  virtual ~TcpVegas (void);
85 
86  virtual std::string GetName () const;
87 
103  virtual void PktsAcked (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked,
104  const Time& rtt);
105 
114  virtual void CongestionStateSet (Ptr<TcpSocketState> tcb,
115  const TcpSocketState::TcpCongState_t newState);
116 
123  virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
124 
133  virtual uint32_t GetSsThresh (Ptr<const TcpSocketState> tcb,
134  uint32_t bytesInFlight);
135 
136  virtual Ptr<TcpCongestionOps> Fork ();
137 
138 protected:
139 private:
151  void EnableVegas (Ptr<TcpSocketState> tcb);
152 
156  void DisableVegas ();
157 
158 private:
159  uint32_t m_alpha;
160  uint32_t m_beta;
161  uint32_t m_gamma;
164  uint32_t m_cntRtt;
167 };
168 
169 } // namespace ns3
170 
171 #endif // TCPVEGAS_H
The NewReno implementation.
TcpCongState_t
Definition of the Congestion state machine.
An implementation of TCP Vegas.
Definition: tcp-vegas.h:66
virtual std::string GetName() const
Get the name of the congestion control algorithm.
Definition: tcp-vegas.cc:283
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Enable/disable Vegas algorithm depending on the congestion state.
Definition: tcp-vegas.cc:141
virtual ~TcpVegas(void)
Definition: tcp-vegas.cc:88
void DisableVegas()
Stop taking Vegas samples.
Definition: tcp-vegas.cc:133
uint32_t m_cntRtt
Number of RTT measurements during last RTT.
Definition: tcp-vegas.h:164
TcpVegas(void)
Create an unbound tcp socket.
Definition: tcp-vegas.cc:60
uint32_t m_alpha
Alpha threshold, lower bound of packets in network.
Definition: tcp-vegas.h:159
uint32_t m_beta
Beta threshold, upper bound of packets in network.
Definition: tcp-vegas.h:160
bool m_doingVegasNow
If true, do Vegas for this RTT.
Definition: tcp-vegas.h:165
void EnableVegas(Ptr< TcpSocketState > tcb)
Enable Vegas algorithm to start taking Vegas samples.
Definition: tcp-vegas.cc:122
Time m_minRtt
Minimum of all RTT measurements within last RTT.
Definition: tcp-vegas.h:163
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Compute RTTs needed to execute Vegas algorithm.
Definition: tcp-vegas.cc:100
Time m_baseRtt
Minimum of all Vegas RTT measurements seen during connection.
Definition: tcp-vegas.h:162
uint32_t m_gamma
Gamma threshold, limit on increase.
Definition: tcp-vegas.h:161
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Adjust cwnd following Vegas linear increase/decrease algorithm.
Definition: tcp-vegas.cc:156
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-vegas.cc:38
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get slow start threshold following Vegas principle.
Definition: tcp-vegas.cc:289
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across sockets.
Definition: tcp-vegas.cc:94
SequenceNumber32 m_begSndNxt
Right edge during last RTT.
Definition: tcp-vegas.h:166
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.