-
Notifications
You must be signed in to change notification settings - Fork 82
/
switch.hh
67 lines (43 loc) · 1.54 KB
/
switch.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_SWITCH_HH
#define CLICK_SWITCH_HH
#include <click/batchelement.hh>
CLICK_DECLS
/*
=c
Switch([OUTPUT])
=s classification
sends packet stream to settable output
=d
Switch sends every incoming packet to one of its output ports --
specifically, OUTPUT. The default OUTPUT is zero; negative OUTPUT means to
destroy input packets instead of forwarding them. You can change OUTPUT with a
write handler. Switch has an unlimited number of outputs.
=h switch read/write
Return or set the OUTPUT 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 StaticSwitch, PullSwitch, RoundRobinSwitch, StrideSwitch, HashSwitch,
RandomSwitch */
class Switch : public BatchElement { public:
Switch() CLICK_COLD;
const char *class_name() const override { return "Switch"; }
const char *port_count() const override { return "1/-"; }
const char *processing() const override { return PUSH; }
void add_handlers() CLICK_COLD;
int configure(Vector<String> &, ErrorHandler *) CLICK_COLD;
bool can_live_reconfigure() const { return true; }
void push(int, Packet *) override;
#if HAVE_BATCH
void push_batch(int, PacketBatch *) override;
#endif
int llrpc(unsigned, void *);
private:
int _output;
static String read_param(Element *, void *) CLICK_COLD;
static int write_param(const String &, Element *, void *, ErrorHandler *) CLICK_COLD;
};
CLICK_ENDDECLS
#endif