build a set of SimpleNetDevice objects More...
#include "simple-net-device-helper.h"
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< 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. 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... | |
build a set of SimpleNetDevice objects
Definition at line 38 of file simple-net-device-helper.h.
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().
|
inlinevirtual |
Definition at line 46 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 71 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 90 of file simple-net-device-helper.cc.
References third::channel, 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 98 of file simple-net-device-helper.cc.
References ns3::NetDeviceContainer::Add(), ns3::NodeContainer::Begin(), third::channel, 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 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().
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 84 of file simple-net-device-helper.cc.
References third::channel, and 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 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().
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 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().
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 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().
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 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().
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 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().
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 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().
|
private |
Channel factory.
Definition at line 179 of file simple-net-device-helper.h.
Referenced by SimpleNetDeviceHelper(), Install(), SetChannel(), and SetChannelAttribute().
|
private |
NetDevice factory.
Definition at line 178 of file simple-net-device-helper.h.
Referenced by SimpleNetDeviceHelper(), InstallPriv(), and SetDeviceAttribute().
|
private |
whether to enable flow control
Definition at line 181 of file simple-net-device-helper.h.
Referenced by SimpleNetDeviceHelper(), DisableFlowControl(), and InstallPriv().
|
private |
Install PointToPoint SimpleNetDevice or Broadcast ones.
Definition at line 180 of file simple-net-device-helper.h.
Referenced by SimpleNetDeviceHelper(), InstallPriv(), and SetNetDevicePointToPointMode().
|
private |
Queue factory.
Definition at line 177 of file simple-net-device-helper.h.
Referenced by SimpleNetDeviceHelper(), InstallPriv(), and SetQueue().