Code

If unspecified set LDAP_OPT_SUCCESS to LDAP_SUCCESS (Sergei Haramundanis - #1498923)
[nagiosplug.git] / lib / utils_base.h
index ca27f1697f1082e4819f0279f00ecb429fa9ece3..bda765959ba2f72821665b705424a4b0edf01e24 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef _UTILS_BASE_
+#define _UTILS_BASE_
 /* Header file for nagios plugins utils_base.c */
 
 /* This file holds header information for thresholds - use this in preference to 
@@ -29,9 +31,23 @@ typedef struct thresholds_struct {
 range *parse_range_string (char *);
 int _set_thresholds(thresholds **, char *, char *);
 void set_thresholds(thresholds **, char *, char *);
+void print_thresholds(const char *, thresholds *);
 int check_range(double, range *);
 int get_status(double, thresholds *);
 
 char *np_escaped_string (const char *);
 
 void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3)));
+
+/* Return codes for _set_thresholds */
+#define NP_RANGE_UNPARSEABLE 1
+#define NP_WARN_WITHIN_CRIT 2
+
+/* a simple check to see if we're running as root.  
+ * returns zero on failure, nonzero on success */
+int np_check_if_root(void);
+/* and a helpful wrapper around that.  it returns the same status
+ * code from the above function, in case it's helpful for testing */
+int np_warn_if_not_root(void);
+
+#endif /* _UTILS_BASE_ */