📄 pokehandlers.hh
字号:
// -*- mode: c++; c-basic-offset: 4 -*-#ifndef CLICK_POKEHANDLERS_HH#define CLICK_POKEHANDLERS_HH#include <click/element.hh>#include <click/timer.hh>CLICK_DECLS/*=cPokeHandlers(DIRECTIVE, ...)=s debuggingcalls write handlers at specified times=ioNone=dRuns read and write handlers at specified times. Each configuration argumentis a directive, taken from this list:=over 8=item `read HANDLER'Call a read handler and report its result. At user level, the result isprinted on standard error; in a Linux kernel, it is printed to/var/log/messages. HANDLER should be either a global read handler name, or`ELEMENT.HNAME', where ELEMENT is an element name and HNAME the name of one ofits read handlers.=item `write HANDLER [VALUE]'Call a write handler with a given value. At user level, errors reported bywrite handlers are printed to standard error. In the Linux kernel module, theyare printed to /var/log/messages (accessible through dmesg(1)) and to/proc/click/errors.=item `stop'Stop the driver.=item `wait DELAY'Wait for DELAY seconds before continuing to the next directive.=item `pause'Wait until the `unpause' write handler is called, then continue to the next directive.=item `loop'Start over from the first directive.=back=e PokeHandlers(write red.max_p 0.8, wait 1.5, // delay for 1.5 seconds write red.max_p 0.5);=h unpause write-onlyIf paused, continue to next directive. Otherwise, there is no effect.=h paused read-onlyReturns `true' if paused, else `false'.=a dmesg(1) */class PokeHandlers : public Element { public: PokeHandlers(); ~PokeHandlers(); const char *class_name() const { return "PokeHandlers"; } int configure(Vector<String> &, ErrorHandler *); int initialize(ErrorHandler *); bool can_live_reconfigure() const { return true; } void add_handlers(); private: static Element * const STOP_MARKER; static Element * const LOOP_MARKER; static Element * const PAUSE_MARKER; int _pos; bool _paused; Vector<Element *> _h_element; Vector<String> _h_handler; Vector<String> _h_value; Vector<int> _h_timeout; Timer _timer; static void timer_hook(Timer *, void *); void add(Element *, const String &, const String &, int); void unpause(); static String read_param(Element *, void *); static int write_param(const String &, Element *, void *, ErrorHandler *);};CLICK_ENDDECLS#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -