-
Notifications
You must be signed in to change notification settings - Fork 78
/
khandlerproxy.hh
102 lines (70 loc) · 2.55 KB
/
khandlerproxy.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#ifndef CLICK_KERNELHANDLERPROXY_HH
#define CLICK_KERNELHANDLERPROXY_HH
#include "elements/userlevel/handlerproxy.hh"
CLICK_DECLS
/*
=c
KernelHandlerProxy([I<KEYWORDS>])
=s control
proxies kernel module handlers at user level
=d
Provides one proxy handler for each handler in a Linux kernel module Click
configuration. The proxy handler for an element C<e>'s handler C<h> is named
`C<e.h>'. Reading KernelHandlerProxy's C<e.h> handler will return the result
of reading kernel element C<e>'s C<h> handler. Similarly, writing a string to
KernelHandlerProxy's C<e.h> handler will cause the proxy to write that string
to kernel element C<e>'s C<h> handler.
Keyword arguments are:
=over 8
=item VERBOSE
Boolean. If true, print chatter messages when read handlers fail. (Errors with
write handlers are reported to the supplied ErrorHandler, but read handlers
don't take an ErrorHandler argument.) Default is false.
=back
=n
KernelHandlerProxy does not decide ahead of time whether a given handler is
active. Thus, for example, KernelHandlerProxy can report that a handler exists
even when no corresponding element exists in the kernel configuration. Any
error will be reported when the handler is actually called.
=e
Click configuration:
proxy :: KernelHandlerProxy
ControlSocket(TCP, 8800, PROXY proxy, LOCALHOST true)
Interaction example:
% click-install -e 'x :: Idle'
% telnet localhost 8800
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Click::ControlSocket/1.3
READ list
200 Read handler 'list' OK
DATA 4
1
x
=a
SocketHandlerProxy
*/
class KernelHandlerProxy : public HandlerProxy { public:
KernelHandlerProxy() CLICK_COLD;
~KernelHandlerProxy() CLICK_COLD;
const char* class_name() const { return "KernelHandlerProxy"; }
void* cast(const char*);
int configure(Vector<String>&, ErrorHandler*) CLICK_COLD;
int check_handler(const String&, bool write, ErrorHandler* errh);
void add_handlers() CLICK_COLD;
int llrpc(unsigned, void*);
private:
bool _detailed_error_message;
bool _verbose;
bool _dot_h_checked;
bool _dot_h;
String handler_name_to_file_name(const String &str);
static int handler_hook(int, String&, Element*, const Handler*, ErrorHandler*);
static int star_write_handler(const String&, Element*, void*, ErrorHandler*) CLICK_COLD;
int complain(ErrorHandler*, const String&, int errcode, const String&);
int complain_about_open(ErrorHandler*, const String&, int);
int check_handler_name(const String&, ErrorHandler*);
};
CLICK_ENDDECLS
#endif