Table Of Contents
Table Of Contents

Priority Buffer

The PriorityBuffer module extends PacketBuffer by configuring a packet drop strategy. By default, when the buffer is full, packets belonging to the last queue are dropped first. This is the behavior that can be changed by the packet drop strategy.

In this example network, packets are produced at random intervals by two active packet sources (ActivePacketSource). The packet packet sources push packets into two queues (PacketQueue). The queues share a PriorityBuffer with a packet capacity of 2. Packets are popped from the queues at random intervals by two active packet sinks (ActivePacketSink). When the buffer becomes full, it drops packets from the second queue first.

network PriorityBufferTutorialStep
        buffer: PriorityBuffer {
        producer1: ActivePacketSource {
        producer2: ActivePacketSource {
        queue1: PacketQueue {
            bufferModule = "^.buffer";
        queue2: PacketQueue {
            bufferModule = "^.buffer";
        collector1: ActivePacketSink {
        collector2: ActivePacketSink {
        producer1.out -->;
        queue1.out -->;
        producer2.out -->;
        queue2.out -->;
[Config PriorityBuffer]
network = PriorityBufferTutorialStep
sim-time-limit = 10s

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