1#ifndef CLICK_HANDLER_HH
2#define CLICK_HANDLER_HH 1
13typedef int (*HandlerCallback)(
int operation,
String &data,
Element *element,
16typedef int (*WriteHandlerCallback)(
const String &data,
Element *element,
54 f_read_comprehensive = 0x0008,
55 f_write_comprehensive = 0x0010,
76 return op ==
f_write ? _write_user_data : _read_user_data;
81 return _read_user_data;
86 return _write_user_data;
90 inline void *user_data1() const CLICK_DEPRECATED;
91 inline
void *user_data2() const CLICK_DEPRECATED;
165 return _flags &
f_raw;
224 return the_blank_handler;
244 h_driver_flag_0 = f_driver0,
246 h_user_flag_shift = f_user_shift,
248 h_read_comprehensive = f_read_comprehensive,
249 h_write_comprehensive = f_write_comprehensive,
252 enum DeprecatedFlags {
265 USER_FLAG_SHIFT = f_user_shift,
268 enum CLICK_DEPRECATED {
281 inline String __call_read(
Element *e,
void *new_user_data)
const {
282 assert((_flags & (
f_read | f_read_comprehensive)) ==
f_read);
283 return _read_hook.r(e, new_user_data);
292 ReadHandlerCallback r;
296 WriteHandlerCallback w;
298 void *_read_user_data;
299 void *_write_user_data;
304 static const Handler *the_blank_handler;
308 inline void combine(
const Handler &x);
309 inline bool compatible(
const Handler &x)
const;
316#define LARGEST_HANDLER_WRITE 65536
318typedef HandlerCallback HandlerHook CLICK_DEPRECATED;
319typedef ReadHandlerCallback ReadHandlerHook CLICK_DEPRECATED;
320typedef WriteHandlerCallback WriteHandlerHook CLICK_DEPRECATED;
324Handler::user_data1()
const
326 return _read_user_data;
330Handler::user_data2()
const
332 return _write_user_data;
Base class for Click elements.
Definition element.hh:42
Error reporting class.
Definition error.hh:90
Represents a router's handlers.
Definition handler.hh:19
bool allow_concurrent_threads() const
Test if this handler can execute concurrently with router threads.
Definition handler.hh:142
const String & name() const
Return this handler's name.
Definition handler.hh:62
static const Handler * blank_handler()
Returns a handler incapable of doing anything.
Definition handler.hh:223
uint32_t flags() const
Return this handler's flags.
Definition handler.hh:69
String unparse_name(Element *e) const
Unparse this handler's name.
Definition router.cc:1733
bool visible() const
Test if this is a public read or write handler.
Definition handler.hh:130
int call_write(const String &value, Element *e, ErrorHandler *errh) const
Call a write handler.
Definition router.cc:1709
bool readable() const
Test if this is a valid read handler.
Definition handler.hh:96
bool read_param() const
Test if this is a valid read handler that may accept parameters.
Definition handler.hh:102
void * user_data(int op) const
Return this handler's callback data.
Definition handler.hh:75
bool raw() const
Test if spaces should be preserved when calling this handler.
Definition handler.hh:164
Flags
Definition handler.hh:21
@ f_uncommon
User interfaces should not display handler by default.
Definition handler.hh:38
@ f_calm
Read handler value changes rarely.
Definition handler.hh:40
@ f_expensive
Read handler is expensive to call.
Definition handler.hh:41
@ f_special
These flags may not be set by Router::set_handler_flags().
Definition handler.hh:56
@ f_read
Handler supports read operations.
Definition handler.hh:22
@ f_exclusive
Handler is exclusive (the default): router threads must stop while it is called.
Definition handler.hh:25
@ f_button
Write handler ignores data.
Definition handler.hh:42
@ f_user0
First uninterpreted handler flag available for element-specific use. Equals 1 << f_user_shift.
Definition handler.hh:49
@ f_raw
Don't add newline to results.
Definition handler.hh:31
@ f_deprecated
outside the router configuration).
Definition handler.hh:36
@ f_nonexclusive
Handler is nonexclusive: router threads don't need to stop while it is called.
Definition handler.hh:28
@ f_read_param
Read handler takes parameters.
Definition handler.hh:24
@ f_write_private
Write handler private (invisible.
Definition handler.hh:34
@ f_read_private
Read handler private (invisible outside the router configuration).
Definition handler.hh:32
@ f_driver1
Uninterpreted handler flags available for drivers.
Definition handler.hh:46
@ f_checkbox
Read/write handler is boolean and should be rendered as a checkbox.
Definition handler.hh:43
@ f_write
Handler supports write operations.
Definition handler.hh:23
void * write_user_data() const
Return this handler's write callback data.
Definition handler.hh:85
String call_read(Element *e, ErrorHandler *errh=0) const
Call a read handler without parameters.
Definition handler.hh:186
bool write_visible() const
Test if this is a public write handler.
Definition handler.hh:125
void * read_user_data() const
Return this handler's read callback data.
Definition handler.hh:80
bool read_visible() const
Test if this is a public read handler.
Definition handler.hh:111
bool allow_concurrent_handlers() const
Test if this handler can execute concurrently with other handlers.
Definition handler.hh:136
bool writable() const
Test if this is a valid write handler.
Definition handler.hh:116
String call_read(Element *e, const String ¶m, ErrorHandler *errh) const
Call a read handler, possibly with parameters.
Definition router.cc:1691
A router configuration.
Definition router.hh:28
A string of characters.
Definition string.hh:22