• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:host

27  * SPDX-License-Identifier: MIT
50 static size_t hostent_nalias(const struct hostent *host) in hostent_nalias() argument
53 for (i=0; host->h_aliases != NULL && host->h_aliases[i] != NULL; i++) in hostent_nalias()
64 for (cname = ai->cnames; cname != NULL; cname=cname->next) { in ai_nalias()
71 static size_t hostent_naddr(const struct hostent *host) in hostent_naddr() argument
74 for (i=0; host->h_addr_list != NULL && host->h_addr_list[i] != NULL; i++) in hostent_naddr()
85 for (node = ai->nodes; node != NULL; node=node->ai_next) { in ai_naddr()
86 if (af != AF_UNSPEC && af != node->ai_family) in ai_naddr()
95 struct hostent **host) in ares_addrinfo2hostent() argument
106 if (ai == NULL || host == NULL) { in ares_addrinfo2hostent()
110 /* Use either the host set in the passed in hosts to be filled in, or the in ares_addrinfo2hostent()
115 if (*host != NULL && (*host)->h_addrtype != AF_UNSPEC) { in ares_addrinfo2hostent()
116 family = (*host)->h_addrtype; in ares_addrinfo2hostent()
117 } else if (ai->nodes != NULL) { in ares_addrinfo2hostent()
118 family = ai->nodes->ai_family; in ares_addrinfo2hostent()
126 if (*host == NULL) { in ares_addrinfo2hostent()
127 *host = ares_malloc_zero(sizeof(**host)); in ares_addrinfo2hostent()
128 if (!(*host)) { in ares_addrinfo2hostent()
133 (*host)->h_addrtype = (HOSTENT_ADDRTYPE_TYPE)family; in ares_addrinfo2hostent()
135 (*host)->h_length = sizeof(struct in_addr); in ares_addrinfo2hostent()
137 (*host)->h_length = sizeof(struct ares_in6_addr); in ares_addrinfo2hostent()
140 if ((*host)->h_name == NULL) { in ares_addrinfo2hostent()
141 if (ai->cnames) { in ares_addrinfo2hostent()
142 (*host)->h_name = ares_strdup(ai->cnames->name); in ares_addrinfo2hostent()
143 if ((*host)->h_name == NULL && ai->cnames->name) { in ares_addrinfo2hostent()
147 (*host)->h_name = ares_strdup(ai->name); in ares_addrinfo2hostent()
148 if ((*host)->h_name == NULL && ai->name) { in ares_addrinfo2hostent()
155 ealiases = hostent_nalias(*host); in ares_addrinfo2hostent()
156 aliases = ares_realloc_zero((*host)->h_aliases, in ares_addrinfo2hostent()
162 (*host)->h_aliases = aliases; in ares_addrinfo2hostent()
167 for (cname = ai->cnames; cname != NULL; cname = cname->next) { in ares_addrinfo2hostent()
168 if (cname->alias == NULL) { in ares_addrinfo2hostent()
171 (*host)->h_aliases[i] = ares_strdup(cname->alias); in ares_addrinfo2hostent()
172 if ((*host)->h_aliases[i] == NULL) { in ares_addrinfo2hostent()
180 eaddrs = hostent_naddr(*host); in ares_addrinfo2hostent()
181 addrs = ares_realloc_zero((*host)->h_addr_list, eaddrs * sizeof(char *), in ares_addrinfo2hostent()
186 (*host)->h_addr_list = addrs; in ares_addrinfo2hostent()
190 for (next = ai->nodes; next != NULL; next = next->ai_next) { in ares_addrinfo2hostent()
191 if (next->ai_family != family) { in ares_addrinfo2hostent()
194 (*host)->h_addr_list[i] = ares_malloc_zero((size_t)(*host)->h_length); in ares_addrinfo2hostent()
195 if ((*host)->h_addr_list[i] == NULL) { in ares_addrinfo2hostent()
199 memcpy((*host)->h_addr_list[i], in ares_addrinfo2hostent()
200 &(CARES_INADDR_CAST(const struct sockaddr_in6 *, next->ai_addr) in ares_addrinfo2hostent()
201 ->sin6_addr), in ares_addrinfo2hostent()
202 (size_t)(*host)->h_length); in ares_addrinfo2hostent()
205 memcpy((*host)->h_addr_list[i], in ares_addrinfo2hostent()
206 &(CARES_INADDR_CAST(const struct sockaddr_in *, next->ai_addr) in ares_addrinfo2hostent()
207 ->sin_addr), in ares_addrinfo2hostent()
208 (size_t)(*host)->h_length); in ares_addrinfo2hostent()
215 ares_free_hostent(*host); in ares_addrinfo2hostent()
216 *host = NULL; in ares_addrinfo2hostent()
224 ares_free_hostent(*host); in ares_addrinfo2hostent()
225 *host = NULL; in ares_addrinfo2hostent()
262 next_cname = ai->cnames; in ares_addrinfo2addrttl()
264 if (next_cname->ttl < cname_ttl) { in ares_addrinfo2addrttl()
265 cname_ttl = next_cname->ttl; in ares_addrinfo2addrttl()
267 next_cname = next_cname->next; in ares_addrinfo2addrttl()
270 for (next = ai->nodes; next != NULL; next = next->ai_next) { in ares_addrinfo2addrttl()
271 if (next->ai_family != family) { in ares_addrinfo2addrttl()
280 if (next->ai_ttl > cname_ttl) { in ares_addrinfo2addrttl()
283 addr6ttls[*naddrttls].ttl = next->ai_ttl; in ares_addrinfo2addrttl()
287 &(CARES_INADDR_CAST(const struct sockaddr_in6 *, next->ai_addr) in ares_addrinfo2addrttl()
288 ->sin6_addr), in ares_addrinfo2addrttl()
291 if (next->ai_ttl > cname_ttl) { in ares_addrinfo2addrttl()
294 addrttls[*naddrttls].ttl = next->ai_ttl; in ares_addrinfo2addrttl()
297 &(CARES_INADDR_CAST(const struct sockaddr_in *, next->ai_addr) in ares_addrinfo2addrttl()
298 ->sin_addr), in ares_addrinfo2addrttl()