A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::TrafficControlHelper Class Reference

Build a set of QueueDisc objects. More...

#include "traffic-control-helper.h"

+ Collaboration diagram for ns3::TrafficControlHelper:

Public Types

typedef std::vector< uint16_t > ClassIdList
 Container type for Class IDs.
 
typedef std::vector< uint16_t > HandleList
 Container type for Handlers.
 

Public Member Functions

 TrafficControlHelper ()
 Create a TrafficControlHelper to make life easier when creating QueueDisc objects.
 
virtual ~TrafficControlHelper ()
 
template<typename... Args>
uint16_t AddChildQueueDisc (uint16_t handle, uint16_t classId, const std::string &type, Args &&... args)
 Helper function used to attach a child queue disc (of the given type and with the given attributes) to a given class (included in the queue disc having the given handle).
 
template<typename... Args>
HandleList AddChildQueueDiscs (uint16_t handle, const ClassIdList &classes, const std::string &type, Args &&... args)
 Helper function used to attach a child queue disc (of the given type and with the given attributes) to each of the given classes (included in the queue disc having the given handle).
 
template<typename... Args>
void AddInternalQueues (uint16_t handle, uint16_t count, std::string type, Args &&... args)
 Helper function used to add the given number of internal queues (of the given type and with the given attributes) to the queue disc having the given handle.
 
template<typename... Args>
void AddPacketFilter (uint16_t handle, const std::string &type, Args &&... args)
 Helper function used to add a packet filter (of the given type and with the given attributes) to the queue disc having the given handle.
 
template<typename... Args>
ClassIdList AddQueueDiscClasses (uint16_t handle, uint16_t count, const std::string &type, Args &&... args)
 Helper function used to add the given number of queue disc classes (of the given type and with the given attributes) to the queue disc having the given handle.
 
QueueDiscContainer Install (NetDeviceContainer c)
 
QueueDiscContainer Install (Ptr< NetDevice > d)
 
template<typename... Args>
void SetQueueLimits (std::string type, Args &&... args)
 Helper function used to add a queue limits object to the transmission queues of the devices.
 
template<typename... Args>
uint16_t SetRootQueueDisc (const std::string &type, Args &&... args)
 Helper function used to set a root queue disc of the given type and with the given attributes.
 
void Uninstall (NetDeviceContainer c)
 
void Uninstall (Ptr< NetDevice > d)
 

Static Public Member Functions

static TrafficControlHelper Default (std::size_t nTxQueues=1)
 

Private Member Functions

uint16_t DoAddChildQueueDisc (uint16_t handle, uint16_t classId, ObjectFactory factory)
 Actual implementation of the AddChildQueueDisc method.
 
HandleList DoAddChildQueueDiscs (uint16_t handle, const ClassIdList &classes, ObjectFactory factory)
 Actual implementation of the AddChildQueueDiscs method.
 
void DoAddInternalQueues (uint16_t handle, uint16_t count, ObjectFactory factory)
 Actual implementation of the AddInternalQueues method.
 
void DoAddPacketFilter (uint16_t handle, ObjectFactory factory)
 Actual implementation of the AddPacketFilter method.
 
ClassIdList DoAddQueueDiscClasses (uint16_t handle, uint16_t count, ObjectFactory factory)
 Actual implementation of the AddQueueDiscClasses method.
 
uint16_t DoSetRootQueueDisc (ObjectFactory factory)
 Actual implementation of the SetRootQueueDisc method.
 

Private Attributes

std::vector< QueueDiscFactorym_queueDiscFactory
 QueueDisc factory, stores the configuration of all the queue discs.
 
std::vector< Ptr< QueueDisc > > m_queueDiscs
 Vector of all the created queue discs.
 
ObjectFactory m_queueLimitsFactory
 Factory to create a queue limits object.
 

Detailed Description

Build a set of QueueDisc objects.

This class can help to create QueueDisc objects and map them to the corresponding devices. This map is stored at the Traffic Control layer.

Definition at line 107 of file traffic-control-helper.h.

Member Typedef Documentation

◆ ClassIdList

typedef std::vector<uint16_t> ns3::TrafficControlHelper::ClassIdList

Container type for Class IDs.

Definition at line 171 of file traffic-control-helper.h.

◆ HandleList

typedef std::vector<uint16_t> ns3::TrafficControlHelper::HandleList

Container type for Handlers.

Definition at line 211 of file traffic-control-helper.h.

Constructor & Destructor Documentation

◆ TrafficControlHelper()

ns3::TrafficControlHelper::TrafficControlHelper ( )

Create a TrafficControlHelper to make life easier when creating QueueDisc objects.

Definition at line 92 of file traffic-control-helper.cc.

◆ ~TrafficControlHelper()

virtual ns3::TrafficControlHelper::~TrafficControlHelper ( )
inlinevirtual

