A Discrete-Event Network Simulator
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
16namespace ns3
17{
18
24
26 : ApplicationHelper(UdpEchoServer::GetTypeId())
27{
28 SetAttribute("Local", AddressValue(address));
29}
30
32 : UdpEchoClientHelper(addressUtils::ConvertToSocketAddress(address, port))
33{
34}
35
37 : ApplicationHelper(UdpEchoClient::GetTypeId())
38{
39 SetAttribute("Remote", AddressValue(address));
40}
41
42void
44{
45 app->GetObject<UdpEchoClient>()->SetFill(fill);
46}
47
48void
50{
51 app->GetObject<UdpEchoClient>()->SetFill(fill, dataLength);
52}
53
54void
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
a polymophic address class
Definition address.h:90
AttributeValue implementation for Address.
Definition address.h:275
A helper to make it easier to instantiate an application on a set of nodes.
void SetAttribute(const std::string &name, const AttributeValue &value)
Helper function used to set the underlying application attributes.
Smart pointer class similar to boost::intrusive_ptr.
Create an application which sends a UDP packet and waits for an echo of this packet.
UdpEchoClientHelper(const Address &ip, uint16_t port)
Create UdpEchoClientHelper which will make life easier for people trying to set up simulations with e...
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...
A Udp Echo client.
UdpEchoServerHelper(uint16_t port)
Create UdpEchoServerHelper which will make life easier for people trying to set up simulations with e...
A Udp Echo server.
Hold an unsigned integer type.
Definition uinteger.h:34
uint16_t port
Definition dsdv-manet.cc:33
Every class exported by the ns3 library is enclosed in the ns3 namespace.