Code

initial version of ini file parsing routines in C
[nagiosplug.git] / lib / utils_base.h
1 #ifndef _UTILS_BASE_
2 #define _UTILS_BASE_
3 /* Header file for nagios plugins utils_base.c */
5 /* This file holds header information for thresholds - use this in preference to 
6    individual plugin logic */
8 /* This has not been merged with utils.h because of problems with
9    timeout_interval when other utils_*.h files use utils.h */
11 /* Long term, add new functions to utils_base.h for common routines
12    and utils_*.h for specific to plugin routines. If routines are
13    placed in utils_*.h, then these can be tested with libtap */
15 #define OUTSIDE 0
16 #define INSIDE  1
18 typedef struct range_struct {
19         double  start;
20         int     start_infinity;         /* FALSE (default) or TRUE */
21         double  end;
22         int     end_infinity;
23         int     alert_on;               /* OUTSIDE (default) or INSIDE */
24         } range;
26 typedef struct thresholds_struct {
27         range   *warning;
28         range   *critical;
29         } thresholds;
31 range *parse_range_string (char *);
32 int _set_thresholds(thresholds **, char *, char *);
33 void set_thresholds(thresholds **, char *, char *);
34 int check_range(double, range *);
35 int get_status(double, thresholds *);
37 char *np_escaped_string (const char *);
39 void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3)));
41 /* Return codes for _set_thresholds */
42 #define NP_RANGE_UNPARSEABLE 1
43 #define NP_WARN_WITHIN_CRIT 2
45 #endif /* _UTILS_BASE_ */