A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-congestion-ops.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 Natale Patriciello <natale.patriciello@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 */
18#ifndef TCPCONGESTIONOPS_H
19#define TCPCONGESTIONOPS_H
20
21#include "tcp-rate-ops.h"
22#include "tcp-socket-state.h"
23
24namespace ns3
25{
26
52{
53 public:
58 static TypeId GetTypeId();
59
61
67
68 ~TcpCongestionOps() override;
69
75 virtual std::string GetName() const = 0;
76
82 virtual void Init(Ptr<TcpSocketState> tcb [[maybe_unused]])
83 {
84 }
85
101
113 virtual void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
114
127 virtual void PktsAcked(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked, const Time& rtt);
128
146 const TcpSocketState::TcpCongState_t newState);
147
157 virtual void CwndEvent(Ptr<TcpSocketState> tcb, const TcpSocketState::TcpCAEvent_t event);
158
171 virtual bool HasCongControl() const;
172
183 virtual void CongControl(Ptr<TcpSocketState> tcb,
185 const TcpRateOps::TcpRateSample& rs);
186
187 // Present in Linux but not in ns-3 yet:
188 /* call when ack arrives (optional) */
189 // void (*in_ack_event)(struct sock *sk, u32 flags);
190 /* new value of cwnd after loss (optional) */
191 // u32 (*undo_cwnd)(struct sock *sk);
192 /* hook for packet ack accounting (optional) */
193 // void (*pkts_acked)(struct sock *sk, u32 ext, int *attr, union tcp_cc_info *info);
194
201};
202
212{
213 public:
218 static TypeId GetTypeId();
219
220 TcpNewReno();
221
226 TcpNewReno(const TcpNewReno& sock);
227
228 ~TcpNewReno() override;
229
230 std::string GetName() const override;
231
232 void IncreaseWindow(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked) override;
233 uint32_t GetSsThresh(Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight) override;
234 Ptr<TcpCongestionOps> Fork() override;
235
236 protected:
237 virtual uint32_t SlowStart(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
238 virtual void CongestionAvoidance(Ptr<TcpSocketState> tcb, uint32_t segmentsAcked);
239};
240
241} // namespace ns3
242
243#endif // TCPCONGESTIONOPS_H
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
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.
static TypeId GetTypeId()
Get the type ID.
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.
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 uint32_t SlowStart(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
Tcp NewReno slow start algorithm.
virtual void CongestionAvoidance(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked)
NewReno congestion avoidance.
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get the slow start threshold after a loss event.
std::string GetName() const override
Get the name of the congestion control algorithm.
void IncreaseWindow(Ptr< TcpSocketState > tcb, uint32_t segmentsAcked) override
Try to increase the cWnd following the NewReno specification.
static TypeId GetTypeId()
Get the type ID.
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
TcpCAEvent_t
Congestion avoidance events.
TcpCongState_t
Definition of the Congestion state machine.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
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:173
Rate Sample structure.
Definition: tcp-rate-ops.h:139