-
Notifications
You must be signed in to change notification settings - Fork 82
/
truncate.hh
42 lines (31 loc) · 918 Bytes
/
truncate.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
// -*- mode: c++; c-basic-offset: 4 -*-
#ifndef CLICK_TRUNCATE_HH
#define CLICK_TRUNCATE_HH
#include <click/element.hh>
CLICK_DECLS
/*
* =c
* Truncate(LENGTH)
* =s basicmod
* limit packet length
* =d
* Shorten packets to at most LENGTH bytes.
*
* The EXTRA_LENGTH keyword argument determines whether packets' extra length
* annotations are updated to account for any dropped bytes. Default is true.
* =a Strip, Pad
*/
class Truncate : public Element { public:
Truncate() CLICK_COLD;
const char *class_name() const override { return "Truncate"; }
const char *port_count() const override { return PORTS_1_1; }
int configure(Vector<String> &, ErrorHandler *) CLICK_COLD;
bool can_live_reconfigure() const { return true; }
Packet *simple_action(Packet *);
void add_handlers() CLICK_COLD;
private:
unsigned _nbytes;
bool _extra_anno;
};
CLICK_ENDDECLS
#endif