build a set of CsmaNetDevice objects More...
#include "csma-helper.h"
Public Member Functions | |
CsmaHelper () | |
Construct a CsmaHelper. | |
~CsmaHelper () override | |
int64_t | AssignStreams (NetDeviceContainer c, int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. | |
void | DisableFlowControl () |
Disable flow control only if you know what you are doing. | |
NetDeviceContainer | Install (const NodeContainer &c) const |
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttribute. | |
NetDeviceContainer | Install (const NodeContainer &c, Ptr< CsmaChannel > channel) const |
For each Ptr<node> in the provided container, this method creates an ns3::CsmaNetDevice (with the attributes configured by CsmaHelper::SetDeviceAttribute); adds the device to the node; and attaches the provided channel to the device. | |
NetDeviceContainer | Install (const NodeContainer &c, std::string channelName) const |
For each Ptr<node> in the provided container, this method creates an ns3::CsmaNetDevice (with the attributes configured by CsmaHelper::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::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttribute, an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttribute and then adds the device to the node and attaches the channel to the device. | |
NetDeviceContainer | Install (Ptr< Node > node, Ptr< CsmaChannel > channel) const |
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device. | |
NetDeviceContainer | Install (Ptr< Node > node, std::string channelName) const |
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device. | |
NetDeviceContainer | Install (std::string name) const |
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttribute, an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttribute and then adds the device to the node and attaches the channel to the device. | |
NetDeviceContainer | Install (std::string nodeName, Ptr< CsmaChannel > channel) const |
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device. | |
NetDeviceContainer | Install (std::string nodeName, std::string channelName) const |
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device. | |
void | SetChannelAttribute (std::string n1, const AttributeValue &v1) |
void | SetDeviceAttribute (std::string n1, const AttributeValue &v1) |
template<typename... Ts> | |
void | SetQueue (std::string type, Ts &&... args) |
Public Member Functions inherited from ns3::PcapHelperForDevice | |
PcapHelperForDevice () | |
Construct a PcapHelperForDevice. | |
virtual | ~PcapHelperForDevice () |
Destroy a PcapHelperForDevice. | |
void | EnablePcap (std::string prefix, NetDeviceContainer d, bool promiscuous=false) |
Enable pcap output on each device in the container which is of the appropriate type. | |
void | EnablePcap (std::string prefix, NodeContainer n, bool promiscuous=false) |
Enable pcap output on each device (which is of the appropriate type) in the nodes provided in the container. | |
void | EnablePcap (std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false) |
Enable pcap output the indicated net device. | |
void | EnablePcap (std::string prefix, std::string ndName, bool promiscuous=false, bool explicitFilename=false) |
Enable pcap output the indicated net device using a device previously named using the ns-3 object name service. | |
void | EnablePcap (std::string prefix, uint32_t nodeid, uint32_t deviceid, bool promiscuous=false) |
Enable pcap output on the device specified by a global node-id (of a previously created node) and associated device-id. | |
void | EnablePcapAll (std::string prefix, bool promiscuous=false) |
Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created in the simulation. | |
virtual void | EnablePcapInternal (std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)=0 |
Enable pcap output the indicated net device. | |
Public Member Functions inherited from ns3::AsciiTraceHelperForDevice | |
AsciiTraceHelperForDevice () | |
Construct an AsciiTraceHelperForDevice. | |
virtual | ~AsciiTraceHelperForDevice () |
Destroy an AsciiTraceHelperForDevice. | |
void | EnableAscii (Ptr< OutputStreamWrapper > stream, NetDeviceContainer d) |
Enable ascii trace output on each device in the container which is of the appropriate type. | |
void | EnableAscii (Ptr< OutputStreamWrapper > stream, NodeContainer n) |
Enable ascii trace output on each device (which is of the appropriate type) in the nodes provided in the container. | |
void | EnableAscii (Ptr< OutputStreamWrapper > stream, Ptr< NetDevice > nd) |
Enable ascii trace output on the indicated net device. | |
void | EnableAscii (Ptr< OutputStreamWrapper > stream, std::string ndName) |
Enable ascii trace output the indicated net device using a device previously named using the ns-3 object name service. | |
void | EnableAscii (Ptr< OutputStreamWrapper > stream, uint32_t nodeid, uint32_t deviceid) |
Enable ascii trace output on the device specified by a global node-id (of a previously created node) and associated device-id. | |
void | EnableAscii (std::string prefix, NetDeviceContainer d) |
Enable ascii trace output on each device in the container which is of the appropriate type. | |
void | EnableAscii (std::string prefix, NodeContainer n) |
Enable ascii trace output on each device (which is of the appropriate type) in the nodes provided in the container. | |
void | EnableAscii (std::string prefix, Ptr< NetDevice > nd, bool explicitFilename=false) |
Enable ascii trace output on the indicated net device. | |
void | EnableAscii (std::string prefix, std::string ndName, bool explicitFilename=false) |
Enable ascii trace output the indicated net device using a device previously named using the ns-3 object name service. | |
void | EnableAscii (std::string prefix, uint32_t nodeid, uint32_t deviceid, bool explicitFilename) |
Enable ascii trace output on the device specified by a global node-id (of a previously created node) and associated device-id. | |
void | EnableAsciiAll (Ptr< OutputStreamWrapper > stream) |
Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes created in the simulation. | |
void | EnableAsciiAll (std::string prefix) |
Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes created in the simulation. | |
virtual void | EnableAsciiInternal (Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)=0 |
Enable ascii trace output on the indicated net device. | |
Private Member Functions | |
void | EnableAsciiInternal (Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override |
Enable ascii trace output on the indicated net device. | |
void | EnablePcapInternal (std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override |
Enable pcap output on the indicated net device. | |
Ptr< NetDevice > | InstallPriv (Ptr< Node > node, Ptr< CsmaChannel > channel) const |
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device. | |
Private Attributes | |
ObjectFactory | m_channelFactory |
factory for the channel | |
ObjectFactory | m_deviceFactory |
factory for the NetDevices | |
bool | m_enableFlowControl |
whether to enable flow control | |
ObjectFactory | m_queueFactory |
factory for the queues | |
build a set of CsmaNetDevice objects
Normally we eschew multiple inheritance, however, the classes PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are treated as "mixins". A mixin is a self-contained class that encapsulates a general attribute or a set of functionality that may be of interest to many other classes.
Definition at line 47 of file csma-helper.h.
ns3::CsmaHelper::CsmaHelper | ( | ) |
Construct a CsmaHelper.
Definition at line 41 of file csma-helper.cc.
References m_channelFactory, m_deviceFactory, m_enableFlowControl, m_queueFactory, and ns3::ObjectFactory::SetTypeId().
|
inlineoverride |
Definition at line 55 of file csma-helper.h.
int64_t ns3::CsmaHelper::AssignStreams | ( | NetDeviceContainer | c, |
int64_t | stream | ||
) |
Assign a fixed random variable stream number to the random variables used by this model.
Return the number of streams (possibly zero) that have been assigned. The Install() method should have previously been called by the user.
c | NetDeviceContainer of the set of net devices for which the CsmaNetDevice should be modified to use a fixed stream |
stream | first stream index to use |
Definition at line 296 of file csma-helper.cc.
References ns3::NetDeviceContainer::Begin(), and ns3::NetDeviceContainer::End().
void ns3::CsmaHelper::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 62 of file csma-helper.cc.
References m_enableFlowControl.
|
overrideprivatevirtual |
Enable ascii trace output on the indicated net device.
NetDevice-specific implementation mechanism for hooking the trace and writing to the trace file.
stream | The output stream object to use when logging ascii traces. |
prefix | Filename prefix to use for ascii trace files. |
nd | Net device for which you want to enable tracing. |
explicitFilename | Treat the prefix as an explicit filename if true |
Implements ns3::AsciiTraceHelperForDevice.
Definition at line 111 of file csma-helper.cc.
References ns3::Config::Connect(), ns3::AsciiTraceHelper::CreateFileStream(), ns3::AsciiTraceHelper::DefaultDequeueSinkWithContext(), ns3::AsciiTraceHelper::DefaultDropSinkWithContext(), ns3::AsciiTraceHelper::DefaultEnqueueSinkWithContext(), ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext(), ns3::Packet::EnablePrinting(), ns3::AsciiTraceHelper::GetFilenameFromDevice(), ns3::CsmaNetDevice::GetQueue(), ns3::AsciiTraceHelper::HookDefaultDequeueSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultDropSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultEnqueueSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext(), ns3::MakeBoundCallback(), and NS_LOG_INFO.
|
overrideprivatevirtual |
Enable pcap output on the indicated net device.
NetDevice-specific implementation mechanism for hooking the trace and writing to the trace file.
prefix | Filename prefix to use for pcap files. |
nd | Net device for which you want to enable tracing. |
promiscuous | If true capture all possible packets available at the device. |
explicitFilename | Treat the prefix as an explicit filename if true |
Implements ns3::PcapHelperForDevice.
Definition at line 68 of file csma-helper.cc.
References ns3::PcapHelper::CreateFile(), ns3::PcapHelper::DLT_EN10MB, ns3::PcapHelper::GetFilenameFromDevice(), ns3::PcapHelper::HookDefaultSink(), and NS_LOG_INFO.
NetDeviceContainer ns3::CsmaHelper::Install | ( | const NodeContainer & | c | ) | const |
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttribute.
For each Ptr<node> in the provided container: it creates an ns3::CsmaNetDevice (with the attributes configured by CsmaHelper::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 268 of file csma-helper.cc.
References ns3::ObjectFactory::Create(), ns3::Object::GetObject(), Install(), and m_channelFactory.
NetDeviceContainer ns3::CsmaHelper::Install | ( | const NodeContainer & | c, |
Ptr< CsmaChannel > | channel | ||
) | const |
For each Ptr<node> in the provided container, this method creates an ns3::CsmaNetDevice (with the attributes configured by CsmaHelper::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 276 of file csma-helper.cc.
References ns3::NetDeviceContainer::Add(), ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), and InstallPriv().
NetDeviceContainer ns3::CsmaHelper::Install | ( | const NodeContainer & | c, |
std::string | channelName | ||
) | const |
For each Ptr<node> in the provided container, this method creates an ns3::CsmaNetDevice (with the attributes configured by CsmaHelper::SetDeviceAttribute); adds the device to the node; and attaches the provided channel to the device.
c | The NodeContainer holding the nodes to be changed. |
channelName | The name of the channel to attach to the devices. |
Definition at line 289 of file csma-helper.cc.
References Install().
NetDeviceContainer ns3::CsmaHelper::Install | ( | Ptr< Node > | node | ) | const |
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttribute, an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::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 226 of file csma-helper.cc.
References ns3::ObjectFactory::Create(), ns3::Object::GetObject(), Install(), and m_channelFactory.
Referenced by ns3::CsmaStarHelper::CsmaStarHelper(), EpcS1uDlTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), Install(), and NeighborCacheExample::Run().
NetDeviceContainer ns3::CsmaHelper::Install | ( | Ptr< Node > | node, |
Ptr< CsmaChannel > | channel | ||
) | const |
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::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 240 of file csma-helper.cc.
References InstallPriv().
NetDeviceContainer ns3::CsmaHelper::Install | ( | Ptr< Node > | node, |
std::string | channelName | ||
) | const |
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::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 |
channelName | The name of the channel to attach to the device. |
Definition at line 246 of file csma-helper.cc.
References InstallPriv().
NetDeviceContainer ns3::CsmaHelper::Install | ( | std::string | name | ) | const |
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttribute, an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttribute and then adds the device to the node and attaches the channel to the device.
name | The name of the node to install the device in |
Definition at line 233 of file csma-helper.cc.
References Install().
NetDeviceContainer ns3::CsmaHelper::Install | ( | std::string | nodeName, |
Ptr< CsmaChannel > | channel | ||
) | const |
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device.
nodeName | The name of the node to install the device in |
channel | The channel to attach to the device. |
Definition at line 253 of file csma-helper.cc.
References InstallPriv().
NetDeviceContainer ns3::CsmaHelper::Install | ( | std::string | nodeName, |
std::string | channelName | ||
) | const |
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttribute and then adds the device to the node and attaches the provided channel to the device.
nodeName | The name of the node to install the device in |
channelName | The name of the channel to attach to the device. |
Definition at line 260 of file csma-helper.cc.
References InstallPriv().
|
private |
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::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 313 of file csma-helper.cc.
References ns3::Mac48Address::Allocate(), ns3::ObjectFactory::Create(), m_deviceFactory, m_enableFlowControl, and m_queueFactory.
Referenced by Install().
void ns3::CsmaHelper::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 CsmaHelper::Install
Definition at line 56 of file csma-helper.cc.
References m_channelFactory, and ns3::ObjectFactory::Set().
Referenced by NeighborCacheExample::Run().
void ns3::CsmaHelper::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::CsmaNetDevice created by CsmaHelper::Install
Definition at line 50 of file csma-helper.cc.
References m_deviceFactory, and ns3::ObjectFactory::Set().
void ns3::CsmaHelper::SetQueue | ( | std::string | type, |
Ts &&... | args | ||
) |
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 CsmaNetDevice created through CsmaHelper::Install.
Definition at line 269 of file csma-helper.h.
References ns3::QueueBase::AppendItemTypeIfNotPresent(), m_queueFactory, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().
|
private |
factory for the channel
Definition at line 259 of file csma-helper.h.
Referenced by CsmaHelper(), Install(), and SetChannelAttribute().
|
private |
factory for the NetDevices
Definition at line 258 of file csma-helper.h.
Referenced by CsmaHelper(), InstallPriv(), and SetDeviceAttribute().
|
private |
whether to enable flow control
Definition at line 260 of file csma-helper.h.
Referenced by CsmaHelper(), DisableFlowControl(), and InstallPriv().
|
private |
factory for the queues
Definition at line 257 of file csma-helper.h.
Referenced by CsmaHelper(), InstallPriv(), and SetQueue().