ns3::SatQueue Class Reference

SatQueue implements a queue utilized in the satellite module. More...

#include "satellite-queue.h"

+ Inheritance diagram for ns3::SatQueue:
+ Collaboration diagram for ns3::SatQueue:

Classes

struct  QueueStats_t
 QueueStats_t definition for passing queue related statistics to any interested modules. More...
 

Public Types

typedef Callback< void, Ptr< Packet > > LogonCallback
 logon msg sending callback More...
 
enum  QueueEvent_t { FIRST_BUFFERED_PKT , BUFFERED_PKT }
 
typedef Callback< void, SatQueue::QueueEvent_t, uint8_t > QueueEventCallback
 Callback to indicate queue related event. More...
 

Public Member Functions

 SatQueue ()
 Default constructor. More...
 
 SatQueue (uint8_t flowId)
 Constructor. More...
 
 ~SatQueue ()
 Destructor for SatQueue. More...
 
void AddLogonCallback (SatQueue::LogonCallback cb)
 Add queue event callback. More...
 
void AddQueueEventCallback (SatQueue::QueueEventCallback cb)
 Add queue event callback. More...
 
virtual Ptr< Packet > Dequeue (void)
 Deque takes packet from the packet container (front) More...
 
void DequeueAll (void)
 Flush the queue. More...
 
virtual void DoDispose ()
 Dispose of this class instance. More...
 
virtual bool Enqueue (Ptr< Packet > p)
 Enque pushes packet to the packet container (back) More...
 
uint32_t GetNBytes (void) const
 Get number of bytes currently stored in the queue. More...
 
uint32_t GetNPackets (void) const
 Get number of packets currently stored in the queue. More...
 
uint32_t GetNumSmallerPackets (uint32_t maxPacketSizeBytes) const
 Method checks how many packets are smaller or equal in size than the maximum packets size threshold specified as an argument. More...
 
QueueStats_t GetQueueStatistics (bool reset)
 GetQueueStatistics returns a struct of KPIs. More...
 
uint32_t GetTotalDroppedBytes (void) const
 Get total number of bytes dropped by this Queue since the simulation began, or since ResetStatistics was called, according to whichever happened more recently. More...
 
uint32_t GetTotalDroppedPackets (void) const
 Get total number of bytes dropped by this Queue since the simulation began, or since ResetStatistics was called, according to whichever happened more recently. More...
 
uint32_t GetTotalReceivedBytes (void) const
 Get total number of bytes received by this queue since the simulation began, or since ResetStatistics was called, according to whichever happened more recently. More...
 
uint32_t GetTotalReceivedPackets (void) const
 Get total number of packets received by this Queue since the simulation began, or since ResetStatistics was called, according to whichever happened more recently. More...
 
virtual bool IsEmpty (void) const
 Is the queue empty. More...
 
virtual Ptr< const Packet > Peek (void) const
 Get a copy of the item at the front of the queue without removing it. More...
 
virtual void PushFront (Ptr< Packet > p)
 PushFront pushes a fragmented packet back to the front of the packet container. More...
 
void ResetStatistics (void)
 Resets the counts for dropped packets, dropped bytes, received packets, and received bytes. More...
 
void SetFlowId (uint32_t flowId)
 Configured flow index for this queue. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Member Functions

void Drop (Ptr< Packet > packet)
 Drop a packet. More...
 

Private Types

typedef std::vector< QueueEventCallbackEventCallbackContainer_t
 
typedef std::deque< Ptr< Packet > > PacketContainer_t
 

Private Member Functions

void ResetShortTermStatistics ()
 Reset the short term statistics. More...
 
void SendEvent (SatQueue::QueueEvent_t event)
 Send queue event to all registered callbacks. More...
 

Private Attributes

uint8_t m_flowId
 An unique id for each queue. More...
 
LogonCallback m_logonCallback
 Callback to send control messages. More...
 
uint32_t m_maxPackets
 Maximum allowed packets within the packet container. More...
 
uint32_t m_nBytes
 
uint32_t m_nDequeBytesSinceReset
 
uint32_t m_nEnqueBytesSinceReset
 
uint32_t m_nPackets
 
uint32_t m_nTotalDroppedBytes
 
uint32_t m_nTotalDroppedPackets
 
uint32_t m_nTotalReceivedBytes
 
uint32_t m_nTotalReceivedPackets
 
PacketContainer_t m_packets
 Packet container. More...
 
EventCallbackContainer_t m_queueEventCallbacks
 Container of callbacks for queue related events. More...
 
Time m_statResetTime
 
TracedCallback< Ptr< const Packet > > m_traceDequeue
 
TracedCallback< Ptr< const Packet > > m_traceDrop
 
