Network device transmission queue interface. More...
#include "net-device-queue-interface.h"
Public Types | |
typedef std::function< std::size_t(Ptr< QueueItem >)> | SelectQueueCallback |
Callback invoked to determine the tx queue selected for a given packet. More... | |
Public Member Functions | |
NetDeviceQueueInterface () | |
Constructor. More... | |
~NetDeviceQueueInterface () override | |
std::size_t | GetNTxQueues () const |
Get the number of device transmission queues. More... | |
SelectQueueCallback | GetSelectQueueCallback () const |
Get the select queue callback. More... | |
Ptr< NetDeviceQueue > | GetTxQueue (std::size_t i) const |
Get the i-th transmission queue of the device. More... | |
void | SetNTxQueues (std::size_t numTxQueues) |
Set the number of device transmission queues to create. More... | |
void | SetSelectQueueCallback (SelectQueueCallback cb) |
Set the select queue callback. More... | |
void | SetTxQueuesType (TypeId type) |
Set the type of device transmission queues to create. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. More... | |
~Object () override | |
Destructor. More... | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. More... | |
void | Dispose () |
Dispose of this Object. More... | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. More... | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. More... | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. More... | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. More... | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. More... | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. More... | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. More... | |
bool | IsInitialized () const |
Check if the object has been initialized. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. More... | |
SimpleRefCount (const SimpleRefCount &o[[maybe_unused]]) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o[[maybe_unused]]) |
Assignment operator. More... | |
void | Ref () const |
Increment the reference count. More... | |
void | Unref () const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
Get the value of an attribute, raising fatal errors if unsuccessful. More... | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. More... | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. More... | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. More... | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. More... | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. More... | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. More... | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. More... | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. More... | |
Protected Member Functions | |
void | DoDispose () override |
Dispose of the object. More... | |
void | NotifyNewAggregate () override |
Notify that an object was aggregated. More... | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. More... | |
virtual void | DoInitialize () |
Initialize() implementation. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. More... | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. More... | |
Private Attributes | |
SelectQueueCallback | m_selectQueueCallback |
Select queue callback. More... | |
ObjectFactory | m_txQueues |
Device transmission queues TypeId. More... | |
std::vector< Ptr< NetDeviceQueue > > | m_txQueuesVector |
Device transmission queues. More... | |
Additional Inherited Members | |
Related Functions inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. More... | |
Network device transmission queue interface.
This interface is used by the traffic control layer and by the aggregated device to access the transmission queues of the device. Additionally, through this interface, traffic control aware netdevices can:
Definition at line 230 of file net-device-queue-interface.h.
typedef std::function<std::size_t(Ptr<QueueItem>)> ns3::NetDeviceQueueInterface::SelectQueueCallback |
Callback invoked to determine the tx queue selected for a given packet.
Definition at line 282 of file net-device-queue-interface.h.
ns3::NetDeviceQueueInterface::NetDeviceQueueInterface | ( | ) |
Constructor.
Definition at line 200 of file net-device-queue-interface.cc.
References m_selectQueueCallback, and NS_LOG_FUNCTION.
|
override |
Definition at line 208 of file net-device-queue-interface.cc.
References NS_LOG_FUNCTION.
|
overrideprotectedvirtual |
Dispose of the object.
Reimplemented from ns3::Object.
Definition at line 227 of file net-device-queue-interface.cc.
References ns3::Object::DoDispose(), m_txQueuesVector, and NS_LOG_FUNCTION.
std::size_t ns3::NetDeviceQueueInterface::GetNTxQueues | ( | ) | const |
Get the number of device transmission queues.
Definition at line 221 of file net-device-queue-interface.cc.
References m_txQueuesVector.
Referenced by GetTypeId().
NetDeviceQueueInterface::SelectQueueCallback ns3::NetDeviceQueueInterface::GetSelectQueueCallback | ( | ) | const |
Get the select queue callback.
Called by the traffic control layer to get the select queue callback set by a multi-queue device.
Definition at line 283 of file net-device-queue-interface.cc.
References m_selectQueueCallback.
Ptr< NetDeviceQueue > ns3::NetDeviceQueueInterface::GetTxQueue | ( | std::size_t | i | ) | const |
Get the i-th transmission queue of the device.
i | the index of the requested queue. |
The index of the first transmission queue is zero.
Definition at line 214 of file net-device-queue-interface.cc.
References m_txQueuesVector, and NS_ASSERT.
|
static |
Get the type ID.
Definition at line 177 of file net-device-queue-interface.cc.
References ns3::TypeId::ATTR_CONSTRUCT, ns3::TypeId::ATTR_GET, GetNTxQueues(), ns3::NetDeviceQueue::GetTypeId(), ns3::MakeTypeIdAccessor(), ns3::MakeTypeIdChecker(), ns3::MakeUintegerAccessor(), SetNTxQueues(), ns3::TypeId::SetParent(), and SetTxQueuesType().
|
overrideprotectedvirtual |
Notify that an object was aggregated.
Reimplemented from ns3::Object.
Definition at line 236 of file net-device-queue-interface.cc.
References m_txQueuesVector, ns3::Object::NotifyNewAggregate(), and NS_LOG_FUNCTION.
void ns3::NetDeviceQueueInterface::SetNTxQueues | ( | std::size_t | numTxQueues | ) |
Set the number of device transmission queues to create.
numTxQueues | number of device transmission queues to create. |
This method is called when the NTxQueues attribute is set to create the corresponding number of device transmission queues. It cannot be called again afterwards.
Definition at line 261 of file net-device-queue-interface.cc.
References ns3::ObjectFactory::Create(), ns3::Object::GetObject(), m_txQueues, m_txQueuesVector, NS_ABORT_MSG_IF, NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by GetTypeId().
void ns3::NetDeviceQueueInterface::SetSelectQueueCallback | ( | SelectQueueCallback | cb | ) |
Set the select queue callback.
cb | the callback to set. |
This method is called to set the select queue callback, i.e., the method used to select a device transmission queue for a given packet.
Definition at line 277 of file net-device-queue-interface.cc.
References m_selectQueueCallback.
void ns3::NetDeviceQueueInterface::SetTxQueuesType | ( | TypeId | type | ) |
Set the type of device transmission queues to create.
type | type of device transmission queues to create. |
This method is called when the TxQueuesType attribute is set to create the corresponding type of device transmission queues. It cannot be called again afterwards.
Definition at line 249 of file net-device-queue-interface.cc.
References m_txQueues, m_txQueuesVector, NS_ABORT_MSG_IF, NS_LOG_FUNCTION, ns3::Object::ObjectFactory, ns3::ObjectFactory::SetTypeId(), and check-style-clang-format::type.
Referenced by GetTypeId().
|
private |
Select queue callback.
Definition at line 315 of file net-device-queue-interface.h.
Referenced by NetDeviceQueueInterface(), GetSelectQueueCallback(), and SetSelectQueueCallback().
|
private |
Device transmission queues TypeId.
Definition at line 313 of file net-device-queue-interface.h.
Referenced by SetNTxQueues(), and SetTxQueuesType().
|
private |
Device transmission queues.
Definition at line 314 of file net-device-queue-interface.h.
Referenced by DoDispose(), GetNTxQueues(), GetTxQueue(), NotifyNewAggregate(), SetNTxQueues(), and SetTxQueuesType().