build a set of SimpleNetDevice objects More...
#include "simple-net-device-helper.h"
Public Member Functions | |
SimpleNetDeviceHelper () | |
Construct a SimpleNetDeviceHelper. | |
virtual | ~SimpleNetDeviceHelper () |
void | DisableFlowControl () |
Disable flow control only if you know what you are doing. | |
NetDeviceContainer | Install (const NodeContainer &c) const |
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::SetChannelAttribute. | |
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. | |
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. | |
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. | |
template<typename... Ts> | |
void | SetChannel (std::string type, Ts &&... args) |
Each net device must have a channel to pass packets through. | |
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. | |
template<typename... Ts> | |
void | SetQueue (std::string type, Ts &&... args) |
Each net device must have a queue to pass packets through. | |
Private Member Functions | |
Ptr< NetDevice > | InstallPriv (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. | |
Private Attributes | |
ObjectFactory | m_channelFactory |
Channel factory. | |
ObjectFactory | m_deviceFactory |
NetDevice factory. | |
bool | m_enableFlowControl |
whether to enable flow control | |
bool | m_pointToPointMode |
Install PointToPoint SimpleNetDevice or Broadcast ones. | |
ObjectFactory | m_queueFactory |
Queue factory. | |
build a set of SimpleNetDevice objects
Definition at line 27 of file simple-net-device-helper.h.
ns3::SimpleNetDeviceHelper::SimpleNetDeviceHelper | ( | ) |
Construct a SimpleNetDeviceHelper.
Definition at line 32 of file simple-net-device-helper.cc.
References m_channelFactory, m_deviceFactory, m_enableFlowControl, m_pointToPointMode, m_queueFactory, and ns3::ObjectFactory::SetTypeId().
|
inlinevirtual |
Definition at line 35 of file simple-net-device-helper.h.
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 60 of file simple-net-device-helper.cc.
References m_enableFlowControl.
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.
c | The NodeContainer holding the nodes to be changed. |
Definition at line 79 of file simple-net-device-helper.cc.
References ns3::ObjectFactory::Create(), Install(), and m_channelFactory.
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.
c | The NodeContainer holding the nodes to be changed. |
channel | The channel to attach to the devices. |
Definition at line 87 of file simple-net-device-helper.cc.
References ns3::NetDeviceContainer::Add(), ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), and InstallPriv().
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.
node | The node to install the device in |
Definition at line 66 of file simple-net-device-helper.cc.
References ns3::ObjectFactory::Create(), Install(), and m_channelFactory.
Referenced by ns3::olsr::Bug780Test::CreateNodes(), ns3::olsr::HelloRegressionTest::CreateNodes(), ns3::olsr::TcRegressionTest::CreateNodes(), BulkSendBasicTestCase::DoRun(), BulkSendSeqTsSizeTestCase::DoRun(), ChannelTest::DoRun(), DhcpTestCase::DoRun(), DuplicateTest::DoRun(), DynamicPartialTest::DoRun(), FlushTest::DoRun(), IcmpTimeExceedTestCase::DoRun(), IcmpV6TimeExceedTestCase::DoRun(), InterfaceContainerTest::DoRun(), Ipv4DeduplicationPerformanceTest::DoRun(), Ipv4DeduplicationTest::DoRun(), Ipv4DynamicGlobalRoutingTestCase::DoRun(), Ipv4FragmentationTest::DoRun(), Ipv4GlobalRoutingSlash32TestCase::DoRun(), Ipv4PacketInfoTagTest::DoRun(), Ipv4RawSocketImplTest::DoRun(), Ipv4StaticRoutingSlash32TestCase::DoRun(), Ipv6DadTest::DoRun(), Ipv6ForwardingTest::DoRun(), Ipv6PacketInfoTagTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), NetDeviceContainerTest::DoRun(), NixVectorRoutingTest::DoRun(), ns3::TcpGeneralTest::DoRun(), RadvdTestCase::DoRun(), TcFlowControlTestCase::DoRun(), Udp6SocketImplTest::DoRun(), UdpSocketImplTest::DoRun(), BridgeTest::DoSetup(), LanTest::DoSetup(), LinkTest::DoSetup(), PingTestCase::DoSetup(), TwoBridgeTest::DoSetup(), TwoLanTest::DoSetup(), TwoLinkTest::DoSetup(), Install(), and Install().
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.
node | The node to install the device in |
channel | The channel to attach to the device. |
Definition at line 73 of file simple-net-device-helper.cc.
References InstallPriv().
|
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.
node | The node to install the device in |
channel | The channel to attach to the device. |
Definition at line 100 of file simple-net-device-helper.cc.
References ns3::Mac48Address::Allocate(), ns3::ObjectFactory::Create(), ns3::CreateObject(), m_deviceFactory, m_enableFlowControl, m_pointToPointMode, m_queueFactory, and NS_ASSERT_MSG.
Referenced by Install(), and Install().
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.
Ts | [deduced] Argument types |
type | the type of channel | |
[in] | args | Name and AttributeValue pairs to set. |
Set the type of channel to create and associated to each SimpleNetDevice created through SimpleNetDeviceHelper::Install.
Definition at line 189 of file simple-net-device-helper.h.
References m_channelFactory, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().
Referenced by PingTestCase::DoSetup().
void ns3::SimpleNetDeviceHelper::SetChannelAttribute | ( | std::string | n1, |
const AttributeValue & | v1 ) |
n1 | the name of the attribute to set |
v1 | the value of the attribute to set |
Set these attributes on each ns3::CsmaChannel created by SimpleNetDeviceHelper::Install
Definition at line 48 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().
void ns3::SimpleNetDeviceHelper::SetDeviceAttribute | ( | std::string | n1, |
const AttributeValue & | v1 ) |
n1 | the name of the attribute to set |
v1 | the value of the attribute to set |
Set these attributes on each ns3::SimpleNetDevice created by SimpleNetDeviceHelper::Install
Definition at line 42 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().
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.
pointToPointMode | True for PointToPoint SimpleNetDevice |
Definition at line 54 of file simple-net-device-helper.cc.
References m_pointToPointMode.
Referenced by IcmpTimeExceedTestCase::DoRun(), IcmpV6TimeExceedTestCase::DoRun(), Ipv4DynamicGlobalRoutingTestCase::DoRun(), Ipv4FragmentationTest::DoRun(), Ipv4RawSocketImplTest::DoRun(), Ipv6DadTest::DoRun(), Ipv6ForwardingTest::DoRun(), Ipv6RawSocketImplTest::DoRun(), NixVectorRoutingTest::DoRun(), ns3::TcpGeneralTest::DoRun(), Udp6SocketImplTest::DoRun(), UdpSocketImplTest::DoRun(), LinkTest::DoSetup(), PingTestCase::DoSetup(), and TwoLinkTest::DoSetup().
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.
Ts | [deduced] Argument types |
type | the type of queue | |
[in] | args | Name and AttributeValue pairs to set. |
Set the type of queue to create and associated to each SimpleNetDevice created through SimpleNetDeviceHelper::Install.
Definition at line 179 of file simple-net-device-helper.h.
References ns3::QueueBase::AppendItemTypeIfNotPresent(), m_queueFactory, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().
Referenced by TcFlowControlTestCase::DoRun().
|
private |
Channel factory.
Definition at line 168 of file simple-net-device-helper.h.
Referenced by SimpleNetDeviceHelper(), Install(), Install(), SetChannel(), and SetChannelAttribute().
|
private |
NetDevice factory.
Definition at line 167 of file simple-net-device-helper.h.
Referenced by SimpleNetDeviceHelper(), InstallPriv(), and SetDeviceAttribute().
|
private |
whether to enable flow control
Definition at line 170 of file simple-net-device-helper.h.
Referenced by SimpleNetDeviceHelper(), DisableFlowControl(), and InstallPriv().
|
private |
Install PointToPoint SimpleNetDevice or Broadcast ones.
Definition at line 169 of file simple-net-device-helper.h.
Referenced by SimpleNetDeviceHelper(), InstallPriv(), and SetNetDevicePointToPointMode().
|
private |
Queue factory.
Definition at line 166 of file simple-net-device-helper.h.
Referenced by SimpleNetDeviceHelper(), InstallPriv(), and SetQueue().