src/graph_instance.[ch]: Implement "inst_data_to_json".
[collection4.git] / src / common.h
1 /**
2  * collection4 - common.h
3  * Copyright (C) 2010  Florian octo Forster
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (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 GNU
13  * Lesser General Public License for more details.
14  * 
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA  02110-1301  USA
19  *
20  * Authors:
21  *   Florian octo Forster <ff at octo.it>
22  **/
23
24 #ifndef COMMON_H
25 #define COMMON_H 1
26
27 #include <stdint.h>
28 #include <inttypes.h>
29
30 int print_debug (const char *format, ...)
31   __attribute__((format(printf,1,2)));
32 #if 0
33 # define DEBUG(...) print_debug (__VA_ARGS__)
34 #else
35 # define DEBUG(...) /**/
36 #endif
37
38 size_t c_strlcat (char *dst, const char *src, size_t size);
39 #define strlcat c_strlcat
40
41 int ds_list_from_rrd_file (char *file,
42     size_t *ret_dses_num, char ***ret_dses);
43
44 uint32_t get_random_color (void);
45 uint32_t fade_color (uint32_t color);
46
47 char *strtolower (char *str);
48 char *strtolower_copy (const char *str);
49
50 /*
51  * Parses the time parameters "begin" and "end" and returns the specified time
52  * in epoch in the longs pointed to by "ret_begin" and "ret_end". Returns
53  * non-zero on failure. If the optional "ret_now" pointer is not-NULL, the
54  * current time will be assigned to it.
55  */
56 int get_time_args (long *ret_begin, long *ret_end,
57     long *ret_now);
58
59 #endif /* COMMON_H */
60 /* vim: set sw=2 sts=2 et fdm=marker : */