2 * UCW Library -- Rate Limiting based on the Token Bucket Filter
4 * (c) 2009 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
13 struct token_bucket_filter {
14 double rate; // Number of tokens per second
15 uns burst; // Capacity of the bucket
16 timestamp_t last_hit; // Internal state...
21 void tbf_init(struct token_bucket_filter *f);
22 int tbf_limit(struct token_bucket_filter *f, timestamp_t now);