A Discrete-Event Network Simulator
API
tcp-newreno.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010 Adrian Sai-wah Tam
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  * Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com>
19  */
20 
21 #ifndef TCP_NEWRENO_H
22 #define TCP_NEWRENO_H
23 
24 #include "tcp-socket-base.h"
25 
26 namespace ns3 {
27 
36 class TcpNewReno : public TcpSocketBase
37 {
38 public:
43  static TypeId GetTypeId (void);
47  TcpNewReno (void);
52  TcpNewReno (const TcpNewReno& sock);
53  virtual ~TcpNewReno (void);
54 
55  // From TcpSocketBase
56  virtual int Connect (const Address &address);
57  virtual int Listen (void);
58 
59 protected:
60  virtual uint32_t Window (void); // Return the max possible number of unacked bytes
61  virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpNewReno> to clone me
62  virtual void NewAck (SequenceNumber32 const& seq); // Inc cwnd and call NewAck() of parent
63  virtual void DupAck (const TcpHeader& t, uint32_t count); // Halving cwnd and reset nextTxSequence
64  virtual void Retransmit (void); // Exit fast recovery upon retransmit timeout
65 
66  // Implementing ns3::TcpSocket -- Attribute get/set
67  virtual void SetSegSize (uint32_t size);
68  virtual void SetInitialSSThresh (uint32_t threshold);
69  virtual uint32_t GetInitialSSThresh (void) const;
70  virtual void SetInitialCwnd (uint32_t cwnd);
71  virtual uint32_t GetInitialCwnd (void) const;
72  virtual void ScaleSsThresh (uint8_t scaleFactor);
73 
74 private:
78  void InitializeCwnd (void);
79 
80 protected:
83  uint32_t m_initialCWnd;
84  uint32_t m_initialSsThresh;
86  uint32_t m_retxThresh;
87  bool m_inFastRec;
88  bool m_limitedTx;
89 };
90 
91 } // namespace ns3
92 
93 #endif /* TCP_NEWRENO_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
virtual void NewAck(SequenceNumber32 const &seq)
Update buffers w.r.t.
Definition: tcp-newreno.cc:124
bool m_limitedTx
perform limited transmit
Definition: tcp-newreno.h:88
virtual void ScaleSsThresh(uint8_t scaleFactor)
Scale the initial SsThresh value to the correct one.
Definition: tcp-newreno.cc:269
uint32_t m_initialSsThresh
Initial Slow Start Threshold value.
Definition: tcp-newreno.h:84
virtual int Listen(void)
Listen for incoming connections.
Definition: tcp-newreno.cc:92
virtual uint32_t GetInitialCwnd(void) const
Get the initial Congestion Window.
Definition: tcp-newreno.cc:251
virtual uint32_t Window(void)
Return the max possible number of unacked bytes.
Definition: tcp-newreno.cc:110
An implementation of a stream socket using TCP.
Definition: tcp-newreno.h:36
virtual void SetSegSize(uint32_t size)
Set the segment size.
Definition: tcp-newreno.cc:224
a polymophic address class
Definition: address.h:90
TracedValue< uint32_t > m_ssThresh
Slow Start Threshold.
Definition: tcp-newreno.h:82
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-newreno.cc:38
virtual void DupAck(const TcpHeader &t, uint32_t count)
Received dupack (duplicate ACK)
Definition: tcp-newreno.cc:169
virtual void SetInitialCwnd(uint32_t cwnd)
Set the initial Congestion Window.
Definition: tcp-newreno.cc:244
virtual uint32_t GetInitialSSThresh(void) const
Get the initial Slow Start Threshold.
Definition: tcp-newreno.cc:238
virtual int Connect(const Address &address)
Initiate a connection to a remote host.
Definition: tcp-newreno.cc:101
TracedValue< uint32_t > m_cWnd
Congestion window.
Definition: tcp-newreno.h:81
A base class for implementation of a stream socket using TCP.
void InitializeCwnd(void)
Set the congestion window when connection starts.
Definition: tcp-newreno.cc:257
bool m_inFastRec
currently in fast recovery
Definition: tcp-newreno.h:87
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_retxThresh
Fast Retransmit threshold.
Definition: tcp-newreno.h:86
Header for the Transmission Control Protocol.
Definition: tcp-header.h:44
virtual void Retransmit(void)
Halving cwnd and call DoRetransmit()
Definition: tcp-newreno.cc:201
uint32_t m_initialCWnd
Initial cWnd value.
Definition: tcp-newreno.h:83
virtual Ptr< TcpSocketBase > Fork(void)
Call CopyObject<> to clone me.
Definition: tcp-newreno.cc:117
tuple address
Definition: first.py:37
TcpNewReno(void)
Create an unbound tcp socket.
Definition: tcp-newreno.cc:64
a unique identifier for an interface.
Definition: type-id.h:57
virtual void SetInitialSSThresh(uint32_t threshold)
Set the initial Slow Start Threshold.
Definition: tcp-newreno.cc:231
SequenceNumber32 m_recover
Previous highest Tx seqnum for fast recovery.
Definition: tcp-newreno.h:85
virtual ~TcpNewReno(void)
Definition: tcp-newreno.cc:86