A Discrete-Event Network Simulator
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 "ns3/attribute.h"
23#include "ns3/net-device-container.h"
24#include "ns3/node-container.h"
25#include "ns3/object-factory.h"
26#include "ns3/queue.h"
27#include "ns3/simple-channel.h"
28
29#include <string>
30
31namespace ns3
32{
33
38{
39 public:
44
46 {
47 }
48
61 template <typename... Ts>
62 void SetQueue(std::string type, Ts&&... args);
63
76 template <typename... Ts>
77 void SetChannel(std::string type, Ts&&... args);
78
86 void SetDeviceAttribute(std::string n1, const AttributeValue& v1);
87
95 void SetChannelAttribute(std::string n1, const AttributeValue& v1);
96
106 void SetNetDevicePointToPointMode(bool pointToPointMode);
107
116 void DisableFlowControl();
117
128
139
151
163
164 private:
175
181};
182
183/***************************************************************
184 * Implementation of the templates declared above.
185 ***************************************************************/
186
187template <typename... Ts>
188void
190{
192
194 m_queueFactory.Set(std::forward<Ts>(args)...);
195}
196
197template <typename... Ts>
198void
200{
202 m_channelFactory.Set(std::forward<Ts>(args)...);
203}
204
205} // namespace ns3
206
207#endif /* SIMPLE_NETDEVICE_HELPER_H */
Hold a value for an Attribute.
Definition: attribute.h:70
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
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
build a set of SimpleNetDevice objects
void SetQueue(std::string type, Ts &&... args)
Each net device must have a queue to pass packets through.
bool m_enableFlowControl
whether to enable flow control
Ptr< NetDevice > InstallPriv(Ptr< Node > node, Ptr< SimpleChannel > channel) const
This method creates an ns3::SimpleNetDevice with the attributes configured by SimpleNetDeviceHelper::...
ObjectFactory m_deviceFactory
NetDevice factory.
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
ObjectFactory m_channelFactory
Channel factory.
ObjectFactory m_queueFactory
Queue factory.
void SetNetDevicePointToPointMode(bool pointToPointMode)
SimpleNetDevice is Broadcast capable and ARP needing.
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
void SetChannel(std::string type, Ts &&... args)
Each net device must have a channel to pass packets through.
SimpleNetDeviceHelper()
Construct a SimpleNetDeviceHelper.
void DisableFlowControl()
Disable flow control only if you know what you are doing.
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
bool m_pointToPointMode
Install PointToPoint SimpleNetDevice or Broadcast ones.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
channel
Definition: third.py:81