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
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
33
namespace
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
*/
45
class
FdNetDeviceHelper
:
public
PcapHelperForDevice
,
public
AsciiTraceHelperForDevice
46
{
47
public
:
48
/**
49
* Construct a FdNetDeviceHelper.
50
*/
51
FdNetDeviceHelper
();
52
53
~FdNetDeviceHelper
()
override
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,
122
Ptr<NetDevice>
nd,
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
*/
137
void
EnableAsciiInternal
(
Ptr<OutputStreamWrapper>
stream,
138
std::string prefix,
139
Ptr<NetDevice>
nd,
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 */
ns3::AsciiTraceHelperForDevice
Base class providing common user-level ascii trace operations for helpers representing net devices.
Definition:
trace-helper.h:729
ns3::AttributeValue
Hold a value for an Attribute.
Definition:
attribute.h:70
ns3::FdNetDeviceHelper
build a set of FdNetDevice objects Normally we eschew multiple inheritance, however,...
Definition:
fd-net-device-helper.h:46
ns3::FdNetDeviceHelper::SetAttribute
void SetAttribute(std::string n1, const AttributeValue &v1)
Definition:
fd-net-device-helper.cc:52
ns3::FdNetDeviceHelper::Install
virtual NetDeviceContainer Install(Ptr< Node > node) const
This method creates a FdNetDevice and associates it to a node.
Definition:
fd-net-device-helper.cc:185
ns3::FdNetDeviceHelper::m_deviceFactory
ObjectFactory m_deviceFactory
factory for the NetDevices
Definition:
fd-net-device-helper.h:142
ns3::FdNetDeviceHelper::InstallPriv
virtual Ptr< NetDevice > InstallPriv(Ptr< Node > node) const
This method creates an ns3::FdNetDevice and associates it to a node.
Definition:
fd-net-device-helper.cc:211
ns3::FdNetDeviceHelper::EnablePcapInternal
void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override
Enable pcap output on the indicated net device.
Definition:
fd-net-device-helper.cc:59
ns3::FdNetDeviceHelper::FdNetDeviceHelper
FdNetDeviceHelper()
Construct a FdNetDeviceHelper.
Definition:
fd-net-device-helper.cc:40
ns3::FdNetDeviceHelper::~FdNetDeviceHelper
~FdNetDeviceHelper() override
Definition:
fd-net-device-helper.h:53
ns3::FdNetDeviceHelper::SetTypeId
void SetTypeId(std::string type)
Set the TypeId of the Objects to be created by this helper.
Definition:
fd-net-device-helper.cc:46
ns3::FdNetDeviceHelper::EnableAsciiInternal
void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
Enable ascii trace output on the indicated net device.
Definition:
fd-net-device-helper.cc:102
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition:
net-device-container.h:43
ns3::NodeContainer
keep track of a set of node pointers.
Definition:
node-container.h:40
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition:
object-factory.h:48
ns3::PcapHelperForDevice
Base class providing common user-level pcap operations for helpers representing net devices.
Definition:
trace-helper.h:624
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
fd-net-device
helper
fd-net-device-helper.h
Generated on Tue May 28 2024 23:35:23 for ns-3 by
1.9.6