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"
31 typedef struct timespec dp_time_t;
33 struct dp_data_point_s
38 typedef struct dp_data_point_s dp_data_point_t;
40 /* Callback passed to the "get_idents" function. */
41 typedef int (*dp_get_idents_callback) (const graph_ident_t *, void *);
43 /* Callback passed to the "get_ident_ds_names" function. */
44 typedef int (*dp_list_get_ident_ds_names_callback) (const graph_ident_t *,
45 const char *ds_name, void *);
47 /* Callback passed to the "get_ident_data" function. */
48 typedef int (*dp_get_ident_data_callback) (graph_ident_t *, const char *ds_name,
49 const dp_data_point_t *, void *);
51 struct data_provider_s
53 int (*get_idents) (void *priv, dp_get_idents_callback, void *);
54 int (*get_ident_ds_names) (void *priv, graph_ident_t *,
55 dp_list_get_ident_ds_names_callback, void *);
56 int (*get_ident_data) (void *priv,
57 graph_ident_t *, const char *ds_name,
58 dp_time_t begin, dp_time_t end,
59 dp_get_ident_data_callback, void *);
60 /* Optional method: Prints graph to STDOUT, including HTTP header. */
61 int (*print_graph) (void *priv, graph_config_t *cfg, graph_instance_t *inst);
64 typedef struct data_provider_s data_provider_t;
66 #endif /* DATA_PROVIDER_H */
67 /* vim: set sw=2 sts=2 et fdm=marker : */