A Discrete-Event Network Simulator
API
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ns3::FdNetDeviceHelper Class Reference

build a set of FdNetDevice objects Normally we eschew multiple inheritance, however, the classes PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are treated as "mixins". More...

#include "fd-net-device-helper.h"

+ Inheritance diagram for ns3::FdNetDeviceHelper:

Public Member Functions

 FdNetDeviceHelper ()
 Construct a FdNetDeviceHelper. More...
 
virtual ~FdNetDeviceHelper ()
 
virtual NetDeviceContainer Install (Ptr< Node > node) const
 This method creates a FdNetDevice and associates it to a node. More...
 
virtual NetDeviceContainer Install (std::string name) const
 This method creates a FdNetDevice and associates it to a node. More...
 
virtual NetDeviceContainer Install (const NodeContainer &c) const
 This method creates a FdNetDevice and associates it to a node. More...
 
void SetAttribute (std::string n1, const AttributeValue &v1)
 
- Public Member Functions inherited from ns3::PcapHelperForDevice
 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...
 
- Public Member Functions inherited from ns3::AsciiTraceHelperForDevice
 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...
 

Protected Member Functions

virtual Ptr< NetDeviceInstallPriv (Ptr< Node > node) const
 This method creates an ns3::FdNetDevice and associates it to a node. 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...
 

Private Attributes

ObjectFactory m_deviceFactory
 factory for the NetDevices More...
 

Detailed Description

build a set of FdNetDevice 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 45 of file fd-net-device-helper.h.

Constructor & Destructor Documentation

◆ FdNetDeviceHelper()

ns3::FdNetDeviceHelper::FdNetDeviceHelper ( )

Construct a FdNetDeviceHelper.

Definition at line 40 of file fd-net-device-helper.cc.

References m_deviceFactory, and ns3::ObjectFactory::SetTypeId().

◆ ~FdNetDeviceHelper()

virtual ns3::FdNetDeviceHelper::~FdNetDeviceHelper ( )
inlinevirtual

Definition at line 53 of file fd-net-device-helper.h.

Member Function Documentation

◆ EnableAsciiInternal()

void ns3::FdNetDeviceHelper::EnableAsciiInternal ( Ptr< OutputStreamWrapper stream,
std::string  prefix,
Ptr< NetDevice nd,
bool  explicitFilename 
)
privatevirtual

Enable ascii trace output on the indicated net device.

NetDevice-specific implementation mechanism for hooking the trace and writing to the trace file.

Parameters
streamThe output stream object to use when logging ascii traces.
prefixFilename prefix to use for ascii trace files.
ndNet device for which you want to enable tracing.
explicitFilenameTreat the prefix as an explicit filename if true

Implements ns3::AsciiTraceHelperForDevice.

Definition at line 91 of file fd-net-device-helper.cc.

References ns3::Config::Connect(), ns3::AsciiTraceHelper::CreateFileStream(), ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext(), ns3::Packet::EnablePrinting(), ns3::AsciiTraceHelper::GetFilenameFromDevice(), ns3::AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext(), ns3::MakeBoundCallback(), and NS_LOG_INFO.

◆ EnablePcapInternal()

void ns3::FdNetDeviceHelper::EnablePcapInternal ( std::string  prefix,
Ptr< NetDevice nd,
bool  promiscuous,
bool  explicitFilename 
)
privatevirtual

Enable pcap output on the indicated net device.

NetDevice-specific implementation mechanism for hooking the trace and writing to the trace file.

Parameters
prefixFilename prefix to use for pcap files.
ndNet device for which you want to enable tracing.
promiscuousIf true capture all possible packets available at the device.
explicitFilenameTreat the prefix as an explicit filename if true

Implements ns3::PcapHelperForDevice.

Definition at line 53 of file fd-net-device-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.

◆ Install() [1/3]

NetDeviceContainer ns3::FdNetDeviceHelper::Install ( Ptr< Node node) const
virtual

This method creates a FdNetDevice and associates it to a node.

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

Definition at line 170 of file fd-net-device-helper.cc.

References InstallPriv().

Referenced by ns3::EmuEpcHelper::DoInitialize().

◆ Install() [2/3]

NetDeviceContainer ns3::FdNetDeviceHelper::Install ( std::string  name) const
virtual

This method creates a FdNetDevice and associates it to a node.

Parameters
nameThe name of the node to install the device in
Returns
A container holding the added net device.

Definition at line 176 of file fd-net-device-helper.cc.

References InstallPriv().

◆ Install() [3/3]

NetDeviceContainer ns3::FdNetDeviceHelper::Install ( const NodeContainer c) const
virtual

This method creates a FdNetDevice and associates it to a node.

For each Ptr<node> in the provided container: it creates an ns3::FdNetDevice (with the attributes configured by FdNetDeviceHelper::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 183 of file fd-net-device-helper.cc.

References ns3::NetDeviceContainer::Add(), ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), and InstallPriv().

◆ InstallPriv()

Ptr< NetDevice > ns3::FdNetDeviceHelper::InstallPriv ( Ptr< Node node) const
protectedvirtual

This method creates an ns3::FdNetDevice and associates it to a node.

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

Reimplemented in ns3::TapFdNetDeviceHelper, ns3::PlanetLabFdNetDeviceHelper, and ns3::EmuFdNetDeviceHelper.

Definition at line 196 of file fd-net-device-helper.cc.

References ns3::Node::AddDevice(), ns3::Mac48Address::Allocate(), ns3::ObjectFactory::Create(), and m_deviceFactory.

Referenced by Install(), ns3::EmuFdNetDeviceHelper::InstallPriv(), ns3::PlanetLabFdNetDeviceHelper::InstallPriv(), and ns3::TapFdNetDeviceHelper::InstallPriv().

◆ SetAttribute()

void ns3::FdNetDeviceHelper::SetAttribute ( 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::FdNetDevice created by FdNetDeviceHelper::Install

Definition at line 46 of file fd-net-device-helper.cc.

References m_deviceFactory, NS_LOG_FUNCTION, and ns3::ObjectFactory::Set().

Member Data Documentation

◆ m_deviceFactory

ObjectFactory ns3::FdNetDeviceHelper::m_deviceFactory
private

factory for the NetDevices

Definition at line 133 of file fd-net-device-helper.h.

Referenced by FdNetDeviceHelper(), InstallPriv(), and SetAttribute().


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