author | Tom Henderson <tomh@tomh.org> |
Fri, 30 May 2008 10:36:02 -0700 | |
changeset 3183 | fc3b2e03e61e |
parent 3136 | a59b9ce95b6b |
child 3269 | 448134601b03 |
permissions | -rw-r--r-- |
3135 | 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 "socket.h" |
|
27 |
#include "ns3/traced-callback.h" |
|
28 |
#include "ns3/callback.h" |
|
29 |
#include "ns3/ptr.h" |
|
30 |
#include "ns3/object.h" |
|
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
31 |
#include "ns3/nstime.h" |
3135 | 32 |
|
33 |
namespace ns3 { |
|
34 |
||
35 |
class Node; |
|
36 |
class Packet; |
|
37 |
||
38 |
/** |
|
3183 | 39 |
* \ingroup socket |
40 |
* |
|
3135 | 41 |
* \brief (abstract) base class of all TcpSockets |
42 |
* |
|
43 |
* This class exists solely for hosting TcpSocket attributes that can |
|
44 |
* be reused across different implementations. |
|
45 |
*/ |
|
46 |
class TcpSocket : public Socket |
|
47 |
{ |
|
48 |
public: |
|
49 |
static TypeId GetTypeId (void); |
|
50 |
||
51 |
TcpSocket (void); |
|
52 |
virtual ~TcpSocket (void); |
|
53 |
||
54 |
virtual enum Socket::SocketErrno GetErrno (void) const = 0; |
|
55 |
virtual Ptr<Node> GetNode (void) const = 0; |
|
56 |
virtual int Bind () = 0; |
|
57 |
virtual int Close (void) = 0; |
|
58 |
virtual int ShutdownSend (void) = 0; |
|
59 |
virtual int ShutdownRecv (void) = 0; |
|
60 |
virtual int Connect (const Address &address) = 0; |
|
61 |
virtual int Send (Ptr<Packet> p) = 0; |
|
62 |
virtual uint32_t GetTxAvailable (void) const = 0; |
|
63 |
virtual int SendTo (Ptr<Packet> p, const Address &address) = 0; |
|
64 |
virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags) = 0; |
|
65 |
virtual uint32_t GetRxAvailable (void) const = 0; |
|
66 |
||
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
67 |
private: |
3135 | 68 |
// Indirect the attribute setting and getting through private virtual methods |
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
69 |
virtual void SetSndBufSize (uint32_t size) = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
70 |
virtual uint32_t GetSndBufSize (void) const = 0; |
3135 | 71 |
virtual void SetRcvBufSize (uint32_t size) = 0; |
72 |
virtual uint32_t GetRcvBufSize (void) const = 0; |
|
3136
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
73 |
virtual void SetSegSize (uint32_t size) = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
74 |
virtual uint32_t GetSegSize (void) const = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
75 |
virtual void SetAdvWin (uint32_t window) = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
76 |
virtual uint32_t GetAdvWin (void) const = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
77 |
virtual void SetSSThresh (uint32_t threshold) = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
78 |
virtual uint32_t GetSSThresh (void) const = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
79 |
virtual void SetInitialCwnd (uint32_t count) = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
80 |
virtual uint32_t GetInitialCwnd (void) const = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
81 |
virtual void SetConnTimeout (Time timeout) = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
82 |
virtual Time GetConnTimeout (void) const = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
83 |
virtual void SetConnCount (uint32_t count) = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
84 |
virtual uint32_t GetConnCount (void) const = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
85 |
virtual void SetDelAckTimeout (Time timeout) = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
86 |
virtual Time GetDelAckTimeout (void) const = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
87 |
virtual void SetDelAckMaxCount (uint32_t count) = 0; |
a59b9ce95b6b
Move Tcp attributes from factory to TcpSocket
Tom Henderson <tomh@tomh.org>
parents:
3135
diff
changeset
|
88 |
virtual uint32_t GetDelAckMaxCount (void) const = 0; |
3135 | 89 |
|
90 |
}; |
|
91 |
||
92 |
} //namespace ns3 |
|
93 |
||
94 |
#endif /* TCP_SOCKET_H */ |
|
95 |
||
96 |