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 "ns3/tcp-congestion-ops.h"
31 #include "ns3/tcp-recovery-ops.h"
32 
33 namespace ns3 {
34 
64 class TcpVegas : public TcpNewReno
65 {
66 public:
71  static TypeId GetTypeId (void);
72 
76  TcpVegas (void);
77 
82  TcpVegas (const TcpVegas& sock);
83  virtual ~TcpVegas (void);
84 
85  virtual std::string GetName () const;
86 
102  virtual void PktsAcked (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked,
103  const Time& rtt);
104 
113  virtual void CongestionStateSet (Ptr<TcpSocketState> tcb,
114  const TcpSocketState::TcpCongState_t newState);
115 
122  virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
123 
132  virtual uint32_t GetSsThresh (Ptr<const TcpSocketState> tcb,
133  uint32_t bytesInFlight);
134 
135  virtual Ptr<TcpCongestionOps> Fork ();
136 
137 protected:
138 private:
150  void EnableVegas (Ptr<TcpSocketState> tcb);
151 
155  void DisableVegas ();
156 
157 private:
158  uint32_t m_alpha;
159  uint32_t m_beta;
160  uint32_t m_gamma;
163  uint32_t m_cntRtt;
166 };
167 
168 } // namespace ns3
169 
170 #endif // TCPVEGAS_H
TcpVegas(void)
Create an unbound tcp socket.
Definition: tcp-vegas.cc:58
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
SequenceNumber32 m_begSndNxt
Right edge during last RTT.
Definition: tcp-vegas.h:165
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across socket.
Definition: tcp-vegas.cc:92
The NewReno implementation.
Time m_baseRtt
Minimum of all Vegas RTT measurements seen during connection.
Definition: tcp-vegas.h:161
virtual ~TcpVegas(void)
Definition: tcp-vegas.cc:86
An implementation of TCP Vegas.
Definition: tcp-vegas.h:64
Time m_minRtt
Minimum of all RTT measurements within last RTT.
Definition: tcp-vegas.h:162
TcpCongState_t
Definition of the Congestion state machine.
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-vegas.cc:36
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Adjust cwnd following Vegas linear increase/decrease algorithm.
Definition: tcp-vegas.cc:154
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Enable/disable Vegas algorithm depending on the congestion state.
Definition: tcp-vegas.cc:139
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Compute RTTs needed to execute Vegas algorithm.
Definition: tcp-vegas.cc:98
void DisableVegas()
Stop taking Vegas samples.
Definition: tcp-vegas.cc:131
uint32_t m_gamma
Gamma threshold, limit on increase.
Definition: tcp-vegas.h:160
virtual std::string GetName() const
Get the name of the congestion control algorithm.
Definition: tcp-vegas.cc:281
uint32_t m_beta
Beta threshold, upper bound of packets in network.
Definition: tcp-vegas.h:159
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get slow start threshold following Vegas principle.
Definition: tcp-vegas.cc:287
uint32_t m_alpha
Alpha threshold, lower bound of packets in network.
Definition: tcp-vegas.h:158
bool m_doingVegasNow
If true, do Vegas for this RTT.
Definition: tcp-vegas.h:164
a unique identifier for an interface.
Definition: type-id.h:58
uint32_t m_cntRtt
Number of RTT measurements during last RTT.
Definition: tcp-vegas.h:163
void EnableVegas(Ptr< TcpSocketState > tcb)
Enable Vegas algorithm to start taking Vegas samples.
Definition: tcp-vegas.cc:120