Build a set of QueueDisc objects. More...
#include "traffic-control-helper.h"
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< QueueDiscFactory > | m_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. | |
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.
typedef std::vector<uint16_t> ns3::TrafficControlHelper::ClassIdList |
Container type for Class IDs.
Definition at line 171 of file traffic-control-helper.h.
typedef std::vector<uint16_t> ns3::TrafficControlHelper::HandleList |
Container type for Handlers.
Definition at line 211 of file traffic-control-helper.h.
ns3::TrafficControlHelper::TrafficControlHelper | ( | ) |
Create a TrafficControlHelper to make life easier when creating QueueDisc objects.
Definition at line 92 of file traffic-control-helper.cc.
|
inlinevirtual |
Definition at line 116 of file traffic-control-helper.h.
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).
Args | [deduced] Template type parameter pack for the sequence of name-value pairs. |
handle | the handle of the parent queue disc |
classId | the class ID of the class to attach the queue disc to |
type | the type of queue disc |
args | A sequence of name-value pairs of the attributes to set. |
Definition at line 410 of file traffic-control-helper.h.
References DoAddChildQueueDisc().
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).
Args | [deduced] Template type parameter pack for the sequence of name-value pairs. |
handle | the handle of the parent queue disc |
classes | the class IDs of the classes to attach a queue disc to |
type | the type of queue disc |
args | A sequence of name-value pairs of the attributes to set. |
Definition at line 420 of file traffic-control-helper.h.
References DoAddChildQueueDiscs().
Referenced by Default(), and WifiAcMappingTest::DoRun().
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.
Args | [deduced] Template type parameter pack for the sequence of name-value pairs. |
handle | the handle of the parent queue disc |
count | the number of queues to add |
type | the type of queue |
args | A 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().
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.
Args | [deduced] Template type parameter pack for the sequence of name-value pairs. |
handle | the handle of the parent queue disc |
type | the type of packet filter |
args | A sequence of name-value pairs of the attributes to set. |
Definition at line 393 of file traffic-control-helper.h.
References DoAddPacketFilter().
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.
Args | [deduced] Template type parameter pack for the sequence of name-value pairs. |
handle | the handle of the parent queue disc |
count | the number of queue disc classes to add |
type | the type of queue disc class |
args | A sequence of name-value pairs of the attributes to set. |
Definition at line 400 of file traffic-control-helper.h.
References DoAddQueueDiscClasses().
Referenced by Default(), and WifiAcMappingTest::DoRun().
|
static |
nTxQueues | the number of Tx queue disc classes |
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().
|
private |
Actual implementation of the AddChildQueueDisc method.
handle | the handle of the parent queue disc |
classId | the class ID of the class to attach the queue disc to |
factory | the factory used to add a 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().
|
private |
Actual implementation of the AddChildQueueDiscs method.
handle | the handle of the parent queue disc |
classes | the class IDs of the classes to attach a queue disc to |
factory | the factory used to add child queue discs |
Definition at line 178 of file traffic-control-helper.cc.
References DoAddChildQueueDisc(), and list.
Referenced by AddChildQueueDiscs().
|
private |
Actual implementation of the AddInternalQueues method.
handle | the handle of the parent queue disc |
count | the number of queues to add |
factory | the 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().
|
private |
Actual implementation of the AddPacketFilter method.
handle | the handle of the parent queue disc |
factory | the 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().
|
private |
Actual implementation of the AddQueueDiscClasses method.
handle | the handle of the parent queue disc |
count | the number of queue disc classes to add |
factory | the factory used to add queue disc classes |
Definition at line 148 of file traffic-control-helper.cc.
References list, m_queueDiscFactory, and NS_ABORT_MSG_IF.
Referenced by AddQueueDiscClasses().
|
private |
Actual implementation of the SetRootQueueDisc method.
factory | the factory used to create the root queue disc |
Definition at line 117 of file traffic-control-helper.cc.
References m_queueDiscFactory, and NS_ABORT_MSG_UNLESS.
Referenced by SetRootQueueDisc().
QueueDiscContainer ns3::TrafficControlHelper::Install | ( | NetDeviceContainer | c | ) |
c | set of 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().
QueueDiscContainer ns3::TrafficControlHelper::Install | ( | Ptr< NetDevice > | d | ) |
d | 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.
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.
Args | [deduced] Template type parameter pack for the sequence of name-value pairs. |
type | the type of queue |
args | A 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().
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.
Args | [deduced] Template type parameter pack for the sequence of name-value pairs. |
type | the type of queue disc |
args | A sequence of name-value pairs of the attributes to set. |
Definition at line 375 of file traffic-control-helper.h.
References DoSetRootQueueDisc().
Referenced by Default(), Ns3TcpCubicTestCase::DoRun(), Ns3TcpStateTestCase::DoRun(), WifiAcMappingTest::DoRun(), and experiment().
void ns3::TrafficControlHelper::Uninstall | ( | NetDeviceContainer | c | ) |
c | set 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().
d | device |
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.
|
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().
Vector of all the created queue discs.
Definition at line 359 of file traffic-control-helper.h.
Referenced by Install().
|
private |
Factory to create a queue limits object.
Definition at line 361 of file traffic-control-helper.h.
Referenced by Install(), and SetQueueLimits().