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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Alina Quereilhac <alina.quereilhac@inria.fr>
18 *
19 */
20
21#ifndef FD_NET_DEVICE_HELPER_H
22#define FD_NET_DEVICE_HELPER_H
23
24#include "ns3/attribute.h"
25#include "ns3/fd-net-device.h"
26#include "ns3/net-device-container.h"
27#include "ns3/node-container.h"
28#include "ns3/object-factory.h"
29#include "ns3/trace-helper.h"
30
31#include <string>
32
33namespace ns3
34{
35
36/**
37 * \ingroup fd-net-device
38 * \brief build a set of FdNetDevice objects
39 * Normally we eschew multiple inheritance, however, the classes
40 * PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are
41 * treated as "mixins". A mixin is a self-contained class that
42 * encapsulates a general attribute or a set of functionality that
43 * may be of interest to many other classes.
44 */
46{
47 public:
48 /**
49 * Construct a FdNetDeviceHelper.
50 */
52
54 {
55 }
56
57 /**
58 * Set the TypeId of the Objects to be created by this helper.
59 *
60 * \param [in] type The TypeId of the object to instantiate.
61 */
62 void SetTypeId(std::string type);
63
64 /**
65 * \param n1 the name of the attribute to set
66 * \param v1 the value of the attribute to set
67 *
68 * Set these attributes on each ns3::FdNetDevice created
69 * by FdNetDeviceHelper::Install
70 */
71 void SetAttribute(std::string n1, const AttributeValue& v1);
72
73 /**
74 * This method creates a FdNetDevice and associates it to a node
75 *
76 * \param node The node to install the device in
77 * \returns A container holding the added net device.
78 */
79 virtual NetDeviceContainer Install(Ptr<Node> node) const;
80
81 /**
82 * This method creates a FdNetDevice and associates it to a node
83 *
84 * \param name The name of the node to install the device in
85 * \returns A container holding the added net device.
86 */
87 virtual NetDeviceContainer Install(std::string name) const;
88
89 /**
90 * This method creates a FdNetDevice and associates it to a node.
91 * For each Ptr<node> in the provided container: it creates an ns3::FdNetDevice
92 * (with the attributes configured by FdNetDeviceHelper::SetDeviceAttribute);
93 * adds the device to the node; and attaches the channel to the device.
94 *
95 * \param c The NodeContainer holding the nodes to be changed.
96 * \returns A container holding the added net devices.
97 */
98 virtual NetDeviceContainer Install(const NodeContainer& c) const;
99
100 protected:
101 /**
102 * This method creates an ns3::FdNetDevice and associates it to a node
103 *
104 * \param node The node to install the device in
105 * \returns A container holding the added net device.
106 */
107 virtual Ptr<NetDevice> InstallPriv(Ptr<Node> node) const;
108
109 private:
110 /**
111 * \brief Enable pcap output on the indicated net device.
112 *
113 * NetDevice-specific implementation mechanism for hooking the trace and
114 * writing to the trace file.
115 *
116 * \param prefix Filename prefix to use for pcap files.
117 * \param nd Net device for which you want to enable tracing.
118 * \param promiscuous If true capture all possible packets available at the device.
119 * \param explicitFilename Treat the prefix as an explicit filename if true
120 */
121 void EnablePcapInternal(std::string prefix,
123 bool promiscuous,
124 bool explicitFilename) override;
125
126 /**
127 * \brief Enable ascii trace output on the indicated net device.
128 *
129 * NetDevice-specific implementation mechanism for hooking the trace and
130 * writing to the trace file.
131 *
132 * \param stream The output stream object to use when logging ascii traces.
133 * \param prefix Filename prefix to use for ascii trace files.
134 * \param nd Net device for which you want to enable tracing.
135 * \param explicitFilename Treat the prefix as an explicit filename if true
136 */
138 std::string prefix,
140 bool explicitFilename) override;
141
142 ObjectFactory m_deviceFactory; //!< factory for the NetDevices
143};
144
145} // namespace ns3
146
147#endif /* FD_NET_DEVICE_HELPER_H */
Base class providing common user-level ascii trace operations for helpers representing net devices.
Definition: trace-helper.h:729
Hold a value for an Attribute.
Definition: attribute.h:70
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.
Definition: trace-helper.h:624
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.