-
Notifications
You must be signed in to change notification settings - Fork 321
MixedQueue
MixedQueue — Click element; stores packets in a FIFO/LIFO queue
MixedQueue
MixedQueue(CAPACITY)
Ports: 2 inputs, 1-2 outputs
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.
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]
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.
- 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
andhighwater_length
counters. - reset (write-only) — When written, drops all packets in the queue.
Queue, SimpleQueue, FrontDropQueue
Generated by click-elem2man from ../elements/standard/mixedqueue.hh:7
on 2017/10/17.