diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-10 20:45:45 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-10 20:45:45 (GMT) |
commit | 5b0e00782da2bbe9f9062884c9ae8ed330d5911e (patch) | |
tree | b14d8d7759e0e76b526d18dc1a8fe7ba6fd8d5cc /plugins | |
parent | b48cb1f130cda9818d06aaf74cdc7d2aef13bf42 (diff) | |
download | monitoring-plugins-5b0e00782da2bbe9f9062884c9ae8ed330d5911e.tar.gz |
Move global variables from .h to .c files
Simplify things by moving the definition of global variables into .c
files, where they belong.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/netutils.c | 5 | ||||
-rw-r--r-- | plugins/netutils.h | 12 | ||||
-rw-r--r-- | plugins/sslutils.c | 1 | ||||
-rw-r--r-- | plugins/utils.c | 7 | ||||
-rw-r--r-- | plugins/utils.h | 9 |
5 files changed, 13 insertions, 21 deletions
diff --git a/plugins/netutils.c b/plugins/netutils.c index 1d6100a..9f18723 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
@@ -27,11 +27,12 @@ | |||
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
29 | 29 | ||
30 | #define LOCAL_TIMEOUT_ALARM_HANDLER | ||
31 | |||
32 | #include "common.h" | 30 | #include "common.h" |
33 | #include "netutils.h" | 31 | #include "netutils.h" |
34 | 32 | ||
33 | unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; | ||
34 | unsigned int socket_timeout_state = STATE_CRITICAL; | ||
35 | |||
35 | int econn_refuse_state = STATE_CRITICAL; | 36 | int econn_refuse_state = STATE_CRITICAL; |
36 | int was_refused = FALSE; | 37 | int was_refused = FALSE; |
37 | #if USE_IPV6 | 38 | #if USE_IPV6 |
diff --git a/plugins/netutils.h b/plugins/netutils.h index 5a495c9..347509e 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h | |||
@@ -81,20 +81,14 @@ void host_or_die(const char *str); | |||
81 | # define is_hostname(addr) resolve_host_or_addr(addr, AF_INET) | 81 | # define is_hostname(addr) resolve_host_or_addr(addr, AF_INET) |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | #ifdef LOCAL_TIMEOUT_ALARM_HANDLER | ||
85 | extern unsigned int socket_timeout; | 84 | extern unsigned int socket_timeout; |
86 | extern int socket_timeout_state; | 85 | extern unsigned int socket_timeout_state; |
87 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | ||
88 | #else | ||
89 | unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; | ||
90 | unsigned int socket_timeout_state = STATE_CRITICAL; | ||
91 | extern RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | ||
92 | #endif | ||
93 | |||
94 | extern int econn_refuse_state; | 86 | extern int econn_refuse_state; |
95 | extern int was_refused; | 87 | extern int was_refused; |
96 | extern int address_family; | 88 | extern int address_family; |
97 | 89 | ||
90 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | ||
91 | |||
98 | /* SSL-Related functionality */ | 92 | /* SSL-Related functionality */ |
99 | #ifdef HAVE_SSL | 93 | #ifdef HAVE_SSL |
100 | /* maybe this could be merged with the above np_net_connect, via some flags */ | 94 | /* maybe this could be merged with the above np_net_connect, via some flags */ |
diff --git a/plugins/sslutils.c b/plugins/sslutils.c index 818f799..b8d4581 100644 --- a/plugins/sslutils.c +++ b/plugins/sslutils.c | |||
@@ -27,7 +27,6 @@ | |||
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | 28 | ||
29 | #define MAX_CN_LENGTH 256 | 29 | #define MAX_CN_LENGTH 256 |
30 | #define LOCAL_TIMEOUT_ALARM_HANDLER | ||
31 | #include "common.h" | 30 | #include "common.h" |
32 | #include "netutils.h" | 31 | #include "netutils.h" |
33 | 32 | ||
diff --git a/plugins/utils.c b/plugins/utils.c index 8827e31..b57d5e1 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -22,8 +22,6 @@ | |||
22 | * | 22 | * |
23 | *****************************************************************************/ | 23 | *****************************************************************************/ |
24 | 24 | ||
25 | #define LOCAL_TIMEOUT_ALARM_HANDLER | ||
26 | |||
27 | #include "common.h" | 25 | #include "common.h" |
28 | #include "utils.h" | 26 | #include "utils.h" |
29 | #include "utils_base.h" | 27 | #include "utils_base.h" |
@@ -38,6 +36,11 @@ extern const char *progname; | |||
38 | #define STRLEN 64 | 36 | #define STRLEN 64 |
39 | #define TXTBLK 128 | 37 | #define TXTBLK 128 |
40 | 38 | ||
39 | unsigned int timeout_state = STATE_CRITICAL; | ||
40 | unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT; | ||
41 | |||
42 | time_t start_time, end_time; | ||
43 | |||
41 | /* ************************************************************************** | 44 | /* ************************************************************************** |
42 | * max_state(STATE_x, STATE_y) | 45 | * max_state(STATE_x, STATE_y) |
43 | * compares STATE_x to STATE_y and returns result based on the following | 46 | * compares STATE_x to STATE_y and returns result based on the following |
diff --git a/plugins/utils.h b/plugins/utils.h index 822be94..657d4bf 100644 --- a/plugins/utils.h +++ b/plugins/utils.h | |||
@@ -31,17 +31,12 @@ void print_revision (const char *, const char *); | |||
31 | 31 | ||
32 | /* Handle timeouts */ | 32 | /* Handle timeouts */ |
33 | 33 | ||
34 | #ifdef LOCAL_TIMEOUT_ALARM_HANDLER | ||
35 | extern unsigned int timeout_state; | 34 | extern unsigned int timeout_state; |
36 | extern unsigned int timeout_interval; | 35 | extern unsigned int timeout_interval; |
36 | |||
37 | RETSIGTYPE timeout_alarm_handler (int); | 37 | RETSIGTYPE timeout_alarm_handler (int); |
38 | #else | ||
39 | unsigned int timeout_state = STATE_CRITICAL; | ||
40 | unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT; | ||
41 | extern RETSIGTYPE timeout_alarm_handler (int); | ||
42 | #endif | ||
43 | 38 | ||
44 | time_t start_time, end_time; | 39 | extern time_t start_time, end_time; |
45 | 40 | ||
46 | /* Test input types */ | 41 | /* Test input types */ |
47 | 42 | ||