TracedCallback< Ptr< const Packet > > m_traceEnqueue
 

Detailed Description

SatQueue implements a queue utilized in the satellite module.

SatQueue is utilized in both FWD and RTN link to store incoming packets inside either SatGenericStreamEncapsulator (FWD link) or SatReturnLinkEncapsulator (RTN link). SatQueue is capable of collecting statistics from the incoming and outgoing bits and packets.

Definition at line 45 of file satellite-queue.h.

Member Typedef Documentation

◆ EventCallbackContainer_t

Definition at line 258 of file satellite-queue.h.

◆ LogonCallback

typedef Callback<void, Ptr<Packet> > ns3::SatQueue::LogonCallback

logon msg sending callback

Parameters
pkt
Returns
bool

Definition at line 107 of file satellite-queue.h.

◆ PacketContainer_t

typedef std::deque<Ptr<Packet> > ns3::SatQueue::PacketContainer_t
private

Definition at line 259 of file satellite-queue.h.

◆ QueueEventCallback

Callback to indicate queue related event.

Parameters
SatQueue::QueueEvent_tEvent type
uint32_tQueue id
Returns
void

Definition at line 115 of file satellite-queue.h.

Member Enumeration Documentation

◆ QueueEvent_t

Enumerator
FIRST_BUFFERED_PKT 
BUFFERED_PKT 

Definition at line 76 of file satellite-queue.h.

Constructor & Destructor Documentation

◆ SatQueue() [1/2]

ns3::SatQueue::SatQueue ( )

Default constructor.

Definition at line 69 of file satellite-queue.cc.

◆ SatQueue() [2/2]

ns3::SatQueue::SatQueue ( uint8_t  flowId)

Constructor.

Definition at line 87 of file satellite-queue.cc.

◆ ~SatQueue()

ns3::SatQueue::~SatQueue ( )

Destructor for SatQueue.

Definition at line 105 of file satellite-queue.cc.

Member Function Documentation

◆ AddLogonCallback()

void ns3::SatQueue::AddLogonCallback ( SatQueue::LogonCallback  cb)

Add queue event callback.

Parameters
cbCallback

Definition at line 288 of file satellite-queue.cc.

References m_logonCallback.

◆ AddQueueEventCallback()

void ns3::SatQueue::AddQueueEventCallback ( SatQueue::QueueEventCallback  cb)

Add queue event callback.

Parameters
cbCallback

Definition at line 281 of file satellite-queue.cc.

References m_queueEventCallbacks.

◆ Dequeue()

Ptr< Packet > ns3::SatQueue::Dequeue ( void  )
virtual

Deque takes packet from the packet container (front)

Returns
p Packet

Definition at line 200 of file satellite-queue.cc.

References IsEmpty(), m_nBytes, m_nDequeBytesSinceReset, m_nPackets, m_packets, and m_traceDequeue.

Referenced by DequeueAll().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DequeueAll()

void ns3::SatQueue::DequeueAll ( void  )

Flush the queue.

Definition at line 259 of file satellite-queue.cc.

References Dequeue(), and IsEmpty().

Referenced by DoDispose().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::SatQueue::DoDispose ( void  )
virtual

Dispose of this class instance.

Definition at line 111 of file satellite-queue.cc.

References DequeueAll(), and m_queueEventCallbacks.

+ Here is the call graph for this function:

◆ Drop()

void ns3::SatQueue::Drop ( Ptr< Packet >  packet)
protected

Drop a packet.

Parameters
packetpacket that was dropped

Definition at line 269 of file satellite-queue.cc.

References m_nTotalDroppedBytes, m_nTotalDroppedPackets, and m_traceDrop.

Referenced by Enqueue().

+ Here is the caller graph for this function:

◆ Enqueue()

bool ns3::SatQueue::Enqueue ( Ptr< Packet >  p)
virtual

Enque pushes packet to the packet container (back)

Parameters
pPacket
Returns
bool indicating whether the enque was successfull

Definition at line 141 of file satellite-queue.cc.

References BUFFERED_PKT, Drop(), FIRST_BUFFERED_PKT, ns3::SatControlMsgTag::GetMsgType(), ns3::SatLog::LOG_WARNING, m_logonCallback, m_maxPackets, m_nBytes, m_nEnqueBytesSinceReset, m_nPackets, m_nTotalReceivedBytes, m_nTotalReceivedPackets, m_packets, m_traceEnqueue, ns3::SatControlMsgTag::SAT_LOGON_CTRL_MSG, and SendEvent().

+ Here is the call graph for this function:

◆ GetNBytes()

uint32_t ns3::SatQueue::GetNBytes ( void  ) const

Get number of bytes currently stored in the queue.

Returns
Bytes in queue

Definition at line 319 of file satellite-queue.cc.

References m_nBytes.

Referenced by GetQueueStatistics().

+ Here is the caller graph for this function:

◆ GetNPackets()

uint32_t ns3::SatQueue::GetNPackets ( void  ) const

Get number of packets currently stored in the queue.

Returns
Number of packets in queue

Definition at line 311 of file satellite-queue.cc.

References m_nPackets.

◆ GetNumSmallerPackets()

uint32_t ns3::SatQueue::GetNumSmallerPackets ( uint32_t  maxPacketSizeBytes) const

Method checks how many packets are smaller or equal in size than the maximum packets size threshold specified as an argument.

Note, that each queue is gone through from the front up until there is first packet larger than threshold.

Parameters
maxPacketSizeBytesMaximum packet size threshold in Bytes
Returns
Number of packets

Definition at line 410 of file satellite-queue.cc.

References m_packets.

◆ GetQueueStatistics()

SatQueue::QueueStats_t ns3::SatQueue::GetQueueStatistics ( bool  reset)

◆ GetTotalDroppedBytes()

uint32_t ns3::SatQueue::GetTotalDroppedBytes ( void  ) const

Get total number of bytes dropped by this Queue since the simulation began, or since ResetStatistics was called, according to whichever happened more recently.

Returns
Dropped bytes

Definition at line 343 of file satellite-queue.cc.

References m_nTotalDroppedBytes.

◆ GetTotalDroppedPackets()

uint32_t ns3::SatQueue::GetTotalDroppedPackets ( void  ) const

Get total number of bytes dropped by this Queue since the simulation began, or since ResetStatistics was called, according to whichever happened more recently.

Returns
Dropped packets

Definition at line 351 of file satellite-queue.cc.

References m_nTotalDroppedPackets.

◆ GetTotalReceivedBytes()

uint32_t ns3::SatQueue::GetTotalReceivedBytes ( void  ) const

Get total number of bytes received by this queue since the simulation began, or since ResetStatistics was called, according to whichever happened more recently.

Returns
Received bytes

Definition at line 327 of file satellite-queue.cc.

References m_nTotalReceivedBytes.

◆ GetTotalReceivedPackets()

uint32_t ns3::SatQueue::GetTotalReceivedPackets ( void  ) const

Get total number of packets received by this Queue since the simulation began, or since ResetStatistics was called, according to whichever happened more recently.

Returns
Received packets

Definition at line 335 of file satellite-queue.cc.

References m_nTotalReceivedPackets.

◆ GetTypeId()

TypeId ns3::SatQueue::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 42 of file satellite-queue.cc.

References m_maxPackets, m_traceDequeue, m_traceDrop, and m_traceEnqueue.

◆ IsEmpty()

bool ns3::SatQueue::IsEmpty ( void  ) const
virtual

Is the queue empty.

Returns
true if the queue is empty; false otherwise

Definition at line 134 of file satellite-queue.cc.

References m_packets.

Referenced by Dequeue(), DequeueAll(), and Peek().

+ Here is the caller graph for this function:

◆ Peek()

Ptr< const Packet > ns3::SatQueue::Peek ( void  ) const
virtual

Get a copy of the item at the front of the queue without removing it.

Returns
Pointer to the packet

Definition at line 227 of file satellite-queue.cc.

References IsEmpty(), m_nBytes, and m_packets.

+ Here is the call graph for this function:

◆ PushFront()

void ns3::SatQueue::PushFront ( Ptr< Packet >  p)
virtual

PushFront pushes a fragmented packet back to the front of the packet container.

Parameters
pPacket

Definition at line 246 of file satellite-queue.cc.

References m_nBytes, m_nDequeBytesSinceReset, m_nPackets, and m_packets.

◆ ResetShortTermStatistics()

void ns3::SatQueue::ResetShortTermStatistics ( )
private

Reset the short term statistics.

Short term reflects here e.g. to superframe duration.

Definition at line 400 of file satellite-queue.cc.

References m_nDequeBytesSinceReset, m_nEnqueBytesSinceReset, and m_statResetTime.

Referenced by GetQueueStatistics().

+ Here is the caller graph for this function:

◆ ResetStatistics()

void ns3::SatQueue::ResetStatistics ( void  )

Resets the counts for dropped packets, dropped bytes, received packets, and received bytes.

Definition at line 387 of file satellite-queue.cc.

References m_nBytes, m_nPackets, m_nTotalDroppedBytes, m_nTotalDroppedPackets, m_nTotalReceivedBytes, and m_nTotalReceivedPackets.

◆ SendEvent()

