A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
simple-net-device-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2014 Universita' di Firenze
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: Tommaso Pecorella <tommaso.pecorella@unifi.it>
18
*/
19
#ifndef SIMPLE_NETDEVICE_HELPER_H
20
#define SIMPLE_NETDEVICE_HELPER_H
21
22
#include "
net-device-container.h
"
23
#include "
node-container.h
"
24
25
#include "ns3/attribute.h"
26
#include "ns3/object-factory.h"
27
#include "ns3/queue.h"
28
#include "ns3/simple-channel.h"
29
30
#include <string>
31
32
namespace
ns3
33
{
34
38
class
SimpleNetDeviceHelper
39
{
40
public
:
44
SimpleNetDeviceHelper
();
45
46
virtual
~SimpleNetDeviceHelper
()
47
{
48
}
49
62
template
<
typename
... Ts>
63
void
SetQueue
(std::string
type
, Ts&&...
args
);
64
77
template
<
typename
... Ts>
78
void
SetChannel
(std::string
type
, Ts&&...
args
);
79
87
void
SetDeviceAttribute
(std::string n1,
const
AttributeValue
& v1);
88
96
void
SetChannelAttribute
(std::string n1,
const
AttributeValue
& v1);
97
107
void
SetNetDevicePointToPointMode
(
bool
pointToPointMode);
108
117
void
DisableFlowControl
();
118
128
NetDeviceContainer
Install
(
Ptr<Node>
node)
const
;
129
139
NetDeviceContainer
Install
(
Ptr<Node>
node,
Ptr<SimpleChannel>
channel
)
const
;
140
151
NetDeviceContainer
Install
(
const
NodeContainer
& c)
const
;
152
163
NetDeviceContainer
Install
(
const
NodeContainer
& c,
Ptr<SimpleChannel>
channel
)
const
;
164
165
private
:
175
Ptr<NetDevice>
InstallPriv
(
Ptr<Node>
node,
Ptr<SimpleChannel>
channel
)
const
;
176
177
ObjectFactory
m_queueFactory
;
178
ObjectFactory
m_deviceFactory
;
179
ObjectFactory
m_channelFactory
;
180
bool
m_pointToPointMode
;
181
bool
m_enableFlowControl
;
182
};
183
184
/***************************************************************
185
* Implementation of the templates declared above.
186
***************************************************************/
187
188
template
<
typename
... Ts>
189
void
190
SimpleNetDeviceHelper::SetQueue
(std::string
type
, Ts&&...
args
)
191
{
192
QueueBase::AppendItemTypeIfNotPresent
(
type
,
"Packet"
);
193
194
m_queueFactory
.
SetTypeId
(
type
);
195
m_queueFactory
.
Set
(std::forward<Ts>(
args
)...);
196
}
197
198
template
<
typename
... Ts>
199
void
200
SimpleNetDeviceHelper::SetChannel
(std::string
type
, Ts&&...
args
)
201
{
202
m_channelFactory
.
SetTypeId
(
type
);
203
m_channelFactory
.
Set
(std::forward<Ts>(
args
)...);
204
}
205
206
}
// namespace ns3
207
208
#endif
/* SIMPLE_NETDEVICE_HELPER_H */
ns3::AttributeValue
Hold a value for an Attribute.
Definition:
attribute.h:70
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::ObjectFactory::Set
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Definition:
object-factory.h:220
ns3::ObjectFactory::SetTypeId
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Definition:
object-factory.cc:42
ns3::Ptr< Node >
ns3::QueueBase::AppendItemTypeIfNotPresent
static void AppendItemTypeIfNotPresent(std::string &typeId, const std::string &itemType)
Append the item type to the provided type ID if the latter does not end with '>'.
Definition:
queue.cc:73
ns3::SimpleNetDeviceHelper
build a set of SimpleNetDevice objects
Definition:
simple-net-device-helper.h:39
ns3::SimpleNetDeviceHelper::SetQueue
void SetQueue(std::string type, Ts &&... args)
Each net device must have a queue to pass packets through.
Definition:
simple-net-device-helper.h:190
ns3::SimpleNetDeviceHelper::~SimpleNetDeviceHelper
virtual ~SimpleNetDeviceHelper()
Definition:
simple-net-device-helper.h:46
ns3::SimpleNetDeviceHelper::m_enableFlowControl
bool m_enableFlowControl
whether to enable flow control
Definition:
simple-net-device-helper.h:181
ns3::SimpleNetDeviceHelper::InstallPriv
Ptr< NetDevice > InstallPriv(Ptr< Node > node, Ptr< SimpleChannel > channel) const
This method creates an ns3::SimpleNetDevice with the attributes configured by SimpleNetDeviceHelper::...
Definition:
simple-net-device-helper.cc:111
ns3::SimpleNetDeviceHelper::m_deviceFactory
ObjectFactory m_deviceFactory
NetDevice factory.
Definition:
simple-net-device-helper.h:178
ns3::SimpleNetDeviceHelper::SetChannelAttribute
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
Definition:
simple-net-device-helper.cc:59
ns3::SimpleNetDeviceHelper::m_channelFactory
ObjectFactory m_channelFactory
Channel factory.
Definition:
simple-net-device-helper.h:179
ns3::SimpleNetDeviceHelper::m_queueFactory
ObjectFactory m_queueFactory
Queue factory.
Definition:
simple-net-device-helper.h:177
ns3::SimpleNetDeviceHelper::SetNetDevicePointToPointMode
void SetNetDevicePointToPointMode(bool pointToPointMode)
SimpleNetDevice is Broadcast capable and ARP needing.
Definition:
simple-net-device-helper.cc:65
ns3::SimpleNetDeviceHelper::SetDeviceAttribute
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
Definition:
simple-net-device-helper.cc:53
ns3::SimpleNetDeviceHelper::SetChannel
void SetChannel(std::string type, Ts &&... args)
Each net device must have a channel to pass packets through.
Definition:
simple-net-device-helper.h:200
ns3::SimpleNetDeviceHelper::SimpleNetDeviceHelper
SimpleNetDeviceHelper()
Construct a SimpleNetDeviceHelper.
Definition:
simple-net-device-helper.cc:43
ns3::SimpleNetDeviceHelper::DisableFlowControl
void DisableFlowControl()
Disable flow control only if you know what you are doing.
Definition:
simple-net-device-helper.cc:71
ns3::SimpleNetDeviceHelper::Install
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
Definition:
simple-net-device-helper.cc:77
ns3::SimpleNetDeviceHelper::m_pointToPointMode
bool m_pointToPointMode
Install PointToPoint SimpleNetDevice or Broadcast ones.
Definition:
simple-net-device-helper.h:180
check-style-clang-format.args
args
Definition:
check-style-clang-format.py:754
check-style-clang-format.type
type
Definition:
check-style-clang-format.py:704
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
third.channel
channel
Definition:
third.py:88
net-device-container.h
node-container.h
src
network
helper
simple-net-device-helper.h
Generated on Sun Mar 3 2024 17:11:05 for ns-3 by
1.9.1