1 /*****************************************************************************
2 * RRDtool 1.3.2 Copyright by Tobi Oetiker, 1997-2008
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 rrd_fetch_fn(
87 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);
96 #define RRD_READONLY (1<<0)
97 #define RRD_READWRITE (1<<1)
98 #define RRD_CREAT (1<<2)
99 #define RRD_READAHEAD (1<<3)
100 #define RRD_COPY (1<<4)
102 enum cf_en cf_conv(
103 const char *string);
104 enum dst_en dst_conv(
105 char *string);
106 long ds_match(
107 rrd_t *rrd,
108 char *ds_nam);
109 double rrd_diff(
110 char *a,
111 char *b);
113 #endif
115 #ifdef __cplusplus
116 }
117 #endif