|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
20 #ifndef NET_DEVICE_QUEUE_INTERFACE_H
21 #define NET_DEVICE_QUEUE_INTERFACE_H
25 #include "ns3/callback.h"
26 #include "ns3/object.h"
29 #include "ns3/net-device.h"
30 #include "ns3/object-factory.h"
35 class NetDeviceQueueInterface;
72 virtual void Start (
void);
78 virtual void Stop (
void);
85 virtual void Wake (
void);
162 template <
typename QueueType>
177 template <
typename QueueType>
192 template <
typename QueueType>
203 template <
typename QueueType>
323 template <
typename QueueType>
329 queue->TraceConnectWithoutContext (
"Enqueue",
330 MakeCallback (&NetDeviceQueue::PacketEnqueued<QueueType>,
this)
332 queue->TraceConnectWithoutContext (
"Dequeue",
333 MakeCallback (&NetDeviceQueue::PacketDequeued<QueueType>,
this)
335 queue->TraceConnectWithoutContext (
"DropBeforeEnqueue",
336 MakeCallback (&NetDeviceQueue::PacketDiscarded<QueueType>,
this)
340 template <
typename QueueType>
355 if (queue->GetCurrentSize () + p > queue->GetMaxSize ())
357 NS_LOG_DEBUG (
"The device queue is being stopped (" << queue->GetCurrentSize ()
363 template <
typename QueueType>
379 if (queue->GetCurrentSize () + p <= queue->GetMaxSize ())
385 template <
typename QueueType>
396 NS_LOG_ERROR (
"BUG! No room in the device queue for the received packet! ("
397 << queue->GetCurrentSize () <<
" inside)");
a unique identifier for an interface.
void PacketDiscarded(QueueType *queue, Ptr< const typename QueueType::ItemType > item)
Perform the actions required by flow control and dynamic queue limits when a packet is dropped before...
virtual void NotifyNewAggregate(void)
Notify that an object was aggregated.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
ObjectFactory m_txQueues
Device transmission queues TypeId.
Ptr< NetDeviceQueue > GetTxQueue(std::size_t i) const
Get the i-th transmission queue of the device.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WakeCallback m_wakeCallback
Wake callback.
void SetQueueLimits(Ptr< QueueLimits > ql)
Set queue limits to this queue.
virtual void Wake(void)
Called by the device to wake the queue disc associated with this device transmission queue.
void SetTxQueuesType(TypeId type)
Set the type of device transmission queues to create.
SelectQueueCallback GetSelectQueueCallback(void) const
Get the select queue callback.
NS_LOG_TEMPLATE_DECLARE
redefinition of the log component
virtual uint16_t GetMtu(void) const =0
Ptr< QueueLimits > m_queueLimits
Queue limits object.
U * PeekPointer(const Ptr< U > &p)
Callback< void > WakeCallback
Callback invoked by netdevices to wake upper layers.
virtual ~NetDeviceQueueInterface()
Smart pointer class similar to boost::intrusive_ptr.
virtual void DoDispose(void)
Dispose of the object.
NetDeviceQueueInterface()
Constructor.
static TypeId GetTypeId(void)
Get the type ID.
A base class which provides memory management and object aggregation.
virtual bool IsStopped(void) const
Get the status of the device transmission queue.
void PacketEnqueued(QueueType *queue, Ptr< const typename QueueType::ItemType > item)
Perform the actions required by flow control and dynamic queue limits when a packet is enqueued in th...
Ptr< NetDevice > m_device
the netdevice aggregated to the NetDeviceQueueInterface
void SetNTxQueues(std::size_t numTxQueues)
Set the number of device transmission queues to create.
Network device transmission queue.
void ConnectQueueTraces(Ptr< QueueType > queue)
Connect the traced callbacks of a queue to the methods providing support for flow control and dynamic...
bool m_stoppedByQueueLimits
True if the queue has been stopped by a queue limits object.
Instantiate subclasses of ns3::Object.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
void PacketDequeued(QueueType *queue, Ptr< const typename QueueType::ItemType > item)
Perform the actions required by flow control and dynamic queue limits when a packet is dequeued (or d...
void SetSelectQueueCallback(SelectQueueCallback cb)
Set the select queue callback.
virtual ~NetDeviceQueue()
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
virtual void Stop(void)
Called by the device to stop this device transmission queue.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Network device transmission queue interface.
bool m_stoppedByDevice
True if the queue has been stopped by the device.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
std::vector< Ptr< NetDeviceQueue > > m_txQueuesVector
Device transmission queues.
SelectQueueCallback m_selectQueueCallback
Select queue callback.
virtual void NotifyQueuedBytes(uint32_t bytes)
Called by the netdevice to report the number of bytes queued to the device queue.
virtual void SetWakeCallback(WakeCallback cb)
Set the wake callback.
std::function< std::size_t(Ptr< QueueItem >)> SelectQueueCallback
Callback invoked to determine the tx queue selected for a given packet.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
void NotifyAggregatedObject(Ptr< NetDeviceQueueInterface > ndqi)
Notify this NetDeviceQueue that the NetDeviceQueueInterface was aggregated to an object.
Ptr< QueueLimits > GetQueueLimits()
Get queue limits to this queue.
virtual void Start(void)
Called by the device to start this device transmission queue.
virtual void NotifyTransmittedBytes(uint32_t bytes)
Called by the netdevice to report the number of bytes it is going to transmit.
std::size_t GetNTxQueues(void) const
Get the number of device transmission queues.
void ResetQueueLimits()
Reset queue limits state.
static TypeId GetTypeId(void)
Get the type ID.