de35e46df533a01f881c6cd82b8ce29ce013c191
1 /*****************************************************************************
2 * RRDtool 1.4.3 Copyright by Tobi Oetiker, 1997-2010
3 *****************************************************************************
4 * rrd_tool.h Common Header File
5 *****************************************************************************/
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 #ifndef _RRD_TOOL_H
11 #define _RRD_TOOL_H
13 #ifdef HAVE_CONFIG_H
14 #include "../rrd_config.h"
15 #elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
16 #include "../win32/config.h"
17 #endif
19 #include "rrd.h"
21 #if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)
23 /* Win32 only includes */
25 #include <float.h> /* for _isnan */
26 #include <io.h> /* for chdir */
28 struct tm *localtime_r(
29 const time_t *timep,
30 struct tm *result);
31 char *ctime_r(
32 const time_t *timep,
33 char *result);
34 struct tm *gmtime_r(
35 const time_t *timep,
36 struct tm *result);
37 char *strtok_r(
38 char *str,
39 const char *sep,
40 char **last);
42 #else
44 /* unix-only includes */
45 #if !defined isnan && !defined HAVE_ISNAN
46 int isnan(
47 double value);
48 #endif
50 #endif
52 /* local include files -- need to be after the system ones */
53 #ifdef HAVE_GETOPT_LONG
54 #define _GNU_SOURCE
55 #include <getopt.h>
56 #else
57 #include "rrd_getopt.h"
58 #endif
60 #include "rrd_format.h"
62 #ifndef max
63 #define max(a,b) ((a) > (b) ? (a) : (b))
64 #endif
66 #ifndef min
67 #define min(a,b) ((a) < (b) ? (a) : (b))
68 #endif
70 #define DIM(x) (sizeof(x)/sizeof(x[0]))
72 char *sprintf_alloc(
73 char *,
74 ...);
76 /* HELPER FUNCTIONS */
78 int PngSize(
79 FILE *,
80 long *,
81 long *);
83 int rrd_create_fn(
84 const char *file_name,
85 rrd_t *rrd,
86 int no_overwrite);
87 int rrd_fetch_fn (const char *filename,
88 enum cf_en cf_idx,
89 time_t *start,
90 time_t *end,
91 unsigned long *step,
92 unsigned long *ds_cnt,
93 char ***ds_namv,
94 rrd_value_t **data);
97 #ifdef HAVE_LIBDBI
98 int rrd_fetch_fn_libdbi(const char *filename, enum cf_en cf_idx,
99 time_t *start,time_t *end,
100 unsigned long *step,
101 unsigned long *ds_cnt,
102 char ***ds_namv,
103 rrd_value_t **data);
104 #endif
106 #define RRD_READONLY (1<<0)
107 #define RRD_READWRITE (1<<1)
108 #define RRD_CREAT (1<<2)
109 #define RRD_READAHEAD (1<<3)
110 #define RRD_COPY (1<<4)
111 #define RRD_EXCL (1<<5)
113 enum cf_en cf_conv(
114 const char *string);
115 enum dst_en dst_conv(
116 char *string);
117 long ds_match(
118 rrd_t *rrd,
119 char *ds_nam);
120 off_t rrd_get_header_size(
121 rrd_t *rrd);
122 double rrd_diff(
123 char *a,
124 char *b);
126 const char *cf_to_string (enum cf_en cf);
128 #endif /* _RRD_TOOL_H */
130 #ifdef __cplusplus
131 }
132 #endif