Definition at line 116 of file traffic-control-helper.h.

Member Function Documentation

◆ AddChildQueueDisc()

template<typename... Args>
uint16_t ns3::TrafficControlHelper::AddChildQueueDisc ( uint16_t handle,
uint16_t classId,
const std::string & type,
Args &&... args )

Helper function used to attach a child queue disc (of the given type and with the given attributes) to a given class (included in the queue disc having the given handle).

Template Parameters
Args[deduced] Template type parameter pack for the sequence of name-value pairs.
Parameters
handlethe handle of the parent queue disc
classIdthe class ID of the class to attach the queue disc to
typethe type of queue disc
argsA sequence of name-value pairs of the attributes to set.
Returns
the handle of the created child queue disc

Definition at line 410 of file traffic-control-helper.h.

References DoAddChildQueueDisc().

+ Here is the call graph for this function:

◆ AddChildQueueDiscs()

template<typename... Args>
TrafficControlHelper::HandleList ns3::TrafficControlHelper::AddChildQueueDiscs ( uint16_t handle,
const ClassIdList & classes,
const std::string & type,
Args &&... args )

Helper function used to attach a child queue disc (of the given type and with the given attributes) to each of the given classes (included in the queue disc having the given handle).

Template Parameters
Args[deduced] Template type parameter pack for the sequence of name-value pairs.
Parameters
handlethe handle of the parent queue disc
classesthe class IDs of the classes to attach a queue disc to
typethe type of queue disc
argsA sequence of name-value pairs of the attributes to set.
Returns
the list of handles of the created child queue discs

Definition at line 420 of file traffic-control-helper.h.

References DoAddChildQueueDiscs().

Referenced by Default(), and WifiAcMappingTest::DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddInternalQueues()

template<typename... Args>
void ns3::TrafficControlHelper::AddInternalQueues ( uint16_t handle,
uint16_t count,
std::string type,
Args &&... args )

Helper function used to add the given number of internal queues (of the given type and with the given attributes) to the queue disc having the given handle.

Template Parameters
Args[deduced] Template type parameter pack for the sequence of name-value pairs.
Parameters
handlethe handle of the parent queue disc
countthe number of queues to add
typethe type of queue
argsA sequence of name-value pairs of the attributes to set.

Definition at line 382 of file traffic-control-helper.h.

References ns3::QueueBase::AppendItemTypeIfNotPresent(), and DoAddInternalQueues().

Referenced by experiment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddPacketFilter()

template<typename... Args>
void ns3::TrafficControlHelper::AddPacketFilter ( uint16_t handle,
const std::string & type,
Args &&... args )

Helper function used to add a packet filter (of the given type and with the given attributes) to the queue disc having the given handle.

Template Parameters
Args[deduced] Template type parameter pack for the sequence of name-value pairs.
Parameters
handlethe handle of the parent queue disc
typethe type of packet filter
argsA sequence of name-value pairs of the attributes to set.

Definition at line 393 of file traffic-control-helper.h.

References DoAddPacketFilter().

+ Here is the call graph for this function:

◆ AddQueueDiscClasses()

template<typename... Args>
TrafficControlHelper::ClassIdList ns3::TrafficControlHelper::AddQueueDiscClasses ( uint16_t handle,
uint16_t count,
const std::string & type,
Args &&... args )

Helper function used to add the given number of queue disc classes (of the given type and with the given attributes) to the queue disc having the given handle.

Template Parameters
Args[deduced] Template type parameter pack for the sequence of name-value pairs.
Parameters
handlethe handle of the parent queue disc
countthe number of queue disc classes to add
typethe type of queue disc class
argsA sequence of name-value pairs of the attributes to set.
Returns
the list of class IDs

Definition at line 400 of file traffic-control-helper.h.

References DoAddQueueDiscClasses().

Referenced by Default(), and WifiAcMappingTest::DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Default()

TrafficControlHelper ns3::TrafficControlHelper::Default ( std::size_t nTxQueues = 1)
static
Parameters
nTxQueuesthe number of Tx queue disc classes
Returns
a new TrafficControlHelper with a default configuration

The default configuration is an FqCoDelQueueDisc, if the device has a single queue, or an MqQueueDisc with as many FqCoDelQueueDiscs as the number of device queues, otherwise.

Definition at line 97 of file traffic-control-helper.cc.

References AddChildQueueDiscs(), AddQueueDiscClasses(), NS_ABORT_MSG_IF, NS_LOG_FUNCTION, and SetRootQueueDisc().

Referenced by ns3::Ipv4AddressHelper::Assign(), ns3::Ipv6AddressHelper::Assign(), TcFlowControlTestCase::DoRun(), UdpSocketImplTest::DoRun(), ns3::DhcpHelper::InstallDhcpClientPriv(), ns3::DhcpHelper::InstallDhcpServer(), and ns3::DhcpHelper::InstallFixedAddress().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoAddChildQueueDisc()

