A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
src
network
utils
packet-socket-client.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_CLIENT_H
22
#define PACKET_SOCKET_CLIENT_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
52
class
PacketSocketClient
:
public
Application
53
{
54
public
:
59
static
TypeId
GetTypeId
(
void
);
60
61
PacketSocketClient
();
62
63
virtual
~PacketSocketClient
();
64
69
void
SetRemote
(
PacketSocketAddress
addr);
70
75
uint8_t
GetPriority
(
void
)
const
;
76
77
protected
:
78
virtual
void
DoDispose
(
void
);
79
80
private
:
81
82
virtual
void
StartApplication
(
void
);
83
virtual
void
StopApplication
(
void
);
84
89
void
SetPriority
(uint8_t priority);
90
94
void
Send
(
void
);
95
96
uint32_t
m_maxPackets
;
97
Time
m_interval
;
98
uint32_t
m_size
;
99
uint8_t
m_priority
;
100
101
uint32_t
m_sent
;
102
Ptr<Socket>
m_socket
;
103
PacketSocketAddress
m_peerAddress
;
104
bool
m_peerAddressSet
;
105
EventId
m_sendEvent
;
106
108
TracedCallback<Ptr<const Packet>
,
const
Address
&>
m_txTrace
;
109
};
110
111
}
// namespace ns3
112
113
#endif
/* PACKET_SOCKET_CLIENT_H */
ns3::PacketSocketClient::m_maxPackets
uint32_t m_maxPackets
Maximum number of packets the application will send.
Definition:
packet-socket-client.h:96
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:102
ns3::Ptr< Socket >
ns3::PacketSocketClient::StopApplication
virtual void StopApplication(void)
Application specific shutdown code.
Definition:
packet-socket-client.cc:146
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition:
traced-callback.h:62
ns3::PacketSocketAddress
an address for a packet socket
Definition:
packet-socket-address.h:38
ns3::PacketSocketClient::m_peerAddressSet
bool m_peerAddressSet
Sanity check.
Definition:
packet-socket-client.h:104
ns3::PacketSocketClient::~PacketSocketClient
virtual ~PacketSocketClient()
Definition:
packet-socket-client.cc:85
ns3::Address
a polymophic address class
Definition:
address.h:90
ns3::PacketSocketClient::m_sent
uint32_t m_sent
Counter for sent packets.
Definition:
packet-socket-client.h:101
ns3::PacketSocketClient::m_interval
Time m_interval
Packet inter-send time.
Definition:
packet-socket-client.h:97
ns3::PacketSocketClient::StartApplication
virtual void StartApplication(void)
Application specific startup code.
Definition:
packet-socket-client.cc:122
ns3::Application
The base class for all ns3 applications.
Definition:
application.h:60
ns3::PacketSocketClient::m_sendEvent
EventId m_sendEvent
Event to send the next packet.
Definition:
packet-socket-client.h:105
ns3::PacketSocketClient::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
packet-socket-client.cc:43
ns3::PacketSocketClient::SetPriority
void SetPriority(uint8_t priority)
Manually set the socket priority.
Definition:
packet-socket-client.cc:106
ns3::PacketSocketClient::m_socket
Ptr< Socket > m_socket
Socket.
Definition:
packet-socket-client.h:102
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::PacketSocketClient::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
packet-socket-client.cc:99
ns3::PacketSocketClient::m_txTrace
TracedCallback< Ptr< const Packet >, const Address & > m_txTrace
Traced Callback: sent packets, source address.
Definition:
packet-socket-client.h:108
ns3::PacketSocketClient
A simple client.
Definition:
packet-socket-client.h:52
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:53
ns3::PacketSocketClient::SetRemote
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used
Definition:
packet-socket-client.cc:91
ns3::PacketSocketClient::GetPriority
uint8_t GetPriority(void) const
Query the priority value of this socket.
Definition:
packet-socket-client.cc:116
ns3::PacketSocketClient::Send
void Send(void)
Send a packet.
Definition:
packet-socket-client.cc:154
ns3::PacketSocketClient::m_peerAddress
PacketSocketAddress m_peerAddress
Remote peer address.
Definition:
packet-socket-client.h:103
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::PacketSocketClient::m_size
uint32_t m_size
Size of the sent packet.
Definition:
packet-socket-client.h:98
ns3::PacketSocketClient::m_priority
uint8_t m_priority
Priority of the sent packets.
Definition:
packet-socket-client.h:99
ns3::PacketSocketClient::PacketSocketClient
PacketSocketClient()
Definition:
packet-socket-client.cc:76
Generated on Wed Nov 7 2018 10:02:07 for ns-3 by
1.8.14