-
Notifications
You must be signed in to change notification settings - Fork 78
/
bwratedsplitter.hh
69 lines (59 loc) · 1.72 KB
/
bwratedsplitter.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
// -*- c-basic-offset: 4 -*-
#ifndef CLICK_BWRATEDSPLITTER_HH
#define CLICK_BWRATEDSPLITTER_HH
#include <click/batchelement.hh>
#include "elements/standard/ratedsplitter.hh"
CLICK_DECLS
/*
* =c
* BandwidthRatedSplitter(RATE, I[<KEYWORDS>])
* =s shaping
* splits flow of packets at specified bandwidth rate
* =processing
* Push
* =d
*
* BandwidthRatedSplitter has two output ports. All incoming packets up to a
* maximum of RATE are emitted on output port 0. Any remaining packets are
* emitted on output port 1. RATE is a bandwidth, such as "384 kbps".
* Unlike BandwidthMeter, the base RATE is emitted on output port
* 0 even when the input rate is greater than RATE.
*
* The rate is implemented using a token bucket. The capacity of this token
* bucket defaults to 20 milliseconds worth of tokens, but can be customized by
* setting one of BURST_DURATION or BURST_SIZE.
*
* Keyword arguments are:
*
* =over 8
*
* =item RATE
*
* Bandwidth. Token bucket fill rate.
*
* =item BURST_DURATION
*
* Time. If specified, the capacity of the token bucket is calculated as
* rate * burst_duration.
*
* =item BURST_BYTES
*
* Integer. If specified, the capacity of the token bucket is set to this
* value in bytes.
*
* =h rate read/write
* rate of splitting
*
* =a RatedSplitter, BandwidthMeter, BandwidthShaper, BandwidthRatedUnqueue */
class BandwidthRatedSplitter : public RatedSplitter { public:
BandwidthRatedSplitter() CLICK_COLD;
const char *class_name() const override { return "BandwidthRatedSplitter"; }
void push(int port, Packet *);
#if HAVE_BATCH
void push_batch(int, PacketBatch *);
#endif
private:
inline int smaction(Packet *p) CLICK_WARN_UNUSED_RESULT;
};
CLICK_ENDDECLS
#endif