build a set of EmuNetDevice objects More...
#include <emu-helper.h>
Public Member Functions | |
EmuHelper () | |
NetDeviceContainer | 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. More... | |
NetDeviceContainer | 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. More... | |
NetDeviceContainer | 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. More... | |
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. 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... | |
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< NetDevice > | InstallPriv (Ptr< Node > node) const |
Private Attributes | |
ObjectFactory | m_deviceFactory |
ObjectFactory | m_queueFactory |
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.
ns3::EmuHelper::EmuHelper | ( | ) |
Definition at line 37 of file emu-helper.cc.
References m_deviceFactory, m_queueFactory, NS_LOG_FUNCTION_NOARGS, and ns3::ObjectFactory::SetTypeId().
|
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 106 of file emu-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::EmuNetDevice::GetQueue(), ns3::AsciiTraceHelper::HookDefaultDequeueSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultDropSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultEnqueueSinkWithoutContext(), ns3::AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext(), ns3::MakeBoundCallback(), and NS_LOG_INFO.
|
privatevirtual |
Enable pcap output 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 emu-helper.cc.
References ns3::PcapHelper::CreateFile(), ns3::PcapHelper::DLT_EN10MB, 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.
node | The node to install the device in |
Definition at line 207 of file emu-helper.cc.
References InstallPriv().
Referenced by main().
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.
nodeName | The name of the node to install the device in |
Definition at line 213 of file emu-helper.cc.
References InstallPriv().
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.
c | The NodeContainer holding the nodes to be changed. |
Definition at line 220 of file emu-helper.cc.
References ns3::NetDeviceContainer::Add(), ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), and InstallPriv().
Definition at line 233 of file emu-helper.cc.
References ns3::Node::AddDevice(), ns3::Mac48Address::Allocate(), ns3::ObjectFactory::Create(), m_deviceFactory, and m_queueFactory.
Referenced by Install().
void ns3::EmuHelper::SetAttribute | ( | 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::EmuNetDevice created by EmuHelper::Install
Definition at line 61 of file emu-helper.cc.
References m_deviceFactory, NS_LOG_FUNCTION_NOARGS, and ns3::ObjectFactory::Set().
Referenced by main().
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 () |
||
) |
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 EmuNetDevice created through EmuHelper::Install.
Definition at line 45 of file emu-helper.cc.
References m_queueFactory, NS_LOG_FUNCTION_NOARGS, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().
|
private |
Definition at line 149 of file emu-helper.h.
Referenced by EmuHelper(), InstallPriv(), and SetAttribute().
|
private |
Definition at line 148 of file emu-helper.h.
Referenced by EmuHelper(), InstallPriv(), and SetQueue().