uint16_t ns3::TrafficControlHelper::DoAddChildQueueDisc ( uint16_t handle,
uint16_t classId,
ObjectFactory factory )
private

Actual implementation of the AddChildQueueDisc method.

Parameters
handlethe handle of the parent queue disc
classIdthe class ID of the class to attach the queue disc to
factorythe factory used to add a child queue disc
Returns
the handle of the created child queue disc

Definition at line 165 of file traffic-control-helper.cc.

References m_queueDiscFactory, and NS_ABORT_MSG_IF.

Referenced by AddChildQueueDisc(), and DoAddChildQueueDiscs().

+ Here is the caller graph for this function:

◆ DoAddChildQueueDiscs()

TrafficControlHelper::HandleList ns3::TrafficControlHelper::DoAddChildQueueDiscs ( uint16_t handle,
const ClassIdList & classes,
ObjectFactory factory )
private

Actual implementation of the AddChildQueueDiscs method.

Parameters
handlethe handle of the parent queue disc
classesthe class IDs of the classes to attach a queue disc to
factorythe factory used to add child queue discs
Returns
the list of handles of the created child queue discs

Definition at line 178 of file traffic-control-helper.cc.

References DoAddChildQueueDisc(), and list.

Referenced by AddChildQueueDiscs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoAddInternalQueues()

void ns3::TrafficControlHelper::DoAddInternalQueues ( uint16_t handle,
uint16_t count,
ObjectFactory factory )
private

Actual implementation of the AddInternalQueues method.

Parameters
handlethe handle of the parent queue disc
countthe number of queues to add
factorythe factory used to add internal queues

Definition at line 127 of file traffic-control-helper.cc.

References m_queueDiscFactory, and NS_ABORT_MSG_IF.

Referenced by AddInternalQueues().

+ Here is the caller graph for this function:

◆ DoAddPacketFilter()

void ns3::TrafficControlHelper::DoAddPacketFilter ( uint16_t handle,
ObjectFactory factory )
private

Actual implementation of the AddPacketFilter method.

Parameters
handlethe handle of the parent queue disc
factorythe factory used to add a packet filter

Definition at line 139 of file traffic-control-helper.cc.

References m_queueDiscFactory, and NS_ABORT_MSG_IF.

Referenced by AddPacketFilter().

+ Here is the caller graph for this function:

◆ DoAddQueueDiscClasses()

TrafficControlHelper::ClassIdList ns3::TrafficControlHelper::DoAddQueueDiscClasses ( uint16_t handle,
uint16_t count,
ObjectFactory factory )
private

Actual implementation of the AddQueueDiscClasses method.

Parameters
handlethe handle of the parent queue disc
countthe number of queue disc classes to add
factorythe factory used to add queue disc classes
Returns
the list of class IDs

Definition at line 148 of file traffic-control-helper.cc.

References list, m_queueDiscFactory, and NS_ABORT_MSG_IF.

Referenced by AddQueueDiscClasses().

+ Here is the caller graph for this function:

◆ DoSetRootQueueDisc()

uint16_t ns3::TrafficControlHelper::DoSetRootQueueDisc ( ObjectFactory factory)
private

Actual implementation of the SetRootQueueDisc method.

Parameters
factorythe factory used to create the root queue disc
Returns
zero on success

Definition at line 117 of file traffic-control-helper.cc.

References m_queueDiscFactory, and NS_ABORT_MSG_UNLESS.

Referenced by SetRootQueueDisc().

+ Here is the caller graph for this function:

◆ Install() [1/2]

QueueDiscContainer ns3::TrafficControlHelper::Install ( NetDeviceContainer c)
Parameters
cset of devices
Returns
a QueueDisc container with the root queue discs installed on the devices

This method creates a QueueDisc object of the type and with the attributes configured by TrafficControlHelper::SetQueueDisc for each device in the container. Then, stores the mapping between a device and the associated queue disc into the traffic control layer of the corresponding node. This method creates the queue discs (along with their packet filters, internal queues, classes) configured with the methods provided by this class and installs them on each device in the given container. Additionally, if configured, a queue limits object is installed on each transmission queue of the devices.

Definition at line 238 of file traffic-control-helper.cc.

References ns3::NetDeviceContainer::Begin(), ns3::NetDeviceContainer::End(), and Install().

Referenced by ns3::Ipv4AddressHelper::Assign(), ns3::Ipv6AddressHelper::Assign(), Ns3TcpCubicTestCase::DoRun(), Ns3TcpStateTestCase::DoRun(), TcFlowControlTestCase::DoRun(), UdpSocketImplTest::DoRun(), WifiAcMappingTest::DoRun(), experiment(), Install(), ns3::DhcpHelper::InstallDhcpClientPriv(), ns3::DhcpHelper::InstallDhcpServer(), and ns3::DhcpHelper::InstallFixedAddress().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Install() [2/2]

