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
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
20
#ifndef UDP_ECHO_HELPER_H
21
#define UDP_ECHO_HELPER_H
22
23
#include <ns3/application-helper.h>
24
25
#include <stdint.h>
26
27
namespace
ns3
28
{
29
30
/**
31
* \ingroup udpecho
32
* \brief Create a server application which waits for input UDP packets
33
* and sends them back to the original sender.
34
*/
35
class
UdpEchoServerHelper
:
public
ApplicationHelper
36
{
37
public
:
38
/**
39
* Create UdpEchoServerHelper which will make life easier for people trying
40
* to set up simulations with echos.
41
*
42
* \param port The port the server will wait on for incoming packets
43
*/
44
UdpEchoServerHelper
(uint16_t
port
);
45
};
46
47
/**
48
* \ingroup udpecho
49
* \brief Create an application which sends a UDP packet and waits for an echo of this packet
50
*/
51
class
UdpEchoClientHelper
:
public
ApplicationHelper
52
{
53
public
:
54
/**
55
* Create UdpEchoClientHelper which will make life easier for people trying
56
* to set up simulations with echos. Use this variant with addresses that do
57
* not include a port value (e.g., Ipv4Address and Ipv6Address).
58
*
59
* \param ip The IP address of the remote udp echo server
60
* \param port The port number of the remote udp echo server
61
*/
62
UdpEchoClientHelper
(
const
Address
& ip, uint16_t
port
);
63
/**
64
* Create UdpEchoClientHelper which will make life easier for people trying
65
* to set up simulations with echos. Use this variant with addresses that do
66
* include a port value (e.g., InetSocketAddress and Inet6SocketAddress).
67
*
68
* \param addr The address of the remote udp echo server
69
*/
70
UdpEchoClientHelper
(
const
Address
& addr);
71
72
/**
73
* Given a pointer to a UdpEchoClient application, set the data fill of the
74
* packet (what is sent as data to the server) to the contents of the fill
75
* string (including the trailing zero terminator).
76
*
77
* \warning The size of resulting echo packets will be automatically adjusted
78
* to reflect the size of the fill string -- this means that the PacketSize
79
* attribute may be changed as a result of this call.
80
*
81
* \param app Smart pointer to the application (real type must be UdpEchoClient).
82
* \param fill The string to use as the actual echo data bytes.
83
*/
84
void
SetFill
(
Ptr<Application>
app,
const
std::string& fill);
85
86
/**
87
* Given a pointer to a UdpEchoClient application, set the data fill of the
88
* packet (what is sent as data to the server) to the contents of the fill
89
* byte.
90
*
91
* The fill byte will be used to initialize the contents of the data packet.
92
*
93
* \warning The size of resulting echo packets will be automatically adjusted
94
* to reflect the dataLength parameter -- this means that the PacketSize
95
* attribute may be changed as a result of this call.
96
*
97
* \param app Smart pointer to the application (real type must be UdpEchoClient).
98
* \param fill The byte to be repeated in constructing the packet data..
99
* \param dataLength The desired length of the resulting echo packet data.
100
*/
101
void
SetFill
(
Ptr<Application>
app, uint8_t fill,
uint32_t
dataLength);
102
103
/**
104
* Given a pointer to a UdpEchoClient application, set the data fill of the
105
* packet (what is sent as data to the server) to the contents of the fill
106
* buffer, repeated as many times as is required.
107
*
108
* Initializing the fill to the contents of a single buffer is accomplished
109
* by providing a complete buffer with fillLength set to your desired
110
* dataLength
111
*
112
* \warning The size of resulting echo packets will be automatically adjusted
113
* to reflect the dataLength parameter -- this means that the PacketSize
114
* attribute of the Application may be changed as a result of this call.
115
*
116
* \param app Smart pointer to the application (real type must be UdpEchoClient).
117
* \param fill The fill pattern to use when constructing packets.
118
* \param fillLength The number of bytes in the provided fill pattern.
119
* \param dataLength The desired length of the final echo data.
120
*/
121
void
SetFill
(
Ptr<Application>
app, uint8_t* fill,
uint32_t
fillLength,
uint32_t
dataLength);
122
};
123
124
}
// namespace ns3
125
126
#endif
/* UDP_ECHO_HELPER_H */
ns3::Address
a polymophic address class
Definition:
address.h:101
ns3::ApplicationHelper
A helper to make it easier to instantiate an application on a set of nodes.
Definition:
application-helper.h:39
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::UdpEchoClientHelper
Create an application which sends a UDP packet and waits for an echo of this packet.
Definition:
udp-echo-helper.h:52
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:49
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:36
uint32_t
port
uint16_t port
Definition:
dsdv-manet.cc:44
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
applications
helper
udp-echo-helper.h
Generated on Tue May 28 2024 23:34:07 for ns-3 by
1.9.6