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,
107 /* Allocate and fill in the host query structure. */
135 struct hostent *host;
161 status = file_lookup(hquery->name, hquery->want_family, &host);
168 end_hquery(hquery, status, host);
183 struct hostent *host = NULL;
190 status = ares_parse_a_reply(abuf, alen, &host, NULL, NULL);
191 if (host && channel->nsort)
192 sort_addresses(host, channel->sortlist, channel->nsort);
196 status = ares_parse_aaaa_reply(abuf, alen, &host, NULL, NULL);
207 if (host && channel->nsort)
208 sort6_addresses(host, channel->sortlist, channel->nsort);
210 end_hquery(hquery, status, host);
228 struct hostent *host)
230 hquery->callback(hquery->arg, status, hquery->timeouts, host);
231 if (host)
232 ares_free_hostent(host);
237 /* If the name looks like an IP address, fake up a host entry, end the
300 /* Fill in the rest of the host structure and terminate the query. */
313 int family, struct hostent **host)
322 *host = NULL;
329 result = file_lookup(name, family, host);
333 *host = NULL;
338 static int file_lookup(const char *name, int family, struct hostent **host)
396 *host = NULL;
400 while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS)
402 if (strcasecmp((*host)->h_name, name) == 0)
404 for (alias = (*host)->h_aliases; *alias; alias++)
411 ares_free_hostent(*host);
417 *host = NULL;
421 static void sort_addresses(struct hostent *host,
432 for (i1 = 0; host->h_addr_list[i1]; i1++)
434 memcpy(&a1, host->h_addr_list[i1], sizeof(struct in_addr));
438 memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr));
442 memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr));
444 memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in_addr));
477 static void sort6_addresses(struct hostent *host,
488 for (i1 = 0; host->h_addr_list[i1]; i1++)
490 memcpy(&a1, host->h_addr_list[i1], sizeof(struct ares_in6_addr));
494 memcpy(&a2, host->h_addr_list[i2], sizeof(struct ares_in6_addr));
498 memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct ares_in6_addr));
500 memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct ares_in6_addr));