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
netmap-net-device-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 Universita' degli Studi di Napoli Federico II
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Pasquale Imputato <p.imputato@gmail.com>
7
*/
8
9
#ifndef NETMAP_NET_DEVICE_HELPER_H
10
#define NETMAP_NET_DEVICE_HELPER_H
11
12
#include "
fd-net-device-helper.h
"
13
14
#include "ns3/attribute.h"
15
#include "ns3/fd-net-device.h"
16
#include "ns3/net-device-container.h"
17
#include "ns3/netmap-net-device.h"
18
#include "ns3/node-container.h"
19
#include "ns3/object-factory.h"
20
21
#include <string>
22
23
namespace
ns3
24
{
25
26
class
NetmapNetDevice;
27
28
/**
29
* \ingroup fd-net-device
30
* \brief build a set of FdNetDevice objects attached to a physical network
31
* interface
32
*
33
*/
34
class
NetmapNetDeviceHelper
:
public
FdNetDeviceHelper
35
{
36
public
:
37
NetmapNetDeviceHelper
();
38
39
virtual
~NetmapNetDeviceHelper
()
40
{
41
}
42
43
/**
44
* \brief Get the device name of this device.
45
* \returns The device name of this device.
46
*/
47
std::string
GetDeviceName
();
48
49
/**
50
* \brief Set the device name of this device.
51
* \param deviceName The device name of this device.
52
*/
53
void
SetDeviceName
(std::string deviceName);
54
55
protected
:
56
/**
57
* \brief This method creates an ns3::FdNetDevice attached to a physical network
58
* interface
59
* \param node The node to install the device in
60
* \returns A container holding the added net device.
61
*/
62
Ptr<NetDevice>
InstallPriv
(
Ptr<Node>
node)
const
;
63
64
/**
65
* \brief Sets device flags and MTU.
66
* \param device the FdNetDevice
67
*/
68
virtual
void
SetDeviceAttributes
(
Ptr<FdNetDevice>
device)
const
;
69
70
/**
71
* \brief Call out to a separate process running as suid root in order to get a raw
72
* socket. We do this to avoid having the entire simulation running as root.
73
* \return the rawSocket number
74
*/
75
virtual
int
CreateFileDescriptor
()
const
;
76
77
/**
78
* \brief Switch the fd in netmap mode.
79
* \param fd the file descriptor
80
* \param device the NetmapNetDevice
81
*/
82
void
SwitchInNetmapMode
(
int
fd,
Ptr<NetmapNetDevice>
device)
const
;
83
84
std::string
m_deviceName
;
//!< The unix/linux name of the underlying device (e.g., eth0)
85
};
86
87
}
// namespace ns3
88
89
#endif
/* NETMAP_NET_DEVICE_HELPER_H */
ns3::FdNetDeviceHelper
build a set of FdNetDevice objects Normally we eschew multiple inheritance, however,...
Definition
fd-net-device-helper.h:35
ns3::NetmapNetDeviceHelper
build a set of FdNetDevice objects attached to a physical network interface
Definition
netmap-net-device-helper.h:35
ns3::NetmapNetDeviceHelper::InstallPriv
Ptr< NetDevice > InstallPriv(Ptr< Node > node) const
This method creates an ns3::FdNetDevice attached to a physical network interface.
Definition
netmap-net-device-helper.cc:73
ns3::NetmapNetDeviceHelper::CreateFileDescriptor
virtual int CreateFileDescriptor() const
Call out to a separate process running as suid root in order to get a raw socket.
Definition
netmap-net-device-helper.cc:187
ns3::NetmapNetDeviceHelper::SetDeviceName
void SetDeviceName(std::string deviceName)
Set the device name of this device.
Definition
netmap-net-device-helper.cc:67
ns3::NetmapNetDeviceHelper::m_deviceName
std::string m_deviceName
The unix/linux name of the underlying device (e.g., eth0)
Definition
netmap-net-device-helper.h:84
ns3::NetmapNetDeviceHelper::SwitchInNetmapMode
void SwitchInNetmapMode(int fd, Ptr< NetmapNetDevice > device) const
Switch the fd in netmap mode.
Definition
netmap-net-device-helper.cc:419
ns3::NetmapNetDeviceHelper::GetDeviceName
std::string GetDeviceName()
Get the device name of this device.
Definition
netmap-net-device-helper.cc:61
ns3::NetmapNetDeviceHelper::~NetmapNetDeviceHelper
virtual ~NetmapNetDeviceHelper()
Definition
netmap-net-device-helper.h:39
ns3::NetmapNetDeviceHelper::SetDeviceAttributes
virtual void SetDeviceAttributes(Ptr< FdNetDevice > device) const
Sets device flags and MTU.
Definition
netmap-net-device-helper.cc:98
ns3::NetmapNetDeviceHelper::NetmapNetDeviceHelper
NetmapNetDeviceHelper()
Definition
netmap-net-device-helper.cc:54
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
fd-net-device-helper.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
fd-net-device
helper
netmap-net-device-helper.h
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0