summaryrefslogtreecommitdiffstats
path: root/lib/utils_base.h
diff options
context:
space:
mode:
authorLorenz Kästle <lorenz.kaestle@netways.de>2024-10-17 15:57:50 (GMT)
committerLorenz Kästle <lorenz.kaestle@netways.de>2024-10-17 15:57:50 (GMT)
commitee1ba3209993b72e90f5fe30a16ad951f1e2402d (patch)
tree24b9cb0130f89892ea71562f09197d95c269048c /lib/utils_base.h
parent7fb58ce783285a983964d219fff18eba9b12e1e4 (diff)
downloadmonitoring-plugins-ee1ba3209993b72e90f5fe30a16ad951f1e2402d.tar.gz
lib: clang-format
Diffstat (limited to 'lib/utils_base.h')
-rw-r--r--lib/utils_base.h61
1 files changed, 30 insertions, 31 deletions
diff --git a/lib/utils_base.h b/lib/utils_base.h
index 9d4dffe..a209cb6 100644
--- a/lib/utils_base.h
+++ b/lib/utils_base.h
@@ -3,7 +3,7 @@
3/* Header file for Monitoring Plugins utils_base.c */ 3/* Header file for Monitoring Plugins utils_base.c */
4 4
5#ifndef USE_OPENSSL 5#ifndef USE_OPENSSL
6# include "sha256.h" 6# include "sha256.h"
7#endif 7#endif
8 8
9/* This file holds header information for thresholds - use this in preference to 9/* This file holds header information for thresholds - use this in preference to
@@ -20,44 +20,43 @@
20#define INSIDE 1 20#define INSIDE 1
21 21
22typedef struct range_struct { 22typedef struct range_struct {
23 double start; 23 double start;
24 bool start_infinity; 24 bool start_infinity;
25 double end; 25 double end;
26 int end_infinity; 26 int end_infinity;
27 int alert_on; /* OUTSIDE (default) or INSIDE */ 27 int alert_on; /* OUTSIDE (default) or INSIDE */
28 char* text; /* original unparsed text input */ 28 char *text; /* original unparsed text input */
29 } range; 29} range;
30 30
31typedef struct thresholds_struct { 31typedef struct thresholds_struct {
32 range *warning; 32 range *warning;
33 range *critical; 33 range *critical;
34 } thresholds; 34} thresholds;
35 35
36#define NP_STATE_FORMAT_VERSION 1 36#define NP_STATE_FORMAT_VERSION 1
37 37
38typedef struct state_data_struct { 38typedef struct state_data_struct {
39 time_t time; 39 time_t time;
40 void *data; 40 void *data;
41 int length; /* Of binary data */ 41 int length; /* Of binary data */
42 } state_data; 42} state_data;
43
44 43
45typedef struct state_key_struct { 44typedef struct state_key_struct {
46 char *name; 45 char *name;
47 char *plugin_name; 46 char *plugin_name;
48 int data_version; 47 int data_version;
49 char *_filename; 48 char *_filename;
50 state_data *state_data; 49 state_data *state_data;
51 } state_key; 50} state_key;
52 51
53typedef struct np_struct { 52typedef struct np_struct {
54 char *plugin_name; 53 char *plugin_name;
55 state_key *state; 54 state_key *state;
56 int argc; 55 int argc;
57 char **argv; 56 char **argv;
58 } monitoring_plugin; 57} monitoring_plugin;
59 58
60range *parse_range_string (char *); 59range *parse_range_string(char *);
61int _set_thresholds(thresholds **, char *, char *); 60int _set_thresholds(thresholds **, char *, char *);
62void set_thresholds(thresholds **, char *, char *); 61void set_thresholds(thresholds **, char *, char *);
63void print_thresholds(const char *, thresholds *); 62void print_thresholds(const char *, thresholds *);
@@ -71,13 +70,13 @@ extern unsigned int timeout_interval;
71/* All possible characters in a threshold range */ 70/* All possible characters in a threshold range */
72#define NP_THRESHOLDS_CHARS "-0123456789.:@~" 71#define NP_THRESHOLDS_CHARS "-0123456789.:@~"
73 72
74char *np_escaped_string (const char *); 73char *np_escaped_string(const char *);
75 74
76void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3))); 75void die(int, const char *, ...) __attribute__((noreturn, format(printf, 2, 3)));
77 76
78/* Return codes for _set_thresholds */ 77/* Return codes for _set_thresholds */
79#define NP_RANGE_UNPARSEABLE 1 78#define NP_RANGE_UNPARSEABLE 1
80#define NP_WARN_WITHIN_CRIT 2 79#define NP_WARN_WITHIN_CRIT 2
81 80
82/* a simple check to see if we're running as root. 81/* a simple check to see if we're running as root.
83 * returns zero on failure, nonzero on success */ 82 * returns zero on failure, nonzero on success */
@@ -93,7 +92,7 @@ int np_check_if_root(void);
93 * This function can be used to parse NTP control packet data and performance 92 * This function can be used to parse NTP control packet data and performance
94 * data strings. 93 * data strings.
95 */ 94 */
96char *np_extract_value(const char*, const char*, char); 95char *np_extract_value(const char *, const char *, char);
97 96
98/* 97/*
99 * Same as np_extract_value with separator suitable for NTP control packet 98 * Same as np_extract_value with separator suitable for NTP control packet
@@ -105,7 +104,7 @@ char *np_extract_value(const char*, const char*, char);
105 * Read a string representing a state (ok, warning... or numeric: 0, 1) and 104 * Read a string representing a state (ok, warning... or numeric: 0, 1) and
106 * return the corresponding NP_STATE or ERROR) 105 * return the corresponding NP_STATE or ERROR)
107 */ 106 */
108int mp_translate_state (char *); 107int mp_translate_state(char *);
109 108
110void np_enable_state(char *, int); 109void np_enable_state(char *, int);
111state_data *np_state_read(); 110state_data *np_state_read();
@@ -114,6 +113,6 @@ void np_state_write_string(time_t, char *);
114void np_init(char *, int argc, char **argv); 113void np_init(char *, int argc, char **argv);
115void np_set_args(int argc, char **argv); 114void np_set_args(int argc, char **argv);
116void np_cleanup(); 115void np_cleanup();
117const char *state_text (int); 116const char *state_text(int);
118 117
119#endif /* _UTILS_BASE_ */ 118#endif /* _UTILS_BASE_ */