2022-07-13 13:39:14 +00:00
|
|
|
/*
|
2022-07-14 12:51:03 +00:00
|
|
|
* BIRD -- Statistics Protocol Configuration
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
CF_HDR
|
|
|
|
|
|
|
|
#include "proto/stats/stats.h"
|
|
|
|
|
|
|
|
CF_DEFINES
|
|
|
|
|
2022-07-19 08:21:43 +00:00
|
|
|
#define STATS_CC ((struct stats_channel_config *) this_channel)
|
2022-07-13 13:39:14 +00:00
|
|
|
|
|
|
|
CF_DECLS
|
|
|
|
|
2022-07-21 14:54:13 +00:00
|
|
|
CF_KEYWORDS(STATS, TABLE, MAX, GENERATION, SETTLE, TIME)
|
2022-07-14 12:51:03 +00:00
|
|
|
|
|
|
|
%type <cc> stats_channel_start
|
2022-07-13 13:39:14 +00:00
|
|
|
|
|
|
|
CF_GRAMMAR
|
|
|
|
|
|
|
|
proto: stats_proto '}' { this_channel = NULL; } ;
|
|
|
|
|
|
|
|
stats_proto_start: proto_start STATS
|
|
|
|
{
|
|
|
|
this_proto = proto_config_new(&proto_stats, $1);
|
|
|
|
}
|
2022-07-14 12:51:03 +00:00
|
|
|
|
|
|
|
proto_name ;
|
|
|
|
|
2022-07-19 08:21:43 +00:00
|
|
|
stats_channel_opt_list:
|
|
|
|
/* empty */
|
|
|
|
| '{' stats_opts '}'
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
channel_max_gen:
|
|
|
|
MAX GENERATION expr {
|
|
|
|
if ($3 > 254) cf_error("Max generation must be in range 0..254, got %u", $3);
|
|
|
|
STATS_CC->max_generation = $3;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
2022-07-21 14:54:13 +00:00
|
|
|
stats_settle:
|
|
|
|
SETTLE TIME time {
|
|
|
|
STATS_CC->settle = $3 S_;
|
|
|
|
}
|
|
|
|
|
2022-07-19 08:21:43 +00:00
|
|
|
stats_opts:
|
|
|
|
/* empty */
|
|
|
|
| stats_opts channel_item ';'
|
|
|
|
| stats_opts channel_max_gen ';'
|
2022-07-21 14:54:13 +00:00
|
|
|
| stats_opts stats_settle ';'
|
2022-07-19 08:21:43 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
stats_proto_channel: stats_channel_start stats_channel_opt_list channel_end ;
|
2022-07-14 12:51:03 +00:00
|
|
|
|
|
|
|
stats_channel_start: net_type symbol
|
2022-07-13 13:39:14 +00:00
|
|
|
{
|
2022-07-19 08:21:43 +00:00
|
|
|
this_channel = channel_config_get(&channel_stats, $2->name, $1, this_proto);
|
|
|
|
STATS_CC->max_generation = 16;
|
2022-07-21 14:54:13 +00:00
|
|
|
STATS_CC->settle = 5 S_;
|
2022-07-20 15:04:49 +00:00
|
|
|
$2 = cf_define_symbol($2, SYM_COUNTER, ch_config, this_channel);
|
2022-07-14 12:51:03 +00:00
|
|
|
}
|
2022-07-13 13:39:14 +00:00
|
|
|
|
|
|
|
stats_proto:
|
|
|
|
stats_proto_start '{'
|
|
|
|
| stats_proto proto_item ';'
|
2022-07-14 12:51:03 +00:00
|
|
|
| stats_proto stats_proto_channel ';'
|
|
|
|
| stats_proto ';'
|
2022-07-13 13:39:14 +00:00
|
|
|
;
|
|
|
|
|
|
|
|
CF_CODE
|
|
|
|
|
|
|
|
CF_END
|