void do_firedns_getip6(firedns_state *state, char * string) { int fd; fd_set s; int n; struct timeval tv; char *m; struct in6_addr addr6; fprintf(stderr,"taking firedns_getip6(%s): ",string); fd = firedns_getip6(state, string); fprintf(stderr,"%d\n",fd); if (fd == -1) return; tv.tv_sec = 5; tv.tv_usec = 0; FD_ZERO(&s); FD_SET(fd,&s); n = select(fd + 1,&s,NULL,NULL,&tv); (void) n; m = firedns_getresult(state, fd); if (m == NULL) fprintf(stderr,"getting result: (null)\n"); else { memcpy(&addr6,m,sizeof(struct in6_addr)); char result[256]; firedns_ntoa6(&addr6, result); fprintf(stderr,"getting result: %s\n", result); } }
static inline struct in6_addr *firedns_resolveip6_i(const char *const name, char *(*result)(int)) { int fd; int t,i; struct in6_addr *ret; fd_set s; struct timeval tv; for (t = 0; t < FIREDNS_TRIES; t++) { fd = firedns_getip6(name); if (fd == -1) return NULL; tv.tv_sec = 5; tv.tv_usec = 0; FD_ZERO(&s); FD_SET(fd,&s); i = select(fd + 1,&s,NULL,NULL,&tv); ret = (struct in6_addr *) result(fd); if (ret != NULL || i != 0) return ret; } return NULL; }