-
Notifications
You must be signed in to change notification settings - Fork 82
/
simplepullswitch.hh
67 lines (42 loc) · 1.64 KB
/
simplepullswitch.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
#ifndef CLICK_SIMPLEPULLSWITCH_HH
#define CLICK_SIMPLEPULLSWITCH_HH
#include <click/element.hh>
CLICK_DECLS
/*
=c
SimplePullSwitch([INPUT])
=s scheduling
forwards pull requests to settable input, without notification
=d
On every pull, SimplePullSwitch returns the packet pulled from one of its
input ports -- specifically, INPUT. The default INPUT is zero; negative INPUTs
mean always return a null packet. You can change INPUT with a write handler.
PullSwitch has an unlimited number of inputs.
=h switch read/write
Return or set the K parameter.
=h CLICK_LLRPC_GET_SWITCH llrpc
Argument is a pointer to an integer, in which the Switch's K parameter is
stored.
=h CLICK_LLRPC_SET_SWITCH llrpc
Argument is a pointer to an integer. Sets the K parameter to that integer.
=a PullSwitch, StaticPullSwitch, PrioSched, RoundRobinSched, StrideSched,
Switch */
class SimplePullSwitch : public Element { public:
SimplePullSwitch() CLICK_COLD;
~SimplePullSwitch() CLICK_COLD;
const char *class_name() const override { return "SimplePullSwitch"; }
const char *port_count() const override { return "-/1"; }
const char *processing() const override { return PULL; }
int configure(Vector<String> &conf, ErrorHandler *errh) CLICK_COLD;
bool can_live_reconfigure() const { return true; }
void add_handlers() CLICK_COLD;
virtual void set_input(int input);
Packet *pull(int);
int llrpc(unsigned command, void *data);
protected:
int _input;
static String read_param(Element *, void *) CLICK_COLD;
static int write_param(const String &, Element *, void *, ErrorHandler *) CLICK_COLD;
};
CLICK_ENDDECLS
#endif