author | Tommaso Pecorella <tommaso.pecorella@unifi.it> |
Wed, 20 Nov 2013 20:15:02 +0100 | |
changeset 10440 | 1e48ff9185f1 |
parent 10158 | 971f362648c3 |
child 10855 | 7ef081ddfc7f |
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 |
|
10158
971f362648c3
Link to RFC num with \RFC{num}
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
7608
diff
changeset
|
40 |
* also \RFC{2001}. |
6694 | 41 |
*/ |
42 |
class TcpTahoe : public TcpSocketBase |
|
43 |
{ |
|
44 |
public: |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
45 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
46 |
* \brief Get the type ID. |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
47 |
* \return the object TypeId |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
48 |
*/ |
6694 | 49 |
static TypeId GetTypeId (void); |
50 |
/** |
|
51 |
* Create an unbound tcp socket. |
|
52 |
*/ |
|
53 |
TcpTahoe (void); |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
54 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
55 |
* \brief Copy constructor |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
56 |
* \param sock the object to copy |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
57 |
*/ |
6694 | 58 |
TcpTahoe (const TcpTahoe& sock); |
59 |
virtual ~TcpTahoe (void); |
|
60 |
||
6697
6f1114f669ff
fix valgrind warnings for new TCP code
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
61 |
// From TcpSocketBase |
7176
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
62 |
virtual int Connect (const Address &address); |
9f2663992e99
internet coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents:
6834
diff
changeset
|
63 |
virtual int Listen (void); |
6694 | 64 |
|
65 |
protected: |
|
66 |
virtual uint32_t Window (void); // Return the max possible number of unacked bytes |
|
67 |
virtual Ptr<TcpSocketBase> Fork (void); // Call CopyObject<TcpTahoe> to clone me |
|
68 |
virtual void NewAck (SequenceNumber32 const& seq); // Inc cwnd and call NewAck() of parent |
|
69 |
virtual void DupAck (const TcpHeader& t, uint32_t count); // Treat 3 dupack as timeout |
|
70 |
virtual void Retransmit (void); // Retransmit time out |
|
71 |
||
72 |
// Implementing ns3::TcpSocket -- Attribute get/set |
|
73 |
virtual void SetSegSize (uint32_t size); |
|
74 |
virtual void SetSSThresh (uint32_t threshold); |
|
75 |
virtual uint32_t GetSSThresh (void) const; |
|
76 |
virtual void SetInitialCwnd (uint32_t cwnd); |
|
77 |
virtual uint32_t GetInitialCwnd (void) const; |
|
6697
6f1114f669ff
fix valgrind warnings for new TCP code
Tom Henderson <tomh@tomh.org>
parents:
6694
diff
changeset
|
78 |
private: |
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
79 |
/** |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
80 |
* \brief Set the congestion window when connection starts |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
81 |
*/ |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
82 |
void InitializeCwnd (void); |
6694 | 83 |
|
84 |
protected: |
|
10440
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
85 |
TracedValue<uint32_t> m_cWnd; //!< Congestion window |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
86 |
uint32_t m_ssThresh; //!< Slow Start Threshold |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
87 |
uint32_t m_initialCWnd; //!< Initial cWnd value |
1e48ff9185f1
Bug 938 - missing Doxygen in ns-3 (internet model + helper)
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
10158
diff
changeset
|
88 |
uint32_t m_retxThresh; //!< Fast Retransmit threshold |
6694 | 89 |
}; |
90 |
||
91 |
} // namespace ns3 |
|
92 |
||
93 |
#endif /* TCP_TAHOE_H */ |