SatQueue implements a queue utilized in the satellite module. More...
#include "satellite-queue.h"
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< QueueEventCallback > | EventCallbackContainer_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 |
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 48 of file satellite-queue.h.
|
private |
Definition at line 261 of file satellite-queue.h.
typedef Callback<void, Ptr<Packet> > ns3::SatQueue::LogonCallback |
logon msg sending callback
pkt |
Definition at line 110 of file satellite-queue.h.
|
private |
Definition at line 262 of file satellite-queue.h.
typedef Callback<void, SatQueue::QueueEvent_t, uint8_t> ns3::SatQueue::QueueEventCallback |
Callback to indicate queue related event.
SatQueue::QueueEvent_t | Event type |
uint32_t | Queue id |
Definition at line 118 of file satellite-queue.h.
Enumerator | |
---|---|
FIRST_BUFFERED_PKT | |
BUFFERED_PKT |
Definition at line 79 of file satellite-queue.h.
ns3::SatQueue::SatQueue | ( | ) |
Default constructor.
Definition at line 71 of file satellite-queue.cc.
ns3::SatQueue::SatQueue | ( | uint8_t | flowId | ) |
Constructor.
Definition at line 89 of file satellite-queue.cc.
ns3::SatQueue::~SatQueue | ( | ) |
Destructor for SatQueue.
Definition at line 107 of file satellite-queue.cc.
void ns3::SatQueue::AddLogonCallback | ( | SatQueue::LogonCallback | cb | ) |
Add queue event callback.
cb | Callback |
Definition at line 290 of file satellite-queue.cc.
References m_logonCallback.
void ns3::SatQueue::AddQueueEventCallback | ( | SatQueue::QueueEventCallback | cb | ) |
Add queue event callback.
cb | Callback |
Definition at line 283 of file satellite-queue.cc.
References m_queueEventCallbacks.
|
virtual |
Deque takes packet from the packet container (front)
Definition at line 202 of file satellite-queue.cc.
References IsEmpty(), m_nBytes, m_nDequeBytesSinceReset, m_nPackets, m_packets, and m_traceDequeue.
Referenced by DequeueAll().
void ns3::SatQueue::DequeueAll | ( | void | ) |
Flush the queue.
Definition at line 261 of file satellite-queue.cc.
References Dequeue(), and IsEmpty().
Referenced by DoDispose().
|
virtual |
Dispose of this class instance.
Definition at line 113 of file satellite-queue.cc.
References DequeueAll(), and m_queueEventCallbacks.
|
protected |
Drop a packet.
packet | packet that was dropped |
Definition at line 271 of file satellite-queue.cc.
References m_nTotalDroppedBytes, m_nTotalDroppedPackets, and m_traceDrop.
Referenced by Enqueue().
|
virtual |
Enque pushes packet to the packet container (back)
p | Packet |
Definition at line 143 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().
uint32_t ns3::SatQueue::GetNBytes | ( | void | ) | const |
Get number of bytes currently stored in the queue.
Definition at line 321 of file satellite-queue.cc.
References m_nBytes.
Referenced by GetQueueStatistics().
uint32_t ns3::SatQueue::GetNPackets | ( | void | ) | const |
Get number of packets currently stored in the queue.
Definition at line 313 of file satellite-queue.cc.
References m_nPackets.
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.
maxPacketSizeBytes | Maximum packet size threshold in Bytes |
Definition at line 412 of file satellite-queue.cc.
References m_packets.
SatQueue::QueueStats_t ns3::SatQueue::GetQueueStatistics | ( | bool | reset | ) |
GetQueueStatistics returns a struct of KPIs.
reset | Reset flag indicating whether the statistics should be reset now |
Definition at line 361 of file satellite-queue.cc.
References ns3::SatConstVariables::BITS_IN_KBIT, ns3::SatConstVariables::BITS_PER_BYTE, GetNBytes(), ns3::SatQueue::QueueStats_t::m_incomingRateKbps, m_nDequeBytesSinceReset, m_nEnqueBytesSinceReset, ns3::SatQueue::QueueStats_t::m_outgoingRateKbps, ns3::SatQueue::QueueStats_t::m_queueSizeBytes, m_statResetTime, ns3::SatQueue::QueueStats_t::m_volumeInBytes, ns3::SatQueue::QueueStats_t::m_volumeOutBytes, and ResetShortTermStatistics().
Referenced by ns3::SatUtLlc::CreateEncap(), ns3::SatUtHelperDvb::Install(), and ns3::SatUtLlc::SetQueueStatisticsCallbacks().
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.
Definition at line 345 of file satellite-queue.cc.
References m_nTotalDroppedBytes.
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.
Definition at line 353 of file satellite-queue.cc.
References m_nTotalDroppedPackets.
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.
Definition at line 329 of file satellite-queue.cc.
References m_nTotalReceivedBytes.
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.
Definition at line 337 of file satellite-queue.cc.
References m_nTotalReceivedPackets.
|
static |
Get the type ID.
Definition at line 44 of file satellite-queue.cc.
References m_maxPackets, m_traceDequeue, m_traceDrop, and m_traceEnqueue.
|
virtual |
Is the queue empty.
Definition at line 136 of file satellite-queue.cc.
References m_packets.
Referenced by Dequeue(), DequeueAll(), and Peek().
|
virtual |
Get a copy of the item at the front of the queue without removing it.
Definition at line 229 of file satellite-queue.cc.
References IsEmpty(), m_nBytes, and m_packets.
|
virtual |
PushFront pushes a fragmented packet back to the front of the packet container.
p | Packet |
Definition at line 248 of file satellite-queue.cc.
References m_nBytes, m_nDequeBytesSinceReset, m_nPackets, and m_packets.
|
private |
Reset the short term statistics.
Short term reflects here e.g. to superframe duration.
Definition at line 402 of file satellite-queue.cc.
References m_nDequeBytesSinceReset, m_nEnqueBytesSinceReset, and m_statResetTime.
Referenced by GetQueueStatistics().
void ns3::SatQueue::ResetStatistics | ( | void | ) |
Resets the counts for dropped packets, dropped bytes, received packets, and received bytes.
Definition at line 389 of file satellite-queue.cc.
References m_nBytes, m_nPackets, m_nTotalDroppedBytes, m_nTotalDroppedPackets, m_nTotalReceivedBytes, and m_nTotalReceivedPackets.
|
private |
Send queue event to all registered callbacks.
event | Queue event |
Definition at line 297 of file satellite-queue.cc.
References m_flowId, and m_queueEventCallbacks.
Referenced by Enqueue().
void ns3::SatQueue::SetFlowId | ( | uint32_t | flowId | ) |
Configured flow index for this queue.
flowId |
Definition at line 129 of file satellite-queue.cc.
References m_flowId.
|
private |
An unique id for each queue.
Definition at line 282 of file satellite-queue.h.
Referenced by SendEvent(), and SetFlowId().
|
private |
Callback to send control messages.
Definition at line 305 of file satellite-queue.h.
Referenced by AddLogonCallback(), and Enqueue().
|
private |
Maximum allowed packets within the packet container.
Definition at line 277 of file satellite-queue.h.
Referenced by Enqueue(), and GetTypeId().
|
private |
Definition at line 285 of file satellite-queue.h.
Referenced by Dequeue(), Enqueue(), GetNBytes(), Peek(), PushFront(), and ResetStatistics().
|
private |
Definition at line 294 of file satellite-queue.h.
Referenced by Dequeue(), GetQueueStatistics(), PushFront(), and ResetShortTermStatistics().
|
private |
Definition at line 293 of file satellite-queue.h.
Referenced by Enqueue(), GetQueueStatistics(), and ResetShortTermStatistics().
|
private |
Definition at line 287 of file satellite-queue.h.
Referenced by Dequeue(), Enqueue(), GetNPackets(), PushFront(), and ResetStatistics().
|
private |
Definition at line 289 of file satellite-queue.h.
Referenced by Drop(), GetTotalDroppedBytes(), and ResetStatistics().
|
private |
Definition at line 290 of file satellite-queue.h.
Referenced by Drop(), GetTotalDroppedPackets(), and ResetStatistics().
|
private |
Definition at line 286 of file satellite-queue.h.
Referenced by Enqueue(), GetTotalReceivedBytes(), and ResetStatistics().
|
private |
Definition at line 288 of file satellite-queue.h.
Referenced by Enqueue(), GetTotalReceivedPackets(), and ResetStatistics().
|
private |
Packet container.
Definition at line 272 of file satellite-queue.h.
Referenced by Dequeue(), Enqueue(), GetNumSmallerPackets(), IsEmpty(), Peek(), and PushFront().
|
private |
Container of callbacks for queue related events.
Definition at line 267 of file satellite-queue.h.
Referenced by AddQueueEventCallback(), DoDispose(), and SendEvent().
|
private |
Definition at line 295 of file satellite-queue.h.
Referenced by GetQueueStatistics(), and ResetShortTermStatistics().
|
private |
Definition at line 299 of file satellite-queue.h.
Referenced by Dequeue(), and GetTypeId().
|
private |
Definition at line 300 of file satellite-queue.h.
Referenced by Drop(), and GetTypeId().
|
private |
Definition at line 298 of file satellite-queue.h.
Referenced by Enqueue(), and GetTypeId().