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 "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 
39 {
40  public:
45 
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 
129 
140 
151  NetDeviceContainer Install(const NodeContainer& c) const;
152 
164 
165  private:
176 
182 };
183 
184 /***************************************************************
185  * Implementation of the templates declared above.
186  ***************************************************************/
187 
188 template <typename... Ts>
189 void
191 {
193 
195  m_queueFactory.Set(std::forward<Ts>(args)...);
196 }
197 
198 template <typename... Ts>
199 void
201 {
203  m_channelFactory.Set(std::forward<Ts>(args)...);
204 }
205 
206 } // namespace ns3
207 
208 #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:88