forked from oetiker/rrdtool-1.x
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrrd_tool.h
157 lines (126 loc) · 3.9 KB
/
rrd_tool.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#ifndef RRD_TOOL_H_3853987DDF7E4709A5B5849E5A6204F4
#define RRD_TOOL_H_3853987DDF7E4709A5B5849E5A6204F4
/*****************************************************************************
* RRDtool 1.8.0 Copyright by Tobi Oetiker, 1997-2022
*****************************************************************************
* rrd_tool.h Common Header File
*****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
#include "rrd_config.h"
#include "rrd.h"
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__) && !defined(__MINGW32__)
/* Win32 only includes */
#include <float.h> /* for _isnan */
#include <io.h> /* for chdir */
struct tm *localtime_r(
const time_t *timep,
struct tm *result);
char *ctime_r(
const time_t *timep,
char *result);
struct tm *gmtime_r(
const time_t *timep,
struct tm *result);
char *strtok_r(
char *str,
const char *sep,
char **last);
#else
/* unix-only includes */
#if !defined isnan && !defined HAVE_ISNAN
int isnan(
double value);
#endif
#endif
/* local include files -- need to be after the system ones */
#include "optparse.h"
#include "rrd_format.h"
#ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) ((a) < (b) ? (a) : (b))
#endif
#define DIM(x) (sizeof(x)/sizeof(x[0]))
char *sprintf_alloc(
char *,
...);
/* HELPER FUNCTIONS */
int PngSize(
FILE *,
long *,
long *);
int rrd_create_fn(
const char *file_name,
rrd_t *rrd,
int no_overwrite);
int rrd_fetch_fn (const char *filename,
enum cf_en cf_idx,
time_t *start,
time_t *end,
unsigned long *step,
unsigned long *ds_cnt,
char ***ds_namv,
rrd_value_t **data);
int rrd_fetch_empty(
time_t *start,
time_t *end,
unsigned long *step,
unsigned long *ds_cnt,
char *ds_nam,
char ***ds_namv,
rrd_value_t **data);
#ifdef HAVE_LIBDBI
int rrd_fetch_fn_libdbi(const char *filename, enum cf_en cf_idx,
time_t *start,time_t *end,
unsigned long *step,
unsigned long *ds_cnt,
char ***ds_namv,
rrd_value_t **data);
#endif
typedef int (*rrd_fetch_cb_t)(
const char *filename, /* name of the rrd */
enum cf_en cf_idx, /* consolidation function */
time_t *start,
time_t *end, /* which time frame do you want ?
* will be changed to represent reality */
unsigned long *step, /* which stepsize do you want?
* will be changed to represent reality */
unsigned long *ds_cnt, /* number of data sources in file */
char ***ds_namv, /* names of data_sources */
rrd_value_t **data /* two dimensional array containing the data */
);
int rrd_fetch_fn_cb(const char *filename, enum cf_en cf_idx,
time_t *start,time_t *end,
unsigned long *step,
unsigned long *ds_cnt,
char ***ds_namv,
rrd_value_t **data);
int rrd_fetch_cb_register(rrd_fetch_cb_t cb);
#define RRD_READONLY (1<<0)
#define RRD_READWRITE (1<<1)
#define RRD_CREAT (1<<2)
#define RRD_READAHEAD (1<<3)
#define RRD_COPY (1<<4)
#define RRD_EXCL (1<<5)
#define RRD_READVALUES (1<<6)
#define RRD_LOCK (1<<7)
enum cf_en rrd_cf_conv(
const char *string);
enum dst_en dst_conv(
const char *string);
long ds_match(
rrd_t *rrd,
char *ds_nam);
off_t rrd_get_header_size(
rrd_t *rrd);
double rrd_diff(
char *a,
char *b);
const char *cf_to_string (enum cf_en cf);
#ifdef __cplusplus
}
#endif
#endif /* RRD_TOOL_H */