summaryrefslogtreecommitdiffstats
path: root/plugins/netutils.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/netutils.h')
-rw-r--r--plugins/netutils.h32
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
39RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); 39RETSIGTYPE 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)
41int process_tcp_request2 (const char *address, int port, 46int process_tcp_request2 (const char *address, int port,
42 const char *sbuffer, char *rbuffer, int rsize); 47 const char *sbuffer, char *rbuffer, int rsize);
43int process_tcp_request (const char *address, int port,
44 const char *sbuffer, char *rbuffer, int rsize);
45int process_udp_request (const char *address, int port,
46 const char *sbuffer, char *rbuffer, int rsize);
47int process_request (const char *address, int port, int proto, 48int 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
50int my_tcp_connect (const char *address, int port, int *sd); 51/* my_connect and wrapper macros */
51int 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)
54int my_connect(const char *address, int port, int *sd, int proto);
52 55
53int send_tcp_request (int sd, const char *send_buffer, char *recv_buffer, int recv_size); 56/* send_request and wrapper macros */
54int 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)
55int send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, int recv_size); 61int 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 */
57int is_host (const char *); 65int is_host (const char *);
58int is_addr (const char *); 66int is_addr (const char *);
59int resolve_host_or_addr (const char *, int); 67int resolve_host_or_addr (const char *, int);
60int 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
62int 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
64int is_hostname (const char *);
65 75
66extern unsigned int socket_timeout; 76extern unsigned int socket_timeout;
67extern int econn_refuse_state; 77extern int econn_refuse_state;