cpuqueue.hh
来自「COPE the first practical network coding 」· HH 代码 · 共 63 行
HH
63 行
#ifndef CPUQUEUE_HH#define CPUQUEUE_HH/* * =c * CPUQueue * CPUQueue(CAPACITY) * =s storage * stores packets in FIFO queues. * =d * * Stores incoming packets in a first-in-first-out queue. Each CPU has its own * queue. The incoming packet is always enqueued onto the queue of the CPU * calling the push method. Drops incoming packets if the queue already holds * CAPACITY packets. The default for CAPACITY is 128. * * =a Queue */#include <click/element.hh>class CPUQueue : public Element { struct { Packet **_q; unsigned _head; unsigned _tail; unsigned _pad[5]; } _q[NUM_CLICK_CPUS]; unsigned _last; unsigned _capacity; unsigned _drops; int next_i(int i) const { return (i!=_capacity ? i+1 : 0); } int prev_i(int i) const { return (i!=0 ? i-1 : _capacity); } Packet *deq(int); static String read_handler(Element *, void *); public: CPUQueue(); ~CPUQueue(); const char *class_name() const { return "CPUQueue"; } const char *processing() const { return PUSH_TO_PULL; } void notify_noutputs(int); int initialize(ErrorHandler *); void cleanup(CleanupStage); unsigned drops() const { return _drops; } unsigned capacity() const { return _capacity; } int configure(Vector<String> &, ErrorHandler *); void push(int port, Packet *); Packet *pull(int port); void add_handlers();};#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?