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. If a packet dropper function is not used and any queue capacity parameter is specified then the queue provides back pressure towards its source.
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 pulled 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.
Some often used packet queue variants such as DropTailQueue are implemented as dervide modules.
Some notable packet dropper functions are: PacketAtCollectionBeginDropper, PacketAtCollectionEndDropper, PacketWithHighestOwnerModuleIdDropper, PacketWithLowestModuleIdDropper.
Some notable packet comparator functions are: PacketUserPriorityComparator, PacketCreationTimeComparator, PacketEligibilityTimeComparator.
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. |
EligibilityTimeQueue | simple module |
This module is a packet queue that keeps the packets in ascending order based on the eligibility time in the attached EligibilityTimeTag of the packets. |
InProgressQueue | simple module | (no description) |
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\npulled %o removed %r dropped %d" |
determines the text that is written on top of 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 | |
defaultStatistic | queueLength:vector |
Gates
Name | Direction | Size | Description |
---|---|---|---|
in | input | ||
out | output |
Signals
Name | Type | Unit |
---|---|---|
packetRemoved | inet::Packet | |
packetPushStarted | inet::Packet | |
packetDropped | inet::Packet | |
packetPushEnded | inet::Packet? | |
packetPulled | inet::Packet |
Statistics
Name | Title | Source | Record | Unit | Interpolation Mode |
---|---|---|---|---|---|
queueBitLength | queue bit length | warmup(atomic(constant0(packetPushEnded) + sum(packetLength(packetPushStarted)) - sum(packetLength(packetPulled)) - sum(packetLength(packetRemoved)) - sum(packetLength(packetDropped)))) | last, max, timeavg, vector | b | sample-hold |
queueLength | queue length | warmup(atomic(constant0(packetPushEnded) + count(packetPushStarted) - count(packetPulled) - count(packetRemoved) - count(packetDropped))) | last, max, timeavg, vector | pk | sample-hold |
droppedPacketsQueueOverflow | dropped packets: queue overflow | packetDropReasonIsQueueOverflow(packetDropped) | count | pk | none |
queueingTime | queueing times | queueingTime(packetPulled) | histogram, vector | s | none |
incomingDataRate | incoming datarate | throughput(packetPushStarted) | vector | bps | linear |
flowQueueingTime | flow queueing times | queueingTime(demuxFlow(packetPulled)) | histogram, vector | s | none |
incomingPacketLengths | incoming packet lengths | packetLength(packetPushStarted) | sum, histogram, vector | b | none |
flowIncomingDataRate | flow specific incoming data rate | throughput(flowPacketLength(demuxFlow(packetPushStarted))) | vector | bps | linear |
outgoingDataRate | outgoing datarate | throughput(packetPulled) | vector | bps | linear |
outgoingPacketLengths | outgoing packet lengths | packetLength(packetPulled) | sum, histogram, vector | b | none |
droppedPacketLengthsQueueOverflow | dropped packet lengths: queue overflow | packetLength(packetDropReasonIsQueueOverflow(packetDropped)) | sum, vector | b | none |
flowOutgoingDataRate | flow specific outgoing data rate | throughput(flowPacketLength(demuxFlow(packetPulled))) | vector | bps | linear |
incomingPackets | incoming packets | packetPushStarted | count | pk | |
outgoingPackets | outgoing packets | packetPulled | count | pk |
Direct method calls (observed)
call to | function | info |
---|---|---|
EthernetMac | inet::EthernetMac::handleCanPullPacketChanged | handleCanPullPacketChanged |
Ieee8021qCreditBasedShaper | inet::queueing::CreditBasedGate::handleCanPullPacketChanged | handleCanPullPacketChanged |
PcpTrafficClassClassifier | inet::PcpTrafficClassClassifier::handleCanPushPacketChanged | handleCanPushPacketChanged |
Ppp | inet::Ppp::handleCanPullPacketChanged | handleCanPullPacketChanged |
PacketBuffer | inet::queueing::PacketBuffer::addPacket | addPacket |
PacketBuffer | inet::queueing::PacketBuffer::removePacket | removePacket |
PriorityBuffer | inet::queueing::PacketBuffer::addPacket | addPacket |
PriorityBuffer | inet::queueing::PacketBuffer::removePacket | removePacket |
PriorityClassifier | inet::queueing::PriorityClassifier::handleCanPushPacketChanged | handleCanPushPacketChanged |
WrrClassifier | inet::queueing::WrrClassifier::handleCanPushPacketChanged | handleCanPushPacketChanged |
PacketMultiplexer | inet::queueing::PacketMultiplexer::handleCanPushPacketChanged | handleCanPushPacketChanged |
RedDropper | inet::queueing::RedDropper::handleCanPushPacketChanged | handleCanPushPacketChanged |
RedDropper | inet::queueing::RedDropper::receiveSignal | packetPulled |
FlowMeasurementStarter | inet::queueing::FlowMeasurementStarter::handleCanPushPacketChanged | handleCanPushPacketChanged |
PeriodicGate | inet::queueing::PeriodicGate::handleCanPullPacketChanged | handleCanPullPacketChanged |
PacketQueue | inet::queueing::PacketQueue::pushPacket | pushPacket |
PriorityScheduler | inet::queueing::PriorityScheduler::handleCanPullPacketChanged | handleCanPullPacketChanged |
WrrScheduler | inet::queueing::WrrScheduler::handleCanPullPacketChanged | handleCanPullPacketChanged |
InstantServer | inet::queueing::InstantServer::handleCanPullPacketChanged | handleCanPullPacketChanged |
PacketServer | inet::queueing::PacketServer::handleCanPullPacketChanged | handleCanPullPacketChanged |
TokenBasedServer | inet::queueing::TokenBasedServer::handleCanPullPacketChanged | handleCanPullPacketChanged |
TokenBasedServer | inet::queueing::TokenBasedServer::handleCanPushPacketChanged | handleCanPushPacketChanged |
ActivePacketSink | inet::queueing::ActivePacketSink::handleCanPullPacketChanged | handleCanPullPacketChanged |
ActivePacketSource | inet::queueing::ActivePacketSource::handleCanPushPacketChanged | handleCanPushPacketChanged |
QueueBasedTokenGenerator | inet::queueing::QueueBasedTokenGenerator::receiveSignal | packetPulled |
Called methods (observed)
function | info | call from |
---|---|---|
inet::queueing::PacketQueue::handlePacketRemoved | handlePacketRemoved | PacketBuffer, PriorityBuffer |
inet::queueing::PacketQueue::pullPacket | pullPacket | inet.examples.inet.netperfmeter.REDQueue, Ieee8021qCreditBasedShaper, PeriodicGate, RedDropperQueue, PriorityScheduler, WrrScheduler, InstantServer, PacketServer, TokenBasedServer, ActivePacketSink |
inet::queueing::PacketQueue::pushPacket | pushPacket | LayeredEthernetInterface, EthernetCutthroughInterface, PcpTrafficClassClassifier, PriorityClassifier, WrrClassifier, PacketMultiplexer, RedDropper, FlowMeasurementStarter, PacketQueue, TokenBasedServer, ActivePacketSource |
inet::queueing::PacketQueue::removeAllPackets | removeAllPackets | EthernetMacLayer |
Incoming messages (observed)
gate | msg | kind | ctrl | srcModule | tags |
---|---|---|---|---|---|
in | Packet | 0 | UdpSocketIo | DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, TosInd, TransportProtocolInd | |
in | Packet | 1 | TcpServerSocketIo |
Pulled out messages (observed)
Pushed in messages (observed)
Packet operations (observed)
chunkType | packetAction |
---|---|
BytesChunk | peekDataAt |
Region Tagging operations (observed)
tagType | tagAction |
---|---|
FlowTag | mapAllTags |
PacketEventTag | mapAllTagsForUpdate |
QueueingTimeTag | mapAllTagsForUpdate |
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. If a packet dropper // function is not used and any queue capacity parameter is specified then the // queue provides back pressure towards its source. // // 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 pulled 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. // // Some often used packet queue variants such as ~DropTailQueue are implemented // as dervide modules. // // Some notable packet dropper functions are: ~PacketAtCollectionBeginDropper, // ~PacketAtCollectionEndDropper, ~PacketWithHighestOwnerModuleIdDropper, // ~PacketWithLowestModuleIdDropper. // // Some notable packet comparator functions are: ~PacketUserPriorityComparator, // ~PacketCreationTimeComparator, ~PacketEligibilityTimeComparator. // // @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\npulled %o removed %r dropped %d"); @class(PacketQueue); @signal[packetPushStarted](type=inet::Packet); @signal[packetPushEnded](type=inet::Packet?); @signal[packetPulled](type=inet::Packet); @signal[packetRemoved](type=inet::Packet); @signal[packetDropped](type=inet::Packet); // the statistical value is the number of packets in the queue @statistic[queueLength](title="queue length"; source=warmup(atomic(constant0(packetPushEnded) + count(packetPushStarted) - count(packetPulled) - count(packetRemoved) - count(packetDropped))); record=last,max,timeavg,vector; unit=pk; interpolationmode=sample-hold; autoWarmupFilter=false); // the statistical value is the total bit length of all packets in the queue @statistic[queueBitLength](title="queue bit length"; source=warmup(atomic(constant0(packetPushEnded) + sum(packetLength(packetPushStarted)) - sum(packetLength(packetPulled)) - sum(packetLength(packetRemoved)) - sum(packetLength(packetDropped)))); record=last,max,timeavg,vector; unit=b; interpolationmode=sample-hold; autoWarmupFilter=false); // the statistical value is the queueing time of packets @statistic[queueingTime](title="queueing times"; source=queueingTime(packetPulled); record=histogram,vector; unit=s; interpolationmode=none); // the statistical value is the incoming packet @statistic[incomingPackets](title="incoming packets"; source=packetPushStarted; record=count; unit=pk); // the statistical value is the length of the incoming packet @statistic[incomingPacketLengths](title="incoming packet lengths"; source=packetLength(packetPushStarted); record=sum,histogram,vector; unit=b; interpolationmode=none); // the statistical value is the data rate of the incoming packets @statistic[incomingDataRate](title="incoming datarate"; source=throughput(packetPushStarted); record=vector; unit=bps; interpolationmode=linear); // the statistical value is the outgoing packet @statistic[outgoingPackets](title="outgoing packets"; source=packetPulled; record=count; unit=pk); // the statistical value is the length of the outgoing packet @statistic[outgoingPacketLengths](title="outgoing packet lengths"; source=packetLength(packetPulled); record=sum,histogram,vector; unit=b; interpolationmode=none); // the statistical value is the data rate of the outgoing packets @statistic[outgoingDataRate](title="outgoing datarate"; source=throughput(packetPulled); record=vector; unit=bps; interpolationmode=linear); // the statistical value is the packet that is dropped due to queue overflow @statistic[droppedPacketsQueueOverflow](title="dropped packets: queue overflow"; source=packetDropReasonIsQueueOverflow(packetDropped); record=count; unit=pk; interpolationmode=none); // the statistical value is the length of the packet that is dropped due to queue overflow @statistic[droppedPacketLengthsQueueOverflow](title="dropped packet lengths: queue overflow"; source=packetLength(packetDropReasonIsQueueOverflow(packetDropped)); record=sum,vector; unit=b; interpolationmode=none); // the statistical value is the flow specific queueing time of packets @statistic[flowQueueingTime](title="flow queueing times"; source=queueingTime(demuxFlow(packetPulled)); record=histogram,vector; unit=s; interpolationmode=none); // the statistical value is the flow specific data rate of the incoming packets @statistic[flowIncomingDataRate](title="flow specific incoming data rate"; source=throughput(flowPacketLength(demuxFlow(packetPushStarted))); record=vector; unit=bps; interpolationmode=linear); // the statistical value is the flow specific data rate of the outgoing packets @statistic[flowOutgoingDataRate](title="flow specific outgoing data rate"; source=throughput(flowPacketLength(demuxFlow(packetPulled))); record=vector; unit=bps; interpolationmode=linear); @defaultStatistic(queueLength:vector); }File: src/inet/queueing/queue/PacketQueue.ned