A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
tcp-l4-protocol.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007 Georgia Tech Research Corporation
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: Raj Bhattacharjea <raj.b@gatech.edu>
19
*/
20
21
#ifndef TCP_L4_PROTOCOL_H
22
#define TCP_L4_PROTOCOL_H
23
24
#include <stdint.h>
25
26
#include "ns3/packet.h"
27
#include "ns3/ipv4-address.h"
28
#include "ns3/ipv6-address.h"
29
#include "ns3/ptr.h"
30
#include "ns3/object-factory.h"
31
#include "
ip-l4-protocol.h
"
32
#include "ns3/net-device.h"
33
34
namespace
ns3 {
35
36
class
Node;
37
class
Socket;
38
class
TcpHeader;
39
class
Ipv4EndPointDemux;
40
class
Ipv6EndPointDemux;
41
class
Ipv4Interface;
42
class
TcpSocketBase;
43
class
Ipv4EndPoint;
44
class
Ipv6EndPoint;
45
56
class
TcpL4Protocol
:
public
IpL4Protocol
{
57
public
:
58
static
TypeId
GetTypeId
(
void
);
59
static
const
uint8_t
PROT_NUMBER
;
63
TcpL4Protocol
();
64
virtual
~TcpL4Protocol
();
65
66
void
SetNode
(
Ptr<Node>
node);
67
68
virtual
int
GetProtocolNumber
(
void
)
const
;
69
74
Ptr<Socket>
CreateSocket
(
void
);
75
Ptr<Socket>
CreateSocket
(
TypeId
socketTypeId);
76
77
Ipv4EndPoint
*
Allocate
(
void
);
78
Ipv4EndPoint
*
Allocate
(
Ipv4Address
address);
79
Ipv4EndPoint
*
Allocate
(uint16_t
port
);
80
Ipv4EndPoint
*
Allocate
(
Ipv4Address
address, uint16_t
port
);
81
Ipv4EndPoint
*
Allocate
(
Ipv4Address
localAddress, uint16_t localPort,
82
Ipv4Address
peerAddress, uint16_t peerPort);
83
Ipv6EndPoint
*
Allocate6
(
void
);
84
Ipv6EndPoint
*
Allocate6
(
Ipv6Address
address);
85
Ipv6EndPoint
*
Allocate6
(uint16_t
port
);
86
Ipv6EndPoint
*
Allocate6
(
Ipv6Address
address, uint16_t
port
);
87
Ipv6EndPoint
*
Allocate6
(
Ipv6Address
localAddress, uint16_t localPort,
88
Ipv6Address
peerAddress, uint16_t peerPort);
89
90
void
DeAllocate
(
Ipv4EndPoint
*endPoint);
91
void
DeAllocate
(
Ipv6EndPoint
*endPoint);
92
102
void
Send
(
Ptr<Packet>
packet,
103
Ipv4Address
saddr,
Ipv4Address
daddr,
104
uint16_t sport, uint16_t dport,
Ptr<NetDevice>
oif = 0);
105
void
Send
(
Ptr<Packet>
packet,
106
Ipv6Address
saddr,
Ipv6Address
daddr,
107
uint16_t sport, uint16_t dport,
Ptr<NetDevice>
oif = 0);
114
virtual
enum
IpL4Protocol::RxStatus
Receive
(
Ptr<Packet>
p,
115
Ipv4Header
const
&header,
116
Ptr<Ipv4Interface>
incomingInterface);
117
virtual
enum
IpL4Protocol::RxStatus
Receive
(
Ptr<Packet>
p,
118
Ipv6Address
&src,
119
Ipv6Address
&dst,
120
Ptr<Ipv6Interface>
interface);
121
122
// From IpL4Protocol
123
virtual
void
SetDownTarget
(
IpL4Protocol::DownTargetCallback
cb);
124
virtual
void
SetDownTarget6
(
IpL4Protocol::DownTargetCallback6
cb);
125
// From IpL4Protocol
126
virtual
IpL4Protocol::DownTargetCallback
GetDownTarget
(
void
)
const
;
127
virtual
IpL4Protocol::DownTargetCallback6
GetDownTarget6
(
void
)
const
;
128
129
protected
:
130
virtual
void
DoDispose
(
void
);
131
/*
132
* This function will notify other components connected to the node that a new stack member is now connected
133
* This will be used to notify Layer 3 protocol of layer 4 protocol stack to connect them together.
134
*/
135
virtual
void
NotifyNewAggregate
();
136
private
:
137
Ptr<Node>
m_node
;
138
Ipv4EndPointDemux
*
m_endPoints
;
139
Ipv6EndPointDemux
*
m_endPoints6
;
140
TypeId
m_rttTypeId
;
141
TypeId
m_socketTypeId
;
142
private
:
143
friend
class
TcpSocketBase
;
144
void
SendPacket
(
Ptr<Packet>
,
const
TcpHeader
&,
145
Ipv4Address
,
Ipv4Address
,
Ptr<NetDevice>
oif = 0);
146
void
SendPacket
(
Ptr<Packet>
,
const
TcpHeader
&,
147
Ipv6Address
,
Ipv6Address
,
Ptr<NetDevice>
oif = 0);
148
TcpL4Protocol
(
const
TcpL4Protocol
&o);
149
TcpL4Protocol
&
operator =
(
const
TcpL4Protocol
&o);
150
151
std::vector<Ptr<TcpSocketBase> >
m_sockets
;
152
IpL4Protocol::DownTargetCallback
m_downTarget
;
153
IpL4Protocol::DownTargetCallback6
m_downTarget6
;
154
};
155
156
}
// namespace ns3
157
158
#endif
/* TCP_L4_PROTOCOL_H */
src
internet
model
tcp-l4-protocol.h
Generated on Tue Nov 13 2012 10:32:15 for ns-3 by
1.8.1.2