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

« back to all changes in this revision

Viewing changes to myrrd/rrd_format.c

  • 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, 1999
 
3
 *****************************************************************************
 
4
 * rrd_format.c  RRD Database Format helper functions
 
5
 *****************************************************************************
 
6
 * $Id: rrd_format.c,v 1.1 2003/04/22 17:02:29 deri Exp $
 
7
 * $Log: rrd_format.c,v $
 
8
 * Revision 1.1  2003/04/22 17:02:29  deri
 
9
 * Local RRD tree
 
10
 *
 
11
 * Revision 1.1.1.1  2002/02/26 10:21:37  oetiker
 
12
 * Intial Import
 
13
 *
 
14
 * Revision 1.3  1998/03/08 12:35:11  oetiker
 
15
 * checkpointing things because the current setup seems to work
 
16
 * according to the things said in the manpages
 
17
 *
 
18
 * Revision 1.2  1998/02/26 22:58:22  oetiker
 
19
 * fixed define
 
20
 *
 
21
 * Revision 1.1  1998/02/21 16:14:41  oetiker
 
22
 * Initial revision
 
23
 *
 
24
 *
 
25
 *****************************************************************************/
 
26
#include "rrd_tool.h"
 
27
 
 
28
#define converter(VV,VVV) \
 
29
   if (strcmp(#VV, string) == 0) return VVV;
 
30
 
 
31
/* conversion functions to allow symbolic entry of enumerations */
 
32
enum dst_en dst_conv(char *string)
 
33
{
 
34
    converter(COUNTER,DST_COUNTER)
 
35
    converter(ABSOLUTE,DST_ABSOLUTE)
 
36
    converter(GAUGE,DST_GAUGE)
 
37
    converter(DERIVE,DST_DERIVE)
 
38
    rrd_set_error("unknown date aquisition function '%s'",string);
 
39
    return(-1);
 
40
}
 
41
 
 
42
 
 
43
enum cf_en cf_conv(char *string)
 
44
{
 
45
 
 
46
    converter(AVERAGE,CF_AVERAGE)
 
47
    converter(MIN,CF_MINIMUM)
 
48
    converter(MAX,CF_MAXIMUM)
 
49
    converter(LAST,CF_LAST)
 
50
    rrd_set_error("unknown consolidation function '%s'",string);
 
51
    return(-1);
 
52
}
 
53
 
 
54
#undef converter        
 
55
 
 
56
long
 
57
ds_match(rrd_t *rrd,char *ds_nam){
 
58
    long i;
 
59
    for(i=0;i<rrd->stat_head->ds_cnt;i++)
 
60
        if ((strcmp(ds_nam,rrd->ds_def[i].ds_nam))==0)
 
61
            return i;
 
62
    rrd_set_error("unknown data source name '%s'",ds_nam);
 
63
    return -1;
 
64
}
 
65
 
 
66
 
 
67
 
 
68
 
 
69
 
 
70
 
 
71