📄 timedsource.hh
字号:
#ifndef CLICK_TIMEDSOURCE_HH#define CLICK_TIMEDSOURCE_HH#include <click/element.hh>#include <click/timer.hh>CLICK_DECLS/*=cTimedSource([INTERVAL, DATA, I<KEYWORDS>])=s sourcesperiodically generates a packet=dCreates packets consisting of DATA. Pushes such a packet out its single outputabout once every INTERVAL seconds. INTERVAL has millisecond precision. DefaultINTERVAL is 500 milliseconds; default DATA is at least 64 bytes long.Keyword arguments are:=over 8=item DATAString. Same as the DATA argument.=item INTERVALNumber of seconds. Same as the INTERVAL argument.=item LIMITInteger. Stops sending after LIMIT packets are generated; but if LIMIT isnegative, sends packets forever.=item STOPBoolean. If true, then stop the driver once LIMIT packets are sent. Default isfalse.=back=e TimedSource(INTERVAL 0.333) -> ...=h data read/writeReturns or sets the DATA parameter.=h interval read/writeReturns or sets the INTERVAL parameter.=a InfiniteSource */class TimedSource : public Element { public: TimedSource(); ~TimedSource(); const char *class_name() const { return "TimedSource"; } const char *processing() const { return PUSH; } int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); void cleanup(CleanupStage); void add_handlers(); void run_timer(); private: Packet *_packet; uint32_t _interval; int _limit; int _count; bool _active : 1; bool _stop : 1; Timer _timer; String _data; static String read_param(Element *, void *); static int change_param(const String &, Element *, void *, ErrorHandler *); };CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -