A Discrete-Event Network Simulator
API
ns3::SimpleNetDeviceHelper Class Reference

build a set of SimpleNetDevice objects More...

#include "simple-net-device-helper.h"

+ Collaboration diagram for ns3::SimpleNetDeviceHelper:

Public Member Functions

 SimpleNetDeviceHelper ()
 Construct a SimpleNetDeviceHelper. More...
 
virtual ~SimpleNetDeviceHelper ()
 
NetDeviceContainer Install (Ptr< Node > node) const
 This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::SetChannelAttribute, an ns3::SimpleNetDevice with the attributes configured by SimpleNetDeviceHelper::SetDeviceAttribute and then adds the device to the node and attaches the channel to the device. More...
 
NetDeviceContainer Install (Ptr< Node > node, Ptr< SimpleChannel > channel) const
 This method creates an ns3::SimpleNetDevice with the attributes configured by SimpleNetDeviceHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device. More...
 
NetDeviceContainer Install (const NodeContainer &c) const
 This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::SetChannelAttribute. More...
 
NetDeviceContainer Install (const NodeContainer &c, Ptr< SimpleChannel > channel) const
 For each Ptr<node> in the provided container, this method creates an ns3::SimpleNetDevice (with the attributes configured by SimpleNetDeviceHelper::SetDeviceAttribute); adds the device to the node; and attaches the provided channel to the device. More...
 
void SetChannel (std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue())
 Each net device must have a channel to pass packets through. More...
 
void SetChannelAttribute (std::string n1, const AttributeValue &v1)
 
void SetDeviceAttribute (std::string n1, const AttributeValue &v1)
 
void SetNetDevicePointToPointMode (bool pointToPointMode)
 SimpleNetDevice is Broadcast capable and ARP needing. More...
 
void SetQueue (std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue())
 Each net device must have a queue to pass packets through. More...
 

Private Member Functions

Ptr< NetDeviceInstallPriv (Ptr< Node > node, Ptr< SimpleChannel > channel) const
 This method creates an ns3::SimpleNetDevice with the attributes configured by SimpleNetDeviceHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device. More...
 

Private Attributes

ObjectFactory m_channelFactory
 Channel factory. More...
 
ObjectFactory m_deviceFactory
 NetDevice factory. More...
 
bool m_pointToPointMode
 Install PointToPoint SimpleNetDevice or Broadcast ones. More...
 
ObjectFactory m_queueFactory
 Queue factory. More...
 

Detailed Description

build a set of SimpleNetDevice objects

Definition at line 36 of file simple-net-device-helper.h.

Constructor & Destructor Documentation

◆ SimpleNetDeviceHelper()

ns3::SimpleNetDeviceHelper::SimpleNetDeviceHelper ( )

Construct a SimpleNetDeviceHelper.

Definition at line 43 of file simple-net-device-helper.cc.

References m_channelFactory, m_deviceFactory, m_pointToPointMode, m_queueFactory, and ns3::ObjectFactory::SetTypeId().

+ Here is the call graph for this function:

◆ ~SimpleNetDeviceHelper()

virtual ns3::SimpleNetDeviceHelper::~SimpleNetDeviceHelper ( )
inlinevirtual

Definition at line 43 of file simple-net-device-helper.h.

Member Function Documentation

◆ Install() [1/4]

◆ Install() [2/4]

NetDeviceContainer ns3::SimpleNetDeviceHelper::Install ( Ptr< Node node,
Ptr< SimpleChannel channel 
) const

This method creates an ns3::SimpleNetDevice with the attributes configured by SimpleNetDeviceHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device.

Parameters
nodeThe node to install the device in
channelThe channel to attach to the device.
Returns
A container holding the added net device.

Definition at line 107 of file simple-net-device-helper.cc.

References third::channel, and InstallPriv().

+ Here is the call graph for this function:

◆ Install() [3/4]

NetDeviceContainer ns3::SimpleNetDeviceHelper::Install ( const NodeContainer c) const

This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::SetChannelAttribute.

