1 /*
2 ** Zabbix
3 ** Copyright (C) 2001-2021 Zabbix SIA
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program is distributed in the hope that it will be useful,
11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 **/
19 
20 #ifndef ZABBIX_CFG_H
21 #define ZABBIX_CFG_H
22 
23 #define	TYPE_INT		0
24 #define	TYPE_STRING		1
25 #define	TYPE_MULTISTRING	2
26 #define	TYPE_UINT64		3
27 #define	TYPE_STRING_LIST	4
28 
29 #define	PARM_OPT	0
30 #define	PARM_MAND	1
31 
32 /* config file parsing options */
33 #define	ZBX_CFG_FILE_REQUIRED	0
34 #define	ZBX_CFG_FILE_OPTIONAL	1
35 
36 #define	ZBX_CFG_NOT_STRICT	0
37 #define	ZBX_CFG_STRICT		1
38 
39 #define ZBX_PROXY_HEARTBEAT_FREQUENCY_MAX	SEC_PER_HOUR
40 
41 extern char	*CONFIG_FILE;
42 extern char	*CONFIG_LOG_TYPE_STR;
43 extern int	CONFIG_LOG_TYPE;
44 extern char	*CONFIG_LOG_FILE;
45 extern int	CONFIG_ALLOW_ROOT;
46 extern int	CONFIG_TIMEOUT;
47 
48 struct cfg_line
49 {
50 	char		*parameter;
51 	void		*variable;
52 	int		type;
53 	int		mandatory;
54 	zbx_uint64_t	min;
55 	zbx_uint64_t	max;
56 };
57 
58 int	parse_cfg_file(const char *cfg_file, struct cfg_line *cfg, int optional, int strict);
59 
60 int	check_cfg_feature_int(const char *parameter, int value, const char *feature);
61 int	check_cfg_feature_str(const char *parameter, const char *value, const char *feature);
62 
63 #endif
64