📄 chuckcheck.hh
字号:
#ifndef CLICK_CHUCKCHECK_HH#define CLICK_CHUCKCHECK_HH#include <click/element.hh>CLICK_DECLS/*=cChuckCheck()=s debuggingCollects information about packets=dChuckCheck collects information about the timestamps and source addresses onpassing IP packets, and makes that information available via the `info'handler. Packets must have their IP header annotations set.=nWarning: This element does not perform the locking required for multiprocessormachines!!=h info read-onlyReturns a binary string represented the information collected on the last 4096packets received. (If less than 4096 packets have been received, returns asmuch information as it has.)The string consists of a number of 4-byte unsigned integers in host byteorder. The first integer is N, the number of records in the rest of thestring. After this comes N information records. Each record looks like this: 0 4 8 12 +--------------+--------------+--------------+--------------+ | packet ID |timestamp sec |timestamp usec| source addr | +--------------+--------------+--------------+--------------+The fields are:=over 5=item C<packet ID>The identification number of this packet. The first packet ChuckCheck receivesgets ID number 0, and packets are sequentially numbered after that. The readercan use packet ID numbers to differentiate new information from information ithas already processed.=item C<timestamp sec>, C<timestamp usec>The time when the packet arrived at the ChuckCheck element.=item C<source addr>The packet's IP source address.=backThe records are returned in increasing, sequential order by packet ID.*/class ChuckCheck : public Element { struct Stat { struct timeval time; unsigned saddr; }; enum { BUCKETS = 4096 }; Stat _info[BUCKETS]; unsigned _head; unsigned _tail; unsigned _head_id; static String read_handler(Element *, void *); inline void count(Packet *); public: ChuckCheck(); ~ChuckCheck(); const char *class_name() const { return "ChuckCheck"; } const char *processing() const { return AGNOSTIC; } void add_handlers(); int initialize(ErrorHandler *); void push(int, Packet *); Packet *pull(int); };CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -