build a set of CsmaNetDevice objects More...
#include "csma-helper.h"
Public Member Functions | |
CsmaHelper () | |
Construct a CsmaHelper. More... | |
virtual | ~CsmaHelper () |
int64_t | AssignStreams (NetDeviceContainer c, int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
NetDeviceContainer | Install (const NodeContainer &c) const |
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttribute. More... | |
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. More... | |
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. More... | |
void | SetChannelAttribute (std::string n1, const AttributeValue &v1) |
void | SetDeviceAttribute (std::string n1, const AttributeValue &v1) |
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()) |
![]() | |
PcapHelperForDevice () | |
Construct a PcapHelperForDevice. More... | |
virtual | ~PcapHelperForDevice () |
Destroy a PcapHelperForDevice. More... | |
void | EnablePcap (std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false) |
Enable pcap output the indicated net device. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
![]() | |
AsciiTraceHelperForDevice () | |
Construct an AsciiTraceHelperForDevice. More... | |
virtual | ~AsciiTraceHelperForDevice () |
Destroy an AsciiTraceHelperForDevice. More... | |
void | EnableAscii (std::string prefix, Ptr< NetDevice > nd, bool explicitFilename=false) |
Enable ascii trace output on the indicated net device. More... | |
void | EnableAscii (Ptr< OutputStreamWrapper > stream, Ptr< NetDevice > nd) |
Enable ascii trace output on the indicated net device. More... | |
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. More... | |
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. More... | |
void | EnableAscii (std::string prefix, NetDeviceContainer d) |
Enable ascii trace output on each device in the container which is of the appropriate type. More... | |
void | EnableAscii (Ptr< OutputStreamWrapper > stream, NetDeviceContainer d) |
Enable ascii trace output on each device in the container which is of the appropriate type. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
Private Member Functions | |
virtual void | EnableAsciiInternal (Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) |
Enable ascii trace output on the indicated net device. More... | |
virtual void | EnablePcapInternal (std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) |
Enable pcap output on the indicated net device. More... | |
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. More... | |
Private Attributes | |
ObjectFactory | m_channelFactory |
factory for the channel More... | |
ObjectFactory | m_deviceFactory |
factory for the NetDevices More... | |
ObjectFactory | m_queueFactory |
factory for the queues More... | |
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 46 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_queueFactory, and ns3::ObjectFactory::SetTypeId().
|
inlinevirtual |
Definition at line 53 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 287 of file csma-helper.cc.
References ns3::NetDeviceContainer::Begin(), second::csma, and ns3::NetDeviceContainer::End().
|
privatevirtual |
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 116 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.
|
privatevirtual |
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 77 of file csma-helper.cc.
References ns3::PcapHelper::CreateFile(), ns3::PcapHelper::DLT_EN10MB, anonymous_namespace{print-introspected-doxygen.cc}::file, ns3::PcapHelper::GetFilenameFromDevice(), ns3::PcapHelper::HookDefaultSink(), and NS_LOG_INFO.
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 217 of file csma-helper.cc.
References third::channel, ns3::ObjectFactory::Create(), ns3::Object::GetObject(), and m_channelFactory.
Referenced by ns3::CsmaStarHelper::CsmaStarHelper(), EpcS1uDlTestCase::DoRun(), EpcS1uUlTestCase::DoRun(), and Install().
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 224 of file csma-helper.cc.
References Install().
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 231 of file csma-helper.cc.
References third::channel, and 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 237 of file csma-helper.cc.
References third::channel, and InstallPriv().
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 244 of file csma-helper.cc.
References third::channel, and 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 251 of file csma-helper.cc.
References third::channel, and InstallPriv().
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 259 of file csma-helper.cc.
References third::channel, 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 267 of file csma-helper.cc.
References ns3::NetDeviceContainer::Add(), ns3::NodeContainer::Begin(), third::channel, 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 280 of file csma-helper.cc.
References third::channel, and Install().
|
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 304 of file csma-helper.cc.
References ns3::Node::AddDevice(), ns3::Mac48Address::Allocate(), third::channel, ns3::ObjectFactory::Create(), m_deviceFactory, 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 71 of file csma-helper.cc.
References m_channelFactory, and ns3::ObjectFactory::Set().
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 65 of file csma-helper.cc.
References m_deviceFactory, and ns3::ObjectFactory::Set().
void ns3::CsmaHelper::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 () |
||
) |
type | the type of queue |
n1 | the name of the attribute to set on the queue |
v1 | the value of the attribute to set on the queue |
n2 | the name of the attribute to set on the queue |
v2 | the value of the attribute to set on the queue |
n3 | the name of the attribute to set on the queue |
v3 | the value of the attribute to set on the queue |
n4 | the name of the attribute to set on the queue |
v4 | the value of the attribute to set on the queue |
Set the type of queue to create and associated to each CsmaNetDevice created through CsmaHelper::Install.
Definition at line 49 of file csma-helper.cc.
References ns3::QueueBase::AppendItemTypeIfNotPresent(), m_queueFactory, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().
|
private |
factory for the channel
Definition at line 252 of file csma-helper.h.
Referenced by CsmaHelper(), Install(), and SetChannelAttribute().
|
private |
factory for the NetDevices
Definition at line 251 of file csma-helper.h.
Referenced by CsmaHelper(), InstallPriv(), and SetDeviceAttribute().
|
private |
factory for the queues
Definition at line 250 of file csma-helper.h.
Referenced by CsmaHelper(), InstallPriv(), and SetQueue().