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 TCPHIGHSPEED_H
21 #define TCPHIGHSPEED_H
22 
23 #include "tcp-congestion-ops.h"
24 
25 namespace ns3 {
26 
27 class TcpSocketState;
28 
29 /**
30  * \ingroup congestionOps
31  *
32  * \brief An implementation of TCP HighSpeed
33  *
34  * TCP HighSpeed is designed for high-capacity channels or, in general, for
35  * TCP connections with large congestion windows.
36  * Conceptually, with respect to the standard TCP, HighSpeed makes the
37  * cWnd grow faster during the probing phases and accelerates the
38  * cWnd recovery from losses.
39  * This behavior is executed only when the window grows beyond a
40  * certain threshold, which allows TCP Highspeed to be friendly with standard
41  * TCP in environments with heavy congestion, without introducing new dangers
42  * of congestion collapse.
43  * At the core of TCP HighSpeed there are two functions, a(w) and b(w), which respectively
44  * specify the cWnd growth addendum and the cWnd reduction factor when
45  * given an actual cWnd value w.
46  *
47  * More information: http://dl.acm.org/citation.cfm?id=2756518
48  */
49 class TcpHighSpeed : public TcpNewReno
50 {
51 public:
52   /**
53    * \brief Get the type ID.
54    * \return the object TypeId
55    */
56   static TypeId GetTypeId (void);
57 
58   /**
59    * Create an unbound tcp socket.
60    */
61   TcpHighSpeed (void);
62 
63   /**
64    * \brief Copy constructor
65    * \param sock the object to copy
66    */
67   TcpHighSpeed (const TcpHighSpeed& sock);
68   virtual ~TcpHighSpeed (void);
69 
70   virtual std::string GetName () const;
71 
72   virtual uint32_t GetSsThresh (Ptr<const TcpSocketState> tcb,
73                                 uint32_t bytesInFlight);
74 
75   virtual Ptr<TcpCongestionOps> Fork ();
76 
77   /**
78    * \brief Lookup table for the coefficient a (from RFC 3649)
79    *
80    * \param w Window value (in packets)
81    *
82    * \return the coefficient a
83    */
84   static uint32_t  TableLookupA (uint32_t w);
85 
86   /**
87    * \brief Lookup table for the coefficient b (from RFC 3649)
88    *
89    * \param w Window value (in packets)
90    *
91    * \return the coefficient b
92    */
93   static double    TableLookupB (uint32_t w);
94 
95 protected:
96   virtual void CongestionAvoidance (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
97 
98 private:
99   uint32_t m_ackCnt; //!< Number of received ACK, corrected with the coefficient a
100 };
101 
102 } // namespace ns3
103 
104 #endif // TCPHIGHSPEED_H
105