A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::OnOffHelper Class Reference

A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes. More...

#include "on-off-helper.h"

+ Inheritance diagram for ns3::OnOffHelper:
+ Collaboration diagram for ns3::OnOffHelper:

Public Member Functions

 OnOffHelper (const std::string &protocol, const Address &address)
 Create an OnOffHelper to make it easier to work with OnOffApplications.
 
void SetConstantRate (DataRate dataRate, uint32_t packetSize=512)
 Helper function to set a constant rate source.
 
- Public Member Functions inherited from ns3::ApplicationHelper
 ApplicationHelper (const std::string &typeId)
 Create an application of a given type ID.
 
 ApplicationHelper (TypeId typeId)
 Create an application of a given type ID.
 
int64_t AssignStreams (NodeContainer c, int64_t stream)
 Assigns a unique (monotonically increasing) stream number to all applications that match the configured type of this application helper instance.
 
ApplicationContainer Install (const std::string &nodeName)
 Install an application on the node configured with all the attributes set with SetAttribute.
 
ApplicationContainer Install (NodeContainer c)
 Install an application on each node of the input container configured with all the attributes set with SetAttribute.
 
ApplicationContainer Install (Ptr< Node > node)
 Install an application on the node configured with all the attributes set with SetAttribute.
 
void SetAttribute (const std::string &name, const AttributeValue &value)
 Helper function used to set the underlying application attributes.
 
void SetTypeId (const std::string &typeId)
 Allow the helper to be repurposed for another application type.
 
void SetTypeId (TypeId typeId)
 Allow the helper to be repurposed for another application type.
 

Additional Inherited Members

- Static Public Member Functions inherited from ns3::ApplicationHelper
static int64_t AssignStreamsToAllApps (NodeContainer c, int64_t stream)
 Assign a fixed random variable stream number to the random variables used by all the applications.
 
- Protected Member Functions inherited from ns3::ApplicationHelper
virtual Ptr< ApplicationDoInstall (Ptr< Node > node)
 Install an application on the node configured with all the attributes set with SetAttribute.
 
- Protected Attributes inherited from ns3::ApplicationHelper
ObjectFactory m_factory
 Object factory.
 

Detailed Description

A helper to make it easier to instantiate an ns3::OnOffApplication on a set of nodes.

Definition at line 36 of file on-off-helper.h.

Constructor & Destructor Documentation

◆ OnOffHelper()

ns3::OnOffHelper::OnOffHelper ( const std::string &  protocol,
const Address address 
)

Create an OnOffHelper to make it easier to work with OnOffApplications.

Parameters
protocolthe name of the protocol to use to send traffic by the applications. This string identifies the socket factory type used to create sockets for the applications. A typical value would be ns3::UdpSocketFactory.
addressthe address of the remote node to send traffic to.

Definition at line 29 of file on-off-helper.cc.

References ns3::ApplicationHelper::m_factory, and ns3::ObjectFactory::Set().

+ Here is the call graph for this function:

Member Function Documentation

◆ SetConstantRate()

void ns3::OnOffHelper::SetConstantRate ( DataRate  dataRate,
uint32_t  packetSize = 512 
)

Helper function to set a constant rate source.

Equivalent to setting the attributes OnTime to constant 1000 seconds, OffTime to constant 0 seconds, and the DataRate and PacketSize set accordingly

Parameters
dataRateDataRate object for the sending rate
packetSizesize in bytes of the packet payloads generated

Definition at line 37 of file on-off-helper.cc.

References ns3::ApplicationHelper::m_factory, packetSize, and ns3::ObjectFactory::Set().

+ Here is the call graph for this function:

The documentation for this class was generated from the following files: