tor  0.4.1.0-alpha-dev
ratelim.h
Go to the documentation of this file.
1 /* Copyright (c) 2003-2004, Roger Dingledine
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2019, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
11 #ifndef TOR_RATELIM_H
12 #define TOR_RATELIM_H
13 
14 #include <time.h>
15 
16 /* Rate-limiter */
17 
42 typedef struct ratelim_t {
43  int rate;
44  time_t last_allowed;
45  int n_calls_since_last_time;
46 } ratelim_t;
47 
48 #define RATELIM_INIT(r) { (r), 0, 0 }
49 #define RATELIM_TOOMANY (16*1000*1000)
50 
51 char *rate_limit_log(ratelim_t *lim, time_t now);
52 
53 #endif
Definitions for timing-related constants.
struct ratelim_t ratelim_t
char * rate_limit_log(ratelim_t *lim, time_t now)
Definition: ratelim.c:41