1 /*****************************************************************************
2 * RRDtool 1.0.33 Copyright Tobias Oetiker, 1999
3 *****************************************************************************
4 * rrd_format.c RRD Database Format helper functions
5 *****************************************************************************
8 * Revision 1.1 2001/02/25 22:25:05 oetiker
11 * Revision 1.3 1998/03/08 12:35:11 oetiker
12 * checkpointing things because the current setup seems to work
13 * according to the things said in the manpages
15 * Revision 1.2 1998/02/26 22:58:22 oetiker
18 * Revision 1.1 1998/02/21 16:14:41 oetiker
22 *****************************************************************************/
25 #define converter(VV,VVV) \
26 if (strcmp(#VV, string) == 0) return VVV;
28 /* conversion functions to allow symbolic entry of enumerations */
29 enum dst_en dst_conv(char *string)
31 converter(COUNTER,DST_COUNTER)
32 converter(ABSOLUTE,DST_ABSOLUTE)
33 converter(GAUGE,DST_GAUGE)
34 converter(DERIVE,DST_DERIVE)
35 rrd_set_error("unknown date aquisition function '%s'",string);
40 enum cf_en cf_conv(char *string)
43 converter(AVERAGE,CF_AVERAGE)
44 converter(MIN,CF_MINIMUM)
45 converter(MAX,CF_MAXIMUM)
46 converter(LAST,CF_LAST)
47 rrd_set_error("unknown consolidation function '%s'",string);
54 ds_match(rrd_t *rrd,char *ds_nam){
56 for(i=0;i<rrd->stat_head->ds_cnt;i++)
57 if ((strcmp(ds_nam,rrd->ds_def[i].ds_nam))==0)
59 rrd_set_error("unknown data source name '%s'",ds_nam);