PacketBuffer

Package: inet.queueing.buffer

PacketBuffer

simple module

This module 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

PacketBuffer

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Known subclasses

Name Type Description
PriorityBuffer simple module

This buffer drops packets among the connected packet queues based on their module id.

Extends

Name Type Description
PacketBufferBase simple module

This is a base module for various packet buffer modules which maintains a few statistics.

Parameters

Name Type Default value Description
displayStringTextFormat string "contains %p pk (%l)\nadded %a 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 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
display i=block/buffer
class PacketBuffer

Gates

Name Direction Size Description
in input
out output

Signals

Name Type Unit
packetRemoved inet::Packet
packetDropped inet::Packet
packetAdded inet::Packet

Statistics

Name Title Source Record Unit Interpolation Mode
packetRemoved packets removed count, sum(packetBytes), vector(packetBytes) none
packetDropQueueOverflow packet drops: queue overflow packetDropReasonIsQueueOverflow(packetDropped) count, sum(packetBytes), vector(packetBytes) none
packetAdded packets added count, sum(packetBytes), vector(packetBytes) none

Source code

//
// This module 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);
        @statistic[packetAdded](title="packets added"; 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);
}
File: src/inet/queueing/buffer/PacketBuffer.ned