1 #ifndef __NET_NONBLOCK_H
2 #define __NET_NONBLOCK_H
7 IPADDR ip4, ip6; /* resolved ip addresses */
8 int error; /* error, 0 = no error, -1 = error: */
9 int errlen; /* error text length */
10 char *errorstr; /* error string - dynamically allocated, you'll
11 need to free() it yourself unless it's NULL */
12 char *host4, *host6; /* dito */
24 typedef void (*NET_CALLBACK) (GIOChannel *, void *);
25 typedef void (*NET_HOST_CALLBACK) (RESOLVED_NAME_REC *, void *);
27 /* nonblocking gethostbyname(), PID of the resolver child is returned. */
28 int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe,
30 /* Get host's name, call func when finished */
31 int net_gethostbyaddr_nonblock(IPADDR *ip, NET_HOST_CALLBACK func, void *data);
32 /* get the resolved IP address. returns -1 if some error occured with read() */
33 int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec);
35 /* Connect to server, call func when finished */
36 int net_connect_nonblock(const char *server, int port, const IPADDR *my_ip,
37 NET_CALLBACK func, void *data);
38 /* Kill the resolver child */
39 void net_disconnect_nonblock(int pid);