Lines Matching refs:ai

274 #define GET_AI(ai, afd, addr) 					\  argument
277 (ai) = get_ai(pai, (afd), (addr)); \
278 if ((ai) == NULL) { \
284 #define GET_PORT(ai, serv) \ argument
287 error = get_port((ai), (serv), 0); \
292 #define GET_CANONNAME(ai, str) \ argument
295 error = get_canonname(pai, (ai), (str)); \
325 freeaddrinfo(struct addrinfo *ai) in freeaddrinfo() argument
330 if (ai == NULL) return; in freeaddrinfo()
332 _DIAGASSERT(ai != NULL); in freeaddrinfo()
336 next = ai->ai_next; in freeaddrinfo()
337 if (ai->ai_canonname) in freeaddrinfo()
338 free(ai->ai_canonname); in freeaddrinfo()
340 free(ai); in freeaddrinfo()
341 ai = next; in freeaddrinfo()
342 } while (ai); in freeaddrinfo()
461 struct addrinfo* ai = NULL; in android_getaddrinfo_proxy() local
473 ai = calloc(1, sizeof(struct addrinfo) + sizeof(struct sockaddr_storage)); in android_getaddrinfo_proxy()
474 if (ai == NULL) { in android_getaddrinfo_proxy()
477 ai->ai_addr = (struct sockaddr*)(ai + 1); in android_getaddrinfo_proxy()
494 readBE32(proxy, &ai->ai_flags) && in android_getaddrinfo_proxy()
495 readBE32(proxy, &ai->ai_family) && in android_getaddrinfo_proxy()
496 readBE32(proxy, &ai->ai_socktype) && in android_getaddrinfo_proxy()
497 readBE32(proxy, &ai->ai_protocol) && in android_getaddrinfo_proxy()
504 ai->ai_addrlen = addr_len; in android_getaddrinfo_proxy()
510 if (fread(ai->ai_addr, addr_len, 1, proxy) != 1) { in android_getaddrinfo_proxy()
521 ai->ai_canonname = (char*) malloc(name_len); in android_getaddrinfo_proxy()
522 if (fread(ai->ai_canonname, name_len, 1, proxy) != 1) { in android_getaddrinfo_proxy()
525 if (ai->ai_canonname[name_len - 1] != '\0') { in android_getaddrinfo_proxy()
532 *nextres = ai; in android_getaddrinfo_proxy()
533 nextres = &ai->ai_next; in android_getaddrinfo_proxy()
534 ai = NULL; in android_getaddrinfo_proxy()
537 if (ai != NULL) { in android_getaddrinfo_proxy()
540 freeaddrinfo(ai); in android_getaddrinfo_proxy()
593 struct addrinfo ai; in android_getaddrinfofornetcontext() local
605 pai = &ai; in android_getaddrinfofornetcontext()
1083 get_canonname(const struct addrinfo *pai, struct addrinfo *ai, const char *str) in get_canonname() argument
1087 assert(ai != NULL); in get_canonname()
1091 ai->ai_canonname = strdup(str); in get_canonname()
1092 if (ai->ai_canonname == NULL) in get_canonname()
1102 struct addrinfo *ai; in get_ai() local
1108 ai = (struct addrinfo *)malloc(sizeof(struct addrinfo) in get_ai()
1110 if (ai == NULL) in get_ai()
1113 memcpy(ai, pai, sizeof(struct addrinfo)); in get_ai()
1114 ai->ai_addr = (struct sockaddr *)(void *)(ai + 1); in get_ai()
1115 memset(ai->ai_addr, 0, (size_t)afd->a_socklen); in get_ai()
1118 ai->ai_addr->sa_len = afd->a_socklen; in get_ai()
1121 ai->ai_addrlen = afd->a_socklen; in get_ai()
1123 ai->__ai_pad0 = 0; in get_ai()
1125 ai->ai_addr->sa_family = ai->ai_family = afd->a_af; in get_ai()
1126 p = (char *)(void *)(ai->ai_addr); in get_ai()
1128 return ai; in get_ai()
1132 get_portmatch(const struct addrinfo *ai, const char *servname) in get_portmatch() argument
1135 assert(ai != NULL); in get_portmatch()
1138 return get_port(ai, servname, 1); in get_portmatch()
1142 get_port(const struct addrinfo *ai, const char *servname, int matchonly) in get_port() argument
1149 assert(ai != NULL); in get_port()
1154 switch (ai->ai_family) { in get_port()
1164 switch (ai->ai_socktype) { in get_port()
1190 if (ai->ai_flags & AI_NUMERICSERV) in get_port()
1193 switch (ai->ai_socktype) { in get_port()
1211 switch (ai->ai_family) { in get_port()
1214 ai->ai_addr)->sin_port = port; in get_port()
1219 ai->ai_addr)->sin6_port = port; in get_port()
1314 struct addrinfo ai; in getanswer() local
1470 ai = *pai; in getanswer()
1471 ai.ai_family = (type == T_A) ? AF_INET : AF_INET6; in getanswer()
1472 afd = find_afd(ai.ai_family); in getanswer()
1477 cur->ai_next = get_ai(&ai, afd, (const char *)cp); in getanswer()
1504 struct addrinfo *ai; member
1699 scope_dst1 = _get_scope(a1->ai->ai_addr); in _rfc6724_compare()
1703 scope_dst2 = _get_scope(a2->ai->ai_addr); in _rfc6724_compare()
1722 label_dst1 = _get_label(a1->ai->ai_addr); in _rfc6724_compare()
1726 label_dst2 = _get_label(a2->ai->ai_addr); in _rfc6724_compare()
1734 precedence1 = _get_precedence(a1->ai->ai_addr); in _rfc6724_compare()
1735 precedence2 = _get_precedence(a2->ai->ai_addr); in _rfc6724_compare()
1756 if (a1->has_src_addr && a1->ai->ai_addr->sa_family == AF_INET6 && in _rfc6724_compare()
1757 a2->has_src_addr && a2->ai->ai_addr->sa_family == AF_INET6) { in _rfc6724_compare()
1759 const struct sockaddr_in6 *a1_dst = (const struct sockaddr_in6 *)a1->ai->ai_addr; in _rfc6724_compare()
1761 const struct sockaddr_in6 *a2_dst = (const struct sockaddr_in6 *)a2->ai->ai_addr; in _rfc6724_compare()
1869 elems[i].ai = cur; in _rfc6724_sort()
1882 list_sentinel->ai_next = elems[0].ai; in _rfc6724_sort()
1884 elems[i].ai->ai_next = elems[i + 1].ai; in _rfc6724_sort()
1886 elems[nelem - 1].ai->ai_next = NULL; in _rfc6724_sort()
1896 struct addrinfo *ai; in _dns_getaddrinfo() local
1996 ai = getanswer(buf, q.n, q.name, q.qtype, pai); in _dns_getaddrinfo()
1997 if (ai) { in _dns_getaddrinfo()
1998 cur->ai_next = ai; in _dns_getaddrinfo()
2003 ai = getanswer(buf2, q2.n, q2.name, q2.qtype, pai); in _dns_getaddrinfo()
2004 if (ai) in _dns_getaddrinfo()
2005 cur->ai_next = ai; in _dns_getaddrinfo()