Skip to content
Eddie Kohler edited this page Oct 17, 2017 · 5 revisions

MixedQueue Element Documentation

NAME

MixedQueue — Click element; stores packets in a FIFO/LIFO queue

SYNOPSIS

MixedQueue
MixedQueue(CAPACITY)

Ports: 2 inputs, 1-2 outputs

DESCRIPTION

Stores incoming packets in a mixed first-in-first-out/last-in-first-out queue. In particular, MixedQueue's first input is FIFO, but its second input is LIFO. The queue is full when it holds CAPACITY packets. When full, MixedQueue drops incoming FIFO packets, but drops the oldest packet to make room for incoming LIFO packets. The default for CAPACITY is 1000.

MixedQueue notifies interested parties when it becomes empty and when a formerly-empty queue receives a packet. The empty notification takes place some time after the queue goes empty, to prevent thrashing for queues that hover around 1 or 2 packets long.

EXAMPLES

This diagram shows the state of a MixedQueue after 5 pushes, of packets A through E. The queue's head is on the left.

     initial state        empty
     push(0, A)           [A]
     push(0, B)           [A B]
     push(1, C)           [C A B]
     push(0, D)           [C A B D]
     push(1, E)           [E C A B D]

SYNCHRONIZATION

Note for multithreaded Click: Unlike Queue, whose input and output ports need not be synchronized, MixedQueue requires synchronization between its LIFO input and its output. You will need to prevent a thread from pushing to the LIFO input at the same time that a different thread pulls from the output.

ELEMENT HANDLERS

  • length (read-only) — Returns the current number of packets in the queue.
  • highwater_length (read-only) — Returns the maximum number of packets that have ever been in the queue at once.
  • capacity (read/write) — Returns or sets the queue's capacity.
  • drops (read-only) — Returns the number of packets dropped by the queue so far.
  • reset_counts (write-only) — When written, resets the drops and highwater_length counters.
  • reset (write-only) — When written, drops all packets in the queue.

SEE ALSO

Queue, SimpleQueue, FrontDropQueue

Generated by click-elem2man from ../elements/standard/mixedqueue.hh:7 on 2017/10/17.

Clone this wiki locally