Removed references to GIF
[rrdtool.git] / src / rrd_tool.h
1 /*****************************************************************************
2  * RRDtool 1.0.33  Copyright Tobias Oetiker, 1997 - 2000
3  *****************************************************************************
4  * rrd_tool.h   Common Header File
5  *****************************************************************************/
6 #ifdef  __cplusplus
7 extern "C" {
8 #endif
9
10
11 #ifndef _RRD_TOOL_H
12 #define _RRD_TOOL_H
13
14 #ifdef WIN32
15 #include "../confignt/config.h"
16 #else
17 #ifdef HAVE_CONFIG_H
18 #include <config.h>
19 #endif
20 #endif
21
22 #ifdef MUST_DISABLE_SIGFPE
23 #include <signal.h>
24 #endif
25
26 #ifdef MUST_DISABLE_FPMASK
27 #include <floatingpoint.h>
28 #endif
29     
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <errno.h>
33 #include <string.h>
34 #include <time.h>
35 #include <ctype.h>
36
37 #if HAVE_SYS_PARAM_H
38 #  include <sys/param.h>
39 #endif
40
41 #ifndef MAXPATH
42 #  define MAXPATH 1024
43 #endif
44
45 #if HAVE_MATH_H
46 # include <math.h>
47 #endif
48 #if HAVE_UNISTD_H
49 # include <unistd.h>
50 #endif
51 #if HAVE_SYS_TIME_H
52 # include <sys/time.h>
53 #endif
54 #if HAVE_SYS_TIMES_H
55 # include <sys/times.h>
56 #endif
57 #if HAVE_SYS_RESOURCE_H
58 # include <sys/resource.h>
59 #if (defined(__svr4__) && defined(__sun__))
60 /* Solaris headers (pre 2.6) don't have a getrusage prototype.
61    Use this instead. */
62 extern int getrusage(int, struct rusage *);
63 #endif /* __svr4__ && __sun__ */
64 #endif
65
66 #include "rrd.h"
67
68 #ifndef WIN32
69
70 /* unix-only includes */
71 #ifndef isnan
72 int isnan(double value);
73 #endif
74
75 #else
76
77 /* Win32 only includes */
78
79 #include <float.h>        /* for _isnan  */
80 #define isnan _isnan
81 #define finite _finite
82 #define isinf(a) (_fpclass(a) == _FPCLASS_NINF || _fpclass(a) == _FPCLASS_PINF)
83 #endif
84
85 /* local include files -- need to be after the system ones */
86 #include "getopt.h"
87 #include "rrd_format.h"
88
89 #ifndef max
90 #define max(a,b) ((a) > (b) ? (a) : (b))
91 #endif
92
93 #ifndef min
94 #define min(a,b) ((a) < (b) ? (a) : (b))
95 #endif                                                   
96
97 #define DIM(x) (sizeof(x)/sizeof(x[0]))
98
99 /* rrd info interface */
100 enum info_type   { RD_I_VAL=0,
101                RD_I_CNT,
102                RD_I_STR  };
103
104 typedef union infoval { 
105     unsigned long u_cnt; 
106     rrd_value_t   u_val;
107     char         *u_str;
108 } infoval;
109
110 typedef struct info_t {
111     char            *key;
112     enum info_type  type;
113     union infoval   value;
114     struct info_t   *next;
115 } info_t;
116
117
118 info_t *rrd_info(int, char **);
119
120 /* HELPER FUNCTIONS */
121
122 int PngSize(FILE *, long *, long *);
123
124 int rrd_create_fn(char *file_name, rrd_t *rrd);
125 int rrd_fetch_fn(char *filename, enum cf_en cf_idx,
126                  time_t *start,time_t *end,
127                  unsigned long *step,
128                  unsigned long *ds_cnt,
129                  char        ***ds_namv,
130                  rrd_value_t **data);
131
132 void rrd_free(rrd_t *rrd);
133 void rrd_init(rrd_t *rrd);
134
135 int rrd_open(char *file_name, FILE **in_file, rrd_t *rrd, int rdwr);
136 int readfile(char *file, char **buffer, int skipfirst);
137
138 #define RRD_READONLY    0
139 #define RRD_READWRITE   1
140
141 enum cf_en cf_conv(char *string);
142 enum dst_en dst_conv(char *string);
143 long ds_match(rrd_t *rrd,char *ds_nam);
144 double rrd_diff(char *a, char *b);
145
146 #endif
147
148 #ifdef  __cplusplus
149 }
150 #endif