2 * collection4 - data_provider.h
3 * Copyright (C) 2010 Florian octo Forster
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.
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.
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
21 * Florian octo Forster <ff at octo.it>
24 #ifndef DATA_PROVIDER_H
25 #define DATA_PROVIDER_H 1
27 #include "graph_types.h"
32 typedef struct timespec dp_time_t;
34 struct dp_data_point_s
39 typedef struct dp_data_point_s dp_data_point_t;
41 /* Callback passed to the "get_idents" function. */
42 typedef int (*dp_get_idents_callback) (const graph_ident_t *, void *);
44 /* Callback passed to the "get_ident_ds_names" function. */
45 typedef int (*dp_list_get_ident_ds_names_callback) (const graph_ident_t *,
46 const char *ds_name, void *);
48 /* Callback passed to the "get_ident_data" function. */
49 typedef int (*dp_get_ident_data_callback) (graph_ident_t *, const char *ds_name,
50 const dp_data_point_t *dp, size_t dp_num,
53 struct data_provider_s
55 int (*get_idents) (void *priv, dp_get_idents_callback, void *);
56 int (*get_ident_ds_names) (void *priv, graph_ident_t *,
57 dp_list_get_ident_ds_names_callback, void *);
58 int (*get_ident_data) (void *priv,
59 graph_ident_t *, const char *ds_name,
60 dp_time_t begin, dp_time_t end,
61 dp_get_ident_data_callback, void *);
62 /* Optional method: Prints graph to STDOUT, including HTTP header. */
63 int (*print_graph) (void *priv, graph_config_t *cfg, graph_instance_t *inst);
66 typedef struct data_provider_s data_provider_t;
68 int data_provider_config (const oconfig_item_t *ci);
70 int data_provider_register (const char *name, data_provider_t *p);
71 int data_provider_get_idents (dp_get_idents_callback callback, void *user_data);
72 int data_provider_get_ident_ds_names (graph_ident_t *ident,
73 dp_list_get_ident_ds_names_callback callback, void *user_data);
74 int data_provider_get_ident_data (graph_ident_t *ident,
76 dp_time_t begin, dp_time_t end,
77 dp_get_ident_data_callback callback, void *user_data);
79 #endif /* DATA_PROVIDER_H */
80 /* vim: set sw=2 sts=2 et fdm=marker : */