A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::TapFdNetDeviceHelper Class Reference

build a set of FdNetDevice objects attached to a virtual TAP network interface More...

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

+ Inheritance diagram for ns3::TapFdNetDeviceHelper:
+ Collaboration diagram for ns3::TapFdNetDeviceHelper:

Public Member Functions

 TapFdNetDeviceHelper ()
 Construct a TapFdNetDeviceHelper.
 
 ~TapFdNetDeviceHelper () override
 
void SetModePi (bool pi)
 Set flag IFF_NO_PI on the device.
 
void SetTapIpv4Address (Ipv4Address address)
 Set the device IPv4 address.
 
void SetTapIpv4Mask (Ipv4Mask mask)
 Set the IPv4 network mask for the TAP device.
 
void SetTapIpv6Address (Ipv6Address address)
 Set the device IPv6 address.
 
void SetTapIpv6Prefix (int prefix)
 Set the IPv6 network mask for the TAP device.
 
void SetTapMacAddress (Mac48Address mac)
 Set the MAC address for the TAP device.
 
- Public Member Functions inherited from ns3::EmuFdNetDeviceHelper
 EmuFdNetDeviceHelper ()
 Construct a EmuFdNetDeviceHelper.
 
 ~EmuFdNetDeviceHelper () override
 
std::string GetDeviceName ()
 Get the device name of this device.
 
void HostQdiscBypass (bool hostQdiscBypass)
 Request host qdisc bypass.
 
void SetDeviceName (std::string deviceName)
 Set the device name of this device.
 
- Public Member Functions inherited from ns3::FdNetDeviceHelper
 FdNetDeviceHelper ()
 Construct a FdNetDeviceHelper.
 
 ~FdNetDeviceHelper () override
 
virtual NetDeviceContainer Install (const NodeContainer &c) const
 This method creates a FdNetDevice and associates it to a node.
 
virtual NetDeviceContainer Install (Ptr< Node > node) const
 This method creates a FdNetDevice and associates it to a node.
 
virtual NetDeviceContainer Install (std::string name) const
 This method creates a FdNetDevice and associates it to a node.
 
void SetAttribute (std::string n1, const AttributeValue &v1)
 
void SetTypeId (std::string type)
 Set the TypeId of the Objects to be created by this helper.
 
- 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.
 
- 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.
 

Protected Member Functions

int CreateFileDescriptor () const override
 Call out to a separate process running as suid root in order to create a TAP device and obtain the file descriptor associated to it.
 
Ptr< NetDeviceInstallPriv (Ptr< Node > node) const override
 This method creates an ns3::FdNetDevice attached to a virtual TAP network interface.
 
void SetFileDescriptor (Ptr< FdNetDevice > device) const override
 Sets a file descriptor on the FileDescriptorNetDevice.
 

Protected Attributes

bool m_modePi
 The TAP device flag IFF_NO_PI.
 
Ipv4Address m_tapIp4
 The IPv4 address for the TAP device.
 
Ipv6Address m_tapIp6
 The IPv6 address for the TAP device.
 
Mac48Address m_tapMac
 The TAP device MAC address.
 
Ipv4Mask m_tapMask4
 The network mask IPv4 for the TAP device.
 
int m_tapPrefix6
 The network prefix IPv6 for the TAP device.
 
- Protected Attributes inherited from ns3::EmuFdNetDeviceHelper
std::string m_deviceName
 The Unix/Linux name of the underlying device (e.g., eth0)
 
bool m_hostQdiscBypass
 True if request host qdisc bypass.
 

Detailed Description

build a set of FdNetDevice objects attached to a virtual TAP network interface

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

Constructor & Destructor Documentation

◆ TapFdNetDeviceHelper()

ns3::TapFdNetDeviceHelper::TapFdNetDeviceHelper ( )

Construct a TapFdNetDeviceHelper.

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

References ns3::Mac48Address::Allocate(), ns3::Ipv4Address::GetZero(), ns3::Ipv4Mask::GetZero(), ns3::Ipv6Address::GetZero(), ns3::EmuFdNetDeviceHelper::m_deviceName, m_modePi, m_tapIp4, m_tapIp6, m_tapMac, m_tapMask4, and m_tapPrefix6.

+ Here is the call graph for this function:

◆ ~TapFdNetDeviceHelper()

ns3::TapFdNetDeviceHelper::~TapFdNetDeviceHelper ( )
inlineoverride

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

Member Function Documentation

◆ CreateFileDescriptor()

int ns3::TapFdNetDeviceHelper::CreateFileDescriptor ( ) const
overrideprotectedvirtual

Call out to a separate process running as suid root in order to create a TAP device and obtain the file descriptor associated to it.

Returns
The file descriptor associated with the TAP device.

Reimplemented from ns3::EmuFdNetDeviceHelper.

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

References ns3::BufferToString(), ns3::Ipv4Address::GetZero(), ns3::Ipv4Mask::GetZero(), ns3::Ipv6Address::GetZero(), ns3::EmuFdNetDeviceHelper::m_deviceName, m_modePi, m_tapIp4, m_tapIp6, m_tapMac, m_tapMask4, m_tapPrefix6, NS_ABORT_MSG_IF, NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_DEBUG, NS_LOG_FUNCTION, NS_LOG_INFO, and TAP_MAGIC.

Referenced by SetFileDescriptor().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InstallPriv()

Ptr< NetDevice > ns3::TapFdNetDeviceHelper::InstallPriv ( Ptr< Node > node) const
overrideprotectedvirtual

This method creates an ns3::FdNetDevice attached to a virtual TAP network interface.

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

Reimplemented from ns3::EmuFdNetDeviceHelper.

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

References ns3::FdNetDevice::DIXPI, ns3::FdNetDeviceHelper::InstallPriv(), m_modePi, and SetFileDescriptor().

+ Here is the call graph for this function:

◆ SetFileDescriptor()

void ns3::TapFdNetDeviceHelper::SetFileDescriptor ( Ptr< FdNetDevice > device) const
overrideprotectedvirtual

Sets a file descriptor on the FileDescriptorNetDevice.

Parameters
devicethe device to install the file descriptor in

Reimplemented from ns3::EmuFdNetDeviceHelper.

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

References CreateFileDescriptor(), and NS_LOG_LOGIC.

Referenced by InstallPriv().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetModePi()

void ns3::TapFdNetDeviceHelper::SetModePi ( bool pi)

Set flag IFF_NO_PI on the device.

Parameters
piSet the IFF_NO_PI flag if pi is false.

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

References m_modePi.

◆ SetTapIpv4Address()

void ns3::TapFdNetDeviceHelper::SetTapIpv4Address ( Ipv4Address address)

Set the device IPv4 address.

Parameters
addressThe IPv4 address for the TAP device.

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

References m_tapIp4.

◆ SetTapIpv4Mask()

void ns3::TapFdNetDeviceHelper::SetTapIpv4Mask ( Ipv4Mask mask)

Set the IPv4 network mask for the TAP device.

Parameters
maskThe IPv4 network mask for the TAP device.

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

References m_tapMask4.

◆ SetTapIpv6Address()

void ns3::TapFdNetDeviceHelper::SetTapIpv6Address ( Ipv6Address address)

Set the device IPv6 address.

Parameters
addressThe IPv6 address for the TAP device.

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

References m_tapIp6.

◆ SetTapIpv6Prefix()

void ns3::TapFdNetDeviceHelper::SetTapIpv6Prefix ( int prefix)

Set the IPv6 network mask for the TAP device.

Parameters
prefixThe IPv6 network prefix for the TAP device.

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

References m_tapPrefix6.

◆ SetTapMacAddress()

void ns3::TapFdNetDeviceHelper::SetTapMacAddress ( Mac48Address mac)

Set the MAC address for the TAP device.

Parameters
macThe MAC address the TAP device.

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

References m_tapMac.

Member Data Documentation

◆ m_modePi

bool ns3::TapFdNetDeviceHelper::m_modePi
protected

The TAP device flag IFF_NO_PI.

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

Referenced by TapFdNetDeviceHelper(), CreateFileDescriptor(), InstallPriv(), and SetModePi().

◆ m_tapIp4

Ipv4Address ns3::TapFdNetDeviceHelper::m_tapIp4
protected

The IPv4 address for the TAP device.

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

Referenced by TapFdNetDeviceHelper(), CreateFileDescriptor(), and SetTapIpv4Address().

◆ m_tapIp6

Ipv6Address ns3::TapFdNetDeviceHelper::m_tapIp6
protected

The IPv6 address for the TAP device.

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

Referenced by TapFdNetDeviceHelper(), CreateFileDescriptor(), and SetTapIpv6Address().

◆ m_tapMac

Mac48Address ns3::TapFdNetDeviceHelper::m_tapMac
protected

The TAP device MAC address.

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

Referenced by TapFdNetDeviceHelper(), CreateFileDescriptor(), and SetTapMacAddress().

◆ m_tapMask4

Ipv4Mask ns3::TapFdNetDeviceHelper::m_tapMask4
protected

The network mask IPv4 for the TAP device.

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

Referenced by TapFdNetDeviceHelper(), CreateFileDescriptor(), and SetTapIpv4Mask().

◆ m_tapPrefix6

int ns3::TapFdNetDeviceHelper::m_tapPrefix6
protected

The network prefix IPv6 for the TAP device.

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

Referenced by TapFdNetDeviceHelper(), CreateFileDescriptor(), and SetTapIpv6Prefix().


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