A Discrete-Event Network Simulator
API
tcp-congestion-ops.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2015 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#ifndef TCPCONGESTIONOPS_H
20#define TCPCONGESTIONOPS_H
21
22#include "tcp-rate-ops.h"
23#include "tcp-socket-state.h"
24
25namespace ns3 {
26
52{
53public:
58 static TypeId GetTypeId (void);
59
61
67
68 virtual ~TcpCongestionOps ();
69
75 virtual std::string GetName () const = 0;
76
82 virtual void Init ([[maybe_unused]] Ptr<TcpSocketState> tcb)
83 {
84 }
85
101 uint32_t bytesInFlight) = 0;
102
114 virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
115
128 virtual void PktsAcked (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked,
129 const Time& rtt);
130
147 virtual void CongestionStateSet (Ptr<TcpSocketState> tcb,
148 const TcpSocketState::TcpCongState_t newState);
149
159 virtual void CwndEvent (Ptr<TcpSocketState> tcb,
160 const TcpSocketState::TcpCAEvent_t event);
161
174 virtual bool HasCongControl () const;
175
186 virtual void CongControl (Ptr<TcpSocketState> tcb,
188 const TcpRateOps::TcpRateSample &rs);
189
190 // Present in Linux but not in ns-3 yet:
191 /* call when ack arrives (optional) */
192 // void (*in_ack_event)(struct sock *sk, u32 flags);
193 /* new value of cwnd after loss (optional) */
194 // u32 (*undo_cwnd)(struct sock *sk);
195 /* hook for packet ack accounting (optional) */
196 // void (*pkts_acked)(struct sock *sk, u32 ext, int *attr, union tcp_cc_info *info);
197
204};
205
215{
216public:
221 static TypeId GetTypeId (void);
222
223 TcpNewReno ();
224
229 TcpNewReno (const TcpNewReno& sock);
230
231 ~TcpNewReno ();
232
233 std::string GetName () const;
234
235 virtual void IncreaseWindow (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
237 uint32_t bytesInFlight);
238 virtual Ptr<TcpCongestionOps> Fork ();
239
240protected:
241 virtual uint32_t SlowStart (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
242 virtual void CongestionAvoidance (Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
243};
244
245} // namespace ns3
246
247#endif // TCPCONGESTIONOPS_H
A base class which provides memory management and object aggregation.
Definition: object.h:88
Congestion control abstract class.
virtual void CwndEvent(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCAEvent_t event)
Trigger events/calculations on occurrence of congestion window event.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Congestion avoidance algorithm implementation.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)=0
Get the slow start threshold after a loss event.
virtual void CongControl(Ptr< TcpSocketState > tcb, const TcpRateOps::TcpRateConnection &rc, const TcpRateOps::TcpRateSample &rs)
Called when packets are delivered to update cwnd and pacing rate.
virtual void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked, const Time &rtt)
Timing information on received ACK.
virtual bool HasCongControl() const
Returns true when Congestion Control Algorithm implements CongControl.
static TypeId GetTypeId(void)
Get the type ID.
virtual void Init(Ptr< TcpSocketState > tcb)
Set configuration required by congestion control algorithm.
virtual Ptr< TcpCongestionOps > Fork()=0
Copy the congestion control algorithm across sockets.
virtual void CongestionStateSet(Ptr< TcpSocketState > tcb, const TcpSocketState::TcpCongState_t newState)
Trigger events/calculations specific to a congestion state.
virtual std::string GetName() const =0
Get the name of the congestion control algorithm.
The NewReno implementation.
virtual void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Try to increase the cWnd following the NewReno specification.
virtual uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight)
Get the slow start threshold after a loss event.
virtual uint32_t SlowStart(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Tcp NewReno slow start algorithm.
virtual Ptr< TcpCongestionOps > Fork()
Copy the congestion control algorithm across sockets.
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
NewReno congestion avoidance.
std::string GetName() const
Get the name of the congestion control algorithm.
static TypeId GetTypeId(void)
Get the type ID.
TcpCAEvent_t
Congestion avoidance events.
TcpCongState_t
Definition of the Congestion state machine.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Information about the connection rate.
Definition: tcp-rate-ops.h:163
Rate Sample structure.
Definition: tcp-rate-ops.h:134