diff options
Diffstat (limited to 'plugins/utils.h')
0 files changed, 0 insertions, 0 deletions
diff --git a/plugins/netutils.h b/plugins/netutils.h index 2f31bdc..bd53201 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; |