/usr/include/ns3.26/ns3/tcp-congestion-ops.h is in libns3-dev 3.26+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2015 Natale Patriciello <natale.patriciello@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef TCPCONGESTIONOPS_H
#define TCPCONGESTIONOPS_H
#include "ns3/object.h"
#include "ns3/timer.h"
#include "ns3/tcp-socket-base.h"
namespace ns3 {
/**
* \ingroup tcp
* \defgroup congestionOps Congestion Control Algorithms.
*
* The various congestion control algorithms, also known as "TCP flavors".
*/
/**
* \ingroup congestionOps
*
* \brief Congestion control abstract class
*
* The design is inspired on what Linux v4.0 does (but it has been
* in place since years). The congestion control is splitted from the main
* socket code, and it is a pluggable component. An interface has been defined;
* variables are maintained in the TcpSocketState class, while subclasses of
* TcpCongestionOps operate over an instance of that class.
*
* Only three methods has been utilized right now; however, Linux has many others,
* which can be added later in ns-3.
*
* \see IncreaseWindow
* \see PktsAcked
*/
class TcpCongestionOps : public Object
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
TcpCongestionOps ();
/**
* \brief Copy constructor.
* \param other object to copy.
*/
TcpCongestionOps (const TcpCongestionOps &other);
virtual ~TcpCongestionOps ();
/**
* \brief Get the name of the congestion control algorithm
*
* \return A string identifying the name
*/
virtual std::string GetName () const = 0;
/**
* \brief Get the slow start threshold after a loss event
*
* Is guaranteed that the congestion control state (TcpAckState_t) is
* changed BEFORE the invocation of this method.
* The implementator should return the slow start threshold (and not change
* it directly) because, in the future, the TCP implementation may require to
* instantly recover from a loss event (e.g. when there is a network with an high
* reordering factor).
*
* \param tcb internal congestion state
* \param bytesInFlight total bytes in flight
* \return Slow start threshold
*/
virtual uint32_t GetSsThresh (Ptr<const TcpSocketState> tcb,
uint32_t bytesInFlight) = 0;
/**
* \brief Congestion avoidance algorithm implementation
*
* Mimic the function cong_avoid in Linux. New segments have been ACKed,
* and the congestion control duty is to set
*
* The function is allowed to change directly cWnd and/or ssThresh.
*
* \param tcb internal congestion state
* \param segmentsAcked count of segments acked
*/
virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) = 0;
/**
* \brief Timing information on received ACK
*
* The function is called every time an ACK is received (only one time
* also for cumulative ACKs) and contains timing information. It is
* optional (congestion controls can not implement it) and the default
* implementation does nothing.
*
* \param tcb internal congestion state
* \param segmentsAcked count of segments acked
* \param rtt last rtt
*/
virtual void PktsAcked (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked,
const Time& rtt)
{
}
/**
* \brief Trigger events/calculations specific to a congestion state
*
* This function mimics the function set_state in Linux.
* The function is called before changing congestion state.
*
* \param tcb internal congestion state
* \param newState new congestion state to which the TCP is going to switch
*/
virtual void CongestionStateSet (Ptr<TcpSocketState> tcb,
const TcpSocketState::TcpCongState_t newState)
{
}
// Present in Linux but not in ns-3 yet:
/* call when cwnd event occurs (optional) */
// void (*cwnd_event)(struct sock *sk, enum tcp_ca_event ev);
/* call when ack arrives (optional) */
// void (*in_ack_event)(struct sock *sk, u32 flags);
/* new value of cwnd after loss (optional) */
// u32 (*undo_cwnd)(struct sock *sk);
/* hook for packet ack accounting (optional) */
// void (*pkts_acked)(struct sock *sk, u32 num_acked, s32 rtt_us);
/**
* \brief Copy the congestion control algorithm across socket
*
* \return a pointer of the copied object
*/
virtual Ptr<TcpCongestionOps> Fork () = 0;
};
/**
* \brief The NewReno implementation
*
* New Reno introduces partial ACKs inside the well-established Reno algorithm.
* This and other modifications are described in RFC 6582.
*
* \see IncreaseWindow
*/
class TcpNewReno : public TcpCongestionOps
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId (void);
TcpNewReno ();
/**
* \brief Copy constructor.
* \param sock object to copy.
*/
TcpNewReno (const TcpNewReno& sock);
~TcpNewReno ();
std::string GetName () const;
virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
virtual uint32_t GetSsThresh (Ptr<const TcpSocketState> tcb,
uint32_t bytesInFlight);
virtual Ptr<TcpCongestionOps> Fork ();
protected:
virtual uint32_t SlowStart (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
virtual void CongestionAvoidance (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
};
} // namespace ns3
#endif // TCPCONGESTIONOPS_H
|