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. More... | |
typedef std::vector< uint16_t > | HandleList |
Container type for Handlers. More... | |
Public Member Functions | |
TrafficControlHelper () | |
Create a TrafficControlHelper to make life easier when creating QueueDisc objects. More... | |
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). More... | |
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). More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
HandleList | DoAddChildQueueDiscs (uint16_t handle, const ClassIdList &classes, ObjectFactory factory) |
Actual implementation of the AddChildQueueDiscs method. More... | |
void | DoAddInternalQueues (uint16_t handle, uint16_t count, ObjectFactory factory) |
Actual implementation of the AddInternalQueues method. More... | |
void | DoAddPacketFilter (uint16_t handle, ObjectFactory factory) |
Actual implementation of the AddPacketFilter method. More... | |
ClassIdList | DoAddQueueDiscClasses (uint16_t handle, uint16_t count, ObjectFactory factory) |
Actual implementation of the AddQueueDiscClasses method. More... | |
uint16_t | DoSetRootQueueDisc (ObjectFactory factory) |
Actual implementation of the SetRootQueueDisc method. More... | |
Private Attributes | |
std::vector< QueueDiscFactory > | m_queueDiscFactory |
QueueDisc factory, stores the configuration of all the queue discs. More... | |
std::vector< Ptr< QueueDisc > > | m_queueDiscs |
Vector of all the created queue discs. More... | |
ObjectFactory | m_queueLimitsFactory |
Factory to create a queue limits object. More... | |
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 115 of file traffic-control-helper.h.
typedef std::vector<uint16_t> ns3::TrafficControlHelper::ClassIdList |
Container type for Class IDs.
Definition at line 176 of file traffic-control-helper.h.
typedef std::vector<uint16_t> ns3::TrafficControlHelper::HandleList |
Container type for Handlers.
Definition at line 210 of file traffic-control-helper.h.
ns3::TrafficControlHelper::TrafficControlHelper | ( | ) |
Create a TrafficControlHelper to make life easier when creating QueueDisc objects.
Definition at line 105 of file traffic-control-helper.cc.
|
inlinevirtual |
Definition at line 123 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 401 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 409 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 377 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 386 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 393 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 110 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(), 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 177 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 190 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 139 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 151 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 160 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 130 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 248 of file traffic-control-helper.cc.
References ns3::QueueDiscContainer::Add(), ns3::NetDeviceContainer::Begin(), and ns3::NetDeviceContainer::End().
Referenced by ns3::Ipv4AddressHelper::Assign(), ns3::Ipv6AddressHelper::Assign(), UdpSocketImplTest::DoRun(), Ns3TcpStateTestCase::DoRun(), WifiAcMappingTest::DoRun(), TcFlowControlTestCase::DoRun(), experiment(), 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 203 of file traffic-control-helper.cc.
References ns3::QueueDiscContainer::Add(), ns3::ObjectFactory::Create(), ns3::NetDevice::GetNode(), ns3::Object::GetObject(), 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 417 of file traffic-control-helper.h.
References m_queueLimitsFactory, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().
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 370 of file traffic-control-helper.h.
References DoSetRootQueueDisc().
Referenced by Default(), 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 279 of file traffic-control-helper.cc.
References ns3::NetDeviceContainer::Begin(), and ns3::NetDeviceContainer::End().
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 261 of file traffic-control-helper.cc.
References ns3::NetDevice::GetNode(), ns3::Object::GetObject(), and NS_ASSERT.
|
private |
QueueDisc factory, stores the configuration of all the queue discs.
Definition at line 352 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 354 of file traffic-control-helper.h.
Referenced by Install().
|
private |
Factory to create a queue limits object.
Definition at line 356 of file traffic-control-helper.h.
Referenced by Install(), and SetQueueLimits().