A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
tcp-reno.h
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_RENO_H
22 #define TCP_RENO_H
23 
24 #include "tcp-socket-base.h"
25 
26 namespace ns3 {
27 
38 class TcpReno : public TcpSocketBase
39 {
40 public:
41  static TypeId GetTypeId (void);
45  TcpReno (void);
46  TcpReno (const TcpReno& sock);
47  virtual ~TcpReno (void);
48 
49  // From TcpSocketBase
50  virtual int Connect (const Address &address);
51  virtual int Listen (void);
52 
53 protected:
54  virtual uint32_t Window (void); // Return the max possible number of unacked bytes
55  virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpReno> to clone me
56  virtual void NewAck (const SequenceNumber32& seq); // Inc cwnd and call NewAck() of parent
57  virtual void DupAck (const TcpHeader& t, uint32_t count); // Fast retransmit
58  virtual void Retransmit (void); // Retransmit timeout
59 
60  // Implementing ns3::TcpSocket -- Attribute get/set
61  virtual void SetSegSize (uint32_t size);
62  virtual void SetSSThresh (uint32_t threshold);
63  virtual uint32_t GetSSThresh (void) const;
64  virtual void SetInitialCwnd (uint32_t cwnd);
65  virtual uint32_t GetInitialCwnd (void) const;
66 private:
67  void InitializeCwnd (void); // set m_cWnd when connection starts
68 
69 protected:
70  TracedValue<uint32_t> m_cWnd; //< Congestion window
71  uint32_t m_ssThresh; //< Slow Start Threshold
72  uint32_t m_initialCWnd; //< Initial cWnd value
73  uint32_t m_retxThresh; //< Fast Retransmit threshold
74  bool m_inFastRec; //< currently in fast recovery
75 };
76 
77 } // namespace ns3
78 
79 #endif /* TCP_RENO_H */
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:59
virtual int Listen(void)
Definition: tcp-reno.cc:77
virtual void NewAck(const SequenceNumber32 &seq)
Definition: tcp-reno.cc:109
a polymophic address class
Definition: address.h:86
An implementation of a stream socket using TCP.
Definition: tcp-reno.h:38
virtual int Connect(const Address &address)
Definition: tcp-reno.cc:86
A base class for implementation of a stream socket using TCP.
Header for the Transmission Control Protocol.
Definition: tcp-header.h:43
TcpReno(void)
Definition: tcp-reno.cc:54
a unique identifier for an interface.
Definition: type-id.h:44
virtual uint32_t Window(void)
Definition: tcp-reno.cc:95