~ubuntu-branches/ubuntu/natty/ntop/natty

« back to all changes in this revision

Viewing changes to myrrd/rrd_tool.h

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2005-01-30 21:59:13 UTC
  • mfrom: (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050130215913-xc3ke963bw49b3k4
Tags: 2:3.0-5
* Updated README.Debian file so users will understand what to do at
  install, closes: #291794, #287802.
* Updated ntop init script to give better output.
* Also changed log directory from /var/lib/ntop to /var/log/ntop,
  closes: #252352.
* Quoted the interface list to allow whitespace, closes: #267248.
* Added a couple of logcheck ignores, closes: #269321, #269319.

Show diffs side-by-side

added added

removed removed

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