graph_list.[ch]: Implement some (very simple) config handling.
[collection4.git] / graph_list.h
1 #ifndef GRAPH_LIST_H
2 #define GRAPH_LIST_H 1
3
4 #include "utils_array.h"
5 #include "graph_ident.h"
6 #include "oconfig.h"
7
8 struct graph_instance_s;
9 typedef struct graph_instance_s graph_instance_t;
10
11 struct graph_config_s;
12 typedef struct graph_config_s graph_config_t;
13
14 /*
15  * Callback types
16  */
17 typedef int (*gl_cfg_callback) (graph_config_t *cfg,
18     void *user_data);
19
20 typedef int (*gl_inst_callback) (graph_config_t *cfg,
21     graph_instance_t *inst, void *user_data);
22
23 /*
24  * Functions
25  */
26 int graph_config_add (const oconfig_item_t *ci);
27 int graph_config_submit (void);
28
29 int gl_graph_get_all (gl_cfg_callback callback,
30     void *user_data);
31
32 graph_config_t *graph_get_selected (void);
33
34 int gl_graph_get_title (graph_config_t *cfg,
35     char *buffer, size_t buffer_size);
36
37 graph_ident_t *gl_graph_get_selector (graph_config_t *cfg);
38
39 int gl_graph_instance_get_all (graph_config_t *cfg,
40     gl_inst_callback callback, void *user_data);
41
42 graph_instance_t *inst_get_selected (graph_config_t *cfg);
43
44 int gl_instance_get_all (gl_inst_callback callback,
45     void *user_data);
46
47 int gl_instance_get_params (graph_config_t *cfg, graph_instance_t *inst,
48     char *buffer, size_t buffer_size);
49
50 int gl_instance_get_rrdargs (graph_config_t *cfg, graph_instance_t *inst,
51     str_array_t *args);
52
53 graph_ident_t *gl_instance_get_selector (graph_instance_t *inst);
54
55 struct graph_list_s
56 {
57   char *host;
58   char *plugin;
59   char *plugin_instance;
60   char *type;
61   char *type_instance;
62 };
63 typedef struct graph_list_s graph_list_t;
64
65 typedef int (*gl_callback) (
66     const graph_list_t *, void *user_data);
67
68 int gl_update (void);
69
70 #endif /* GRAPH_LIST_H */
71 /* vim: set sw=2 sts=2 et fdm=marker : */