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
nsc-tcp-l4-protocol.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* This program is free software; you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License version 2 as
5
* published by the Free Software Foundation;
6
*
7
* This program is distributed in the hope that it will be useful,
8
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
* GNU General Public License for more details.
11
*
12
* You should have received a copy of the GNU General Public License
13
* along with this program; if not, write to the Free Software
14
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15
*/
16
17
#ifndef NSC_TCP_L4_PROTOCOL_H
18
#define NSC_TCP_L4_PROTOCOL_H
19
20
#include <stdint.h>
21
22
#include "ns3/packet.h"
23
#include "ns3/ipv4-address.h"
24
#include "ns3/ptr.h"
25
#include "ns3/object-factory.h"
26
#include "ns3/timer.h"
27
#include "
ip-l4-protocol.h
"
28
29
struct
INetStack
;
30
31
namespace
ns3 {
32
33
class
Node;
34
class
Socket;
35
class
Ipv4EndPointDemux;
36
class
Ipv4Interface;
37
class
NscTcpSocketImpl;
38
class
Ipv4EndPoint;
39
class
NscInterfaceImpl;
40
46
class
NscTcpL4Protocol
:
public
IpL4Protocol
{
47
public
:
48
static
const
uint8_t
PROT_NUMBER
;
49
static
TypeId
GetTypeId
(
void
);
53
NscTcpL4Protocol
();
54
virtual
~NscTcpL4Protocol
();
55
56
void
SetNode
(
Ptr<Node>
node);
57
void
SetNscLibrary
(
const
std::string &lib);
58
std::string
GetNscLibrary
(
void
)
const
;
59
virtual
int
GetProtocolNumber
(
void
)
const
;
60
virtual
int
GetVersion
(
void
)
const
;
61
66
Ptr<Socket>
CreateSocket
(
void
);
67
68
Ipv4EndPoint
*
Allocate
(
void
);
69
Ipv4EndPoint
*
Allocate
(
Ipv4Address
address
);
70
Ipv4EndPoint
*
Allocate
(uint16_t
port
);
71
Ipv4EndPoint
*
Allocate
(
Ipv4Address
address
, uint16_t
port
);
72
Ipv4EndPoint
*
Allocate
(
Ipv4Address
localAddress, uint16_t localPort,
73
Ipv4Address
peerAddress, uint16_t peerPort);
74
75
void
DeAllocate
(
Ipv4EndPoint
*endPoint);
76
83
virtual
IpL4Protocol::RxStatus
Receive
(
Ptr<Packet>
p,
84
Ipv4Header
const
&header,
85
Ptr<Ipv4Interface>
incomingInterface);
86
virtual
IpL4Protocol::RxStatus
Receive
(
Ptr<Packet>
p,
87
Ipv6Header
const
&header,
88
Ptr<Ipv6Interface>
interface);
89
90
// From IpL4Protocol
91
virtual
void
SetDownTarget
(
IpL4Protocol::DownTargetCallback
cb);
92
virtual
void
SetDownTarget6
(
IpL4Protocol::DownTargetCallback6
cb);
93
// From IpL4Protocol
94
virtual
IpL4Protocol::DownTargetCallback
GetDownTarget
(
void
)
const
;
95
virtual
IpL4Protocol::DownTargetCallback6
GetDownTarget6
(
void
)
const
;
96
protected
:
97
virtual
void
DoDispose
(
void
);
98
virtual
void
NotifyNewAggregate
();
99
private
:
100
NscTcpL4Protocol
(
NscTcpL4Protocol
const
&);
101
NscTcpL4Protocol
&
operator=
(
NscTcpL4Protocol
const
&);
102
103
// NSC callbacks.
104
// NSC invokes these hooks to interact with the simulator.
105
// In any case, these methods are only to be called by NSC.
106
//
107
// send_callback is invoked by NSCs 'ethernet driver' to re-inject
108
// a packet (i.e. an octet soup consisting of an IP Header, TCP Header
109
// and user payload, if any), into ns-3.
110
void
send_callback
(
const
void
*
data
,
int
datalen);
111
// This is called by the NSC stack whenever something of interest
112
// has happened, e.g. when data arrives on a socket, a listen socket
113
// has a new connection pending, etc.
114
void
wakeup
();
115
// This is called by the Linux stack RNG initialization.
116
// Its also used by the cradle code to add a timestamp to
117
// printk/printf/debug output.
118
void
gettime
(
unsigned
int
*sec,
unsigned
int
*usec);
119
void
AddInterface
(
void
);
120
void
SoftInterrupt
(
void
);
121
friend
class
NscInterfaceImpl
;
122
friend
class
NscTcpSocketImpl
;
123
Ptr<Node>
m_node
;
124
Ipv4EndPointDemux
*
m_endPoints
;
125
INetStack
*
m_nscStack
;
126
NscInterfaceImpl
*
m_nscInterface
;
127
void
*
m_dlopenHandle
;
128
std::string
m_nscLibrary
;
129
Timer
m_softTimer
;
130
std::vector<Ptr<NscTcpSocketImpl> >
m_sockets
;
131
IpL4Protocol::DownTargetCallback
m_downTarget
;
132
};
133
134
}
// namespace ns3
135
136
#endif
/* NSC_TCP_L4_PROTOCOL_H */
ns3::NscTcpL4Protocol
Nsc wrapper glue, to interface with the Ipv4 protocol underneath.
Definition:
nsc-tcp-l4-protocol.h:46
ns3::NscTcpL4Protocol::SoftInterrupt
void SoftInterrupt(void)
Definition:
nsc-tcp-l4-protocol.cc:347
ns3::Ipv6Header
Packet header for IPv6.
Definition:
ipv6-header.h:33
ns3::Ptr< Node >
ns3::Callback< void, Ptr< Packet >, Ipv4Address, Ipv4Address, uint8_t, Ptr< Ipv4Route > >
ns3::Timer
a simple Timer class
Definition:
timer.h:45
ns3::NscTcpL4Protocol::m_downTarget
IpL4Protocol::DownTargetCallback m_downTarget
Definition:
nsc-tcp-l4-protocol.h:131
ns3::NscTcpL4Protocol::m_nscLibrary
std::string m_nscLibrary
Definition:
nsc-tcp-l4-protocol.h:128
ns3::NscTcpL4Protocol::CreateSocket
Ptr< Socket > CreateSocket(void)
Definition:
nsc-tcp-l4-protocol.cc:249
ns3::NscTcpL4Protocol::GetTypeId
static TypeId GetTypeId(void)
Definition:
nsc-tcp-l4-protocol.cc:96
ns3::NscTcpL4Protocol::wakeup
void wakeup()
Definition:
nsc-tcp-l4-protocol.cc:385
ns3::NscTcpL4Protocol::GetDownTarget6
virtual IpL4Protocol::DownTargetCallback6 GetDownTarget6(void) const
Definition:
nsc-tcp-l4-protocol.cc:477
ns3::NscTcpL4Protocol::SetNscLibrary
void SetNscLibrary(const std::string &lib)
Definition:
nsc-tcp-l4-protocol.cc:137
port
uint16_t port
Definition:
dsdv-manet.cc:44
ns3::NscTcpL4Protocol::GetVersion
virtual int GetVersion(void) const
Definition:
nsc-tcp-l4-protocol.cc:219
ns3::NscTcpL4Protocol::m_nscInterface
NscInterfaceImpl * m_nscInterface
Definition:
nsc-tcp-l4-protocol.h:126
ns3::Ipv4EndPointDemux
Demultiplexes packets to various transport layer endpoints.
Definition:
ipv4-end-point-demux.h:43
ns3::Ipv4Header
Packet header for IPv4.
Definition:
ipv4-header.h:31
ns3::NscTcpL4Protocol::SetDownTarget6
virtual void SetDownTarget6(IpL4Protocol::DownTargetCallback6 cb)
Definition:
nsc-tcp-l4-protocol.cc:466
ns3::NscTcpL4Protocol::SetNode
void SetNode(Ptr< Node > node)
Definition:
nsc-tcp-l4-protocol.cc:155
data
uint8_t data[writeSize]
Definition:
socket-bound-tcp-static-routing.cc:53
ns3::NscTcpSocketImpl
Socket logic for the NSC TCP sockets.
Definition:
nsc-tcp-socket-impl.h:53
ns3::NscTcpL4Protocol::NotifyNewAggregate
virtual void NotifyNewAggregate()
Definition:
nsc-tcp-l4-protocol.cc:191
ns3::NscTcpL4Protocol::DoDispose
virtual void DoDispose(void)
Definition:
nsc-tcp-l4-protocol.cc:225
INetStack
Definition:
sim_interface.h:27
ns3::NscTcpL4Protocol::operator=
NscTcpL4Protocol & operator=(NscTcpL4Protocol const &)
ns3::NscTcpL4Protocol::GetNscLibrary
std::string GetNscLibrary(void) const
Definition:
nsc-tcp-l4-protocol.cc:150
ns3::NscTcpL4Protocol::SetDownTarget
virtual void SetDownTarget(IpL4Protocol::DownTargetCallback cb)
Definition:
nsc-tcp-l4-protocol.cc:460
ns3::NscTcpL4Protocol::AddInterface
void AddInterface(void)
Definition:
nsc-tcp-l4-protocol.cc:411
ns3::NscInterfaceImpl
Definition:
nsc-tcp-l4-protocol.cc:57
ns3::NscTcpL4Protocol::m_nscStack
INetStack * m_nscStack
Definition:
nsc-tcp-l4-protocol.h:125
ns3::NscTcpL4Protocol::Receive
virtual IpL4Protocol::RxStatus Receive(Ptr< Packet > p, Ipv4Header const &header, Ptr< Ipv4Interface > incomingInterface)
Receive a packet up the protocol stack.
Definition:
nsc-tcp-l4-protocol.cc:305
ns3::NscTcpL4Protocol::NscTcpL4Protocol
NscTcpL4Protocol()
Constructor.
Definition:
nsc-tcp-l4-protocol.cc:120
ns3::IpL4Protocol
L4 Protocol abstract base class.
Definition:
ip-l4-protocol.h:47
ip-l4-protocol.h
ns3::NscTcpL4Protocol::~NscTcpL4Protocol
virtual ~NscTcpL4Protocol()
Definition:
nsc-tcp-l4-protocol.cc:130
ns3::NscTcpL4Protocol::PROT_NUMBER
static const uint8_t PROT_NUMBER
Definition:
nsc-tcp-l4-protocol.h:48
ns3::NscTcpL4Protocol::m_node
Ptr< Node > m_node
Definition:
nsc-tcp-l4-protocol.h:123
ns3::NscTcpL4Protocol::m_endPoints
Ipv4EndPointDemux * m_endPoints
Definition:
nsc-tcp-l4-protocol.h:124
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:38
ns3::NscTcpL4Protocol::m_sockets
std::vector< Ptr< NscTcpSocketImpl > > m_sockets
Definition:
nsc-tcp-l4-protocol.h:130
ns3::NscTcpL4Protocol::DeAllocate
void DeAllocate(Ipv4EndPoint *endPoint)
Definition:
nsc-tcp-l4-protocol.cc:298
ns3::NscTcpL4Protocol::GetProtocolNumber
virtual int GetProtocolNumber(void) const
Definition:
nsc-tcp-l4-protocol.cc:214
ns3::NscTcpL4Protocol::Allocate
Ipv4EndPoint * Allocate(void)
Definition:
nsc-tcp-l4-protocol.cc:261
ns3::IpL4Protocol::RxStatus
RxStatus
Definition:
ip-l4-protocol.h:50
first.address
tuple address
Definition:
first.py:37
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:49
ns3::NscTcpL4Protocol::m_dlopenHandle
void * m_dlopenHandle
Definition:
nsc-tcp-l4-protocol.h:127
ns3::NscTcpL4Protocol::gettime
void gettime(unsigned int *sec, unsigned int *usec)
Definition:
nsc-tcp-l4-protocol.cc:399
ns3::NscTcpL4Protocol::m_softTimer
Timer m_softTimer
Definition:
nsc-tcp-l4-protocol.h:129
ns3::Ipv4EndPoint
A representation of an internet endpoint/connection.
Definition:
ipv4-end-point.h:47
ns3::NscTcpL4Protocol::send_callback
void send_callback(const void *data, int datalen)
Definition:
nsc-tcp-l4-protocol.cc:354
ns3::NscTcpL4Protocol::GetDownTarget
virtual IpL4Protocol::DownTargetCallback GetDownTarget(void) const
Definition:
nsc-tcp-l4-protocol.cc:471
src
internet
model
nsc-tcp-l4-protocol.h
Generated on Sat Nov 16 2013 12:55:29 for ns-3 by
1.8.5