📄 mixedqueue.hh
字号:
// -*- c-basic-offset: 4 -*-#ifndef CLICK_MIXEDQUEUE_HH#define CLICK_MIXEDQUEUE_HH#include "notifierqueue.hh"CLICK_DECLS/*=cMixedQueueMixedQueue(CAPACITY)=s storagestores packets in a FIFO/LIFO queue=dStores 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 dropsincoming FIFO packets, but drops the oldest packet to make room for incomingLIFO packets. The default for CAPACITY is 1000.MixedQueue notifies interested parties when it becomes empty and when aformerly-empty queue receives a packet. The empty notification takes placesome time after the queue goes empty, to prevent thrashing for queues thathover around 1 or 2 packets long.=eThis diagram shows the state of a MixedQueue after 5 pushes, of packets Athrough 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]=head1 SYNCHRONIZATIONNote for multithreaded Click: Unlike Queue, whose input and output ports neednot be synchronized, MixedQueue requires synchronization between its LIFOinput and its output. You will need to prevent a thread from pushing to theLIFO input at the same time that a different thread pulls from the output.=h length read-onlyReturns the current number of packets in the queue.=h highwater_length read-onlyReturns the maximum number of packets that have ever been in the queue at once.=h capacity read/writeReturns or sets the queue's capacity.=h drops read-onlyReturns the number of packets dropped by the queue so far.=h reset_counts write-onlyWhen written, resets the C<drops> and C<highwater_length> counters.=h reset write-onlyWhen written, drops all packets in the queue.=a Queue, SimpleQueue, FrontDropQueue */class MixedQueue : public NotifierQueue { public: MixedQueue(); ~MixedQueue(); const char *class_name() const { return "MixedQueue"; } void *cast(const char *); void push(int port, Packet *); };CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -