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
udp-echo-client.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright 2007 University of Washington
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
19
#ifndef UDP_ECHO_CLIENT_H
20
#define UDP_ECHO_CLIENT_H
21
22
#include "ns3/application.h"
23
#include "ns3/event-id.h"
24
#include "ns3/ptr.h"
25
#include "ns3/ipv4-address.h"
26
#include "ns3/traced-callback.h"
27
28
namespace
ns3
{
29
30
class
Socket;
31
class
Packet;
32
39
class
UdpEchoClient
:
public
Application
40
{
41
public
:
46
static
TypeId
GetTypeId
(
void
);
47
48
UdpEchoClient
();
49
50
virtual
~UdpEchoClient
();
51
57
void
SetRemote
(
Address
ip, uint16_t
port
);
62
void
SetRemote
(
Address
addr);
63
74
void
SetDataSize
(uint32_t dataSize);
75
87
uint32_t
GetDataSize
(
void
)
const
;
88
99
void
SetFill
(std::string fill);
100
113
void
SetFill
(uint8_t fill, uint32_t dataSize);
114
131
void
SetFill
(uint8_t *fill, uint32_t fillSize, uint32_t dataSize);
132
133
protected
:
134
virtual
void
DoDispose
(
void
);
135
136
private
:
137
138
virtual
void
StartApplication
(
void
);
139
virtual
void
StopApplication
(
void
);
140
145
void
ScheduleTransmit
(
Time
dt);
149
void
Send
(
void
);
150
158
void
HandleRead
(
Ptr<Socket>
socket);
159
160
uint32_t
m_count
;
161
Time
m_interval
;
162
uint32_t
m_size
;
163
164
uint32_t
m_dataSize
;
165
uint8_t *
m_data
;
166
167
uint32_t
m_sent
;
168
Ptr<Socket>
m_socket
;
169
Address
m_peerAddress
;
170
uint16_t
m_peerPort
;
171
EventId
m_sendEvent
;
172
174
TracedCallback<Ptr<const Packet>
>
m_txTrace
;
175
};
176
177
}
// namespace ns3
178
179
#endif
/* UDP_ECHO_CLIENT_H */
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:102
ns3::Ptr< Socket >
ns3::UdpEchoClient::m_txTrace
TracedCallback< Ptr< const Packet > > m_txTrace
Callbacks for tracing the packet Tx events.
Definition:
udp-echo-client.h:174
ns3::UdpEchoClient::m_dataSize
uint32_t m_dataSize
packet payload size (must be equal to m_size)
Definition:
udp-echo-client.h:164
ns3::UdpEchoClient::~UdpEchoClient
virtual ~UdpEchoClient()
Definition:
udp-echo-client.cc:87
ns3::UdpEchoClient::m_socket
Ptr< Socket > m_socket
Socket.
Definition:
udp-echo-client.h:168
ns3::UdpEchoClient::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
udp-echo-client.cc:113
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition:
traced-callback.h:62
ns3::UdpEchoClient::HandleRead
void HandleRead(Ptr< Socket > socket)
Handle a packet reception.
Definition:
udp-echo-client.cc:362
ns3::UdpEchoClient::SetRemote
void SetRemote(Address ip, uint16_t port)
set the remote address and port
Definition:
udp-echo-client.cc:98
ns3::UdpEchoClient::StopApplication
virtual void StopApplication(void)
Application specific shutdown code.
Definition:
udp-echo-client.cc:172
port
uint16_t port
Definition:
dsdv-manet.cc:44
ns3::Address
a polymophic address class
Definition:
address.h:90
ns3::UdpEchoClient::ScheduleTransmit
void ScheduleTransmit(Time dt)
Schedule the next packet transmission.
Definition:
udp-echo-client.cc:290
ns3::UdpEchoClient::UdpEchoClient
UdpEchoClient()
Definition:
udp-echo-client.cc:77
ns3::Application
The base class for all ns3 applications.
Definition:
application.h:60
ns3::UdpEchoClient::m_data
uint8_t * m_data
packet payload data
Definition:
udp-echo-client.h:165
ns3::UdpEchoClient
A Udp Echo client.
Definition:
udp-echo-client.h:39
ns3::UdpEchoClient::StartApplication
virtual void StartApplication(void)
Application specific startup code.
Definition:
udp-echo-client.cc:120
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::UdpEchoClient::m_count
uint32_t m_count
Maximum number of packets the application will send.
Definition:
udp-echo-client.h:160
ns3::UdpEchoClient::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
udp-echo-client.cc:39
ns3::UdpEchoClient::m_interval
Time m_interval
Packet inter-send time.
Definition:
udp-echo-client.h:161
ns3::UdpEchoClient::SetDataSize
void SetDataSize(uint32_t dataSize)
Set the data size of the packet (the number of bytes that are sent as data to the server)...
Definition:
udp-echo-client.cc:187
ns3::UdpEchoClient::Send
void Send(void)
Send a packet.
Definition:
udp-echo-client.cc:297
ns3::UdpEchoClient::m_sendEvent
EventId m_sendEvent
Event to send the next packet.
Definition:
udp-echo-client.h:171
ns3::EventId
An identifier for simulation events.
Definition:
event-id.h:53
ns3::UdpEchoClient::GetDataSize
uint32_t GetDataSize(void) const
Get the number of data bytes that will be sent to the server.
Definition:
udp-echo-client.cc:203
ns3::UdpEchoClient::m_peerAddress
Address m_peerAddress
Remote peer address.
Definition:
udp-echo-client.h:169
ns3::UdpEchoClient::m_sent
uint32_t m_sent
Counter for sent packets.
Definition:
udp-echo-client.h:167
ns3::UdpEchoClient::m_size
uint32_t m_size
Size of the sent packet.
Definition:
udp-echo-client.h:162
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::UdpEchoClient::m_peerPort
uint16_t m_peerPort
Remote peer port.
Definition:
udp-echo-client.h:170
ns3::UdpEchoClient::SetFill
void SetFill(std::string fill)
Set the data fill of the packet (what is sent as data to the server) to the zero-terminated contents ...
Definition:
udp-echo-client.cc:210
src
applications
model
udp-echo-client.h
Generated on Wed Mar 21 2018 14:24:02 for ns-3 by
1.8.9.1