-
Notifications
You must be signed in to change notification settings - Fork 81
/
ipoutputcombo.hh
73 lines (60 loc) · 1.79 KB
/
ipoutputcombo.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
#ifndef CLICK_IPOUTPUTCOMBO_HH
#define CLICK_IPOUTPUTCOMBO_HH
#include <click/batchelement.hh>
#include <click/glue.hh>
#include <clicknet/ip.h>
CLICK_DECLS
/*
* =c
* IPOutputCombo(COLOR, IPADDR, MTU)
* =s ip
* output combo for IP routing
* =d
* A single element encapsulating common tasks on an IP router's output path.
* Effectively equivalent to
*
* elementclass IPOutputCombo { $COLOR, $IPADDR, $MTU |
* input[0] -> DropBroadcasts
* -> p::PaintTee($COLOR)
* -> g::IPGWOptions($IPADDR)
* -> FixIPSrc($IPADDR)
* -> d::DecIPTTL
* -> l::CheckLength($MTU)
* -> [0]output;
* p[1] -> [1]output;
* g[1] -> [2]output;
* d[1] -> [3]output;
* l[1] -> [4]output;
* }
*
* Output 0 is the path for normal packets; outputs 1 through 3 are error
* outputs for PaintTee, IPGWOptions, and DecIPTTL, respectively; and
* output 4 is for packets longer than MTU.
*
* =n
*
* IPOutputCombo does no fragmentation. You'll still need an IPFragmenter for
* that.
*
* =a DropBroadcasts, PaintTee, CheckLength, IPGWOptions, FixIPSrc, DecIPTTL,
* IPFragmenter, IPInputCombo */
class IPOutputCombo : public BatchElement {
public:
IPOutputCombo() CLICK_COLD;
~IPOutputCombo() CLICK_COLD;
const char *class_name() const override { return "IPOutputCombo"; }
const char *port_count() const override { return "1/5"; }
const char *processing() const override { return PUSH; }
int configure(Vector<String> &, ErrorHandler *) CLICK_COLD;
#if HAVE_BATCH
void push_batch(int, PacketBatch *);
#endif
void push(int, Packet *);
private:
int _color; // PaintTee
struct in_addr _my_ip; // IPGWOptions, FixIPSrc
unsigned _mtu; // Fragmenter
inline int action(Packet* p_in, bool color = true);
};
CLICK_ENDDECLS
#endif