bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2009-2018 Dovecot authors, see the included COPYING file */
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenstatic bool stats_metric_settings_check(void *_set, pool_t pool, const char **error_r);
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen/* <settings checks> */
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenstatic struct file_listener_settings stats_unix_listeners_array[] = {
49568744a836768dc6c76db837130b7966c5ff38Timo Sirainen { "stats-writer", 0660, "", "$default_internal_group" },
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenstatic struct file_listener_settings *stats_unix_listeners[] = {
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen stats_unix_listeners, sizeof(stats_unix_listeners), { NULL, }
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen/* </settings checks> */
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenstruct service_settings stats_service_settings = {
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen .unix_listeners = { { &stats_unix_listeners_buf,
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen { type, #name, offsetof(struct stats_metric_settings, name), NULL }
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenstatic const struct setting_define stats_metric_setting_defines[] = {
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen { SET_STRLIST, "filter", offsetof(struct stats_metric_settings, filter), NULL },
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenconst struct stats_metric_settings stats_metric_default_settings = {
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenconst struct setting_parser_info stats_metric_setting_parser_info = {
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen .type_offset = offsetof(struct stats_metric_settings, name),
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen .struct_size = sizeof(struct stats_metric_settings),
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen offsetof(struct stats_settings, field), defines }
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenstatic const struct setting_define stats_setting_defines[] = {
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen DEFLIST_UNIQUE(metrics, "metric", &stats_metric_setting_parser_info),
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenconst struct stats_settings stats_default_settings = {
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenconst struct setting_parser_info stats_setting_parser_info = {
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen/* <settings checks> */
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainenstatic bool stats_metric_settings_check(void *_set, pool_t pool ATTR_UNUSED,
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen const char **error_r)
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen const char *p;
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen if ((p = strchr(set->source_location, ':')) == NULL) {
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen if (str_to_uint(p+1, &set->parsed_source_linenum) < 0 ||
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen *error_r = "source_location has invalid line number after ':'";
e9068f1c3326de0265d0ef542a0d7723f5f01bc8Timo Sirainen/* </settings checks> */