Lines Matching refs:pai
277 (ai) = get_ai(pai, (afd), (addr)); \
295 error = get_canonname(pai, (ai), (str)); \
595 struct addrinfo *pai; in android_getaddrinfofornetcontext() local
605 pai = &ai; in android_getaddrinfofornetcontext()
606 pai->ai_flags = 0; in android_getaddrinfofornetcontext()
607 pai->ai_family = PF_UNSPEC; in android_getaddrinfofornetcontext()
608 pai->ai_socktype = ANY; in android_getaddrinfofornetcontext()
609 pai->ai_protocol = ANY; in android_getaddrinfofornetcontext()
610 pai->ai_addrlen = 0; in android_getaddrinfofornetcontext()
611 pai->ai_canonname = NULL; in android_getaddrinfofornetcontext()
612 pai->ai_addr = NULL; in android_getaddrinfofornetcontext()
613 pai->ai_next = NULL; in android_getaddrinfofornetcontext()
634 memcpy(pai, hints, sizeof(*pai)); in android_getaddrinfofornetcontext()
640 if (pai->ai_socktype != ANY && pai->ai_protocol != ANY) { in android_getaddrinfofornetcontext()
642 if (pai->ai_family != ex->e_af) in android_getaddrinfofornetcontext()
648 if (pai->ai_socktype == ex->e_socktype in android_getaddrinfofornetcontext()
649 && pai->ai_protocol != ex->e_protocol) { in android_getaddrinfofornetcontext()
661 if (MATCH_FAMILY(pai->ai_family, PF_INET, 1) in android_getaddrinfofornetcontext()
663 || MATCH_FAMILY(pai->ai_family, PF_INET6, 1) in android_getaddrinfofornetcontext()
666 ai0 = *pai; /* backup *pai */ in android_getaddrinfofornetcontext()
668 if (pai->ai_family == PF_UNSPEC) { in android_getaddrinfofornetcontext()
670 pai->ai_family = PF_INET6; in android_getaddrinfofornetcontext()
672 pai->ai_family = PF_INET; in android_getaddrinfofornetcontext()
675 error = get_portmatch(pai, servname); in android_getaddrinfofornetcontext()
679 *pai = ai0; in android_getaddrinfofornetcontext()
682 ai0 = *pai; in android_getaddrinfofornetcontext()
686 *pai = ai0; in android_getaddrinfofornetcontext()
692 if (!MATCH_FAMILY(pai->ai_family, ex->e_af, WILD_AF(ex))) in android_getaddrinfofornetcontext()
694 if (!MATCH(pai->ai_socktype, ex->e_socktype, WILD_SOCKTYPE(ex))) in android_getaddrinfofornetcontext()
696 if (!MATCH(pai->ai_protocol, ex->e_protocol, WILD_PROTOCOL(ex))) in android_getaddrinfofornetcontext()
699 if (pai->ai_family == PF_UNSPEC) in android_getaddrinfofornetcontext()
700 pai->ai_family = ex->e_af; in android_getaddrinfofornetcontext()
701 if (pai->ai_socktype == ANY && ex->e_socktype != ANY) in android_getaddrinfofornetcontext()
702 pai->ai_socktype = ex->e_socktype; in android_getaddrinfofornetcontext()
703 if (pai->ai_protocol == ANY && ex->e_protocol != ANY) in android_getaddrinfofornetcontext()
704 pai->ai_protocol = ex->e_protocol; in android_getaddrinfofornetcontext()
707 error = explore_null(pai, servname, &cur->ai_next); in android_getaddrinfofornetcontext()
709 error = explore_numeric_scope(pai, hostname, servname, in android_getaddrinfofornetcontext()
729 if (pai->ai_flags & AI_NUMERICHOST) in android_getaddrinfofornetcontext()
746 *pai = ai0; in android_getaddrinfofornetcontext()
749 if (pai->ai_family != ex->e_af) in android_getaddrinfofornetcontext()
752 if (!MATCH(pai->ai_socktype, ex->e_socktype, in android_getaddrinfofornetcontext()
756 if (!MATCH(pai->ai_protocol, ex->e_protocol, in android_getaddrinfofornetcontext()
761 if (pai->ai_socktype == ANY && ex->e_socktype != ANY) in android_getaddrinfofornetcontext()
762 pai->ai_socktype = ex->e_socktype; in android_getaddrinfofornetcontext()
763 if (pai->ai_protocol == ANY && ex->e_protocol != ANY) in android_getaddrinfofornetcontext()
764 pai->ai_protocol = ex->e_protocol; in android_getaddrinfofornetcontext()
767 pai, hostname, servname, &cur->ai_next, netcontext); in android_getaddrinfofornetcontext()
799 explore_fqdn(const struct addrinfo *pai, const char *hostname, in explore_fqdn() argument
813 assert(pai != NULL); in explore_fqdn()
823 if (get_portmatch(pai, servname) != 0) in explore_fqdn()
827 default_dns_files, hostname, pai, netcontext)) { in explore_fqdn()
862 explore_null(const struct addrinfo *pai, const char *servname, in explore_null() argument
871 assert(pai != NULL); in explore_null()
883 s = socket(pai->ai_family, SOCK_DGRAM | SOCK_CLOEXEC, 0); in explore_null()
893 if (get_portmatch(pai, servname) != 0) in explore_null()
896 afd = find_afd(pai->ai_family); in explore_null()
900 if (pai->ai_flags & AI_PASSIVE) { in explore_null()
928 explore_numeric(const struct addrinfo *pai, const char *hostname, in explore_numeric() argument
937 assert(pai != NULL); in explore_numeric()
949 if (get_portmatch(pai, servname) != 0) in explore_numeric()
952 afd = find_afd(pai->ai_family); in explore_numeric()
960 if (pai->ai_family == afd->a_af || in explore_numeric()
961 pai->ai_family == PF_UNSPEC /*?*/) { in explore_numeric()
964 if ((pai->ai_flags & AI_CANONNAME)) { in explore_numeric()
981 if (pai->ai_family == afd->a_af || in explore_numeric()
982 pai->ai_family == PF_UNSPEC /*?*/) { in explore_numeric()
985 if ((pai->ai_flags & AI_CANONNAME)) { in explore_numeric()
1015 explore_numeric_scope(const struct addrinfo *pai, const char *hostname, in explore_numeric_scope() argument
1019 return explore_numeric(pai, hostname, servname, res, hostname); in explore_numeric_scope()
1027 assert(pai != NULL); in explore_numeric_scope()
1035 if (get_portmatch(pai, servname) != 0) in explore_numeric_scope()
1038 afd = find_afd(pai->ai_family); in explore_numeric_scope()
1043 return explore_numeric(pai, hostname, servname, res, hostname); in explore_numeric_scope()
1047 return explore_numeric(pai, hostname, servname, res, hostname); in explore_numeric_scope()
1060 error = explore_numeric(pai, addr, servname, res, hostname); in explore_numeric_scope()
1083 get_canonname(const struct addrinfo *pai, struct addrinfo *ai, const char *str) in get_canonname() argument
1086 assert(pai != NULL); in get_canonname()
1090 if ((pai->ai_flags & AI_CANONNAME) != 0) { in get_canonname()
1099 get_ai(const struct addrinfo *pai, const struct afd *afd, const char *addr) in get_ai() argument
1104 assert(pai != NULL); in get_ai()
1113 memcpy(ai, pai, sizeof(struct addrinfo)); in get_ai()
1311 const struct addrinfo *pai) in getanswer() argument
1330 assert(pai != NULL); in getanswer()
1470 ai = *pai; in getanswer()
1492 (void)get_canonname(pai, sentinel.ai_next, qname); in getanswer()
1494 (void)get_canonname(pai, sentinel.ai_next, canonname); in getanswer()
1899 const struct addrinfo *pai; in _dns_getaddrinfo() local
1906 pai = va_arg(ap, const struct addrinfo *); in _dns_getaddrinfo()
1927 switch (pai->ai_family) { in _dns_getaddrinfo()
1935 if (pai->ai_flags & AI_ADDRCONFIG) { in _dns_getaddrinfo()
1996 ai = getanswer(buf, q.n, q.name, q.qtype, pai); in _dns_getaddrinfo()
2003 ai = getanswer(buf2, q2.n, q2.name, q2.qtype, pai); in _dns_getaddrinfo()
2050 _gethtent(FILE **hostf, const char *name, const struct addrinfo *pai) in _gethtent() argument
2061 assert(pai != NULL); in _gethtent()
2096 hints = *pai; in _gethtent()
2103 res->ai_flags = pai->ai_flags; in _gethtent()
2105 if (pai->ai_flags & AI_CANONNAME) { in _gethtent()
2106 if (get_canonname(pai, res, cname) != 0) { in _gethtent()
2120 const struct addrinfo *pai; in _files_getaddrinfo() local
2126 pai = va_arg(ap, struct addrinfo *); in _files_getaddrinfo()
2133 while ((p = _gethtent(&hostf, name, pai)) != NULL) { in _files_getaddrinfo()