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-echo-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
9
#ifndef UDP_ECHO_HELPER_H
10
#define UDP_ECHO_HELPER_H
11
12
#include <ns3/application-helper.h>
13
14
#include <stdint.h>
15
16
namespace
ns3
17
{
18
19
/**
20
* \ingroup udpecho
21
* \brief Create a server application which waits for input UDP packets
22
* and sends them back to the original sender.
23
*/
24
class
UdpEchoServerHelper
:
public
ApplicationHelper
25
{
26
public
:
27
/**
28
* Create UdpEchoServerHelper which will make life easier for people trying
29
* to set up simulations with echos.
30
*
31
* \param port The port the server will wait on for incoming packets
32
*/
33
UdpEchoServerHelper
(uint16_t
port
);
34
};
35
36
/**
37
* \ingroup udpecho
38
* \brief Create an application which sends a UDP packet and waits for an echo of this packet
39
*/
40
class
UdpEchoClientHelper
:
public
ApplicationHelper
41
{
42
public
:
43
/**
44
* Create UdpEchoClientHelper which will make life easier for people trying
45
* to set up simulations with echos. Use this variant with addresses that do
46
* not include a port value (e.g., Ipv4Address and Ipv6Address).
47
*
48
* \param ip The IP address of the remote udp echo server
49
* \param port The port number of the remote udp echo server
50
*/
51
UdpEchoClientHelper
(
const
Address
& ip, uint16_t
port
);
52
/**
53
* Create UdpEchoClientHelper which will make life easier for people trying
54
* to set up simulations with echos. Use this variant with addresses that do
55
* include a port value (e.g., InetSocketAddress and Inet6SocketAddress).
56
*
57
* \param addr The address of the remote udp echo server
58
*/
59
UdpEchoClientHelper
(
const
Address
& addr);
60
61
/**
62
* Given a pointer to a UdpEchoClient application, set the data fill of the
63
* packet (what is sent as data to the server) to the contents of the fill
64
* string (including the trailing zero terminator).
65
*
66
* \warning The size of resulting echo packets will be automatically adjusted
67
* to reflect the size of the fill string -- this means that the PacketSize
68
* attribute may be changed as a result of this call.
69
*
70
* \param app Smart pointer to the application (real type must be UdpEchoClient).
71
* \param fill The string to use as the actual echo data bytes.
72
*/
73
void
SetFill
(
Ptr<Application>
app,
const
std::string& fill);
74
75
/**
76
* Given a pointer to a UdpEchoClient application, set the data fill of the
77
* packet (what is sent as data to the server) to the contents of the fill
78
* byte.
79
*
80
* The fill byte will be used to initialize the contents of the data packet.
81
*
82
* \warning The size of resulting echo packets will be automatically adjusted
83
* to reflect the dataLength parameter -- this means that the PacketSize
84
* attribute may be changed as a result of this call.
85
*
86
* \param app Smart pointer to the application (real type must be UdpEchoClient).
87
* \param fill The byte to be repeated in constructing the packet data..
88
* \param dataLength The desired length of the resulting echo packet data.
89
*/
90
void
SetFill
(
Ptr<Application>
app, uint8_t fill,
uint32_t
dataLength);
91
92
/**
93
* Given a pointer to a UdpEchoClient application, set the data fill of the
94
* packet (what is sent as data to the server) to the contents of the fill
95
* buffer, repeated as many times as is required.
96
*
97
* Initializing the fill to the contents of a single buffer is accomplished
98
* by providing a complete buffer with fillLength set to your desired
99
* dataLength
100
*
101
* \warning The size of resulting echo packets will be automatically adjusted
102
* to reflect the dataLength parameter -- this means that the PacketSize
103
* attribute of the Application may be changed as a result of this call.
104
*
105
* \param app Smart pointer to the application (real type must be UdpEchoClient).
106
* \param fill The fill pattern to use when constructing packets.
107
* \param fillLength The number of bytes in the provided fill pattern.
108
* \param dataLength The desired length of the final echo data.
109
*/
110
void
SetFill
(
Ptr<Application>
app, uint8_t* fill,
uint32_t
fillLength,
uint32_t
dataLength);
111
};
112
113
}
// namespace ns3
114
115
#endif
/* UDP_ECHO_HELPER_H */
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::ApplicationHelper
A helper to make it easier to instantiate an application on a set of nodes.
Definition
application-helper.h:28
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::UdpEchoClientHelper
Create an application which sends a UDP packet and waits for an echo of this packet.
Definition
udp-echo-helper.h:41
ns3::UdpEchoClientHelper::UdpEchoClientHelper
UdpEchoClientHelper(const Address &ip, uint16_t port)
Create UdpEchoClientHelper which will make life easier for people trying to set up simulations with e...
Definition
udp-echo-helper.cc:24
ns3::UdpEchoClientHelper::SetFill
void SetFill(Ptr< Application > app, const std::string &fill)
Given a pointer to a UdpEchoClient application, set the data fill of the packet (what is sent as data...
Definition
udp-echo-helper.cc:38
ns3::UdpEchoServerHelper
Create a server application which waits for input UDP packets and sends them back to the original sen...
Definition
udp-echo-helper.h:25
ns3::UdpEchoServerHelper::UdpEchoServerHelper
UdpEchoServerHelper(uint16_t port)
Create UdpEchoServerHelper which will make life easier for people trying to set up simulations with e...
Definition
udp-echo-helper.cc:18
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
helper
udp-echo-helper.h
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0