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.cc
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
#include "
udp-echo-helper.h
"
10
11
#include "ns3/address-utils.h"
12
#include "ns3/udp-echo-client.h"
13
#include "ns3/udp-echo-server.h"
14
#include "ns3/uinteger.h"
15
16
namespace
ns3
17
{
18
19
UdpEchoServerHelper::UdpEchoServerHelper
(uint16_t
port
)
20
:
ApplicationHelper
(
UdpEchoServer
::GetTypeId())
21
{
22
SetAttribute
(
"Port"
,
UintegerValue
(
port
));
23
}
24
25
UdpEchoServerHelper::UdpEchoServerHelper
(
const
Address
& address)
26
:
ApplicationHelper
(
UdpEchoServer
::GetTypeId())
27
{
28
SetAttribute
(
"Local"
,
AddressValue
(address));
29
}
30
31
UdpEchoClientHelper::UdpEchoClientHelper
(
const
Address
& address, uint16_t
port
)
32
:
UdpEchoClientHelper
(addressUtils::ConvertToSocketAddress(address,
port
))
33
{
34
}
35
36
UdpEchoClientHelper::UdpEchoClientHelper
(
const
Address
& address)
37
:
ApplicationHelper
(
UdpEchoClient
::GetTypeId())
38
{
39
SetAttribute
(
"Remote"
,
AddressValue
(address));
40
}
41
42
void
43
UdpEchoClientHelper::SetFill
(
Ptr<Application>
app,
const
std::string& fill)
44
{
45
app->GetObject<
UdpEchoClient
>()->
SetFill
(fill);
46
}
47
48
void
49
UdpEchoClientHelper::SetFill
(
Ptr<Application>
app, uint8_t fill,
uint32_t
dataLength)
50
{
51
app->GetObject<
UdpEchoClient
>()->
SetFill
(fill, dataLength);
52
}
53
54
void
55
UdpEchoClientHelper::SetFill
(
Ptr<Application>
app,
56
uint8_t* fill,
57
uint32_t
fillLength,
58
uint32_t
dataLength)
59
{
60
app->GetObject<
UdpEchoClient
>()->
SetFill
(fill, fillLength, dataLength);
61
}
62
63
}
// namespace ns3
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::AddressValue
AttributeValue implementation for Address.
Definition
address.h:275
ns3::ApplicationHelper
A helper to make it easier to instantiate an application on a set of nodes.
Definition
application-helper.h:28
ns3::ApplicationHelper::SetAttribute
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
Definition
application-helper.cc:41
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:49
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:31
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:43
ns3::UdpEchoClient
A Udp Echo client.
Definition
udp-echo-client.h:33
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:19
ns3::UdpEchoServer
A Udp Echo server.
Definition
udp-echo-server.h:34
ns3::UintegerValue
Hold an unsigned integer type.
Definition
uinteger.h:34
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.
udp-echo-helper.h
src
applications
helper
udp-echo-helper.cc
Generated on Sun Dec 1 2024 18:20:35 for ns-3 by
1.11.0