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
on-off-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 "
on-off-helper.h
"
10
11
#include <ns3/onoff-application.h>
12
#include <ns3/string.h>
13
#include <ns3/uinteger.h>
14
15
namespace
ns3
16
{
17
18
OnOffHelper::OnOffHelper
(
const
std::string& protocol,
const
Address
& address)
19
:
ApplicationHelper
(
"ns3::OnOffApplication"
)
20
{
21
m_factory
.
Set
(
"Protocol"
,
StringValue
(protocol));
22
m_factory
.
Set
(
"Remote"
,
AddressValue
(address));
23
}
24
25
void
26
OnOffHelper::SetConstantRate
(
DataRate
dataRate,
uint32_t
packetSize
)
27
{
28
m_factory
.
Set
(
"OnTime"
,
StringValue
(
"ns3::ConstantRandomVariable[Constant=1000]"
));
29
m_factory
.
Set
(
"OffTime"
,
StringValue
(
"ns3::ConstantRandomVariable[Constant=0]"
));
30
m_factory
.
Set
(
"DataRate"
,
DataRateValue
(dataRate));
31
m_factory
.
Set
(
"PacketSize"
,
UintegerValue
(
packetSize
));
32
}
33
34
}
// namespace ns3
ns3::Address
a polymophic address class
Definition
address.h:90
ns3::AddressValue
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::m_factory
ObjectFactory m_factory
Object factory.
Definition
application-helper.h:129
ns3::DataRate
Class for representing data rates.
Definition
data-rate.h:78
ns3::DataRateValue
Definition
data-rate.h:285
ns3::ObjectFactory::Set
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Definition
object-factory.h:213
ns3::OnOffHelper::OnOffHelper
OnOffHelper(const std::string &protocol, const Address &address)
Create an OnOffHelper to make it easier to work with OnOffApplications.
Definition
on-off-helper.cc:18
ns3::OnOffHelper::SetConstantRate
void SetConstantRate(DataRate dataRate, uint32_t packetSize=512)
Helper function to set a constant rate source.
Definition
on-off-helper.cc:26
ns3::StringValue
Hold variables of type string.
Definition
string.h:45
ns3::UintegerValue
Hold an unsigned integer type.
Definition
uinteger.h:34
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
on-off-helper.h
packetSize
static const uint32_t packetSize
Packet size generated at the AP.
Definition
wifi-power-adaptation-distance.cc:96
src
applications
helper
on-off-helper.cc
Generated on Fri Nov 8 2024 13:58:59 for ns-3 by
1.11.0