diff options
author | M. Sean Finney <seanius@users.sourceforge.net> | 2005-05-24 20:25:19 +0000 |
---|---|---|
committer | M. Sean Finney <seanius@users.sourceforge.net> | 2005-05-24 20:25:19 +0000 |
commit | 35f2cfd6e82407eb64e80ef3311fbc1e86829112 (patch) | |
tree | f594fa7064ffe9ecb17ada8f479ecc52781e41f1 /plugins/netutils.h | |
parent | 9d0badbb5002ae72c5ffba30be371939a30a0f68 (diff) | |
download | monitoring-plugins-35f2cfd6e82407eb64e80ef3311fbc1e86829112.tar.gz |
optimizations and cleanup from andreas
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1173 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/netutils.h')
-rw-r--r-- | plugins/netutils.h | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/plugins/netutils.h b/plugins/netutils.h index 2f31bdc8..bd532011 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h | |||
@@ -38,30 +38,40 @@ | |||
38 | 38 | ||
39 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | 39 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); |
40 | 40 | ||
41 | /* process_request and wrapper macros */ | ||
42 | #define process_tcp_request(addr, port, sbuf, rbuf, rsize) \ | ||
43 | process_request(addr, port, IPPROTO_TCP, sbuf, rbuf, rsize) | ||
44 | #define process_udp_request(addr, port, sbuf, rbuf, rsize) \ | ||
45 | process_request(addr, port, IPPROTO_UDP, sbuf, rbuf, rsize) | ||
41 | int process_tcp_request2 (const char *address, int port, | 46 | int process_tcp_request2 (const char *address, int port, |
42 | const char *sbuffer, char *rbuffer, int rsize); | 47 | const char *sbuffer, char *rbuffer, int rsize); |
43 | int process_tcp_request (const char *address, int port, | ||
44 | const char *sbuffer, char *rbuffer, int rsize); | ||
45 | int process_udp_request (const char *address, int port, | ||
46 | const char *sbuffer, char *rbuffer, int rsize); | ||
47 | int process_request (const char *address, int port, int proto, | 48 | int process_request (const char *address, int port, int proto, |
48 | const char *sbuffer, char *rbuffer, int rsize); | 49 | const char *sbuffer, char *rbuffer, int rsize); |
49 | 50 | ||
50 | int my_tcp_connect (const char *address, int port, int *sd); | 51 | /* my_connect and wrapper macros */ |
51 | int my_udp_connect (const char *address, int port, int *sd); | 52 | #define my_tcp_connect(addr, port, s) my_connect(addr, port, s, IPPROTO_TCP) |
53 | #define my_udp_connect(addr, port, s) my_connect(addr, port, s, IPPROTO_UDP) | ||
54 | int my_connect(const char *address, int port, int *sd, int proto); | ||
52 | 55 | ||
53 | int send_tcp_request (int sd, const char *send_buffer, char *recv_buffer, int recv_size); | 56 | /* send_request and wrapper macros */ |
54 | int send_udp_request (int sd, const char *send_buffer, char *recv_buffer, int recv_size); | 57 | #define send_tcp_request(s, sbuf, rbuf, rsize) \ |
58 | send_request(s, IPPROTO_TCP, sbuf, rbuf, rsize) | ||
59 | #define send_udp_request(s, sbuf, rbuf, rsize) \ | ||
60 | send_request(s, IPPROTO_UDP, sbuf, rbuf, rsize) | ||
55 | int send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int recv_size); | 61 | int send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int recv_size); |
56 | 62 | ||
63 | |||
64 | /* "is_*" wrapper macros and functions */ | ||
57 | int is_host (const char *); | 65 | int is_host (const char *); |
58 | int is_addr (const char *); | 66 | int is_addr (const char *); |
59 | int resolve_host_or_addr (const char *, int); | 67 | int resolve_host_or_addr (const char *, int); |
60 | int is_inet_addr (const char *); | 68 | #define is_inet_addr(addr) resolve_host_or_addr(addr, AF_INET) |
61 | #ifdef USE_IPV6 | 69 | #ifdef USE_IPV6 |
62 | int is_inet6_addr (const char *); | 70 | # define is_inet6_addr(addr) resolve_host_or_addr(addr, AF_INET6) |
71 | # define is_hostname(addr) resolve_host_or_addr(addr, address_family) | ||
72 | #else | ||
73 | # define is_hostname(addr) resolve_host_or_addr(addr, AF_INET) | ||
63 | #endif | 74 | #endif |
64 | int is_hostname (const char *); | ||
65 | 75 | ||
66 | extern unsigned int socket_timeout; | 76 | extern unsigned int socket_timeout; |
67 | extern int econn_refuse_state; | 77 | extern int econn_refuse_state; |