A Discrete-Event Network Simulator
API
traffic-control-helper.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2015 Universita' degli Studi di Napoli Federico II
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Stefano Avallone <stavallo@unina.it>
19  */
20 #ifndef TRAFFIC_CONTROL_HELPER_H
21 #define TRAFFIC_CONTROL_HELPER_H
22 
23 #include <string>
24 #include <vector>
25 #include <map>
26 #include "ns3/object-factory.h"
27 #include "ns3/net-device-container.h"
28 #include "ns3/queue-disc-container.h"
29 
30 namespace ns3 {
31 
39 {
40 public:
47 
48  virtual ~QueueDiscFactory () {}
49 
55  void AddInternalQueue (ObjectFactory factory);
56 
62  void AddPacketFilter (ObjectFactory factory);
63 
70  uint16_t AddQueueDiscClass (ObjectFactory factory);
71 
78  void SetChildQueueDisc (uint16_t classId, uint16_t handle);
79 
86  Ptr<QueueDisc> CreateQueueDisc (const std::vector<Ptr<QueueDisc> > & queueDiscs);
87 
88 private:
95 
99  std::vector<ObjectFactory> m_internalQueuesFactory;
101  std::vector<ObjectFactory> m_packetFiltersFactory;
103  std::vector<ObjectFactory> m_queueDiscClassesFactory;
105  std::map<uint16_t, uint16_t> m_classIdChildHandleMap;
106 };
107 
108 
119 {
120 public:
126  virtual ~TrafficControlHelper () {}
127 
134  static TrafficControlHelper Default (void);
135 
174  uint16_t SetRootQueueDisc (std::string type,
175  std::string n01 = "", const AttributeValue &v01 = EmptyAttributeValue (),
176  std::string n02 = "", const AttributeValue &v02 = EmptyAttributeValue (),
177  std::string n03 = "", const AttributeValue &v03 = EmptyAttributeValue (),
178  std::string n04 = "", const AttributeValue &v04 = EmptyAttributeValue (),
179  std::string n05 = "", const AttributeValue &v05 = EmptyAttributeValue (),
180  std::string n06 = "", const AttributeValue &v06 = EmptyAttributeValue (),
181  std::string n07 = "", const AttributeValue &v07 = EmptyAttributeValue (),
182  std::string n08 = "", const AttributeValue &v08 = EmptyAttributeValue (),
183  std::string n09 = "", const AttributeValue &v09 = EmptyAttributeValue (),
184  std::string n10 = "", const AttributeValue &v10 = EmptyAttributeValue (),
185  std::string n11 = "", const AttributeValue &v11 = EmptyAttributeValue (),
186  std::string n12 = "", const AttributeValue &v12 = EmptyAttributeValue (),
187  std::string n13 = "", const AttributeValue &v13 = EmptyAttributeValue (),
188  std::string n14 = "", const AttributeValue &v14 = EmptyAttributeValue (),
189  std::string n15 = "", const AttributeValue &v15 = EmptyAttributeValue ());
190 
215  void AddInternalQueues (uint16_t handle, uint16_t count, std::string type,
216  std::string n01 = "", const AttributeValue &v01 = EmptyAttributeValue (),
217  std::string n02 = "", const AttributeValue &v02 = EmptyAttributeValue (),
218  std::string n03 = "", const AttributeValue &v03 = EmptyAttributeValue (),
219  std::string n04 = "", const AttributeValue &v04 = EmptyAttributeValue (),
220  std::string n05 = "", const AttributeValue &v05 = EmptyAttributeValue (),
221  std::string n06 = "", const AttributeValue &v06 = EmptyAttributeValue (),
222  std::string n07 = "", const AttributeValue &v07 = EmptyAttributeValue (),
223  std::string n08 = "", const AttributeValue &v08 = EmptyAttributeValue ());
224 
248  void AddPacketFilter (uint16_t handle, std::string type,
249  std::string n01 = "", const AttributeValue &v01 = EmptyAttributeValue (),
250  std::string n02 = "", const AttributeValue &v02 = EmptyAttributeValue (),
251  std::string n03 = "", const AttributeValue &v03 = EmptyAttributeValue (),
252  std::string n04 = "", const AttributeValue &v04 = EmptyAttributeValue (),
253  std::string n05 = "", const AttributeValue &v05 = EmptyAttributeValue (),
254  std::string n06 = "", const AttributeValue &v06 = EmptyAttributeValue (),
255  std::string n07 = "", const AttributeValue &v07 = EmptyAttributeValue (),
256  std::string n08 = "", const AttributeValue &v08 = EmptyAttributeValue ());
257 
261  typedef std::vector<uint16_t> ClassIdList;
262 
288  ClassIdList AddQueueDiscClasses (uint16_t handle, uint16_t count, std::string type,
289  std::string n01 = "", const AttributeValue &v01 = EmptyAttributeValue (),
290  std::string n02 = "", const AttributeValue &v02 = EmptyAttributeValue (),
291  std::string n03 = "", const AttributeValue &v03 = EmptyAttributeValue (),
292  std::string n04 = "", const AttributeValue &v04 = EmptyAttributeValue (),
293  std::string n05 = "", const AttributeValue &v05 = EmptyAttributeValue (),
294  std::string n06 = "", const AttributeValue &v06 = EmptyAttributeValue (),
295  std::string n07 = "", const AttributeValue &v07 = EmptyAttributeValue (),
296  std::string n08 = "", const AttributeValue &v08 = EmptyAttributeValue ());
297 
338  uint16_t AddChildQueueDisc (uint16_t handle, uint16_t classId, std::string type,
339  std::string n01 = "", const AttributeValue &v01 = EmptyAttributeValue (),
340  std::string n02 = "", const AttributeValue &v02 = EmptyAttributeValue (),
341  std::string n03 = "", const AttributeValue &v03 = EmptyAttributeValue (),
342  std::string n04 = "", const AttributeValue &v04 = EmptyAttributeValue (),
343  std::string n05 = "", const AttributeValue &v05 = EmptyAttributeValue (),
344  std::string n06 = "", const AttributeValue &v06 = EmptyAttributeValue (),
345  std::string n07 = "", const AttributeValue &v07 = EmptyAttributeValue (),
346  std::string n08 = "", const AttributeValue &v08 = EmptyAttributeValue (),
347  std::string n09 = "", const AttributeValue &v09 = EmptyAttributeValue (),
348  std::string n10 = "", const AttributeValue &v10 = EmptyAttributeValue (),
349  std::string n11 = "", const AttributeValue &v11 = EmptyAttributeValue (),
350  std::string n12 = "", const AttributeValue &v12 = EmptyAttributeValue (),
351  std::string n13 = "", const AttributeValue &v13 = EmptyAttributeValue (),
352  std::string n14 = "", const AttributeValue &v14 = EmptyAttributeValue (),
353  std::string n15 = "", const AttributeValue &v15 = EmptyAttributeValue ());
354 
358  typedef std::vector<uint16_t> HandleList;
359 
400  HandleList AddChildQueueDiscs (uint16_t handle, const ClassIdList &classes, std::string type,
401  std::string n01 = "", const AttributeValue &v01 = EmptyAttributeValue (),
402  std::string n02 = "", const AttributeValue &v02 = EmptyAttributeValue (),
403  std::string n03 = "", const AttributeValue &v03 = EmptyAttributeValue (),
404  std::string n04 = "", const AttributeValue &v04 = EmptyAttributeValue (),
405  std::string n05 = "", const AttributeValue &v05 = EmptyAttributeValue (),
406  std::string n06 = "", const AttributeValue &v06 = EmptyAttributeValue (),
407  std::string n07 = "", const AttributeValue &v07 = EmptyAttributeValue (),
408  std::string n08 = "", const AttributeValue &v08 = EmptyAttributeValue (),
409  std::string n09 = "", const AttributeValue &v09 = EmptyAttributeValue (),
410  std::string n10 = "", const AttributeValue &v10 = EmptyAttributeValue (),
411  std::string n11 = "", const AttributeValue &v11 = EmptyAttributeValue (),
412  std::string n12 = "", const AttributeValue &v12 = EmptyAttributeValue (),
413  std::string n13 = "", const AttributeValue &v13 = EmptyAttributeValue (),
414  std::string n14 = "", const AttributeValue &v14 = EmptyAttributeValue (),
415  std::string n15 = "", const AttributeValue &v15 = EmptyAttributeValue ());
416 
439  void SetQueueLimits (std::string type,
440  std::string n01 = "", const AttributeValue &v01 = EmptyAttributeValue (),
441  std::string n02 = "", const AttributeValue &v02 = EmptyAttributeValue (),
442  std::string n03 = "", const AttributeValue &v03 = EmptyAttributeValue (),
443  std::string n04 = "", const AttributeValue &v04 = EmptyAttributeValue (),
444  std::string n05 = "", const AttributeValue &v05 = EmptyAttributeValue (),
445  std::string n06 = "", const AttributeValue &v06 = EmptyAttributeValue (),
446  std::string n07 = "", const AttributeValue &v07 = EmptyAttributeValue (),
447  std::string n08 = "", const AttributeValue &v08 = EmptyAttributeValue ());
448 
465 
476 
483  void Uninstall (NetDeviceContainer c);
484 
491  void Uninstall (Ptr<NetDevice> d);
492 
493 private:
495  std::vector<QueueDiscFactory> m_queueDiscFactory;
497  std::vector<Ptr<QueueDisc> > m_queueDiscs;
500 };
501 
502 } // namespace ns3
503 
504 #endif /* TRAFFIC_CONTROL_HELPER_H */
QueueDiscContainer Install(NetDeviceContainer c)
QueueDiscFactory()
Default constructor.
Hold a value for an Attribute.
Definition: attribute.h:68
std::vector< ObjectFactory > m_queueDiscClassesFactory
Vector of factories to create queue disc classes.
std::vector< Ptr< QueueDisc > > m_queueDiscs
Vector of all the created queue discs.
void Uninstall(NetDeviceContainer c)
ClassIdList AddQueueDiscClasses(uint16_t handle, uint16_t count, std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue())
Helper function used to add the given number of queue disc classes (of the given type and with the gi...
void AddPacketFilter(uint16_t handle, std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue())
Helper function used to add a packet filter (of the given type and with the given attributes) to the ...
void SetChildQueueDisc(uint16_t classId, uint16_t handle)
Set the (child) queue disc to attach to a class.
Holds a vector of ns3::QueueDisc pointers.
ObjectFactory m_queueDiscFactory
Factory to create this queue disc.
TrafficControlHelper()
Create a TrafficControlHelper to make life easier when creating QueueDisc objects.
A class for an empty attribute value.
Definition: attribute.h:232
holds a vector of ns3::NetDevice pointers
Build a set of QueueDisc objects.
void SetQueueLimits(std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue())
Helper function used to add a queue limits object to the transmission queues of the devices...
Ptr< QueueDisc > CreateQueueDisc(const std::vector< Ptr< QueueDisc > > &queueDiscs)
Create a queue disc with the currently stored configuration.
HandleList AddChildQueueDiscs(uint16_t handle, const ClassIdList &classes, std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue(), std::string n09="", const AttributeValue &v09=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue(), std::string n11="", const AttributeValue &v11=EmptyAttributeValue(), std::string n12="", const AttributeValue &v12=EmptyAttributeValue(), std::string n13="", const AttributeValue &v13=EmptyAttributeValue(), std::string n14="", const AttributeValue &v14=EmptyAttributeValue(), std::string n15="", const AttributeValue &v15=EmptyAttributeValue())
Helper function used to attach a child queue disc (of the given type and with the given attributes) t...
uint16_t AddChildQueueDisc(uint16_t handle, uint16_t classId, std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue(), std::string n09="", const AttributeValue &v09=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue(), std::string n11="", const AttributeValue &v11=EmptyAttributeValue(), std::string n12="", const AttributeValue &v12=EmptyAttributeValue(), std::string n13="", const AttributeValue &v13=EmptyAttributeValue(), std::string n14="", const AttributeValue &v14=EmptyAttributeValue(), std::string n15="", const AttributeValue &v15=EmptyAttributeValue())
Helper function used to attach a child queue disc (of the given type and with the given attributes) t...
std::vector< uint16_t > ClassIdList
Container type for Class IDs.
uint16_t AddQueueDiscClass(ObjectFactory factory)
Add a factory to create a queue disc class.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint16_t SetRootQueueDisc(std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue(), std::string n09="", const AttributeValue &v09=EmptyAttributeValue(), std::string n10="", const AttributeValue &v10=EmptyAttributeValue(), std::string n11="", const AttributeValue &v11=EmptyAttributeValue(), std::string n12="", const AttributeValue &v12=EmptyAttributeValue(), std::string n13="", const AttributeValue &v13=EmptyAttributeValue(), std::string n14="", const AttributeValue &v14=EmptyAttributeValue(), std::string n15="", const AttributeValue &v15=EmptyAttributeValue())
Helper function used to set a root queue disc of the given type and with the given attributes...
std::vector< ObjectFactory > m_internalQueuesFactory
Vector of factories to create internal queues.
void AddInternalQueue(ObjectFactory factory)
Add a factory to create an internal queue.
ObjectFactory m_queueLimitsFactory
Factory to create a queue limits object.
void AddPacketFilter(ObjectFactory factory)
Add a factory to create a packet filter.
Instantiate subclasses of ns3::Object.
std::vector< ObjectFactory > m_packetFiltersFactory
Vector of factories to create packet filters.
std::vector< QueueDiscFactory > m_queueDiscFactory
QueueDisc factory, stores the configuration of all the queue discs.
void AddInternalQueues(uint16_t handle, uint16_t count, std::string type, std::string n01="", const AttributeValue &v01=EmptyAttributeValue(), std::string n02="", const AttributeValue &v02=EmptyAttributeValue(), std::string n03="", const AttributeValue &v03=EmptyAttributeValue(), std::string n04="", const AttributeValue &v04=EmptyAttributeValue(), std::string n05="", const AttributeValue &v05=EmptyAttributeValue(), std::string n06="", const AttributeValue &v06=EmptyAttributeValue(), std::string n07="", const AttributeValue &v07=EmptyAttributeValue(), std::string n08="", const AttributeValue &v08=EmptyAttributeValue())
Helper function used to add the given number of internal queues (of the given type and with the given...
std::map< uint16_t, uint16_t > m_classIdChildHandleMap
Map storing the associations between class IDs and child queue disc handles.
This class stores object factories required to create a queue disc and all of its components (packet ...
static TrafficControlHelper Default(void)
std::vector< uint16_t > HandleList
Container type for Handlers.