A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
tcp-westwood-plus.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 ResiliNets, ITTC, University of Kansas
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Authors: Siddharth Gangadhar <siddharth@ittc.ku.edu>, Truc Anh N. Nguyen <annguyen@ittc.ku.edu>,
7 * and Greeshma Umapathi
8 *
9 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
10 * ResiliNets Research Group https://resilinets.org/
11 * Information and Telecommunication Technology Center (ITTC)
12 * and Department of Electrical Engineering and Computer Science
13 * The University of Kansas Lawrence, KS USA.
14 *
15 * Work supported in part by NSF FIND (Future Internet Design) Program
16 * under grant CNS-0626918 (Postmodern Internet Architecture),
17 * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
18 * US Department of Defense (DoD), and ITTC at The University of Kansas.
19 */
20
21#ifndef TCP_WESTWOOD_H
22#define TCP_WESTWOOD_H
23
24#include "tcp-congestion-ops.h"
25#include "tcp-recovery-ops.h"
26
27#include "ns3/data-rate.h"
28#include "ns3/event-id.h"
29#include "ns3/traced-value.h"
30
31namespace ns3
32{
33
34class Time;
35
36/**
37 * @ingroup congestionOps
38 *
39 * @brief An implementation of TCP Westwood+.
40 *
41 * Westwood+ employ the AIAD (Additive Increase/Adaptive Decrease)
42 * congestion control paradigm. When a congestion episode happens,
43 * instead of halving the cwnd, these protocols try to estimate the network's
44 * bandwidth and use the estimated value to adjust the cwnd.
45 * While Westwood performs the bandwidth sampling every ACK reception,
46 * Westwood+ samples the bandwidth every RTT.
47 *
48 * The two main methods in the implementation are the CountAck (const TCPHeader&)
49 * and the EstimateBW (int, const, Time). The CountAck method calculates
50 * the number of acknowledged segments on the receipt of an ACK.
51 * The EstimateBW estimates the bandwidth based on the value returned by CountAck
52 * and the sampling interval (last RTT).
53 *
54 * WARNING: this TCP model lacks validation and regression tests; use with caution.
55 */
57{
58 public:
59 /**
60 * @brief Get the type ID.
61 * @return the object TypeId
62 */
63 static TypeId GetTypeId();
64
66 /**
67 * @brief Copy constructor
68 * @param sock the object to copy
69 */
71 ~TcpWestwoodPlus() override;
72
73 /**
74 * @brief Filter type (None or Tustin)
75 */
77 {
79 TUSTIN
80 };
81
82 uint32_t GetSsThresh(Ptr<const TcpSocketState> tcb, uint32_t bytesInFlight) override;
83
84 void PktsAcked(Ptr<TcpSocketState> tcb, uint32_t packetsAcked, const Time& rtt) override;
85
86 Ptr<TcpCongestionOps> Fork() override;
87
88 private:
89 /**
90 * Update the total number of acknowledged packets during the current RTT
91 *
92 * @param [in] acked the number of packets the currently received ACK acknowledges
93 */
94 void UpdateAckedSegments(int acked);
95
96 /**
97 * Estimate the network's bandwidth
98 *
99 * @param [in] rtt the RTT estimation.
100 * @param [in] tcb the socket state.
101 */
102 void EstimateBW(const Time& rtt, Ptr<TcpSocketState> tcb);
103
104 protected:
105 TracedValue<DataRate> m_currentBW; //!< Current value of the estimated BW
106 DataRate m_lastSampleBW; //!< Last bandwidth sample
107 DataRate m_lastBW; //!< Last bandwidth sample after being filtered
108 FilterType m_fType; //!< 0 for none, 1 for Tustin
109
110 uint32_t m_ackedSegments; //!< The number of segments ACKed between RTTs
111 bool m_IsCount; //!< Start keeping track of m_ackedSegments for Westwood+ if TRUE
112 EventId m_bwEstimateEvent; //!< The BW estimation event for Westwood+
113 Time m_lastAck; //!< The last ACK time
114};
115
116} // namespace ns3
117
118#endif /* TCP_WESTWOOD_H */
Class for representing data rates.
Definition data-rate.h:78
An identifier for simulation events.
Definition event-id.h:45
Smart pointer class similar to boost::intrusive_ptr.
The NewReno implementation.
An implementation of TCP Westwood+.
void EstimateBW(const Time &rtt, Ptr< TcpSocketState > tcb)
Estimate the network's bandwidth.
TracedValue< DataRate > m_currentBW
Current value of the estimated BW.
DataRate m_lastBW
Last bandwidth sample after being filtered.
EventId m_bwEstimateEvent
The BW estimation event for Westwood+.
void UpdateAckedSegments(int acked)
Update the total number of acknowledged packets during the current RTT.
FilterType
Filter type (None or Tustin)
DataRate m_lastSampleBW
Last bandwidth sample.
uint32_t GetSsThresh(Ptr< const TcpSocketState > tcb, uint32_t bytesInFlight) override
Get the slow start threshold after a loss event.
void PktsAcked(Ptr< TcpSocketState > tcb, uint32_t packetsAcked, const Time &rtt) override
Timing information on received ACK.
bool m_IsCount
Start keeping track of m_ackedSegments for Westwood+ if TRUE.
FilterType m_fType
0 for none, 1 for Tustin
Time m_lastAck
The last ACK time.
uint32_t m_ackedSegments
The number of segments ACKed between RTTs.
static TypeId GetTypeId()
Get the type ID.
Ptr< TcpCongestionOps > Fork() override
Copy the congestion control algorithm across sockets.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
Trace classes with value semantics.
a unique identifier for an interface.
Definition type-id.h:48
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition nstime.h:864
Every class exported by the ns3 library is enclosed in the ns3 namespace.