21 #include "ns3/object.h"
23 #include "ns3/uinteger.h"
24 #include "ns3/double.h"
25 #include "ns3/boolean.h"
26 #include "ns3/trace-source-accessor.h"
27 #include "ns3/nstime.h"
28 #include "tcp-socket.h"
34 NS_OBJECT_ENSURE_REGISTERED (TcpSocket);
36 const char*
const TcpSocket::TcpStateName[LAST_STATE] = {
"CLOSED",
"LISTEN",
"SYN_SENT",
"SYN_RCVD",
"ESTABLISHED",
"CLOSE_WAIT",
"LAST_ACK",
"FIN_WAIT_1",
"FIN_WAIT_2",
"CLOSING",
"TIME_WAIT" };
39 TcpSocket::GetTypeId (
void)
41 static TypeId tid = TypeId (
"ns3::TcpSocket")
43 .AddAttribute (
"SndBufSize",
44 "TcpSocket maximum transmit buffer size (bytes)",
45 UintegerValue (131072),
46 MakeUintegerAccessor (&TcpSocket::GetSndBufSize,
47 &TcpSocket::SetSndBufSize),
48 MakeUintegerChecker<uint32_t> ())
49 .AddAttribute (
"RcvBufSize",
50 "TcpSocket maximum receive buffer size (bytes)",
51 UintegerValue (131072),
52 MakeUintegerAccessor (&TcpSocket::GetRcvBufSize,
53 &TcpSocket::SetRcvBufSize),
54 MakeUintegerChecker<uint32_t> ())
55 .AddAttribute (
"SegmentSize",
56 "TCP maximum segment size in bytes (may be adjusted based on MTU discovery)",
58 MakeUintegerAccessor (&TcpSocket::GetSegSize,
59 &TcpSocket::SetSegSize),
60 MakeUintegerChecker<uint32_t> ())
61 .AddAttribute (
"SlowStartThreshold",
62 "TCP slow start threshold (bytes)",
63 UintegerValue (0xffff),
64 MakeUintegerAccessor (&TcpSocket::GetSSThresh,
65 &TcpSocket::SetSSThresh),
66 MakeUintegerChecker<uint32_t> ())
67 .AddAttribute (
"InitialCwnd",
68 "TCP initial congestion window size (segments)",
70 MakeUintegerAccessor (&TcpSocket::GetInitialCwnd,
71 &TcpSocket::SetInitialCwnd),
72 MakeUintegerChecker<uint32_t> ())
73 .AddAttribute (
"ConnTimeout",
74 "TCP retransmission timeout when opening connection (seconds)",
76 MakeTimeAccessor (&TcpSocket::GetConnTimeout,
77 &TcpSocket::SetConnTimeout),
79 .AddAttribute (
"ConnCount",
80 "Number of connection attempts (SYN retransmissions) before returning failure",
82 MakeUintegerAccessor (&TcpSocket::GetConnCount,
83 &TcpSocket::SetConnCount),
84 MakeUintegerChecker<uint32_t> ())
85 .AddAttribute (
"DelAckTimeout",
86 "Timeout value for TCP delayed acks, in seconds",
88 MakeTimeAccessor (&TcpSocket::GetDelAckTimeout,
89 &TcpSocket::SetDelAckTimeout),
91 .AddAttribute (
"DelAckCount",
92 "Number of packets to wait before sending a TCP ack",
94 MakeUintegerAccessor (&TcpSocket::GetDelAckMaxCount,
95 &TcpSocket::SetDelAckMaxCount),
96 MakeUintegerChecker<uint32_t> ())
97 .AddAttribute (
"TcpNoDelay",
"Set to true to disable Nagle's algorithm",
99 MakeBooleanAccessor (&TcpSocket::GetTcpNoDelay,
100 &TcpSocket::SetTcpNoDelay),
101 MakeBooleanChecker ())
102 .AddAttribute (
"PersistTimeout",
103 "Persist timeout to probe for rx window",
105 MakeTimeAccessor (&TcpSocket::GetPersistTimeout,
106 &TcpSocket::SetPersistTimeout),
112 TcpSocket::TcpSocket ()
117 TcpSocket::~TcpSocket ()
#define NS_LOG_COMPONENT_DEFINE(name)
#define NS_LOG_FUNCTION_NOARGS()
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.