timedsource.hh

来自「Click is a modular router toolkit. To us」· HH 代码 · 共 101 行

HH
101
字号
#ifndef CLICK_TIMEDSOURCE_HH#define CLICK_TIMEDSOURCE_HH#include <click/element.hh>#include <click/timer.hh>CLICK_DECLS/*=cTimedSource([INTERVAL, DATA, I<KEYWORDS>])=s basicsourcesperiodically generates a packet=dCreates packets consisting of DATA. Pushes such a packet out its single outputabout once every INTERVAL seconds. 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 INTERVALTime. Same as the INTERVAL argument.=item LIMITInteger. Stops sending after LIMIT packets are generated; but if LIMIT isnegative, sends packets forever.=item HEADROOMUnsigned integer. Sets the amount of headroom on generated packets. Default isthe default packet headroom.=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 *port_count() const		{ return PORTS_0_1; }  const char *processing() const		{ return PUSH; }  int configure(Vector<String> &, ErrorHandler *);  int initialize(ErrorHandler *);  void cleanup(CleanupStage);  void add_handlers();  void run_timer(Timer *); private:    Packet *_packet;    Timestamp _interval;    int _limit;    int _count;    bool _active;    bool _stop;    Timer _timer;    String _data;    uint32_t _headroom;    enum { h_data, h_interval, h_active, h_reset, h_headroom };    static String read_param(Element *, void *);    static int change_param(const String &, Element *, void *, ErrorHandler *);};CLICK_ENDDECLS#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?