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
* 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
#include "
udp-echo-helper.h
"
21
22
#include "ns3/udp-echo-client.h"
23
#include "ns3/udp-echo-server.h"
24
#include "ns3/uinteger.h"
25
26
namespace
ns3
27
{
28
29
UdpEchoServerHelper::UdpEchoServerHelper
(uint16_t
port
)
30
:
ApplicationHelper
(
UdpEchoServer
::GetTypeId())
31
{
32
SetAttribute
(
"Port"
,
UintegerValue
(
port
));
33
}
34
35
UdpEchoClientHelper::UdpEchoClientHelper
(
const
Address
& address, uint16_t
port
)
36
:
ApplicationHelper
(
UdpEchoClient
::GetTypeId())
37
{
38
SetAttribute
(
"RemoteAddress"
,
AddressValue
(address));
39
SetAttribute
(
"RemotePort"
,
UintegerValue
(
port
));
40
}
41
42
UdpEchoClientHelper::UdpEchoClientHelper
(
const
Address
& address)
43
:
ApplicationHelper
(
UdpEchoClient
::GetTypeId())
44
{
45
SetAttribute
(
"RemoteAddress"
,
AddressValue
(address));
46
}
47
48
void
49
UdpEchoClientHelper::SetFill
(
Ptr<Application>
app,
const
std::string& fill)
50
{
51
app->GetObject<
UdpEchoClient
>()->
SetFill
(fill);
52
}
53
54
void
55
UdpEchoClientHelper::SetFill
(
Ptr<Application>
app, uint8_t fill,
uint32_t
dataLength)
56
{
57
app->GetObject<
UdpEchoClient
>()->
SetFill
(fill, dataLength);
58
}
59
60
void
61
UdpEchoClientHelper::SetFill
(
Ptr<Application>
app,
62
uint8_t* fill,
63
uint32_t
fillLength,
64
uint32_t
dataLength)
65
{
66
app->GetObject<
UdpEchoClient
>()->
SetFill
(fill, fillLength, dataLength);
67
}
68
69
}
// namespace ns3
ns3::Address
a polymophic address class
Definition:
address.h:101
ns3::AddressValue
AttributeValue implementation for Address.
Definition:
address.h:286
ns3::ApplicationHelper
A helper to make it easier to instantiate an application on a set of nodes.
Definition:
application-helper.h:39
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:52
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
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:35
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::UdpEchoClient
A Udp Echo client.
Definition:
udp-echo-client.h:40
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:29
ns3::UdpEchoServer
A Udp Echo server.
Definition:
udp-echo-server.h:45
ns3::UintegerValue
Hold an unsigned integer type.
Definition:
uinteger.h:45
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.
udp-echo-helper.h
src
applications
helper
udp-echo-helper.cc
Generated on Tue May 28 2024 23:34:07 for ns-3 by
1.9.6