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 ()
 
void DisableFlowControl ()
 Disable flow control only if you know what you are doing. 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...
 
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...
 
template<typename... Ts>
void SetChannel (std::string type, Ts &&... args)
 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...
 
template<typename... Ts>
void SetQueue (std::string type, Ts &&... args)
 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_enableFlowControl
 whether to enable flow control 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 38 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_enableFlowControl, 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 46 of file simple-net-device-helper.h.

Member Function Documentation

◆ DisableFlowControl()

void ns3::SimpleNetDeviceHelper::DisableFlowControl ( )

Disable flow control only if you know what you are doing.

By disabling flow control, this NetDevice will be sent packets even if there is no room for them (such packets will be likely dropped by this NetDevice). Also, any queue disc installed on this NetDevice will have no effect, as every packet enqueued to the traffic control layer queue disc will be immediately dequeued.

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

References m_enableFlowControl.

◆ Install() [1/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 90 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() [2/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 98 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:

◆ Install() [3/4]

NetDeviceContainer ns3::SimpleNetDeviceHelper::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.

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

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

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

Referenced by ns3::olsr::Bug780Test::CreateNodes(), ns3::olsr::HelloRegressionTest::CreateNodes(), ns3::olsr::TcRegressionTest::CreateNodes(), BulkSendBasicTestCase::DoRun(), BulkSendSeqTsSizeTestCase::DoRun(), DhcpTestCase::DoRun(), RadvdTestCase::DoRun(), IcmpTimeExceedTestCase::DoRun(), IcmpV6TimeExceedTestCase::DoRun(), Ipv4DeduplicationTest::DoRun(), Ipv4DeduplicationPerformanceTest::DoRun(), Ipv4FragmentationTest::DoRun(), Ipv4DynamicGlobalRoutingTestCase::DoRun(), Ipv4GlobalRoutingSlash32TestCase::DoRun(), Ipv4PacketInfoTagTest::DoRun(), Ipv4RawSocketImplTest::DoRun(), Ipv4StaticRoutingSlash32TestCase::DoRun(), Ipv6DadTest::DoRun(), Ipv6ForwardingTest::DoRun(), Ipv6PacketInfoTagTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), ChannelTest::DoRun(), NetDeviceContainerTest::DoRun(), InterfaceContainerTest::DoRun(), FlushTest::DoRun(), DuplicateTest::DoRun(), DynamicPartialTest::DoRun(), ns3::TcpGeneralTest::DoRun(), UdpSocketImplTest::DoRun(), Udp6SocketImplTest::DoRun(), NixVectorRoutingTest::DoRun(), TcFlowControlTestCase::DoRun(), PingTestCase::DoSetup(), LinkTest::DoSetup(), LanTest::DoSetup(), TwoLinkTest::DoSetup(), TwoLanTest::DoSetup(), BridgeTest::DoSetup(), TwoBridgeTest::DoSetup(), and Install().

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

◆ Install() [4/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 84 of file simple-net-device-helper.cc.

References third::channel, 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 111 of file simple-net-device-helper.cc.

References ns3::Node::AddDevice(), ns3::Mac48Address::Allocate(), third::channel, ns3::ObjectFactory::Create(), m_deviceFactory, m_enableFlowControl, 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()

template<typename... Ts>
void ns3::SimpleNetDeviceHelper::SetChannel ( std::string  type,
Ts &&...  args 
)

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.

Template Parameters
Ts[deduced] Argument types
Parameters
typethe type of channel
[in]argsName and AttributeValue pairs to set.

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

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

References check-style-clang-format::args, m_channelFactory, ns3::ObjectFactory::Set(), ns3::ObjectFactory::SetTypeId(), and check-style-clang-format::type.

Referenced by PingTestCase::DoSetup().

+ Here is the call graph for this function:
+ Here is the caller 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 59 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(), BulkSendBasicTestCase::DoRun(), BulkSendSeqTsSizeTestCase::DoRun(), DhcpTestCase::DoRun(), and RadvdTestCase::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 53 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(), BulkSendBasicTestCase::DoRun(), BulkSendSeqTsSizeTestCase::DoRun(), DhcpTestCase::DoRun(), RadvdTestCase::DoRun(), TcFlowControlTestCase::DoRun(), and PingTestCase::DoSetup().

+ 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 65 of file simple-net-device-helper.cc.

References m_pointToPointMode.

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

+ Here is the caller graph for this function:

◆ SetQueue()

template<typename... Ts>
void ns3::SimpleNetDeviceHelper::SetQueue ( std::string  type,
Ts &&...  args 
)

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.

Template Parameters
Ts[deduced] Argument types
Parameters
typethe type of queue
[in]argsName and AttributeValue pairs to set.

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

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

References ns3::QueueBase::AppendItemTypeIfNotPresent(), check-style-clang-format::args, m_queueFactory, ns3::ObjectFactory::Set(), ns3::ObjectFactory::SetTypeId(), and check-style-clang-format::type.

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 178 of file simple-net-device-helper.h.

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

◆ m_enableFlowControl

bool ns3::SimpleNetDeviceHelper::m_enableFlowControl
private

whether to enable flow control

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

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

◆ m_pointToPointMode

bool ns3::SimpleNetDeviceHelper::m_pointToPointMode
private

Install PointToPoint SimpleNetDevice or Broadcast ones.

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

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

◆ m_queueFactory

ObjectFactory ns3::SimpleNetDeviceHelper::m_queueFactory
private

Queue factory.

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

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


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