A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::EmuHelper Class Reference

build a set of EmuNetDevice objects More...

#include <emu-helper.h>

+ Inheritance diagram for ns3::EmuHelper:

Public Member Functions

NetDeviceContainer Install (Ptr< Node > node) const
 
NetDeviceContainer Install (std::string nodeName) const
 
NetDeviceContainer Install (const NodeContainer &c) const
 
void SetAttribute (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())
 
- Public Member Functions inherited from ns3::PcapHelperForDevice
 PcapHelperForDevice ()
 Construct a PcapHelperForDevice.
 
virtual ~PcapHelperForDevice ()
 Destroy a PcapHelperForDevice.
 
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.
 
virtual ~AsciiTraceHelperForDevice ()
 Destroy an AsciiTraceHelperForDevice.
 
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 the indicated net device. More...
 
Ptr< NetDeviceInstallPriv (Ptr< Node > node) const
 

Private Attributes

ObjectFactory m_deviceFactory
 
ObjectFactory m_queueFactory
 

Detailed Description

build a set of EmuNetDevice 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 emu-helper.h.

Member Function Documentation

void ns3::EmuHelper::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 106 of file emu-helper.cc.

References ns3::Config::Connect(), ns3::AsciiTraceHelper::CreateFileStream(), ns3::Packet::EnablePrinting(), ns3::AsciiTraceHelper::GetFilenameFromDevice(), ns3::EmuNetDevice::GetQueue(), ns3::AsciiTraceHelper::HookDefaultDequeueSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultDropSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultEnqueueSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext(), and NS_LOG_INFO.

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

Enable pcap output 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 68 of file emu-helper.cc.

References ns3::PcapHelper::CreateFile(), ns3::PcapHelper::GetFilenameFromDevice(), ns3::PcapHelper::HookDefaultSink(), and NS_LOG_INFO.

NetDeviceContainer ns3::EmuHelper::Install ( Ptr< Node node) const

This method creates an ns3::EmuNetDevice with the attributes configured by EmuHelper::SetDeviceAttribute and then adds the device to the node.

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

Definition at line 207 of file emu-helper.cc.

NetDeviceContainer ns3::EmuHelper::Install ( std::string  nodeName) const

This method creates an ns3::EmuNetDevice with the attributes configured by EmuHelper::SetDeviceAttribute and then adds the device to the node.

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

Definition at line 213 of file emu-helper.cc.

NetDeviceContainer ns3::EmuHelper::Install ( const NodeContainer c) const

For each Ptr<node> in the provided container this method creates an ns3::EmuNetDevice (with the attributes configured by EmuHelper::SetDeviceAttribute); adds the device to the node.

Parameters
cThe NodeContainer holding the nodes to be changed.
Returns
A container holding the added net devices.

Definition at line 220 of file emu-helper.cc.

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

void ns3::EmuHelper::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::EmuNetDevice created by EmuHelper::Install

Definition at line 61 of file emu-helper.cc.

References NS_LOG_FUNCTION_NOARGS, and ns3::ObjectFactory::Set().

void ns3::EmuHelper::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 () 
)
Parameters
typethe type of queue
n1the name of the attribute to set on the queue
v1the value of the attribute to set on the queue
n2the name of the attribute to set on the queue
v2the value of the attribute to set on the queue
n3the name of the attribute to set on the queue
v3the value of the attribute to set on the queue
n4the name of the attribute to set on the queue
v4the value of the attribute to set on the queue

Set the type of queue to create and associated to each EmuNetDevice created through EmuHelper::Install.

Definition at line 45 of file emu-helper.cc.

References NS_LOG_FUNCTION_NOARGS, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().


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