20 #ifndef NET_DEVICE_QUEUE_INTERFACE_H 
   21 #define NET_DEVICE_QUEUE_INTERFACE_H 
   25 #include "ns3/callback.h" 
   26 #include "ns3/object.h" 
   28 #include "ns3/queue-item.h" 
   29 #include "ns3/queue.h" 
   30 #include "ns3/net-device.h" 
   35 class NetDeviceQueueInterface;
 
   40 extern template class Queue<Packet>;
 
   41 extern template class Queue<QueueDiscItem>;
 
   71   virtual void Start (
void);
 
   77   virtual void Stop (
void);
 
   84   virtual void Wake (
void);
 
   93   bool IsStopped (
void) 
const;
 
  108   virtual void SetWakeCallback (WakeCallback cb);
 
  114   void NotifyQueuedBytes (uint32_t bytes);
 
  120   void NotifyTransmittedBytes (uint32_t bytes);
 
  125   void ResetQueueLimits ();
 
  152   template <
typename Item>
 
  171   template <
typename Item>
 
  190   template <
typename Item>
 
  225   static TypeId GetTypeId (
void);
 
  249   uint8_t GetNTxQueues (
void) 
const;
 
  259   void SetTxQueuesN (uint8_t numTxQueues);
 
  267   void CreateTxQueues (
void);
 
  273   bool GetLateTxQueuesCreation (
void) 
const;
 
  285   void SetLateTxQueuesCreation (
bool value);
 
  298   void SetSelectQueueCallback (SelectQueueCallback cb);
 
  307   SelectQueueCallback GetSelectQueueCallback (
void) 
const;
 
  315   template <
typename Item>
 
  322   virtual void DoDispose (
void);
 
  329   std::map<Ptr<QueueBase>, std::vector<CallbackBase> > 
m_traceMap;   
 
  337 template <
typename Item>
 
  344   m_traceMap.emplace (queue, std::initializer_list<CallbackBase> {
 
  349   queue->TraceConnectWithoutContext (
"Enqueue", 
m_traceMap[queue][0]);
 
  350   queue->TraceConnectWithoutContext (
"Dequeue", 
m_traceMap[queue][1]);
 
  351   queue->TraceConnectWithoutContext (
"DropAfterDequeue", 
m_traceMap[queue][1]);
 
  352   queue->TraceConnectWithoutContext (
"DropBeforeEnqueue", 
m_traceMap[queue][2]);
 
  355 template <
typename Item>
 
  366   ndqi->GetTxQueue (txq)->NotifyQueuedBytes (item->GetSize ());
 
  368   uint16_t mtu = ndqi->GetObject<
NetDevice> ()->GetMtu ();
 
  374        queue->GetNPackets () >= queue->GetMaxPackets ()) ||
 
  376        queue->GetNBytes () + mtu > queue->GetMaxBytes ()))
 
  378       NS_LOG_DEBUG (
"The device queue is being stopped (" << queue->GetNPackets ()
 
  379                     << 
" packets and " << queue->GetNBytes () << 
" bytes inside)");
 
  380       ndqi->GetTxQueue (txq)->Stop ();
 
  384 template <
typename Item>
 
  395   ndqi->GetTxQueue (txq)->NotifyTransmittedBytes (item->GetSize ());
 
  397   uint16_t mtu = ndqi->GetObject<
NetDevice> ()->GetMtu ();
 
  404        queue->GetNPackets () < queue->GetMaxPackets ()) ||
 
  406        queue->GetNBytes () + mtu <= queue->GetMaxBytes ()))
 
  408       ndqi->GetTxQueue (txq)->Wake ();
 
  412 template <
typename Item>
 
  427   NS_LOG_ERROR (
"BUG! No room in the device queue for the received packet! (" 
  428                 << queue->GetNPackets () << 
" packets and " << queue->GetNBytes () << 
" bytes inside)");
 
  430   ndqi->GetTxQueue (txq)->Stop ();
 
Smart pointer class similar to boost::intrusive_ptr. 
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
 
uint8_t GetNTxQueues(void) const 
Get the number of device transmission queues. 
 
std::map< Ptr< QueueBase >, std::vector< CallbackBase > > m_traceMap
Map storing all the connected traces. 
 
bool m_stoppedByDevice
True if the queue has been stopped by the device. 
 
bool m_stoppedByQueueLimits
True if the queue has been stopped by a queue limits object. 
 
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument. 
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
 
WakeCallback m_wakeCallback
Wake callback. 
 
static void PacketDequeued(Ptr< Queue< Item > > queue, Ptr< NetDeviceQueueInterface > ndqi, uint8_t txq, Ptr< const Item > item)
Perform the actions required by flow control and dynamic queue limits when a packet is dequeued (or d...
 
static void PacketEnqueued(Ptr< Queue< Item > > queue, Ptr< NetDeviceQueueInterface > ndqi, uint8_t txq, Ptr< const Item > item)
Perform the actions required by flow control and dynamic queue limits when a packet is enqueued in th...
 
Use number of packets for maximum queue size. 
 
Template class for packet Queues. 
 
Callback< void > WakeCallback
Callback invoked by netdevices to wake upper layers. 
 
Callback< uint8_t, Ptr< QueueItem > > SelectQueueCallback
Callback invoked to determine the tx queue selected for a given packet. 
 
void ConnectQueueTraces(Ptr< Queue< Item > > queue, uint8_t txq)
Connect the traced callbacks of a queue to the static methods of the NetDeviceQueue class to support ...
 
#define NS_LOG_STATIC_TEMPLATE_DEFINE(name)
Declare and initialize a reference to a Log component. 
 
SelectQueueCallback m_selectQueueCallback
Select queue callback. 
 
Network device transmission queue interface. 
 
uint8_t m_numTxQueues
Number of transmission queues to create. 
 
bool m_lateTxQueuesCreation
True if a device wants to create the TX queues by itself. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
std::vector< Ptr< NetDeviceQueue > > m_txQueuesVector
Device transmission queues. 
 
Use number of bytes for maximum queue size. 
 
Ptr< QueueLimits > m_queueLimits
Queue limits object. 
 
Network layer to device interface. 
 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
 
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR. 
 
A base class which provides memory management and object aggregation. 
 
Network device transmission queue. 
 
a unique identifier for an interface. 
 
static void PacketDiscarded(Ptr< Queue< Item > > queue, Ptr< NetDeviceQueueInterface > ndqi, uint8_t txq, Ptr< const Item > item)
Perform the actions required by flow control and dynamic queue limits when a packet is dropped before...