-
Notifications
You must be signed in to change notification settings - Fork 82
/
discard.hh
94 lines (60 loc) · 1.77 KB
/
discard.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef CLICK_DISCARD_HH
#define CLICK_DISCARD_HH
#include <click/batchelement.hh>
#include <click/task.hh>
#include <click/notifier.hh>
CLICK_DECLS
/*
=c
Discard([I<keywords> ACTIVE, BURST])
=s basicsources
drops all packets
=d
Discards all packets received on its single input. If used in a pull context,
it initiates pulls whenever packets are available, and listens for activity
notification, such as that available from Queue.
Keyword arguments are:
=over 8
=item ACTIVE
Boolean. If false, then Discard does not pull packets. Default is true.
Only meaningful in pull context.
=item BURST
Unsigned. Number of packets to pull per scheduling. Default is 1. Only
meaningful in pull context.
=back
=h active rw
Returns or sets the ACTIVE parameter. Only present if Discard is in pull
context.
=h count read-only
Returns the number of packets discarded.
=h reset_counts write-only
Resets "count" to 0.
=a Queue */
class Discard : public BatchElement { public:
Discard() CLICK_COLD;
const char *class_name() const override { return "Discard"; }
const char *port_count() const override { return PORTS_1_0; }
int configure(Vector<String> &conf, ErrorHandler *errh) CLICK_COLD;
int initialize(ErrorHandler *errh) CLICK_COLD;
void add_handlers() CLICK_COLD;
#if HAVE_BATCH
void push_batch(int, PacketBatch*);
#endif
void push(int, Packet *);
bool run_task(Task *);
protected:
Task _task;
NotifierSignal _signal;
#if HAVE_INT64_TYPES
typedef uint64_t counter_t;
#else
typedef uint32_t counter_t;
#endif
counter_t _count;
unsigned _burst;
bool _active;
enum { h_reset_counts = 0, h_active = 1 };
static int write_handler(const String &, Element *, void *, ErrorHandler *) CLICK_COLD;
};
CLICK_ENDDECLS
#endif