A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
udp-client.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2007,2008,2009 INRIA, UDCAST
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Amine Ismail <amine.ismail@sophia.inria.fr>
7
* <amine.ismail@udcast.com>
8
*
9
*/
10
11
#ifndef UDP_CLIENT_H
12
#define UDP_CLIENT_H
13
14
#include "ns3/application.h"
15
#include "ns3/event-id.h"
16
#include "ns3/ipv4-address.h"
17
#include "ns3/ptr.h"
18
#include <ns3/traced-callback.h>
19
20
namespace
ns3
21
{
22
23
class
Socket;
24
class
Packet;
25
26
/**
27
* \ingroup udpclientserver
28
*
29
* \brief A Udp client. Sends UDP packet carrying sequence number and time stamp
30
* in their payloads
31
*
32
*/
33
class
UdpClient
:
public
Application
34
{
35
public
:
36
/**
37
* \brief Get the type ID.
38
* \return the object TypeId
39
*/
40
static
TypeId
GetTypeId
();
41
42
UdpClient
();
43
44
~UdpClient
()
override
;
45
46
/**
47
* \brief set the remote address and port
48
* \param ip remote IP address
49
* \param port remote port
50
*/
51
void
SetRemote
(
Address
ip, uint16_t
port
);
52
/**
53
* \brief set the remote address
54
* \param addr remote address
55
*/
56
void
SetRemote
(
Address
addr);
57
58
/**
59
* \return the total bytes sent by this app
60
*/
61
uint64_t
GetTotalTx
()
const
;
62
63
private
:
64
void
StartApplication
()
override
;
65
void
StopApplication
()
override
;
66
67
/**
68
* \brief Send a packet
69
*/
70
void
Send
();
71
72
/// Traced Callback: transmitted packets.
73
TracedCallback<Ptr<const Packet>
>
m_txTrace
;
74
75
/// Callbacks for tracing the packet Tx events, includes source and destination addresses
76
TracedCallback<Ptr<const Packet>
,
const
Address
&,
const
Address
&>
m_txTraceWithAddresses
;
77
78
uint32_t
m_count
;
//!< Maximum number of packets the application will send
79
Time
m_interval
;
//!< Packet inter-send time
80
uint32_t
m_size
;
//!< Size of the sent packet (including the SeqTsHeader)
81
82
uint32_t
m_sent
;
//!< Counter for sent packets
83
uint64_t
m_totalTx
;
//!< Total bytes sent
84
Ptr<Socket>
m_socket
;
//!< Socket
85
Address
m_peerAddress
;
//!< Remote peer address
86
uint16_t
m_peerPort
;
//!< Remote peer port
87
uint8_t
m_tos
;
//!< The packets Type of Service
88
EventId
m_sendEvent
;
//!< Event to send the next packet
89
90
#ifdef NS3_LOG_ENABLE
91
std::string
m_peerAddressString
;
//!< Remote peer address string
92
#endif
// NS3_LOG_ENABLE
93
};
94
95
}
// namespace ns3
96
97
#endif
/* UDP_CLIENT_H */
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::Application
The base class for all ns3 applications.
Definition
application.h:51
ns3::EventId
An identifier for simulation events.
Definition
event-id.h:45
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition
traced-callback.h:43
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::UdpClient
A Udp client.
Definition
udp-client.h:34
ns3::UdpClient::m_interval
Time m_interval
Packet inter-send time.
Definition
udp-client.h:79
ns3::UdpClient::GetTotalTx
uint64_t GetTotalTx() const
Definition
udp-client.cc:243
ns3::UdpClient::m_totalTx
uint64_t m_totalTx
Total bytes sent.
Definition
udp-client.h:83
ns3::UdpClient::~UdpClient
~UdpClient() override
Definition
udp-client.cc:95
ns3::UdpClient::m_sent
uint32_t m_sent
Counter for sent packets.
Definition
udp-client.h:82
ns3::UdpClient::m_socket
Ptr< Socket > m_socket
Socket.
Definition
udp-client.h:84
ns3::UdpClient::m_txTraceWithAddresses
TracedCallback< Ptr< const Packet >, const Address &, const Address & > m_txTraceWithAddresses
Callbacks for tracing the packet Tx events, includes source and destination addresses.
Definition
udp-client.h:76
ns3::UdpClient::m_peerPort
uint16_t m_peerPort
Remote peer port.
Definition
udp-client.h:86
ns3::UdpClient::Send
void Send()
Send a packet.
Definition
udp-client.cc:200
ns3::UdpClient::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
udp-client.cc:35
ns3::UdpClient::m_sendEvent
EventId m_sendEvent
Event to send the next packet.
Definition
udp-client.h:88
ns3::UdpClient::UdpClient
UdpClient()
Definition
udp-client.cc:86
ns3::UdpClient::m_size
uint32_t m_size
Size of the sent packet (including the SeqTsHeader)
Definition
udp-client.h:80
ns3::UdpClient::m_count
uint32_t m_count
Maximum number of packets the application will send.
Definition
udp-client.h:78
ns3::UdpClient::SetRemote
void SetRemote(Address ip, uint16_t port)
set the remote address and port
Definition
udp-client.cc:101
ns3::UdpClient::m_peerAddress
Address m_peerAddress
Remote peer address.
Definition
udp-client.h:85
ns3::UdpClient::m_txTrace
TracedCallback< Ptr< const Packet > > m_txTrace
Traced Callback: transmitted packets.
Definition
udp-client.h:73
ns3::UdpClient::m_tos
uint8_t m_tos
The packets Type of Service.
Definition
udp-client.h:87
ns3::UdpClient::StartApplication
void StartApplication() override
Application specific startup code.
Definition
udp-client.cc:116
ns3::UdpClient::StopApplication
void StopApplication() override
Application specific shutdown code.
Definition
udp-client.cc:193
ns3::UdpClient::m_peerAddressString
std::string m_peerAddressString
Remote peer address string.
Definition
udp-client.h:91
uint32_t
port
uint16_t port
Definition
dsdv-manet.cc:33
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
applications
model
udp-client.h
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0