📄 infinitesource.hh
字号:
#ifndef CLICK_INFINITESOURCE_HH#define CLICK_INFINITESOURCE_HH#include <click/element.hh>#include <click/task.hh>#include <click/notifier.hh>CLICK_DECLS/*=cInfiniteSource([DATA, LIMIT, BURST, ACTIVE?, I<KEYWORDS>])=s sourcesgenerates packets whenever scheduled=dCreates packets consisting of DATA. Pushes BURST such packets out its singleoutput every time it is scheduled (which will be often). Stops sending afterLIMIT packets are generated; but if LIMIT is negative, sends packets forever.Will send packets only if ACTIVE is true. (ACTIVE is true by default.) DefaultDATA is at least 64 bytes long. Default LIMIT is -1 (send packets forever).Default BURST is 1.Keyword arguments are:=over 8=item DATAString. Same as the DATA argument.=item DATASIZEInteger. If set, ensures the outgoing packet contains at least this many bytes.=item LIMITInteger. Same as the LIMIT argument.=item BURSTInteger. Same as the BURST argument.=item ACTIVEBoolean. Same as the ACTIVE? argument.=item STOPBoolean. If true, then stop the driver once LIMIT packets are sent. Default isfalse.=backTo generate a particular traffic pattern, use this element and RatedSourcein conjunction with PokeHandlers.=e InfiniteSource(\<0800>) -> Queue -> ...=nUseful for profiling and experiments. Packets' timestamp annotations are setto the current time.InfiniteSource listens for downstream full notification.=h count read-onlyReturns the total number of packets that have been generated.=h reset write-onlyResets the number of generated packets to 0. The InfiniteSource will thengenerate another LIMIT packets (if it is active).=h data read/writeReturns or sets the DATA parameter.=h datasize read/writeReturns or sets the DATASIZE parameter.=h limit read/writeReturns or sets the LIMIT parameter.=h burstsize read/writeReturns or sets the BURSTSIZE parameter.=h active read/writeMakes the element active or inactive.=aRatedSource, PokeHandlers */class InfiniteSource : public Element, public ActiveNotifier { public: InfiniteSource(); ~InfiniteSource(); const char *class_name() const { return "InfiniteSource"; } void *cast(const char *); const char *processing() const { return AGNOSTIC; } const char *flags() const { return "S1"; } void add_handlers(); int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); bool can_live_reconfigure() const { return true; } void cleanup(CleanupStage); bool run_task(); Packet *pull(int); protected: void setup_packet(); Packet *_packet; int _burstsize; int _limit; int _count; int _datasize; bool _active : 1; bool _stop : 1; Task _task; String _data; NotifierSignal _nonfull_signal; 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 + -