Package: inet.queueing.queue
PacketQueue
simple moduleThis module implements a widely configurable packet queue, which is suitable among others, to be used in MAC protocols, traffic conditioning, and quality of services. This module can be used on its own, but it's also often supplemented by additional queueing components such as servers, classifiers, schedulers, multiplexers, etc. This kind of composition allows to form a larger module which can act as a packet queue with more complex behavior.
By default, this module acts as a standard FIFO queue with an infinite internal buffer. Nevertheless, it can also be configured to limit the number of packets and the total data length of packets in the internal buffer. If the queue becomes overloaded by surpassing the limits of the internal buffer, an error is raised unless a packet drop algorithm is configured.
When a packet drop algorithm is used, then one or more packets are dropped until the storage limits are met according to the dropping strategy. Packets are only dropped after the new packet has been inserted into the queue. This method allows higher priority packets to take precedence over already stored lower priority packets even if the queue is already full.
The queue can also keep the packets sorted according to a comparator function. If a comparator is not configured, then packets are pushed at the back of the queue and they are kept in this order. Packets are always popped at the front of the queue.
It's also possible to use an external buffer, which can be shared among multiple queues. In this case, the storage limits are configured on the packet buffer, which also takes care of dropping packets from either this queue or some other queues as necessary.
See also: IPacketBuffer
Inheritance diagram
The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.
Used in compound modules
Name | Type | Description |
---|---|---|
AFxyQueue | compound module |
This is an example queue, that implements one class of the Assured Forwarding PHB group (RFC 2597). |
CompoundPendingQueue | compound module | (no description) |
Known subclasses
Name | Type | Description |
---|---|---|
DropHeadQueue | simple module |
This is a limited packet queue which drops packets at the head of the queue. |
DropTailQueue | simple module |
This module is a limited packet queue which drops packets at the tail of the queue. |
Extends
Name | Type | Description |
---|---|---|
PacketQueueBase | simple module |
This is a base module for various packet queue modules which maintains a few statistics. |
Parameters
Name | Type | Default value | Description |
---|---|---|---|
displayStringTextFormat | string | "contains %p pk (%l) pushed %u\npopped %o removed %r dropped %d" |
determines display string text above the submodule |
packetCapacity | int | -1 |
maximum number of packets in the queue, no limit by default |
dataCapacity | int | -1b |
maximum total length of packets in the queue, no limit by default |
dropperClass | string | "" |
determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class |
comparatorClass | string | "" |
determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class |
bufferModule | string | "" |
relative module path to the IPacketBuffer module used by this queue, implicit buffer by default |
Properties
Name | Value | Description |
---|---|---|
display | i=block/queue | |
class | PacketQueue |
Gates
Name | Direction | Size | Description |
---|---|---|---|
in | input | ||
out | output |
Signals
Name | Type | Unit |
---|---|---|
packetRemoved | inet::Packet | |
packetPushed | inet::Packet | |
packetDropped | inet::Packet | |
packetPopped | inet::Packet |
Statistics
Name | Title | Source | Record | Unit | Interpolation Mode |
---|---|---|---|---|---|
packetRemoved | packets removed | count, sum(packetBytes), vector(packetBytes) | none | ||
queueLength | queue length | count(packetPushed) - count(packetPopped) - count(packetRemoved) - count(packetDropped) | max, timeavg, vector | sample-hold | |
queueingTime | queueing times | queueingTime(packetPopped) | histogram, vector | s | none |
packetPushed | packet pushed | count, sum(packetBytes), vector(packetBytes) | none | ||
packetDropQueueOverflow | packet drops: queue overflow | packetDropReasonIsQueueOverflow(packetDropped) | count, sum(packetBytes), vector(packetBytes) | none | |
packetPopped | packet popped | count, sum(packetBytes), vector(packetBytes) | none |
Source code
// // This module implements a widely configurable packet queue, which is suitable // among others, to be used in MAC protocols, traffic conditioning, and quality // of services. This module can be used on its own, but it's also often supplemented // by additional queueing components such as servers, classifiers, schedulers, // multiplexers, etc. This kind of composition allows to form a larger module // which can act as a packet queue with more complex behavior. // // By default, this module acts as a standard FIFO queue with an infinite // internal buffer. Nevertheless, it can also be configured to limit the number // of packets and the total data length of packets in the internal buffer. // If the queue becomes overloaded by surpassing the limits of the internal // buffer, an error is raised unless a packet drop algorithm is configured. // // When a packet drop algorithm is used, then one or more packets are dropped // until the storage limits are met according to the dropping strategy. Packets // are only dropped after the new packet has been inserted into the queue. This // method allows higher priority packets to take precedence over already stored // lower priority packets even if the queue is already full. // // The queue can also keep the packets sorted according to a comparator function. // If a comparator is not configured, then packets are pushed at the back of the // queue and they are kept in this order. Packets are always popped at the front // of the queue. // // It's also possible to use an external buffer, which can be shared among multiple // queues. In this case, the storage limits are configured on the packet buffer, // which also takes care of dropping packets from either this queue or some // other queues as necessary. // // @see ~IPacketBuffer // simple PacketQueue extends PacketQueueBase like IPacketQueue { parameters: int packetCapacity = default(-1); // maximum number of packets in the queue, no limit by default int dataCapacity @unit(b) = default(-1b); // maximum total length of packets in the queue, no limit by default string dropperClass = default(""); // determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class string comparatorClass = default(""); // determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class string bufferModule = default(""); // relative module path to the IPacketBuffer module used by this queue, implicit buffer by default displayStringTextFormat = default("contains %p pk (%l) pushed %u\npopped %o removed %r dropped %d"); @class(PacketQueue); @signal[packetPushed](type=inet::Packet); @signal[packetPopped](type=inet::Packet); @signal[packetRemoved](type=inet::Packet); @signal[packetDropped](type=inet::Packet); @statistic[packetPushed](title="packet pushed"; record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none); @statistic[packetPopped](title="packet popped"; record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none); @statistic[packetRemoved](title="packets removed"; record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none); @statistic[packetDropQueueOverflow](title="packet drops: queue overflow"; source=packetDropReasonIsQueueOverflow(packetDropped); record=count,sum(packetBytes),vector(packetBytes); interpolationmode=none); @statistic[queueingTime](title="queueing times"; source=queueingTime(packetPopped); record=histogram,vector; unit=s; interpolationmode=none); @statistic[queueLength](title="queue length"; source=count(packetPushed) - count(packetPopped) - count(packetRemoved) - count(packetDropped); record=max,timeavg,vector; interpolationmode=sample-hold); }File: src/inet/queueing/queue/PacketQueue.ned