2022-07-13 13:39:14 +00:00
|
|
|
/*
|
2022-07-14 15:08:03 +00:00
|
|
|
* BIRD -- Statistics Protocol
|
2022-07-13 13:39:14 +00:00
|
|
|
*
|
2022-07-14 12:51:03 +00:00
|
|
|
* (c) 2022 Vojtech Vilimek <vojtech.vilimek@nic.cz>
|
|
|
|
* (c) 2022 CZ.NIC z.s.p.o.
|
2022-07-13 13:39:14 +00:00
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BIRD_STATS_H_
|
|
|
|
#define _BIRD_STATS_H_
|
|
|
|
|
2022-07-19 08:21:43 +00:00
|
|
|
struct stats_channel;
|
|
|
|
|
2022-07-13 13:39:14 +00:00
|
|
|
struct stats_config {
|
|
|
|
struct proto_config c;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct stats_proto {
|
|
|
|
struct proto p;
|
2022-07-19 08:21:43 +00:00
|
|
|
struct stats_channel *c;
|
2022-07-13 13:39:14 +00:00
|
|
|
struct tbf rl_gen;
|
2022-07-19 08:21:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct stats_channel {
|
|
|
|
struct channel c;
|
|
|
|
pool *pool;
|
|
|
|
u8 max_generation;
|
2022-07-14 15:08:03 +00:00
|
|
|
u32 *counters;
|
2022-07-20 13:01:41 +00:00
|
|
|
u32 sum;
|
2022-07-21 14:54:13 +00:00
|
|
|
timer *timer;
|
|
|
|
btime settle;
|
2022-07-13 13:39:14 +00:00
|
|
|
};
|
|
|
|
|
2022-07-19 08:21:43 +00:00
|
|
|
struct stats_channel_config {
|
|
|
|
struct channel_config c;
|
|
|
|
u8 max_generation;
|
2022-07-21 14:54:13 +00:00
|
|
|
btime settle;
|
2022-07-19 08:21:43 +00:00
|
|
|
};
|
|
|
|
|
2022-07-20 15:04:49 +00:00
|
|
|
static inline int
|
|
|
|
get_stats_sum(struct symbol *sym)
|
|
|
|
{
|
|
|
|
if (sym->ch_config->channel)
|
|
|
|
return (int) ((struct stats_channel *) sym->ch_config->channel)->sum;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
2022-07-20 13:01:41 +00:00
|
|
|
|
2022-07-13 13:39:14 +00:00
|
|
|
#endif
|