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 */
23 typedef void (*NET_CALLBACK) (GIOChannel *, void *);
24 typedef void (*NET_HOST_CALLBACK) (RESOLVED_NAME_REC *, void *);
26 /* nonblocking gethostbyname(), PID of the resolver child is returned. */
27 int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe);
28 /* Get host's name, call func when finished */
29 int net_gethostbyaddr_nonblock(IPADDR *ip, NET_HOST_CALLBACK func, void *data);
30 /* get the resolved IP address. returns -1 if some error occured with read() */
31 int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec);
33 /* Connect to server, call func when finished */
34 int net_connect_nonblock(const char *server, int port, const IPADDR *my_ip,
35 NET_CALLBACK func, void *data);
36 /* Kill the resolver child */
37 void net_disconnect_nonblock(int pid);