QueueDiscContainer ns3::TrafficControlHelper::Install ( Ptr< NetDevice > d)
Parameters
ddevice
Returns
a QueueDisc container with the root queue disc installed on the device

This method creates the queue discs (along with their packet filters, internal queues, classes) configured with the methods provided by this class and installs them on the given device. Additionally, if configured, a queue limits object is installed on each transmission queue of the device.

Definition at line 192 of file traffic-control-helper.cc.

References ns3::ObjectFactory::Create(), ns3::ObjectFactory::GetTypeId(), ns3::TypeId::GetUid(), m_queueDiscFactory, m_queueDiscs, m_queueLimitsFactory, NS_ABORT_MSG_IF, and NS_ASSERT.

+ Here is the call graph for this function:

◆ SetQueueLimits()

template<typename... Args>
void ns3::TrafficControlHelper::SetQueueLimits ( std::string type,
Args &&... args )

Helper function used to add a queue limits object to the transmission queues of the devices.

Template Parameters
Args[deduced] Template type parameter pack for the sequence of name-value pairs.
Parameters
typethe type of queue
argsA sequence of name-value pairs of the attributes to set.

Definition at line 430 of file traffic-control-helper.h.

References m_queueLimitsFactory, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().

Referenced by Ns3TcpCubicTestCase::DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetRootQueueDisc()

template<typename... Args>
uint16_t ns3::TrafficControlHelper::SetRootQueueDisc ( const std::string & type,
Args &&... args )

Helper function used to set a root queue disc of the given type and with the given attributes.

To set the InternalQueueList, PacketFilterList and ChildQueueDiscList attributes, use the AddInternalQueue, AddPacketFilter and AddChildQueueDisc methods.

Template Parameters
Args[deduced] Template type parameter pack for the sequence of name-value pairs.
Parameters
typethe type of queue disc
argsA sequence of name-value pairs of the attributes to set.
Returns
the handle of the root queue disc (zero)

Definition at line 375 of file traffic-control-helper.h.

References DoSetRootQueueDisc().

Referenced by Default(), Ns3TcpCubicTestCase::DoRun(), Ns3TcpStateTestCase::DoRun(), WifiAcMappingTest::DoRun(), and experiment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Uninstall() [1/2]

void ns3::TrafficControlHelper::Uninstall ( NetDeviceContainer c)
Parameters
cset of devices

This method removes the root queue discs (and associated filters, classes and queues) installed on the given devices. Note that the traffic control layer will continue to perform flow control if the device has an aggregated NetDeviceQueueInterface. If you really want that the Traffic Control layer forwards packets down to the NetDevice even if there is no room for them in the NetDevice queue(s), then disable the flow control by using the DisableFlowControl method of the NetDevice helper.

Definition at line 269 of file traffic-control-helper.cc.

References ns3::NetDeviceContainer::Begin(), ns3::NetDeviceContainer::End(), and Uninstall().

Referenced by Uninstall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Uninstall() [2/2]

void ns3::TrafficControlHelper::Uninstall ( Ptr< NetDevice > d)
Parameters
ddevice

This method removes the root queue disc (and associated filters, classes and queues) installed on the given device. Note that the traffic control layer will continue to perform flow control if the device has an aggregated NetDeviceQueueInterface. If you really want that the Traffic Control layer forwards packets down to the NetDevice even if there is no room for them in the NetDevice queue(s), then disable the flow control by using the DisableFlowControl method of the NetDevice helper.

Definition at line 251 of file traffic-control-helper.cc.

References NS_ASSERT.

Member Data Documentation

◆ m_queueDiscFactory

std::vector<QueueDiscFactory> ns3::TrafficControlHelper::m_queueDiscFactory
private

QueueDisc factory, stores the configuration of all the queue discs.

Definition at line 357 of file traffic-control-helper.h.

Referenced by DoAddChildQueueDisc(), DoAddInternalQueues(), DoAddPacketFilter(), DoAddQueueDiscClasses(), DoSetRootQueueDisc(), and Install().

◆ m_queueDiscs

std::vector<Ptr<QueueDisc> > ns3::TrafficControlHelper::m_queueDiscs
private

Vector of all the created queue discs.

Definition at line 359 of file traffic-control-helper.h.

Referenced by Install().

◆ m_queueLimitsFactory

ObjectFactory ns3::TrafficControlHelper::m_queueLimitsFactory
private

Factory to create a queue limits object.

Definition at line 361 of file traffic-control-helper.h.

Referenced by Install(), and SetQueueLimits().


The documentation for this class was generated from the following files: