Lines Matching refs:host

74                        struct hostent *host);
77 static int file_lookup(const char *name, int family, struct hostent **host);
78 static void sort_addresses(struct hostent *host,
80 static void sort6_addresses(struct hostent *host,
135 struct hostent *host; in next_lookup() local
161 status = file_lookup(hquery->name, hquery->want_family, &host); in next_lookup()
168 end_hquery(hquery, status, host); in next_lookup()
183 struct hostent *host = NULL; in host_callback() local
190 status = ares_parse_a_reply(abuf, alen, &host, NULL, NULL); in host_callback()
191 if (host && channel->nsort) in host_callback()
192 sort_addresses(host, channel->sortlist, channel->nsort); in host_callback()
196 status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL); in host_callback()
207 if (host && channel->nsort) in host_callback()
208 sort6_addresses(host, channel->sortlist, channel->nsort); in host_callback()
210 end_hquery(hquery, status, host); in host_callback()
228 struct hostent *host) in end_hquery() argument
230 hquery->callback(hquery->arg, status, hquery->timeouts, host); in end_hquery()
231 if (host) in end_hquery()
232 ares_free_hostent(host); in end_hquery()
313 int family, struct hostent **host) in ares_gethostbyname_file() argument
322 *host = NULL; in ares_gethostbyname_file()
329 result = file_lookup(name, family, host); in ares_gethostbyname_file()
333 *host = NULL; in ares_gethostbyname_file()
338 static int file_lookup(const char *name, int family, struct hostent **host) in file_lookup() argument
396 *host = NULL; in file_lookup()
400 while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS) in file_lookup()
402 if (strcasecmp((*host)->h_name, name) == 0) in file_lookup()
404 for (alias = (*host)->h_aliases; *alias; alias++) in file_lookup()
411 ares_free_hostent(*host); in file_lookup()
417 *host = NULL; in file_lookup()
421 static void sort_addresses(struct hostent *host, in sort_addresses() argument
432 for (i1 = 0; host->h_addr_list[i1]; i1++) in sort_addresses()
434 memcpy(&a1, host->h_addr_list[i1], sizeof(struct in_addr)); in sort_addresses()
438 memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr)); in sort_addresses()
442 memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr)); in sort_addresses()
444 memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in_addr)); in sort_addresses()
477 static void sort6_addresses(struct hostent *host, in sort6_addresses() argument
488 for (i1 = 0; host->h_addr_list[i1]; i1++) in sort6_addresses()
490 memcpy(&a1, host->h_addr_list[i1], sizeof(struct ares_in6_addr)); in sort6_addresses()
494 memcpy(&a2, host->h_addr_list[i2], sizeof(struct ares_in6_addr)); in sort6_addresses()
498 memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct ares_in6_addr)); in sort6_addresses()
500 memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct ares_in6_addr)); in sort6_addresses()