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