LEFT | RIGHT |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2010 Adrian Sai-wah Tam | 3 * Copyright (c) 2010 Adrian Sai-wah Tam |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com> | 18 * Author: Adrian Sai-wah Tam <adrian.sw.tam@gmail.com> |
19 */ | 19 */ |
20 | 20 |
21 #ifndef TCP_RENO_H | 21 #ifndef TCP_RENO_H |
22 #define TCP_RENO_H | 22 #define TCP_RENO_H |
23 | 23 |
24 #include "tcp-tahoe.h" | 24 #include "tcp-socket-base.h" |
25 | 25 |
26 namespace ns3 { | 26 namespace ns3 { |
27 | 27 |
28 /** | 28 /** |
29 * \ingroup socket | 29 * \ingroup socket |
30 * \ingroup tcp | 30 * \ingroup tcp |
31 * | 31 * |
32 * \brief An implementation of a stream socket using TCP. | 32 * \brief An implementation of a stream socket using TCP. |
33 * | 33 * |
34 * This class contains the Reno implementation of TCP, according to RFC2581, | 34 * This class contains the Reno implementation of TCP, according to RFC2581, |
35 * except sec.4.1 "re-starting idle connections", which we do not detect for | 35 * except sec.4.1 "re-starting idle connections", which we do not detect for |
36 * idleness and thus no slow start upon resumption. | 36 * idleness and thus no slow start upon resumption. |
37 */ | 37 */ |
38 class TcpReno : public TcpTahoe | 38 class TcpReno : public TcpSocketBase |
39 { | 39 { |
40 public: | 40 public: |
41 static TypeId GetTypeId (void); | 41 static TypeId GetTypeId (void); |
42 /** | 42 /** |
43 * Create an unbound tcp socket. | 43 * Create an unbound tcp socket. |
44 */ | 44 */ |
45 TcpReno (void); | 45 TcpReno (void); |
46 TcpReno (const TcpReno& sock); | 46 TcpReno (const TcpReno& sock); |
47 virtual ~TcpReno (void); | 47 virtual ~TcpReno (void); |
48 | 48 |
| 49 // Set associated Node, TcpL4Protocol, RttEstimator to this socket |
| 50 virtual void SetNode (Ptr<Node> node); |
| 51 |
49 protected: | 52 protected: |
| 53 virtual uint32_t Window (void); // Return the max possible number of unacked b
ytes |
50 virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpReno> to clone m
e | 54 virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpReno> to clone m
e |
51 virtual void NewAck (SequenceNumber const& seq); // Fast recovery | 55 virtual void NewAck (const SequenceNumber32& seq); // Inc cwnd and call NewAck
() of parent |
52 virtual void DupAck (const TcpHeader& t, uint32_t count); // Fast retransmit | 56 virtual void DupAck (const TcpHeader& t, uint32_t count); // Fast retransmit |
53 virtual void Retransmit (void); // Retransmit timeout | 57 virtual void Retransmit (void); // Retransmit timeout |
| 58 |
| 59 // Implementing ns3::TcpSocket -- Attribute get/set |
| 60 virtual void SetSegSize (uint32_t size); |
| 61 virtual void SetSSThresh (uint32_t threshold); |
| 62 virtual uint32_t GetSSThresh (void) const; |
| 63 virtual void SetInitialCwnd (uint32_t cwnd); |
| 64 virtual uint32_t GetInitialCwnd (void) const; |
| 65 |
| 66 protected: |
| 67 TracedValue<uint32_t> m_cWnd; //< Congestion window |
| 68 uint32_t m_ssThresh; //< Slow Start Threshold |
| 69 uint32_t m_initialCWnd; //< Initial cWnd value |
| 70 bool m_inFastRec; //< currently in fast recovery |
54 }; | 71 }; |
55 | 72 |
56 } // namespace ns3 | 73 } // namespace ns3 |
57 | 74 |
58 #endif /* TCP_RENO_H */ | 75 #endif /* TCP_RENO_H */ |
LEFT | RIGHT |