summaryrefslogtreecommitdiffstats
path: root/plugins/check_curl.d/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_curl.d/config.h')
-rw-r--r--plugins/check_curl.d/config.h123
1 files changed, 123 insertions, 0 deletions
diff --git a/plugins/check_curl.d/config.h b/plugins/check_curl.d/config.h
new file mode 100644
index 00000000..bcdf3010
--- /dev/null
+++ b/plugins/check_curl.d/config.h
@@ -0,0 +1,123 @@
1#pragma once
2
3#include "../../config.h"
4#include "../common.h"
5#include "../../lib/states.h"
6#include "../../lib/thresholds.h"
7#include <stddef.h>
8#include <string.h>
9#include <sys/socket.h>
10#include "curl/curl.h"
11#include "perfdata.h"
12#include "regex.h"
13
14enum {
15 MAX_RE_SIZE = 1024,
16 HTTP_PORT = 80,
17 HTTPS_PORT = 443,
18 MAX_PORT = 65535,
19 DEFAULT_MAX_REDIRS = 15
20};
21
22enum {
23 FOLLOW_HTTP_CURL = 0,
24 FOLLOW_LIBCURL = 1
25};
26
27enum {
28 STICKY_NONE = 0,
29 STICKY_HOST = 1,
30 STICKY_PORT = 2
31};
32
33#define HTTP_EXPECT "HTTP/"
34#define DEFAULT_BUFFER_SIZE 2048
35#define DEFAULT_SERVER_URL "/"
36
37typedef struct {
38 char *server_address;
39 char *server_url;
40 char *host_name;
41
42 char *http_method;
43
44 char *http_post_data;
45
46 unsigned short virtualPort;
47 unsigned short serverPort;
48
49 bool use_ssl;
50 bool no_body;
51
52 /* curl CURLOPT_PROXY option will be set to this value if not NULL */
53 char *curlopt_proxy;
54 /* curl CURLOPT_NOPROXY option will be set to this value if not NULL */
55 char *curlopt_noproxy;
56} check_curl_working_state;
57
58check_curl_working_state check_curl_working_state_init();
59
60typedef struct {
61 bool automatic_decompression;
62 bool haproxy_protocol;
63 long socket_timeout;
64 sa_family_t sin_family;
65 long curl_http_version;
66 char **http_opt_headers;
67 size_t http_opt_headers_count;
68 long ssl_version;
69 char *client_cert;
70 char *client_privkey;
71 char *ca_cert;
72 bool verify_peer_and_host;
73 char proxy[DEFAULT_BUFFER_SIZE];
74 char no_proxy[DEFAULT_BUFFER_SIZE];
75 char user_agent[DEFAULT_BUFFER_SIZE];
76 char proxy_auth[MAX_INPUT_BUFFER];
77 char user_auth[MAX_INPUT_BUFFER];
78 char *http_content_type;
79 char *cookie_jar_file;
80} check_curl_static_curl_config;
81
82typedef struct {
83 check_curl_working_state initial_config;
84
85 check_curl_static_curl_config curl_config;
86 long max_depth;
87 int followmethod;
88 int followsticky;
89
90 int maximum_age;
91
92 // the original regex string from the command line
93 char regexp[MAX_RE_SIZE];
94
95 // the compiled regex for usage later
96 regex_t compiled_regex;
97
98 mp_state_enum state_regex;
99 bool invert_regex;
100 bool check_cert;
101 bool continue_after_check_cert;
102 int days_till_exp_warn;
103 int days_till_exp_crit;
104 mp_thresholds thlds;
105 mp_range page_length_limits;
106 bool page_length_limits_is_set;
107 struct {
108 char string[MAX_INPUT_BUFFER];
109 bool is_present;
110 } server_expect;
111 char string_expect[MAX_INPUT_BUFFER];
112 char header_expect[MAX_INPUT_BUFFER];
113 mp_state_enum on_redirect_result_state;
114 bool on_redirect_dependent;
115
116 bool show_extended_perfdata;
117 bool show_body;
118
119 bool output_format_is_set;
120 mp_output_format output_format;
121} check_curl_config;
122
123check_curl_config check_curl_config_init();