1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2019 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: Apoorva Bharagava <apoorvabhargava13@gmail.com>
19  *         Mohit P. Tahiliani <tahiliani@nitk.edu.in>
20  *
21  */
22 
23 #ifndef TCPLINUXRENO_H
24 #define TCPLINUXRENO_H
25 
26 #include "ns3/tcp-congestion-ops.h"
27 #include "ns3/tcp-socket-state.h"
28 
29 namespace ns3 {
30 
31 class TcpLinuxReno : public TcpCongestionOps
32 {
33 public:
34   /**
35    * \brief Get the type ID.
36    * \return the object TypeId
37    */
38   static TypeId GetTypeId (void);
39 
40   TcpLinuxReno ();
41 
42   /**
43    * \brief Copy constructor.
44    * \param sock object to copy.
45    */
46   TcpLinuxReno (const TcpLinuxReno& sock);
47 
48   ~TcpLinuxReno ();
49 
50   std::string GetName () const;
51 
52   virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
53   virtual uint32_t GetSsThresh (Ptr<const TcpSocketState> tcb,
54                                 uint32_t bytesInFlight);
55   virtual Ptr<TcpCongestionOps> Fork ();
56 
57 protected:
58   /**
59    * Slow start phase handler
60    * \param tcb Transmission Control Block of the connection
61    * \param segmentsAcked count of segments acked
62    * \return Number of segments acked minus the difference between the receiver and sender Cwnd
63    */
64   virtual uint32_t SlowStart (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
65   /**
66    * Congestion avoidance phase handler
67    * \param tcb Transmission Control Block of the connection
68    * \param segmentsAcked count of segments acked
69    */
70   virtual void CongestionAvoidance (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
71 
72 private:
73   uint32_t m_cWndCnt {0}; //!< Linear increase counter
74 };
75 
76 } // namespace ns3
77 
78 #endif // TCPLINUXRENO_H
79