For each Ptr<node> in the provided container: it creates an ns3::SimpleNetDevice (with the attributes configured by SimpleNetDeviceHelper::SetDeviceAttribute); adds the device to the node; and attaches the channel to the device.

Parameters
cThe NodeContainer holding the nodes to be changed.
Returns
A container holding the added net devices.

Definition at line 113 of file simple-net-device-helper.cc.

References third::channel, ns3::ObjectFactory::Create(), Install(), and m_channelFactory.

+ Here is the call graph for this function:

◆ Install() [4/4]

NetDeviceContainer ns3::SimpleNetDeviceHelper::Install ( const NodeContainer c,
Ptr< SimpleChannel channel 
) const

For each Ptr<node> in the provided container, this method creates an ns3::SimpleNetDevice (with the attributes configured by SimpleNetDeviceHelper::SetDeviceAttribute); adds the device to the node; and attaches the provided channel to the device.

Parameters
cThe NodeContainer holding the nodes to be changed.
channelThe channel to attach to the devices.
Returns
A container holding the added net devices.

Definition at line 121 of file simple-net-device-helper.cc.

References ns3::NetDeviceContainer::Add(), ns3::NodeContainer::Begin(), third::channel, ns3::NodeContainer::End(), and InstallPriv().

+ Here is the call graph for this function:

◆ InstallPriv()

Ptr< NetDevice > ns3::SimpleNetDeviceHelper::InstallPriv ( Ptr< Node node,
Ptr< SimpleChannel channel 
) const
private

This method creates an ns3::SimpleNetDevice with the attributes configured by SimpleNetDeviceHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device.

Parameters
nodeThe node to install the device in
channelThe channel to attach to the device.
Returns
The new net device.

Definition at line 134 of file simple-net-device-helper.cc.

References ns3::Node::AddDevice(), ns3::Mac48Address::Allocate(), third::channel, ns3::ObjectFactory::Create(), m_deviceFactory, m_pointToPointMode, m_queueFactory, and NS_ASSERT_MSG().

Referenced by Install().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetChannel()

void ns3::SimpleNetDeviceHelper::SetChannel ( std::string  type,
std::string  n1 = "",
const AttributeValue v1 = EmptyAttributeValue (),
std::string  n2 = "",
const AttributeValue v2 = EmptyAttributeValue (),
std::string  n3 = "",
const AttributeValue v3 = EmptyAttributeValue (),
std::string  n4 = "",
const AttributeValue v4 = EmptyAttributeValue () 
)

Each net device must have a channel to pass packets through.

This method allows one to set the type of the channel that is automatically created when the device is created and attached to a node.

Parameters
typethe type of queue
n1the name of the attribute to set on the queue
v1the value of the attribute to set on the queue
n2the name of the attribute to set on the queue
v2the value of the attribute to set on the queue
n3the name of the attribute to set on the queue
v3the value of the attribute to set on the queue
n4the name of the attribute to set on the queue
v4the value of the attribute to set on the queue

Set the type of channel to create and associated to each SimpleNetDevice created through SimpleNetDeviceHelper::Install.

Definition at line 68 of file simple-net-device-helper.cc.

References m_channelFactory, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().

+ Here is the call graph for this function:

◆ SetChannelAttribute()

void ns3::SimpleNetDeviceHelper::SetChannelAttribute ( std::string  n1,
const AttributeValue v1 
)
Parameters
n1the name of the attribute to set
v1the value of the attribute to set

Set these attributes on each ns3::CsmaChannel created by SimpleNetDeviceHelper::Install

Definition at line 88 of file simple-net-device-helper.cc.

References m_channelFactory, and ns3::ObjectFactory::Set().

Referenced by ns3::olsr::Bug780Test::CreateNodes(), ns3::olsr::HelloRegressionTest::CreateNodes(), ns3::olsr::TcRegressionTest::CreateNodes(), and DhcpTestCase::DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDeviceAttribute()

void ns3::SimpleNetDeviceHelper::SetDeviceAttribute ( std::string  n1,
const AttributeValue v1 
)
Parameters
n1the name of the attribute to set
v1the value of the attribute to set

