A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
emu-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 EMU_FD_NET_DEVICE_HELPER_H
9#define EMU_FD_NET_DEVICE_HELPER_H
10
12
13#include "ns3/attribute.h"
14#include "ns3/fd-net-device.h"
15#include "ns3/net-device-container.h"
16#include "ns3/node-container.h"
17#include "ns3/object-factory.h"
18
19#include <string>
20
21namespace ns3
22{
23
24/**
25 * \ingroup fd-net-device
26 * \brief build a set of FdNetDevice objects attached to a physical network
27 * interface
28 *
29 */
31{
32 public:
33 /**
34 * Construct a EmuFdNetDeviceHelper.
35 */
37
39 {
40 }
41
42 /**
43 * Get the device name of this device.
44 *
45 * \returns The device name of this device.
46 */
47 std::string GetDeviceName();
48
49 /**
50 * Set the device name of this device.
51 *
52 * \param deviceName The device name of this device.
53 */
54 void SetDeviceName(std::string deviceName);
55
56 /**
57 * \brief Request host qdisc bypass
58 * \param hostQdiscBypass to enable host qdisc bypass
59 */
60 void HostQdiscBypass(bool hostQdiscBypass);
61
62 protected:
63 /**
64 * This method creates an ns3::FdNetDevice attached to a physical network
65 * interface
66 *
67 * \param node The node to install the device in
68 * \returns A container holding the added net device.
69 */
70 Ptr<NetDevice> InstallPriv(Ptr<Node> node) const override;
71
72 /**
73 * Sets a file descriptor on the FileDescriptorNetDevice.
74 * \param device the device to install the file descriptor in
75 */
76 virtual void SetFileDescriptor(Ptr<FdNetDevice> device) const;
77
78 /**
79 * Call out to a separate process running as suid root in order to get a raw
80 * socket. We do this to avoid having the entire simulation running as root.
81 * \return the rawSocket number
82 */
83 virtual int CreateFileDescriptor() const;
84
85 /**
86 * The Unix/Linux name of the underlying device (e.g., eth0)
87 */
88 std::string m_deviceName;
89 bool m_hostQdiscBypass; //!< True if request host qdisc bypass
90};
91
92} // namespace ns3
93
94#endif /* EMU_FD_NET_DEVICE_HELPER_H */
build a set of FdNetDevice objects attached to a physical network interface
bool m_hostQdiscBypass
True if request host qdisc bypass.
std::string m_deviceName
The Unix/Linux name of the underlying device (e.g., eth0)
void HostQdiscBypass(bool hostQdiscBypass)
Request host qdisc bypass.
void SetDeviceName(std::string deviceName)
Set the device name of this device.
Ptr< NetDevice > InstallPriv(Ptr< Node > node) const override
This method creates an ns3::FdNetDevice attached to a physical network interface.
virtual void SetFileDescriptor(Ptr< FdNetDevice > device) const
Sets a file descriptor on the FileDescriptorNetDevice.
std::string GetDeviceName()
Get the device name of this device.
virtual int CreateFileDescriptor() const
Call out to a separate process running as suid root in order to get a raw socket.
EmuFdNetDeviceHelper()
Construct a EmuFdNetDeviceHelper.
build a set of FdNetDevice objects Normally we eschew multiple inheritance, however,...
Smart pointer class similar to boost::intrusive_ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.