26 #include "ns3/packet.h" 
   27 #include "ns3/object.h" 
   28 #include "ns3/traced-callback.h" 
   29 #include "ns3/traced-value.h" 
   30 #include "ns3/unused.h" 
   32 #include "ns3/queue-size.h" 
  250   void EnableRunningAverage (
Time averageWindow);
 
  251   void DisableRunningAverage (
void);
 
  253   double GetQueueSizeAverage (
void);
 
  254   double GetReceivedBytesPerSecondAverage (
void);
 
  255   double GetReceivedPacketsPerSecondAverage (
void);
 
  256   double GetDroppedBytesPerSecondAverage (
void);
 
  257   double GetDroppedPacketsPerSecondAverage (
void);
 
  259   double GetQueueSizeVariance (
void);
 
  260   double GetReceivedBytesPerSecondVariance (
void);
 
  261   double GetReceivedPacketsPerSecondVariance (
void);
 
  262   double GetDroppedBytesPerSecondVariance (
void);
 
  263   double GetDroppedPacketsPerSecondVariance (
void);
 
  283   template <
typename Item>
 
  311 template <
typename Item>
 
  376   ConstIterator 
Head (
void) 
const;
 
  392   ConstIterator 
Tail (
void) 
const;
 
  464 template <
typename Item>
 
  468   std::string name = GetTypeParamName<Queue<Item> > ();
 
  469   static TypeId tid = 
TypeId ((
"ns3::Queue<" + name + 
">").c_str ())
 
  471     .SetGroupName (
"Network")
 
  472     .AddTraceSource (
"Enqueue", 
"Enqueue a packet in the queue.",
 
  474                      "ns3::" + name + 
"::TracedCallback")
 
  475     .AddTraceSource (
"Dequeue", 
"Dequeue a packet from the queue.",
 
  477                      "ns3::" + name + 
"::TracedCallback")
 
  478     .AddTraceSource (
"Drop", 
"Drop a packet (for whatever reason).",
 
  480                      "ns3::" + name + 
"::TracedCallback")
 
  481     .AddTraceSource (
"DropBeforeEnqueue", 
"Drop a packet before enqueue.",
 
  483                      "ns3::" + name + 
"::TracedCallback")
 
  484     .AddTraceSource (
"DropAfterDequeue", 
"Drop a packet after dequeue.",
 
  486                      "ns3::" + name + 
"::TracedCallback")
 
  491 template <
typename Item>
 
  497 template <
typename Item>
 
  502 template <
typename Item>
 
  508   if (GetCurrentSize () + item > GetMaxSize ())
 
  511       DropBeforeEnqueue (item);
 
  515   m_packets.insert (pos, item);
 
  517   uint32_t size = item->GetSize ();
 
  519   m_nTotalReceivedBytes += size;
 
  522   m_nTotalReceivedPackets++;
 
  525   m_traceEnqueue (item);
 
  530 template <
typename Item>
 
  536   if (m_nPackets.Get () == 0)
 
  543   m_packets.erase (pos);
 
  547       NS_ASSERT (m_nBytes.Get () >= item->GetSize ());
 
  550       m_nBytes -= item->GetSize ();
 
  554       m_traceDequeue (item);
 
  559 template <
typename Item>
 
  565   if (m_nPackets.Get () == 0)
 
  572   m_packets.erase (pos);
 
  576       NS_ASSERT (m_nBytes.Get () >= item->GetSize ());
 
  579       m_nBytes -= item->GetSize ();
 
  584       m_traceDequeue (item);
 
  586       DropAfterDequeue (item);
 
  591 template <
typename Item>
 
  602 template <
typename Item>
 
  608   if (m_nPackets.Get () == 0)
 
  617 template <
typename Item>
 
  620   return m_packets.cbegin ();
 
  623 template <
typename Item>
 
  626   return m_packets.cend ();
 
  629 template <
typename Item>
 
  635   m_nTotalDroppedPackets++;
 
  636   m_nTotalDroppedPacketsBeforeEnqueue++;
 
  637   m_nTotalDroppedBytes += item->GetSize ();
 
  638   m_nTotalDroppedBytesBeforeEnqueue += item->GetSize ();
 
  642   m_traceDropBeforeEnqueue (item);
 
  645 template <
typename Item>
 
  651   m_nTotalDroppedPackets++;
 
  652   m_nTotalDroppedPacketsAfterDequeue++;
 
  653   m_nTotalDroppedBytes += item->GetSize ();
 
  654   m_nTotalDroppedBytesAfterDequeue += item->GetSize ();
 
  658   m_traceDropAfterDequeue (item);
 
uint32_t m_nTotalDroppedPacketsBeforeEnqueue
Total dropped packets before enqueue. 
 
uint32_t m_nTotalReceivedPackets
Total received packets. 
 
Simulation virtual time values and global simulation resolution. 
 
uint32_t m_nTotalDroppedPackets
Total dropped packets. 
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
 
ConstIterator Head(void) const 
Get a const iterator which refers to the first item in the queue. 
 
TracedCallback< Ptr< const Item > > m_traceDequeue
Traced callback: fired when a packet is dequeued. 
 
Class for representing queue sizes. 
 
