A Discrete-Event Network Simulator
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
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
23namespace ns3
24{
25
26class 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 */
35{
36 public:
38
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 */
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 */
build a set of FdNetDevice objects Normally we eschew multiple inheritance, however,...
build a set of FdNetDevice objects attached to a physical network interface
Ptr< NetDevice > InstallPriv(Ptr< Node > node) const
This method creates an ns3::FdNetDevice attached to a physical network interface.
virtual int CreateFileDescriptor() const
Call out to a separate process running as suid root in order to get a raw socket.
void SetDeviceName(std::string deviceName)
Set the device name of this device.
std::string m_deviceName
The unix/linux name of the underlying device (e.g., eth0)
void SwitchInNetmapMode(int fd, Ptr< NetmapNetDevice > device) const
Switch the fd in netmap mode.
std::string GetDeviceName()
Get the device name of this device.
virtual void SetDeviceAttributes(Ptr< FdNetDevice > device) const
Sets device flags and MTU.
Smart pointer class similar to boost::intrusive_ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.