1 /*****************************************************************************
2 * RRDtool 1.0.33 Copyright Tobias Oetiker, 1999
3 *****************************************************************************
4 * rrd_format.c RRD Database Format helper functions
5 *****************************************************************************
8 * Revision 1.2 2001/03/10 23:54:39 oetiker
9 * Support for COMPUTE data sources (CDEF data sources). Removes the RPN
10 * parser and calculator from rrd_graph and puts then in a new file,
11 * rrd_rpncalc.c. Changes to core files rrd_create and rrd_update. Some
12 * clean-up of aberrant behavior stuff, including a bug fix.
13 * Documentation update (rrdcreate.pod, rrdupdate.pod). Change xml format.
14 * -- Jake Brutlag <jakeb@corp.webtv.net>
16 * Revision 1.1.1.1 2001/02/25 22:25:05 oetiker
19 * Revision 1.3 1998/03/08 12:35:11 oetiker
20 * checkpointing things because the current setup seems to work
21 * according to the things said in the manpages
23 * Revision 1.2 1998/02/26 22:58:22 oetiker
26 * Revision 1.1 1998/02/21 16:14:41 oetiker
30 *****************************************************************************/
33 #define converter(VV,VVV) \
34 if (strcmp(#VV, string) == 0) return VVV;
36 /* conversion functions to allow symbolic entry of enumerations */
37 enum dst_en dst_conv(char *string)
39 converter(COUNTER,DST_COUNTER)
40 converter(ABSOLUTE,DST_ABSOLUTE)
41 converter(GAUGE,DST_GAUGE)
42 converter(DERIVE,DST_DERIVE)
43 converter(COMPUTE,DST_CDEF)
44 rrd_set_error("unknown data aquisition function '%s'",string);
49 enum cf_en cf_conv(char *string)
52 converter(AVERAGE,CF_AVERAGE)
53 converter(MIN,CF_MINIMUM)
54 converter(MAX,CF_MAXIMUM)
55 converter(LAST,CF_LAST)
56 converter(HWPREDICT,CF_HWPREDICT)
57 converter(DEVPREDICT,CF_DEVPREDICT)
58 converter(SEASONAL,CF_SEASONAL)
59 converter(DEVSEASONAL,CF_DEVSEASONAL)
60 converter(FAILURES,CF_FAILURES)
61 rrd_set_error("unknown consolidation function '%s'",string);
68 ds_match(rrd_t *rrd,char *ds_nam){
70 for(i=0;i<rrd->stat_head->ds_cnt;i++)
71 if ((strcmp(ds_nam,rrd->ds_def[i].ds_nam))==0)
73 rrd_set_error("unknown data source name '%s'",ds_nam);