uint32_t m_maxBytes
max bytes in the queue 
 
NS_LOG_TEMPLATE_DECLARE
the log component 
 
Forward calls to a chain of Callback. 
 
void Flush(void)
Flush the queue. 
 
uint32_t m_nTotalDroppedBytes
Total dropped bytes. 
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
 
uint32_t m_nTotalDroppedPacketsAfterDequeue
Total dropped packets after dequeue. 
 
uint32_t m_nTotalDroppedBytesAfterDequeue
Total dropped bytes after dequeue. 
 
Ptr< Item > DoRemove(ConstIterator pos)
Pull the item to drop from the queue. 
 
uint32_t GetTotalDroppedPacketsBeforeEnqueue(void) const 
 
TracedCallback< Ptr< const Item > > m_traceDrop
Traced callback: fired when a packet is dropped. 
 
QueueBase::QueueMode GetMode(void) const 
Get the operating mode of this device. 
 
TracedValue< uint32_t > m_nPackets
Number of packets in the queue. 
 
static void AppendItemTypeIfNotPresent(std::string &typeId, const std::string &itemType)
Append the item type to the provided type ID if the latter does not end with '>'. ...
 
QueueSize m_maxSize
max queue size 
 
Use number of packets for maximum queue size. 
 
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source. 
 
Template class for packet Queues. 
 
static TypeId GetTypeId(void)
Get the type ID. 
 
TracedCallback< Ptr< const Item > > m_traceDropAfterDequeue
Traced callback: fired when a packet is dropped after dequeue. 
 
uint32_t GetNBytes(void) const 
 
uint32_t m_maxPackets
max packets in the queue 
 
void SetMode(QueueBase::QueueMode mode)
Set the operating mode of this device. 
 
uint32_t m_nTotalDroppedBytesBeforeEnqueue
Total dropped bytes before enqueue. 
 
#define NS_LOG_TEMPLATE_DEFINE(name)
Initialize a reference to a Log component. 
 
QueueSize GetCurrentSize(void) const 
 
TracedCallback< Ptr< const Item > > m_traceEnqueue
Traced callback: fired when a packet is enqueued. 
 
void SetMaxPackets(uint32_t maxPackets)
Set the maximum amount of packets that can be stored in this queue. 
 
void DropAfterDequeue(Ptr< Item > item)
Drop a packet after dequeue. 
 
uint32_t GetMaxPackets(void) const 
 
ConstIterator Tail(void) const 
Get a const iterator which indicates past-the-last item in the queue. 
 
uint32_t GetTotalDroppedBytes(void) const 
 
uint32_t m_nTotalReceivedBytes
Total received bytes. 
 
void ResetStatistics(void)
Resets the counts for dropped packets, dropped bytes, received packets, and received bytes...
 
virtual bool Enqueue(Ptr< Item > item)=0
Place an item into the Queue (each subclass defines the position) 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
virtual Ptr< Item > Remove(void)=0
Remove an item from the Queue (each subclass defines the position), counting it as dropped...
 
uint32_t GetTotalDroppedBytesAfterDequeue(void) const 
 
void SetMaxBytes(uint32_t maxBytes)
Set the maximum amount of bytes that can be stored in this queue. 
 
Use number of bytes for maximum queue size. 
 
TracedCallback< Ptr< const Item > > m_traceDropBeforeEnqueue
Traced callback: fired when a packet is dropped before enqueue. 
 
uint32_t GetTotalReceivedPackets(void) const 
 
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
 
uint32_t GetMaxBytes(void) const 
 
Abstract base class for packet Queues. 
 
virtual Ptr< Item > Dequeue(void)=0
Remove an item from the Queue (each subclass defines the position), counting it as dequeued...
 
Ptr< const Item > DoPeek(ConstIterator pos) const 
Peek the front item in the queue. 
 
void DropBeforeEnqueue(Ptr< Item > item)
Drop a packet before enqueue. 
 
uint32_t GetNPackets(void) const 
 
uint32_t GetTotalDroppedPacketsAfterDequeue(void) const 
 
uint32_t GetTotalDroppedPackets(void) const 
 
virtual Ptr< const Item > Peek(void) const =0
Get a copy of an item in the queue (each subclass defines the position) without removing it...
 
A base class which provides memory management and object aggregation. 
 
void SetMaxSize(QueueSize size)
Set the maximum size of this queue. 
 
QueueMode
Enumeration of the modes supported in the class. 
 
Ptr< Item > DoDequeue(ConstIterator pos)
Pull the item to dequeue from the queue. 
 
a unique identifier for an interface. 
 
uint32_t GetTotalReceivedBytes(void) const 
 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
 
bool DoEnqueue(ConstIterator pos, Ptr< Item > item)
Push an item in the queue. 
 
std::list< Ptr< Item > >::const_iterator ConstIterator
Const iterator. 
 
std::list< Ptr< Item > > m_packets
the items in the queue 
 
QueueSize GetMaxSize(void) const 
 
static TypeId GetTypeId(void)
Get the type ID. 
 
uint32_t GetTotalDroppedBytesBeforeEnqueue(void) const 
 
TracedValue< uint32_t > m_nBytes
Number of bytes in the queue.