author | Adrian S Tam <adrian.sw.tam@gmail.com> |
Wed, 07 Dec 2011 11:22:10 -0500 | |
changeset 7619 | b4dee6307aa7 |
parent 7608 | de67936e4017 |
child 10158 | 971f362648c3 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7176
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
6694 | 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_TAHOE_H |
|
22 |
#define TCP_TAHOE_H |
|
23 |
||
24 |
#include "tcp-socket-base.h" |
|
25 |
||
26 |
namespace ns3 { |
|
27 |
||
28 |
/** |
|
29 |
* \ingroup socket |
|
30 |
* \ingroup tcp |
|
31 |
* |
|
32 |
* \brief An implementation of a stream socket using TCP. |
|
33 |
* |
|
34 |
* This class contains the Tahoe implementation of TCP. Tahoe is not officially |
|
35 |
* published in RFC. The reference for implementing this is based on |
|
36 |
* Kevin Fall and Sally Floyd, "Simulation-based Comparisons of Tahoe, Reno, and SACK TCP", CCR, 1996 |
|
37 |
* http://inst.eecs.berkeley.edu/~ee122/fa05/projects/Project2/proj2_spec_files/sacks.pdf |
|
38 |
* In summary, we have slow start, congestion avoidance, and fast retransmit. |
|
39 |
* The implementation of these algorithms are based on W. R. Stevens's book and |
|
40 |
* also RFC2001. |
|
41 |
*/ |
|
42 |
class TcpTahoe : public TcpSocketBase |
|
43 |
{ |
|
44 |
public: |
|
45 |
static TypeId GetTypeId (void); |
|
46 |
/** |
|
47 |
* Create an unbound tcp socket. |
|
48 |
*/ |
|
49 |
TcpTahoe (void); |
|
50 |
TcpTahoe (const TcpTahoe& sock); |
|
51 |
virtual ~TcpTahoe (void); |
|
52 |
||
6697
6f1114f669ff
fix valgrind warnings for new TCP code
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
53 |
// From TcpSocketBase |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
54 |
virtual int Connect (const Address &address); |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
55 |
virtual int Listen (void); |
6694 | 56 |
|
57 |
protected: |
|
58 |
virtual uint32_t Window (void); // Return the max possible number of unacked bytes |
|
59 |
virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpTahoe> to clone me |
|
60 |
virtual void NewAck (SequenceNumber32 const& seq); // Inc cwnd and call NewAck() of parent |
|
61 |
virtual void DupAck (const TcpHeader& t, uint32_t count); // Treat 3 dupack as timeout |
|
62 |
virtual void Retransmit (void); // Retransmit time out |
|
63 |
||
64 |
// Implementing ns3::TcpSocket -- Attribute get/set |
|
65 |
virtual void SetSegSize (uint32_t size); |
|
66 |
virtual void SetSSThresh (uint32_t threshold); |
|
67 |
virtual uint32_t GetSSThresh (void) const; |
|
68 |
virtual void SetInitialCwnd (uint32_t cwnd); |
|
69 |
virtual uint32_t GetInitialCwnd (void) const; |
|
6697
6f1114f669ff
fix valgrind warnings for new TCP code
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
70 |
private: |
6f1114f669ff
fix valgrind warnings for new TCP code
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
71 |
void InitializeCwnd (void); // set m_cWnd when connection starts |
6694 | 72 |
|
73 |
protected: |
|
74 |
TracedValue<uint32_t> m_cWnd; //< Congestion window |
|
75 |
uint32_t m_ssThresh; //< Slow Start Threshold |
|
76 |
uint32_t m_initialCWnd; //< Initial cWnd value |
|
7608
de67936e4017
Mixed bugfixes on TCP, closes bug 1166, 1227, 1242.
Adrian S Tam <adrian.sw.tam@gmail.com>
parents:
7385
diff
changeset
|
77 |
uint32_t m_retxThresh; //< Fast Retransmit threshold |
6694 | 78 |
}; |
79 |
||
80 |
} // namespace ns3 |
|
81 |
||
82 |
#endif /* TCP_TAHOE_H */ |