A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tcp-socket.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006 Georgia Tech Research Corporation
4  * 2007 INRIA
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Authors: George F. Riley<riley@ece.gatech.edu>
20  * Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
21  */
22 
23 #ifndef TCP_SOCKET_H
24 #define TCP_SOCKET_H
25 
26 #include "ns3/socket.h"
27 #include "ns3/traced-callback.h"
28 #include "ns3/callback.h"
29 #include "ns3/ptr.h"
30 #include "ns3/object.h"
31 #include "ns3/nstime.h"
32 
33 namespace ns3 {
34 
35 class Node;
36 class Packet;
37 
41 typedef enum {
42  CLOSED, // 0
43  LISTEN, // 1
44  SYN_SENT, // 2
45  SYN_RCVD, // 3
47  CLOSE_WAIT, // 5
48  LAST_ACK, // 6
49  FIN_WAIT_1, // 7
50  FIN_WAIT_2, // 8
51  CLOSING, // 9
52  TIME_WAIT, // 10
54 } TcpStates_t;
55 
64 class TcpSocket : public Socket
65 {
66 public:
72  static TypeId GetTypeId (void);
73 
74  TcpSocket (void);
75  virtual ~TcpSocket (void);
76 
80  static const char* const TcpStateName[LAST_STATE];
81 
82 private:
83  // Indirect the attribute setting and getting through private virtual methods
84 
89  virtual void SetSndBufSize (uint32_t size) = 0;
90 
95  virtual uint32_t GetSndBufSize (void) const = 0;
96 
101  virtual void SetRcvBufSize (uint32_t size) = 0;
102 
107  virtual uint32_t GetRcvBufSize (void) const = 0;
108 
113  virtual void SetSegSize (uint32_t size) = 0;
114 
119  virtual uint32_t GetSegSize (void) const = 0;
120 
125  virtual void SetSSThresh (uint32_t threshold) = 0;
126 
131  virtual uint32_t GetSSThresh (void) const = 0;
132 
137  virtual void SetInitialCwnd (uint32_t cwnd) = 0;
138 
143  virtual uint32_t GetInitialCwnd (void) const = 0;
144 
149  virtual void SetConnTimeout (Time timeout) = 0;
150 
155  virtual Time GetConnTimeout (void) const = 0;
156 
161  virtual void SetConnCount (uint32_t count) = 0;
162 
167  virtual uint32_t GetConnCount (void) const = 0;
168 
173  virtual void SetDelAckTimeout (Time timeout) = 0;
174 
179  virtual Time GetDelAckTimeout (void) const = 0;
180 
185  virtual void SetDelAckMaxCount (uint32_t count) = 0;
186 
191  virtual uint32_t GetDelAckMaxCount (void) const = 0;
192 
197  virtual void SetTcpNoDelay (bool noDelay) = 0;
198 
203  virtual bool GetTcpNoDelay (void) const = 0;
204 
214  virtual void SetPersistTimeout (Time timeout) = 0;
215 
225  virtual Time GetPersistTimeout (void) const = 0;
226 
227 };
228 
229 } // namespace ns3
230 
231 #endif /* TCP_SOCKET_H */
232 
233 
virtual void SetSndBufSize(uint32_t size)=0
Set the send buffer size.
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
(abstract) base class of all TcpSockets
Definition: tcp-socket.h:64
virtual void SetSSThresh(uint32_t threshold)=0
Set the Slow Start Threshold.
virtual ~TcpSocket(void)
Definition: tcp-socket.cc:118
virtual void SetInitialCwnd(uint32_t cwnd)=0
Set the initial Congestion Window.
virtual void SetRcvBufSize(uint32_t size)=0
Set the receive buffer size.
ns3::Time timeout
virtual void SetPersistTimeout(Time timeout)=0
Set the timout for persistent connection.
A low-level Socket API based loosely on the BSD Socket API.
Definition: socket.h:66
static TypeId GetTypeId(void)
Get the type ID.
Definition: tcp-socket.cc:40
static const char *const TcpStateName[LAST_STATE]
Literal names of TCP states for use in log messages.
Definition: tcp-socket.h:80
TcpStates_t
Names of the 11 TCP states.
Definition: tcp-socket.h:41
virtual uint32_t GetSndBufSize(void) const =0
Get the send buffer size.
virtual void SetDelAckMaxCount(uint32_t count)=0
Set the number of packet to fire an ACK before delay timeout.
virtual void SetTcpNoDelay(bool noDelay)=0
Enable/Disable Nagle's algorithm.
virtual uint32_t GetSSThresh(void) const =0
Get the Slow Start Threshold.
virtual uint32_t GetRcvBufSize(void) const =0
Get the receive buffer size.
virtual void SetDelAckTimeout(Time timeout)=0
Set the time to delay an ACK.
virtual void SetConnCount(uint32_t count)=0
Set the number of connection retries before giving up.
virtual uint32_t GetSegSize(void) const =0
Get the segment size.
virtual Time GetDelAckTimeout(void) const =0
Get the time to delay an ACK.
virtual bool GetTcpNoDelay(void) const =0
Check if Nagle's algorithm is enabled or not.
virtual void SetConnTimeout(Time timeout)=0
Set the connection timeout.
virtual uint32_t GetDelAckMaxCount(void) const =0
Get the number of packet to fire an ACK before delay timeout.
virtual Time GetConnTimeout(void) const =0
Get the connection timeout.
virtual void SetSegSize(uint32_t size)=0
Set the segment size.
a unique identifier for an interface.
Definition: type-id.h:49
virtual uint32_t GetInitialCwnd(void) const =0
Get the initial Congestion Window.
virtual Time GetPersistTimeout(void) const =0
Get the timout for persistent connection.
virtual uint32_t GetConnCount(void) const =0
Get the number of connection retries before giving up.