Set these attributes on each ns3::SimpleNetDevice created by SimpleNetDeviceHelper::Install

Definition at line 82 of file simple-net-device-helper.cc.

References m_deviceFactory, and ns3::ObjectFactory::Set().

Referenced by ns3::olsr::Bug780Test::CreateNodes(), ns3::olsr::HelloRegressionTest::CreateNodes(), ns3::olsr::TcRegressionTest::CreateNodes(), DhcpTestCase::DoRun(), and TcFlowControlTestCase::DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetNetDevicePointToPointMode()

void ns3::SimpleNetDeviceHelper::SetNetDevicePointToPointMode ( bool  pointToPointMode)

SimpleNetDevice is Broadcast capable and ARP needing.

This function limits the number of SimpleNetDevices on one channel to two, disables Broadcast and ARP and enables PointToPoint mode.

Warning
It must be used before installing a NetDevice on a node.
Parameters
pointToPointModeTrue for PointToPoint SimpleNetDevice

Definition at line 94 of file simple-net-device-helper.cc.

References m_pointToPointMode.

Referenced by Ipv6ForwardingTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), Ipv4RawSocketImplTest::DoRun(), Ipv4FragmentationTest::DoRun(), UdpSocketImplTest::DoRun(), IcmpTimeExceedTestCase::DoRun(), ns3::TcpGeneralTest::DoRun(), Udp6SocketImplTest::DoRun(), IcmpV6TimeExceedTestCase::DoRun(), Ipv4DynamicGlobalRoutingTestCase::DoRun(), LinkTest::DoSetup(), and TwoLinkTest::DoSetup().

+ Here is the caller graph for this function:

◆ SetQueue()

void ns3::SimpleNetDeviceHelper::SetQueue ( std::string  type,
std::string  n1 = "",
const AttributeValue v1 = EmptyAttributeValue (),
std::string  n2 = "",
const AttributeValue v2 = EmptyAttributeValue (),
std::string  n3 = "",
const AttributeValue v3 = EmptyAttributeValue (),
std::string  n4 = "",
const AttributeValue v4 = EmptyAttributeValue () 
)

Each net device must have a queue to pass packets through.

This method allows one to set the type of the queue that is automatically created when the device is created and attached to a node.

Parameters
typethe type of queue
n1the name of the attribute to set on the queue
v1the value of the attribute to set on the queue
n2the name of the attribute to set on the queue
v2the value of the attribute to set on the queue
n3the name of the attribute to set on the queue
v3the value of the attribute to set on the queue
n4the name of the attribute to set on the queue
v4the value of the attribute to set on the queue

Set the type of queue to create and associated to each SimpleNetDevice created through SimpleNetDeviceHelper::Install.

Definition at line 52 of file simple-net-device-helper.cc.

References ns3::QueueBase::AppendItemTypeIfNotPresent(), m_queueFactory, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().

Referenced by TcFlowControlTestCase::DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_channelFactory

ObjectFactory ns3::SimpleNetDeviceHelper::m_channelFactory
private

◆ m_deviceFactory

ObjectFactory ns3::SimpleNetDeviceHelper::m_deviceFactory
private

NetDevice factory.

Definition at line 182 of file simple-net-device-helper.h.

Referenced by InstallPriv(), SetDeviceAttribute(), and SimpleNetDeviceHelper().

◆ m_pointToPointMode

bool ns3::SimpleNetDeviceHelper::m_pointToPointMode
private

Install PointToPoint SimpleNetDevice or Broadcast ones.

Definition at line 184 of file simple-net-device-helper.h.

Referenced by InstallPriv(), SetNetDevicePointToPointMode(), and SimpleNetDeviceHelper().

◆ m_queueFactory

ObjectFactory ns3::SimpleNetDeviceHelper::m_queueFactory
private

Queue factory.

Definition at line 181 of file simple-net-device-helper.h.

Referenced by InstallPriv(), SetQueue(), and SimpleNetDeviceHelper().


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