PacketBuffer¶
Package: inet.queueing.buffer
simple module PacketBuffer
Provides packet storage for sharing and optimizing storage space between multiple packet queues. When a packet buffer becomes overloaded, the packet dropping strategy can drop any number of packets from any number of connected packet queues.
See also: IPacketQueue
Inheritance diagram¶
Known subclasses¶
Name |
Type |
Description |
|---|---|---|
simple module |
This buffer drops packets among the connected packet queues based on their module ID. |
Extends¶
Name |
Type |
Description |
|---|---|---|
simple module |
Base module for various packet buffer modules which maintains a few statistics. |
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
displayStringTextFormat |
string |
“contains {numPackets} pk ({totalLength})\nadded {numAddedPackets} removed {numRemovedPackets} dropped {numDroppedPackets}” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
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 buffer 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 |
Properties¶
Name |
Value |
Description |
|---|---|---|
class |
PacketBuffer |
|
display |
i=block/buffer |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
in |
input |
||
out |
output |
Signals¶
Name |
Type |
Unit |
Description |
|---|---|---|---|
packetAdded |
|||
packetDropped |
|||
packetRemoved |
Statistics¶
Name |
Title |
Source |
Record |
Unit |
Interpolation Mode |
Description |
|---|---|---|---|---|---|---|
addedPacketLengths |
added packet lengths |
packetLength(packetAdded) |
sum,vector |
b |
none |
the statistical value is the length of the added packet |
addedPackets |
added packets |
packetAdded |
count |
pk |
the statistical value is the added packet |
|
bufferBitLength |
buffer bit length |
warmup(sum(packetLength(packetAdded)) - sum(packetLength(packetRemoved)) - sum(packetLength(packetDropped))) |
last,max,timeavg,vector |
b |
sample-hold |
the statistical value is the total bit length of all packets in the buffer |
bufferLength |
buffer length |
warmup(count(packetAdded) - count(packetRemoved) - count(packetDropped)) |
last,max,timeavg,vector |
pk |
sample-hold |
the statistical value is the number of packets in the buffer |
droppedPacketLengthsQueueOverflow |
dropped packet lengths: queue overflow |
packetLength(packetDropReasonIsQueueOverflow(packetDropped)) |
sum,vector |
b |
none |
the statistical value is the length of the packet that is dropped due to queue overflow |
droppedPacketsQueueOverflow |
dropped packets: queue overflow |
packetDropReasonIsQueueOverflow(packetDropped) |
count |
pk |
none |
the statistical value is the packet that is dropped due to queue overflow |
removedPacketLengths |
removed packet lengths |
packetLength(packetRemoved) |
sum,vector |
pk |
none |
the statistical value is the length of the removed packet |
removedPackets |
removed packets |
packetRemoved |
count |
pk |
the statistical value is the removed packet |
Source code¶
//
// Provides packet storage for sharing and optimizing storage space
// between multiple packet queues. When a packet buffer becomes overloaded, the
// packet dropping strategy can drop any number of packets from any number of
// connected packet queues.
//
// @see ~IPacketQueue
//
simple PacketBuffer extends PacketBufferBase like IPacketBuffer
{
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 buffer 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
@class(PacketBuffer);
@display("i=block/buffer");
@signal[packetAdded](type=inet::Packet);
@signal[packetRemoved](type=inet::Packet);
@signal[packetDropped](type=inet::Packet);
// the statistical value is the added packet
@statistic[addedPackets](title="added packets"; source=packetAdded; record=count; unit=pk);
// the statistical value is the length of the added packet
@statistic[addedPacketLengths](title="added packet lengths"; source=packetLength(packetAdded); record=sum,vector; unit=b; interpolationmode=none);
// the statistical value is the removed packet
@statistic[removedPackets](title="removed packets"; source=packetRemoved; record=count; unit=pk);
// the statistical value is the length of the removed packet
@statistic[removedPacketLengths](title="removed packet lengths"; source=packetLength(packetRemoved); record=sum,vector; unit=pk; interpolationmode=none);
// the statistical value is the number of packets in the buffer
@statistic[bufferLength](title="buffer length"; source=warmup(count(packetAdded) - count(packetRemoved) - count(packetDropped)); record=last,max,timeavg,vector; unit=pk; interpolationmode=sample-hold);
// the statistical value is the total bit length of all packets in the buffer
@statistic[bufferBitLength](title="buffer bit length"; source=warmup(sum(packetLength(packetAdded)) - sum(packetLength(packetRemoved)) - sum(packetLength(packetDropped))); record=last,max,timeavg,vector; unit=b; interpolationmode=sample-hold; autoWarmupFilter=false);
// 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);
}