Table Of Contents
Table Of Contents

Dropping Packets from a Finite Queue

The DropTailQueue module extends PacketQueue by specifying a packet capacity, and setting a packet dropper function. By default, the packet capacity is set to 100, and packets are dropped from the end of the queue.

In this example network, packets are created at random intervals by an active packet source (ActivePacketSource) The packets are pushed into a drop-tail queue (DropTailQueue) with a capacity of 4 packets. The packets are popped from the queue at random intervals by an active packet sink (ActivePacketSink).

network DropTailQueueTutorialStep
{
    @display("bgb=700,200");
    submodules:
        producer: ActivePacketSource {
            @display("p=100,100");
        }
        queue: DropTailQueue {
            @display("p=325,100");
        }
        collector: ActivePacketSink {
            @display("p=550,100");
        }
    connections allowunconnected:
        producer.out --> queue.in;
        queue.out --> collector.in;
}
[Config DropTailQueue]
network = DropTailQueueTutorialStep
sim-time-limit = 10s

*.producer.packetLength = 1B
*.producer.productionInterval = uniform(0s, 1s)
*.queue.packetCapacity = 4
*.collector.collectionInterval = uniform(0s, 2s)