A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
fd-net-device-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Alina Quereilhac <alina.quereilhac@inria.fr>
7 *
8 */
9
10#ifndef FD_NET_DEVICE_HELPER_H
11#define FD_NET_DEVICE_HELPER_H
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#include "ns3/trace-helper.h"
19
20#include <string>
21
22namespace ns3
23{
24
25/**
26 * \ingroup fd-net-device
27 * \brief build a set of FdNetDevice objects
28 * Normally we eschew multiple inheritance, however, the classes
29 * PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are
30 * treated as "mixins". A mixin is a self-contained class that
31 * encapsulates a general attribute or a set of functionality that
32 * may be of interest to many other classes.
33 */
35{
36 public:
37 /**
38 * Construct a FdNetDeviceHelper.
39 */
41
43 {
44 }
45
46 /**
47 * Set the TypeId of the Objects to be created by this helper.
48 *
49 * \param [in] type The TypeId of the object to instantiate.
50 */
51 void SetTypeId(std::string type);
52
53 /**
54 * \param n1 the name of the attribute to set
55 * \param v1 the value of the attribute to set
56 *
57 * Set these attributes on each ns3::FdNetDevice created
58 * by FdNetDeviceHelper::Install
59 */
60 void SetAttribute(std::string n1, const AttributeValue& v1);
61
62 /**
63 * This method creates a FdNetDevice and associates it to a node
64 *
65 * \param node The node to install the device in
66 * \returns A container holding the added net device.
67 */
68 virtual NetDeviceContainer Install(Ptr<Node> node) const;
69
70 /**
71 * This method creates a FdNetDevice and associates it to a node
72 *
73 * \param name The name of the node to install the device in
74 * \returns A container holding the added net device.
75 */
76 virtual NetDeviceContainer Install(std::string name) const;
77
78 /**
79 * This method creates a FdNetDevice and associates it to a node.
80 * For each Ptr<node> in the provided container: it creates an ns3::FdNetDevice
81 * (with the attributes configured by FdNetDeviceHelper::SetDeviceAttribute);
82 * adds the device to the node; and attaches the channel to the device.
83 *
84 * \param c The NodeContainer holding the nodes to be changed.
85 * \returns A container holding the added net devices.
86 */
87 virtual NetDeviceContainer Install(const NodeContainer& c) const;
88
89 protected:
90 /**
91 * This method creates an ns3::FdNetDevice and associates it to a node
92 *
93 * \param node The node to install the device in
94 * \returns A container holding the added net device.
95 */
96 virtual Ptr<NetDevice> InstallPriv(Ptr<Node> node) const;
97
98 private:
99 /**
100 * \brief Enable pcap output on the indicated net device.
101 *
102 * NetDevice-specific implementation mechanism for hooking the trace and
103 * writing to the trace file.
104 *
105 * \param prefix Filename prefix to use for pcap files.
106 * \param nd Net device for which you want to enable tracing.
107 * \param promiscuous If true capture all possible packets available at the device.
108 * \param explicitFilename Treat the prefix as an explicit filename if true
109 */
110 void EnablePcapInternal(std::string prefix,
112 bool promiscuous,
113 bool explicitFilename) override;
114
115 /**
116 * \brief Enable ascii trace output on the indicated net device.
117 *
118 * NetDevice-specific implementation mechanism for hooking the trace and
119 * writing to the trace file.
120 *
121 * \param stream The output stream object to use when logging ascii traces.
122 * \param prefix Filename prefix to use for ascii trace files.
123 * \param nd Net device for which you want to enable tracing.
124 * \param explicitFilename Treat the prefix as an explicit filename if true
125 */
127 std::string prefix,
129 bool explicitFilename) override;
130
131 ObjectFactory m_deviceFactory; //!< factory for the NetDevices
132};
133
134} // namespace ns3
135
136#endif /* FD_NET_DEVICE_HELPER_H */
Base class providing common user-level ascii trace operations for helpers representing net devices.
Hold a value for an Attribute.
Definition attribute.h:59
build a set of FdNetDevice objects Normally we eschew multiple inheritance, however,...
void SetAttribute(std::string n1, const AttributeValue &v1)
virtual NetDeviceContainer Install(Ptr< Node > node) const
This method creates a FdNetDevice and associates it to a node.
ObjectFactory m_deviceFactory
factory for the NetDevices
virtual Ptr< NetDevice > InstallPriv(Ptr< Node > node) const
This method creates an ns3::FdNetDevice and associates it to a node.
void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override
Enable pcap output on the indicated net device.
FdNetDeviceHelper()
Construct a FdNetDeviceHelper.
void SetTypeId(std::string type)
Set the TypeId of the Objects to be created by this helper.
void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
Enable ascii trace output on the indicated net device.
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Base class providing common user-level pcap operations for helpers representing net devices.
Smart pointer class similar to boost::intrusive_ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.