A Discrete-Event Network Simulator
API
tcp-westwood.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013 ResiliNets, ITTC, University of Kansas
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  * Authors: Siddharth Gangadhar <siddharth@ittc.ku.edu>, Truc Anh N. Nguyen <annguyen@ittc.ku.edu>,
19  * and Greeshma Umapathi
20  *
21  * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
22  * ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets
23  * Information and Telecommunication Technology Center (ITTC)
24  * and Department of Electrical Engineering and Computer Science
25  * The University of Kansas Lawrence, KS USA.
26  *
27  * Work supported in part by NSF FIND (Future Internet Design) Program
28  * under grant CNS-0626918 (Postmodern Internet Architecture),
29  * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
30  * US Department of Defense (DoD), and ITTC at The University of Kansas.
31  */
32 
33 #ifndef TCP_WESTWOOD_H
34 #define TCP_WESTWOOD_H
35 
36 #include "tcp-socket-base.h"
37 #include "ns3/packet.h"
38 
39 namespace ns3 {
40 
62 class TcpWestwood : public TcpSocketBase
63 {
64 public:
69  static TypeId GetTypeId (void);
70 
71  TcpWestwood (void);
76  TcpWestwood (const TcpWestwood& sock);
77  virtual ~TcpWestwood (void);
78 
83  {
86  };
87 
91  enum FilterType
92  {
95  };
96 
97 protected:
98  virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpTahoe> to clone me
99  virtual void NewAck (SequenceNumber32 const& seq); // Inc cwnd and call NewAck() of parent
100  virtual void DupAck (const TcpHeader& t, uint32_t count); // Treat 3 dupack as timeout
101  virtual void Retransmit (void); // Retransmit time out
102 
109  virtual void ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader);
110 
116  virtual void EstimateRtt (const TcpHeader& header);
117 
118 private:
125  int CountAck (const TcpHeader& tcpHeader);
126 
132  void UpdateAckedSegments (int acked);
133 
141  void EstimateBW (int acked, const TcpHeader& tcpHeader, Time rtt);
142 
146  void Filtering (void);
147 
148 protected:
149  bool m_inFastRec;
150 
152  double m_lastSampleBW;
153  double m_lastBW;
155  double m_lastAck;
160 
162  bool m_IsCount;
164 
165 };
166 
167 } // namespace ns3
168 
169 #endif /* TCP_WESTWOOD_H */
EventId m_bwEstimateEvent
The BW estimation event for Westwood+.
Definition: tcp-westwood.h:163
int CountAck(const TcpHeader &tcpHeader)
Calculate the number of acknowledged packets upon the receipt of an ACK packet.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
FilterType
Filter type (None or Tustin)
Definition: tcp-westwood.h:91
double m_lastBW
Last bandwidth sample after being filtered.
Definition: tcp-westwood.h:153
int m_accountedFor
The number of received DUPACKs.
Definition: tcp-westwood.h:157
virtual void NewAck(SequenceNumber32 const &seq)
Update buffers w.r.t.
virtual void DupAck(const TcpHeader &t, uint32_t count)
Received dupack (duplicate ACK)
virtual void Retransmit(void)
Halving cwnd and call DoRetransmit()
enum FilterType m_fType
0 for none, 1 for Tustin
Definition: tcp-westwood.h:159
void Filtering(void)
Tustin filter.
A base class for implementation of a stream socket using TCP.
bool m_inFastRec
Currently in fast recovery if TRUE.
Definition: tcp-westwood.h:149
void UpdateAckedSegments(int acked)
Update the total number of acknowledged packets during the current RTT.
double m_lastAck
The time last ACK was received.
Definition: tcp-westwood.h:155
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Header for the Transmission Control Protocol.
Definition: tcp-header.h:44
SequenceNumber32 m_prevAckNo
Previously received ACK number.
Definition: tcp-westwood.h:156
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-westwood.cc:52
virtual ~TcpWestwood(void)
int m_ackedSegments
The number of segments ACKed between RTTs.
Definition: tcp-westwood.h:161
virtual void ReceivedAck(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Process the newly received ACK.
virtual Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
An identifier for simulation events.
Definition: event-id.h:53
double m_lastSampleBW
Last bandwidth sample.
Definition: tcp-westwood.h:152
TracedValue< double > m_currentBW
Current value of the estimated BW.
Definition: tcp-westwood.h:151
bool m_IsCount
Start keeping track of m_ackedSegments for Westwood+ if TRUE.
Definition: tcp-westwood.h:162
void EstimateBW(int acked, const TcpHeader &tcpHeader, Time rtt)
Estimate the network's bandwidth.
ProtocolType
Protocol variant (Westwood or Westwood+)
Definition: tcp-westwood.h:82
Time m_minRtt
Minimum RTT.
Definition: tcp-westwood.h:154
a unique identifier for an interface.
Definition: type-id.h:58
virtual void EstimateRtt(const TcpHeader &header)
Estimate the RTT, record the minimum value, and run a clock on the RTT to trigger Westwood+ bandwidth...
An implementation of a stream socket using TCP.
Definition: tcp-westwood.h:62
enum ProtocolType m_pType
0 for Westwood, 1 for Westwood+
Definition: tcp-westwood.h:158