2012-08-07 12:07:12 +00:00
|
|
|
// (c) 2012 Thomas Schoebel-Theuer / 1&1 Internet AG
|
|
|
|
#ifndef MARS_LIB_LIMITER_H
|
|
|
|
#define MARS_LIB_LIMITER_H
|
|
|
|
|
2012-09-24 09:17:00 +00:00
|
|
|
#include "brick.h"
|
|
|
|
|
2012-08-07 12:07:12 +00:00
|
|
|
#include <linux/utsname.h>
|
|
|
|
|
|
|
|
struct mars_limiter {
|
2012-09-24 09:49:29 +00:00
|
|
|
/* hierarchy tree */
|
|
|
|
struct mars_limiter *lim_father;
|
2012-08-07 12:07:12 +00:00
|
|
|
/* tunables */
|
|
|
|
int lim_max_rate;
|
2013-11-20 13:10:54 +00:00
|
|
|
int lim_max_delay;
|
2013-11-20 14:14:05 +00:00
|
|
|
int lim_min_window;
|
|
|
|
int lim_max_window;
|
2012-09-24 09:49:29 +00:00
|
|
|
/* readable */
|
|
|
|
int lim_rate;
|
2013-11-19 11:22:45 +00:00
|
|
|
int lim_cumul;
|
2013-11-20 14:46:16 +00:00
|
|
|
int lim_count;
|
2012-12-06 13:14:59 +00:00
|
|
|
long long lim_stamp;
|
2012-08-07 12:07:12 +00:00
|
|
|
/* internal */
|
2013-07-15 07:58:35 +00:00
|
|
|
long long lim_accu;
|
2012-08-07 12:07:12 +00:00
|
|
|
};
|
|
|
|
|
2012-09-24 09:17:00 +00:00
|
|
|
extern int mars_limit(struct mars_limiter *lim, int amount);
|
2012-08-07 12:07:12 +00:00
|
|
|
|
2013-11-20 13:10:54 +00:00
|
|
|
extern void mars_limit_sleep(struct mars_limiter *lim, int amount);
|
2012-08-07 12:07:12 +00:00
|
|
|
|
|
|
|
#endif
|