A Discrete-Event Network Simulator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
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  */
33 #ifndef TCP_WESTWOOD_H
34 #define TCP_WESTWOOD_H
36 #include "tcp-socket-base.h"
37 #include "ns3/packet.h"
39 namespace ns3 {
62 class TcpWestwood : public TcpSocketBase
63 {
64 public:
69  static TypeId GetTypeId (void);
71  TcpWestwood (void);
76  TcpWestwood (const TcpWestwood& sock);
77  virtual ~TcpWestwood (void);
83  {
86  };
91  enum FilterType
92  {
95  };
97  // From TcpSocketBase
98  virtual int Connect (const Address &address);
99  virtual int Listen (void);
101 protected:
102  virtual uint32_t Window (void); // Return the max possible number of unacked bytes
103  virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpTahoe> to clone me
104  virtual void NewAck (SequenceNumber32 const& seq); // Inc cwnd and call NewAck() of parent
105  virtual void DupAck (const TcpHeader& t, uint32_t count); // Treat 3 dupack as timeout
106  virtual void Retransmit (void); // Retransmit time out
114  virtual void ReceivedAck (Ptr<Packet> packet, const TcpHeader& tcpHeader);
121  virtual void EstimateRtt (const TcpHeader& header);
123  // Implementing ns3::TcpSocket -- Attribute get/set
124  virtual void SetSegSize (uint32_t size);
125  virtual void SetSSThresh (uint32_t threshold);
126  virtual uint32_t GetSSThresh (void) const;
127  virtual void SetInitialCwnd (uint32_t cwnd);
128  virtual uint32_t GetInitialCwnd (void) const;
130 private:
134  void InitializeCwnd (void);
142  int CountAck (const TcpHeader& tcpHeader);
149  void UpdateAckedSegments (int acked);
158  void EstimateBW (int acked, const TcpHeader& tcpHeader, Time rtt);
163  void Filtering (void);
165 protected:
167  uint32_t m_ssThresh;
168  uint32_t m_initialCWnd;
169  bool m_inFastRec;
172  double m_lastSampleBW;
173  double m_lastBW;
175  double m_lastAck;
182  bool m_IsCount;
185 };
187 } // namespace ns3
189 #endif /* TCP_WESTWOOD_H */
void InitializeCwnd(void)
Initialize cwnd at the beginning of a connection.
EventId m_bwEstimateEvent
The BW estimation event for Westwood+.
Definition: tcp-westwood.h:183
int CountAck(const TcpHeader &tcpHeader)
Calculate the number of acknowledged packets upon the receipt of an ACK packet.
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
double m_lastBW
Last bandwidth sample after being filtered.
Definition: tcp-westwood.h:173
int m_accountedFor
The number of received DUPACKs.
Definition: tcp-westwood.h:177
uint32_t m_ssThresh
Slow Start Threshold.
Definition: tcp-westwood.h:167
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 uint32_t Window(void)
Return the max possible number of unacked bytes.
virtual void Retransmit(void)
Halving cwnd and call DoRetransmit()
virtual int Listen(void)
Listen for incoming connections.
a polymophic address class
Definition: address.h:86
TracedValue< uint32_t > m_cWnd
Congestion window.
Definition: tcp-westwood.h:166
enum FilterType m_fType
0 for none, 1 for Tustin
Definition: tcp-westwood.h:179
void Filtering(void)
Tustin filter.
virtual uint32_t GetInitialCwnd(void) const
Get the initial Congestion Window.
virtual void SetSSThresh(uint32_t threshold)
Set the Slow Start Threshold.
A base class for implementation of a stream socket using TCP.
bool m_inFastRec
Currently in fast recovery if TRUE.
Definition: tcp-westwood.h:169
void UpdateAckedSegments(int acked)
Update the total number of acknowledged packets during the current RTT.
Protocol variant (Westwood or Westwood+)
Definition: tcp-westwood.h:82
double m_lastAck
The time last ACK was received.
Definition: tcp-westwood.h:175
Header for the Transmission Control Protocol.
Definition: tcp-header.h:43
SequenceNumber32 m_prevAckNo
Previously received ACK number.
Definition: tcp-westwood.h:176
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-westwood.cc:53
virtual void SetSegSize(uint32_t size)
Set the segment size.
Filter type (None or Tustin)
Definition: tcp-westwood.h:91
virtual ~TcpWestwood(void)
int m_ackedSegments
The number of segments ACKed between RTTs.
Definition: tcp-westwood.h:181
virtual void ReceivedAck(Ptr< Packet > packet, const TcpHeader &tcpHeader)
Process the newly received ACK.
virtual void SetInitialCwnd(uint32_t cwnd)
Set the initial Congestion Window.
virtual Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
an identifier for simulation events.
Definition: event-id.h:46
double m_lastSampleBW
Last bandwidth sample.
Definition: tcp-westwood.h:172
TracedValue< double > m_currentBW
Current value of the estimated BW.
Definition: tcp-westwood.h:171
bool m_IsCount
Start keeping track of m_ackedSegments for Westwood+ if TRUE.
Definition: tcp-westwood.h:182
void EstimateBW(int acked, const TcpHeader &tcpHeader, Time rtt)
Estimate the network's bandwidth.
virtual uint32_t GetSSThresh(void) const
Get the Slow Start Threshold.
uint32_t m_initialCWnd
Initial cWnd value.
Definition: tcp-westwood.h:168
Time m_minRtt
Minimum RTT.
Definition: tcp-westwood.h:174
tuple address
Definition: first.py:37
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
a unique identifier for an interface.
Definition: type-id.h:49
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:178