diff options
author | Lorenz Kästle <lorenz.kaestle@netways.de> | 2024-10-17 15:57:50 (GMT) |
---|---|---|
committer | Lorenz Kästle <lorenz.kaestle@netways.de> | 2024-10-17 15:57:50 (GMT) |
commit | ee1ba3209993b72e90f5fe30a16ad951f1e2402d (patch) | |
tree | 24b9cb0130f89892ea71562f09197d95c269048c /lib/utils_base.h | |
parent | 7fb58ce783285a983964d219fff18eba9b12e1e4 (diff) | |
download | monitoring-plugins-ee1ba3209993b72e90f5fe30a16ad951f1e2402d.tar.gz |
lib: clang-format
Diffstat (limited to 'lib/utils_base.h')
-rw-r--r-- | lib/utils_base.h | 61 |
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 | ||
22 | typedef struct range_struct { | 22 | typedef 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 | ||
31 | typedef struct thresholds_struct { | 31 | typedef 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 | ||
38 | typedef struct state_data_struct { | 38 | typedef 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 | ||
45 | typedef struct state_key_struct { | 44 | typedef 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 | ||
53 | typedef struct np_struct { | 52 | typedef 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 | ||
60 | range *parse_range_string (char *); | 59 | range *parse_range_string(char *); |
61 | int _set_thresholds(thresholds **, char *, char *); | 60 | int _set_thresholds(thresholds **, char *, char *); |
62 | void set_thresholds(thresholds **, char *, char *); | 61 | void set_thresholds(thresholds **, char *, char *); |
63 | void print_thresholds(const char *, thresholds *); | 62 | void 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 | ||
74 | char *np_escaped_string (const char *); | 73 | char *np_escaped_string(const char *); |
75 | 74 | ||
76 | void die (int, const char *, ...) __attribute__((noreturn,format(printf, 2, 3))); | 75 | void 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 | */ |
96 | char *np_extract_value(const char*, const char*, char); | 95 | char *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 | */ |
108 | int mp_translate_state (char *); | 107 | int mp_translate_state(char *); |
109 | 108 | ||
110 | void np_enable_state(char *, int); | 109 | void np_enable_state(char *, int); |
111 | state_data *np_state_read(); | 110 | state_data *np_state_read(); |
@@ -114,6 +113,6 @@ void np_state_write_string(time_t, char *); | |||
114 | void np_init(char *, int argc, char **argv); | 113 | void np_init(char *, int argc, char **argv); |
115 | void np_set_args(int argc, char **argv); | 114 | void np_set_args(int argc, char **argv); |
116 | void np_cleanup(); | 115 | void np_cleanup(); |
117 | const char *state_text (int); | 116 | const char *state_text(int); |
118 | 117 | ||
119 | #endif /* _UTILS_BASE_ */ | 118 | #endif /* _UTILS_BASE_ */ |