summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-09-10 20:45:45 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-09-10 20:45:45 (GMT)
commit5b0e00782da2bbe9f9062884c9ae8ed330d5911e (patch)
treeb14d8d7759e0e76b526d18dc1a8fe7ba6fd8d5cc
parentb48cb1f130cda9818d06aaf74cdc7d2aef13bf42 (diff)
downloadmonitoring-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.
-rw-r--r--plugins/netutils.c5
-rw-r--r--plugins/netutils.h12
-rw-r--r--plugins/sslutils.c1
-rw-r--r--plugins/utils.c7
-rw-r--r--plugins/utils.h9
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
33unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
34unsigned int socket_timeout_state = STATE_CRITICAL;
35
35int econn_refuse_state = STATE_CRITICAL; 36int econn_refuse_state = STATE_CRITICAL;
36int was_refused = FALSE; 37int 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
85extern unsigned int socket_timeout; 84extern unsigned int socket_timeout;
86extern int socket_timeout_state; 85extern unsigned int socket_timeout_state;
87RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
88#else
89unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT;
90unsigned int socket_timeout_state = STATE_CRITICAL;
91extern RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn));
92#endif
93
94extern int econn_refuse_state; 86extern int econn_refuse_state;
95extern int was_refused; 87extern int was_refused;
96extern int address_family; 88extern int address_family;
97 89
90RETSIGTYPE 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
39unsigned int timeout_state = STATE_CRITICAL;
40unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
41
42time_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
35extern unsigned int timeout_state; 34extern unsigned int timeout_state;
36extern unsigned int timeout_interval; 35extern unsigned int timeout_interval;
36
37RETSIGTYPE timeout_alarm_handler (int); 37RETSIGTYPE timeout_alarm_handler (int);
38#else
39unsigned int timeout_state = STATE_CRITICAL;
40unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT;
41extern RETSIGTYPE timeout_alarm_handler (int);
42#endif
43 38
44time_t start_time, end_time; 39extern time_t start_time, end_time;
45 40
46/* Test input types */ 41/* Test input types */
47 42