1 /*
2  * conf.h                         Config Crap
3  *
4  * Copyright (c) 2001-2013 Thomas Graf <tgraf@suug.ch>
5  * Copyright (c) 2013 Red Hat, Inc.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a
8  * copy of this software and associated documentation files (the "Software"),
9  * to deal in the Software without restriction, including without limitation
10  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11  * and/or sell copies of the Software, and to permit persons to whom the
12  * Software is furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23  * DEALINGS IN THE SOFTWARE.
24  */
25 
26 #ifndef __BMON_CONF_H_
27 #define __BMON_CONF_H_
28 
29 #include <bmon/bmon.h>
30 
31 extern cfg_t *cfg;
32 
33 extern float			cfg_read_interval;
34 extern float			cfg_rate_interval;
35 extern float			cfg_rate_variance;
36 extern float			cfg_history_variance;
37 extern int			cfg_show_all;
38 extern int			cfg_unit_exp;
39 
40 extern void			conf_init_pre(void);
41 extern void			conf_init_post(void);
42 extern void			configfile_read(void);
43 extern void			set_configfile(const char *);
44 
45 extern unsigned int		get_lifecycles(void);
46 
47 extern void			conf_set_float(const char *, double);
48 extern double			conf_get_float(const char *);
49 extern void			conf_set_int(const char *, long);
50 extern long			conf_get_int(const char *);
51 extern void			conf_set_string(const char *, const char *);
52 extern const char *		conf_get_string(const char *);
53 
54 typedef struct tv_s
55 {
56 	char *			tv_type;
57 	char *			tv_value;
58 	struct list_head	tv_list;
59 } tv_t;
60 
61 typedef struct module_conf_s
62 {
63 	char *			m_name;
64 	struct list_head	m_attrs;
65 	struct list_head	m_list;
66 } module_conf_t;
67 
68 extern int parse_module_param(const char *, struct list_head *);
69 
70 enum {
71 	LAYOUT_UNSPEC,
72 	LAYOUT_DEFAULT,
73 	LAYOUT_STATUSBAR,
74 	LAYOUT_HEADER,
75 	LAYOUT_LIST,
76 	LAYOUT_SELECTED,
77     LAYOUT_RX_GRAPH,
78     LAYOUT_TX_GRAPH,
79 	__LAYOUT_MAX
80 };
81 
82 #define LAYOUT_MAX (__LAYOUT_MAX - 1)
83 
84 struct layout
85 {
86 	int	l_fg,
87 		l_bg,
88 		l_attr;
89 };
90 
91 extern struct layout cfg_layout[];
92 
93 #endif
94