A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
network
utils
packet-socket-server.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2014 Universita' di Firenze
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: Tommaso Pecorella <tommaso.pecorella@unifi.it>
19
*/
20
21
#ifndef PACKET_SOCKET_SERVER_H
22
#define PACKET_SOCKET_SERVER_H
23
24
#include "ns3/application.h"
25
#include "ns3/event-id.h"
26
#include "ns3/ptr.h"
27
#include "ns3/packet-socket-address.h"
28
29
namespace
ns3
{
30
31
class
Socket;
32
class
Packet;
33
46
class
PacketSocketServer
:
public
Application
47
{
48
public
:
53
static
TypeId
GetTypeId
(
void
);
54
55
PacketSocketServer
();
56
57
virtual
~PacketSocketServer
();
58
63
void
SetLocal
(
PacketSocketAddress
addr);
64
65
protected
:
66
virtual
void
DoDispose
(
void
);
67
68
private
:
69
70
virtual
void
StartApplication
(
void
);
71
virtual
void
StopApplication
(
void
);
72
77
void
HandleRead
(
Ptr<Socket>
socket);
78
79
uint32_t
m_pktRx
;
80
uint32_t
m_bytesRx
;
81
82
Ptr<Socket>
m_socket
;
83
PacketSocketAddress
m_localAddress
;
84
bool
m_localAddressSet
;
85
87
TracedCallback<Ptr<const Packet>
,
const
Address
&>
m_rxTrace
;
88
};
89
90
}
// namespace ns3
91
92
#endif
/* PACKET_SOCKET_SERVER_H */
ns3::Ptr< Socket >
ns3::PacketSocketServer::m_localAddressSet
bool m_localAddressSet
Sanity check.
Definition:
packet-socket-server.h:84
ns3::PacketSocketServer::SetLocal
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used
Definition:
packet-socket-server.cc:102
ns3::PacketSocketServer::m_localAddress
PacketSocketAddress m_localAddress
Local address.
Definition:
packet-socket-server.h:83
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition:
traced-callback.h:62
ns3::PacketSocketServer::m_bytesRx
uint32_t m_bytesRx
Total bytes received.
Definition:
packet-socket-server.h:80
ns3::PacketSocketServer::m_pktRx
uint32_t m_pktRx
The number of received packets.
Definition:
packet-socket-server.h:79
ns3::PacketSocketAddress
an address for a packet socket
Definition:
packet-socket-address.h:38
ns3::PacketSocketServer::StartApplication
virtual void StartApplication(void)
Application specific startup code.
Definition:
packet-socket-server.cc:78
ns3::PacketSocketServer::HandleRead
void HandleRead(Ptr< Socket > socket)
Handle a packet received by the application.
Definition:
packet-socket-server.cc:110
ns3::Address
a polymophic address class
Definition:
address.h:90
ns3::PacketSocketServer::m_rxTrace
TracedCallback< Ptr< const Packet >, const Address & > m_rxTrace
Traced Callback: received packets, source address.
Definition:
packet-socket-server.h:87
ns3::Application
The base class for all ns3 applications.
Definition:
application.h:60
ns3::PacketSocketServer::m_socket
Ptr< Socket > m_socket
Socket.
Definition:
packet-socket-server.h:82
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::PacketSocketServer::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
packet-socket-server.cc:71
ns3::PacketSocketServer::PacketSocketServer
PacketSocketServer()
Definition:
packet-socket-server.cc:56
ns3::PacketSocketServer::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
packet-socket-server.cc:43
ns3::PacketSocketServer::StopApplication
virtual void StopApplication(void)
Application specific shutdown code.
Definition:
packet-socket-server.cc:94
ns3::PacketSocketServer
A server using PacketSocket.
Definition:
packet-socket-server.h:46
ns3::PacketSocketServer::~PacketSocketServer
virtual ~PacketSocketServer()
Definition:
packet-socket-server.cc:65
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
Generated on Wed Nov 7 2018 10:02:07 for ns-3 by
1.8.14