author | Lalith Suresh <suresh.lalith@gmail.com> |
Sun, 18 Jul 2010 13:29:13 +0530 | |
changeset 6339 | 366418369bda |
parent 6197 | ebe303de4725 |
permissions | -rw-r--r-- |
3135 | 1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2007 INRIA |
|
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
|
19 |
*/ |
|
20 |
||
21 |
#include "ns3/object.h" |
|
22 |
#include "ns3/log.h" |
|
23 |
#include "ns3/uinteger.h" |
|
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
24 |
#include "ns3/double.h" |
3135 | 25 |
#include "ns3/trace-source-accessor.h" |
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
26 |
#include "ns3/nstime.h" |
3135 | 27 |
#include "tcp-socket.h" |
28 |
||
29 |
NS_LOG_COMPONENT_DEFINE ("TcpSocket"); |
|
30 |
||
31 |
namespace ns3 { |
|
32 |
||
33 |
NS_OBJECT_ENSURE_REGISTERED (TcpSocket); |
|
34 |
||
35 |
TypeId |
|
36 |
TcpSocket::GetTypeId (void) |
|
37 |
{ |
|
38 |
static TypeId tid = TypeId ("ns3::TcpSocket") |
|
39 |
.SetParent<Socket> () |
|
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
40 |
.AddAttribute ("SndBufSize", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
41 |
"TcpSocket maximum transmit buffer size (bytes)", |
4611
eb6e86305f4f
bug 596: unbounded tcp queue is evil
Gustavo J. A. M. Carneiro <gjcarneiro@gmail.com>
parents:
3644
diff
changeset
|
42 |
UintegerValue (131072), // 128k |
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
43 |
MakeUintegerAccessor (&TcpSocket::GetSndBufSize, |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
44 |
&TcpSocket::SetSndBufSize), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
45 |
MakeUintegerChecker<uint32_t> ()) |
3135 | 46 |
.AddAttribute ("RcvBufSize", |
47 |
"TcpSocket maximum receive buffer size (bytes)", |
|
6197
ebe303de4725
Bug 835 - Unlimited receive queues in sockets == evil
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents:
4611
diff
changeset
|
48 |
UintegerValue (131072), |
3135 | 49 |
MakeUintegerAccessor (&TcpSocket::GetRcvBufSize, |
50 |
&TcpSocket::SetRcvBufSize), |
|
51 |
MakeUintegerChecker<uint32_t> ()) |
|
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
52 |
.AddAttribute ("SegmentSize", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
53 |
"TCP maximum segment size in bytes (may be adjusted based on MTU discovery)", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
54 |
UintegerValue (536), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
55 |
MakeUintegerAccessor (&TcpSocket::GetSegSize, |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
56 |
&TcpSocket::SetSegSize), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
57 |
MakeUintegerChecker<uint32_t> ()) |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
58 |
.AddAttribute ("SlowStartThreshold", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
59 |
"TCP slow start threshold (bytes)", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
60 |
UintegerValue (0xffff), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
61 |
MakeUintegerAccessor (&TcpSocket::GetSSThresh, |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
62 |
&TcpSocket::SetSSThresh), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
63 |
MakeUintegerChecker<uint32_t> ()) |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
64 |
.AddAttribute ("InitialCwnd", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
65 |
"TCP initial congestion window size (segments)", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
66 |
UintegerValue (1), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
67 |
MakeUintegerAccessor (&TcpSocket::GetInitialCwnd, |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
68 |
&TcpSocket::SetInitialCwnd), |
3135 | 69 |
MakeUintegerChecker<uint32_t> ()) |
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
70 |
.AddAttribute ("ConnTimeout", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
71 |
"TCP retransmission timeout when opening connection (seconds)", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
72 |
TimeValue (Seconds (3)), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
73 |
MakeTimeAccessor (&TcpSocket::GetConnTimeout, |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
74 |
&TcpSocket::SetConnTimeout), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
75 |
MakeTimeChecker ()) |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
76 |
.AddAttribute ("ConnCount", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
77 |
"Number of connection attempts (SYN retransmissions) before returning failure", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
78 |
UintegerValue (6), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
79 |
MakeUintegerAccessor (&TcpSocket::GetConnCount, |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
80 |
&TcpSocket::SetConnCount), |
3135 | 81 |
MakeUintegerChecker<uint32_t> ()) |
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
82 |
.AddAttribute ("DelAckTimeout", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
83 |
"Timeout value for TCP delayed acks, in seconds", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
84 |
TimeValue (Seconds (0.2)), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
85 |
MakeTimeAccessor (&TcpSocket::GetDelAckTimeout, |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
86 |
&TcpSocket::SetDelAckTimeout), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
87 |
MakeTimeChecker ()) |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
88 |
.AddAttribute ("DelAckCount", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
89 |
"Number of packets to wait before sending a TCP ack", |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
90 |
UintegerValue (2), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
91 |
MakeUintegerAccessor (&TcpSocket::GetDelAckMaxCount, |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
92 |
&TcpSocket::SetDelAckMaxCount), |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
93 |
MakeUintegerChecker<uint32_t> ()) |
3135 | 94 |
; |
95 |
return tid; |
|
96 |
} |
|
97 |
||
98 |
TcpSocket::TcpSocket () |
|
99 |
{ |
|
100 |
NS_LOG_FUNCTION_NOARGS (); |
|
101 |
} |
|
102 |
||
103 |
TcpSocket::~TcpSocket () |
|
104 |
{ |
|
105 |
NS_LOG_FUNCTION_NOARGS (); |
|
106 |
} |
|
107 |
||
108 |
}; // namespace ns3 |