diff options
| author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2026-04-08 17:21:44 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-08 17:21:44 +0200 |
| commit | 613cb60c96e21eaafb82b80a6b6d84b1b1f9729f (patch) | |
| tree | b8b0b26ea8b14b74cd92da272c213dccf5356fbd /plugins/check_curl.d/check_curl_helpers.h | |
| parent | ddd1bd9fbd84b29fb169e592943d1fdfc8ad0d7e (diff) | |
| download | monitoring-plugins-613cb60c96e21eaafb82b80a6b6d84b1b1f9729f.tar.gz | |
check_curl: Clean up (#2252)
* check_curl: remove unused variables
* check_curl: run formatter on related files
* check_curl_helpers: make code a bit more understandable
* check_curl helpers: general api cleanup and code style
Diffstat (limited to 'plugins/check_curl.d/check_curl_helpers.h')
| -rw-r--r-- | plugins/check_curl.d/check_curl_helpers.h | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/plugins/check_curl.d/check_curl_helpers.h b/plugins/check_curl.d/check_curl_helpers.h index cc47bf9d..55df9bc1 100644 --- a/plugins/check_curl.d/check_curl_helpers.h +++ b/plugins/check_curl.d/check_curl_helpers.h | |||
| @@ -127,11 +127,25 @@ mp_subcheck check_curl_certificate_checks(CURL *curl, X509 *cert, int warn_days_ | |||
| 127 | int crit_days_till_exp); | 127 | int crit_days_till_exp); |
| 128 | char *fmt_url(check_curl_working_state workingState); | 128 | char *fmt_url(check_curl_working_state workingState); |
| 129 | 129 | ||
| 130 | 130 | /* determine_hostname_resolver determines if the host or the proxy resolves the target hostname | |
| 131 | /* function that will determine if the host or the proxy resolves the target hostname | 131 | returns RESOLVE_LOCALLY if requester resolves the hostname locally, RESOLVE_REMOTELY if proxy |
| 132 | returns 0 if requester resolves the hostname locally, 1 if proxy resolves the hostname */ | 132 | resolves the hostname */ |
| 133 | int determine_hostname_resolver(const check_curl_working_state working_state, const check_curl_static_curl_config config); | 133 | bool hostname_gets_resolved_locally(const check_curl_working_state working_state); |
| 134 | 134 | ||
| 135 | /* Checks if an IP is inside given CIDR region. Using /protocol_size or not specifying the prefix length performs an equality check. Supports both IPv4 and IPv6 | 135 | /* Checks if an IP is inside given CIDR region. Using /protocol_size or not specifying the prefix |
| 136 | returns 1 if the target_ip address is inside the given cidr_region_or_ip_addr, 0 if its out. return codes < 0 mean an error has occurred. */ | 136 | length performs an equality check. Supports both IPv4 and IPv6 returns 1 if the target_ip address is |
| 137 | int ip_addr_inside_cidr(const char* cidr_region_or_ip_addr, const char* target_ip); | 137 | inside the given cidr_region_or_ip_addr, 0 if its out. return codes < 0 mean an error has occurred. |
| 138 | */ | ||
| 139 | typedef enum { | ||
| 140 | NO_ERROR, | ||
| 141 | FAILED_STRDUP, | ||
| 142 | COULD_NOT_PARSE_SUBNET_LENGTH, | ||
| 143 | CIDR_REGION_INVALID, | ||
| 144 | CIDR_REGION_INVALID_PREFIX, | ||
| 145 | IP_CONTAINS_INVALID_CHARACTERS, | ||
| 146 | } ip_addr_inside_error_code; | ||
| 147 | typedef struct { | ||
| 148 | bool inside; | ||
| 149 | ip_addr_inside_error_code error; | ||
| 150 | } ip_addr_inside; | ||
| 151 | ip_addr_inside ip_addr_inside_cidr(const char *cidr_region_or_ip_addr, const char *target_ip); | ||
