f70d385248a0bf57238ee110b44b0ada2e5f0cae
[collection4.git] / common.h
1 #ifndef COMMON_H
2 #define COMMON_H 1
3
4 #include <stdint.h>
5 #include <inttypes.h>
6
7 #define DATA_DIR "/var/lib/collectd/rrd"
8
9 #include "graph_list.h"
10
11 typedef int (*callback_type_t)   (const char *type,   void *user_data);
12 typedef int (*callback_plugin_t) (const char *plugin, void *user_data);
13 typedef int (*callback_host_t)   (const char *host,   void *user_data);
14
15 int print_debug (const char *format, ...)
16   __attribute__((format(printf,1,2)));
17 #if 0
18 # define DEBUG(...) print_debug (__VA_ARGS__)
19 #else
20 # define DEBUG(...) /**/
21 #endif
22
23 int foreach_type (const char *host, const char *plugin,
24     callback_type_t, void *user_data);
25 int foreach_plugin (const char *host, callback_plugin_t, void *user_data);
26 int foreach_host (callback_host_t, void *user_data);
27
28 size_t c_strlcat (char *dst, const char *src, size_t size);
29 #define strlcat c_strlcat
30
31 int ds_list_from_rrd_file (char *file,
32     size_t *ret_dses_num, char ***ret_dses);
33
34 uint32_t get_random_color (void);
35
36 #endif /* COMMON_H */
37 /* vim: set sw=2 sts=2 et fdm=marker : */