A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-linux-reno.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 NITK Surathkal
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Apoorva Bharagava <apoorvabhargava13@gmail.com>
7 * Mohit P. Tahiliani <tahiliani@nitk.edu.in>
8 *
9 */
10
11#ifndef TCPLINUXRENO_H
12#define TCPLINUXRENO_H
13
14#include "tcp-congestion-ops.h"
15#include "tcp-socket-state.h"
16
17namespace ns3
18{
19
20/**
21 * \ingroup congestionOps
22 *
23 * \brief Reno congestion control algorithm
24 *
25 * This class implement the Reno congestion control type
26 * and it mimics the one implemented in the Linux kernel.
27 */
29{
30 public:
31 /**
32 * \brief Get the type ID.
33 * \return the object TypeId
34 */
35 static TypeId GetTypeId();
36
38
39 /**
40 * \brief Copy constructor.
41 * \param sock object to copy.
42 */
43 TcpLinuxReno(const TcpLinuxReno& sock);
44
45 ~TcpLinuxReno() override;
46
47 std::string GetName() const override;
48
49 void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
50 uint32_t GetSsThresh(Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight) override;
51 Ptr<TcpCongestionOps> Fork() override;
52
53 protected:
54 /**
55 * Slow start phase handler
56 * \param tcb Transmission Control Block of the connection
57 * \param segmentsAcked count of segments acked
58 * \return Number of segments acked minus the difference between the receiver and sender Cwnd
59 */
60 virtual uint32_t SlowStart(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
61 /**
62 * Congestion avoidance phase handler
63 * \param tcb Transmission Control Block of the connection
64 * \param segmentsAcked count of segments acked
65 */
66 virtual void CongestionAvoidance(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
67
68 /**
69 * TcpSocketBase follows the Linux way of setting a flag 'isCwndLimited'
70 * when BytesInFlight() >= cwnd. This flag, if true, will suppress
71 * additive increase window updates for this class. However, some
72 * derived classes using the IncreaseWindow() method may not want this
73 * behavior, so this method exists to allow subclasses to set it to false.
74 *
75 * \param value Value to set whether the isCwndLimited condition
76 * suppresses window updates
77 */
78 void SetSuppressIncreaseIfCwndLimited(bool value);
79
80 private:
81 uint32_t m_cWndCnt{0}; //!< Linear increase counter
82 // The below flag exists for classes derived from TcpLinuxReno (such as
83 // TcpDctcp) that may not want to suppress cwnd increase, unlike Linux's
84 // tcp_reno_cong_avoid()
86 true}; //!< Suppress window increase if TCP is not cwnd limited
87};
88
89} // namespace ns3
90
91#endif // TCPLINUXRENO_H
Smart pointer class similar to boost::intrusive_ptr.
Congestion control abstract class.
Reno congestion control algorithm.
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get the slow start threshold after a loss event.
bool m_suppressIncreaseIfCwndLimited
Suppress window increase if TCP is not cwnd limited.
std::string GetName() const override
Get the name of the congestion control algorithm.
static TypeId GetTypeId()
Get the type ID.
~TcpLinuxReno() override
virtual uint32_t SlowStart(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Slow start phase handler.
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Congestion avoidance algorithm implementation.
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Congestion avoidance phase handler.
uint32_t m_cWndCnt
Linear increase counter.
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
void SetSuppressIncreaseIfCwndLimited(bool value)
TcpSocketBase follows the Linux way of setting a flag 'isCwndLimited' when BytesInFlight() >= cwnd.
a unique identifier for an interface.
Definition type-id.h:48
Every class exported by the ns3 library is enclosed in the ns3 namespace.