void ns3::SatQueue::SendEvent ( SatQueue::QueueEvent_t  event)
private

Send queue event to all registered callbacks.

Parameters
eventQueue event

Definition at line 295 of file satellite-queue.cc.

References m_flowId, and m_queueEventCallbacks.

Referenced by Enqueue().

+ Here is the caller graph for this function:

◆ SetFlowId()

void ns3::SatQueue::SetFlowId ( uint32_t  flowId)

Configured flow index for this queue.

Parameters
flowId

Definition at line 127 of file satellite-queue.cc.

References m_flowId.

Member Data Documentation

◆ m_flowId

uint8_t ns3::SatQueue::m_flowId
private

An unique id for each queue.

Definition at line 279 of file satellite-queue.h.

Referenced by SendEvent(), and SetFlowId().

◆ m_logonCallback

LogonCallback ns3::SatQueue::m_logonCallback
private

Callback to send control messages.

Definition at line 302 of file satellite-queue.h.

Referenced by AddLogonCallback(), and Enqueue().

◆ m_maxPackets

uint32_t ns3::SatQueue::m_maxPackets
private

Maximum allowed packets within the packet container.

Definition at line 274 of file satellite-queue.h.

Referenced by Enqueue(), and GetTypeId().

◆ m_nBytes

uint32_t ns3::SatQueue::m_nBytes
private

Definition at line 282 of file satellite-queue.h.

Referenced by Dequeue(), Enqueue(), GetNBytes(), Peek(), PushFront(), and ResetStatistics().

◆ m_nDequeBytesSinceReset

uint32_t ns3::SatQueue::m_nDequeBytesSinceReset
private

◆ m_nEnqueBytesSinceReset

uint32_t ns3::SatQueue::m_nEnqueBytesSinceReset
private

Definition at line 290 of file satellite-queue.h.

Referenced by Enqueue(), GetQueueStatistics(), and ResetShortTermStatistics().

◆ m_nPackets

uint32_t ns3::SatQueue::m_nPackets
private

Definition at line 284 of file satellite-queue.h.

Referenced by Dequeue(), Enqueue(), GetNPackets(), PushFront(), and ResetStatistics().

◆ m_nTotalDroppedBytes

uint32_t ns3::SatQueue::m_nTotalDroppedBytes
private

Definition at line 286 of file satellite-queue.h.

Referenced by Drop(), GetTotalDroppedBytes(), and ResetStatistics().

◆ m_nTotalDroppedPackets

uint32_t ns3::SatQueue::m_nTotalDroppedPackets
private

Definition at line 287 of file satellite-queue.h.

Referenced by Drop(), GetTotalDroppedPackets(), and ResetStatistics().

◆ m_nTotalReceivedBytes

uint32_t ns3::SatQueue::m_nTotalReceivedBytes
private

Definition at line 283 of file satellite-queue.h.

Referenced by Enqueue(), GetTotalReceivedBytes(), and ResetStatistics().

◆ m_nTotalReceivedPackets

uint32_t ns3::SatQueue::m_nTotalReceivedPackets
private

Definition at line 285 of file satellite-queue.h.

Referenced by Enqueue(), GetTotalReceivedPackets(), and ResetStatistics().

◆ m_packets

PacketContainer_t ns3::SatQueue::m_packets
private

Packet container.

Definition at line 269 of file satellite-queue.h.

Referenced by Dequeue(), Enqueue(), GetNumSmallerPackets(), IsEmpty(), Peek(), and PushFront().

◆ m_queueEventCallbacks

EventCallbackContainer_t ns3::SatQueue::m_queueEventCallbacks
private

Container of callbacks for queue related events.

Definition at line 264 of file satellite-queue.h.

Referenced by AddQueueEventCallback(), DoDispose(), and SendEvent().

◆ m_statResetTime

Time ns3::SatQueue::m_statResetTime
private

Definition at line 292 of file satellite-queue.h.

Referenced by GetQueueStatistics(), and ResetShortTermStatistics().

◆ m_traceDequeue

TracedCallback<Ptr<const Packet> > ns3::SatQueue::m_traceDequeue
private

Definition at line 296 of file satellite-queue.h.

Referenced by Dequeue(), and GetTypeId().

◆ m_traceDrop

TracedCallback<Ptr<const Packet> > ns3::SatQueue::m_traceDrop
private

Definition at line 297 of file satellite-queue.h.

Referenced by Drop(), and GetTypeId().

◆ m_traceEnqueue

TracedCallback<Ptr<const Packet> > ns3::SatQueue::m_traceEnqueue
private

Definition at line 295 of file satellite-queue.h.

Referenced by Enqueue(), and GetTypeId().


The documentation for this class was generated from the following files: