A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
tap-fd-net-device-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012 INRIA, 2012 University of Washington
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
*/
7
8
#ifndef TAP_FD_NET_DEVICE_HELPER_H
9
#define TAP_FD_NET_DEVICE_HELPER_H
10
11
#include "
emu-fd-net-device-helper.h
"
12
13
#include "ns3/attribute.h"
14
#include "ns3/fd-net-device.h"
15
#include "ns3/mac48-address.h"
16
#include "ns3/net-device-container.h"
17
#include "ns3/node-container.h"
18
#include "ns3/object-factory.h"
19
20
#include <string>
21
22
namespace
ns3
23
{
24
25
/**
26
* \ingroup fd-net-device
27
* \brief build a set of FdNetDevice objects attached to a virtual TAP network
28
* interface
29
*
30
*/
31
class
TapFdNetDeviceHelper
:
public
EmuFdNetDeviceHelper
32
{
33
public
:
34
/**
35
* Construct a TapFdNetDeviceHelper.
36
*/
37
TapFdNetDeviceHelper
();
38
39
~TapFdNetDeviceHelper
()
override
40
{
41
}
42
43
/**
44
* Set flag IFF_NO_PI on the device.
45
*
46
* \param pi Set the IFF_NO_PI flag if pi is false.
47
*/
48
void
SetModePi
(
bool
pi);
49
50
/**
51
* Set the device IPv4 address.
52
*
53
* \param address The IPv4 address for the TAP device.
54
*/
55
void
SetTapIpv4Address
(
Ipv4Address
address);
56
57
/**
58
* Set the IPv4 network mask for the TAP device.
59
*
60
* \param mask The IPv4 network mask for the TAP device.
61
*/
62
void
SetTapIpv4Mask
(
Ipv4Mask
mask);
63
64
/**
65
* Set the device IPv6 address.
66
*
67
* \param address The IPv6 address for the TAP device.
68
*/
69
void
SetTapIpv6Address
(
Ipv6Address
address);
70
71
/**
72
* Set the IPv6 network mask for the TAP device.
73
*
74
* \param prefix The IPv6 network prefix for the TAP device.
75
*/
76
void
SetTapIpv6Prefix
(
int
prefix);
77
78
/**
79
* Set the MAC address for the TAP device.
80
*
81
* \param mac The MAC address the TAP device.
82
*/
83
void
SetTapMacAddress
(
Mac48Address
mac);
84
85
protected
:
86
/**
87
* This method creates an ns3::FdNetDevice attached to a virtual TAP network
88
* interface
89
*
90
* \param node The node to install the device in
91
* \returns A container holding the added net device.
92
*/
93
Ptr<NetDevice>
InstallPriv
(
Ptr<Node>
node)
const override
;
94
95
/**
96
* Sets a file descriptor on the FileDescriptorNetDevice.
97
* \param device the device to install the file descriptor in
98
*/
99
void
SetFileDescriptor
(
Ptr<FdNetDevice>
device)
const override
;
100
101
/**
102
* Call out to a separate process running as suid root in order to create a
103
* TAP device and obtain the file descriptor associated to it.
104
* \returns The file descriptor associated with the TAP device.
105
*/
106
int
CreateFileDescriptor
()
const override
;
107
108
/**
109
* The TAP device flag IFF_NO_PI.
110
*/
111
bool
m_modePi
;
112
113
/**
114
* The IPv4 address for the TAP device.
115
*/
116
Ipv4Address
m_tapIp4
;
117
118
/**
119
* The IPv6 address for the TAP device.
120
*/
121
Ipv6Address
m_tapIp6
;
122
123
/**
124
* The network mask IPv4 for the TAP device.
125
*/
126
Ipv4Mask
m_tapMask4
;
127
128
/**
129
* The network prefix IPv6 for the TAP device.
130
*/
131
int
m_tapPrefix6
;
132
133
/**
134
* The TAP device MAC address.
135
*/
136
Mac48Address
m_tapMac
;
137
};
138
139
}
// namespace ns3
140
141
#endif
/* TAP_FD_NET_DEVICE_HELPER_H */
ns3::EmuFdNetDeviceHelper
build a set of FdNetDevice objects attached to a physical network interface
Definition
emu-fd-net-device-helper.h:31
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition
ipv4-address.h:31
ns3::Ipv4Mask
a class to represent an Ipv4 address mask
Definition
ipv4-address.h:246
ns3::Ipv6Address
Describes an IPv6 address.
Definition
ipv6-address.h:38
ns3::Mac48Address
an EUI-48 address
Definition
mac48-address.h:35
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::TapFdNetDeviceHelper
build a set of FdNetDevice objects attached to a virtual TAP network interface
Definition
tap-fd-net-device-helper.h:32
ns3::TapFdNetDeviceHelper::CreateFileDescriptor
int CreateFileDescriptor() const override
Call out to a separate process running as suid root in order to create a TAP device and obtain the fi...
Definition
tap-fd-net-device-helper.cc:131
ns3::TapFdNetDeviceHelper::SetTapMacAddress
void SetTapMacAddress(Mac48Address mac)
Set the MAC address for the TAP device.
Definition
tap-fd-net-device-helper.cc:91
ns3::TapFdNetDeviceHelper::m_modePi
bool m_modePi
The TAP device flag IFF_NO_PI.
Definition
tap-fd-net-device-helper.h:111
ns3::TapFdNetDeviceHelper::SetTapIpv6Prefix
void SetTapIpv6Prefix(int prefix)
Set the IPv6 network mask for the TAP device.
Definition
tap-fd-net-device-helper.cc:85
ns3::TapFdNetDeviceHelper::m_tapIp6
Ipv6Address m_tapIp6
The IPv6 address for the TAP device.
Definition
tap-fd-net-device-helper.h:121
ns3::TapFdNetDeviceHelper::InstallPriv
Ptr< NetDevice > InstallPriv(Ptr< Node > node) const override
This method creates an ns3::FdNetDevice attached to a virtual TAP network interface.
Definition
tap-fd-net-device-helper.cc:97
ns3::TapFdNetDeviceHelper::SetTapIpv4Mask
void SetTapIpv4Mask(Ipv4Mask mask)
Set the IPv4 network mask for the TAP device.
Definition
tap-fd-net-device-helper.cc:73
ns3::TapFdNetDeviceHelper::m_tapMask4
Ipv4Mask m_tapMask4
The network mask IPv4 for the TAP device.
Definition
tap-fd-net-device-helper.h:126
ns3::TapFdNetDeviceHelper::m_tapIp4
Ipv4Address m_tapIp4
The IPv4 address for the TAP device.
Definition
tap-fd-net-device-helper.h:116
ns3::TapFdNetDeviceHelper::TapFdNetDeviceHelper
TapFdNetDeviceHelper()
Construct a TapFdNetDeviceHelper.
Definition
tap-fd-net-device-helper.cc:49
ns3::TapFdNetDeviceHelper::m_tapMac
Mac48Address m_tapMac
The TAP device MAC address.
Definition
tap-fd-net-device-helper.h:136
ns3::TapFdNetDeviceHelper::m_tapPrefix6
int m_tapPrefix6
The network prefix IPv6 for the TAP device.
Definition
tap-fd-net-device-helper.h:131
ns3::TapFdNetDeviceHelper::SetTapIpv4Address
void SetTapIpv4Address(Ipv4Address address)
Set the device IPv4 address.
Definition
tap-fd-net-device-helper.cc:67
ns3::TapFdNetDeviceHelper::SetModePi
void SetModePi(bool pi)
Set flag IFF_NO_PI on the device.
Definition
tap-fd-net-device-helper.cc:61
ns3::TapFdNetDeviceHelper::SetTapIpv6Address
void SetTapIpv6Address(Ipv6Address address)
Set the device IPv6 address.
Definition
tap-fd-net-device-helper.cc:79
ns3::TapFdNetDeviceHelper::~TapFdNetDeviceHelper
~TapFdNetDeviceHelper() override
Definition
tap-fd-net-device-helper.h:39
ns3::TapFdNetDeviceHelper::SetFileDescriptor
void SetFileDescriptor(Ptr< FdNetDevice > device) const override
Sets a file descriptor on the FileDescriptorNetDevice.
Definition
tap-fd-net-device-helper.cc:118
emu-fd-net-device-helper.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
fd-net-device
helper
tap-fd-net-device-helper.h
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0