-
Notifications
You must be signed in to change notification settings - Fork 81
/
decipttl.hh
70 lines (61 loc) · 1.65 KB
/
decipttl.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
#ifndef CLICK_DECIPTTL_HH
#define CLICK_DECIPTTL_HH
#include <click/batchelement.hh>
#include <click/glue.hh>
#include <click/atomic.hh>
CLICK_DECLS
/*
* =c
* DecIPTTL([keyword I<MULTICAST>])
* =s ip
* decrements IP time-to-live, drops dead packets
* =d
* Expects IP packet as input.
* If the ttl is <= 1 (i.e. has expired),
* DecIPTTL sends the packet to output 1 (or discards it if there is no
* output 1).
* Otherwise it decrements the ttl, re-calculates the checksum,
* and sends the packet to output 0.
*
* Ordinarily output 1 is connected to an ICMP error packet generator.
*
* =over 8
*
* =item ACTIVE
*
* Boolean. If false, do not decrement any packets' TTLs. Defaults to true.
*
* =item MULTICAST
*
* Boolean. If false, do not decrement the TTLs for multicast packets.
* Defaults to true.
*
* =back
*
* =e
* This is a typical IP input processing sequence:
*
* ... -> CheckIPHeader -> dt::DecIPTTL -> ...
* dt[1] -> ICMPError(18.26.4.24, 11, 0) -> ...
*
* =a ICMPError, CheckIPHeader
*/
class DecIPTTL : public BatchElement { public:
DecIPTTL() CLICK_COLD;
~DecIPTTL() CLICK_COLD;
const char *class_name() const override { return "DecIPTTL"; }
const char *port_count() const override { return PORTS_1_1X2; }
const char *processing() const override { return PROCESSING_A_AH; }
int configure(Vector<String> &conf, ErrorHandler *errh) CLICK_COLD;
void add_handlers() CLICK_COLD;
Packet *simple_action (Packet *);
#if HAVE_BATCH
PacketBatch *simple_action_batch(PacketBatch *);
#endif
private:
atomic_uint32_t _drops;
bool _active;
bool _multicast;
};
CLICK_ENDDECLS
#endif